Xenomai  3.0.8
can_filter Struct Reference

Filter for reception of CAN messages. More...

Data Fields

uint32_t can_id
 CAN ID which must match with incoming IDs after passing the mask. More...
 
uint32_t can_mask
 Mask which is applied to incoming IDs. More...
 

Detailed Description

Filter for reception of CAN messages.

This filter works as follows: A received CAN ID is AND'ed bitwise with can_mask and then compared to can_id. This also includes the CAN_EFF_FLAG and CAN_RTR_FLAG of CAN_xxx_FLAG. If this comparison is true, the message will be received by the socket. The logic can be inverted with the can_id flag CAN_INV_FILTER :

if ((received_can_id & can_mask) != (can_id & ~CAN_INV_FILTER))
accept-message;
} else {
if ((received_can_id & can_mask) == can_id)
accept-message;
}

Multiple filters can be arranged in a filter list and set with Sockopts. If one of these filters matches a CAN ID upon reception of a CAN frame, this frame is accepted.

Examples:
can-rtt.c, and rtcanrecv.c.

Field Documentation

◆ can_id

uint32_t can_filter::can_id

CAN ID which must match with incoming IDs after passing the mask.

The filter logic can be inverted with the flag CAN_INV_FILTER.

Examples:
rtcanrecv.c.

◆ can_mask

uint32_t can_filter::can_mask

Mask which is applied to incoming IDs.

See CAN ID masks if exactly one CAN ID should come through.


The documentation for this struct was generated from the following file: