mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 05:53:35 +08:00
Added proper support for ChibiOS 4; added compile-time check that fails if IRQ vectors are not properly defined
This commit is contained in:
@@ -59,7 +59,7 @@
|
|||||||
# ifndef UAVCAN_STM32_IRQ_PRIORITY_MASK
|
# ifndef UAVCAN_STM32_IRQ_PRIORITY_MASK
|
||||||
# if (CH_KERNEL_MAJOR == 2)
|
# if (CH_KERNEL_MAJOR == 2)
|
||||||
# define UAVCAN_STM32_IRQ_PRIORITY_MASK CORTEX_PRIORITY_MASK(CORTEX_MAX_KERNEL_PRIORITY)
|
# define UAVCAN_STM32_IRQ_PRIORITY_MASK CORTEX_PRIORITY_MASK(CORTEX_MAX_KERNEL_PRIORITY)
|
||||||
# else // ChibiOS 3
|
# else // ChibiOS 3+
|
||||||
# define UAVCAN_STM32_IRQ_PRIORITY_MASK CORTEX_MAX_KERNEL_PRIORITY
|
# define UAVCAN_STM32_IRQ_PRIORITY_MASK CORTEX_MAX_KERNEL_PRIORITY
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (UAVCAN_STM32_CHIBIOS && CH_KERNEL_MAJOR == 3)
|
#if (UAVCAN_STM32_CHIBIOS && (CH_KERNEL_MAJOR == 3 || CH_KERNEL_MAJOR == 4))
|
||||||
#define CAN1_TX_IRQHandler STM32_CAN1_TX_HANDLER
|
#define CAN1_TX_IRQHandler STM32_CAN1_TX_HANDLER
|
||||||
#define CAN1_RX0_IRQHandler STM32_CAN1_RX0_HANDLER
|
#define CAN1_RX0_IRQHandler STM32_CAN1_RX0_HANDLER
|
||||||
#define CAN1_RX1_IRQHandler STM32_CAN1_RX1_HANDLER
|
#define CAN1_RX1_IRQHandler STM32_CAN1_RX1_HANDLER
|
||||||
@@ -1084,7 +1084,15 @@ static int can2_irq(const int irq, void*)
|
|||||||
}
|
}
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#else // UAVCAN_STM32_NUTTX
|
#else // UAVCAN_STM32_NUTTX
|
||||||
|
|
||||||
|
#if !defined(CAN1_TX_IRQHandler) ||\
|
||||||
|
!defined(CAN1_RX0_IRQHandler) ||\
|
||||||
|
!defined(CAN1_RX1_IRQHandler)
|
||||||
|
# error "Misconfigured build"
|
||||||
|
#endif
|
||||||
|
|
||||||
UAVCAN_STM32_IRQ_HANDLER(CAN1_TX_IRQHandler);
|
UAVCAN_STM32_IRQ_HANDLER(CAN1_TX_IRQHandler);
|
||||||
UAVCAN_STM32_IRQ_HANDLER(CAN1_TX_IRQHandler)
|
UAVCAN_STM32_IRQ_HANDLER(CAN1_TX_IRQHandler)
|
||||||
{
|
{
|
||||||
@@ -1111,6 +1119,12 @@ UAVCAN_STM32_IRQ_HANDLER(CAN1_RX1_IRQHandler)
|
|||||||
|
|
||||||
# if UAVCAN_STM32_NUM_IFACES > 1
|
# if UAVCAN_STM32_NUM_IFACES > 1
|
||||||
|
|
||||||
|
#if !defined(CAN2_TX_IRQHandler) ||\
|
||||||
|
!defined(CAN2_RX0_IRQHandler) ||\
|
||||||
|
!defined(CAN2_RX1_IRQHandler)
|
||||||
|
# error "Misconfigured build"
|
||||||
|
#endif
|
||||||
|
|
||||||
UAVCAN_STM32_IRQ_HANDLER(CAN2_TX_IRQHandler);
|
UAVCAN_STM32_IRQ_HANDLER(CAN2_TX_IRQHandler);
|
||||||
UAVCAN_STM32_IRQ_HANDLER(CAN2_TX_IRQHandler)
|
UAVCAN_STM32_IRQ_HANDLER(CAN2_TX_IRQHandler)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ bool BusEvent::wait(uavcan::MonotonicDuration duration)
|
|||||||
{
|
{
|
||||||
# if (CH_KERNEL_MAJOR == 2)
|
# if (CH_KERNEL_MAJOR == 2)
|
||||||
ret = sem_.waitTimeout(TIME_IMMEDIATE);
|
ret = sem_.waitTimeout(TIME_IMMEDIATE);
|
||||||
# else // ChibiOS 3
|
# else // ChibiOS 3+
|
||||||
ret = sem_.wait(TIME_IMMEDIATE);
|
ret = sem_.wait(TIME_IMMEDIATE);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
@@ -34,13 +34,13 @@ bool BusEvent::wait(uavcan::MonotonicDuration duration)
|
|||||||
{
|
{
|
||||||
# if (CH_KERNEL_MAJOR == 2)
|
# if (CH_KERNEL_MAJOR == 2)
|
||||||
ret = sem_.waitTimeout((msec > MaxDelayMSec) ? MS2ST(MaxDelayMSec) : MS2ST(msec));
|
ret = sem_.waitTimeout((msec > MaxDelayMSec) ? MS2ST(MaxDelayMSec) : MS2ST(msec));
|
||||||
# else // ChibiOS 3
|
# else // ChibiOS 3+
|
||||||
ret = sem_.wait((msec > MaxDelayMSec) ? MS2ST(MaxDelayMSec) : MS2ST(msec));
|
ret = sem_.wait((msec > MaxDelayMSec) ? MS2ST(MaxDelayMSec) : MS2ST(msec));
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
# if (CH_KERNEL_MAJOR == 2)
|
# if (CH_KERNEL_MAJOR == 2)
|
||||||
return ret == RDY_OK;
|
return ret == RDY_OK;
|
||||||
# else // ChibiOS 3
|
# else // ChibiOS 3+
|
||||||
return ret == MSG_OK;
|
return ret == MSG_OK;
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ void BusEvent::signalFromInterrupt()
|
|||||||
chSysLockFromIsr();
|
chSysLockFromIsr();
|
||||||
sem_.signalI();
|
sem_.signalI();
|
||||||
chSysUnlockFromIsr();
|
chSysUnlockFromIsr();
|
||||||
# else // ChibiOS 3
|
# else // ChibiOS 3+
|
||||||
chSysLockFromISR();
|
chSysLockFromISR();
|
||||||
sem_.signalI();
|
sem_.signalI();
|
||||||
chSysUnlockFromISR();
|
chSysUnlockFromISR();
|
||||||
@@ -75,7 +75,7 @@ void Mutex::unlock()
|
|||||||
{
|
{
|
||||||
# if (CH_KERNEL_MAJOR == 2)
|
# if (CH_KERNEL_MAJOR == 2)
|
||||||
chibios_rt::BaseThread::unlockMutex();
|
chibios_rt::BaseThread::unlockMutex();
|
||||||
# else // ChibiOS 3
|
# else // ChibiOS 3+
|
||||||
mtx_.unlock();
|
mtx_.unlock();
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user