drv_can.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021-02-09 shelton the first version
  9. */
  10. #ifndef __DRV_CAN_H__
  11. #define __DRV_CAN_H__
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #include <board.h>
  16. #include <rtdevice.h>
  17. #include <rtthread.h>
  18. #define CAN_TX_MAILBOX0 (0x00000001U) /*!< Tx Mailbox 0 */
  19. #define CAN_TX_MAILBOX1 (0x00000002U) /*!< Tx Mailbox 1 */
  20. #define CAN_TX_MAILBOX2 (0x00000004U) /*!< Tx Mailbox 2 */
  21. struct at32_baud_rate_tab
  22. {
  23. rt_uint32_t baud_rate;
  24. rt_uint32_t sjw;
  25. rt_uint32_t bs1;
  26. rt_uint32_t bs2;
  27. rt_uint32_t psc;
  28. };
  29. struct CAN_Handler
  30. {
  31. CAN_Type *Instance;
  32. CAN_InitType CanInit;
  33. CAN_FilterInitType FilterConfig;
  34. };
  35. /* at32 can device */
  36. struct at32_can
  37. {
  38. char *name;
  39. struct CAN_Handler CanConfig;
  40. struct rt_can_device device; /* inherit from can device */
  41. };
  42. int rt_hw_can_init(void);
  43. #ifdef __cplusplus
  44. }
  45. #endif
  46. #endif /*__DRV_CAN_H__ */
  47. /************************** end of file ******************/