forked from espressif/esp-modbus
freertos: Remove legacy data types
This commit removes the usage of all legacy FreeRTOS data types that are exposed via configENABLE_BACKWARD_COMPATIBILITY. Legacy types can still be used by enabling CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY. * Original commit: espressif/esp-idf@57fd78f5ba
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* SPDX-FileContributor: 2016-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*/
|
||||
/*
|
||||
* FreeModbus Libary: ESP32 Port Demo Application
|
||||
@ -47,7 +47,7 @@
|
||||
#include "sdkconfig.h"
|
||||
#include "port_serial_slave.h"
|
||||
/* ----------------------- Variables ----------------------------------------*/
|
||||
static xQueueHandle xQueueHdl;
|
||||
static QueueHandle_t xQueueHdl;
|
||||
|
||||
#define MB_EVENT_QUEUE_SIZE (6)
|
||||
#define MB_EVENT_QUEUE_TIMEOUT (pdMS_TO_TICKS(CONFIG_FMB_EVENT_QUEUE_TIMEOUT))
|
||||
@ -113,7 +113,7 @@ xMBPortEventGet(eMBEventType * peEvent)
|
||||
return xEventHappened;
|
||||
}
|
||||
|
||||
xQueueHandle
|
||||
QueueHandle_t
|
||||
xMBPortEventGetHandle(void)
|
||||
{
|
||||
if(xQueueHdl != NULL)
|
||||
|
@ -87,19 +87,19 @@ static void vxMBTCPPortMStoTimeVal(USHORT usTimeoutMs, struct timeval *pxTimeout
|
||||
pxTimeout->tv_usec = (usTimeoutMs - (pxTimeout->tv_sec * 1000)) * 1000;
|
||||
}
|
||||
|
||||
static xQueueHandle xMBTCPPortRespQueueCreate(void)
|
||||
static QueueHandle_t xMBTCPPortRespQueueCreate(void)
|
||||
{
|
||||
xQueueHandle xRespQueueHandle = xQueueCreate(2, sizeof(void*));
|
||||
QueueHandle_t xRespQueueHandle = xQueueCreate(2, sizeof(void*));
|
||||
MB_PORT_CHECK((xRespQueueHandle != NULL), NULL, "TCP respond queue creation failure.");
|
||||
return xRespQueueHandle;
|
||||
}
|
||||
|
||||
static void vMBTCPPortRespQueueDelete(xQueueHandle xRespQueueHandle)
|
||||
static void vMBTCPPortRespQueueDelete(QueueHandle_t xRespQueueHandle)
|
||||
{
|
||||
vQueueDelete(xRespQueueHandle);
|
||||
}
|
||||
|
||||
static void* vxMBTCPPortRespQueueRecv(xQueueHandle xRespQueueHandle)
|
||||
static void* vxMBTCPPortRespQueueRecv(QueueHandle_t xRespQueueHandle)
|
||||
{
|
||||
void* pvResp = NULL;
|
||||
MB_PORT_CHECK(xRespQueueHandle != NULL, NULL, "Response queue is not initialized.");
|
||||
@ -111,7 +111,7 @@ static void* vxMBTCPPortRespQueueRecv(xQueueHandle xRespQueueHandle)
|
||||
return pvResp;
|
||||
}
|
||||
|
||||
static BOOL vxMBTCPPortRespQueueSend(xQueueHandle xRespQueueHandle, void* pvResp)
|
||||
static BOOL vxMBTCPPortRespQueueSend(QueueHandle_t xRespQueueHandle, void* pvResp)
|
||||
{
|
||||
MB_PORT_CHECK(xRespQueueHandle != NULL, FALSE, "Response queue is not initialized.");
|
||||
BaseType_t xStatus = xQueueSend(xConfig.xRespQueueHandle,
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* SPDX-FileContributor: 2016-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*/
|
||||
/*
|
||||
* FreeModbus Libary: ESP32 TCP Port
|
||||
@ -76,7 +76,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
TaskHandle_t xMbTcpTaskHandle; /*!< Server task handle */
|
||||
xQueueHandle xRespQueueHandle; /*!< Response queue handle */
|
||||
QueueHandle_t xRespQueueHandle; /*!< Response queue handle */
|
||||
MbClientInfo_t* pxCurClientInfo; /*!< Current client info */
|
||||
MbClientInfo_t** pxMbClientInfo; /*!< Pointers to information about connected clients */
|
||||
USHORT usPort; /*!< TCP/UDP port number */
|
||||
|
@ -559,7 +559,7 @@ Example to get event when holding or input registers accessed in the slave:
|
||||
#define MB_READ_MASK (MB_EVENT_INPUT_REG_RD | MB_EVENT_HOLDING_REG_RD)
|
||||
#define MB_WRITE_MASK (MB_EVENT_HOLDING_REG_WR)
|
||||
#define MB_READ_WRITE_MASK (MB_READ_MASK | MB_WRITE_MASK)
|
||||
#define MB_PAR_INFO_GET_TOUT (10 / portTICK_RATE_MS)
|
||||
#define MB_PAR_INFO_GET_TOUT (10 / portTICK_PERIOD_MS)
|
||||
....
|
||||
|
||||
// The function blocks while waiting for register access
|
||||
|
@ -24,11 +24,11 @@
|
||||
|
||||
// Timeout to update cid over Modbus
|
||||
#define UPDATE_CIDS_TIMEOUT_MS (500)
|
||||
#define UPDATE_CIDS_TIMEOUT_TICS (UPDATE_CIDS_TIMEOUT_MS / portTICK_RATE_MS)
|
||||
#define UPDATE_CIDS_TIMEOUT_TICS (UPDATE_CIDS_TIMEOUT_MS / portTICK_PERIOD_MS)
|
||||
|
||||
// Timeout between polls
|
||||
#define POLL_TIMEOUT_MS (1)
|
||||
#define POLL_TIMEOUT_TICS (POLL_TIMEOUT_MS / portTICK_RATE_MS)
|
||||
#define POLL_TIMEOUT_TICS (POLL_TIMEOUT_MS / portTICK_PERIOD_MS)
|
||||
|
||||
// The macro to get offset for parameter in the appropriate structure
|
||||
#define HOLD_OFFSET(field) ((uint16_t)(offsetof(holding_reg_params_t, field) + 1))
|
||||
|
@ -32,11 +32,11 @@
|
||||
|
||||
// Timeout to update cid over Modbus
|
||||
#define UPDATE_CIDS_TIMEOUT_MS (500)
|
||||
#define UPDATE_CIDS_TIMEOUT_TICS (UPDATE_CIDS_TIMEOUT_MS / portTICK_RATE_MS)
|
||||
#define UPDATE_CIDS_TIMEOUT_TICS (UPDATE_CIDS_TIMEOUT_MS / portTICK_PERIOD_MS)
|
||||
|
||||
// Timeout between polls
|
||||
#define POLL_TIMEOUT_MS (1)
|
||||
#define POLL_TIMEOUT_TICS (POLL_TIMEOUT_MS / portTICK_RATE_MS)
|
||||
#define POLL_TIMEOUT_TICS (POLL_TIMEOUT_MS / portTICK_PERIOD_MS)
|
||||
#define MB_MDNS_PORT (502)
|
||||
|
||||
// The macro to get offset for parameter in the appropriate structure
|
||||
|
Reference in New Issue
Block a user