use the linker! (#1363)
This commit is contained in:
parent
a444e09ff8
commit
f704bf22cb
|
@ -1872,7 +1872,7 @@ typedef enum {
|
||||||
CUSTOM_ERR_UNEXPECTED_SPI = 6524,
|
CUSTOM_ERR_UNEXPECTED_SPI = 6524,
|
||||||
CUSTOM_ERR_EXT_MODE = 6525,
|
CUSTOM_ERR_EXT_MODE = 6525,
|
||||||
CUSTOM_ERR_TIMER_OVERFLOW = 6526,
|
CUSTOM_ERR_TIMER_OVERFLOW = 6526,
|
||||||
CUSTOM_ERR_NULL_TIMER_CALLBACK = 6527,
|
CUSTOM_ERR_6527 = 6527,
|
||||||
CUSTOM_ERR_SCHEDULING_ERROR = 6528,
|
CUSTOM_ERR_SCHEDULING_ERROR = 6528,
|
||||||
CUSTOM_ERR_LOGGING_NOT_READY = 6529,
|
CUSTOM_ERR_LOGGING_NOT_READY = 6529,
|
||||||
ERROR_NAN_FIND_INDEX = 6530,
|
ERROR_NAN_FIND_INDEX = 6530,
|
||||||
|
|
|
@ -35,8 +35,6 @@
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
extern schfunc_t globalTimerCallback;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* these fields are global in order to facilitate debugging
|
* these fields are global in order to facilitate debugging
|
||||||
*/
|
*/
|
||||||
|
@ -45,15 +43,9 @@ static efitime_t nextEventTimeNt = 0;
|
||||||
uint32_t hwSetTimerDuration;
|
uint32_t hwSetTimerDuration;
|
||||||
uint32_t lastExecutionCount;
|
uint32_t lastExecutionCount;
|
||||||
|
|
||||||
static void executorCallback(void *arg) {
|
void globalTimerCallback() {
|
||||||
(void)arg;
|
|
||||||
efiAssertVoid(CUSTOM_ERR_6624, getCurrentRemainingStack() > EXPECTED_REMAINING_STACK, "lowstck#2y");
|
efiAssertVoid(CUSTOM_ERR_6624, getCurrentRemainingStack() > EXPECTED_REMAINING_STACK, "lowstck#2y");
|
||||||
|
|
||||||
// callbackTime = getTimeNowNt();
|
|
||||||
// if ((callbackTime > nextEventTimeNt) && (callbackTime - nextEventTimeNt > US2NT(5000))) {
|
|
||||||
// timerIsLate++;
|
|
||||||
// }
|
|
||||||
|
|
||||||
___engine.executor.onTimerCallback();
|
___engine.executor.onTimerCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +172,6 @@ void SingleTimerExecutor::scheduleTimerCallback() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void initSingleTimerExecutorHardware(void) {
|
void initSingleTimerExecutorHardware(void) {
|
||||||
globalTimerCallback = executorCallback;
|
|
||||||
initMicrosecondTimer();
|
initMicrosecondTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,13 +46,11 @@ uint32_t maxPrecisionCallbackDuration = 0;
|
||||||
|
|
||||||
static volatile efitick_t lastSetTimerTimeNt;
|
static volatile efitick_t lastSetTimerTimeNt;
|
||||||
static int lastSetTimerValue;
|
static int lastSetTimerValue;
|
||||||
static volatile bool isTimerPending = FALSE;
|
static volatile bool isTimerPending = false;
|
||||||
|
|
||||||
static volatile int timerCallbackCounter = 0;
|
static volatile int timerCallbackCounter = 0;
|
||||||
static volatile int timerRestartCounter = 0;
|
static volatile int timerRestartCounter = 0;
|
||||||
|
|
||||||
schfunc_t globalTimerCallback;
|
|
||||||
|
|
||||||
static const char * msg;
|
static const char * msg;
|
||||||
|
|
||||||
static char buff[32];
|
static char buff[32];
|
||||||
|
@ -103,23 +101,21 @@ void setHardwareUsTimer(int32_t deltaTimeUs) {
|
||||||
|
|
||||||
lastSetTimerTimeNt = getTimeNowNt();
|
lastSetTimerTimeNt = getTimeNowNt();
|
||||||
lastSetTimerValue = deltaTimeUs;
|
lastSetTimerValue = deltaTimeUs;
|
||||||
isTimerPending = TRUE;
|
isTimerPending = true;
|
||||||
timerRestartCounter++;
|
timerRestartCounter++;
|
||||||
enginePins.debugSetTimer.setValue(0);
|
enginePins.debugSetTimer.setValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void globalTimerCallback();
|
||||||
|
|
||||||
static void hwTimerCallback(GPTDriver *gptp) {
|
static void hwTimerCallback(GPTDriver *gptp) {
|
||||||
(void)gptp;
|
(void)gptp;
|
||||||
enginePins.debugTimerCallback.setValue(1);
|
enginePins.debugTimerCallback.setValue(1);
|
||||||
timerCallbackCounter++;
|
timerCallbackCounter++;
|
||||||
if (globalTimerCallback == NULL) {
|
|
||||||
firmwareError(CUSTOM_ERR_NULL_TIMER_CALLBACK, "NULL globalTimerCallback");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
isTimerPending = false;
|
isTimerPending = false;
|
||||||
|
|
||||||
uint32_t before = getTimeNowLowerNt();
|
uint32_t before = getTimeNowLowerNt();
|
||||||
globalTimerCallback(NULL);
|
globalTimerCallback();
|
||||||
uint32_t precisionCallbackDuration = getTimeNowLowerNt() - before;
|
uint32_t precisionCallbackDuration = getTimeNowLowerNt() - before;
|
||||||
if (precisionCallbackDuration > maxPrecisionCallbackDuration) {
|
if (precisionCallbackDuration > maxPrecisionCallbackDuration) {
|
||||||
maxPrecisionCallbackDuration = precisionCallbackDuration;
|
maxPrecisionCallbackDuration = precisionCallbackDuration;
|
||||||
|
@ -203,7 +199,6 @@ static void validateHardwareTimer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void initMicrosecondTimer(void) {
|
void initMicrosecondTimer(void) {
|
||||||
|
|
||||||
gptStart(&GPTDEVICE, &gpt5cfg);
|
gptStart(&GPTDEVICE, &gpt5cfg);
|
||||||
efiAssertVoid(CUSTOM_ERR_TIMER_STATE, GPTDEVICE.state == GPT_READY, "hw state");
|
efiAssertVoid(CUSTOM_ERR_TIMER_STATE, GPTDEVICE.state == GPT_READY, "hw state");
|
||||||
hwStarted = true;
|
hwStarted = true;
|
||||||
|
|
Loading…
Reference in New Issue