Commit Graph
105 Commits
Author SHA1 Message Date
Michal Lenc 3cb2e57560 cpukit/dev/can: fail controller init if worker task start doesn't start
CAN controllers need a running worker task to function. Check if
the task is actually started and return NULL (and free already allocated
resources) if it fails.

Also assert if cleanup functions fail.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2026-05-14 15:46:10 +00:00
Pavel Pisa 48d8b2bdea cpukit/dev/can/sja1000: fix build failure on i386 with I/O option
Disable PCI/PCIe and other buses I/O mapped access
because rtems/cpukit build is not allowed to access
BSP specific headers during build.

rtems/bsps/i386/include/i386_io.h

Cannot be used.

This is temporal workaround for

rtems/rtos/rtems#5563

Signed-off-by: Pavel Pisa <ppisa@pikron.com>
2026-04-29 02:41:08 +02:00
Michal Lenc 558615a28e cpukit/dev/can/ctucanfd/ctucanfd.c: fix typo
folowing -> following in license header

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2026-04-27 21:26:51 -05:00
Michal LencandPavel Pisa df346b439b can: add support for SJA1000 CAN controller
This commit adds support for a stand alone SJA1000 CAN controller. This
is classical CAN only capable controller, so no FD support here. The
driver's implementation is similar to CTU CAN FD, thus interrupt handler
triggers a semaphore in main worker thread that takes care of handling
interrupts and receiving and sending messages.

The controller utilizes its one TX buffer for sending messages with
abort function available if higher priority message is present in
the software queue.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
Co-authored-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
2026-04-27 21:26:51 -05:00
Michal Lenc 8ac4b4c412 can/ctucanfd: add can prefix to rtems_ctucanfd_initialize
This commit renames function rtems_ctucanfd_initialize to
rtems_can_ctucanfd_initialize. It standardizes the naming for CAN
controllers to always begin with rtems_can_ (similar to virtual
controller or sja1000 at the moment under review).

This is an API breaking change.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2026-04-12 07:33:41 -05:00
M Mithilesh 2970f882c9 cpukit/dev/can: Check task start status in queue init (CID 1642607) 2026-03-06 11:08:21 -06:00
M Mithilesh 1af2b99fa9 cpukit/can: Fix out-of-bounds array access
Add bounds checking to txtb_id to prevent out-of-bounds writes
in the TX buffer array. Fixes Coverity CID 1642617 and resolves
Issue #5248.
2026-02-27 15:49:12 -06:00
Kinsey Moore ef52cb5fbc cpukit/dev/can: Resolve sign comparison warning
Make the constant unsigned so that signedness on both sides of the
comparison matches.
2026-02-09 17:23:00 +00:00
Gedare Bloom 149df22aeb cpukit/dev: reformat io files
Closes #5443.
2026-02-05 10:46:11 -07:00
Gedare Bloom 1b17076054 cpukit/dev/spi: reformat
Updates #5443.
2026-02-05 10:46:11 -07:00
Gedare Bloom 4ced2b7f33 cpukit/dev/serial: reformat
Updates #5443.
2026-02-05 10:46:11 -07:00
Gedare Bloom 0e85986583 cpukit/dev/i2c: reformat
updates #5443.
2026-02-05 10:46:11 -07:00
Gedare Bloom ffd859a304 cpukit/dev/flash: reformat
Updates #5443
2026-02-05 10:46:11 -07:00
Gedare Bloom c6cdbd2c60 cpukit/dev/can: reformat
Updates #5443
2026-02-05 10:46:09 -07:00
Gedare Bloom fbc96a878b cpukit/dev: relocate iovprintf.c
Updates #5374
2026-02-02 19:16:07 +00:00
Joel Sherrill 0b7eb103fe cpukit/dev: Address -Wsign-compare warnings
This warning occurs when comparing a signed variable to an unsigned one.
This addresses warnings that only occurred on 64-bit targets.  For the
ones which only appeared on 64-bit targets, the cause was frequently
a mismatch when comparing a combination off_t, ssize_t, and int.
2026-02-02 12:48:43 -06:00
Yash cecbf340e9 cpukit/dev/can: Fix spelling errors in comments
Correct 'succesful' to 'successful' and 'succesfully' to 'successfully'
in the CAN and CTUCANFD driver comments.

Updates #5429
2026-01-24 17:01:35 +00:00
Michal Lenc 40305e360f can: fix -Wsign-compare warnings
Fixes -Wsign-compare compile warnings in CAN code. This introduces
the change in rtems_ctucanfd_initialize where ntxbufs is changed from
int to unsigned int, thus making the ntxbufs < 0 obsolete.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-12-18 19:14:40 -06:00
Joel Sherrill 089a16b6e8 cpukit/dev/can/can-bus.c: Address type-limits warnings
These changes were made to address GCC -Wtype-limits warnings.
In this case, the variables were unsigned and there was no need to
check them for being <= 0.

Updates #5388.
2025-12-11 23:53:16 +00:00
Joel Sherrill 426f938869 cpukit/.../flashdev.c: Correct comparisons of different signedness
The GCC warning -Wsign-compare flagged these instances of comparing
signed and unsigned types. A common pair was size_t and int.
2025-12-04 18:46:23 -05:00
Kinsey Moore e3592620d7 cpukit/flashdev: Return error for missing callbacks
When a callback does not exist, the Flashdev API should return error
where possible instead of success. When the API returns success for
missing callbacks, the Flashdev API client code may end up using
uninitialized variables as if they were filled by the API.

Closes #5391
2025-11-10 12:29:32 -06:00
Joel Sherrill 34f9c5690d cpukit: Address unused parameter warnings
Add "(void) param;" annotation to address unused parameter warnings.
Found with GCC's warning -Wunused-parameter.
2025-10-10 21:59:38 +00:00
Kinsey Moore 38e8e5c286 cpukit/flashdev: Add full support for NAND devices
This extends the flashdev API to support the additional calls required
by NAND device backends. This also adds region-relative IOCTLs to
prevent reimplementation of offset logic in top-end flashdev/filesystem
adapters.
2025-10-02 20:12:51 -04:00
Joel Sherrill 60458df1c2 cpukit/dev/can/*: Address unused parameter warnings
Add "(void) param;" annotation to address unused parameter warnings.
Found with GCC's warning -Wunused-paramter.
2025-09-26 22:38:34 +00:00
Kinsey Moore 75e7f5cb80 cpukit/flashdev: Add unregister call and private data destructor
This adds an API call allowing for unregistration to include destruction
of private data that is not managed by the flashdev framework. This also
updates the existing consumers of flashdev to use the new private data
destructor callback.
2025-09-22 10:04:58 -05:00
Michal Lenc e8de13e0c5 cpukit/dev/can/can-bittiming.c: remove calls to abs()
Using abs() on unsigned integers leads to GCC warning -Wabsolute-value.
This commit removes the calls to abs() and replaces them with ternary
conditional operator. This keeps the correct error calculation
previously ensured by abs() call.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-09-20 20:47:14 +02:00
Joel Sherrill 106363b29d cpukit/*: Correct implicit fallthrough warnings
Use RTEMS_FALL_THROUGH() to annotate case statements which
intentionally do not have a break statement.
2025-09-19 19:02:25 +00:00
Kinsey Moore 509ce2fde4 cpukit/flashdev: Remove unnecessary reinitialization 2025-09-10 18:56:24 +00:00
Aaron Nyholm f93f3b87c8 flashdev: Added missing copyright 2025-09-09 16:09:49 +00:00
Amar Takhar b714e4a809 ascii: Remove non-ASCII characters
We will soon be enforcing ASCII-only characters for source.
2025-05-22 19:35:12 +00:00
Joel Sherrill 91cc54bcf9 cpukit/dev/i2c/*: Relicense to 2-BSD
All files were written by Chris Johns who has previously given
permission to relicense.

Update #3053.
2025-03-19 01:16:19 +00:00
Gedare Bloom 8e6ded473c rtems: update licenses to 2BSD
This is an update of many lingering embedded brains GmbH licenses from
the RTEMS License to the 2-BSD license where possible depending on the
joint copyrights.

Updates #3053.
2025-02-10 15:44:09 +00:00
Michal Lenc 91237f06f9 can/ctucanfd: use STM mode if CAN_CTRLMODE_PRESUME_ACK is set
Self Test mode in CTU CAN FD has generally better much for
CAN_CTRLMODE_PRESUME_ACK mode compared to self-acknowledge mode (SAM)
It considers transmitted frame valid even if dominant acknowledge bit
was not receive, therefore it presumes acknowledge.

Moreover, this mode is available even in older CTU CAN FD versions.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-02-07 01:06:01 +00:00
Gedare Bloom db425a09b1 dev/can: remove URLs from copyrights 2025-02-07 00:30:36 +00:00
Michal LencandPavel Pisa e6f6eccaef can: add support for CTU CAN FD controller
This commit adds support for CTU CAN FD controller. The controller
can be initialized from BSP by ctucanfd_initialize() function call.
It also implements the dynamic redistribution of hardware transmission
buffers to CAN stack priority classes in order to avoid possible
priority inversion.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
Co-authored-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
2025-01-28 08:25:28 +01:00
Michal LencandPavel Pisa 0cbb9eb9f9 can: add support for a simple virtual CAN controller
This commit adds a support for a simple virtual CAN controller. This
controller can be used to test CAN stack functions and serves as an
inspiration for further controller implementations.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
Co-authored-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
2025-01-28 08:25:28 +01:00
Michal LencandPavel Pisa c3f4e215b1 cpukit: add support for common CAN/CAN FD stack
This adds support for common full-featured CAN/CAN FD stack to RTEMS.
The API is provided in form the form of the POSIX character driver with
each CAN controller (chip) registered as node into “/dev”
namespace.

The stack utilizes FIFO queues (also called edges) organized
into oriented edges between controller side and application side.
Edges, responsible for message transfers from application to controller
and vice versa, can have different priorities and function as priority
classes.

The stack provides run time configuration options to create new
queues with desired priority, direction and filter, making it
suitable for various applications requirements. There is also a
possibility to configure controller’s characteristics (bit rate,
mode, chip specific ioctl calls). Both blocking and nonblocking mode
is supported.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
Co-authored-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
2025-01-28 01:57:28 +00:00
Sebastian Huber 2c64cf1bd8 dev/serial/sc16is752-spi: Fix warnings
Fix several may be used uninitialized warnings.
2024-11-12 16:21:20 +00:00
Aaron Nyholm 87c725b6ed flashdev: Add sector IOCTLs
Added new IOCTLs to flashdev to get sector info.
Updated flashdev shell command and flashdev test with new IOCTLs.
2024-11-06 22:35:20 +00:00
Sebastian Huber ce1fb41a6c kvprintf(): Fix '+' conversion handling
For example, printf("%+i", 1) prints "+1".  However, kvprintf() did
print just "1" for this example.  According to PRINTF(3):

  A sign must always be placed before a number produced by a signed
  conversion.

For "%+r" radix conversions, keep the "+" handling as it is, since this
is a non-standard conversion.  For "%+p" pointer conversions, continue
to ignore the sign modifier to be in line with libc.

This change allows to support the ' conversion modifier in the future.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1310
2024-09-12 23:34:28 +00:00
Sebastian Huber 1e68298847 dev/io: Fix "%hhi" conversion
The signedness of "char" is implementation-dependent.
2024-06-13 17:19:35 +00:00
Sebastian Huber 30125493b5 dev/io: Remove dead code in _IO_Vprintf() 2024-06-13 17:19:35 +00:00
Warner Losh 0c7a972b3c sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2024-06-13 17:19:35 +00:00
Warner Losh c2041d3a0b sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2024-06-13 17:19:35 +00:00
Marius Strobl a9e1c29aa6 kvprintf(9): add missing FALLTHROUGH
Reported by:	Coverity
CID:		1005166
2024-06-13 17:19:35 +00:00
Sebastian Huber 317df86ba3 base64: Move base64 encoding support 2024-02-16 09:32:04 +01:00
Bernd Moessner a73b52d6a4 flashdev.c: return error if both buffers are NULL
Updates #4981
2024-01-16 10:57:43 -06:00
Bernd Moessner bd898b503f flashdev: Add missing default case
Updates #4981
2024-01-16 10:57:43 -06:00
Sebastian Huber 527af2b7f2 score: Move formatted I/O functions
These functions do not belong to an super core service.
2023-07-28 11:58:32 +02:00
Gedare Bloom c1cad595af Revert "cpukit/dev/can: Added CAN support"
This reverts commit cd91b37dce.

Closes #4803.
2023-07-27 12:41:28 -06:00