26 #ifndef _icl_hardware_can_UseMCACan_h_ 27 #define _icl_hardware_can_UseMCACan_h_ 33 # include <sys/ioctl.h> 42 # include "CAN-lxrt.h" 47 #ifdef _IC_BUILDER_CAN_MCA_HAS_IOCTL_H_ 48 # include "CAN-ioctl.h" 50 # define IOCTL_CAN_IOCRESET 0x01 51 # define IOCTL_CAN_SETBAUDRATE 0x02 52 # define IOCTL_CAN_IOCSETRMASK 0x03 53 # define IOCTL_CAN_SETSENDFIFOSIZE 0x04 54 # define IOCTL_CAN_SETRECEIVEFIFOSIZE 0x05 64 return can_device >= 0;
107 inline tCanDescriptor
CanDeviceOpen(
const char *device_name,
int flags,
108 unsigned char acceptance_code,
unsigned char acceptance_mask,
unsigned int baud_rate,
109 unsigned send_fifo_size,
unsigned receive_fifo_size)
111 int can_device = open(device_name, flags);
114 long value = receive_fifo_size;
120 value = send_fifo_size;
126 value = acceptance_mask;
127 value = ((value << 8)) | (acceptance_code);
151 return close(can_device);
156 return write(can_device, &msg,
sizeof(
tCanMessage));
161 return read(can_device, &msg,
sizeof(
tCanMessage));
int CanDeviceClose(tCanDescriptor)
Implements a struct representing a can message.
bool CanDescriptorValid(tCanDescriptor can_device)
int CanDeviceReset(tCanDescriptor)
bool CanDriverLxrtSupport()
no support for LXRT available
#define IOCTL_CAN_SETRECEIVEFIFOSIZE
#define IOCTL_CAN_IOCSETRMASK
const char * CanDriverName()
Contains CAN driver interface functions.
tCanDescriptor InvalidCanDescriptor()
#define IOCTL_CAN_SETSENDFIFOSIZE
Contains CAN driver interface functions.
icl_hardware::can::tCanMessage tCanMessage
#define IOCTL_CAN_IOCRESET
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_SETBAUDRATE
int CanDeviceReceive(tCanDescriptor, tCanMessage &)