driver: can: add new filter to match CAN-FD frames

Add support FD frame filter to configure type frame for
each Rx msg to receive corresponding frames (classic, FD frames).

The Bosch M_CAN driver does not support FD frame filter,
so inmplement driver to handle it in software.

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
This commit is contained in:
Cong Nguyen Huu 2022-11-09 11:23:54 +07:00 committed by David Leach
commit d167d3a29a
8 changed files with 57 additions and 6 deletions

View file

@ -199,7 +199,12 @@ static int can_npl_add_rx_filter(const struct device *dev, can_rx_callback_t cb,
LOG_DBG("Setting filter ID: 0x%x, mask: 0x%x", filter->id,
filter->mask);
#ifdef CONFIG_CAN_FD_MODE
if ((filter->flags & ~(CAN_FILTER_IDE | CAN_FILTER_DATA |
CAN_FILTER_RTR | CAN_FILTER_FDF)) != 0) {
#else
if ((filter->flags & ~(CAN_FILTER_IDE | CAN_FILTER_DATA | CAN_FILTER_RTR)) != 0) {
#endif
LOG_ERR("unsupported CAN filter flags 0x%02x", filter->flags);
return -ENOTSUP;
}