mirror of
https://github.com/espressif/openthread.git
synced 2026-07-29 15:17:47 +00:00
[config] platform (#4020)
This commit is contained in:
@@ -796,64 +796,6 @@ AC_SUBST(OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC)
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC], [test "${enable_mtd_network_diagnostic}" = "yes"])
|
||||
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC],[${OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC}],[Define to 1 to enable network diagnostic for MTD.])
|
||||
|
||||
#
|
||||
# Platform UDP
|
||||
#
|
||||
|
||||
AC_ARG_ENABLE(platform_udp,
|
||||
[AS_HELP_STRING([--enable-platform-udp],[Enable platform UDP support @<:@default=no@:>@.])],
|
||||
[
|
||||
case "${enableval}" in
|
||||
no|yes)
|
||||
enable_platform_udp=${enableval}
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Invalid value ${enable_platform_udp} for --enable-platform-udp])
|
||||
;;
|
||||
esac
|
||||
],
|
||||
[enable_platform_udp=no])
|
||||
|
||||
if test "$enable_platform_udp" = "yes"; then
|
||||
OPENTHREAD_ENABLE_PLATFORM_UDP=1
|
||||
else
|
||||
OPENTHREAD_ENABLE_PLATFORM_UDP=0
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT(${enable_platform_udp})
|
||||
AC_SUBST(OPENTHREAD_ENABLE_PLATFORM_UDP)
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_PLATFORM_UDP], [test "${enable_platform_udp}" = "yes"])
|
||||
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_PLATFORM_UDP], [${OPENTHREAD_ENABLE_PLATFORM_UDP}], [Define to 1 to enable platform UDP.])
|
||||
|
||||
#
|
||||
# Platform Netif
|
||||
#
|
||||
|
||||
AC_ARG_ENABLE(platform_netif,
|
||||
[AS_HELP_STRING([--enable-platform-netif],[Enable platform Netif support @<:@default=no@:>@.])],
|
||||
[
|
||||
case "${enableval}" in
|
||||
no|yes)
|
||||
enable_platform_netif=${enableval}
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Invalid value ${enable_platform_netif} for --enable-platform-netif])
|
||||
;;
|
||||
esac
|
||||
],
|
||||
[enable_platform_netif=no])
|
||||
|
||||
if test "$enable_platform_netif" = "yes"; then
|
||||
OPENTHREAD_ENABLE_PLATFORM_NETIF=1
|
||||
else
|
||||
OPENTHREAD_ENABLE_PLATFORM_NETIF=0
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT(${enable_platform_netif})
|
||||
AC_SUBST(OPENTHREAD_ENABLE_PLATFORM_NETIF)
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_PLATFORM_NETIF], [test "${enable_platform_netif}" = 'yes'])
|
||||
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_PLATFORM_NETIF], [${OPENTHREAD_ENABLE_PLATFORM_NETIF}], [Define to 1 to enable platform Netif.])
|
||||
|
||||
#
|
||||
# Jam Detection
|
||||
#
|
||||
|
||||
@@ -155,7 +155,7 @@ configure_OPTIONS += --enable-mtd-network-diagnostic
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM_UDP),1)
|
||||
configure_OPTIONS += --enable-platform-udp
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE=1
|
||||
endif
|
||||
|
||||
# Enable features only required for reference device during certification.
|
||||
|
||||
@@ -141,13 +141,13 @@
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to support microsecond timer in platform.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#define OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER 1
|
||||
#ifndef OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -163,13 +163,13 @@
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to support microsecond timer in platform.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#define OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER 1
|
||||
#ifndef OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -283,7 +283,7 @@ void platformAlarmProcess(otInstance *aInstance)
|
||||
}
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
|
||||
if (sIsUsRunning)
|
||||
{
|
||||
@@ -297,7 +297,7 @@ void platformAlarmProcess(otInstance *aInstance)
|
||||
}
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
}
|
||||
|
||||
uint64_t otPlatTimeGet(void)
|
||||
|
||||
@@ -112,12 +112,12 @@
|
||||
#endif // OPENTHREAD_RADIO
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to support microsecond timer in platform.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER 1
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def CLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER
|
||||
|
||||
@@ -121,7 +121,7 @@ int32_t platformAlarmGetNext(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
|
||||
if (sIsUsRunning)
|
||||
{
|
||||
@@ -133,7 +133,7 @@ int32_t platformAlarmGetNext(void)
|
||||
}
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
|
||||
return remaining;
|
||||
}
|
||||
@@ -164,7 +164,7 @@ void platformAlarmProcess(otInstance *aInstance)
|
||||
}
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
|
||||
if (sIsUsRunning)
|
||||
{
|
||||
@@ -178,7 +178,7 @@ void platformAlarmProcess(otInstance *aInstance)
|
||||
}
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
}
|
||||
|
||||
uint64_t otPlatTimeGet(void)
|
||||
|
||||
@@ -339,6 +339,7 @@ HEADERS_COMMON = \
|
||||
config/openthread-core-config-check.h \
|
||||
config/openthread-core-default-config.h \
|
||||
config/parent_search.h \
|
||||
config/platform.h \
|
||||
crypto/aes_ccm.hpp \
|
||||
crypto/aes_ecb.hpp \
|
||||
crypto/ecdsa.hpp \
|
||||
|
||||
@@ -128,7 +128,7 @@ void otUdpForwardReceive(otInstance * aInstance,
|
||||
}
|
||||
#endif // OPENTHREAD_ENABLE_UDP_FORWARD
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
otUdpSocket *otUdpGetSockets(otInstance *aInstance)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
@@ -51,7 +51,7 @@ otDEFINE_ALIGNED_VAR(gInstanceRaw, sizeof(Instance), uint64_t);
|
||||
Instance::Instance(void)
|
||||
: mTaskletScheduler()
|
||||
, mTimerMilliScheduler(*this)
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
, mTimerMicroScheduler(*this)
|
||||
#endif
|
||||
#if OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
|
||||
@@ -308,7 +308,7 @@ private:
|
||||
|
||||
TaskletScheduler mTaskletScheduler;
|
||||
TimerMilliScheduler mTimerMilliScheduler;
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
TimerMicroScheduler mTimerMicroScheduler;
|
||||
#endif
|
||||
|
||||
@@ -703,7 +703,7 @@ template <> inline TimerMilliScheduler &Instance::Get(void)
|
||||
return mTimerMilliScheduler;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
template <> inline TimerMicroScheduler &Instance::Get(void)
|
||||
{
|
||||
return mTimerMicroScheduler;
|
||||
|
||||
@@ -212,7 +212,7 @@ exit:
|
||||
return;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
const TimerScheduler::AlarmApi TimerMicroScheduler::sAlarmMicroApi = {&otPlatAlarmMicroStartAt, &otPlatAlarmMicroStop,
|
||||
&otPlatAlarmMicroGetNow};
|
||||
|
||||
@@ -238,6 +238,6 @@ extern "C" void otPlatAlarmMicroFired(otInstance *aInstance)
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
|
||||
} // namespace ot
|
||||
|
||||
@@ -412,7 +412,7 @@ private:
|
||||
static const AlarmApi sAlarmMilliApi;
|
||||
};
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
class TimerMicroScheduler;
|
||||
|
||||
/**
|
||||
@@ -512,7 +512,7 @@ public:
|
||||
private:
|
||||
static const AlarmApi sAlarmMicroApi;
|
||||
};
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
#ifndef OPENTHREAD_CORE_CONFIG_CHECK_H_
|
||||
#define OPENTHREAD_CORE_CONFIG_CHECK_H_
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP && OPENTHREAD_ENABLE_UDP_FORWARD
|
||||
#error "OPENTHREAD_ENABLE_PLATFORM_UDP and OPENTHREAD_ENABLE_UDP_FORWARD must not both be set."
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE && OPENTHREAD_ENABLE_UDP_FORWARD
|
||||
#error "OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE and OPENTHREAD_ENABLE_UDP_FORWARD must not both be set."
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -75,16 +75,6 @@
|
||||
#define OPENTHREAD_CONFIG_STACK_VERSION_MINOR 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_INFO
|
||||
*
|
||||
* The platform-specific string to insert into the OpenThread version string.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_PLATFORM_INFO
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_INFO "NONE"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS
|
||||
*
|
||||
@@ -247,18 +237,6 @@
|
||||
#define OPENTHREAD_CONFIG_SNTP_MAX_RETRANSMIT 2
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT
|
||||
*
|
||||
* The message pool is managed by platform defined logic when this flag is set.
|
||||
* This feature would typically be used when operating in a multi-threaded system
|
||||
* and multiple threads need to access the message pool.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_STORE_FRAME_COUNTER_AHEAD
|
||||
*
|
||||
@@ -308,36 +286,6 @@
|
||||
#define OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT
|
||||
*
|
||||
* The assert is managed by platform defined logic when this flag is set.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
*
|
||||
* Define to 1 if you want to enable microsecond backoff timer implemented in platform.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#define OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_ENABLE_PLATFORM_EUI64_CUSTOM_SOURCE
|
||||
*
|
||||
* Allows to define custom otPlatRadioGetIeeeEui64 function to retrieve EUI-64.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_ENABLE_PLATFORM_EUI64_CUSTOM_SOURCE
|
||||
#define OPENTHREAD_CONFIG_ENABLE_PLATFORM_EUI64_CUSTOM_SOURCE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_HEAP_SIZE
|
||||
*
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file includes compile-time configurations for platform-specific services.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_PLATFORM_H_
|
||||
#define CONFIG_PLATFORM_H_
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_INFO
|
||||
*
|
||||
* The platform-specific string to insert into the OpenThread version string.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_PLATFORM_INFO
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_INFO "NONE"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT
|
||||
*
|
||||
* The message pool is managed by platform defined logic when this flag is set.
|
||||
* This feature would typically be used when operating in a multi-threaded system
|
||||
* and multiple threads need to access the message pool.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT
|
||||
*
|
||||
* The assert is managed by platform defined logic when this flag is set.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
|
||||
*
|
||||
* Define to 1 to enable platform NETIF support.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
*
|
||||
* Define to 1 to enable platform UDP support.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to enable microsecond backoff timer implemented in platform.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 0
|
||||
#endif
|
||||
|
||||
#endif // CONFIG_PLATFORM_H_
|
||||
@@ -256,7 +256,7 @@ void SubMac::StartCsmaBackoff(void)
|
||||
otPlatRadioSleep(&GetInstance());
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
mTimer.Start(backoff);
|
||||
#else
|
||||
mTimer.Start(backoff / 1000UL);
|
||||
@@ -304,7 +304,7 @@ void SubMac::HandleTransmitStarted(Frame &aFrame)
|
||||
{
|
||||
if (ShouldHandleAckTimeout() && aFrame.GetAckRequest())
|
||||
{
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
mTimer.Start(kAckTimeout * 1000UL);
|
||||
#else
|
||||
mTimer.Start(kAckTimeout);
|
||||
|
||||
@@ -413,7 +413,7 @@ private:
|
||||
kMinBackoff = 1, ///< Minimum backoff (milliseconds).
|
||||
kAckTimeout = 16, ///< Timeout for waiting on an ACK (milliseconds).
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
kEnergyScanRssiSampleInterval = 128, ///< RSSI sample interval during energy scan, 128 usec
|
||||
#else
|
||||
kEnergyScanRssiSampleInterval = 1, ///< RSSI sample interval during energy scan, 1 ms
|
||||
@@ -467,7 +467,7 @@ private:
|
||||
Callbacks mCallbacks;
|
||||
otLinkPcapCallback mPcapCallback;
|
||||
void * mPcapCallbackContext;
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
TimerMicro mTimer;
|
||||
#else
|
||||
TimerMilli mTimer;
|
||||
|
||||
@@ -732,7 +732,7 @@ otError Ip6::ProcessReceiveCallback(const Message & aMessage,
|
||||
|
||||
break;
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP == 0
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE == 0
|
||||
case kCoapUdpPort:
|
||||
|
||||
// do not pass TMF messages
|
||||
@@ -742,7 +742,7 @@ otError Ip6::ProcessReceiveCallback(const Message & aMessage,
|
||||
}
|
||||
|
||||
break;
|
||||
#endif // OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
|
||||
default:
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
+10
-10
@@ -48,7 +48,7 @@ using ot::Encoding::BigEndian::HostSwap16;
|
||||
namespace ot {
|
||||
namespace Ip6 {
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
static bool IsMle(Instance &aInstance, uint16_t aPort)
|
||||
{
|
||||
#if OPENTHREAD_FTD
|
||||
@@ -79,13 +79,13 @@ otError UdpSocket::Open(otUdpReceive aHandler, void *aContext)
|
||||
mHandler = aHandler;
|
||||
mContext = aContext;
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
SuccessOrExit(error = otPlatUdpSocket(this));
|
||||
#endif
|
||||
|
||||
Get<Udp>().AddSocket(*this);
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
exit:
|
||||
#endif
|
||||
return error;
|
||||
@@ -102,12 +102,12 @@ otError UdpSocket::Bind(const SockAddr &aSockAddr)
|
||||
do
|
||||
{
|
||||
mSockName.mPort = Get<Udp>().GetEphemeralPort();
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
error = otPlatUdpBind(this);
|
||||
#endif
|
||||
} while (error != OT_ERROR_NONE);
|
||||
}
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
else if (!IsMle(GetInstance(), mSockName.mPort))
|
||||
{
|
||||
error = otPlatUdpBind(this);
|
||||
@@ -123,7 +123,7 @@ otError UdpSocket::Connect(const SockAddr &aSockAddr)
|
||||
|
||||
mPeerName = aSockAddr;
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
if (!IsMle(GetInstance(), mSockName.mPort))
|
||||
{
|
||||
error = otPlatUdpConnect(this);
|
||||
@@ -136,7 +136,7 @@ otError UdpSocket::Close(void)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
SuccessOrExit(error = otPlatUdpClose(this));
|
||||
#endif
|
||||
|
||||
@@ -144,7 +144,7 @@ otError UdpSocket::Close(void)
|
||||
memset(&mSockName, 0, sizeof(mSockName));
|
||||
memset(&mPeerName, 0, sizeof(mPeerName));
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
exit:
|
||||
#endif
|
||||
return error;
|
||||
@@ -185,7 +185,7 @@ otError UdpSocket::SendTo(Message &aMessage, const MessageInfo &aMessageInfo)
|
||||
|
||||
messageInfoLocal.SetSockPort(GetSockName().mPort);
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
if (!IsMle(GetInstance(), mSockName.mPort) &&
|
||||
!(mSockName.mPort == ot::kCoapUdpPort && aMessage.GetSubType() == Message::kSubTypeJoinerEntrust))
|
||||
{
|
||||
@@ -377,7 +377,7 @@ otError Udp::HandleMessage(Message &aMessage, MessageInfo &aMessageInfo)
|
||||
aMessageInfo.mPeerPort = udpHeader.GetSourcePort();
|
||||
aMessageInfo.mSockPort = udpHeader.GetDestinationPort();
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
VerifyOrExit(IsMle(GetInstance(), aMessageInfo.mSockPort));
|
||||
#endif
|
||||
|
||||
|
||||
@@ -328,7 +328,7 @@ public:
|
||||
*/
|
||||
void UpdateChecksum(Message &aMessage, uint16_t aChecksum);
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
otUdpSocket *GetUdpSockets(void) { return mSockets; }
|
||||
#endif
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
#include "config/mac.h"
|
||||
#include "config/mle.h"
|
||||
#include "config/parent_search.h"
|
||||
#include "config/platform.h"
|
||||
|
||||
#if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE || OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE || \
|
||||
OPENTHREAD_CONFIG_COMMISSIONER_ENABLE || OPENTHREAD_CONFIG_JOINER_ENABLE
|
||||
|
||||
@@ -92,7 +92,7 @@ configure_OPTIONS += --host=$(HOST)
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM_NETIF),1)
|
||||
configure_OPTIONS += --enable-platform-netif
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE=1
|
||||
endif
|
||||
|
||||
ifneq ($(READLINE),)
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
|
||||
#if OPENTHREAD_POSIX_APP_TYPE == OPENTHREAD_POSIX_APP_TYPE_NCP
|
||||
otNcpInit(instance);
|
||||
#elif OPENTHREAD_POSIX_APP_TYPE == OPENTHREAD_POSIX_APP_TYPE_CLI
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_NETIF
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
|
||||
otSysInitNetif(instance);
|
||||
#endif
|
||||
#if OPENTHREAD_USE_CONSOLE
|
||||
|
||||
@@ -51,13 +51,8 @@ libopenthread_posix_a_SOURCES = \
|
||||
sim.c \
|
||||
system.c \
|
||||
uart.c \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
libopenthread_posix_a_SOURCES += \
|
||||
udp.cpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
noinst_HEADERS = \
|
||||
openthread-system.h \
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
static bool sIsMsRunning = false;
|
||||
static uint32_t sMsAlarm = 0;
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
static bool sIsUsRunning = false;
|
||||
static uint32_t sUsAlarm = 0;
|
||||
#endif
|
||||
@@ -96,7 +96,7 @@ void otPlatAlarmMilliStop(otInstance *aInstance)
|
||||
sIsMsRunning = false;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
uint32_t otPlatAlarmMicroGetNow(void)
|
||||
{
|
||||
return (uint32_t)(otSysGetTime());
|
||||
@@ -116,7 +116,7 @@ void otPlatAlarmMicroStop(otInstance *aInstance)
|
||||
|
||||
sIsUsRunning = false;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
|
||||
void platformAlarmUpdateTimeout(struct timeval *aTimeout)
|
||||
{
|
||||
@@ -133,7 +133,7 @@ void platformAlarmUpdateTimeout(struct timeval *aTimeout)
|
||||
remaining -= (now % US_PER_MS);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
if (sIsUsRunning)
|
||||
{
|
||||
int32_t usRemaining = (int32_t)(sUsAlarm - (uint32_t)now);
|
||||
@@ -143,7 +143,7 @@ void platformAlarmUpdateTimeout(struct timeval *aTimeout)
|
||||
remaining = usRemaining;
|
||||
}
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
|
||||
exit:
|
||||
if (remaining <= 0)
|
||||
@@ -191,7 +191,7 @@ void platformAlarmProcess(otInstance *aInstance)
|
||||
}
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
|
||||
if (sIsUsRunning)
|
||||
{
|
||||
@@ -205,5 +205,5 @@ void platformAlarmProcess(otInstance *aInstance)
|
||||
}
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
#include "common/logging.hpp"
|
||||
#include "net/ip6_address.hpp"
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_NETIF
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
|
||||
|
||||
#ifndef OPENTHREAD_POSIX_TUN_DEVICE
|
||||
#define OPENTHREAD_POSIX_TUN_DEVICE "/dev/net/tun"
|
||||
@@ -410,7 +410,7 @@ void platformNetifInit(otInstance *aInstance)
|
||||
VerifyOrExit(sTunIndex > 0);
|
||||
|
||||
strncpy(sTunName, ifr.ifr_name, sizeof(sTunName));
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
platformUdpInit(sTunName);
|
||||
#endif
|
||||
|
||||
@@ -504,4 +504,4 @@ exit:
|
||||
return;
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_PLATFORM_NETIF
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
|
||||
|
||||
@@ -153,7 +153,7 @@ otInstance *otSysInit(int aArgCount, char *aArgVector[])
|
||||
platformAlarmInit(speedUpFactor);
|
||||
platformRadioInit(radioFile, radioConfig, reset);
|
||||
platformRandomInit();
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP && OPENTHREAD_ENABLE_PLATFORM_NETIF == 0
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE && OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE == 0
|
||||
platformUdpInit(getenv("PLATFORM_NETIF"));
|
||||
#endif
|
||||
|
||||
@@ -173,7 +173,7 @@ otInstance *otSysInit(int aArgCount, char *aArgVector[])
|
||||
return instance;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_NETIF
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
|
||||
void otSysInitNetif(otInstance *aInstance)
|
||||
{
|
||||
platformNetifInit(aInstance);
|
||||
@@ -226,10 +226,10 @@ void otSysMainloopUpdate(otInstance *aInstance, otSysMainloopContext *aMainloop)
|
||||
platformAlarmUpdateTimeout(&aMainloop->mTimeout);
|
||||
platformUartUpdateFdSet(&aMainloop->mReadFdSet, &aMainloop->mWriteFdSet, &aMainloop->mErrorFdSet,
|
||||
&aMainloop->mMaxFd);
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
platformUdpUpdateFdSet(aInstance, &aMainloop->mReadFdSet, &aMainloop->mMaxFd);
|
||||
#endif
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_NETIF
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
|
||||
platformNetifUpdateFdSet(&aMainloop->mReadFdSet, &aMainloop->mWriteFdSet, &aMainloop->mErrorFdSet,
|
||||
&aMainloop->mMaxFd);
|
||||
#endif
|
||||
@@ -299,10 +299,10 @@ void otSysMainloopProcess(otInstance *aInstance, const otSysMainloopContext *aMa
|
||||
#endif
|
||||
platformUartProcess(&aMainloop->mReadFdSet, &aMainloop->mWriteFdSet, &aMainloop->mErrorFdSet);
|
||||
platformAlarmProcess(aInstance);
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_NETIF
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
|
||||
platformNetifProcess(&aMainloop->mReadFdSet, &aMainloop->mWriteFdSet, &aMainloop->mErrorFdSet);
|
||||
#endif
|
||||
#if OPENTHREAD_ENABLE_PLATFORM_UDP
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
platformUdpProcess(aInstance, &aMainloop->mReadFdSet);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@
|
||||
|
||||
#include "common/code_utils.hpp"
|
||||
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
|
||||
static uint32_t sPlatNetifIndex = 0;
|
||||
|
||||
static const size_t kMaxUdpSize = 1280;
|
||||
@@ -447,3 +449,5 @@ void platformUdpProcess(otInstance *aInstance, const fd_set *aReadFdSet)
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
#endif // #if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
|
||||
|
||||
@@ -82,7 +82,7 @@ void FuzzerPlatformProcess(otInstance *aInstance)
|
||||
otPlatAlarmMilliFired(aInstance);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
|
||||
if (sAlarmMicro.isRunning && sAlarmNow >= sAlarmMicro.fire)
|
||||
{
|
||||
sAlarmMicro.isRunning = false;
|
||||
|
||||
Reference in New Issue
Block a user