| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- /******************************************************************************
- 版权所有:
- 文件名称: flexcan.h
- 文件版本: 01.01
- 创建作者: sunxi
- 创建日期: 2013-02-03
- 功能说明: FLEXCAN驱动
- 其它说明:
- 修改记录:
- */
- #ifndef _FLEXCAN_H
- #define _FLEXCAN_H
- /*------------------------------- 头文件 --------------------------------------
- */
- /*------------------------------- 宏定义 --------------------------------------
- */
- #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
- 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
- /*------------------------------ 文件结束 -------------------------------------
- */
|