Commit graph

127 commits

Author SHA1 Message Date
Andy Ross 075c94f6e2 kernel: Port remaining syscalls to new API
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>
2019-09-12 11:31:50 +08:00
Karsten Koenig 758c461252 drivers: can: mcp2515: fix devicetree bindings
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>
2019-08-18 09:56:42 +02:00
Alexander Wachter 4c8901869c drivers: can: mcux: Fix can_detach
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>
2019-08-14 08:49:50 +02:00
Alexander Wachter 41c36b7cd6 drivers: can: mcux: Fix set can_send callbacks
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>
2019-08-14 08:49:50 +02:00
Alexander Wachter d864f5de5b net: l2: canbus: Add support for canbus Ethernet translator
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>
2019-08-08 13:25:01 +03:00
Alexander Wachter 35f01673ac net: l2: 6LoCAN implementation
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>
2019-08-08 13:25:01 +03:00
Alexander Wachter c8c5f3bbf3 net: canbus: Rename canbus to canbus_raw
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>
2019-08-08 13:25:01 +03:00
Nick Ward ea366e9aa3 drivers: can: mcp2515: Fix interrupt bit tests for empty TX buffers
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>
2019-08-07 15:14:28 +03:00
Henrik Brix Andersen 9a7734abf5 drivers: can: flexcan: implement timestamp for RX frames
This commit implements timestamps for receiving frames on the
NXP MCUX FlexCAN CAN driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2019-08-06 16:39:35 +03:00
Alexander Wachter 9923cf2dda drivers: can: stm32: Implement timestamp for RX frames
This commit implements timestamps for receiving frames on
stm32 CAN driver.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-06 16:39:35 +03:00
Alexander Wachter 3febaad1d6 can: Add RX timestamp to zcan_frame
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>
2019-08-06 16:39:35 +03:00
Alexander Wachter 75f3e17b45 drivers: can: Add CAN shell
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>
2019-07-29 10:27:54 +03:00
Alexander Wachter fc23fd1989 drivers: can: stm32: Update enable driver help message
Updated "Tested on" statements in the help

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-07-02 18:57:23 -04:00
Alexander Wachter d644007c32 drivers: can: stm32 Add error message for buffer overflow
This commit adds an LOG_ERR message for RX fifo overflow.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-07-02 18:57:23 -04:00
Alexander Wachter 82a1661c99 drivers: can: stm32: Change TX priority to chronological order
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>
2019-07-02 18:57:23 -04:00
Alexander Wachter 2b6b065d82 drivers: can: stm32: Remove STM CAN_Init
Removed the STM32 CAN_Init function and implemented the initialization
in the driver.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-07-02 18:57:23 -04:00
Anas Nashif a2fd7d70ec cleanup: include/: move misc/util.h to sys/util.h
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>
2019-06-27 22:55:49 -04:00
Anas Nashif 5d001f3e41 cleanup: include/: move misc/byteorder.h to sys/byteorder.h
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>
2019-06-27 22:55:49 -04:00
Anas Nashif bd70f6f1ed cleanup: include/: move spi.h to drivers/spi.h
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>
2019-06-27 22:55:49 -04:00
Anas Nashif 6aa9c3a68f cleanup: include/: move gpio.h to drivers/gpio.h
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>
2019-06-27 22:55:49 -04:00
Anas Nashif 17ddd1714c cleanup: include/: move clock_control.h to drivers/clock_control.h
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>
2019-06-27 22:55:49 -04:00
Anas Nashif c0c9396d44 cleanup: include/: move can.h to drivers/can.h
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>
2019-06-27 22:55:49 -04:00
Anas Nashif e1e05a2eac cleanup: include/: move atomic.h to sys/atomic.h
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>
2019-06-27 22:55:49 -04:00
Kumar Gala a614a026b7 dts: Rename DT_.*_GPIO_* to DT_.*_GPIOS_*
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>
2019-06-27 13:02:34 -05:00
Alexander Wachter f5b227641c drivers: can: mcux_flexcan: Add support for MK64
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>
2019-06-26 16:05:51 -05:00
Henrik Brix Andersen 652fdfe3a1 drivers: can: add support for the NXP Kinetis FlexCAN controller
Add MCUX driver shim for the NXP Kinetis FlexCAN CAN bus controller.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-06-24 14:33:46 -05:00
Henrik Brix Andersen dded1d076a dts: can: allow individual specification of prop seg and phase seg1 quanta
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>
2019-06-24 14:33:46 -05:00
Henrik Brix Andersen 64a9a04500 drivers: can: add support for two CAN controller instances
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>
2019-06-24 14:33:46 -05:00
David B. Kinder 2aebc980e2 doc: fix Kconfig misspellings
Fix misspellings in Kconfig files missed during regular reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-06-18 15:07:52 -04:00
Jukka Rissanen 06b500b6bd net: sockets: can: Close the socket cleanly
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>
2019-06-18 17:58:00 +03:00
Kumar Gala d4a0c3a2aa dts: Convert new/missed DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
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>
2019-06-15 07:14:12 -04:00
Alexander Wachter b0bc68e85e drivers: can: rename drivers to can_<dev name>
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>
2019-05-12 16:54:49 -04:00
Alexander Wachter 0e807c3f54 drivers: can: Add loopback driver
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>
2019-05-12 16:54:49 -04:00
Alexander Wachter 54d065c695 drivers: can: Implement can_attach_workq
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>
2019-05-12 16:54:49 -04:00
Alexander Wachter 7ddbade257 drivers: can: rework can_attach_msgq
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>
2019-05-12 16:54:49 -04:00
Alexander Wachter b3b43b8921 drivers: can: Extend can_send with void *arg and pass it to the isr cb
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>
2019-05-12 16:54:49 -04:00
Alexander Wachter 1b93522304 drivers: can: Extend attach_isr with void *arg and pass to the isr cb
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>
2019-05-12 16:54:49 -04:00
Alexander Wachter bc6186571e drivers: can: stm32: fix filter mode set
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>
2019-05-10 11:55:46 +02:00
Karsten Koenig c9090caad7 drivers: can: mcp2515: Fixes for DT SPI cs
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>
2019-04-17 16:12:30 -04:00
Karsten Koenig 4f7761047b drivers: can: mcp2515: Rework for DTS SPI bindings
Adjusted the MCP2515 driver to switch from KConfig SPI configuration to
DTS based configuration.

Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
2019-04-17 16:12:30 -04:00
Karsten Koenig 35b9308488 drivers: can: mcp2515: Add driver for MCP2515 CAN controller
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>
2019-04-17 16:12:30 -04:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
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>
2019-04-07 08:45:22 -04:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Maksim Masalski d1f3bba705 can: fix unchecked return from clock_control_get_rate
Inside can_stm32_runtime_configure() result of
clock_control_get_rate() is not checked which might result that
function can return error and that error can not be handled

Coverity-CID: 190926
Fixes: #13886
Signed-off-by: Maksim Masalski <maxxliferobot@gmail.com>
2019-03-26 22:18:15 -04:00
Tomasz Bursztyka d6d52ce9e5 net/pkt: Remove _new suffix to net_pkt_write functions
Suffix is now useless, as these functions are now the only ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Jukka Rissanen fc36d56aca drivers: can: socket: Use proper filter when setsockopt is called
Check that the received filter is can_filter type when setsockopt()
is called.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-13 05:58:30 -05:00
Patrik Flykt 4344e27c26 all: Update reserved function names
Update reserved function names starting with one underscore, replacing
them as follows:
   '_k_' with 'z_'
   '_K_' with 'Z_'
   '_handler_' with 'z_handl_'
   '_Cstart' with 'z_cstart'
   '_Swap' with 'z_swap'

This renaming is done on both global and those static function names
in kernel/include and include/. Other static function names in kernel/
are renamed by removing the leading underscore. Other function names
not starting with any prefix listed above are renamed starting with
a 'z_' or 'Z_' prefix.

Function names starting with two or three leading underscores are not
automatcally renamed since these names will collide with the variants
with two or three leading underscores.

Various generator scripts have also been updated as well as perf,
linker and usb files. These are
   drivers/serial/uart_handlers.c
   include/linker/kobject-text.ld
   kernel/include/syscall_handler.h
   scripts/gen_kobject_list.py
   scripts/gen_syscall_header.py

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-11 13:48:42 -04:00
Andrew Boie 26085d9570 drivers: can: fix multiple issues
* Registration of interrupt context callbacks from user mode
  is forbidden.

  - Remove can_attach_isr() as a system call
  - Enforce that can_send() has a NULL callback parameter

* k_msgq are kernel objects that do not live in user memory.
  Fix the checks for it in can_attach_msgq().

* CAN API documentation was with the API struct typedefs and
  not the actual APIs. Moved.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-09 10:07:44 -05:00
Alexander Wachter 8484855428 drivers: can: stm32_can: Fix shifting zero width or out of bounds
When attaching the filters in a way that the filter width dos not change
but the type, CAN_NO_FREE_FILTER was returned when the new filter is at
the end. Also shifting is not necessary when the start is already out
of bounds.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-03-03 23:57:25 -05:00
Flavio Ceolin b3dc27552d drivers: can: Z_SYCALL_HANDLER should return int
can_handlers.c:65:1: warning: control reaches end of non-void function
[-Wreturn-type]

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-03-01 09:22:55 +01:00
Maksim Masalski 9f8db3d729 can: cast value 1U to type ULL in function can_stm32_set_filter
Potentially overflowing expression 1U << register_demand
changed to the 1ULL << register_demand to avoid overflow.

Coverity-CID: 190996
Fixes: #13829
Signed-off-by: Maksim Masalski <maxxliferobot@gmail.com>
2019-02-28 16:57:08 -08:00
Maksim Masalski f32b94c46e can: cast value 1U to type u64_t in function can_stm32_set_filter
Potentially overflowing expression 1U << register_demand
I changed to (u64_t)1U << register_demand
To avoid overflow, I casted 1U to type u64_t.

Coverity-CID: 190996
Fixes: #13829
Signed-off-by: Maksim Masalski <maxxliferobot@gmail.com>
2019-02-28 16:57:08 -08:00
Alexander Wachter 18680e55e5 drivers: can: Fix userspace handler parameter types
Change the parameter types from can_msg to zcan_frame and from
can_filter to zcan_filter.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-28 08:45:44 -06:00
Alexander Wachter b0826442ee drivers: can: Make zcan_frame const for sending
For sending the zcan_frame can be const, because its only
copied to the registers.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-28 08:45:44 -06:00
Kumar Gala bb6b1918b2 drivers: can: stm32: Cleanup Kconfig enablement
Follow the pattern we have for other peripherals in that if the driver
class (CAN) is enabled than enable the driver for that class
(CAN_STM32).  Also have the STM32 CAN driver depend on being on a STM32
SoC.

Remove setting of CONFIG_CAN_STM32 in any .conf files as it will get set
of CONFIG_CAN is set/enabled.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-25 10:05:21 -06:00
Jukka Rissanen c478b5bb6e can: Rename can_msg and can_msg_filter structs
In order to follow the naming from Linux, change the name of
can_msg to zcan_frame, and can_msg_filter to zcan_filter.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-22 08:07:03 -05:00
Jukka Rissanen 58f3ae5334 can: Add Linux compatible frame and filter structs
Add new "struct can_frame" which is compatible with Linux so that it
is easier to port socket-can applications from Linux.
Rename existing can_filter to can_msg_filter so that the name will
not conflict with Linux compatible can_filter struct.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-22 08:07:03 -05:00
Alexander Wachter 8757e780fc drivers: can: Update userspace handlers
This commit updates the userspace handlers to thle latest version.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-12 09:39:30 -05:00
Alexander Wachter 873875411e drivers: can: stm32_can rework
This commit makes the stm32 CAN driver more readable and fix
a bug where the usage and rx_response array are not shifted correctly.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-02-12 09:39:30 -05:00
Jukka Rissanen fc9e414ebf drivers: can: stm32: Add socket CAN support
Add support for socket CAN functionality. This means that user
is able to use BSD socket interface to send and receive CAN
packets.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-08 12:03:34 -05:00
Erwin Rol 28c01b6219 drivers: can: fix typo
Fix another typo in the stm32_can.h header file, swj -> sjw.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2019-02-04 12:59:26 -05:00
Erwin Rol 47fb24fea3 drivers: can: fix typos
- swj -> sjw (Sync Jump Width)
- CAN_MAX_NUMBER_OF_FILTES -> CAN_MAX_NUMBER_OF_FILTERS

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2019-02-01 19:07:57 -05:00
Patrik Flykt 8ff96b5a57 drivers: Add 'U' to unsigned variable assignments
Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-12-04 22:51:56 -05:00
Andrzej Głąbek 20202902f2 dts_fixups: Use DT_ prefix in all defined labels not related to Kconfig
These changes were obtained by running a script  created by
Ulf Magnusson <Ulf.Magnusson@nordicsemi.no> for the following
specification:

1. Read the contents of all dts_fixup.h files in Zephyr
2. Check the left-hand side of the #define macros (i.e. the X in
   #define X Y)
3. Check if that name is also the name of a Kconfig option
   3.a If it is, then do nothing
   3.b If it is not, then replace CONFIG_ with DT_ or add DT_ if it
       has neither of these two prefixes
4. Replace the use of the changed #define in the code itself
   (.c, .h, .ld)

Additionally, some tweaks had to be added to this script to catch some
of the macros used in the code in a parameterized form, e.g.:
- CONFIG_GPIO_STM32_GPIO##__SUFFIX##_BASE_ADDRESS
- CONFIG_UART_##idx##_TX_PIN
- I2C_SBCON_##_num##_BASE_ADDR
and to prevent adding DT_ prefix to the following symbols:
- FLASH_START
- FLASH_SIZE
- SRAM_START
- SRAM_SIZE
- _ROM_ADDR
- _ROM_SIZE
- _RAM_ADDR
- _RAM_SIZE
which are surprisingly also defined in some dts_fixup.h files.

Finally, some manual corrections had to be done as well:
- name##_IRQ -> DT_##name##_IRQ in uart_stm32.c

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-13 10:44:42 -06:00
Kumar Gala aa2bdbe322 drivers: Remove board.h include
We either don't need board.h in the driver or we should be include soc.h
instead.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-01 13:21:11 -04:00
Anas Nashif c141df09e3 drivers: can: move to new logger
Move to new logger subsystem.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Flavio Ceolin 67ca176754 headers: Fix headers across the project
Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-17 15:49:26 -04:00
Flavio Ceolin da49f2e440 coccicnelle: Ignore return of memset
The return of memset is never checked. This patch explicitly ignore
the return to avoid MISRA-C violations.

The only directory excluded directory was ext/* since it contains
only imported code.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-14 16:55:37 -04:00
Alexander Wachter 39cb4b4167 drivers: can: Fix Issue #8226
This commit is a fix for Issue #8226
- Error flags are assigned to the correct mailbox now.
- set_filter_mutex is moved from can_stm32_attach to the wrappers
  can_stm32_attach_isr and can_stm32_attach_msgq. This protects
  response_type variable.
- Waiting for empty mailbox semaphore return value
  is checked for none zero values to check all error states.
- The mailbox tx_int_sem is reset before the sending is triggered.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2018-08-15 08:23:02 -05:00
Ulf Magnusson 27b9c05d4d drivers: can: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Sritej Kanakadandi Venkata Rama 6f61f09803 drivers: can: Set a initial state to the can device before HAL_CAN_Init
As part of HAL_CAN_Init we check the initial state of the can handle.
Setting it to HAL_CAN_STATE_RESET as an initial state to start the
Init properly.

Resolves: #8416
Coverity-CID: 186580

Signed-off-by: Sritej Kanakadandi Venkata Rama <sritej.kvr@gmail.com>
2018-06-19 20:46:25 -04:00
Alexander Wachter ebc31f6235 drivers: can: Prepare STM32 driver for other series than STM32F0
This commit splits the common interrupt into rx and tx parts because
only STM32F0 series has a common interrupt.
Moved clock source definition to device-tree.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2018-06-18 15:23:29 -04:00
Alexander Wachter b97dd472fb drivers: can: Move bit timing and clock to device tree
This commit moves the bit timing (PROP, BS1, BS2 segments and SWJ)
from Kconfig to the device-tree and fixes issue #7933

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2018-06-01 12:59:42 -05:00
David B. Kinder 44383a394b doc: fix misspellings in Kconfig files
Found some misspellings missed during normal reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-23 16:57:20 -04:00
Alexander Wachter 2976ac351d drivers: can: Add CAN driver support for STM32
This commit adds low level driver support for STM32 micro controllers.
It is tested on stm32f072b in loopback and normal mode.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2018-05-19 20:19:30 +02:00
Alexander Wachter d3101b1fa4 drivers: can: Add syscall handlers for CAN API
This commit adds generic syscall handlers for the CAN API

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2018-05-19 20:19:30 +02:00
Alexander Wachter 023e4518f2 drivers: can: Add Kconfig for CAN driver
This commit adds the Kconfig for generic CAN drivers.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2018-05-19 20:19:30 +02:00