19
This commit is contained in:
parent
b8dbaa619d
commit
c4c95b2a3b
@ -428,3 +428,20 @@ void qdx_port_tcp_close(qdx_socket_t sock)
|
||||
ring_init(&ctx->rx_ring);
|
||||
free_sock_ctx(ctx);
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
* WCHNET global lock — exposed for task_wchnet_entry in main.c
|
||||
* All WCHNET API calls must be serialized through this mutex.
|
||||
* ============================================================ */
|
||||
|
||||
void qdx_port_net_lock(void)
|
||||
{
|
||||
if (g_wchnet_mutex)
|
||||
xSemaphoreTake(g_wchnet_mutex, portMAX_DELAY);
|
||||
}
|
||||
|
||||
void qdx_port_net_unlock(void)
|
||||
{
|
||||
if (g_wchnet_mutex)
|
||||
xSemaphoreGive(g_wchnet_mutex);
|
||||
}
|
||||
|
||||
@ -168,6 +168,8 @@ extern void qdx_port_sock_recv_notify(uint8_t sockid);
|
||||
extern void qdx_port_sock_connect_notify(uint8_t sockid);
|
||||
extern void qdx_port_sock_disconnect_notify(uint8_t sockid);
|
||||
extern void qdx_port_init(void);
|
||||
extern void qdx_port_net_lock(void);
|
||||
extern void qdx_port_net_unlock(void);
|
||||
|
||||
|
||||
void WCHNET_HandleSockInt(u8 socketid, u8 intstat)
|
||||
@ -247,9 +249,11 @@ static void task_wchnet_entry(void *pvParameters)
|
||||
(void)pvParameters;
|
||||
while (1)
|
||||
{
|
||||
qdx_port_net_lock();
|
||||
WCHNET_MainTask();
|
||||
if (WCHNET_QueryGlobalInt())
|
||||
WCHNET_HandleGlobalInt();
|
||||
qdx_port_net_unlock();
|
||||
vTaskDelay(pdMS_TO_TICKS(5));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user