zephyr/doc/hardware/peripherals
Henrik Brix Andersen f8a88cdb27 drivers: can: use flags fields for can_frame and can_filter structs
The can_frame and can_filter structs support a number of different flags
(standard/extended CAN ID type, Remote Transmission Request, CAN-FD format,
Bit Rate Switch, ...). Each of these flags is represented as a discrete bit
in the given structure.

This design pattern requires every user of these structs to initialize all
of these flags to either 0 or 1, which does not scale well for future flag
additions.

Some of these flags have associated enumerations to be used for assignment,
some do not. CAN drivers and protocols tend to rely on the logical value of
the flag instead of using the enumeration, leading to a very fragile
API. The enumerations are used inconsistently between the can_frame and
can_filter structures, which further complicates the API.

Instead, convert these flags to bitfields with separate flag definitions
for the can_frame and can_filter structures. This API allows for future
extensions without having to revisit existing users of the two
structures. Furthermore, this allows driver to easily check for unsupported
flags in the respective API calls.

As this change leads to the "id_mask" field of the can_filter to be the
only mask present in that structure, rename it to "mask" for simplicity.

Fixes: #50776

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-10-25 16:32:10 +02:00
..
audio
canbus drivers: can: use flags fields for can_frame and can_filter structs 2022-10-25 16:32:10 +02:00
display
edac
1-Wire_bus_topology.drawio.svg doc: add api documentation for w1 driver 2022-07-05 23:06:45 +02:00
adc.rst
clock_control.rst
coredump.rst coredump: drivers: Add coredump device 2022-06-05 14:28:34 +02:00
counter.rst
dac.rst
dma.rst
ec_host_cmd_periph.rst
eeprom.rst
entropy.rst
espi.rst
flash.rst doc: Add missing kconfig option prefix 2022-10-13 13:16:06 -04:00
gna.rst
gpio.rst
hwinfo.rst
i2c.rst doc: peripherals: i2c: Fix incorrect hyperlink references 2022-09-29 12:20:14 +02:00
i2c_eeprom_target.rst i2c: Update API terminology 2022-06-29 17:51:31 +02:00
i3c.rst doc: i3c: add a few bits about the new I3C API 2022-09-09 17:42:33 -04:00
index.rst doc: add API documentation for USB-C VBUS Driver 2022-10-22 18:38:35 -04:00
ipm.rst
kscan.rst
led.rst
mbox.rst
mdio.rst
mipi_dsi.rst
peci.rst
pinmux.rst
ps2.rst
pwm.rst
regulators.rst
reset.rst
rtc.rst
sdhc.rst
sensor.rst
spi.rst
tcpc.rst doc: peripherals: tcpc: Fix incorrect hyperlink references 2022-09-29 12:20:14 +02:00
uart.rst
usbc_vbus.rst doc: add API documentation for USB-C VBUS Driver 2022-10-22 18:38:35 -04:00
video.rst
w1.rst doc: add api documentation for w1 driver 2022-07-05 23:06:45 +02:00
watchdog.rst