bxcan.hpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. /*
  2. * The MIT License (MIT)
  3. *
  4. * Copyright (c) 2014 Pavel Kirienko
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  7. * this software and associated documentation files (the "Software"), to deal in
  8. * the Software without restriction, including without limitation the rights to
  9. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  10. * the Software, and to permit persons to whom the Software is furnished to do so,
  11. * subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in all
  14. * copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. */
  23. /*
  24. * This file is free software: you can redistribute it and/or modify it
  25. * under the terms of the GNU General Public License as published by the
  26. * Free Software Foundation, either version 3 of the License, or
  27. * (at your option) any later version.
  28. *
  29. * This file is distributed in the hope that it will be useful, but
  30. * WITHOUT ANY WARRANTY; without even the implied warranty of
  31. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  32. * See the GNU General Public License for more details.
  33. *
  34. * You should have received a copy of the GNU General Public License along
  35. * with this program. If not, see <http://www.gnu.org/licenses/>.
  36. *
  37. * Modified for Ardupilot by Siddharth Bharat Purohit
  38. */
  39. #pragma once
  40. #include "AP_HAL_ChibiOS.h"
  41. #if HAL_WITH_UAVCAN
  42. # if !defined(STM32H7XX)
  43. #include <uavcan/uavcan.hpp>
  44. #include <stdint.h>
  45. #ifndef UAVCAN_CPP_VERSION
  46. # error UAVCAN_CPP_VERSION
  47. #endif
  48. #if UAVCAN_CPP_VERSION < UAVCAN_CPP11
  49. // #undef'ed at the end of this file
  50. # define constexpr const
  51. #endif
  52. namespace ChibiOS_CAN
  53. {
  54. namespace bxcan
  55. {
  56. struct TxMailboxType
  57. {
  58. volatile uint32_t TIR;
  59. volatile uint32_t TDTR;
  60. volatile uint32_t TDLR;
  61. volatile uint32_t TDHR;
  62. };
  63. struct RxMailboxType
  64. {
  65. volatile uint32_t RIR;
  66. volatile uint32_t RDTR;
  67. volatile uint32_t RDLR;
  68. volatile uint32_t RDHR;
  69. };
  70. struct FilterRegisterType
  71. {
  72. volatile uint32_t FR1;
  73. volatile uint32_t FR2;
  74. };
  75. struct CanType
  76. {
  77. volatile uint32_t MCR; /*!< CAN master control register, Address offset: 0x00 */
  78. volatile uint32_t MSR; /*!< CAN master status register, Address offset: 0x04 */
  79. volatile uint32_t TSR; /*!< CAN transmit status register, Address offset: 0x08 */
  80. volatile uint32_t RF0R; /*!< CAN receive FIFO 0 register, Address offset: 0x0C */
  81. volatile uint32_t RF1R; /*!< CAN receive FIFO 1 register, Address offset: 0x10 */
  82. volatile uint32_t IER; /*!< CAN interrupt enable register, Address offset: 0x14 */
  83. volatile uint32_t ESR; /*!< CAN error status register, Address offset: 0x18 */
  84. volatile uint32_t BTR; /*!< CAN bit timing register, Address offset: 0x1C */
  85. uint32_t RESERVED0[88]; /*!< Reserved, 0x020 - 0x17F */
  86. TxMailboxType TxMailbox[3]; /*!< CAN Tx MailBox, Address offset: 0x180 - 0x1AC */
  87. RxMailboxType RxMailbox[2]; /*!< CAN FIFO MailBox, Address offset: 0x1B0 - 0x1CC */
  88. uint32_t RESERVED1[12]; /*!< Reserved, 0x1D0 - 0x1FF */
  89. volatile uint32_t FMR; /*!< CAN filter master register, Address offset: 0x200 */
  90. volatile uint32_t FM1R; /*!< CAN filter mode register, Address offset: 0x204 */
  91. uint32_t RESERVED2; /*!< Reserved, 0x208 */
  92. volatile uint32_t FS1R; /*!< CAN filter scale register, Address offset: 0x20C */
  93. uint32_t RESERVED3; /*!< Reserved, 0x210 */
  94. volatile uint32_t FFA1R; /*!< CAN filter FIFO assignment register, Address offset: 0x214 */
  95. uint32_t RESERVED4; /*!< Reserved, 0x218 */
  96. volatile uint32_t FA1R; /*!< CAN filter activation register, Address offset: 0x21C */
  97. uint32_t RESERVED5[8]; /*!< Reserved, 0x220-0x23F */
  98. FilterRegisterType FilterRegister[28]; /*!< CAN Filter Register, Address offset: 0x240-0x31C */
  99. };
  100. /**
  101. * CANx register sets
  102. */
  103. CanType* const Can[UAVCAN_STM32_NUM_IFACES] =
  104. {
  105. reinterpret_cast<CanType*>(0x40006400)
  106. #if UAVCAN_STM32_NUM_IFACES > 1
  107. ,
  108. reinterpret_cast<CanType*>(0x40006800)
  109. #endif
  110. };
  111. /* CAN master control register */
  112. constexpr unsigned long MCR_INRQ = (1U << 0); /* Bit 0: Initialization Request */
  113. constexpr unsigned long MCR_SLEEP = (1U << 1); /* Bit 1: Sleep Mode Request */
  114. constexpr unsigned long MCR_TXFP = (1U << 2); /* Bit 2: Transmit FIFO Priority */
  115. constexpr unsigned long MCR_RFLM = (1U << 3); /* Bit 3: Receive FIFO Locked Mode */
  116. constexpr unsigned long MCR_NART = (1U << 4); /* Bit 4: No Automatic Retransmission */
  117. constexpr unsigned long MCR_AWUM = (1U << 5); /* Bit 5: Automatic Wakeup Mode */
  118. constexpr unsigned long MCR_ABOM = (1U << 6); /* Bit 6: Automatic Bus-Off Management */
  119. constexpr unsigned long MCR_TTCM = (1U << 7); /* Bit 7: Time Triggered Communication Mode Enable */
  120. constexpr unsigned long MCR_RESET = (1U << 15);/* Bit 15: bxCAN software master reset */
  121. constexpr unsigned long MCR_DBF = (1U << 16);/* Bit 16: Debug freeze */
  122. /* CAN master status register */
  123. constexpr unsigned long MSR_INAK = (1U << 0); /* Bit 0: Initialization Acknowledge */
  124. constexpr unsigned long MSR_SLAK = (1U << 1); /* Bit 1: Sleep Acknowledge */
  125. constexpr unsigned long MSR_ERRI = (1U << 2); /* Bit 2: Error Interrupt */
  126. constexpr unsigned long MSR_WKUI = (1U << 3); /* Bit 3: Wakeup Interrupt */
  127. constexpr unsigned long MSR_SLAKI = (1U << 4); /* Bit 4: Sleep acknowledge interrupt */
  128. constexpr unsigned long MSR_TXM = (1U << 8); /* Bit 8: Transmit Mode */
  129. constexpr unsigned long MSR_RXM = (1U << 9); /* Bit 9: Receive Mode */
  130. constexpr unsigned long MSR_SAMP = (1U << 10);/* Bit 10: Last Sample Point */
  131. constexpr unsigned long MSR_RX = (1U << 11);/* Bit 11: CAN Rx Signal */
  132. /* CAN transmit status register */
  133. constexpr unsigned long TSR_RQCP0 = (1U << 0); /* Bit 0: Request Completed Mailbox 0 */
  134. constexpr unsigned long TSR_TXOK0 = (1U << 1); /* Bit 1 : Transmission OK of Mailbox 0 */
  135. constexpr unsigned long TSR_ALST0 = (1U << 2); /* Bit 2 : Arbitration Lost for Mailbox 0 */
  136. constexpr unsigned long TSR_TERR0 = (1U << 3); /* Bit 3 : Transmission Error of Mailbox 0 */
  137. constexpr unsigned long TSR_ABRQ0 = (1U << 7); /* Bit 7 : Abort Request for Mailbox 0 */
  138. constexpr unsigned long TSR_RQCP1 = (1U << 8); /* Bit 8 : Request Completed Mailbox 1 */
  139. constexpr unsigned long TSR_TXOK1 = (1U << 9); /* Bit 9 : Transmission OK of Mailbox 1 */
  140. constexpr unsigned long TSR_ALST1 = (1U << 10);/* Bit 10 : Arbitration Lost for Mailbox 1 */
  141. constexpr unsigned long TSR_TERR1 = (1U << 11);/* Bit 11 : Transmission Error of Mailbox 1 */
  142. constexpr unsigned long TSR_ABRQ1 = (1U << 15);/* Bit 15 : Abort Request for Mailbox 1 */
  143. constexpr unsigned long TSR_RQCP2 = (1U << 16);/* Bit 16 : Request Completed Mailbox 2 */
  144. constexpr unsigned long TSR_TXOK2 = (1U << 17);/* Bit 17 : Transmission OK of Mailbox 2 */
  145. constexpr unsigned long TSR_ALST2 = (1U << 18);/* Bit 18: Arbitration Lost for Mailbox 2 */
  146. constexpr unsigned long TSR_TERR2 = (1U << 19);/* Bit 19: Transmission Error of Mailbox 2 */
  147. constexpr unsigned long TSR_ABRQ2 = (1U << 23);/* Bit 23: Abort Request for Mailbox 2 */
  148. constexpr unsigned long TSR_CODE_SHIFT = (24U); /* Bits 25-24: Mailbox Code */
  149. constexpr unsigned long TSR_CODE_MASK = (3U << TSR_CODE_SHIFT);
  150. constexpr unsigned long TSR_TME0 = (1U << 26);/* Bit 26: Transmit Mailbox 0 Empty */
  151. constexpr unsigned long TSR_TME1 = (1U << 27);/* Bit 27: Transmit Mailbox 1 Empty */
  152. constexpr unsigned long TSR_TME2 = (1U << 28);/* Bit 28: Transmit Mailbox 2 Empty */
  153. constexpr unsigned long TSR_LOW0 = (1U << 29);/* Bit 29: Lowest Priority Flag for Mailbox 0 */
  154. constexpr unsigned long TSR_LOW1 = (1U << 30);/* Bit 30: Lowest Priority Flag for Mailbox 1 */
  155. constexpr unsigned long TSR_LOW2 = (1U << 31);/* Bit 31: Lowest Priority Flag for Mailbox 2 */
  156. /* CAN receive FIFO 0/1 registers */
  157. constexpr unsigned long RFR_FMP_SHIFT = (0U); /* Bits 1-0: FIFO Message Pending */
  158. constexpr unsigned long RFR_FMP_MASK = (3U << RFR_FMP_SHIFT);
  159. constexpr unsigned long RFR_FULL = (1U << 3); /* Bit 3: FIFO 0 Full */
  160. constexpr unsigned long RFR_FOVR = (1U << 4); /* Bit 4: FIFO 0 Overrun */
  161. constexpr unsigned long RFR_RFOM = (1U << 5); /* Bit 5: Release FIFO 0 Output Mailbox */
  162. /* CAN interrupt enable register */
  163. constexpr unsigned long IER_TMEIE = (1U << 0); /* Bit 0: Transmit Mailbox Empty Interrupt Enable */
  164. constexpr unsigned long IER_FMPIE0 = (1U << 1); /* Bit 1: FIFO Message Pending Interrupt Enable */
  165. constexpr unsigned long IER_FFIE0 = (1U << 2); /* Bit 2: FIFO Full Interrupt Enable */
  166. constexpr unsigned long IER_FOVIE0 = (1U << 3); /* Bit 3: FIFO Overrun Interrupt Enable */
  167. constexpr unsigned long IER_FMPIE1 = (1U << 4); /* Bit 4: FIFO Message Pending Interrupt Enable */
  168. constexpr unsigned long IER_FFIE1 = (1U << 5); /* Bit 5: FIFO Full Interrupt Enable */
  169. constexpr unsigned long IER_FOVIE1 = (1U << 6); /* Bit 6: FIFO Overrun Interrupt Enable */
  170. constexpr unsigned long IER_EWGIE = (1U << 8); /* Bit 8: Error Warning Interrupt Enable */
  171. constexpr unsigned long IER_EPVIE = (1U << 9); /* Bit 9: Error Passive Interrupt Enable */
  172. constexpr unsigned long IER_BOFIE = (1U << 10);/* Bit 10: Bus-Off Interrupt Enable */
  173. constexpr unsigned long IER_LECIE = (1U << 11);/* Bit 11: Last Error Code Interrupt Enable */
  174. constexpr unsigned long IER_ERRIE = (1U << 15);/* Bit 15: Error Interrupt Enable */
  175. constexpr unsigned long IER_WKUIE = (1U << 16);/* Bit 16: Wakeup Interrupt Enable */
  176. constexpr unsigned long IER_SLKIE = (1U << 17);/* Bit 17: Sleep Interrupt Enable */
  177. /* CAN error status register */
  178. constexpr unsigned long ESR_EWGF = (1U << 0); /* Bit 0: Error Warning Flag */
  179. constexpr unsigned long ESR_EPVF = (1U << 1); /* Bit 1: Error Passive Flag */
  180. constexpr unsigned long ESR_BOFF = (1U << 2); /* Bit 2: Bus-Off Flag */
  181. constexpr unsigned long ESR_LEC_SHIFT = (4U); /* Bits 6-4: Last Error Code */
  182. constexpr unsigned long ESR_LEC_MASK = (7U << ESR_LEC_SHIFT);
  183. constexpr unsigned long ESR_NOERROR = (0U << ESR_LEC_SHIFT);/* 000: No Error */
  184. constexpr unsigned long ESR_STUFFERROR = (1U << ESR_LEC_SHIFT);/* 001: Stuff Error */
  185. constexpr unsigned long ESR_FORMERROR = (2U << ESR_LEC_SHIFT);/* 010: Form Error */
  186. constexpr unsigned long ESR_ACKERROR = (3U << ESR_LEC_SHIFT);/* 011: Acknowledgment Error */
  187. constexpr unsigned long ESR_BRECERROR = (4U << ESR_LEC_SHIFT);/* 100: Bit recessive Error */
  188. constexpr unsigned long ESR_BDOMERROR = (5U << ESR_LEC_SHIFT);/* 101: Bit dominant Error */
  189. constexpr unsigned long ESR_CRCERRPR = (6U << ESR_LEC_SHIFT);/* 110: CRC Error */
  190. constexpr unsigned long ESR_SWERROR = (7U << ESR_LEC_SHIFT);/* 111: Set by software */
  191. constexpr unsigned long ESR_TEC_SHIFT = (16U); /* Bits 23-16: LS byte of the 9-bit Transmit Error Counter */
  192. constexpr unsigned long ESR_TEC_MASK = (0xFFU << ESR_TEC_SHIFT);
  193. constexpr unsigned long ESR_REC_SHIFT = (24U); /* Bits 31-24: Receive Error Counter */
  194. constexpr unsigned long ESR_REC_MASK = (0xFFU << ESR_REC_SHIFT);
  195. /* CAN bit timing register */
  196. constexpr unsigned long BTR_BRP_SHIFT = (0U); /* Bits 9-0: Baud Rate Prescaler */
  197. constexpr unsigned long BTR_BRP_MASK = (0x03FFU << BTR_BRP_SHIFT);
  198. constexpr unsigned long BTR_TS1_SHIFT = (16U); /* Bits 19-16: Time Segment 1 */
  199. constexpr unsigned long BTR_TS1_MASK = (0x0FU << BTR_TS1_SHIFT);
  200. constexpr unsigned long BTR_TS2_SHIFT = (20U); /* Bits 22-20: Time Segment 2 */
  201. constexpr unsigned long BTR_TS2_MASK = (7U << BTR_TS2_SHIFT);
  202. constexpr unsigned long BTR_SJW_SHIFT = (24U); /* Bits 25-24: Resynchronization Jump Width */
  203. constexpr unsigned long BTR_SJW_MASK = (3U << BTR_SJW_SHIFT);
  204. constexpr unsigned long BTR_LBKM = (1U << 30);/* Bit 30: Loop Back Mode (Debug);*/
  205. constexpr unsigned long BTR_SILM = (1U << 31);/* Bit 31: Silent Mode (Debug);*/
  206. constexpr unsigned long BTR_BRP_MAX = (1024U); /* Maximum BTR value (without decrement);*/
  207. constexpr unsigned long BTR_TSEG1_MAX = (16U); /* Maximum TSEG1 value (without decrement);*/
  208. constexpr unsigned long BTR_TSEG2_MAX = (8U); /* Maximum TSEG2 value (without decrement);*/
  209. /* TX mailbox identifier register */
  210. constexpr unsigned long TIR_TXRQ = (1U << 0); /* Bit 0: Transmit Mailbox Request */
  211. constexpr unsigned long TIR_RTR = (1U << 1); /* Bit 1: Remote Transmission Request */
  212. constexpr unsigned long TIR_IDE = (1U << 2); /* Bit 2: Identifier Extension */
  213. constexpr unsigned long TIR_EXID_SHIFT = (3U); /* Bit 3-31: Extended Identifier */
  214. constexpr unsigned long TIR_EXID_MASK = (0x1FFFFFFFU << TIR_EXID_SHIFT);
  215. constexpr unsigned long TIR_STID_SHIFT = (21U); /* Bits 21-31: Standard Identifier */
  216. constexpr unsigned long TIR_STID_MASK = (0x07FFU << TIR_STID_SHIFT);
  217. /* Mailbox data length control and time stamp register */
  218. constexpr unsigned long TDTR_DLC_SHIFT = (0U); /* Bits 3:0: Data Length Code */
  219. constexpr unsigned long TDTR_DLC_MASK = (0x0FU << TDTR_DLC_SHIFT);
  220. constexpr unsigned long TDTR_TGT = (1U << 8); /* Bit 8: Transmit Global Time */
  221. constexpr unsigned long TDTR_TIME_SHIFT = (16U); /* Bits 31:16: Message Time Stamp */
  222. constexpr unsigned long TDTR_TIME_MASK = (0xFFFFU << TDTR_TIME_SHIFT);
  223. /* Mailbox data low register */
  224. constexpr unsigned long TDLR_DATA0_SHIFT = (0U); /* Bits 7-0: Data Byte 0 */
  225. constexpr unsigned long TDLR_DATA0_MASK = (0xFFU << TDLR_DATA0_SHIFT);
  226. constexpr unsigned long TDLR_DATA1_SHIFT = (8U); /* Bits 15-8: Data Byte 1 */
  227. constexpr unsigned long TDLR_DATA1_MASK = (0xFFU << TDLR_DATA1_SHIFT);
  228. constexpr unsigned long TDLR_DATA2_SHIFT = (16U); /* Bits 23-16: Data Byte 2 */
  229. constexpr unsigned long TDLR_DATA2_MASK = (0xFFU << TDLR_DATA2_SHIFT);
  230. constexpr unsigned long TDLR_DATA3_SHIFT = (24U); /* Bits 31-24: Data Byte 3 */
  231. constexpr unsigned long TDLR_DATA3_MASK = (0xFFU << TDLR_DATA3_SHIFT);
  232. /* Mailbox data high register */
  233. constexpr unsigned long TDHR_DATA4_SHIFT = (0U); /* Bits 7-0: Data Byte 4 */
  234. constexpr unsigned long TDHR_DATA4_MASK = (0xFFU << TDHR_DATA4_SHIFT);
  235. constexpr unsigned long TDHR_DATA5_SHIFT = (8U); /* Bits 15-8: Data Byte 5 */
  236. constexpr unsigned long TDHR_DATA5_MASK = (0xFFU << TDHR_DATA5_SHIFT);
  237. constexpr unsigned long TDHR_DATA6_SHIFT = (16U); /* Bits 23-16: Data Byte 6 */
  238. constexpr unsigned long TDHR_DATA6_MASK = (0xFFU << TDHR_DATA6_SHIFT);
  239. constexpr unsigned long TDHR_DATA7_SHIFT = (24U); /* Bits 31-24: Data Byte 7 */
  240. constexpr unsigned long TDHR_DATA7_MASK = (0xFFU << TDHR_DATA7_SHIFT);
  241. /* Rx FIFO mailbox identifier register */
  242. constexpr unsigned long RIR_RTR = (1U << 1); /* Bit 1: Remote Transmission Request */
  243. constexpr unsigned long RIR_IDE = (1U << 2); /* Bit 2: Identifier Extension */
  244. constexpr unsigned long RIR_EXID_SHIFT = (3U); /* Bit 3-31: Extended Identifier */
  245. constexpr unsigned long RIR_EXID_MASK = (0x1FFFFFFFU << RIR_EXID_SHIFT);
  246. constexpr unsigned long RIR_STID_SHIFT = (21U); /* Bits 21-31: Standard Identifier */
  247. constexpr unsigned long RIR_STID_MASK = (0x07FFU << RIR_STID_SHIFT);
  248. /* Receive FIFO mailbox data length control and time stamp register */
  249. constexpr unsigned long RDTR_DLC_SHIFT = (0U); /* Bits 3:0: Data Length Code */
  250. constexpr unsigned long RDTR_DLC_MASK = (0x0FU << RDTR_DLC_SHIFT);
  251. constexpr unsigned long RDTR_FM_SHIFT = (8U); /* Bits 15-8: Filter Match Index */
  252. constexpr unsigned long RDTR_FM_MASK = (0xFFU << RDTR_FM_SHIFT);
  253. constexpr unsigned long RDTR_TIME_SHIFT = (16U); /* Bits 31:16: Message Time Stamp */
  254. constexpr unsigned long RDTR_TIME_MASK = (0xFFFFU << RDTR_TIME_SHIFT);
  255. /* Receive FIFO mailbox data low register */
  256. constexpr unsigned long RDLR_DATA0_SHIFT = (0U); /* Bits 7-0: Data Byte 0 */
  257. constexpr unsigned long RDLR_DATA0_MASK = (0xFFU << RDLR_DATA0_SHIFT);
  258. constexpr unsigned long RDLR_DATA1_SHIFT = (8U); /* Bits 15-8: Data Byte 1 */
  259. constexpr unsigned long RDLR_DATA1_MASK = (0xFFU << RDLR_DATA1_SHIFT);
  260. constexpr unsigned long RDLR_DATA2_SHIFT = (16U); /* Bits 23-16: Data Byte 2 */
  261. constexpr unsigned long RDLR_DATA2_MASK = (0xFFU << RDLR_DATA2_SHIFT);
  262. constexpr unsigned long RDLR_DATA3_SHIFT = (24U); /* Bits 31-24: Data Byte 3 */
  263. constexpr unsigned long RDLR_DATA3_MASK = (0xFFU << RDLR_DATA3_SHIFT);
  264. /* Receive FIFO mailbox data high register */
  265. constexpr unsigned long RDHR_DATA4_SHIFT = (0U); /* Bits 7-0: Data Byte 4 */
  266. constexpr unsigned long RDHR_DATA4_MASK = (0xFFU << RDHR_DATA4_SHIFT);
  267. constexpr unsigned long RDHR_DATA5_SHIFT = (8U); /* Bits 15-8: Data Byte 5 */
  268. constexpr unsigned long RDHR_DATA5_MASK = (0xFFU << RDHR_DATA5_SHIFT);
  269. constexpr unsigned long RDHR_DATA6_SHIFT = (16U); /* Bits 23-16: Data Byte 6 */
  270. constexpr unsigned long RDHR_DATA6_MASK = (0xFFU << RDHR_DATA6_SHIFT);
  271. constexpr unsigned long RDHR_DATA7_SHIFT = (24U); /* Bits 31-24: Data Byte 7 */
  272. constexpr unsigned long RDHR_DATA7_MASK = (0xFFU << RDHR_DATA7_SHIFT);
  273. /* CAN filter master register */
  274. constexpr unsigned long FMR_FINIT = (1U << 0); /* Bit 0: Filter Init Mode */
  275. }
  276. }
  277. #if UAVCAN_CPP_VERSION < UAVCAN_CPP11
  278. # undef constexpr
  279. #endif
  280. #endif //!defined(STM32H7XX)
  281. #endif //HAL_WITH_UAVCAN