etisserant@145: /* can.h etisserant@145: * Header file for the Linux CAN-bus driver. etisserant@145: * Written by Arnaud Westenberg email:arnaud@wanadoo.nl etisserant@145: * Rewritten for new CAN queues by Pavel Pisa - OCERA team member etisserant@145: * email:pisa@cmp.felk.cvut.cz etisserant@145: * This software is released under the GPL-License. etisserant@145: * Version lincan-0.3 17 Jun 2004 etisserant@145: */ etisserant@145: etisserant@145: #ifndef _CAN_DRVAPI_T_H etisserant@145: #define _CAN_DRVAPI_T_H etisserant@145: etisserant@145: #ifdef __KERNEL__ etisserant@145: etisserant@145: #include etisserant@145: #include etisserant@145: #include etisserant@145: etisserant@145: #else /* __KERNEL__ */ etisserant@145: etisserant@145: #include etisserant@145: #include etisserant@145: #include etisserant@145: etisserant@145: #endif /* __KERNEL__ */ etisserant@145: etisserant@145: #include "./canmsg.h" etisserant@145: etisserant@145: #ifdef __cplusplus etisserant@145: extern "C" { etisserant@145: #endif etisserant@145: etisserant@145: /* CAN ioctl magic number */ etisserant@145: #define CAN_IOC_MAGIC 'd' etisserant@145: etisserant@145: typedef unsigned long bittiming_t; etisserant@145: typedef unsigned short channel_t; etisserant@145: etisserant@145: /** etisserant@145: * struct can_baudparams_t - datatype for calling CONF_BAUDPARAMS IOCTL etisserant@145: * @flags: reserved for additional flags for chip configuration, should be written -1 or 0 etisserant@145: * @baudrate: baud rate in Hz etisserant@145: * @sjw: synchronization jump width (0-3) prescaled clock cycles etisserant@145: * @sampl_pt: sample point in % (0-100) sets (TSEG1+1)/(TSEG1+TSEG2+2) ratio etisserant@145: * etisserant@145: * The structure is used to configure new set of parameters into CAN controller chip. etisserant@145: * If default value of some field should be preserved, fill field by value -1. etisserant@145: */ etisserant@145: struct can_baudparams_t { etisserant@145: long flags; etisserant@145: long baudrate; etisserant@145: long sjw; etisserant@145: long sample_pt; etisserant@145: }; etisserant@145: etisserant@145: /* CAN ioctl functions */ etisserant@145: #define CAN_DRV_QUERY _IO(CAN_IOC_MAGIC, 0) etisserant@145: #define CAN_DRV_QRY_BRANCH 0 /* returns driver branch value - "LINC" for LinCAN driver */ etisserant@145: #define CAN_DRV_QRY_VERSION 1 /* returns driver version as (major<<16) | (minor<<8) | patch */ etisserant@145: #define CAN_DRV_QRY_MSGFORMAT 2 /* format of canmsg_t structure */ etisserant@145: etisserant@145: #define CMD_START _IOW(CAN_IOC_MAGIC, 1, channel_t) etisserant@145: #define CMD_STOP _IOW(CAN_IOC_MAGIC, 2, channel_t) etisserant@145: //#define CMD_RESET 3 etisserant@145: etisserant@145: #define CONF_BAUD _IOW(CAN_IOC_MAGIC, 4, bittiming_t) etisserant@145: //#define CONF_ACCM etisserant@145: //#define CONF_XTDACCM etisserant@145: //#define CONF_TIMING etisserant@145: //#define CONF_OMODE etisserant@145: #define CONF_FILTER _IOW(CAN_IOC_MAGIC, 8, unsigned char) etisserant@145: etisserant@145: //#define CONF_FENABLE etisserant@145: //#define CONF_FDISABLE etisserant@145: etisserant@145: #define STAT _IO(CAN_IOC_MAGIC, 9) etisserant@145: #define CANQUE_FILTER _IOW(CAN_IOC_MAGIC, 10, struct canfilt_t) etisserant@145: #define CANQUE_FLUSH _IO(CAN_IOC_MAGIC, 11) etisserant@145: #define CONF_BAUDPARAMS _IOW(CAN_IOC_MAGIC, 11, struct can_baudparams_t) etisserant@145: #define CANRTR_READ _IOWR(CAN_IOC_MAGIC, 12, struct canmsg_t) etisserant@145: etisserant@145: #ifdef __cplusplus etisserant@145: } /* extern "C"*/ etisserant@145: #endif etisserant@145: etisserant@145: #endif /*_CAN_DRVAPI_T_H*/