router.h¶
Functions for routing RX can frames.
-
int
can_router_register
(sys/include/can/common.h::can_reg_entry_t
* entry,can.h::canid_t
can_id,can.h::canid_t
mask, void * param)¶ Register a user
entry
to receive a framecan_id
.Parameters
entry: the entry containing ifnum and user info can_id: the CAN ID of the frame to receive mask: the mask of the frame to receive param: a user private pointer Return values
- 0 on success
- < 0 on error
-
int
can_router_unregister
(sys/include/can/common.h::can_reg_entry_t
* entry,can.h::canid_t
can_id,can.h::canid_t
mask, void * param)¶ Unregister a user
entry
from receivingcan_id
.The filter is unregistered from the ‘router’ layer if
can_id
,mask
andparam
matches a registered entry.Parameters
entry: the entry containing ifnum and user info which was registered can_id: the CAN ID of the frame to stop receiving mask: the mask of the frame to stop receiving param: a user private pointer Return values
- 0 if
can_id
is not used anymore - 1 if
can_id
is still used by another pid - < 0 on error
- 0 if
-
int
can_router_free_frame
(struct can_frame * frame)¶ Free a received frame.
This function decrements the ref counter of the packet and frees it if the packet is no more in use.
Parameters
frame: the frame to free, it must be a frame returned by the stack Return values
- 0 on success
- < 0 on error
-
int
can_router_dispatch_rx_indic
(can_pkt_t * pkt)¶ Dispatch a RX indication to subscribers threads.
This function goes through the list of subscribed filters to send a message to each subscriber’s thread. If all the subscriber’s threads cannot receive message, the packet is freed.
Parameters
pkt: the packet to dispatch Return values
- 0 on success
- < 0 on error, if at least a thread cannot receive message
-
int
can_router_dispatch_tx_conf
(can_pkt_t * pkt)¶ Dispatch a TX confirmation to the sender’s thread.
Parameters
pkt: the correctly sent packet Return values
- 0 on success
- < 0 on error
-
int
can_router_dispatch_tx_error
(can_pkt_t * pkt)¶ Dispatch a TX error to the sender’s thread.
Parameters
pkt: the error packet Return values
- 0 on success
- < 0 on error