Driver documentation for TEWS IP810 module
For a functional description click here
Data structure
typedef struct
{
short int RW; /* Mode in which Channel was opened */
short int ID; /* ID on which I/O is to happen */
short int Options; /* 0 or CAN_REMOTE */
char Length, _1; /* # of data bytes */
char Data[8]; /* at the moment only ONE message! */
} CAN_DATA; /* 16 Bytes length */
External Variables
There are two external variables to change a part of the functionality
of the driver:
- MonitorCANBus
- This variable is set to OK(0x0) to display all messages
received from the CAN bus, and ERROR(0xff) otherwise.
- Startup Value is ERROR.
- CAN_Show_Ids
- This variable is set to OK(0x0) to display all messages
received from the CAN bus without open READ requests, and
ERROR(0xff) otherwise.
- Startup Value is ERROR.
External functions
There are two external functions allowing to display the status of the
CANchip and to change the setting of the bus speed. The standard value
is hard-coded to 250 kBit/s.
- CanTiming(char slot, uint BusSpeed)
- This function allows to set the Busspeed for the specified slot
to the specified value in kBit/s.
- CANStatus(char slot)
- This function displays the registers of the CAN Controller on
the specified slot.
Defined Control Codes
This section describes the Control Codes for the CAN driver. Additionally, these
Codes have to be set up in the CAN_DATA.RW field.
The Control Codes are only sent to the driver on IO Commands, not on OPEN or CLOSE
Commands. So the process of opening is achieved via calling the IO Command with
the appropriate Control Code. See CDI Driver intro!
OPEN Control Codes
Read Codes: X : exclusive READ
W : wait for next CAN message
R : READ with REMOTE FRAME
AB: Read all Messages for ID not opened for READ!
CAN_CC_OPEN_R
CAN_CC_OPEN_R_X
CAN_CC_OPEN_R_W
CAN_CC_OPEN_R_WX
CAN_CC_OPEN_R_R
CAN_CC_OPEN_R_RX
CAN_CC_OPEN_AB
Write Codes: X : exclusive WRITE
CAN_CC_OPEN_W
CAN_CC_OPEN_W_X
In these cases, exclusive means: channel must only be opened once! Any further
opening is refused. For configuration purposes.
IO Codes
CAN_CC_R
CAN_CC_W
CLOSE Codes:
CAN_CC_CLOSE
Dummy Code
CAN_CC_NONE
Options
CAN_REMOTE
Startup Function call
void CANdriver();
Christof Wehner <wehner@herao1.desy.de>
Last modified: Thu Oct 27 10:17:59 1994