@CHIP-RTOS C Library V2.06 - CAN API
CAN_Open_Port
Open one of the CAN ports. int CAN_Open_Port ( unsigned int port_idx,
const CAN_PORT_INIT far *init ); Parameters
port_idx
- CAN port specifier:
CAN0_PORT = 0, or CAN1_PORT = 1
init
- Pointer to port initialization data
structure
set by caller.
Return Value
- Error code -
CAN_EC_SUCCESS = 0: Success, CAN port opened.
CAN_EC_INVALID_PARAMS = -1:
port_idx invalid or NULL init pointer
CAN_EC_INVALID_BAUD = -2: Invalid baud rate
or bit timing specification.
CAN_EC_PORT_ALREADY_OPENED = -4: Specified port was already opened
CAN_EC_LOW_RESOURCES = -7: Unable to create required event group.
CAN_EC_INVALID_Q_SIZE = -9: One of the queue sizes was invalid.
CAN_EC_LOW_MEMORY = -10: Unable to allocate heap memory.
Comments
- Either this function or the CAN_Rx_Filters
(required in order to receive any CAN messages) would be the starting point
in preparing a CAN port for use.
This function allocates receive and send FIFOs per the caller's
FIFO size
specifications. The CAN port is initialized for operation at the
specified baud
rate. An RTX event group
is allocated if this action has not already been taken for the adjacent CAN port.
(The driver uses a single RTX event group for the CAN port pair.)
No operation is performed if the port has already been opened. In this
case an error code CAN_EC_PORT_ALREADY_OPENED is returned.
If necessary, limited configuration changes on an open CAN port can be made
with the CAN_Reconfig API.
Inside this API the interrupts are masked for a short period and then
re-enabled. This function is reentrant.
When CAN1 is opened, the PIO14 and PIO15 are configured for NORMAL
operation.
Important Note:
No CAN messages will be received until the port's receiver
filters have been enabled for reception using the
CAN_Rx_Filters API.
Following a system reset, the CAN receiver filters are initialized
to reject all incoming CAN messages by default.
See Also
RTOS API
- This library function uses a
dynamic
link to reach the service
offered by RTOS software
interrupt.
Supported since or modified in @CHIP-RTOS version-
SC12 | SC13 | SC11 | SC1x3 |
-
n/a | n/a | n/a | V1.07 |
Supported by @CHIP-RTOS C Library since version
This API List
List of C Libraries
@CHIP-RTOS Main Index
End of document
|