zephyr/drivers/can/can_utils.h
Henrik Brix Andersen b21a91e468 drivers: can: catch up on API naming changes
Catch up on the CAN driver API argument naming changes:
- Unify naming of callback function pointers as "callback".
- Unify naming of user-specified callback function arguments as
  "user_data".
- Instances and pointers to struct zcan_frame are named "frame",
  not "msg", to avoid confusion with the CAN message queue support.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-07 15:39:06 -05:00

33 lines
612 B
C

/*
* Copyright (c) 2018 Karsten Koenig
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file Header where utility code can be found for CAN drivers
*/
#ifndef ZEPHYR_DRIVERS_CAN_CAN_UTILS_H_
#define ZEPHYR_DRIVERS_CAN_CAN_UTILS_H_
static inline uint8_t can_utils_filter_match(const struct zcan_frame *frame,
struct zcan_filter *filter)
{
if (frame->id_type != filter->id_type) {
return 0;
}
if ((frame->rtr ^ filter->rtr) & filter->rtr_mask) {
return 0;
}
if ((frame->id ^ filter->id) & filter->id_mask) {
return 0;
}
return 1;
}
#endif /* ZEPHYR_DRIVERS_CAN_CAN_UTILS_H_ */