mirror of
https://github.com/espressif/openthread.git
synced 2026-10-02 05:47:40 +00:00
[ncp] add NCP based implementation (empty) of platform InfraIf APIs (#10638)
This implementation will be used on all platforms for NCP nodes (simulation, any vendor platforms). However the simulation platform already has a different implementation. To avoid conflicts, the commit adds a control flag in simulation config so that we can choose whether to enable the simulation implementation.
This commit is contained in:
@@ -45,6 +45,13 @@ if(OT_SIMULATION_MAX_NETWORK_SIZE)
|
||||
target_compile_definitions(ot-simulation-config INTERFACE "OPENTHREAD_SIMULATION_MAX_NETWORK_SIZE=${OT_SIMULATION_MAX_NETWORK_SIZE}")
|
||||
endif()
|
||||
|
||||
option(OT_SIMULATION_INFRA_IF "enable simulation infra if" ON)
|
||||
if (OT_SIMULATION_INFRA_IF)
|
||||
target_compile_definitions(ot-simulation-config INTERFACE "OPENTHREAD_SIMULATION_IMPLEMENT_INFRA_IF=1")
|
||||
else()
|
||||
target_compile_definitions(ot-simulation-config INTERFACE "OPENTHREAD_SIMULATION_IMPLEMENT_INFRA_IF=0")
|
||||
endif()
|
||||
|
||||
if(NOT OT_PLATFORM_CONFIG)
|
||||
set(OT_PLATFORM_CONFIG "openthread-core-simulation-config.h" PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "simul_utils.h"
|
||||
#include "utils/code_utils.h"
|
||||
|
||||
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE && !OPENTHREAD_RADIO
|
||||
#if OPENTHREAD_SIMULATION_IMPLEMENT_INFRA_IF && OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
|
||||
#define DEBUG_LOG 0
|
||||
|
||||
@@ -335,4 +335,4 @@ OT_TOOL_WEAK void otPlatInfraIfRecvIcmp6Nd(otInstance *aInstance,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE && !OPENTHREAD_RADIO
|
||||
#endif // OPENTHREAD_SIMULATION_IMPLEMENT_INFRA_IF && OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
|
||||
@@ -116,3 +116,13 @@
|
||||
#ifndef OPENTHREAD_SIMULATION_MDNS_SOCKET_IMPLEMENT_POSIX
|
||||
#define OPENTHREAD_SIMULATION_MDNS_SOCKET_IMPLEMENT_POSIX 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_SIMULATION_IMPLMENT_INFRA_IF
|
||||
*
|
||||
* Define as 1 for the simulation platform to provide implementation of `otPlatInfra` APIs.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_SIMULATION_IMPLEMENT_INFRA_IF
|
||||
#define OPENTHREAD_SIMULATION_IMPLEMENT_INFRA_IF 1
|
||||
#endif
|
||||
|
||||
@@ -305,7 +305,7 @@ void platformTrelProcess(otInstance *aInstance, const fd_set *aReadFdSet, const
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
|
||||
|
||||
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
#if OPENTHREAD_SIMULATION_IMPLEMENT_INFRA_IF && OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
|
||||
/**
|
||||
* Initializes the platform infra-if module.
|
||||
@@ -339,7 +339,7 @@ void platformInfraIfUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aM
|
||||
*/
|
||||
void platformInfraIfProcess(otInstance *aInstance, const fd_set *aReadFdSet, const fd_set *aWriteFdSet);
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
#endif // OPENTHREAD_SIMULATION_IMPLEMENT_INFRA_IF && OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
|
||||
#if OPENTHREAD_CONFIG_MULTICAST_DNS_ENABLE && OPENTHREAD_SIMULATION_MDNS_SOCKET_IMPLEMENT_POSIX
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ void otSysInit(int aArgCount, char *aArgVector[])
|
||||
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
|
||||
platformTrelInit(speedUpFactor);
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
#if OPENTHREAD_SIMULATION_IMPLEMENT_INFRA_IF && OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
platformInfraIfInit();
|
||||
#endif
|
||||
platformRandomInit();
|
||||
@@ -214,7 +214,7 @@ void otSysDeinit(void)
|
||||
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
|
||||
platformTrelDeinit();
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
#if OPENTHREAD_SIMULATION_IMPLEMENT_INFRA_IF && OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
platformInfraIfDeinit();
|
||||
#endif
|
||||
platformLoggingDeinit();
|
||||
@@ -239,7 +239,7 @@ void otSysProcessDrivers(otInstance *aInstance)
|
||||
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
|
||||
platformTrelUpdateFdSet(&read_fds, &write_fds, &timeout, &max_fd);
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
#if OPENTHREAD_SIMULATION_IMPLEMENT_INFRA_IF && OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
platformInfraIfUpdateFdSet(&read_fds, &write_fds, &max_fd);
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_MULTICAST_DNS_ENABLE && OPENTHREAD_SIMULATION_MDNS_SOCKET_IMPLEMENT_POSIX
|
||||
@@ -276,7 +276,7 @@ void otSysProcessDrivers(otInstance *aInstance)
|
||||
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
|
||||
platformTrelProcess(aInstance, &read_fds, &write_fds);
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
#if OPENTHREAD_SIMULATION_IMPLEMENT_INFRA_IF && OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
platformInfraIfProcess(aInstance, &read_fds, &write_fds);
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_MULTICAST_DNS_ENABLE && OPENTHREAD_SIMULATION_MDNS_SOCKET_IMPLEMENT_POSIX
|
||||
|
||||
Reference in New Issue
Block a user