Commit Graph
14 Commits
Author SHA1 Message Date
Cheng Mingming a241e49bda cpukit/dev/flash: Fix region bitmap clear size
rtems_flashdev_register() cleared the region allocator bitmap with
memset( table->bit_allocator, 0, alloc_array_len ) where alloc_array_len
held the number of uint32_t words.  Since bit_allocator is a uint32_t
array, only one byte per word was zeroed, leaving the rest of the bitmap
uninitialised.  Stale bits can make
rtems_flashdev_find_unallocated_region() report region slots as
allocated and fail REGION_SET with ENOMEM while slots are actually free.

Rename RTEMS_FLASHDEV_BITALLOC_LENGTH to RTEMS_FLASHDEV_BITALLOC_WORD_LENGTH
to make the word count explicit, add RTEMS_FLASHDEV_BITALLOC_BYTE_LENGTH for
the size in bytes, and clear the whole bitmap using the byte length.
2026-06-10 09:42:54 +08:00
Gedare Bloom ffd859a304 cpukit/dev/flash: reformat
Updates #5443
2026-02-05 10:46:11 -07: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
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
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
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
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
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
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
Aaron Nyholm 4b209a322e cpukit/flash: Correct erase ioctl address
Previously, the erase ioctl call would ignore flash regions and erase at
the absolute address passed in. This adds a check for if the region is
set and adds the region offset accordingly.
2023-06-27 07:50:40 +10:00
Aaron Nyholm 15d4428e96 cpukit/flash: Add API for Flash devices 2023-05-16 12:48:13 +10:00