A if `netdev_driver_t::confirm_send()` is provided, it provides the
new netdev API. However, detecting the API at runtime and handling
both API styles comes at a cost. This can be optimized in case only
new or only old style netdevs are in use.
To do so, this adds the pseudo modules `netdev_legacy_api` and
`netdev_new_api`. As right now no netdev actually implements the new
API, all netdevs pull in `netdev_legacy_api`. If `netdev_legacy_api` is
in used but `netdev_new_api` is not, we can safely assume at compile
time that only legacy netdevs are in use. Similar, if only
`netdev_new_api` is used, only support for the new API is needed. Only
when both are in use, run time checks are needed.
This provides two helper function to check for a netif if the
corresponding netdev implements the old or the new API. (With one
being the inverse of the other.) They are suitable for constant folding
when only new or only legacy devices are in use. Consequently, dead
branches should be eliminated by the optimizer.
To benefit from the chunked ringbuffer if large frames are being sent,
we need to allocate more than one ethernet frame length to it.
Rename the define and make it overwriteable by the user.
The DOSE watchdog should only run if at least one interface is in RECV
state.
That means it must be enabled when entering RECV state and disabled
when leaving RECV state.
The watchdog was *always* disabled on a transition to IDLE.
This is wrong: If there are two interfaces and one is in RECV state
but the other did just SEND something and transitions to IDLE state
from SEND state, it would still disable the watchdog.
Fix this by only disabling the watchdog if the current state is RECV.
`DOSE_TIMER_DEV` is defined in `board.h`, so we have to include it.
It's not included by the header (and should not), so move the check
to the .c file.
Previously we would not disable the sense pin, this meant that
a node could still wake up if the standby pin is not connected.
Properly disable sensing when in standby and wait for a state
transition to IDLE to avoid aborting a reception and messing up the
DOSE internal state.
Some CAN transceivers have a standby pin that has to be pulled low
in order to use it.
If the interface is disabled we can set it to high again to save some
power.
A fixed timeout is either too long for high symbol rates or too short
for low symbol rates.
To fix this, calculate the timeout based on the symbol rate.
For this, the old 5ms timeout is equivalent to 58 bytes being transmitted
at 115200 baud (8 data bit + start & stop bit).
I rounded this to 50 bytes which should yield 4340 µs.
The expandable GPIO API requires the comparison of structured GPIO types. This means that inline functions must be used instead of direct comparisons. For the migration process, drivers must first be changed so that they use the inline comparison functions.
This changes the prefixes of the symbols generated from USEMODULE and
USEPKG variables. The changes are as follow:
KCONFIG_MODULE_ => KCONFIG_USEMODULE_
KCONFIG_PKG_ => KCONFIG_USEPKG_
MODULE_ => USEMODULE_
PKG_ => USEPKG_