Added proper support for ChibiOS 4; added compile-time check that fails if IRQ vectors are not properly defined

This commit is contained in:
Pavel Kirienko
2017-01-23 04:09:00 +03:00
parent dcbb573972
commit f1fc72ef7a
3 changed files with 21 additions and 7 deletions
@@ -26,7 +26,7 @@ bool BusEvent::wait(uavcan::MonotonicDuration duration)
{
# if (CH_KERNEL_MAJOR == 2)
ret = sem_.waitTimeout(TIME_IMMEDIATE);
# else // ChibiOS 3
# else // ChibiOS 3+
ret = sem_.wait(TIME_IMMEDIATE);
# endif
}
@@ -34,13 +34,13 @@ bool BusEvent::wait(uavcan::MonotonicDuration duration)
{
# if (CH_KERNEL_MAJOR == 2)
ret = sem_.waitTimeout((msec > MaxDelayMSec) ? MS2ST(MaxDelayMSec) : MS2ST(msec));
# else // ChibiOS 3
# else // ChibiOS 3+
ret = sem_.wait((msec > MaxDelayMSec) ? MS2ST(MaxDelayMSec) : MS2ST(msec));
# endif
}
# if (CH_KERNEL_MAJOR == 2)
return ret == RDY_OK;
# else // ChibiOS 3
# else // ChibiOS 3+
return ret == MSG_OK;
# endif
}
@@ -56,7 +56,7 @@ void BusEvent::signalFromInterrupt()
chSysLockFromIsr();
sem_.signalI();
chSysUnlockFromIsr();
# else // ChibiOS 3
# else // ChibiOS 3+
chSysLockFromISR();
sem_.signalI();
chSysUnlockFromISR();
@@ -75,7 +75,7 @@ void Mutex::unlock()
{
# if (CH_KERNEL_MAJOR == 2)
chibios_rt::BaseThread::unlockMutex();
# else // ChibiOS 3
# else // ChibiOS 3+
mtx_.unlock();
# endif
}