Modbus: Change to more header files to make them a little more consistent with Nuttx coding stanards. Still not very close

This commit is contained in:
Gregory Nutt
2015-04-07 15:01:39 -06:00
parent af7f087ccf
commit b1151ef033
6 changed files with 76 additions and 53 deletions

View File

@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* apps/include/modbus/mbproto.h * 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 <wolti@sil.at> * Copyright (c) 2006 Christian Walter <wolti@sil.at>
* All rights reserved. * All rights reserved.
* *

View File

@@ -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 <wolti@sil.at> * Copyright (c) 2006 Christian Walter <wolti@sil.at>
* All rights reserved. * All rights reserved.
* *
@@ -25,32 +27,35 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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 #ifndef __APPS_MODBUS_ASCII_MBASCII_H
#define _MB_ASCII_H #define __APPS_MODBUS_ASCII_MBASCII_H
#ifdef __cplusplus #ifdef __cplusplus
PR_BEGIN_EXTERN_C PR_BEGIN_EXTERN_C
#endif #endif
#ifdef CONFIG_MB_ASCII_ENABLED /****************************************************************************
eMBErrorCode eMBASCIIInit( uint8_t slaveAddress, uint8_t ucPort, * Global Function Prototypes
speed_t ulBaudRate, eMBParity eParity ); ****************************************************************************/
void eMBASCIIStart( void );
void eMBASCIIStop( void );
eMBErrorCode eMBASCIIReceive( uint8_t * pucRcvAddress, uint8_t ** pucFrame, #ifdef CONFIG_MB_ASCII_ENABLED
uint16_t * pusLength ); eMBErrorCode eMBASCIIInit(uint8_t slaveAddress, uint8_t ucPort,
eMBErrorCode eMBASCIISend( uint8_t slaveAddress, const uint8_t * pucFrame, speed_t ulBaudRate, eMBParity eParity);
uint16_t usLength ); void eMBASCIIStart(void);
bool xMBASCIIReceiveFSM( void ); void eMBASCIIStop(void);
bool xMBASCIITransmitFSM( void ); eMBErrorCode eMBASCIIReceive(uint8_t *pucRcvAddress, uint8_t **pucFrame,
bool xMBASCIITimerT1SExpired( void ); 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 #endif
#ifdef __cplusplus #ifdef __cplusplus
PR_END_EXTERN_C PR_END_EXTERN_C
#endif #endif
#endif
#endif /* __APPS_MODBUS_ASCII_MBASCII_H */

View File

@@ -1,6 +1,7 @@
/**************************************************************************** /****************************************************************************
* apps/modbus/nuttx/port.h
* *
* FreeModbus Libary: NuttX Port * FreeModbus Library: NuttX Port
* Based on the FreeModbus Linux port by: * Based on the FreeModbus Linux port by:
* *
* Copyright (C) 2006 Christian Walter <wolti@sil.at> * Copyright (C) 2006 Christian Walter <wolti@sil.at>
@@ -73,8 +74,8 @@ typedef enum
void vMBPortEnterCritical(void); void vMBPortEnterCritical(void);
void vMBPortExitCritical(void); void vMBPortExitCritical(void);
void vMBPortLog(eMBPortLogLevel eLevel, const char * szModule, void vMBPortLog(eMBPortLogLevel eLevel, const char *szModule,
const char * szFmt, ...); const char *szFmt, ...);
void vMBPortTimerPoll(void); void vMBPortTimerPoll(void);
bool xMBPortSerialPoll(void); bool xMBPortSerialPoll(void);
bool xMBPortSerialSetTimeout(uint32_t dwTimeoutMs); bool xMBPortSerialSetTimeout(uint32_t dwTimeoutMs);

View File

@@ -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 <wolti@sil.at> * Copyright (c) 2006 Christian Walter <wolti@sil.at>
* All rights reserved. * All rights reserved.
* *
@@ -25,12 +27,15 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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 _MB_CRC_H #ifndef __APPS_MODBUS_RTU_MBCRC_H
#define _MB_CRC_H #define __APPS_MODBUS_RTU_MBCRC_H
uint16_t usMBCRC16( uint8_t * pucFrame, uint16_t usLen ); /****************************************************************************
* Global Function Prototypes
****************************************************************************/
#endif uint16_t usMBCRC16(uint8_t *pucFrame, uint16_t usLen);
#endif /* __APPS_MODBUS_RTU_MBCRC_H */

View File

@@ -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 <wolti@sil.at> * Copyright (c) 2006 Christian Walter <wolti@sil.at>
* All rights reserved. * All rights reserved.
* *
@@ -25,27 +27,34 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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 #ifndef __APPS_MODBUS_RTU_MBRTU_H
#define _MB_RTU_H #define __APPS_MODBUS_RTU_MBRTU_H
#ifdef __cplusplus #ifdef __cplusplus
PR_BEGIN_EXTERN_C PR_BEGIN_EXTERN_C
#endif #endif
eMBErrorCode eMBRTUInit( uint8_t slaveAddress, uint8_t ucPort, speed_t ulBaudRate,
eMBParity eParity ); /****************************************************************************
void eMBRTUStart( void ); * Global Function Prototypes
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 ); eMBErrorCode eMBRTUInit(uint8_t slaveAddress, uint8_t ucPort,
bool xMBRTUReceiveFSM( void ); speed_t ulBaudRate, eMBParity eParity);
bool xMBRTUTransmitFSM( void ); void eMBRTUStart(void);
bool xMBRTUTimerT15Expired( void ); void eMBRTUStop(void);
bool xMBRTUTimerT35Expired( 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 #ifdef __cplusplus
PR_END_EXTERN_C PR_END_EXTERN_C
#endif #endif
#endif
#endif /* __APPS_MODBUS_RTU_MBRTU_H */

View File

@@ -1,4 +1,6 @@
/* /****************************************************************************
* apps/modbus/tcp/mbtcp.h
*
* FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
* Copyright (c) 2006 Christian Walter <wolti@sil.at> * Copyright (c) 2006 Christian Walter <wolti@sil.at>
* All rights reserved. * All rights reserved.
@@ -30,14 +32,14 @@
#ifndef __APPS_MODBUS_TCP_MBTCP_H #ifndef __APPS_MODBUS_TCP_MBTCP_H
#define __APPS_MODBUS_TCP_MBTCP_H #define __APPS_MODBUS_TCP_MBTCP_H
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
PR_BEGIN_EXTERN_C PR_BEGIN_EXTERN_C
#endif #endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define MB_TCP_PSEUDO_ADDRESS 255 #define MB_TCP_PSEUDO_ADDRESS 255
/**************************************************************************** /****************************************************************************
@@ -55,4 +57,5 @@ eMBErrorCode eMBTCPSend(uint8_t _unused, const uint8_t *pucFrame,
#ifdef __cplusplus #ifdef __cplusplus
PR_END_EXTERN_C PR_END_EXTERN_C
#endif #endif
#endif /* __APPS_MODBUS_TCP_MBTCP_H */ #endif /* __APPS_MODBUS_TCP_MBTCP_H */