Kvaser CANLIB: obsolete.h Source File

obsolete.h

Go to the documentation of this file.
00001 
00018 #ifndef _OBSOLETE_H_
00019 #define _OBSOLETE_H_
00020 
00026 #define canCIRCUIT_ANY          -1   ///< Any circuit will do \warning Obsolete! 
00027 #define canCARD_ANY             -1   ///< Any card will do    \warning Obsolete! 
00028 #define canCHANNEL_ANY          -1   ///< Any channel will do \warning Obsolete! 
00029 
00030 #define CANID_METAMSG  (-1L)        ///< Like msgs containing bus status changes. \warning Obsolete! 
00031 #define CANID_WILDCARD (-2L)        ///< We don't care or don't know. \warning Obsolete! 
00032 
00040 typedef void* (*canMemoryAllocator)  (size_t size);
00041 
00045 typedef void  (*canMemoryDeallocator)(void* p);
00046 
00050 typedef struct tagCanHWDescr {
00051     int                    circuitType;
00052     int                    cardType;
00053     int                    channel;
00054 } canHWDescr;
00055 
00059 typedef struct tagCanSWDescr {
00060     unsigned int           rxBufSize;
00061     unsigned int           txBufSize;
00062     canMemoryAllocator     alloc;
00063     canMemoryDeallocator   deAlloc;
00064 } canSWDescr;
00065 
00066 #ifdef __WIN32__
00067 
00070 typedef struct {
00071     unsigned int size;
00072     unsigned int rxBufSize;
00073     unsigned int txBufSize;
00074 } canSWDescriptorEx;
00075 #endif
00076 
00080 canStatus CANLIBAPI canLocateHardware(void);
00081 
00085 int CANLIBAPI canOpen(const canHWDescr * const hwdescr,
00086                       const canSWDescr * const swdescr,
00087                       const unsigned int flags);
00088 
00092 canStatus CANLIBAPI canGetCircuits(int * context,
00093                                    char * name,
00094                                    char * vendor,
00095                                    char * version,
00096                                    unsigned int * cardtype,
00097                                    unsigned int * circtype,
00098                                    unsigned int * channel);
00099 
00105 #define canERR_BUFOFL           canERR_RESERVED_3   ///< "Buffer overflow"                 \warning Obsolete!
00106 #define canERR_REINIT           canERR_RESERVED_4   ///< "Reinitialization failed"         \warning Obsolete!
00107 #define canERR_MSGLOST          canERR_RESERVED_5   ///< "Message lost by CAN-chip"        \warning Obsolete!
00108 #define canERR_OVERRUN          canERR_RESERVED_6   ///< "Receive buffer overrun"          \warning Obsolete!
00109 #define canERR_CARDCOMMFAILED   canERR_RESERVED_7   ///< "Can't communicate with the card" \warning Obsolete!
00110 
00117 #define canCIRCSTAT_ERROR_PASSIVE 0x0001    ///< Error passive \warning Obsolete!
00118 #define canCIRCSTAT_BUS_OFF       0x0002    ///< Bus off \warning Obsolete!
00119 #define canCIRCSTAT_ERROR_WARNING 0x0004    ///< Error counter > 96 \warning Obsolete!
00120 
00127 #define canSTICKY_ACK_ERROR       0x80000801 ///< \warning Obsolete!
00128 #define canSTICKY_FORM_ERROR      0x80000002 ///< \warning Obsolete!
00129 #define canSTICKY_STUFF_ERROR     0x80000004 ///< \warning Obsolete!
00130 #define canSTICKY_CRC_ERROR       0x80000008 ///< \warning Obsolete!
00131 #define canSTICKY_BIT0_ERROR      0x80000010 ///< \warning Obsolete!
00132 #define canSTICKY_BIT1_ERROR      0x80000020 ///< \warning Obsolete!
00133 #define canSTICKY_HW_OVERRUN      0x80000040 ///< \warning Obsolete!
00134 #define canSTICKY_SW_OVERRUN      0x80000080 ///< \warning Obsolete!
00135 
00137 #define canSTAT_INACTIVE          canSTAT_RESERVED_1    ///< The circuit is not active (removed from the sw bus) \warning Obsolete!
00138 
00139 
00140 /*
00141 #define canCIRCSTAT_TXERR       0x0001      // TX error has occurred
00142 #define canCIRCSTAT_RXERR       0x0002      // Receive error has occurred
00143 #define canCIRCSTAT_OVERRUN     0x0004      // Receiver overrun
00144 #define canCIRCSTAT_WAKEUP      0x0008      // Wakeup has occurred
00145 #define canCIRCSTAT_INT         0x0010      // ??
00146 #define canCIRCSTAT_ACK         0x0020      // ACK error
00147 #define canCIRCSTAT_BIT         0x0040      // Bit error
00148 */
00149 /*
00150 More apocryphs.
00151 #define canCIRCSTAT_OVERRUN     0x0004      // Receiver overrun
00152 #define canCIRCSTAT_WAKEUP      0x0008      // Wakeup has occurred
00153 #define canCIRCSTAT_ACK         0x0010      // ACK error
00154 #define canCIRCSTAT_BIT0        0x0020      // Bit error
00155 #define canCIRCSTAT_BIT1        0x0040      // Bit error
00156 #define canCIRCSTAT_BOFF        0x0080      // Chip went Bus Off
00157 */
00158 /*
00159 Even more.
00160 #define canCIRCSTAT_BOFF_HW     0x10000L      // Chip is Bus Off
00161 #define canCIRCSTAT_BOFF_SW     0x20000L      // We are Bus Off
00162 */
00163 
00164 
00170 #define canWANT_ACTIONS         0x01  ///< \warning Obsolete!
00171 #define canWANT_OWN_BUFFERS     0x02  ///< \warning Obsolete!
00172 #define canWANT_ERROR_COUNTERS  0x04  ///< \warning Obsolete!
00173 #define canWANT_EXCLUSIVE       0x08  ///< \warning Obsolete! Use \ref canOPEN_xxx instead.
00174 #define canWANT_EXTENDED        0x10  ///< \warning Obsolete! Use \ref canOPEN_xxx instead.
00175 #if defined(CANLIB_DECLARE_ALL)
00176 # define canWANT_VIRTUAL        0x20  ///< \warning Obsolete! Use \ref canOPEN_xxx instead.
00177 #endif
00178 
00186 // No circuit                   0
00187 #define PCCAN_PHILIPS           1     ///< 82C200 on PCCAN 1.0  \warning Obsolete!
00188 #define PCCAN_INTEL526          2     ///< Not supported.       \warning Obsolete!
00189 #define PCCAN_INTEL527          3     ///< 82527 on PCCAN 1.0   \warning Obsolete!
00190 #define CANCARD_NEC72005        4     ///< NEC72005 on CANCard  \warning Obsolete!
00191 #define CIRC_VIRTUAL            5     ///<                      \warning Obsolete!
00192 #define CIRC_SJA1000            6     ///<                      \warning Obsolete!
00193 
00200 #define canCARD_PCCAN           1     ///< PCCAN ver 1.x (KVASER)       \warning Obsolete!
00201 #define canCARD_CANCARD         2     ///< CANCard (Softing)            \warning Obsolete!
00202 #define canCARD_AC2             3     ///< CAN-AC2 (Softing)            \warning Obsolete!
00203 #define canCARD_LAPCAN          4     ///<                              \warning Obsolete!
00204 #define canCARD_ISACAN          5     ///<                              \warning Obsolete!
00205 #define canCARD_PCCAN_OEM       6     ///< Special for OEM PCcan cards. \warning Obsolete!
00206 
00213 #define canFlgACCEPT            1     ///< \warning Obsolete!
00214 #define canFlgREJECT            2     ///< \warning Obsolete!
00215 #define canFlgCODE              3     ///< \warning Obsolete!
00216 #define canFlgMASK              4     ///< \warning Obsolete!
00217 
00224 #define canDISCARD_MESSAGE      3     ///< \warning Obsolete!
00225 #define canRETAIN_MESSAGE       4     ///< \warning Obsolete!
00226 
00234 #define canSLOW_MODE            0x01  ///< Sync on rising and falling edge \warning Obsolete!
00235 
00243 #define canOFF                  0     ///<                            \warning Obsolete!
00244 #define canTRISTATE             1     ///<                            \warning Obsolete!
00245 #define canPULLUP               2     ///<                            \warning Obsolete!
00246 #define canPULLDOWN             3     ///<                            \warning Obsolete!
00247 #define canPUSHPULL             4     ///< This is the usual setting. \warning Obsolete!
00248 #define canINVPULLUP            5     ///<                            \warning Obsolete!
00249 #define canINVPULLDOWN          6     ///<                            \warning Obsolete!
00250 #define canINVPUSHPULL          7     ///<                            \warning Obsolete!
00251 
00259 #define canIOCTL_LOCAL_ECHO_ON  3     ///< \warning Obsolete!
00260 #define canIOCTL_LOCAL_ECHO_OFF 4     ///< \warning Obsolete!
00261 
00262 #define canMSG_STATUS 0x0008
00263 
00265 #ifdef __cplusplus
00266 extern "C" {
00267 #endif
00268 
00272 canStatus CANLIBAPI canInstallAction(int handle, long id, int (*fn)());
00273 
00277 canStatus CANLIBAPI canUninstallAction(int handle, long id);
00278 
00282 canStatus CANLIBAPI canInstallOwnBuffer(int handle, long id, unsigned int len,
00283                                         void * buf);
00284 
00288 canStatus CANLIBAPI canUninstallOwnBuffer(int handle, long id);
00289 #ifdef __cplusplus
00290 }
00291 #endif
00292 
00295 #endif