auto-sync

This commit is contained in:
rusEfi 2014-11-08 18:03:17 -06:00
parent 835ddb3e6e
commit ba1194ea8e
11 changed files with 21 additions and 21 deletions

View File

@ -77,7 +77,7 @@ ADCDriver ADCD3;
*/ */
static void adc_lld_serve_rx_interrupt(ADCDriver *adcp, uint32_t flags) { static void adc_lld_serve_rx_interrupt(ADCDriver *adcp, uint32_t flags) {
efiAssertVoid(getRemainingStack(chThdSelf()) > 32, "sys_adc"); efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "sys_adc");
/* DMA errors handling.*/ /* DMA errors handling.*/
if ((flags & (STM32_DMA_ISR_TEIF | STM32_DMA_ISR_DMEIF)) != 0) { if ((flags & (STM32_DMA_ISR_TEIF | STM32_DMA_ISR_DMEIF)) != 0) {

View File

@ -126,7 +126,7 @@ static msg_t consoleThreadThreadEntryPoint(void *arg) {
chRegSetThreadName("console thread"); chRegSetThreadName("console thread");
while (TRUE) { while (TRUE) {
efiAssert(getRemainingStack(chThdSelf()) > 32, "lowstck#9e", 0); efiAssert(getRemainingStack(chThdSelf()) > 256, "lowstck#9e", 0);
bool end = getConsoleLine((BaseSequentialStream*) getConsoleChannel(), consoleInput, sizeof(consoleInput)); bool end = getConsoleLine((BaseSequentialStream*) getConsoleChannel(), consoleInput, sizeof(consoleInput));
if (end) { if (end) {
// firmware simulator is the only case when this happens // firmware simulator is the only case when this happens

View File

@ -114,7 +114,7 @@ static void vappendPrintfI(Logging *logging, const char *fmt, va_list arg) {
} }
void vappendPrintf(Logging *logging, const char *fmt, va_list arg) { void vappendPrintf(Logging *logging, const char *fmt, va_list arg) {
efiAssertVoid(getRemainingStack(chThdSelf()) > 64, "lowstck#5b"); efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#5b");
if (!intermediateLoggingBufferInited) { if (!intermediateLoggingBufferInited) {
firmwareError("intermediateLoggingBufferInited not inited!"); firmwareError("intermediateLoggingBufferInited not inited!");
return; return;
@ -141,7 +141,7 @@ void vappendPrintf(Logging *logging, const char *fmt, va_list arg) {
} }
void appendPrintf(Logging *logging, const char *fmt, ...) { void appendPrintf(Logging *logging, const char *fmt, ...) {
efiAssertVoid(getRemainingStack(chThdSelf()) > 32, "lowstck#4"); efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#4");
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
vappendPrintf(logging, fmt, ap); vappendPrintf(logging, fmt, ap);
@ -319,6 +319,7 @@ void resetLogging(Logging *logging) {
* This method should only be invoked on main thread because only the main thread can write to the console * This method should only be invoked on main thread because only the main thread can write to the console
*/ */
void printMsg(Logging *logger, const char *fmt, ...) { void printMsg(Logging *logger, const char *fmt, ...) {
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#5o");
// resetLogging(logging); // I guess 'reset' is not needed here? // resetLogging(logging); // I guess 'reset' is not needed here?
appendMsgPrefix(logger); appendMsgPrefix(logger);

View File

@ -73,7 +73,7 @@ static scheduling_s endTimer[2];
static void startAveraging(void *arg) { static void startAveraging(void *arg) {
(void) arg; (void) arg;
efiAssertVoid(getRemainingStack(chThdSelf()) > 32, "lowstck#9"); efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#9");
bool wasLocked = lockAnyContext(); bool wasLocked = lockAnyContext();
; ;
// with locking we would have a consistent state // with locking we would have a consistent state
@ -92,7 +92,7 @@ static void startAveraging(void *arg) {
void mapAveragingCallback(adcsample_t value) { void mapAveragingCallback(adcsample_t value) {
/* Calculates the average values from the ADC samples.*/ /* Calculates the average values from the ADC samples.*/
perRevolutionCounter++; perRevolutionCounter++;
efiAssertVoid(getRemainingStack(chThdSelf()) > 32, "lowstck#9a"); efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#9a");
float voltage = adcToVoltsDivided(value); float voltage = adcToVoltsDivided(value);
float currentPressure = getMapByVoltage(voltage); float currentPressure = getMapByVoltage(voltage);

View File

@ -29,7 +29,7 @@ extern schfunc_t globalTimerCallback;
static void executorCallback(void *arg) { static void executorCallback(void *arg) {
(void)arg; (void)arg;
efiAssertVoid(getRemainingStack(chThdSelf()) > 32, "lowstck#2y"); efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#2y");
instance.onTimerCallback(); instance.onTimerCallback();
} }

View File

@ -106,7 +106,7 @@ static INLINE void handleFuelInjectionEvent(ActuatorEvent *event, int rpm DECLAT
static INLINE void handleFuel(uint32_t eventIndex, int rpm DECLATE_ENGINE_PARAMETER) { static INLINE void handleFuel(uint32_t eventIndex, int rpm DECLATE_ENGINE_PARAMETER) {
if (!isInjectionEnabled(engine->engineConfiguration)) if (!isInjectionEnabled(engine->engineConfiguration))
return; return;
efiAssertVoid(getRemainingStack(chThdSelf()) > 64, "lowstck#3"); efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#3");
efiAssertVoid(eventIndex < engine->engineConfiguration2->triggerShape.getLength(), "event index"); efiAssertVoid(eventIndex < engine->engineConfiguration2->triggerShape.getLength(), "event index");
/** /**
@ -255,7 +255,7 @@ void onTriggerEvent(trigger_event_e ckpSignalType, uint32_t eventIndex, MainTrig
Engine *engine = mtc->engine; Engine *engine = mtc->engine;
(void) ckpSignalType; (void) ckpSignalType;
efiAssertVoid(eventIndex < 2 * engine->engineConfiguration2->triggerShape.shaftPositionEventCount, "event index"); efiAssertVoid(eventIndex < 2 * engine->engineConfiguration2->triggerShape.shaftPositionEventCount, "event index");
efiAssertVoid(getRemainingStack(chThdSelf()) > 64, "lowstck#2"); efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#2");
// todo: remove these local variables soon? // todo: remove these local variables soon?
engine_configuration_s *engineConfiguration = engine->engineConfiguration; engine_configuration_s *engineConfiguration = engine->engineConfiguration;

View File

@ -130,7 +130,7 @@ bool isCranking(void) {
void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index, RpmCalculator *rpmState) { void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index, RpmCalculator *rpmState) {
uint64_t nowNt = getTimeNowNt(); uint64_t nowNt = getTimeNowNt();
#if EFI_PROD_CODE #if EFI_PROD_CODE
efiAssertVoid(getRemainingStack(chThdSelf()) > 32, "lowstck#2z"); efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#2z");
#endif #endif
if (index != 0) { if (index != 0) {

View File

@ -61,7 +61,7 @@ void addTriggerEventListener(ShaftPositionListener listener, const char *name, v
EXTERN_ENGINE; EXTERN_ENGINE;
void hwHandleShaftSignal(trigger_event_e signal) { void hwHandleShaftSignal(trigger_event_e signal) {
efiAssertVoid(getRemainingStack(chThdSelf()) > 64, "lowstck#8"); efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#8");
triggerCentral.handleShaftSignal(engine, signal); triggerCentral.handleShaftSignal(engine, signal);
} }
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */

View File

@ -445,7 +445,7 @@ static void setAdcDebugReporting(int value) {
static void adc_callback_slow(ADCDriver *adcp, adcsample_t *buffer, size_t n) { static void adc_callback_slow(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
(void) buffer; (void) buffer;
(void) n; (void) n;
efiAssertVoid(getRemainingStack(chThdSelf()) > 16, "lowstck#9c"); efiAssertVoid(getRemainingStack(chThdSelf()) > 512, "lowstck#9c");
/* Note, only in the ADC_COMPLETE state because the ADC driver fires /* Note, only in the ADC_COMPLETE state because the ADC driver fires
* an intermediate callback when the buffer is half full. */ * an intermediate callback when the buffer is half full. */
if (adcp->state == ADC_COMPLETE) { if (adcp->state == ADC_COMPLETE) {
@ -466,7 +466,7 @@ static void adc_callback_fast(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
(void) n; (void) n;
// /* Note, only in the ADC_COMPLETE state because the ADC driver fires an // /* Note, only in the ADC_COMPLETE state because the ADC driver fires an
// intermediate callback when the buffer is half full.*/ // intermediate callback when the buffer is half full.*/
efiAssertVoid(getRemainingStack(chThdSelf()) > 16, "lowstck#9b"); efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#9b");
if (adcp->state == ADC_COMPLETE) { if (adcp->state == ADC_COMPLETE) {
fastAdcValue = getAvgAdcValue(0, samples_fast, ADC_GRP1_BUF_DEPTH_FAST, fastAdc.size()); fastAdcValue = getAvgAdcValue(0, samples_fast, ADC_GRP1_BUF_DEPTH_FAST, fastAdc.size());

View File

@ -27,16 +27,15 @@ int getRemainingStack(Thread *otp) {
register struct intctx *r13 asm ("r13"); register struct intctx *r13 asm ("r13");
otp->activeStack = r13; otp->activeStack = r13;
int rs; int remainingStack;
if (dbg_isr_cnt > 0) { if (dbg_isr_cnt > 0) {
// ISR context // ISR context
rs = (stkalign_t *) (r13 - 1) - &__main_stack_base__; remainingStack = (int)(r13 - 1) - (int)&__main_stack_base__;
} else { } else {
remainingStack = (int)(r13 - 1) - (int)otp->p_stklimit;
rs = (stkalign_t *) (r13 - 1) - otp->p_stklimit;
} }
otp->remainingStack = rs; otp->remainingStack = remainingStack;
return rs; return remainingStack;
#else #else
return 99999; return 99999;
#endif /* CH_DBG_ENABLE_STACK_CHECK */ #endif /* CH_DBG_ENABLE_STACK_CHECK */
@ -53,7 +52,7 @@ int getRemainingStack(Thread *otp) {
if (dbg_isr_cnt > 0) { if (dbg_isr_cnt > 0) {
remainingStack = (__get_SP() - sizeof(struct intctx)) - (int)&IRQSTACK$$Base; remainingStack = (__get_SP() - sizeof(struct intctx)) - (int)&IRQSTACK$$Base;
} else { } else {
remainingStack = (stkalign_t *)(__get_SP() - sizeof(struct intctx)) - otp->p_stklimit; remainingStack = (__get_SP() - sizeof(struct intctx)) - (int)otp->p_stklimit;
} }
otp->remainingStack = remainingStack; otp->remainingStack = remainingStack;
return remainingStack; return remainingStack;

View File

@ -191,7 +191,7 @@ void runRusEfi(void) {
* control is around main_trigger_callback * control is around main_trigger_callback
*/ */
while (TRUE) { while (TRUE) {
efiAssertVoid(getRemainingStack(chThdSelf()) > 100, "stack#1"); efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "stack#1");
#if EFI_CLI_SUPPORT && !EFI_UART_ECHO_TEST_MODE #if EFI_CLI_SUPPORT && !EFI_UART_ECHO_TEST_MODE
// sensor state + all pending messages for our own dev console // sensor state + all pending messages for our own dev console