freemodbus: Fix remove critical_sections

Closes: https://github.com/espressif/esp-idf/issues/3009
This commit is contained in:
Konstantin Kondrashov 2019-02-13 20:10:53 +08:00 committed by bot
parent 5f3bd38d3d
commit 1ef7d093e1
2 changed files with 0 additions and 12 deletions

View file

@ -110,7 +110,6 @@ eMBASCIIInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eP
eMBErrorCode eStatus = MB_ENOERR; eMBErrorCode eStatus = MB_ENOERR;
( void )ucSlaveAddress; ( void )ucSlaveAddress;
ENTER_CRITICAL_SECTION( );
ucMBLFCharacter = MB_ASCII_DEFAULT_LF; ucMBLFCharacter = MB_ASCII_DEFAULT_LF;
if( xMBPortSerialInit( ucPort, ulBaudRate, 7, eParity ) != TRUE ) if( xMBPortSerialInit( ucPort, ulBaudRate, 7, eParity ) != TRUE )
@ -122,7 +121,6 @@ eMBASCIIInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eP
eStatus = MB_EPORTERR; eStatus = MB_EPORTERR;
} }
EXIT_CRITICAL_SECTION( );
return eStatus; return eStatus;
} }
@ -130,10 +128,8 @@ eMBASCIIInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eP
void void
eMBASCIIStart( void ) eMBASCIIStart( void )
{ {
ENTER_CRITICAL_SECTION( );
vMBPortSerialEnable( TRUE, FALSE ); vMBPortSerialEnable( TRUE, FALSE );
eRcvState = STATE_RX_IDLE; eRcvState = STATE_RX_IDLE;
EXIT_CRITICAL_SECTION( );
/* No special startup required for ASCII. */ /* No special startup required for ASCII. */
( void )xMBPortEventPost( EV_READY ); ( void )xMBPortEventPost( EV_READY );
@ -142,10 +138,8 @@ eMBASCIIStart( void )
void void
eMBASCIIStop( void ) eMBASCIIStop( void )
{ {
ENTER_CRITICAL_SECTION( );
vMBPortSerialEnable( FALSE, FALSE ); vMBPortSerialEnable( FALSE, FALSE );
vMBPortTimersDisable( ); vMBPortTimersDisable( );
EXIT_CRITICAL_SECTION( );
} }
eMBErrorCode eMBErrorCode

View file

@ -84,7 +84,6 @@ eMBRTUInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity ePar
ULONG usTimerT35_50us; ULONG usTimerT35_50us;
( void )ucSlaveAddress; ( void )ucSlaveAddress;
ENTER_CRITICAL_SECTION( );
/* Modbus RTU uses 8 Databits. */ /* Modbus RTU uses 8 Databits. */
if( xMBPortSerialInit( ucPort, ulBaudRate, 8, eParity ) != TRUE ) if( xMBPortSerialInit( ucPort, ulBaudRate, 8, eParity ) != TRUE )
@ -117,7 +116,6 @@ eMBRTUInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity ePar
eStatus = MB_EPORTERR; eStatus = MB_EPORTERR;
} }
} }
EXIT_CRITICAL_SECTION( );
return eStatus; return eStatus;
} }
@ -125,7 +123,6 @@ eMBRTUInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity ePar
void void
eMBRTUStart( void ) eMBRTUStart( void )
{ {
ENTER_CRITICAL_SECTION( );
/* Initially the receiver is in the state STATE_RX_INIT. we start /* Initially the receiver is in the state STATE_RX_INIT. we start
* the timer and if no character is received within t3.5 we change * the timer and if no character is received within t3.5 we change
* to STATE_RX_IDLE. This makes sure that we delay startup of the * to STATE_RX_IDLE. This makes sure that we delay startup of the
@ -135,16 +132,13 @@ eMBRTUStart( void )
vMBPortSerialEnable( TRUE, FALSE ); vMBPortSerialEnable( TRUE, FALSE );
vMBPortTimersEnable( ); vMBPortTimersEnable( );
EXIT_CRITICAL_SECTION( );
} }
void void
eMBRTUStop( void ) eMBRTUStop( void )
{ {
ENTER_CRITICAL_SECTION( );
vMBPortSerialEnable( FALSE, FALSE ); vMBPortSerialEnable( FALSE, FALSE );
vMBPortTimersDisable( ); vMBPortTimersDisable( );
EXIT_CRITICAL_SECTION( );
} }
// The lines below are required to suppress GCC warnings about unused but set variable 'xFrameReceived' // The lines below are required to suppress GCC warnings about unused but set variable 'xFrameReceived'