From 1ef7d093e1e89b2b4a0e38705cd76a5cfcfb6252 Mon Sep 17 00:00:00 2001 From: Konstantin Kondrashov Date: Wed, 13 Feb 2019 20:10:53 +0800 Subject: [PATCH] freemodbus: Fix remove critical_sections Closes: https://github.com/espressif/esp-idf/issues/3009 --- components/freemodbus/modbus/ascii/mbascii.c | 6 ------ components/freemodbus/modbus/rtu/mbrtu.c | 6 ------ 2 files changed, 12 deletions(-) diff --git a/components/freemodbus/modbus/ascii/mbascii.c b/components/freemodbus/modbus/ascii/mbascii.c index c513457ea..55490903c 100644 --- a/components/freemodbus/modbus/ascii/mbascii.c +++ b/components/freemodbus/modbus/ascii/mbascii.c @@ -110,7 +110,6 @@ eMBASCIIInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eP eMBErrorCode eStatus = MB_ENOERR; ( void )ucSlaveAddress; - ENTER_CRITICAL_SECTION( ); ucMBLFCharacter = MB_ASCII_DEFAULT_LF; if( xMBPortSerialInit( ucPort, ulBaudRate, 7, eParity ) != TRUE ) @@ -122,7 +121,6 @@ eMBASCIIInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eP eStatus = MB_EPORTERR; } - EXIT_CRITICAL_SECTION( ); return eStatus; } @@ -130,10 +128,8 @@ eMBASCIIInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eP void eMBASCIIStart( void ) { - ENTER_CRITICAL_SECTION( ); vMBPortSerialEnable( TRUE, FALSE ); eRcvState = STATE_RX_IDLE; - EXIT_CRITICAL_SECTION( ); /* No special startup required for ASCII. */ ( void )xMBPortEventPost( EV_READY ); @@ -142,10 +138,8 @@ eMBASCIIStart( void ) void eMBASCIIStop( void ) { - ENTER_CRITICAL_SECTION( ); vMBPortSerialEnable( FALSE, FALSE ); vMBPortTimersDisable( ); - EXIT_CRITICAL_SECTION( ); } eMBErrorCode diff --git a/components/freemodbus/modbus/rtu/mbrtu.c b/components/freemodbus/modbus/rtu/mbrtu.c index 28bd29622..b0b84deb0 100644 --- a/components/freemodbus/modbus/rtu/mbrtu.c +++ b/components/freemodbus/modbus/rtu/mbrtu.c @@ -84,7 +84,6 @@ eMBRTUInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity ePar ULONG usTimerT35_50us; ( void )ucSlaveAddress; - ENTER_CRITICAL_SECTION( ); /* Modbus RTU uses 8 Databits. */ if( xMBPortSerialInit( ucPort, ulBaudRate, 8, eParity ) != TRUE ) @@ -117,7 +116,6 @@ eMBRTUInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity ePar eStatus = MB_EPORTERR; } } - EXIT_CRITICAL_SECTION( ); return eStatus; } @@ -125,7 +123,6 @@ eMBRTUInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity ePar void eMBRTUStart( void ) { - ENTER_CRITICAL_SECTION( ); /* 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 * to STATE_RX_IDLE. This makes sure that we delay startup of the @@ -135,16 +132,13 @@ eMBRTUStart( void ) vMBPortSerialEnable( TRUE, FALSE ); vMBPortTimersEnable( ); - EXIT_CRITICAL_SECTION( ); } void eMBRTUStop( void ) { - ENTER_CRITICAL_SECTION( ); vMBPortSerialEnable( FALSE, FALSE ); vMBPortTimersDisable( ); - EXIT_CRITICAL_SECTION( ); } // The lines below are required to suppress GCC warnings about unused but set variable 'xFrameReceived'