From 9eb5c1d02c305de6db0b4a23db182b48a2171632 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 7 Apr 2015 15:01:39 -0600 Subject: Modbus: Change to more header files to make them a little more consistent with Nuttx coding stanards. Still not very close --- apps/include/modbus/mbproto.h | 2 +- apps/modbus/ascii/mbascii.h | 43 ++++++++++++++++++++++++------------------- apps/modbus/nuttx/port.h | 7 ++++--- apps/modbus/rtu/mbcrc.h | 21 +++++++++++++-------- apps/modbus/rtu/mbrtu.h | 43 ++++++++++++++++++++++++++----------------- apps/modbus/tcp/mbtcp.h | 13 ++++++++----- 6 files changed, 76 insertions(+), 53 deletions(-) diff --git a/apps/include/modbus/mbproto.h b/apps/include/modbus/mbproto.h index f4f5775b6..f61e858e5 100644 --- a/apps/include/modbus/mbproto.h +++ b/apps/include/modbus/mbproto.h @@ -1,7 +1,7 @@ /**************************************************************************** * apps/include/modbus/mbproto.h * - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * FreeModbus Library: A portable Modbus implementation for Modbus ASCII/RTU. * Copyright (c) 2006 Christian Walter * All rights reserved. * diff --git a/apps/modbus/ascii/mbascii.h b/apps/modbus/ascii/mbascii.h index 983383d03..f4c901a4b 100644 --- a/apps/modbus/ascii/mbascii.h +++ b/apps/modbus/ascii/mbascii.h @@ -1,5 +1,7 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. +/**************************************************************************** + * apps/modbus/ascii/mbascii.h + * + * FreeModbus Library: A portable Modbus implementation for Modbus ASCII/RTU. * Copyright (c) 2006 Christian Walter * All rights reserved. * @@ -25,32 +27,35 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * File: $Id: mbascii.h,v 1.8 2006/12/07 22:10:34 wolti Exp $ - */ + ****************************************************************************/ -#ifndef _MB_ASCII_H -#define _MB_ASCII_H +#ifndef __APPS_MODBUS_ASCII_MBASCII_H +#define __APPS_MODBUS_ASCII_MBASCII_H #ifdef __cplusplus PR_BEGIN_EXTERN_C #endif -#ifdef CONFIG_MB_ASCII_ENABLED -eMBErrorCode eMBASCIIInit( uint8_t slaveAddress, uint8_t ucPort, - speed_t ulBaudRate, eMBParity eParity ); -void eMBASCIIStart( void ); -void eMBASCIIStop( void ); +/**************************************************************************** + * Global Function Prototypes + ****************************************************************************/ -eMBErrorCode eMBASCIIReceive( uint8_t * pucRcvAddress, uint8_t ** pucFrame, - uint16_t * pusLength ); -eMBErrorCode eMBASCIISend( uint8_t slaveAddress, const uint8_t * pucFrame, - uint16_t usLength ); -bool xMBASCIIReceiveFSM( void ); -bool xMBASCIITransmitFSM( void ); -bool xMBASCIITimerT1SExpired( void ); +#ifdef CONFIG_MB_ASCII_ENABLED +eMBErrorCode eMBASCIIInit(uint8_t slaveAddress, uint8_t ucPort, + speed_t ulBaudRate, eMBParity eParity); +void eMBASCIIStart(void); +void eMBASCIIStop(void); +eMBErrorCode eMBASCIIReceive(uint8_t *pucRcvAddress, uint8_t **pucFrame, + uint16_t * pusLength); +eMBErrorCode eMBASCIISend(uint8_t slaveAddress, const uint8_t *pucFrame, + uint16_t usLength); +bool xMBASCIIReceiveFSM(void); +bool xMBASCIITransmitFSM(void); +bool xMBASCIITimerT1SExpired(void); #endif #ifdef __cplusplus PR_END_EXTERN_C #endif -#endif + +#endif /* __APPS_MODBUS_ASCII_MBASCII_H */ diff --git a/apps/modbus/nuttx/port.h b/apps/modbus/nuttx/port.h index fef66b364..c7e730b41 100644 --- a/apps/modbus/nuttx/port.h +++ b/apps/modbus/nuttx/port.h @@ -1,6 +1,7 @@ /**************************************************************************** + * apps/modbus/nuttx/port.h * - * FreeModbus Libary: NuttX Port + * FreeModbus Library: NuttX Port * Based on the FreeModbus Linux port by: * * Copyright (C) 2006 Christian Walter @@ -73,8 +74,8 @@ typedef enum void vMBPortEnterCritical(void); void vMBPortExitCritical(void); -void vMBPortLog(eMBPortLogLevel eLevel, const char * szModule, - const char * szFmt, ...); +void vMBPortLog(eMBPortLogLevel eLevel, const char *szModule, + const char *szFmt, ...); void vMBPortTimerPoll(void); bool xMBPortSerialPoll(void); bool xMBPortSerialSetTimeout(uint32_t dwTimeoutMs); diff --git a/apps/modbus/rtu/mbcrc.h b/apps/modbus/rtu/mbcrc.h index abde43f2c..94bb3751a 100644 --- a/apps/modbus/rtu/mbcrc.h +++ b/apps/modbus/rtu/mbcrc.h @@ -1,5 +1,7 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. +/**************************************************************************** + * apps/modutils/rtu/mbcrc.h + * + * FreeModbus Library: A portable Modbus implementation for Modbus ASCII/RTU. * Copyright (c) 2006 Christian Walter * All rights reserved. * @@ -25,12 +27,15 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * File: $Id: mbcrc.h,v 1.5 2006/12/07 22:10:34 wolti Exp $ - */ + ****************************************************************************/ + +#ifndef __APPS_MODBUS_RTU_MBCRC_H +#define __APPS_MODBUS_RTU_MBCRC_H -#ifndef _MB_CRC_H -#define _MB_CRC_H +/**************************************************************************** + * Global Function Prototypes + ****************************************************************************/ -uint16_t usMBCRC16( uint8_t * pucFrame, uint16_t usLen ); +uint16_t usMBCRC16(uint8_t *pucFrame, uint16_t usLen); -#endif +#endif /* __APPS_MODBUS_RTU_MBCRC_H */ diff --git a/apps/modbus/rtu/mbrtu.h b/apps/modbus/rtu/mbrtu.h index bea5d1eeb..168de25c8 100644 --- a/apps/modbus/rtu/mbrtu.h +++ b/apps/modbus/rtu/mbrtu.h @@ -1,5 +1,7 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. +/**************************************************************************** + * apps/modbus/rtu/mbrtu.h + * + * FreeModbus Library: A portable Modbus implementation for Modbus ASCII/RTU. * Copyright (c) 2006 Christian Walter * All rights reserved. * @@ -25,27 +27,34 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * File: $Id: mbrtu.h,v 1.9 2006/12/07 22:10:34 wolti Exp $ - */ + ****************************************************************************/ -#ifndef _MB_RTU_H -#define _MB_RTU_H +#ifndef __APPS_MODBUS_RTU_MBRTU_H +#define __APPS_MODBUS_RTU_MBRTU_H #ifdef __cplusplus PR_BEGIN_EXTERN_C #endif - eMBErrorCode eMBRTUInit( uint8_t slaveAddress, uint8_t ucPort, speed_t ulBaudRate, - eMBParity eParity ); -void eMBRTUStart( void ); -void eMBRTUStop( void ); -eMBErrorCode eMBRTUReceive( uint8_t * pucRcvAddress, uint8_t ** pucFrame, uint16_t * pusLength ); -eMBErrorCode eMBRTUSend( uint8_t slaveAddress, const uint8_t * pucFrame, uint16_t usLength ); -bool xMBRTUReceiveFSM( void ); -bool xMBRTUTransmitFSM( void ); -bool xMBRTUTimerT15Expired( void ); -bool xMBRTUTimerT35Expired( void ); + +/**************************************************************************** + * Global Function Prototypes + ****************************************************************************/ + +eMBErrorCode eMBRTUInit(uint8_t slaveAddress, uint8_t ucPort, + speed_t ulBaudRate, eMBParity eParity); +void eMBRTUStart(void); +void eMBRTUStop(void); +eMBErrorCode eMBRTUReceive(uint8_t *pucRcvAddress, uint8_t **pucFrame, + uint16_t *pusLength); +eMBErrorCode eMBRTUSend(uint8_t slaveAddress, const uint8_t *pucFrame, + uint16_t usLength); +bool xMBRTUReceiveFSM(void); +bool xMBRTUTransmitFSM(void); +bool xMBRTUTimerT15Expired(void); +bool xMBRTUTimerT35Expired(void); #ifdef __cplusplus PR_END_EXTERN_C #endif -#endif + +#endif /* __APPS_MODBUS_RTU_MBRTU_H */ diff --git a/apps/modbus/tcp/mbtcp.h b/apps/modbus/tcp/mbtcp.h index 3650ca422..9a133f29c 100644 --- a/apps/modbus/tcp/mbtcp.h +++ b/apps/modbus/tcp/mbtcp.h @@ -1,4 +1,6 @@ -/* +/**************************************************************************** + * apps/modbus/tcp/mbtcp.h + * * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. * Copyright (c) 2006 Christian Walter * All rights reserved. @@ -30,14 +32,14 @@ #ifndef __APPS_MODBUS_TCP_MBTCP_H #define __APPS_MODBUS_TCP_MBTCP_H -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - #ifdef __cplusplus PR_BEGIN_EXTERN_C #endif +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + #define MB_TCP_PSEUDO_ADDRESS 255 /**************************************************************************** @@ -55,4 +57,5 @@ eMBErrorCode eMBTCPSend(uint8_t _unused, const uint8_t *pucFrame, #ifdef __cplusplus PR_END_EXTERN_C #endif + #endif /* __APPS_MODBUS_TCP_MBTCP_H */ -- cgit v1.2.3