📄 can_ifc.h
字号:
/******************************************************************************
C167CR CAN Ap. Note project
Header file for CAN hardware (non RTX-166 ap. note only)
Copyright (c) 1997 Keil Software
******************************************************************************/
#include "canregs.h" /* Describes CAN registers */
/* Given a message id, the following macro computes the value to write to
the arbitr member of a CAN message object structure. If a standard
(i.e., 11-bit) identifier is being used, the significant bits are
28...18, not 10...0. If you are specifying 11-bit message ids in bit
positions 10...0 and wish to use this macro, make sure the id is an
unsigned long, and shift it left 18 bit positions, e.g.,
ARBITR((unsigned long)std_id << 18)
*/
#define ARBITR(id) ((unsigned long)(id) >> 21 & 0x000000ff | \
(unsigned long)(id) >> 5 & 0x0000ff00 | \
(unsigned long)(id) << 11 & 0x00ff0000 | \
(unsigned long)(id) << 27)
/* The MSG_CFG macro computes the value for a CAN object message
configuration register (msg_cfg member of the CAN_MSGOBJ[]).
dlc is data length code. must be 0...8.
dir is direction. 0 (CANDIR_RECEIVE) receive; 1 (CANDIR_TRANSMIT) transmit
xtd is extended flag. 0 standard (11 bit) id; 1 extended (29 bit) id
*/
#define MSG_CFG(dlc,dir,xtd) ((dlc) << 4 | (dir) << 3 | (xtd) << 2)
#define CANDIR_RECEIVE 0
#define CANDIR_TRANSMIT 1
void
begin_can_init(void);
void
end_can_init(
unsigned interrupt_enable_flags);
int
copy_received_can_message(
int object_number,
void *buf);
int
update_can_transmit_message(
int object_number,
void *buf,
int length);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -