auto-sync
This commit is contained in:
parent
6edafdc1af
commit
e984e7a0c4
|
@ -154,8 +154,6 @@ void dbg_check_unlock_from_isr(void) {
|
|||
dbg_leave_lock();
|
||||
}
|
||||
|
||||
void firmwareError(const char *fmt, ...);
|
||||
|
||||
extern int maxNesting;
|
||||
|
||||
/**
|
||||
|
|
|
@ -788,10 +788,10 @@ int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomin
|
|||
|
||||
void startTunerStudioConnectivity(void) {
|
||||
if (sizeof(persistent_config_s) != getTunerStudioPageSize(0))
|
||||
firmwareError("TS page size mismatch: %d/%d", sizeof(persistent_config_s), getTunerStudioPageSize(0));
|
||||
firmwareError(OBD_PCM_Processor_Fault, "TS page size mismatch: %d/%d", sizeof(persistent_config_s), getTunerStudioPageSize(0));
|
||||
|
||||
if (sizeof(TunerStudioOutputChannels) != TS_OUTPUT_SIZE)
|
||||
firmwareError("TS outputs size mismatch: %d/%d", sizeof(TunerStudioOutputChannels), TS_OUTPUT_SIZE);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "TS outputs size mismatch: %d/%d", sizeof(TunerStudioOutputChannels), TS_OUTPUT_SIZE);
|
||||
|
||||
memset(&tsState, 0, sizeof(tsState));
|
||||
syncTunerStudioCopy();
|
||||
|
|
|
@ -82,7 +82,7 @@ static bool getConsoleLine(BaseSequentialStream *chp, char *line, unsigned size)
|
|||
;
|
||||
|
||||
if (flags & SD_OVERRUN_ERROR) {
|
||||
// firmwareError("serial overrun");
|
||||
// firmwareError(OBD_PCM_Processor_Fault, "serial overrun");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ void consoleOutputBuffer(const uint8_t *buf, int size) {
|
|||
#if !EFI_UART_ECHO_TEST_MODE
|
||||
lastWriteActual = chnWriteTimeout(getConsoleChannel(), buf, size, CONSOLE_WRITE_TIMEOUT);
|
||||
// if (r != size)
|
||||
// firmwareError("Partial console write");
|
||||
// firmwareError(OBD_PCM_Processor_Fault, "Partial console write");
|
||||
#endif /* EFI_UART_ECHO_TEST_MODE */
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ static void myfatal(void) {
|
|||
}
|
||||
|
||||
static void myerror(void) {
|
||||
firmwareError("firmwareError: %d", getRusEfiVersion());
|
||||
firmwareError(OBD_PCM_Processor_Fault, "firmwareError: %d", getRusEfiVersion());
|
||||
}
|
||||
|
||||
static void sayNothing(void) {
|
||||
|
|
|
@ -288,7 +288,7 @@ void Engine::watchdog() {
|
|||
return;
|
||||
if (!isSpinning) {
|
||||
if (!isRunningBenchTest() && stopPins()) {
|
||||
firmwareError("Some pins were turned off by 2nd pass watchdog");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Some pins were turned off by 2nd pass watchdog");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -990,7 +990,7 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_EN
|
|||
applyNonPersistentConfiguration(logger PASS_ENGINE_PARAMETER);
|
||||
// todo: eliminate triggerShape.operationMode?
|
||||
if (engineConfiguration->operationMode != engine->triggerShape.getOperationMode())
|
||||
firmwareError("operationMode/trigger mismatch");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "operationMode/trigger mismatch");
|
||||
|
||||
#if EFI_TUNER_STUDIO
|
||||
syncTunerStudioCopy();
|
||||
|
@ -1015,11 +1015,11 @@ void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_S
|
|||
engine->triggerShape.initializeTriggerShape(logger PASS_ENGINE_PARAMETER);
|
||||
#endif
|
||||
if (engine->triggerShape.getSize() == 0) {
|
||||
firmwareError("triggerShape size is zero");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "triggerShape size is zero");
|
||||
return;
|
||||
}
|
||||
if (engine->triggerShape.getSize() == 0) {
|
||||
firmwareError("shaftPositionEventCount is zero");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "shaftPositionEventCount is zero");
|
||||
return;
|
||||
}
|
||||
engine->engineCycleEventCount = engine->triggerShape.getLength();
|
||||
|
|
|
@ -34,7 +34,7 @@ bool isWarningNow(efitimesec_t now, bool forIndicator);
|
|||
*
|
||||
* todo: better method name?
|
||||
*/
|
||||
void firmwareError(const char *fmt, ...);
|
||||
void firmwareError(obd_code_e code, const char *fmt, ...);
|
||||
|
||||
#define hasFirmwareError() hasFirmwareErrorFlag
|
||||
|
||||
|
@ -63,8 +63,8 @@ int getRusEfiVersion(void);
|
|||
* is stopped. Please use firmwareWarning() instead
|
||||
*/
|
||||
#if EFI_ENABLE_ASSERTS
|
||||
#define efiAssert(condition, message, result) { if (!(condition)) { firmwareError(message); return result; } }
|
||||
#define efiAssertVoid(condition, message) { if (!(condition)) { firmwareError(message); return; } }
|
||||
#define efiAssert(condition, message, result) { if (!(condition)) { firmwareError(OBD_PCM_Processor_Fault, message); return result; } }
|
||||
#define efiAssertVoid(condition, message) { if (!(condition)) { firmwareError(OBD_PCM_Processor_Fault, message); return; } }
|
||||
#else /* EFI_ENABLE_ASSERTS */
|
||||
#define efiAssert(condition, message, result) { }
|
||||
#define efiAssertVoid(condition, message) { }
|
||||
|
|
|
@ -105,7 +105,7 @@ int getNumberOfInjections(injection_mode_e mode DECLARE_ENGINE_PARAMETER_S) {
|
|||
case IM_BATCH:
|
||||
return 2;
|
||||
default:
|
||||
firmwareError("Unexpected getFuelMultiplier %d", mode);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Unexpected getFuelMultiplier %d", mode);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,12 +51,12 @@ float multi_wave_s::getSwitchTime(int index) const {
|
|||
|
||||
void checkSwitchTimes2(int size, float *switchTimes) {
|
||||
if (switchTimes[size - 1] != 1) {
|
||||
firmwareError("last switch time has to be 1 not %f", switchTimes[size - 1]);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "last switch time has to be 1 not %f", switchTimes[size - 1]);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < size - 1; i++) {
|
||||
if (switchTimes[i] >= switchTimes[i + 1]) {
|
||||
firmwareError("invalid switchTimes @%d: %f/%f", i, switchTimes[i], switchTimes[i + 1]);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "invalid switchTimes @%d: %f/%f", i, switchTimes[i], switchTimes[i + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ bool FLStack<T, MAXSIZE>::remove(T value) {
|
|||
template<typename T, int MAXSIZE>
|
||||
void FLStack<T, MAXSIZE>::push(T value) {
|
||||
if (currentSize >= MAXSIZE) {
|
||||
firmwareError("FLstack overflow");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "FLstack overflow");
|
||||
return;
|
||||
//warning()
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ void FLStack<T, MAXSIZE>::push(T value) {
|
|||
template<typename T, int MAXSIZE>
|
||||
T FLStack<T, MAXSIZE>::pop() {
|
||||
if (currentSize == 0) {
|
||||
firmwareError("FLStack is empty");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "FLStack is empty");
|
||||
}
|
||||
return values[--currentSize];
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ int LEElementPool::getSize() {
|
|||
LEElement *LEElementPool::next() {
|
||||
if (index >= size) {
|
||||
// todo: this should not be a fatal error, just an error
|
||||
firmwareError("LE_ELEMENT_POOL_SIZE overflow");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "LE_ELEMENT_POOL_SIZE overflow");
|
||||
return NULL;
|
||||
}
|
||||
LEElement *result = &pool[index++];
|
||||
|
|
|
@ -81,7 +81,7 @@ FastInterpolation::FastInterpolation(float x1, float y1, float x2, float y2) {
|
|||
|
||||
void FastInterpolation::init(float x1, float y1, float x2, float y2) {
|
||||
if (x1 == x2) {
|
||||
firmwareError("init: Same x1 and x2 in interpolate: %f/%f", x1, x2);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "init: Same x1 and x2 in interpolate: %f/%f", x1, x2);
|
||||
return;
|
||||
}
|
||||
a = INTERPOLATION_A(x1, y1, x2, y2);
|
||||
|
|
|
@ -142,7 +142,7 @@ static const char* idleModeStr[] = { "I:A", "I:M" };
|
|||
// case O2_HEATER:
|
||||
// return "O2H";
|
||||
// default:
|
||||
// firmwareError("No short name for %d", (int) pin);
|
||||
// firmwareError(OBD_PCM_Processor_Fault, "No short name for %d", (int) pin);
|
||||
// return "";
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -193,7 +193,7 @@ static void mapAveragingCallback(trigger_event_e ckpEventType,
|
|||
|
||||
angle_t samplingDuration = ENGINE(engineState.mapAveragingDuration);
|
||||
if (samplingDuration <= 0) {
|
||||
firmwareError("map sampling angle should be positive");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "map sampling angle should be positive");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,
|
|||
IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S);
|
||||
|
||||
#if EFI_ENABLE_ASSERTS
|
||||
#define assertAngleRange(angle) if(angle > 10000000 || angle < -10000000) { firmwareError("angle range");angle = 0;}
|
||||
#define assertAngleRange(angle) if(angle > 10000000 || angle < -10000000) { firmwareError(OBD_PCM_Processor_Fault, "angle range");angle = 0;}
|
||||
#else
|
||||
#define assertAngleRange(angle) {}
|
||||
#endif
|
||||
|
|
|
@ -56,7 +56,7 @@ static void initEgoSensor(afr_sensor_s *sensor, ego_sensor_e type) {
|
|||
sensor->value2 = 14;
|
||||
break;
|
||||
default:
|
||||
firmwareError("Unexpected EGO %d", type);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Unexpected EGO %d", type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ float decodePressure(float voltage, air_pressure_sensor_config_s * mapConfig DEC
|
|||
case MT_MPX4100:
|
||||
return mpx4100.getValue(voltage);
|
||||
default:
|
||||
firmwareError("Unknown MAP type: %d", mapConfig->type);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Unknown MAP type: %d", mapConfig->type);
|
||||
return NAN;
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ static FastInterpolation *getDecoder(air_pressure_sensor_type_e type) {
|
|||
case MT_GM_3_BAR:
|
||||
return &gm3bar;
|
||||
default:
|
||||
firmwareError("Unknown MAP type: %d", type);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Unknown MAP type: %d", type);
|
||||
return &customMap;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ float getResistance(ThermistorConf *config) {
|
|||
|
||||
float getTemperatureC(ThermistorConf *config, ThermistorMath *tm) {
|
||||
if (!initialized) {
|
||||
firmwareError("thermstr not initialized");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "thermstr not initialized");
|
||||
return NAN;
|
||||
}
|
||||
float resistance = getResistance(config);
|
||||
|
@ -137,7 +137,7 @@ static void prepareThermistorCurve(thermistor_conf_s *tc, thermistor_curve_s * c
|
|||
|
||||
float L1 = logf(tc->resistance_1);
|
||||
if (L1 == tc->resistance_1) {
|
||||
firmwareError("log is broken?");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "log is broken?");
|
||||
}
|
||||
float L2 = logf(tc->resistance_2);
|
||||
float L3 = logf(tc->resistance_3);
|
||||
|
|
|
@ -62,7 +62,7 @@ Executor::Executor() {
|
|||
void Executor::scheduleByTime(const bool monitorReuse, scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback,
|
||||
void *param) {
|
||||
// if (delayUs < 0) {
|
||||
// firmwareError("Negative delayUs %s: %d", prefix, delayUs);
|
||||
// firmwareError(OBD_PCM_Processor_Fault, "Negative delayUs %s: %d", prefix, delayUs);
|
||||
// return;
|
||||
// }
|
||||
// if (delayUs == 0) {
|
||||
|
@ -117,7 +117,7 @@ void Executor::doExecute() {
|
|||
}
|
||||
lastExecutionCount = totalExecuted;
|
||||
if (!isLocked()) {
|
||||
firmwareError("Someone has stolen my lock");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Someone has stolen my lock");
|
||||
return;
|
||||
}
|
||||
reentrantFlag = false;
|
||||
|
|
|
@ -134,7 +134,7 @@ int EventQueue::executeAll(efitime_t now) {
|
|||
{
|
||||
efiAssert(current->callback != NULL, "callback==null1", 0);
|
||||
if (++listIterationCounter > QUEUE_LENGTH_LIMIT) {
|
||||
firmwareError("Is this list looped?");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Is this list looped?");
|
||||
return false;
|
||||
}
|
||||
if (current->momentX <= now) {
|
||||
|
|
|
@ -26,7 +26,7 @@ bool assertNotInList(T *head, T*element) {
|
|||
LL_FOREACH(head, current)
|
||||
{
|
||||
if (++counter > QUEUE_LENGTH_LIMIT) {
|
||||
firmwareError("Looped queue?");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Looped queue?");
|
||||
return false;
|
||||
}
|
||||
if (current == element) {
|
||||
|
|
|
@ -182,11 +182,11 @@ void PwmConfig::weComplexInit(const char *msg, int phaseCount, float *switchTime
|
|||
|
||||
efiAssertVoid(periodNt != 0, "period is not initialized");
|
||||
if (phaseCount == 0) {
|
||||
firmwareError("signal length cannot be zero");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "signal length cannot be zero");
|
||||
return;
|
||||
}
|
||||
if (phaseCount > PWM_PHASE_MAX_COUNT) {
|
||||
firmwareError("too many phases in PWM");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "too many phases in PWM");
|
||||
return;
|
||||
}
|
||||
efiAssertVoid(waveCount > 0, "waveCount should be positive");
|
||||
|
|
|
@ -71,7 +71,7 @@ void scheduleTask(const bool monitorReuse, const char *prefix, scheduling_s *sch
|
|||
if (monitorReuse) {
|
||||
// for (int i = 0;i<100;i++)
|
||||
printf("%s: isArmed? why? sch=%d cb=%d p=%d\r\n", prefix, (int) scheduling, (int)callback, (int)param);
|
||||
firmwareError("armored\r\n");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "armored\r\n");
|
||||
}
|
||||
#endif /* EFI_SIMULATOR */
|
||||
chVTResetI(&scheduling->timer);
|
||||
|
|
|
@ -440,7 +440,7 @@ static ALWAYS_INLINE void ignitionMathCalc(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
|||
float dwellMs = ENGINE(engineState.sparkDwell);
|
||||
|
||||
if (cisnan(dwellMs) || dwellMs < 0) {
|
||||
firmwareError("invalid dwell: %f at %d", dwellMs, rpm);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "invalid dwell: %f at %d", dwellMs, rpm);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -599,7 +599,7 @@ void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMET
|
|||
break;
|
||||
|
||||
default:
|
||||
firmwareError("initializeTriggerShape() not implemented: %d", triggerConfig->type);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "initializeTriggerShape() not implemented: %d", triggerConfig->type);
|
||||
return;
|
||||
}
|
||||
wave.checkSwitchTimes(getSize());
|
||||
|
|
|
@ -62,7 +62,7 @@ void TriggerStimulatorHelper::assertSyncPositionAndSetDutyCycle(uint32_t index,
|
|||
nextStep(state, shape, i, triggerConfig PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
if (state->getTotalRevolutionCounter() != 3) {
|
||||
firmwareError("sync failed/wrong gap parameters trigger=%s", getTrigger_type_e(engineConfiguration->trigger.type));
|
||||
firmwareError(OBD_PCM_Processor_Fault, "sync failed/wrong gap parameters trigger=%s", getTrigger_type_e(engineConfiguration->trigger.type));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,6 @@ uint32_t TriggerStimulatorHelper::doFindTrigger(TriggerShape * shape,
|
|||
if (state->shaft_is_synchronized)
|
||||
return i;
|
||||
}
|
||||
firmwareError("findTriggerZeroEventIndex() failed");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "findTriggerZeroEventIndex() failed");
|
||||
return EFI_ERROR_CODE;
|
||||
}
|
||||
|
|
|
@ -303,7 +303,7 @@ void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const waveIndex, trig
|
|||
efiAssertVoid(angle > 0, "angle should be positive");
|
||||
if (size > 0) {
|
||||
if (angle <= previousAngle) {
|
||||
firmwareError("invalid angle order: %f and %f, size=%d", angle, previousAngle, size);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "invalid angle order: %f and %f, size=%d", angle, previousAngle, size);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const waveIndex, trig
|
|||
single_wave_s *wave = &this->wave.waves[i];
|
||||
|
||||
if (wave->pinStates == NULL) {
|
||||
firmwareError("wave pinStates is NULL");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "wave pinStates is NULL");
|
||||
return;
|
||||
}
|
||||
wave->pinStates[0] = initialState[i];
|
||||
|
@ -328,7 +328,7 @@ void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const waveIndex, trig
|
|||
|
||||
int exactMatch = wave.findAngleMatch(angle, size);
|
||||
if (exactMatch != EFI_ERROR_CODE) {
|
||||
firmwareError("same angle: not supported");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "same angle: not supported");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const waveIndex, trig
|
|||
isFrontEvent[index] = TV_RISE == stateParam;
|
||||
|
||||
if (index != size) {
|
||||
firmwareError("are we ever here?");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "are we ever here?");
|
||||
}
|
||||
|
||||
// int index = size;
|
||||
|
|
|
@ -161,7 +161,7 @@ void doSlowAdc(void) {
|
|||
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("ADC slow not ready?");
|
||||
// todo: why and when does this happen? firmwareError(OBD_PCM_Processor_Fault, "ADC slow not ready?");
|
||||
slowAdc.errorsCount++;
|
||||
chSysUnlockFromIsr()
|
||||
;
|
||||
|
@ -194,7 +194,7 @@ static void pwmpcb_fast(PWMDriver *pwmp) {
|
|||
ADC_FAST_DEVICE.state != ADC_COMPLETE &&
|
||||
ADC_FAST_DEVICE.state != ADC_ERROR) {
|
||||
fastAdc.errorsCount++;
|
||||
// todo: when? why? firmwareError("ADC fast not ready?");
|
||||
// todo: when? why? firmwareError(OBD_PCM_Processor_Fault, "ADC fast not ready?");
|
||||
chSysUnlockFromIsr()
|
||||
;
|
||||
return;
|
||||
|
@ -333,7 +333,7 @@ ioportid_t getAdcChannelPort(adc_channel_e hwChannel) {
|
|||
case ADC_CHANNEL_IN15:
|
||||
return GPIOC;
|
||||
default:
|
||||
firmwareError("Unknown hw channel %d", hwChannel);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Unknown hw channel %d", hwChannel);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ int getAdcChannelPin(adc_channel_e hwChannel) {
|
|||
case ADC_CHANNEL_IN15:
|
||||
return 5;
|
||||
default:
|
||||
firmwareError("Unknown hw channel %d", hwChannel);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Unknown hw channel %d", hwChannel);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -512,7 +512,7 @@ static void addChannel(const char *name, adc_channel_e setting, adc_channel_mode
|
|||
}
|
||||
if (adcHwChannelEnabled[setting] != ADC_OFF) {
|
||||
getPinNameByAdcChannel(setting, errorMsgBuff);
|
||||
firmwareError("ADC mapping error: input %s for %s already used by %s?", errorMsgBuff, name, adcHwChannelUsage[setting]);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "ADC mapping error: input %s for %s already used by %s?", errorMsgBuff, name, adcHwChannelUsage[setting]);
|
||||
}
|
||||
|
||||
adcHwChannelUsage[setting] = name;
|
||||
|
@ -547,9 +547,9 @@ static void configureInputs(void) {
|
|||
void initAdcInputs(bool boardTestMode) {
|
||||
printMsg(&logger, "initAdcInputs()");
|
||||
if (ADC_BUF_DEPTH_FAST > MAX_ADC_GRP_BUF_DEPTH)
|
||||
firmwareError("ADC_BUF_DEPTH_FAST too high");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "ADC_BUF_DEPTH_FAST too high");
|
||||
if (ADC_BUF_DEPTH_SLOW > MAX_ADC_GRP_BUF_DEPTH)
|
||||
firmwareError("ADC_BUF_DEPTH_SLOW too high");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "ADC_BUF_DEPTH_SLOW too high");
|
||||
|
||||
configureInputs();
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ static digital_input_s * finddigital_input_s(ICUDriver *driver) {
|
|||
return ®isteredIcus.elements[i];
|
||||
}
|
||||
}
|
||||
firmwareError("reader not found");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "reader not found");
|
||||
return (digital_input_s *) NULL;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ static void icuPeriordCallBack(ICUDriver *driver) {
|
|||
|
||||
static uint32_t getAlternateFunctions(ICUDriver *driver) {
|
||||
if (driver == NULL) {
|
||||
firmwareError("getAlternateFunctions(NULL)");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "getAlternateFunctions(NULL)");
|
||||
return 0xffffffff;
|
||||
}
|
||||
#if STM32_ICU_USE_TIM1
|
||||
|
@ -88,7 +88,7 @@ static uint32_t getAlternateFunctions(ICUDriver *driver) {
|
|||
return GPIO_AF_TIM9;
|
||||
}
|
||||
#endif
|
||||
firmwareError("No such driver");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "No such driver");
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ icuchannel_t getInputCaptureChannel(brain_pin_e hwPin) {
|
|||
case GPIOE_11:
|
||||
return ICU_CHANNEL_2;
|
||||
default:
|
||||
firmwareError("Unexpected hw pin in getInputCaptureChannel %d", hwPin);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Unexpected hw pin in getInputCaptureChannel %d", hwPin);
|
||||
return ICU_CHANNEL_1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ void initOutputPinExt(const char *msg, OutputPin *outputPin, ioportid_t port, ui
|
|||
* here we check if another physical pin is already assigned to this logical output
|
||||
*/
|
||||
// todo: need to clear '&outputs' in io_pins.c
|
||||
firmwareError("outputPin [%s] already assigned to %x%d", msg, outputPin->port, outputPin->pin);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "outputPin [%s] already assigned to %x%d", msg, outputPin->port, outputPin->pin);
|
||||
return;
|
||||
}
|
||||
outputPin->currentLogicValue = INITIAL_PIN_STATE;
|
||||
|
|
|
@ -106,7 +106,7 @@ SPIDriver * getSpiDevice(spi_device_e spiDevice) {
|
|||
return &SPID3;
|
||||
}
|
||||
#endif
|
||||
firmwareError("Unexpected SPI device: %d", spiDevice);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Unexpected SPI device: %d", spiDevice);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -64,7 +64,7 @@ ioportid_t getHwPort(brain_pin_e brainPin) {
|
|||
if (brainPin == GPIO_UNASSIGNED)
|
||||
return GPIO_NULL;
|
||||
if (brainPin > GPIO_UNASSIGNED || brainPin < 0) {
|
||||
firmwareError("Invalid brain_pin_e: %d", brainPin);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Invalid brain_pin_e: %d", brainPin);
|
||||
return GPIO_NULL;
|
||||
}
|
||||
return PORTS[brainPin / PORT_SIZE];
|
||||
|
@ -74,7 +74,7 @@ ioportmask_t getHwPin(brain_pin_e brainPin) {
|
|||
if (brainPin == GPIO_UNASSIGNED)
|
||||
return EFI_ERROR_CODE;
|
||||
if (brainPin > GPIO_UNASSIGNED || brainPin < 0) {
|
||||
firmwareError("Invalid brain_pin_e: %d", brainPin);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Invalid brain_pin_e: %d", brainPin);
|
||||
return EFI_ERROR_CODE;
|
||||
}
|
||||
return brainPin % PORT_SIZE;
|
||||
|
|
|
@ -116,7 +116,7 @@ static uint32_t getExtMode(ioportid_t port) {
|
|||
} else if (port == GPIOF) {
|
||||
return EXT_MODE_GPIOF;
|
||||
}
|
||||
firmwareError("Unsupported %d", port);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Unsupported %d", port);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ void lcd_HD44780_init(Logging *sharedLogger) {
|
|||
addConsoleAction("lcdinfo", lcdInfo);
|
||||
|
||||
if (engineConfiguration->displayMode > DM_HD44780_OVER_PCF8574) {
|
||||
firmwareError("Unexpected displayMode %d", engineConfiguration->displayMode);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Unexpected displayMode %d", engineConfiguration->displayMode);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ static void callback(GPTDriver *gptp) {
|
|||
(void)gptp;
|
||||
timerCallbackCounter++;
|
||||
if (globalTimerCallback == NULL) {
|
||||
firmwareError("NULL globalTimerCallback");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "NULL globalTimerCallback");
|
||||
return;
|
||||
}
|
||||
isTimerPending = false;
|
||||
|
@ -97,7 +97,7 @@ static void usTimerWatchDog(void) {
|
|||
if (getTimeNowNt() >= lastSetTimerTimeNt + 2 * CORE_CLOCK) {
|
||||
strcpy(buff, "no_event");
|
||||
itoa10(&buff[8], lastSetTimerValue);
|
||||
firmwareError(buff);
|
||||
firmwareError(OBD_PCM_Processor_Fault, buff);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ static int getPortIndex(ioportid_t port) {
|
|||
if (port == GPIOH)
|
||||
return 6;
|
||||
#endif /* defined(STM32F4XX) */
|
||||
firmwareError("unknown port");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "unknown port");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ const char * getPinFunction(brain_input_pin_e brainPin) {
|
|||
*/
|
||||
void mySetPadMode(const char *msg, ioportid_t port, ioportmask_t pin, iomode_t mode) {
|
||||
if (!initialized) {
|
||||
firmwareError("repository not initialized");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "repository not initialized");
|
||||
return;
|
||||
}
|
||||
if (port == GPIO_NULL)
|
||||
|
@ -216,7 +216,7 @@ void mySetPadMode(const char *msg, ioportid_t port, ioportmask_t pin, iomode_t m
|
|||
* connected, so the warning is never displayed on the console and that's quite a problem!
|
||||
*/
|
||||
// warning(OBD_PCM_Processor_Fault, "%s%d req by %s used by %s", portname(port), pin, msg, PIN_USED[index]);
|
||||
firmwareError("%s%d req by %s used by %s", portname(port), pin, msg, PIN_USED[index]);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "%s%d req by %s used by %s", portname(port), pin, msg, PIN_USED[index]);
|
||||
return;
|
||||
}
|
||||
markUsed(index, msg);
|
||||
|
@ -250,7 +250,7 @@ void registedFundamentralIoPin(char *msg, ioportid_t port, ioportmask_t pin, iom
|
|||
if (PIN_USED[index] != NULL) {
|
||||
print("!!!!!!!!!!!!! Already used [%s] %d\r\n", msg, pin);
|
||||
print("!!!!!!!!!!!!! Already used by [%s]\r\n", PIN_USED[index]);
|
||||
firmwareError("pin already used");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "pin already used");
|
||||
return;
|
||||
}
|
||||
markUsed(index, msg);
|
||||
|
|
|
@ -114,7 +114,7 @@ static ICUDriver *turnOnTriggerInputPin(brain_pin_e hwPin, ICUConfig *icucfg) {
|
|||
icuEnable(driver);
|
||||
} else {
|
||||
// we would be here for example if same pin is used for multiple input capture purposes
|
||||
firmwareError("ICU unexpected state [%s]", hwPortname(hwPin));
|
||||
firmwareError(OBD_PCM_Processor_Fault, "ICU unexpected state [%s]", hwPortname(hwPin));
|
||||
}
|
||||
}
|
||||
return driver;
|
||||
|
|
|
@ -260,7 +260,7 @@ void chDbgStackOverflowPanic(Thread *otp) {
|
|||
}
|
||||
|
||||
// todo: why is this method here and not in error_handling.cpp ?
|
||||
void firmwareError(const char *errorMsg, ...) {
|
||||
void firmwareError(obd_code_e code, const char *errorMsg, ...) {
|
||||
if (hasFirmwareErrorFlag)
|
||||
return;
|
||||
ON_FATAL_ERROR()
|
||||
|
@ -293,5 +293,5 @@ int getRusEfiVersion(void) {
|
|||
return 123; // this is here to make the compiler happy about the unused array
|
||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||
return 3211; // this is here to make the compiler happy about the unused array
|
||||
return 20161009;
|
||||
return 20161010;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ static bool intermediateLoggingBufferInited = false;
|
|||
*/
|
||||
static ALWAYS_INLINE bool validateBuffer(Logging *logging, uint32_t extraLen) {
|
||||
if (logging->buffer == NULL) {
|
||||
firmwareError("Logging not initialized: %s", logging->name);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Logging not initialized: %s", logging->name);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ static void vappendPrintfI(Logging *logging, const char *fmt, va_list arg) {
|
|||
void vappendPrintf(Logging *logging, const char *fmt, va_list arg) {
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#5b");
|
||||
if (!intermediateLoggingBufferInited) {
|
||||
firmwareError("intermediateLoggingBufferInited not inited!");
|
||||
firmwareError(OBD_PCM_Processor_Fault, "intermediateLoggingBufferInited not inited!");
|
||||
return;
|
||||
}
|
||||
int wasLocked = lockAnyContext();
|
||||
|
@ -240,7 +240,7 @@ void appendMsgPostfix(Logging *logging) {
|
|||
void resetLogging(Logging *logging) {
|
||||
char *buffer = logging->buffer;
|
||||
if (buffer == NULL) {
|
||||
firmwareError("Null buffer: %s", logging->name);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Null buffer: %s", logging->name);
|
||||
return;
|
||||
}
|
||||
logging->linePointer = buffer;
|
||||
|
|
|
@ -83,7 +83,7 @@ int histogramGetIndex(int64_t value) {
|
|||
*/
|
||||
void initHistogram(histogram_s *h, const char *name) {
|
||||
if (efiStrlen(name) > sizeof(h->name) - 1) {
|
||||
firmwareError("Histogram name [%s] too long", name);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Histogram name [%s] too long", name);
|
||||
}
|
||||
strcpy(h->name, name);
|
||||
h->total_value = 0;
|
||||
|
|
|
@ -183,7 +183,7 @@ int warning(obd_code_e code, const char *fmt, ...) {
|
|||
|
||||
bool hasFirmwareErrorFlag = false;
|
||||
|
||||
void firmwareError(const char *fmt, ...) {
|
||||
void firmwareError(obd_code_e code, const char *fmt, ...) {
|
||||
printf(fmt);
|
||||
exit(-1);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ float getLEValue(Engine *engine, calc_stack_t *s, le_action_e action) {
|
|||
case LE_METHOD_FAN_OFF_SETTING:
|
||||
return 0;
|
||||
default:
|
||||
firmwareError("No mock value for %d", action);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "No mock value for %d", action);
|
||||
return NAN;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ void logMsg(const char *format, ...) {
|
|||
// fclose(fp);
|
||||
}
|
||||
|
||||
void firmwareError(const char *fmt, ...) {
|
||||
void firmwareError(obd_code_e code, const char *fmt, ...) {
|
||||
printf("firmwareError [%s]\r\n", fmt);
|
||||
|
||||
va_list ap;
|
||||
|
|
Loading…
Reference in New Issue