Merge branch 'feature/sync_subrepo_with_esp_idf' into 'master'

fix synchronization issues of subrepo in esp-idf

Closes IDFCI-1541

See merge request idf/esp-modbus!23
This commit is contained in:
Alex Lisitsyn
2022-12-08 22:54:28 +08:00
9 changed files with 15 additions and 17 deletions

View File

@ -158,7 +158,7 @@ eMBASCIIReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength )
{ {
return MB_EIO; return MB_EIO;
} }
ENTER_CRITICAL_SECTION( ); ENTER_CRITICAL_SECTION( );
assert( usFrameLength < MB_SER_PDU_SIZE_MAX ); assert( usFrameLength < MB_SER_PDU_SIZE_MAX );
@ -193,7 +193,7 @@ eMBASCIISend( UCHAR ucSlaveAddress, const UCHAR * pucFrame, USHORT usLength )
eMBErrorCode eStatus = MB_ENOERR; eMBErrorCode eStatus = MB_ENOERR;
UCHAR usLRC; UCHAR usLRC;
/* Check if the receiver is still in idle state. If not we where too /* Check if the receiver is still in idle state. If not we where too
* slow with processing the received frame and the master sent another * slow with processing the received frame and the master sent another
* frame on the network. We have to abort sending the frame. * frame on the network. We have to abort sending the frame.

View File

@ -437,7 +437,7 @@ xMBMasterASCIITransmitFSM( void )
/* Notify the task which called eMBMasterASCIISend that the frame has /* Notify the task which called eMBMasterASCIISend that the frame has
* been sent. */ * been sent. */
case STATE_M_TX_NOTIFY: case STATE_M_TX_NOTIFY:
xFrameIsBroadcast = ( ucMasterASCIISndBuf[MB_SEND_BUF_PDU_OFF - MB_SER_PDU_PDU_OFF] xFrameIsBroadcast = ( ucMasterASCIISndBuf[MB_SEND_BUF_PDU_OFF - MB_SER_PDU_PDU_OFF]
== MB_ADDRESS_BROADCAST ) ? TRUE : FALSE; == MB_ADDRESS_BROADCAST ) ? TRUE : FALSE;
vMBMasterRequestSetType( xFrameIsBroadcast ); vMBMasterRequestSetType( xFrameIsBroadcast );
eSndState = STATE_M_TX_XFWR; eSndState = STATE_M_TX_XFWR;

View File

@ -163,7 +163,7 @@ BOOL xMBMasterPortSerialGetByte( CHAR * pucByte );
BOOL xMBMasterPortSerialPutByte( CHAR ucByte ); BOOL xMBMasterPortSerialPutByte( CHAR ucByte );
BOOL xMBMasterPortSerialGetResponse( UCHAR **ppucMBSerialFrame, USHORT * usSerialLength ); BOOL xMBMasterPortSerialGetResponse( UCHAR **ppucMBSerialFrame, USHORT * usSerialLength );
BOOL xMBMasterPortSerialSendRequest( UCHAR *pucMBSerialFrame, USHORT usSerialLength ); BOOL xMBMasterPortSerialSendRequest( UCHAR *pucMBSerialFrame, USHORT usSerialLength );

View File

@ -363,8 +363,8 @@ eMBMasterPoll( void )
MB_PORT_CHECK(ucMBRcvFrame, MB_EILLSTATE, "Receive buffer initialization fail."); MB_PORT_CHECK(ucMBRcvFrame, MB_EILLSTATE, "Receive buffer initialization fail.");
MB_PORT_CHECK(ucMBSendFrame, MB_EILLSTATE, "Send buffer initialization fail."); MB_PORT_CHECK(ucMBSendFrame, MB_EILLSTATE, "Send buffer initialization fail.");
// Check if the frame is for us. If not ,send an error process event. // Check if the frame is for us. If not ,send an error process event.
if ( ( eStatus == MB_ENOERR ) && ( ucRcvAddress == ucMBMasterGetDestAddress() ) ) if ( ( eStatus == MB_ENOERR ) && ( ( ucRcvAddress == ucMBMasterGetDestAddress() )
{ || ( ucRcvAddress == MB_TCP_PSEUDO_ADDRESS) ) ) {
if ( ( ucMBRcvFrame[MB_PDU_FUNC_OFF] & ~MB_FUNC_ERROR ) == ( ucMBSendFrame[MB_PDU_FUNC_OFF] ) ) { if ( ( ucMBRcvFrame[MB_PDU_FUNC_OFF] & ~MB_FUNC_ERROR ) == ( ucMBSendFrame[MB_PDU_FUNC_OFF] ) ) {
ESP_LOGD(MB_PORT_TAG, "%s: Packet data received successfully (%u).", __func__, eStatus); ESP_LOGD(MB_PORT_TAG, "%s: Packet data received successfully (%u).", __func__, eStatus);
ESP_LOG_BUFFER_HEX_LEVEL("POLL receive buffer", (void*)ucMBRcvFrame, (uint16_t)usLength, ESP_LOG_DEBUG); ESP_LOG_BUFFER_HEX_LEVEL("POLL receive buffer", (void*)ucMBRcvFrame, (uint16_t)usLength, ESP_LOG_DEBUG);
@ -376,9 +376,7 @@ eMBMasterPoll( void )
vMBMasterSetErrorType(EV_ERROR_RECEIVE_DATA); vMBMasterSetErrorType(EV_ERROR_RECEIVE_DATA);
( void ) xMBMasterPortEventPost( EV_MASTER_ERROR_PROCESS ); ( void ) xMBMasterPortEventPost( EV_MASTER_ERROR_PROCESS );
} }
} } else {
else
{
vMBMasterSetErrorType(EV_ERROR_RECEIVE_DATA); vMBMasterSetErrorType(EV_ERROR_RECEIVE_DATA);
( void ) xMBMasterPortEventPost( EV_MASTER_ERROR_PROCESS ); ( void ) xMBMasterPortEventPost( EV_MASTER_ERROR_PROCESS );
ESP_LOGD( MB_PORT_TAG, "%s: Packet data receive failed (addr=%u)(%u).", ESP_LOGD( MB_PORT_TAG, "%s: Packet data receive failed (addr=%u)(%u).",

View File

@ -230,12 +230,12 @@ eMBMasterRTUSend( UCHAR ucSlaveAddress, const UCHAR * pucFrame, USHORT usLength
/* Activate the transmitter. */ /* Activate the transmitter. */
eSndState = STATE_M_TX_XMIT; eSndState = STATE_M_TX_XMIT;
if ( xMBMasterPortSerialSendRequest( ( UCHAR * ) pucMasterSndBufferCur, usMasterSndBufferCount ) == FALSE ) if ( xMBMasterPortSerialSendRequest( ( UCHAR * ) pucMasterSndBufferCur, usMasterSndBufferCount ) == FALSE )
{ {
eStatus = MB_EIO; eStatus = MB_EIO;
} }
// The place to enable RS485 driver // The place to enable RS485 driver
vMBMasterPortSerialEnable( FALSE, TRUE ); vMBMasterPortSerialEnable( FALSE, TRUE );
} }

View File

@ -91,7 +91,7 @@ BOOL xMBPortSerialWaitEvent(QueueHandle_t xMbUartQueue, uart_event_t* pxEvent, U
* received buffer and its length using parameters. * received buffer and its length using parameters.
*/ */
__attribute__ ((weak)) __attribute__ ((weak))
BOOL xMBMasterPortSerialGetResponse( UCHAR **ppucMBSerialFrame, USHORT * usSerialLength ) BOOL xMBMasterPortSerialGetResponse( UCHAR **ppucMBSerialFrame, USHORT * usSerialLength )
{ {
ESP_LOGD(MB_PORT_TAG, " %s default", __func__); ESP_LOGD(MB_PORT_TAG, " %s default", __func__);
return TRUE; return TRUE;

View File

@ -298,7 +298,7 @@ static int xMBTCPPortMasterGetBuf(MbSlaveInfo_t* pxInfo, UCHAR* pucDstBuf, USHOR
// Receive data from connected client // Receive data from connected client
while (usBytesLeft > 0) { while (usBytesLeft > 0) {
xMBTCPPortMasterCheckShutdown(); xMBTCPPortMasterCheckShutdown();
xLength = recv(pxInfo->xSockId, pucBuf, usBytesLeft, 0); xLength = recv(pxInfo->xSockId, pucBuf, usBytesLeft, 0);
if (xLength < 0) { if (xLength < 0) {
if (errno == EAGAIN) { if (errno == EAGAIN) {
// Read timeout occurred, check the timeout and return // Read timeout occurred, check the timeout and return
@ -334,7 +334,7 @@ static int vMBTCPPortMasterReadPacket(MbSlaveInfo_t* pxInfo)
if (pxInfo) { if (pxInfo) {
MB_PORT_CHECK((pxInfo->xSockId > 0), -1, "Try to read incorrect socket = #%d.", pxInfo->xSockId); MB_PORT_CHECK((pxInfo->xSockId > 0), -1, "Try to read incorrect socket = #%d.", pxInfo->xSockId);
// Read packet header // Read packet header
xRet = xMBTCPPortMasterGetBuf(pxInfo, &pxInfo->pucRcvBuf[0], xRet = xMBTCPPortMasterGetBuf(pxInfo, &pxInfo->pucRcvBuf[0],
MB_TCP_UID, xMBTCPPortMasterGetRespTimeLeft(pxInfo)); MB_TCP_UID, xMBTCPPortMasterGetRespTimeLeft(pxInfo));
if (xRet < 0) { if (xRet < 0) {
pxInfo->xRcvErr = xRet; pxInfo->xRcvErr = xRet;
@ -348,7 +348,7 @@ static int vMBTCPPortMasterReadPacket(MbSlaveInfo_t* pxInfo)
// If we have received the MBAP header we can analyze it and calculate // If we have received the MBAP header we can analyze it and calculate
// the number of bytes left to complete the current request. // the number of bytes left to complete the current request.
xLength = (int)MB_TCP_GET_FIELD(pxInfo->pucRcvBuf, MB_TCP_LEN); xLength = (int)MB_TCP_GET_FIELD(pxInfo->pucRcvBuf, MB_TCP_LEN);
xRet = xMBTCPPortMasterGetBuf(pxInfo, &pxInfo->pucRcvBuf[MB_TCP_UID], xRet = xMBTCPPortMasterGetBuf(pxInfo, &pxInfo->pucRcvBuf[MB_TCP_UID],
xLength, xMBTCPPortMasterGetRespTimeLeft(pxInfo)); xLength, xMBTCPPortMasterGetRespTimeLeft(pxInfo));
if (xRet < 0) { if (xRet < 0) {
pxInfo->xRcvErr = xRet; pxInfo->xRcvErr = xRet;

View File

@ -565,7 +565,7 @@ static void vMBTCPPortServerTask(void *pvParameters)
pxClientInfo->xSockId, pxClientInfo->pcIpAddr, xErr); pxClientInfo->xSockId, pxClientInfo->pcIpAddr, xErr);
break; break;
} }
if (xShutdownSemaphore) { if (xShutdownSemaphore) {
xSemaphoreGive(xShutdownSemaphore); xSemaphoreGive(xShutdownSemaphore);
vTaskDelete(NULL); vTaskDelete(NULL);

View File

@ -1,4 +1,4 @@
version: "1.0.6" version: "1.0.7"
description: ESP-MODBUS is the official Modbus library for Espressif SoCs. description: ESP-MODBUS is the official Modbus library for Espressif SoCs.
url: https://github.com/espressif/esp-modbus url: https://github.com/espressif/esp-modbus
dependencies: dependencies: