mirror of
https://github.com/espressif/openthread.git
synced 2026-08-14 22:57:46 +00:00
Tasklet API cleanup.
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\core\api\link_raw_api.cpp" />
|
||||
<ClCompile Include="..\..\src\core\api\tasklet_api.cpp" />
|
||||
<ClCompile Include="..\..\src\core\coap\coap_base.cpp" />
|
||||
<ClCompile Include="..\..\src\core\coap\coap_client.cpp" />
|
||||
<ClCompile Include="..\..\src\core\coap\coap_header.cpp" />
|
||||
|
||||
@@ -63,6 +63,9 @@
|
||||
<ClCompile Include="..\..\src\core\api\link_raw_api.cpp">
|
||||
<Filter>Source Files\api</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\core\api\tasklet_api.cpp">
|
||||
<Filter>Source Files\api</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\core\coap\coap_base.cpp">
|
||||
<Filter>Source Files\coap</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\core\api\tasklet_api.cpp" />
|
||||
<ClCompile Include="..\..\src\core\coap\coap_base.cpp" />
|
||||
<ClCompile Include="..\..\src\core\coap\coap_client.cpp" />
|
||||
<ClCompile Include="..\..\src\core\coap\coap_header.cpp" />
|
||||
|
||||
@@ -63,6 +63,9 @@
|
||||
<ClCompile Include="..\..\src\core\api\link_raw_api.cpp">
|
||||
<Filter>Source Files\api</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\core\api\tasklet_api.cpp">
|
||||
<Filter>Source Files\api</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\core\coap\coap_base.cpp">
|
||||
<Filter>Source Files\coap</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread.h>
|
||||
#include <openthread-diag.h>
|
||||
#include <openthread-tasklet.h>
|
||||
#include <openthread/tasklet.h>
|
||||
#include <cli/cli-uart.h>
|
||||
#include <platform/platform.h>
|
||||
#include <assert.h>
|
||||
@@ -52,7 +52,7 @@ void otPlatFree(void *aPtr)
|
||||
}
|
||||
#endif
|
||||
|
||||
void otSignalTaskletPending(otInstance *aInstance)
|
||||
void otTaskletsSignalPending(otInstance *aInstance)
|
||||
{
|
||||
(void)aInstance;
|
||||
}
|
||||
@@ -91,7 +91,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (1)
|
||||
{
|
||||
otProcessQueuedTasklets(sInstance);
|
||||
otTaskletsProcess(sInstance);
|
||||
PlatformProcessDrivers(sInstance);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread.h>
|
||||
#include <openthread-diag.h>
|
||||
#include <openthread-tasklet.h>
|
||||
#include <openthread/tasklet.h>
|
||||
#include <common/debug.hpp>
|
||||
#include <ncp/ncp.h>
|
||||
#include <platform/platform.h>
|
||||
@@ -52,7 +52,7 @@ void otPlatFree(void *aPtr)
|
||||
}
|
||||
#endif
|
||||
|
||||
void otSignalTaskletPending(otInstance *aInstance)
|
||||
void otTaskletsSignalPending(otInstance *aInstance)
|
||||
{
|
||||
(void)aInstance;
|
||||
}
|
||||
@@ -91,7 +91,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (1)
|
||||
{
|
||||
otProcessQueuedTasklets(sInstance);
|
||||
otTaskletsProcess(sInstance);
|
||||
PlatformProcessDrivers(sInstance);
|
||||
}
|
||||
|
||||
|
||||
@@ -1032,7 +1032,7 @@ otLwfEventWorkerThread(
|
||||
else if (status == STATUS_WAIT_0 + 4) // EventWorkerThreadProcessTasklets fired
|
||||
{
|
||||
// Process all tasklets that were indicated to us from OpenThread
|
||||
otProcessQueuedTasklets(pFilter->otCtx);
|
||||
otTaskletsProcess(pFilter->otCtx);
|
||||
}
|
||||
else if (status == STATUS_WAIT_0 + 5) // SendNetBufferListComplete fired
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ RtlCopyBufferToMdl(
|
||||
#include <openthread.h>
|
||||
#include <openthread-icmp6.h>
|
||||
#include <openthread-ip6.h>
|
||||
#include <openthread-tasklet.h>
|
||||
#include <openthread/tasklet.h>
|
||||
#include <commissioning/commissioner.h>
|
||||
#include <commissioning/joiner.h>
|
||||
#include <dhcp6/dhcp6_server.h>
|
||||
|
||||
@@ -284,9 +284,9 @@ ThreadError otPlatRandomSecureGet(uint16_t aInputLength, uint8_t *aOutput, uint1
|
||||
return kThreadError_None;
|
||||
}
|
||||
|
||||
void otSignalTaskletPending(_In_ otInstance *otCtx)
|
||||
void otTaskletsSignalPending(_In_ otInstance *otCtx)
|
||||
{
|
||||
LogVerbose(DRIVER_DEFAULT, "otSignalTaskletPending");
|
||||
LogVerbose(DRIVER_DEFAULT, "otTaskletsSignalPending");
|
||||
PMS_FILTER pFilter = otCtxToFilter(otCtx);
|
||||
otLwfEventProcessingIndicateNewTasklet(pFilter);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#endif
|
||||
|
||||
#include <openthread.h>
|
||||
#include <openthread-tasklet.h>
|
||||
#include <openthread/tasklet.h>
|
||||
#include <platform/alarm.h>
|
||||
|
||||
uint32_t NODE_ID = 1;
|
||||
@@ -97,7 +97,7 @@ void PlatformProcessDrivers(otInstance *aInstance)
|
||||
platformRadioUpdateFdSet(&read_fds, &write_fds, &max_fd);
|
||||
platformAlarmUpdateTimeout(&timeout);
|
||||
|
||||
if (!otAreTaskletsPending(aInstance))
|
||||
if (!otTaskletsArePending(aInstance))
|
||||
{
|
||||
rval = select(max_fd + 1, &read_fds, &write_fds, &error_fds, &timeout);
|
||||
|
||||
|
||||
@@ -70,7 +70,6 @@ include_HEADERS = \
|
||||
openthread-ip6.h \
|
||||
openthread-jam-detection.h \
|
||||
openthread-message.h \
|
||||
openthread-tasklet.h \
|
||||
openthread-types.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
|
||||
#include <openthread-types.h>
|
||||
|
||||
#include "openthread/tasklet.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -30,6 +30,7 @@ include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||
|
||||
openthread_headers = \
|
||||
coap.h \
|
||||
tasklet.h \
|
||||
udp.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief
|
||||
* This file includes the platform abstraction for the tasklet service.
|
||||
* This file defines the OpenThread API for Tasklets.
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_TASKLET_H_
|
||||
#define OPENTHREAD_TASKLET_H_
|
||||
|
||||
#include <openthread-types.h>
|
||||
#include "openthread-types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -56,7 +56,7 @@ extern "C" {
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*/
|
||||
void otProcessQueuedTasklets(otInstance *aInstance);
|
||||
void otTaskletsProcess(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Indicates whether or not OpenThread has tasklets pending.
|
||||
@@ -66,7 +66,7 @@ void otProcessQueuedTasklets(otInstance *aInstance);
|
||||
* @retval TRUE If there are tasklets pending.
|
||||
* @retval FALSE If there are no tasklets pending.
|
||||
*/
|
||||
bool otAreTaskletsPending(otInstance *aInstance);
|
||||
bool otTaskletsArePending(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* OpenThread calls this function when the tasklet queue transitions from empty to non-empty.
|
||||
@@ -74,7 +74,7 @@ bool otAreTaskletsPending(otInstance *aInstance);
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
*/
|
||||
extern void otSignalTaskletPending(otInstance *aInstance);
|
||||
extern void otTaskletsSignalPending(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* @}
|
||||
@@ -40,6 +40,7 @@ CPPFLAGS_COMMON = \
|
||||
|
||||
SOURCES_COMMON = \
|
||||
openthread.cpp \
|
||||
api/tasklet_api.cpp \
|
||||
api/udp_api.cpp \
|
||||
coap/coap_base.cpp \
|
||||
coap/coap_client.cpp \
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 implements the OpenThread Tasklet API.
|
||||
*/
|
||||
|
||||
#define WPP_NAME "tasklet_api.tmh"
|
||||
|
||||
#include "openthread/tasklet.h"
|
||||
|
||||
#include "openthread-instance.h"
|
||||
#include "common/logging.hpp"
|
||||
|
||||
using namespace Thread;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void otTaskletsProcess(otInstance *aInstance)
|
||||
{
|
||||
otLogFuncEntry();
|
||||
aInstance->mIp6.mTaskletScheduler.ProcessQueuedTasklets();
|
||||
otLogFuncExit();
|
||||
}
|
||||
|
||||
bool otTaskletsArePending(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mIp6.mTaskletScheduler.AreTaskletsPending();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
@@ -68,7 +68,7 @@ ThreadError TaskletScheduler::Post(Tasklet &aTasklet)
|
||||
{
|
||||
mHead = &aTasklet;
|
||||
mTail = &aTasklet;
|
||||
otSignalTaskletPending(aTasklet.mScheduler.GetIp6()->GetInstance());
|
||||
otTaskletsSignalPending(aTasklet.mScheduler.GetIp6()->GetInstance());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -118,7 +118,7 @@ void TaskletScheduler::ProcessQueuedTasklets(void)
|
||||
{
|
||||
if (mHead != NULL)
|
||||
{
|
||||
otSignalTaskletPending(cur->mScheduler.GetIp6()->GetInstance());
|
||||
otTaskletsSignalPending(cur->mScheduler.GetIp6()->GetInstance());
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -34,8 +34,7 @@
|
||||
#ifndef TASKLET_HPP_
|
||||
#define TASKLET_HPP_
|
||||
|
||||
#include <openthread-types.h>
|
||||
#include <openthread-tasklet.h>
|
||||
#include "openthread/tasklet.h"
|
||||
|
||||
namespace Thread {
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
#include <common/message.hpp>
|
||||
#include <common/new.hpp>
|
||||
#include <common/settings.hpp>
|
||||
#include <common/tasklet.hpp>
|
||||
#include <common/timer.hpp>
|
||||
#include <crypto/mbedtls.hpp>
|
||||
#include <net/icmp6.hpp>
|
||||
@@ -97,18 +96,6 @@ extern "C" {
|
||||
static void HandleActiveScanResult(void *aContext, Mac::Frame *aFrame);
|
||||
static void HandleEnergyScanResult(void *aContext, otEnergyScanResult *aResult);
|
||||
|
||||
void otProcessQueuedTasklets(otInstance *aInstance)
|
||||
{
|
||||
otLogFuncEntry();
|
||||
aInstance->mIp6.mTaskletScheduler.ProcessQueuedTasklets();
|
||||
otLogFuncExit();
|
||||
}
|
||||
|
||||
bool otAreTaskletsPending(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mIp6.mTaskletScheduler.AreTaskletsPending();
|
||||
}
|
||||
|
||||
uint8_t otGetChannel(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().GetChannel();
|
||||
|
||||
@@ -32,11 +32,11 @@
|
||||
#include <platform/platform.h>
|
||||
#include <platform/radio.h>
|
||||
|
||||
extern "C" void otSignalTaskletPending(otInstance *)
|
||||
extern "C" void otTaskletsSignalPending(otInstance *)
|
||||
{
|
||||
}
|
||||
|
||||
extern "C" bool otAreTaskletsPending(otInstance *)
|
||||
extern "C" bool otTaskletsArePending(otInstance *)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ void TestFuzz(uint32_t aSeconds)
|
||||
|
||||
while (otPlatAlarmGetNow() < tEnd)
|
||||
{
|
||||
otProcessQueuedTasklets(aInstance);
|
||||
otTaskletsProcess(aInstance);
|
||||
|
||||
if (g_testPlatAlarmSet && otPlatAlarmGetNow() >= g_testPlatAlarmNext)
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
void otSignalTaskletPending(otInstance *)
|
||||
void otTaskletsSignalPending(otInstance *)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#endif
|
||||
|
||||
#include <openthread.h>
|
||||
#include <openthread-tasklet.h>
|
||||
#include "openthread/tasklet.h"
|
||||
|
||||
#include <common/code_utils.hpp>
|
||||
#include <platform/alarm.h>
|
||||
|
||||
Reference in New Issue
Block a user