mirror of
https://github.com/espressif/openthread.git
synced 2026-10-22 15:38:20 +00:00
[nrf52840] fix possible permanent sleep in multiprotocol (#3202)
This commit is contained in:
committed by
Jonathan Hui
parent
309bd09d75
commit
2446d36649
@@ -95,6 +95,7 @@ typedef struct
|
||||
static volatile uint32_t sOverflowCounter; ///< Counter of RTC overflowCounter, incremented by 2 on each OVERFLOW event.
|
||||
static volatile uint8_t sMutex; ///< Mutex for write access to @ref sOverflowCounter.
|
||||
static volatile uint64_t sTimeOffset = 0; ///< Time overflowCounter to keep track of current time (in millisecond).
|
||||
static volatile bool sEventPending; ///< Timer fired and upper layer should be notified.
|
||||
static AlarmData sTimerData[kNumTimers]; ///< Data of the timers.
|
||||
|
||||
static const AlarmChannelData sChannelData[kNumTimers] = //
|
||||
@@ -317,6 +318,7 @@ static void HandleCompareMatch(AlarmIndex aIndex, bool aSkipCheck)
|
||||
case kMsTimer:
|
||||
case kUsTimer:
|
||||
sTimerData[aIndex].mFireAlarm = true;
|
||||
sEventPending = true;
|
||||
otSysEventSignalPending();
|
||||
break;
|
||||
|
||||
@@ -479,29 +481,34 @@ void nrf5AlarmDeinit(void)
|
||||
|
||||
void nrf5AlarmProcess(otInstance *aInstance)
|
||||
{
|
||||
if (sTimerData[kMsTimer].mFireAlarm)
|
||||
do
|
||||
{
|
||||
sTimerData[kMsTimer].mFireAlarm = false;
|
||||
sEventPending = false;
|
||||
|
||||
if (sTimerData[kMsTimer].mFireAlarm)
|
||||
{
|
||||
sTimerData[kMsTimer].mFireAlarm = false;
|
||||
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
|
||||
if (otPlatDiagModeGet())
|
||||
{
|
||||
otPlatDiagAlarmFired(aInstance);
|
||||
}
|
||||
else
|
||||
if (otPlatDiagModeGet())
|
||||
{
|
||||
otPlatDiagAlarmFired(aInstance);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
otPlatAlarmMilliFired(aInstance);
|
||||
{
|
||||
otPlatAlarmMilliFired(aInstance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sTimerData[kUsTimer].mFireAlarm)
|
||||
{
|
||||
sTimerData[kUsTimer].mFireAlarm = false;
|
||||
if (sTimerData[kUsTimer].mFireAlarm)
|
||||
{
|
||||
sTimerData[kUsTimer].mFireAlarm = false;
|
||||
|
||||
otPlatAlarmMicroFired(aInstance);
|
||||
}
|
||||
otPlatAlarmMicroFired(aInstance);
|
||||
}
|
||||
} while (sEventPending);
|
||||
}
|
||||
|
||||
inline uint64_t nrf5AlarmGetCurrentTime(void)
|
||||
|
||||
@@ -128,13 +128,13 @@ bool otSysPseudoResetWasRequested(void)
|
||||
|
||||
void otSysProcessDrivers(otInstance *aInstance)
|
||||
{
|
||||
nrf5AlarmProcess(aInstance);
|
||||
nrf5RadioProcess(aInstance);
|
||||
nrf5UartProcess();
|
||||
nrf5TempProcess();
|
||||
#ifndef SPIS_TRANSPORT_DISABLE
|
||||
nrf5SpiSlaveProcess();
|
||||
#endif
|
||||
nrf5AlarmProcess(aInstance);
|
||||
}
|
||||
|
||||
__WEAK void otSysEventSignalPending(void)
|
||||
|
||||
Reference in New Issue
Block a user