Various ChibiOS compatibility fixes and a missing OBD define

This commit is contained in:
Fabien Poussin 2017-03-29 18:03:37 +02:00
parent 4b6d378e81
commit 9f75cd5c75
4 changed files with 16 additions and 16 deletions

View File

@ -1698,8 +1698,8 @@ typedef enum {
CUSTOM_OBD_INJECTION_NO_PIN_ASSIGNED = 6020,
CUSTOM_OBD_UNEXPECTED_INJECTION_MODE = 6021,
CUSTOM_OBD_ANGLE_CONSTRAINT_VIOLATION = 6022,
CUSTOM_OBD_23 = 6023,
CUSTOM_OBD_24 = 6024,
CUSTOM_OBD_UNKNOWN_FIRING_ORDER = 6023,
CUSTOM_OBD_WRONG_FIRING_ORDER = 6024,
CUSTOM_OBD_25 = 6025,
CUSTOM_OBD_26 = 6026,
CUSTOM_UNEXPECTED_ENGINE_TYPE = 6027,

View File

@ -148,7 +148,7 @@ AdcDevice fastAdc(&adcgrpcfg_fast);
void doSlowAdc(void) {
efiAssertVoid(getRemainingStack(chThdSelf())> 32, "lwStAdcSlow");
efiAssertVoid(getRemainingStack(chThdGetSelfX())> 32, "lwStAdcSlow");
#if EFI_INTERNAL_ADC
@ -156,19 +156,19 @@ void doSlowAdc(void) {
will be executed in parallel to the current PWM cycle and will
terminate before the next PWM cycle.*/
slowAdc.conversionCount++;
chSysLockFromIsr()
chSysLockFromISR()
;
if (ADC_SLOW_DEVICE.state != ADC_READY &&
ADC_SLOW_DEVICE.state != ADC_COMPLETE &&
ADC_SLOW_DEVICE.state != ADC_ERROR) {
// todo: why and when does this happen? firmwareError(OBD_PCM_Processor_Fault, "ADC slow not ready?");
slowAdc.errorsCount++;
chSysUnlockFromIsr()
chSysUnlockFromISR()
;
return;
}
adcStartConversionI(&ADC_SLOW_DEVICE, &adcgrpcfgSlow, slowAdc.samples, ADC_BUF_DEPTH_SLOW);
chSysUnlockFromIsr()
chSysUnlockFromISR()
;
#endif
}
@ -179,7 +179,7 @@ static void pwmpcb_slow(PWMDriver *pwmp) {
}
static void pwmpcb_fast(PWMDriver *pwmp) {
efiAssertVoid(getRemainingStack(chThdSelf())> 32, "lwStAdcFast");
efiAssertVoid(getRemainingStack(chThdGetSelfX())> 32, "lwStAdcFast");
#if EFI_INTERNAL_ADC
(void) pwmp;
@ -188,19 +188,19 @@ static void pwmpcb_fast(PWMDriver *pwmp) {
* will be executed in parallel to the current PWM cycle and will
* terminate before the next PWM cycle.
*/
chSysLockFromIsr()
chSysLockFromISR()
;
if (ADC_FAST_DEVICE.state != ADC_READY &&
ADC_FAST_DEVICE.state != ADC_COMPLETE &&
ADC_FAST_DEVICE.state != ADC_ERROR) {
fastAdc.errorsCount++;
// todo: when? why? firmwareError(OBD_PCM_Processor_Fault, "ADC fast not ready?");
chSysUnlockFromIsr()
chSysUnlockFromISR()
;
return;
}
adcStartConversionI(&ADC_FAST_DEVICE, &adcgrpcfg_fast, fastAdc.samples, ADC_BUF_DEPTH_FAST);
chSysUnlockFromIsr()
chSysUnlockFromISR()
;
fastAdc.conversionCount++;
#endif
@ -483,7 +483,7 @@ static void setAdcDebugReporting(int value) {
static void adc_callback_slow(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
(void) buffer;
(void) n;
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#9c");
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#9c");
/* Note, only in the ADC_COMPLETE state because the ADC driver fires
* an intermediate callback when the buffer is half full. */
if (adcp->state == ADC_COMPLETE) {

View File

@ -87,10 +87,10 @@ static void callback(GPTDriver *gptp) {
// // test code
// setOutputPinValue(LED_CRANKING, timerCallbackCounter % 2);
// int mod = timerCallbackCounter % 400;
// chSysLockFromIsr()
// chSysLockFromISR()
// ;
// setHardwareUsTimer(400 - mod);
// chSysUnlockFromIsr()
// chSysUnlockFromISR()
// ;
globalTimerCallback(NULL);

View File

@ -150,7 +150,7 @@ static void scheduleReboot(void) {
}
void runRusEfi(void) {
efiAssertVoid(getRemainingStack(chThdSelf()) > 512, "init s");
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 512, "init s");
assertEngineReference(PASS_ENGINE_PARAMETER_F);
initIntermediateLoggingBuffer();
initErrorHandling();
@ -220,7 +220,7 @@ void runRusEfi(void) {
* control is around main_trigger_callback
*/
while (true) {
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "stack#1");
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "stack#1");
#if (EFI_CLI_SUPPORT && !EFI_UART_ECHO_TEST_MODE) || defined(__DOXYGEN__)
// sensor state + all pending messages for our own dev console
@ -231,7 +231,7 @@ void runRusEfi(void) {
}
}
void chDbgStackOverflowPanic(Thread *otp) {
void chDbgStackOverflowPanic(thread_t *otp) {
strcpy(panicMessage, "stack overflow: ");
#if defined(CH_USE_REGISTRY) || defined(__DOXYGEN__)
int p_name_len = strlen(otp->p_name);