函数 tcpip_adapter_start与函数tcpip_adapter_start_api

yunyong
Posts: 2
Joined: Fri May 10, 2019 9:07 am

函数 tcpip_adapter_start与函数tcpip_adapter_start_api

Postby yunyong » Sun Jun 09, 2019 2:40 pm

#define TCPIP_ADAPTER_IPC_CALL(_if, _mac, _ip, _data, _fn) do {\
tcpip_adapter_api_msg_t msg;\
memset(&msg, 0, sizeof(msg));\
msg.tcpip_if = (_if);\
msg.mac = (uint8_t*)(_mac);\
msg.ip_info = (tcpip_adapter_ip_info_t*)(_ip);\
msg.data = (void*)(_data);\
msg.api_fn = (_fn);\
if (TCPIP_ADAPTER_IPC_REMOTE == tcpip_adapter_ipc_check(&msg)) {\
ESP_LOGV(TAG, "check: remote, if=%d fn=%p\n", (_if), (_fn));\
return msg.ret;\
} else {\
ESP_LOGV(TAG, "check: local, if=%d fn=%p\n", (_if), (_fn));\
}\
} while(0)

static esp_err_t tcpip_adapter_start(tcpip_adapter_if_t tcpip_if, uint8_t *mac, tcpip_adapter_ip_info_t *ip_info)
{
netif_init_fn netif_init;
TCPIP_ADAPTER_IPC_CALL(tcpip_if, mac, ip_info, 0, tcpip_adapter_start_api);
........
}

static esp_err_t tcpip_adapter_start_api(tcpip_adapter_api_msg_t * msg)
{
return tcpip_adapter_start(msg->tcpip_if, msg->mac, msg->ip_info);
}
请问
1. tcpip_adapter_start_api 函数的功能是什么??或者说tcpip_adapter_start中调用tcpip_adapter_start_api 的目的是什么??
2.这两个函数为什么可以相互调用??这样不会陷入无限嵌套吗??,我没搞懂程序中是退出无限嵌套的条件。

Who is online

Users browsing this forum: No registered users and 66 guests