|
truck-code
|


Go to the source code of this file.
Functions | |
| void | can_init (int argc, char *argv[], resmgr_connect_funcs_t *pconn, resmgr_io_funcs_t *pio, IOFUNC_ATTR_T *pattr) |
| int | can_set_filter (int fd, unsigned long id, unsigned long mask) |
| int | can_empty_queue (int fd) |
| int | can_arm (int fd, int channel_id) |
| int | can_read (intptr_t fd, unsigned long *id, char *extended, void *data, BYTE size) |
| int | can_write (intptr_t fd, unsigned long id, char extended, void *data, BYTE size) |
| int | can_send (int fd, j1939_pdu_typ *pdu) |
This file contains utility methods needed to read and write messages to the Control Area Network (CAN) card.
| int can_arm | ( | int | fd, |
| int | channel_id | ||
| ) |
Enable pulses from the CAN driver to the client process.
Pulses are waited for with MsgReceive or IP_Receive. Internal to the driver, done as part of open for read.
| fd | file descriptor for the location of the CAN card |
| channel_id | The ID of the channel that can be used to receive messages and pulses |
| int can_empty_queue | ( | int | fd | ) |
Empty the queue of messages in the CAN driver.
This is internal to the driver, and done as part of open for read
| fd | file descriptor for the location of the CAN card |
| void can_init | ( | int | argc, |
| char * | argv[], | ||
| resmgr_connect_funcs_t * | pconn, | ||
| resmgr_io_funcs_t * | pio, | ||
| IOFUNC_ATTR_T * | pattr | ||
| ) |
Initialize the CAN driver.
This function is called from the main() during the initialization of the CAN driver to read the .ini file and initialize the can_info structure, and initialize the function tables.
Additional Arguments:
| argc | see additional arguments |
| argv | see additional arguments |
| pconn | table of the POSIX-level connect functions that are used by a resource manager. The open handle is updated to support opening the CAN card port |
| pio | table of the POSIX-level I/O functions that are used by a resource manager. The devctl handle is updated to support interrupt handling on the CAN card port |
| pattr | pointer to information per device manager |
| int can_read | ( | intptr_t | fd, |
| unsigned long * | id, | ||
| char * | extended, | ||
| void * | data, | ||
| BYTE | size | ||
| ) |
Read information from the CAN card.
This message will update the ID, message format, and data field of a CAN message.
| fd | file descriptor for the location of the CAN card |
| id | CAN message format ID |
| extended | updated to be 1 if the identifier is in extended (29 bit) format, 0 if it is in the unextended (11 bit) format |
| data | the content of the data field. This element will be modified by this method. |
| size | number of bytes in the CAN data field |
| int can_send | ( | int | fd, |
| j1939_pdu_typ * | pdu | ||
| ) |
FIXME (merge with can_write)
PATH CAN driver does not yet use state code or slot arguments, provided for compatibility with B&B STB converter send routine.
| fd | file descriptor that is used when sending the message |
| pdu | message to send |
| int can_set_filter | ( | int | fd, |
| unsigned long | id, | ||
| unsigned long | mask | ||
| ) |
Set the CAN filter.
Internal to the driver, set as part of open for read
| fd | file descriptor for the location of the CAN card |
| id | CAN message format ID (standard or extended) |
| mask | requested filter mask |
| int can_write | ( | intptr_t | fd, |
| unsigned long | id, | ||
| char | extended, | ||
| void * | data, | ||
| BYTE | size | ||
| ) |
Write information to the CAN card.
| fd | file descriptor for the location of the CAN card |
| id | CAN device id on bus |
| extended | 0 for standard (11 bit) format, 1 for extended (29 bit) format |
| data | the content of the data field |
| size | number of bytes to be added to the data field |
1.8.13