Added in commit 0e807c3f54 ("drivers: can: Add loopback driver"), then
never used.
Found with a script.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Added in commit 0e807c3f54 ("drivers: can: Add loopback driver"), then
never used.
Found with a script.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Fix CAN loopback mode in the NXP MCUX FlexCAN driver by only disabling
self-reception when loopback mode was not requested.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Add work-around for the NXP MCUxpresso SDK not exposing APIs for
setting the listen-only (LOM) bit of the FlexCAN MCR register and the
self-reception disable (SRXDIS) bit of the CTRL1 register.
These bits can only be written when the FlexCAN module is in freeze
mode. Add a set of simplified functions (not supporting errata 9595) for
entering/exiting freeze mode.
This work-around can be removed again once the NXP MCUxpresso SDK
exposes the needed functionality.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
The mcux CAN controller uses frame ID and position to calculate the
priority, but the driver expects chronological ordering.
This PR mimics this behavior by only using the last free message box.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
These calls are not accessible in CI test, nor do they get built on
common platforms (in at least one case I found a typo which proved the
code was truly unused). These changes are blind, so live in a
separate commit. But the nature of the port is mechanical, all other
syscalls in the system work fine, and any errors should be easily
corrected.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Adding required fields to the devicetree overlay of the CAN sample as
this is often used as a reference. Also use these fields instead of the
KConfig entries.
Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
The detach function didn't call FLEXCAN_TransferAbortReceive.
The state of the mailbox after detaching was still kFLEXCAN_StateRxData
and therefore a new filter couldn't be attached.
This PR calls FLEXCAN_TransferAbortReceive and releases the mailbox.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
The callback function and callback argument were not set when the
filter is attached, and therefore, the callback function was never
called. This commit sets the function and callback correct.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit adds support for a 6LoCAN Ethernet border translator.
CAN frames with the translator CAN address are translated and forwarded
to Ethernet. Ethernet frames with the first 34 bits matching the MAC
address of the translator are translated and forwarded to 6LoCAN.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit is an implementation of 6LoCAN, a 6Lo adaption layer for
Controller Area Networks. 6LoCAN is not yet standardised.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
Rename the socket_can implementation from CANBUS to CANBUS_RAW.
This is a preperation for 6LoCAN which is a CANBUS L2 for IPv6.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
TX1 and TX2 buffer empty busy flags would have been cleared only for
TX0 empty interrupts and there would have been extra unwarranted
TX callbacks for TX1 and TX2 if the callbacks had previously been used.
Signed-off-by: Nick Ward <nick.ward@setec.com.au>
This commit implements timestamps for receiving frames on the
NXP MCUX FlexCAN CAN driver.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
This commit introduces a timestamp for received CAN frames.
The timestamp is optional and can be activated via Kconfig.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
Implement a CAN shell. With this shell you can send messages,
attach and tetach filters.
Messages that match the attached filters are printed to the shell.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit changes the TX priority from ID based priority to
chronological order. The advantage is that when messages with
the same ID are sent, the order is retained.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
Removed the STM32 CAN_Init function and implemented the initialization
in the driver.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
move misc/util.h to sys/util.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
move misc/byteorder.h to sys/byteorder.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
move spi.h to drivers/spi.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
move gpio.h to drivers/gpio.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
move clock_control.h to drivers/clock_control.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
move can.h to drivers/can.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
move atomic.h to sys/atomic.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Convert DT_.*_GPIO_{CONTROLLER,PIN,FLAGS} ->
DT_.*_GPIOS_{CONTROLLER,PIN,FLAGS)
Used the following commands to make these conversions:
git grep -l DT_.*_GPIO_CONTROLLER | xargs sed -i 's/DT_\(.*\)_GPIO_CONTROLLER/DT_\1_GPIOS_CONTROLLER/g'
git grep -l DT_.*_GPIO_PIN | xargs sed -i 's/DT_\(.*\)_GPIO_PIN/DT_\1_GPIOS_PIN/g'
git grep -l DT_.*_GPIO_FLAGS | xargs sed -i 's/DT_\(.*\)_GPIO_FLAGS/DT_\1_GPIOS_FLAGS/g'
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add support for Kinetis MK64 series.
Interrupts are adapted because MK64 has other interrupts than KEx1F.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
Allow individual specification of the time quanta used for the CAN bus
propagation segment and phase segment 1.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Add support for two CAN bus controller instances and disable both of
them by default. Enable CAN_1 for the STM boards currently supporting
CAN.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
If the socket is closed, then do CAN detach if that is needed.
This way the CAN interrupts are not received if there are no
CAN sockets listening the data.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The filenames of the can drivers were not consisten.
Changed them to can_<dev name>
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit implements a CAN loopback device. This device is used
for testing when no CAN controller is available on the hardware.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
can_attach_workq is an isr wrapper that puts a work item into a workq
whenever a received frame matches the filter. With this function it is
possible to have a callback that is offloaded. This is useful if the
work is too complex for an isr or USERSPACE is enabled.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
can_attach_msgq can be implemented as a wrapper of can_attach_isr.
This is implemented as a common function for all drives and reduces
the complexity of the specific drivers. Since this is common to
multi instances of drivers too, it is removed from the API struct.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit extends the CAN api can_send function by an argument
that is passed to the isr callback.
With this extension it is possible to distinguish between sent masseges
when they use the same callback.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit extends the CAN api attach_isr function by an argument
that is passed to the isr callback.
With this extension it is possible to distinguish between filter matches
when they use the same callback.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
Bits are actually shifted by filter number instead of bank number.
This results in wrong mode and filter_index calculation.
Fix shifting of mode bits by using bank_number instead of filter_number.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
Fixed using chipselect with seperate chipselect GPIOs and how they were
referenced from/in DeviceTree.
Also configure the device during initialization so it's ready to go
after init.
Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
Adjusted the MCP2515 driver to switch from KConfig SPI configuration to
DTS based configuration.
Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
The MCP2515 is a CAN controller that can be connected via SPI to an
host MCU. This driver adds support for the MCP2515 as a new driver in
the CAN subsystem.
As it is a SPI peripheral it uses a thread for its interrupt
handling and the received message filtering is done inside this
interrupt thread, as the MCP2515 filter capabilities are not sufficient
for the Zephyr CAN interface.
The driver was validated with an external CAN logger and the adjusted
CAN sample application.
Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier. Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.
By default all files without license information are under the default
license of Zephyr, which is Apache version 2.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>