can_filter Struct Reference
[CAN Devices]

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.
uint32_t can_mask
 Mask which is applied to incoming IDs.

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 (can_id & 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:

rtcan_rtt.c, and rtcanrecv.c.


Field Documentation

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

The filter logic can be inverted with the flag CAN_INV_FILTER.

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:

Generated on Tue Oct 27 19:18:55 2009 for Xenomai API by  doxygen 1.6.1