00001 /* 00002 * can.h - can4linux CAN driver module 00003 * 00004 * Copyright (c) 2001 port GmbH Halle/Saale 00005 *------------------------------------------------------------------ 00006 * $Header: /z2/cvsroot/products/0530/software/can4linux/src/can.h,v 1.1.1.1 2001/06/11 18:30:54 oe Exp $ 00007 * 00008 *-------------------------------------------------------------------------- 00009 * 00010 * 00011 * modification history 00012 * -------------------- 00013 * $Log: can.h,v $ 00014 * Revision 1.1.1.1 2001/06/11 18:30:54 oe 00015 * minimal version can4linux embedded, compile time Konfigurierbar 00016 * 00017 * 00018 * 00019 * 00020 *-------------------------------------------------------------------------- 00021 */ 00022 00023 00037 #ifndef __CAN_H 00038 #define __CAN_H 00039 00040 00041 #ifndef __KERNEL__ 00042 #include <sys/time.h> 00043 #endif 00044 /*---------- the can message structure */ 00045 00046 #define CAN_MSG_LENGTH 8 00049 #define MSG_RTR (1<<0) 00050 #define MSG_OVR (1<<1) 00051 #define MSG_EXT (1<<2) 00052 #define MSG_PASSIVE (1<<4) 00053 #define MSG_BUSOFF (1<<5) 00054 #define MSG_ (1<<6) 00055 #define MSG_BOVR (1<<7) 00059 #define MSG_ERR_MASK (MSG_OVR + MSG_PASSIVE) 00060 00066 typedef struct { 00068 int flags; 00069 int cob; 00070 unsigned long id; 00071 struct timeval timestamp; 00072 short int length; 00073 unsigned char data[CAN_MSG_LENGTH]; 00074 } canmsg_t; 00075 00076 00077 00081 #define COMMAND 0 00082 #define CONFIG 1 00083 #define SEND 2 00084 #define RECEIVE 3 00085 #define CONFIGURERTR 4 00086 #define STATUS 5 00088 /*---------- CAN ioctl parameter types */ 00089 00092 typedef struct Command_par { 00093 int cmd; 00094 int error; 00095 unsigned long retval; 00096 } Command_par_t ; 00097 00098 00101 typedef struct Config_par { 00102 int target; 00103 unsigned long val1; 00104 unsigned long val2; 00105 int error; 00106 unsigned long retval; 00107 } Config_par_t ; 00108 00111 typedef struct CanSja1000Status_par { 00112 unsigned int baud; 00113 unsigned char status; 00114 unsigned int error_warning_limit; 00115 unsigned int rx_errors; 00116 unsigned int tx_errors; 00117 unsigned int error_code; 00118 unsigned long retval; 00119 } CanSja1000Status_par_t; 00120 00123 typedef struct Send_par { 00124 canmsg_t *Tx; 00125 int error; 00126 unsigned long retval; 00127 } Send_par_t ; 00128 00131 typedef struct Receive_par { 00132 canmsg_t *Rx; 00133 int error; 00134 unsigned long retval; 00135 } Receive_par_t ; 00136 00139 typedef struct ConfigureRTR_par { 00140 unsigned message; 00141 canmsg_t *Tx; 00142 int error; 00143 unsigned long retval; 00144 } ConfigureRTR_par_t ; 00145 00149 # define CMD_START 1 00150 # define CMD_STOP 2 00151 # define CMD_RESET 3 00152 00153 00157 # define CONF_ACC 0 /* mask and code */ 00158 # define CONF_ACCM 1 /* mask only */ 00159 # define CONF_ACCC 2 /* code only */ 00160 # define CONF_TIMING 3 /* bit timing */ 00161 # define CONF_OMODE 4 /* output control register */ 00162 # define CONF_FILTER 5 00163 # define CONF_FENABLE 6 00164 # define CONF_FDISABLE 7 00165 00166 #endif /* __CAN_H */