This function controls the given CAN device. The parameter func defines, which control operation the user wants to perform.
Prototype
CPU_INT16S XXX_IoCtl(CPU_INT16S devId,
CPU_INT16U func,
void *argp);
Parameter | Meaning |
---|---|
devId | device identifier, returned by XXX_Open() |
func | function code |
argp | optional function argument |
Prototype
Function Code IO_<DRV_NAME>_* | Meaning | used by µC/CAN |
SET_BAUDRATE | set the bus baudrate | yes |
RX_STANDARD | configure the CAN receiver to receive only CAN standard identifiers. | no |
RX_EXTENDED | configure the CAN receiver to receive only CAN extended identifiers. | yes* |
START | starts the CAN controller interface. Most common is to set the CAN controller in active mode | yes |
STOP | stop the CAN controller interface. Most common is to set the CAN controller in passive mode | yes |
GET_NODE_STATUS | get the node status from the CAN controller | no** |
TX_READY | get status if CAN controller is ready to send new CAN frame | yes |
* is used at startup, but some CAN devices will receive both extended or standard identifier if no mask is set
** needed only if CanBusNSHandler() is used.
Note: It’s possible that some CAN devices do not support the function codes RX_STANDARD and RX_EXTENDED (e.g. SJA1000) or that this filter setting must be done via other function codes, e.g. for LPC2xxx CAN device drivers this must be set via SET_xxx_FILTER function codes. Please see the appropriate CanDriverManual if the function code is supported.
Return Value:
Zero for success or -1 if an error occurs.