|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <stdint.h>#include <stdbool.h>Go to the source code of this file.
Functions | |
| static bool | usb_msc_range_ok (uint64_t total_bytes, uint16_t block_size, uint32_t lba, uint32_t offset, uint32_t len, bool is_write) |
| Validates an MSC block access against the volume geometry. | |
| static bool | usb_msc_should_remount (bool prev, bool cur) |
| Whether a host-active transition should trigger a badge remount. | |
|
inlinestatic |
Validates an MSC block access against the volume geometry.
Reads may use any offset/length within bounds. Writes must be sector-aligned (offset 0 and length a whole number of blocks), matching the erase-then-write wear-levelling semantics.
| total_bytes | Total accessible volume size. |
| block_size | Logical block (sector) size. |
| lba | Logical block address. |
| offset | Byte offset inside the block. |
| len | Access length in bytes. |
| is_write | True for a write access (stricter alignment). |
Definition at line 26 of file usb_msc_bounds.h.
Referenced by cdc::plugin_manager::PluginStorage::blockRead(), and cdc::plugin_manager::PluginStorage::blockWrite().
|
inlinestatic |
Whether a host-active transition should trigger a badge remount.
Only the active->inactive edge (host detached) refreshes the FATFS view so host-written files become visible.
| prev | Previous host-active state. |
| cur | New host-active state. |
Definition at line 45 of file usb_msc_bounds.h.
Referenced by cdc::plugin_manager::PluginStorage::setHostActive().