diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-07-21 21:23:18 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-07-21 21:23:18 +0000 |
commit | d9714b556703561a0abcbe71970b1cd6922168a6 (patch) | |
tree | 70b7893243b8ee2e6b8b5fd95106c4ab962699c5 /apps/modbus/mb.c | |
parent | ebf70f8a79eb8ef23bc1d99938768ef06c466119 (diff) | |
download | nuttx-d9714b556703561a0abcbe71970b1cd6922168a6.tar.gz nuttx-d9714b556703561a0abcbe71970b1cd6922168a6.tar.bz2 nuttx-d9714b556703561a0abcbe71970b1cd6922168a6.zip |
Use NuttX types in FreeModBus port; Add FreeModBus demo at apps/examples/modbus; Add new termios APIs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4964 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/modbus/mb.c')
-rw-r--r-- | apps/modbus/mb.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/apps/modbus/mb.c b/apps/modbus/mb.c index 421a25567..0e5c8a920 100644 --- a/apps/modbus/mb.c +++ b/apps/modbus/mb.c @@ -62,7 +62,7 @@ /* ----------------------- Static variables ---------------------------------*/ -static UCHAR ucMBAddress; +static uint8_t ucMBAddress; static eMBMode eMBCurrentMode; static enum @@ -85,12 +85,12 @@ static pvMBFrameClose pvMBFrameCloseCur; * an external event has happend which includes a timeout or the reception * or transmission of a character. */ -BOOL( *pxMBFrameCBByteReceived ) ( void ); -BOOL( *pxMBFrameCBTransmitterEmpty ) ( void ); -BOOL( *pxMBPortCBTimerExpired ) ( void ); +bool( *pxMBFrameCBByteReceived ) ( void ); +bool( *pxMBFrameCBTransmitterEmpty ) ( void ); +bool( *pxMBPortCBTimerExpired ) ( void ); -BOOL( *pxMBFrameCBReceiveFSMCur ) ( void ); -BOOL( *pxMBFrameCBTransmitFSMCur ) ( void ); +bool( *pxMBFrameCBReceiveFSMCur ) ( void ); +bool( *pxMBFrameCBTransmitFSMCur ) ( void ); /* An array of Modbus functions handlers which associates Modbus function * codes with implementing functions. @@ -130,7 +130,7 @@ static xMBFunctionHandler xFuncHandlers[CONFIG_MB_FUNC_HANDLERS_MAX] = { /* ----------------------- Start implementation -----------------------------*/ eMBErrorCode -eMBInit( eMBMode eMode, UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eParity ) +eMBInit( eMBMode eMode, uint8_t ucSlaveAddress, uint8_t ucPort, uint32_t ulBaudRate, eMBParity eParity ) { eMBErrorCode eStatus = MB_ENOERR; @@ -197,7 +197,7 @@ eMBInit( eMBMode eMode, UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eM #ifdef CONFIG_MB_TCP_ENABLED eMBErrorCode -eMBTCPInit( USHORT ucTCPPort ) +eMBTCPInit( uint16_t ucTCPPort ) { eMBErrorCode eStatus = MB_ENOERR; @@ -226,7 +226,7 @@ eMBTCPInit( USHORT ucTCPPort ) #endif eMBErrorCode -eMBRegisterCB( UCHAR ucFunctionCode, pxMBFunctionHandler pxHandler ) +eMBRegisterCB( uint8_t ucFunctionCode, pxMBFunctionHandler pxHandler ) { int i; eMBErrorCode eStatus; @@ -334,10 +334,10 @@ eMBDisable( void ) eMBErrorCode eMBPoll( void ) { - static UCHAR *ucMBFrame; - static UCHAR ucRcvAddress; - static UCHAR ucFunctionCode; - static USHORT usLength; + static uint8_t *ucMBFrame; + static uint8_t ucRcvAddress; + static uint8_t ucFunctionCode; + static uint16_t usLength; static eMBException eException; int i; @@ -352,7 +352,7 @@ eMBPoll( void ) /* Check if there is a event available. If not return control to caller. * Otherwise we will handle the event. */ - if( xMBPortEventGet( &eEvent ) == TRUE ) + if( xMBPortEventGet( &eEvent ) == true ) { switch ( eEvent ) { @@ -396,7 +396,7 @@ eMBPoll( void ) { /* An exception occured. Build an error frame. */ usLength = 0; - ucMBFrame[usLength++] = ( UCHAR )( ucFunctionCode | MB_FUNC_ERROR ); + ucMBFrame[usLength++] = ( uint8_t )( ucFunctionCode | MB_FUNC_ERROR ); ucMBFrame[usLength++] = eException; } if( ( eMBCurrentMode == MB_ASCII ) && CONFIG_MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS ) |