26 #ifndef _icl_hardware_can_UseITECCan_h_ 27 #define _icl_hardware_can_UseITECCan_h_ 33 # include <sys/ioctl.h> 39 # include "CAN-lxrt.h" 53 return can_device >= 0;
74 #define IOCTL_CAN_IOCRESET 0x01 75 #define IOCTL_CAN_SETBAUDRATE 0x02 76 #define IOCTL_CAN_IOCSETRMASK 0x03 77 #define IOCTL_CAN_SETSENDFIFOSIZE 0x04 78 #define IOCTL_CAN_SETRECEIVEFIFOSIZE 0x05 79 #define IOCTL_CAN_KNOCKNOCK 0x06 103 inline tCanDescriptor
CanDeviceOpen(
const char *device_name,
int flags,
104 unsigned char acceptance_code,
unsigned char acceptance_mask,
unsigned int baud_rate,
105 unsigned send_fifo_size,
unsigned receive_fifo_size)
107 int can_device = open(device_name, flags);
110 long value = receive_fifo_size;
121 value = send_fifo_size;
127 value = acceptance_mask;
128 value = ((value << 8)) | (acceptance_code);
152 return close(can_device);
157 return write(can_device, &msg,
sizeof(
tCanMessage));
162 return read(can_device, &msg,
sizeof(
tCanMessage));
int CanDeviceClose(tCanDescriptor)
Implements a struct representing a can message.
#define IOCTL_CAN_KNOCKNOCK
#define IOCTL_CAN_SETRECEIVEFIFOSIZE
bool CanDescriptorValid(tCanDescriptor can_device)
int CanDeviceReset(tCanDescriptor)
bool CanDriverLxrtSupport()
no support for LXRT available
#define IOCTL_CAN_IOCRESET
const char * CanDriverName()
#define IOCTL_CAN_SETSENDFIFOSIZE
Contains CAN driver interface functions.
tCanDescriptor InvalidCanDescriptor()
Contains CAN driver interface functions.
#define IOCTL_CAN_SETBAUDRATE
tCanDescriptor CanDeviceOpen(const char *, int, unsigned char, unsigned char, unsigned int, unsigned, unsigned)
Open a can device and set parameters.
int CanDeviceSend(tCanDescriptor, const tCanMessage &)
#define IOCTL_CAN_IOCSETRMASK
int CanDeviceReceive(tCanDescriptor, tCanMessage &)