Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00034 #ifndef FR9BCS_CAN_H_
00035 #define FR9BCS_CAN_H_
00036
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040
00041 #include "bcs_general.h"
00042
00043 typedef UInt32 BCS_canmsg_id;
00044
00050 #define BCS_CAN_ECU "/dev/can0"
00051
00057 #define BCS_CAN_BOARD "/dev/can1"
00058
00064 #define BCS_CAN_MSG_LENGTH 8
00065
00071 typedef struct {
00072 int flags;
00073 int cob;
00074 BCS_canmsg_id id;
00075 UInt16 length;
00076 UInt8 data[BCS_CAN_MSG_LENGTH];
00077 } BCS_canmsg;
00078
00082 typedef enum {
00083 BCS_CAN_NONE,
00084 BCS_CAN_NOWAIT
00085 } BCS_CAN_Flag;
00086
00094 BCS_ERROR BCS_CAN_open(BCS_canport* fd, const char * port, BCS_CAN_Flag f);
00095
00096
00097 #define _MESSAGEIN 1
00098 #define _MESSAGEOUT 2
00099
00100 BCS_ERROR _BCS_CAN_read(BCS_canport* filedescriptor, BCS_canmsg * data, long flag);
00101 BCS_ERROR _BCS_CAN_write(BCS_canport* filedescriptor, BCS_canmsg * data, long flag);
00102
00110 static inline BCS_ERROR BCS_CAN_read(BCS_canport* fd, BCS_canmsg * dt) {
00111 return _BCS_CAN_read(fd, dt, _MESSAGEIN);
00112 }
00113
00114 static inline BCS_ERROR _SIM_CAN_read(BCS_canport* fd, BCS_canmsg * dt) {
00115 return _BCS_CAN_read(fd, dt, _MESSAGEOUT);
00116 }
00117
00125 static inline BCS_ERROR BCS_CAN_write(BCS_canport* fd, BCS_canmsg * dt) {
00126 return _BCS_CAN_write(fd, dt, _MESSAGEOUT);
00127 }
00128
00129 static inline BCS_ERROR _SIM_CAN_write(BCS_canport* fd, BCS_canmsg * dt) {
00130 return _BCS_CAN_write(fd, dt, _MESSAGEIN);
00131 }
00132
00133 #undef _MESSAGEIN
00134 #undef _MESSAGEOUT
00135
00142 BCS_ERROR BCS_CAN_close(BCS_canport* filedescriptor);
00143
00144 #ifdef __cplusplus
00145 }
00146 #endif
00147
00148 #endif