File indexing completed on 2025-05-11 08:23:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 #ifndef __OCCAN_DRIVER_H__
0036 #define __OCCAN_DRIVER_H__
0037
0038 #ifdef __cplusplus
0039 extern "C" {
0040 #endif
0041
0042
0043 typedef struct {
0044 char extended;
0045 char rtr;
0046 char sshot;
0047 unsigned char len;
0048 unsigned char data[8];
0049 unsigned int id;
0050 } CANMsg;
0051
0052 typedef struct {
0053
0054 unsigned int rx_msgs;
0055 unsigned int tx_msgs;
0056
0057
0058 unsigned int err_warn;
0059 unsigned int err_dovr;
0060 unsigned int err_errp;
0061 unsigned int err_arb;
0062 unsigned int err_bus;
0063
0064
0065
0066
0067 unsigned int err_arb_bitnum[32];
0068
0069
0070
0071
0072
0073
0074 unsigned int err_bus_bit;
0075 unsigned int err_bus_form;
0076 unsigned int err_bus_stuff;
0077 unsigned int err_bus_other;
0078
0079
0080 unsigned int err_bus_rx;
0081 unsigned int err_bus_tx;
0082
0083
0084 unsigned int err_bus_segs[32];
0085
0086
0087
0088
0089
0090
0091
0092 unsigned int ints;
0093
0094
0095 unsigned int tx_buf_error;
0096
0097
0098 unsigned int rx_sw_dovr;
0099
0100 } occan_stats;
0101
0102
0103 #define OCCAN_SEG_ID28 0x02
0104 #define OCCAN_SEG_ID20 0x06
0105 #define OCCAN_SEG_ID17 0x07
0106 #define OCCAN_SEG_ID12 0x0f
0107 #define OCCAN_SEG_ID4 0x0e
0108
0109 #define OCCAN_SEG_START 0x03
0110 #define OCCAN_SEG_SRTR 0x04
0111 #define OCCAN_SEG_IDE 0x05
0112 #define OCCAN_SEG_RTR 0x0c
0113 #define OCCAN_SEG_RSV0 0x09
0114 #define OCCAN_SEG_RSV1 0x0d
0115
0116 #define OCCAN_SEG_DLEN 0x0b
0117 #define OCCAN_SEG_DFIELD 0x0a
0118
0119 #define OCCAN_SEG_CRC_SEQ 0x08
0120 #define OCCAN_SEG_CRC_DELIM 0x18
0121
0122 #define OCCAN_SEG_ACK_SLOT 0x19
0123 #define OCCAN_SEG_ACK_DELIM 0x1b
0124 #define OCCAN_SEG_EOF 0x1a
0125 #define OCCAN_SEG_INTERMISSION 0x12
0126 #define OCCAN_SEG_ACT_ERR 0x11
0127 #define OCCAN_SEG_PASS_ERR 0x16
0128 #define OCCAN_SEG_DOMINANT 0x13
0129 #define OCCAN_SEG_EDELIM 0x17
0130 #define OCCAN_SEG_OVERLOAD 0x1c
0131
0132
0133 #define CANMSG_OPT_RTR 0x40
0134 #define CANMSG_OPT_EXTENDED 0x80
0135 #define CANMSG_OPT_SSHOT 0x01
0136
0137 #define OCCAN_IOC_START 1
0138 #define OCCAN_IOC_STOP 2
0139
0140 #define OCCAN_IOC_GET_CONF 3
0141 #define OCCAN_IOC_GET_STATS 4
0142 #define OCCAN_IOC_GET_STATUS 5
0143
0144 #define OCCAN_IOC_SET_SPEED 6
0145 #define OCCAN_IOC_SPEED_AUTO 7
0146 #define OCCAN_IOC_SET_LINK 8
0147 #define OCCAN_IOC_SET_FILTER 9
0148 #define OCCAN_IOC_SET_BLK_MODE 10
0149 #define OCCAN_IOC_SET_BUFLEN 11
0150 #define OCCAN_IOC_SET_BTRS 12
0151
0152
0153 struct occan_afilter {
0154 unsigned char code[4];
0155 unsigned char mask[4];
0156 int single_mode;
0157 };
0158
0159 #define OCCAN_STATUS_RESET 0x01
0160 #define OCCAN_STATUS_OVERRUN 0x02
0161 #define OCCAN_STATUS_WARN 0x04
0162 #define OCCAN_STATUS_ERR_PASSIVE 0x08
0163 #define OCCAN_STATUS_ERR_BUSOFF 0x10
0164 #define OCCAN_STATUS_QUEUE_ERROR 0x80
0165
0166 #define OCCAN_BLK_MODE_RX 0x1
0167 #define OCCAN_BLK_MODE_TX 0x2
0168
0169 void occan_register_drv (void);
0170
0171
0172 #define OCCAN_SPEED_500K 500000
0173 #define OCCAN_SPEED_250K 250000
0174 #define OCCAN_SPEED_125K 125000
0175 #define OCCAN_SPEED_75K 75000
0176 #define OCCAN_SPEED_50K 50000
0177 #define OCCAN_SPEED_25K 25000
0178 #define OCCAN_SPEED_10K 10000
0179
0180 #ifdef __cplusplus
0181 }
0182 #endif
0183
0184 #endif