12 #ifndef INCLUDE_JBUS_CAN_DEV_H_ 13 #define INCLUDE_JBUS_CAN_DEV_H_ 17 #include <sys/iomsg.h> 18 #include <sys/iofunc.h> 24 #define MAX_MSG_BUF 1000 28 #define PATH_CAN_ID(j) ((((j)->priority & 0x7) << 26) | \ 29 (((j)->reserved & 0x1) << 25) | \ 30 (((j)->data_page & 0x1) << 24) | \ 31 (((j)->pdu_format & 0xff) << 16) | \ 32 (((j)->pdu_specific & 0xff) << 8) | \ 33 (((j)->src_address & 0xff))) 34 #define PATH_CAN_PRIORITY(j) (((j) >> 26) & 0x7) 35 #define PATH_CAN_PF(j) (((j) >> 16) & 0xff) 36 #define PATH_CAN_PS(j) (((j) >> 8) & 0xff) 37 #define PATH_CAN_SA(j) ((j) & 0xff) 41 #define IS_EXTENDED_FRAME(MSG) ((MSG).id & 0x80000000) 42 #define SET_EXTENDED_FRAME(MSG) ((MSG).id |= 0x80000000) 43 #define CAN_ID(MSG) ((MSG).id & ~0x80000000) 76 int use_extended_frame;
85 unsigned int shadow_buffer_count;
86 unsigned int intr_in_handler_count;
87 unsigned int rx_interrupt_count;
88 unsigned int rx_message_lost_count;
89 unsigned int tx_interrupt_count;
127 #define DEFAULT_CONFIG "realtime.ini" 130 #define DEFAULT_DEVICE "/dev/can1" 133 #define INI_IRQ_ENTRY "Irq" 136 #define INI_PORT_ENTRY "Port" 139 #define INI_EXT_ENTRY "Ext" 142 #define DEFAULT_IRQ 0 145 #define DEFAULT_PORT 0x210 149 #define DEFAULT_QSIZE 150 185 virtual void init(
unsigned int base_address,
unsigned int bit_speed,
186 BYTE extended_frame);
282 int _baud[MAX_CHANNELS] = { 0x0 };
284 unsigned int _acc_code[MAX_CHANNELS] = { 0x0 };
286 unsigned int _acc_mask[MAX_CHANNELS] = { 0x0 };
289 time_t _last_time_can_sent;
297 canregs_t *_base_addr;
306 virtual int _start_chip(
int minor);
315 int _stop_chip(
int minor);
334 virtual int _reset_chip(
int minor);
347 virtual int _set_timing(
int minor,
int baud);
360 virtual int _set_mask(
int minor,
unsigned int code,
unsigned int mask);
371 int _set_omode(
int minor,
int arg);
390 int _set_listen_only_mode(
int minor,
int arg);
403 iofunc_attr_t io_attr;
418 #define IOFUNC_OCB_T can_ocb_t 422 #define IOFUNC_ATTR_T can_attr_t 445 extern int can_dev_arm(resmgr_context_t *ctp, iofunc_ocb_t *io_ocb,
464 extern void pulse_init(dispatch_t *dpp, IOFUNC_ATTR_T *pattr);
494 extern int io_devctl(resmgr_context_t *ctp, io_devctl_t *msg,
495 RESMGR_OCB_T *io_ocb);
524 extern int io_open(resmgr_context_t *ctp, io_open_t *msg,
525 RESMGR_HANDLE_T *handle,
void *extra);
int can_notify_client_err
Definition: can_man.h:174
Definition: can_man.h:405
void pulse_init(dispatch_t *dpp, IOFUNC_ATTR_T *pattr)
virtual void send(CircularBuffer *out_buff)
Definition: can_dev.cpp:371
virtual can_err_count_t clear_errs()
Definition: can_dev.cpp:143
virtual can_err_count_t get_errs()
Definition: can_dev.cpp:153
virtual can_msg_t read(CircularBuffer *in_buff)
Definition: can_dev.cpp:244
unsigned char BYTE
Definition: common.h:39
virtual void init(unsigned int base_address, unsigned int bit_speed, BYTE extended_frame)
Definition: can_dev.cpp:38
virtual int interrupt(CircularBuffer *in_buff, CircularBuffer *out_buff, can_filter_t filter)
Definition: can_dev.cpp:158
int tx_buffer_flush
Definition: can_man.h:171
int io_devctl(resmgr_context_t *ctp, io_devctl_t *msg, RESMGR_OCB_T *io_ocb)
int io_open(resmgr_context_t *ctp, io_open_t *msg, RESMGR_HANDLE_T *handle, void *extra)
Definition: io_func.cpp:95
Definition: can_man.h:162
int can_dev_arm(resmgr_context_t *ctp, iofunc_ocb_t *io_ocb, sigevent event)
Definition: can_if.cpp:16
virtual void rx_process_interrupt(CircularBuffer *in_buff, can_filter_t filter)
Definition: can_dev.cpp:269
int mask_count_non_zero
Definition: can_man.h:177
virtual void tx_process_interrupt(CircularBuffer *out_buff)
Definition: can_dev.cpp:319
virtual ~CANDeviceManager()
Definition: can_dev.cpp:133
Definition: can_man.h:103
int can_timeout_count
Definition: can_man.h:167
virtual int write(CircularBuffer *out_buff, can_msg_t *pmsg)
Definition: can_dev.cpp:328