manual picking from ChibiOS migration branch to make my evening a little less depressing

This commit is contained in:
rusefi 2017-03-27 22:54:22 -04:00
parent bf129a65e8
commit ac6dc3c0f1
2 changed files with 9 additions and 9 deletions

View File

@ -151,7 +151,7 @@ void runConsoleLoop(ts_channel_s *console) {
}
while (true) {
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#9e");
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "lowstck#9e");
bool end = getConsoleLine((BaseSequentialStream*) console->channel, console->crcReadBuffer, sizeof(console->crcReadBuffer) - 3);
if (end) {
// firmware simulator is the only case when this happens
@ -285,7 +285,7 @@ bool lockAnyContext(void) {
if (alreadyLocked)
return true;
if (isIsrContext()) {
chSysLockFromIsr()
chSysLockFromISR()
;
} else {
chSysLock()
@ -300,7 +300,7 @@ bool lockOutputBuffer(void) {
void unlockAnyContext(void) {
if (isIsrContext()) {
chSysUnlockFromIsr()
chSysUnlockFromISR()
;
} else {
chSysUnlock()

View File

@ -91,7 +91,7 @@ static bool isAveraging = false;
static void startAveraging(void *arg) {
(void) arg;
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#9");
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#9");
bool wasLocked = lockAnyContext();
;
// with locking we would have a consistent state
@ -99,7 +99,7 @@ static void startAveraging(void *arg) {
mapMeasurementsCounter = 0;
isAveraging = true;
if (!wasLocked)
chSysUnlockFromIsr()
chSysUnlockFromISR()
;
turnPinHigh(&mapAveragingPin);
}
@ -117,7 +117,7 @@ void mapAveragingCallback(adcsample_t adcValue) {
/* Calculates the average values from the ADC samples.*/
measurementsPerRevolutionCounter++;
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#9a");
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#9a");
#if (EFI_SENSOR_CHART && EFI_ANALOG_SENSORS) || defined(__DOXYGEN__)
if (ENGINE(sensorChartMode) == SC_MAP) {
@ -144,13 +144,13 @@ void mapAveragingCallback(adcsample_t adcValue) {
readIndex = writeIndex;
// todo: migrate to the lock-free implementation
chSysLockFromIsr()
chSysLockFromISR()
;
// with locking we would have a consistent state
mapAccumulator += adcValue;
mapMeasurementsCounter++;
chSysUnlockFromIsr()
chSysUnlockFromISR()
;
}
#endif
@ -165,7 +165,7 @@ static void endAveraging(void *arg) {
mapAccumulator / mapMeasurementsCounter);
#endif
if (!wasLocked)
chSysUnlockFromIsr()
chSysUnlockFromISR()
;
turnPinLow(&mapAveragingPin);
}