|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Shared geometry constants + FAT16 sector-synthesis prototype. More...
#include <stdint.h>#include "ux_api.h"Go to the source code of this file.
Enumerations | |
| enum | demo_config_t : uint32_t { k_demo_thread_stack = 4096U , k_demo_usbx_pool_bytes = 32768U , k_demo_block_size = 512U , k_demo_idle_ticks = 50U } |
| Compile-time settings for the worker thread + USBX pool + RAM-disk geometry. More... | |
| enum | demo_mram_t : uint32_t { k_mram_base_addr = 0x02000000U , k_mram_bytes = 0x00100000U } |
| The MRAM window this volume exposes (RA8D2 HUM memory map). More... | |
| enum | demo_fat_geom_t : uint32_t { k_fat_reserved_sectors = 1U , k_fat_num_fats = 1U , k_fat_fat_sectors = 17U , k_fat_root_entries = 512U , k_fat_root_sectors = 32U , k_fat_data_sectors = 4096U , k_fat_fat_lba = 1U , k_fat_root_lba = 18U , k_fat_data_lba = 50U , k_fat_total_sectors = 4146U , k_fat_first_cluster = 2U , k_fat_mram_clusters = 2048U , k_fat_last_mram_clus = 2049U , k_fat_entries_per_sec = 256U , k_fat_eoc = 0xFFFFU , k_fat_entry0 = 0xFFF8U } |
| Synthesized FAT16 volume geometry (MS FAT spec 1.03). More... | |
| enum | demo_fat_boot_t : uint32_t { k_boot_jmp0 = 0xEBU , k_boot_jmp1 = 0x3CU , k_boot_jmp2 = 0x90U , k_boot_media = 0xF8U , k_boot_sec_per_trk = 32U , k_boot_num_heads = 16U , k_boot_drive_num = 0x80U , k_boot_ext_sig = 0x29U , k_boot_volume_id = 0x52A8D200U , k_boot_sig_lo = 0x55U , k_boot_sig_hi = 0xAAU , k_boot_sig_lo_off = 510U , k_boot_sig_hi_off = 511U } |
| Boot-sector field values (MS FAT spec 1.03 sec 3.1). More... | |
| enum | demo_fat_off_t : uint8_t { k_bpb_off_jmp = 0U , k_bpb_off_oem = 3U , k_bpb_off_bps = 11U , k_bpb_off_spc = 13U , k_bpb_off_rsvd = 14U , k_bpb_off_nfats = 16U , k_bpb_off_rootent = 17U , k_bpb_off_totsec16 = 19U , k_bpb_off_media = 21U , k_bpb_off_fatsz16 = 22U , k_bpb_off_spt = 24U , k_bpb_off_heads = 26U , k_bpb_off_drvnum = 36U , k_bpb_off_bootsig = 38U , k_bpb_off_volid = 39U , k_bpb_off_label = 43U , k_bpb_off_fstype = 54U , k_dir_entry_bytes = 32U , k_dir_off_attr = 11U , k_dir_off_cluster_lo = 26U , k_dir_off_size = 28U , k_dir_attr_volume = 0x08U , k_dir_attr_read_only = 0x01U , k_dir_name_bytes = 11U , k_byte_shift = 8U , k_byte_mask = 0xFFU } |
| Byte offsets inside the boot sector and directory entries. More... | |
| enum | demo_word_pack_t : uint32_t { k_word_shift = 16U , k_word_mask = 0xFFFFU } |
| 32-bit little-endian split constants. More... | |
Functions | |
| void | demo_fat_fill_sector (uint32_t lba, UCHAR *out) |
| Synthesize one 512-byte sector of the read-only volume. | |
Shared geometry constants + FAT16 sector-synthesis prototype.
Declares the compile-time FAT16 volume-geometry / boot-sector / offset enums plus the read-only sector-synthesizer that main.c and usb_msc_mram_steps.c share. The enums live here so the on-the-fly volume image stays a single source of truth: the worker thread in main.c reads geometry constants such as k_fat_total_sectors and k_demo_block_size to size the LUN, while the synthesis helpers in usb_msc_mram_steps.c consume the same byte-offset and field-value constants to build each 512-byte sector.
Definition in file usb_msc_mram_steps.h.
| enum demo_config_t : uint32_t |
Compile-time settings for the worker thread + USBX pool + RAM-disk geometry.
Definition at line 34 of file usb_msc_mram_steps.h.
| enum demo_fat_boot_t : uint32_t |
Boot-sector field values (MS FAT spec 1.03 sec 3.1).
Definition at line 84 of file usb_msc_mram_steps.h.
| enum demo_fat_geom_t : uint32_t |
Synthesized FAT16 volume geometry (MS FAT spec 1.03).
One 512-byte sector per cluster. The data region is padded to 4096 clusters so the cluster count crosses the 4085 FAT16 threshold; only the first 2048 clusters (1 MiB) are backed by MRAM, and nothing references the rest. FAT16 needs 2 bytes per entry for 4098 entries = 8196 bytes = 17 sectors. The root directory holds 512 entries = 32 sectors.
Definition at line 61 of file usb_msc_mram_steps.h.
| enum demo_fat_off_t : uint8_t |
Byte offsets inside the boot sector and directory entries.
Definition at line 104 of file usb_msc_mram_steps.h.
| enum demo_mram_t : uint32_t |
The MRAM window this volume exposes (RA8D2 HUM memory map).
| Enumerator | |
|---|---|
| k_mram_base_addr | MRAM code window base address. |
| k_mram_bytes | 1 MiB window size. |
Definition at line 45 of file usb_msc_mram_steps.h.
| enum demo_word_pack_t : uint32_t |
32-bit little-endian split constants.
| Enumerator | |
|---|---|
| k_word_shift | Bits per half-word. |
| k_word_mask | Low half-word mask. |
Definition at line 137 of file usb_msc_mram_steps.h.
| void demo_fat_fill_sector | ( | uint32_t | lba, |
| UCHAR * | out ) |
Synthesize one 512-byte sector of the read-only volume.
Dispatches on the LBA: boot sector, FAT, root directory, or data region. Data sectors inside the MRAM.BIN chain are copied straight out of the 1 MiB MRAM window; padding clusters past the chain read as zeros.
| [in] | lba | Logical block address inside the volume. |
| [out] | out | 512-byte destination buffer. |
lba is below k_fat_total_sectors (caller-checked). out has 512 writable bytes. out holds the synthesized sector content. Definition at line 199 of file usb_msc_mram_steps.c.
References demo_fat_fill_boot(), demo_fat_fill_fat(), demo_fat_fill_root(), k_demo_block_size, k_fat_data_lba, k_fat_fat_lba, k_fat_first_cluster, k_fat_last_mram_clus, k_fat_root_lba, k_mram_base_addr, memcpy(), and memset().
Referenced by demo_msc_read().