| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- /******************************************************************************
- 版权所有:
- 文件名称: flexcan.h
- 文件版本: 01.01
- 创建作者: sunxi
- 创建日期: 2013-02-03
- 功能说明: FLEXCAN驱动
- 其它说明:
- 修改记录:
- */
- #ifndef _FLEXCAN_H
- #define _FLEXCAN_H
- /*------------------------------- 头文件 --------------------------------------
- */
- #include "rt_types.h"
- /*------------------------------- 宏定义 --------------------------------------
- */
- #define RT_CAN_NUM 4 // 原始can数量
- #define RT_CAN_DEV_TYPE 4 // can设备类型
- #define RT_M_CAN0 0x0453C800
- #define RT_M_RAM0 0x04538000
- #define RT_M_TOP0 0x04530000
- #define RT_M_DMA0 0x04534000
- #define RT_M_CAN1 0x04541800
- #define RT_M_RAM1 0x0453D000
- #define RT_M_TOP1 0x04531000
- #define RT_M_DMA1 0x04535000
- #define RT_M_CAN2 0x04546800
- #define RT_M_RAM2 0x04542000
- #define RT_M_TOP2 0x04532000
- #define RT_M_DMA2 0x04536000
- #define RT_M_CAN3 0x0454B800
- #define RT_M_RAM3 0x04547000
- #define RT_M_TOP3 0x04533000
- #define RT_M_DMA3 0x04537000
- #define CAN_BUS_NUM 2 // 底板支持的CAN总线数量
- #define CAN_BUS_ADDR_NUM 16 // 底板支持的插槽数量(与CAN地址数量一一对应)
- #define CAN_BUS_ADDR_BCAST 0X0F // 广播地址
- #define CAN_FRAME_LEN_MAX 256
- #define CAN_MB 16 // can buffer
- #define MB_CNT_CODE(x) (((x)&0x0F)<<24)
- typedef int (*FN_CAN_RECV_CALLBACK)(u32 no,u8 * buf);
- /*------------------------------ 类型结构 -------------------------------------
- */
- struct can_frame_head
- {
- u8 type;
- u8 dst;
- u8 src;
- u8 len;
- };
- /*------------------------------ 函数声明 -------------------------------------
- */
- int can_init(void);
- int can_exit(void);
- int can_regester_recv_callback(FN_CAN_RECV_CALLBACK fn);
- u8 * can_request_tx_buf(u8 type);
- int can_send(u32 no,u8 *buf);
- int can_recv(u32 no,u8 *buf,u32 len);
- int can_stat(void);
- int can_stat_reset(void);
- int can_test(void);
- #endif //_FLEXCAN_H
- /*------------------------------ 文件结束 -------------------------------------
- */
|