Functions for routing RX can frames. More...

Detailed Description

Functions for routing RX can frames.

Author
Toon Stegen toon..nosp@m.steg.nosp@m.en@al.nosp@m.tran.nosp@m..com
Vincent Dupont vince.nosp@m.nt@o.nosp@m.takey.nosp@m.s.co.nosp@m.m

Definition in file router.h.

#include "kernel_types.h"
#include "can/can.h"
#include "can/pkt.h"
+ Include dependency graph for router.h:

Go to the source code of this file.

Functions

int can_router_register (can_reg_entry_t *entry, canid_t can_id, canid_t mask, void *param)
 Register a user entry to receive a frame can_id. More...
 
int can_router_unregister (can_reg_entry_t *entry, canid_t can_id, canid_t mask, void *param)
 Unregister a user entry from receiving can_id. More...
 
int can_router_free_frame (struct can_frame *frame)
 Free a received frame. More...
 
int can_router_dispatch_rx_indic (can_pkt_t *pkt)
 Dispatch a RX indication to subscribers threads. More...
 
int can_router_dispatch_tx_conf (can_pkt_t *pkt)
 Dispatch a TX confirmation to the sender's thread. More...
 
int can_router_dispatch_tx_error (can_pkt_t *pkt)
 Dispatch a TX error to the sender's thread. More...
 

Function Documentation

◆ can_router_dispatch_rx_indic()

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
[in]pktthe packet to dispatch
Returns
0 on success
< 0 on error, if at least a thread cannot receive message

◆ can_router_dispatch_tx_conf()

int can_router_dispatch_tx_conf ( can_pkt_t pkt)

Dispatch a TX confirmation to the sender's thread.

Parameters
[in]pktthe correctly sent packet
Returns
0 on success
< 0 on error

◆ can_router_dispatch_tx_error()

int can_router_dispatch_tx_error ( can_pkt_t pkt)

Dispatch a TX error to the sender's thread.

Parameters
[in]pktthe error packet
Returns
0 on success
< 0 on error

◆ can_router_free_frame()

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
[in]framethe frame to free, it must be a frame returned by the stack
Returns
0 on success
< 0 on error

◆ can_router_register()

int can_router_register ( can_reg_entry_t entry,
canid_t  can_id,
canid_t  mask,
void *  param 
)

Register a user entry to receive a frame can_id.

Parameters
[in]entrythe entry containing ifnum and user info
[in]can_idthe CAN ID of the frame to receive
[in]maskthe mask of the frame to receive
[in]parama user private pointer
Returns
0 on success
< 0 on error

◆ can_router_unregister()

int can_router_unregister ( can_reg_entry_t entry,
canid_t  can_id,
canid_t  mask,
void *  param 
)

Unregister a user entry from receiving can_id.

The filter is unregistered from the 'router' layer if can_id, mask and param matches a registered entry.

Parameters
[in]entrythe entry containing ifnum and user info which was registered
[in]can_idthe CAN ID of the frame to stop receiving
[in]maskthe mask of the frame to stop receiving
[in]parama user private pointer
Returns
0 if can_id is not used anymore
1 if can_id is still used by another pid
< 0 on error