mirror of
https://github.com/espressif/openthread.git
synced 2026-08-20 17:39:51 +00:00
[efr32] add otSysEventSignalPending calls and weak function to efr32mg12 (#3999)
Initialization of NVIC and priorities.
This commit is contained in:
committed by
Jonathan Hui
parent
06a914da0a
commit
6d7098c0a8
@@ -46,6 +46,7 @@ libopenthread_efr32mg12_a_CPPFLAGS =
|
||||
-D__START=main \
|
||||
-D__STARTUP_CLEAR_BSS \
|
||||
-DPLATFORM_HEADER=\"@top_builddir@/third_party/silabs/gecko_sdk_suite/v2.6/platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
|
||||
-DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\" \
|
||||
-Wno-sign-compare \
|
||||
-DCORTEXM3 \
|
||||
-DPHY=EMBER_PHY_RAIL \
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "openthread-system.h"
|
||||
#include <openthread/config.h>
|
||||
#include <openthread/platform/alarm-milli.h>
|
||||
#include <openthread/platform/diag.h>
|
||||
@@ -67,6 +68,7 @@ static bool sIsRunning = false;
|
||||
|
||||
static void RAILCb_TimerExpired(RAIL_Handle_t aHandle)
|
||||
{
|
||||
otSysEventSignalPending();
|
||||
}
|
||||
|
||||
void efr32AlarmInit(void)
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "openthread-system.h"
|
||||
#include <openthread/config.h>
|
||||
#include <openthread/platform/alarm-milli.h>
|
||||
#include <openthread/platform/diag.h>
|
||||
@@ -55,7 +56,6 @@
|
||||
#include "rail.h"
|
||||
#include "rail_config.h"
|
||||
#include "rail_ieee802154.h"
|
||||
#include "rtcdriver.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -289,7 +289,7 @@ void efr32RadioInit(void)
|
||||
efr32ConfigInit(RAILCb_Generic);
|
||||
|
||||
CMU_ClockEnable(cmuClock_PRS, true);
|
||||
RTCDRV_Init();
|
||||
|
||||
status = RAIL_ConfigSleep(gRailHandle, RAIL_SLEEP_CONFIG_TIMERSYNC_ENABLED);
|
||||
assert(status == RAIL_STATUS_NO_ERROR);
|
||||
|
||||
@@ -704,6 +704,8 @@ static void processNextRxPacket(otInstance *aInstance)
|
||||
}
|
||||
}
|
||||
|
||||
otSysEventSignalPending();
|
||||
|
||||
exit:
|
||||
|
||||
if (packetHandle != RAIL_RX_PACKET_HANDLE_INVALID)
|
||||
@@ -801,6 +803,8 @@ static void RAILCb_Generic(RAIL_Handle_t aRailHandle, RAIL_Events_t aEvents)
|
||||
sEnergyScanResultDbm = energyScanResultQuarterDbm / QUARTER_DBM_IN_DBM;
|
||||
}
|
||||
}
|
||||
|
||||
otSysEventSignalPending();
|
||||
}
|
||||
|
||||
otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
|
||||
@@ -835,11 +839,14 @@ void efr32RadioProcess(otInstance *aInstance)
|
||||
{
|
||||
otPlatRadioTxDone(aInstance, &sTransmitFrame, &sReceiveFrame, sTransmitError);
|
||||
}
|
||||
|
||||
otSysEventSignalPending();
|
||||
}
|
||||
else if (sEnergyScanMode == ENERGY_SCAN_MODE_ASYNC && sEnergyScanStatus == ENERGY_SCAN_STATUS_COMPLETED)
|
||||
{
|
||||
sEnergyScanStatus = ENERGY_SCAN_STATUS_IDLE;
|
||||
otPlatRadioEnergyScanDone(aInstance, sEnergyScanResultDbm);
|
||||
otSysEventSignalPending();
|
||||
}
|
||||
|
||||
processNextRxPacket(aInstance);
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "openthread-system.h"
|
||||
#include <openthread/tasklet.h>
|
||||
#include <openthread/platform/uart.h>
|
||||
|
||||
@@ -70,17 +71,28 @@ void otSysInit(int argc, char *argv[])
|
||||
OT_UNUSED_VARIABLE(argc);
|
||||
OT_UNUSED_VARIABLE(argv);
|
||||
|
||||
__disable_irq();
|
||||
|
||||
#undef FIXED_EXCEPTION
|
||||
#define FIXED_EXCEPTION(vectorNumber, functionName, deviceIrqn, deviceIrqHandler)
|
||||
#define EXCEPTION(vectorNumber, functionName, deviceIrqn, deviceIrqHandler, priorityLevel, subpriority) \
|
||||
NVIC_SetPriority(deviceIrqn, NVIC_EncodePriority(PRIGROUP_POSITION, priorityLevel, subpriority));
|
||||
#include NVIC_CONFIG
|
||||
#undef EXCEPTION
|
||||
|
||||
NVIC_SetPriorityGrouping(PRIGROUP_POSITION);
|
||||
CHIP_Init();
|
||||
|
||||
halInitChipSpecific();
|
||||
|
||||
BSP_Init(BSP_INIT_BCC);
|
||||
RTCDRV_Init();
|
||||
|
||||
#if (HAL_FEM_ENABLE)
|
||||
initFem();
|
||||
wakeupFem();
|
||||
#endif
|
||||
|
||||
__enable_irq();
|
||||
|
||||
#if USE_EFR32_LOG
|
||||
efr32LogInit();
|
||||
#endif
|
||||
@@ -153,3 +165,8 @@ void otSysProcessDrivers(otInstance *aInstance)
|
||||
efr32RadioProcess(aInstance);
|
||||
efr32AlarmProcess(aInstance);
|
||||
}
|
||||
|
||||
__WEAK void otSysEventSignalPending(void)
|
||||
{
|
||||
// Intentionally empty
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "openthread-system.h"
|
||||
#include <openthread/platform/uart.h>
|
||||
|
||||
#include "utils/code_utils.h"
|
||||
@@ -132,6 +133,8 @@ static void receiveDone(UARTDRV_Handle_t aHandle, Ecode_t aStatus, uint8_t *aDat
|
||||
assert(sReceiveDeferred == false);
|
||||
sReceiveDeferred = true;
|
||||
}
|
||||
|
||||
otSysEventSignalPending();
|
||||
}
|
||||
|
||||
static inline bool isBufferEmpty(uint16_t unwrappedReadStart, uint16_t unwrappedReadEnd)
|
||||
@@ -180,6 +183,7 @@ exit:
|
||||
static void transmitDone(UARTDRV_Handle_t aHandle, Ecode_t aStatus, uint8_t *aData, UARTDRV_Count_t aCount)
|
||||
{
|
||||
sTransmitLength = 0;
|
||||
otSysEventSignalPending();
|
||||
}
|
||||
|
||||
static void processReceive(void)
|
||||
|
||||
Reference in New Issue
Block a user