123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- #pragma once
- #include "AP_HAL_ChibiOS.h"
- #if HAL_WITH_UAVCAN
- #include <hal.h>
- #include <ch.h>
- #ifndef UAVCAN_STM32_LOG
- # if 0
- # define UAVCAN_STM32_LOG(fmt, ...) syslog("uavcan_stm32: " fmt "\n", ##__VA_ARGS__)
- # else
- # define UAVCAN_STM32_LOG(...) ((void)0)
- # endif
- #endif
- # define UAVCAN_STM32_IRQ_HANDLER(id) CH_IRQ_HANDLER(id)
- # define UAVCAN_STM32_IRQ_PROLOGUE() CH_IRQ_PROLOGUE()
- # define UAVCAN_STM32_IRQ_EPILOGUE() CH_IRQ_EPILOGUE()
- # ifndef UAVCAN_STM32_IRQ_PRIORITY_MASK
- # if (CH_KERNEL_MAJOR == 2)
- # define UAVCAN_STM32_IRQ_PRIORITY_MASK CORTEX_PRIORITY_MASK(CORTEX_MAX_KERNEL_PRIORITY)
- # else
- # define UAVCAN_STM32_IRQ_PRIORITY_MASK CORTEX_MAX_KERNEL_PRIORITY
- # endif
- # endif
- #define UAVCAN_STM32_GLUE2_(A, B) A##B
- #define UAVCAN_STM32_GLUE2(A, B) UAVCAN_STM32_GLUE2_(A, B)
- #define UAVCAN_STM32_GLUE3_(A, B, C) A##B##C
- #define UAVCAN_STM32_GLUE3(A, B, C) UAVCAN_STM32_GLUE3_(A, B, C)
- namespace ChibiOS_CAN {
- struct CriticalSectionLocker {
- CriticalSectionLocker()
- {
- chSysSuspend();
- }
- ~CriticalSectionLocker()
- {
- chSysEnable();
- }
- };
- namespace clock {
- uint64_t getUtcUSecFromCanInterrupt();
- }
- }
- #endif
|