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