1
0
forked from me/IronOS

Spawn PD earlier

This commit is contained in:
Ben V. Brown
2021-04-05 14:37:50 +10:00
parent fc08dc42fa
commit b3c3e4e384
7 changed files with 21 additions and 28 deletions

View File

@@ -25,7 +25,7 @@
#include "task.h"
#include <pd.h>
osThreadId InterruptHandler::TaskHandle = NULL;
volatile osThreadId InterruptHandler::TaskHandle = NULL;
uint32_t InterruptHandler::TaskBuffer[InterruptHandler::TaskStackSize];
osStaticThreadDef_t InterruptHandler::TaskControlBlock;
@@ -68,11 +68,9 @@ void InterruptHandler::Thread(const void *arg) {
}
}
void InterruptHandler::irqCallback() {
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED) {
if (TaskHandle != NULL) {
BaseType_t taskWoke = pdFALSE;
xTaskNotifyFromISR(TaskHandle, 0x01, eNotifyAction::eSetBits, &taskWoke);
portYIELD_FROM_ISR(taskWoke);
}
if (TaskHandle != NULL) {
BaseType_t taskWoke = pdFALSE;
xTaskNotifyFromISR(TaskHandle, 0, eNotifyAction::eNoAction, &taskWoke);
portYIELD_FROM_ISR(taskWoke);
}
}

View File

@@ -29,7 +29,7 @@ public:
private:
static void Thread(const void *arg);
static osThreadId TaskHandle;
static volatile osThreadId TaskHandle;
static const size_t TaskStackSize = 1536 / 3;
static uint32_t TaskBuffer[TaskStackSize];
static osStaticThreadDef_t TaskControlBlock;

View File

@@ -24,8 +24,8 @@
#define EVENT_MASK(x) (1 << x)
/* PD Buddy thread priorities */
#define PDB_PRIO_PE (osPriorityBelowNormal)
#define PDB_PRIO_PE (osPriorityAboveNormal)
#define PDB_PRIO_PRL (osPriorityNormal)
#define PDB_PRIO_PRL_INT_N (osPriorityAboveNormal)
#define PDB_PRIO_PRL_INT_N (osPriorityBelowNormal)
#endif /* PDB_CONF_H */

View File

@@ -622,10 +622,10 @@ void PolicyEngine::PPSTimerCallback() {
if (PPSTimerEnabled && state == policy_engine_state::PESinkReady) {
// I believe even once per second is totally fine, but leaning on faster since everything seems cool with faster
// Have seen everything from 10ms to 1 second :D
// if ((xTaskGetTickCount() - PPSTimeLastEvent) > (100)) {
// Send a new PPS message
PolicyEngine::notify(Notifications::PDB_EVT_PE_PPS_REQUEST);
PPSTimeLastEvent = xTaskGetTickCount();
// }
if ((xTaskGetTickCount() - PPSTimeLastEvent) > (TICKS_SECOND)) {
// Send a new PPS message
PolicyEngine::notify(Notifications::PDB_EVT_PE_PPS_REQUEST);
PPSTimeLastEvent = xTaskGetTickCount();
}
}
}