|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Flash / MRAM controller register layout for the Renesas RA8D2. More...
#include <stdint.h>Go to the source code of this file.
Functions | |
| static volatile uint8_t * | ra8_mram_reg8 (uint16_t off) |
| Pointer to a byte-wide MRMS register at offset off. | |
| static volatile uint16_t * | ra8_mram_reg16 (uint16_t off) |
| Pointer to a halfword-wide MRMS register at offset off. | |
| static volatile uint32_t * | ra8_mram_reg32 (uint16_t off) |
| Pointer to a word-wide MRMS register at offset off. | |
| static volatile uint8_t * | ra8_mram_cmd8 (void) |
| Pointer to the MACI command-issuing area, byte-wide. | |
| static volatile uint16_t * | ra8_mram_cmd16 (void) |
| Pointer to the MACI command-issuing area, halfword-wide. | |
Flash / MRAM controller register layout for the Renesas RA8D2.
On RA8D2 the primary non-volatile code memory is MRAM, not traditional NOR flash, but the controller interface follows the RA "MRMS" IP. Writes to code-MRAM use a small store-window plus a keyed flush; updates to anti-rollback counters, the start-up area and other configuration-set words go through the MACI command sequencer; reads of either region are transparent.
All register offsets, field masks and key codes here are derived from the Hardware User's Manual:
The companion driver (libs/ra8_hal/src/ra8_flash.c) cites the exact HUM page each time it pokes one of these registers. That keeps the math here a passive layout description: all policy lives in the driver.
Definition in file ra8_flash_regs.h.
| enum ra8_arc_limits_t : uint32_t |
Per-counter bit limits and ARCCS field masks.
Values come from BSP_FEATURE_FLASH_ARC_*_MAX_COUNT in the FSP RA8D1/RA8T2 BSP feature header (the RA8D2 inherits the same MRAM macro). HUM Ch 7.2.21 p 296 fixes the ARCCS.ARCNS encoding.
Definition at line 615 of file ra8_flash_regs.h.
| enum ra8_flash_map_t : uintptr_t |
Address bounds of the user-visible MRAM windows.
The code-MRAM lives at 0x02000000 and is 1 MiB. The RA8D2 has no general-purpose data-flash / EEPROM array: the only MRAM area the MACI Program command (0xE8) can target is the extra-MRAM option-setting / OTP window at 0x02E07600..0x02E179F0. Every address enumerated by HUM Ch 59.7.4.5 Table 59.15 lies in that span (FSBL, code certificate, general-purpose OTP, PBPS, POFSPS, REVOKE, HUK-zeroize enable, anti-rollback counter). The previously-declared 0x27000000 "data flash" base is an RA-family assumption this part does not honour (writing it faults, ILGCOMERR|ILGLERR – issue #397). Anti-rollback counters and the start-up area-select fuse live in the Option-Setting Memory window starting at 0x02C9F000.
Definition at line 63 of file ra8_flash_regs.h.
| enum ra8_maci_cmd_t : uint8_t |
MACI command opcodes streamed through the MACI command-issuing area.
Each value is the literal opcode the extra-MRAM sequencer expects as the first byte written to the MACI command-issuing area (HUM Ch 59.7.4 p 3591.. 3597). The two data-carrying commands share one byte-stream shape – <opener>, N, <N halfwords>, 0xD0 – and differ ONLY in the opener:
N (k_ra8_maci_cmd_word_count_n, 0x08) is the halfword count both commands write after the opener: eight halfwords == one 16-byte program unit.
Definition at line 660 of file ra8_flash_regs.h.
| enum ra8_mastat_mask_t : uint8_t |
MASTAT field masks.
| Enumerator | |
|---|---|
| k_ra8_mastat_mask_mreae | Extra MRAM access error. |
| k_ra8_mastat_mask_cmdlk | Command lock latched. |
Definition at line 341 of file ra8_flash_regs.h.
| enum ra8_mcmdr_mask_t : uint16_t |
MCMDR field masks (MACI command status snapshot).
| Enumerator | |
|---|---|
| k_ra8_mcmdr_mask_pcmdr | Pre-command flag. |
| k_ra8_mcmdr_mask_cmdr | Command flag. |
| k_ra8_mcmdr_mask_cmd_progress | Any command in flight. |
Definition at line 437 of file ra8_flash_regs.h.
| enum ra8_mcntselr_t : uint8_t |
MCNTSELR field-value codes for the four counter families.
| Enumerator | |
|---|---|
| k_ra8_mcntselr_sec | ARC_SEC. |
| k_ra8_mcntselr_oembl | ARC_OEMBL (OEM bootloader). |
| k_ra8_mcntselr_nsec_0 | ARC_NSEC index 0; +1/+2/+3 follow. |
| k_ra8_mcntselr_mask | CNTSEL[2:0]. |
Definition at line 598 of file ra8_flash_regs.h.
| enum ra8_mctrcntr_t : uint16_t |
Keyed values + masks for MCTRCNTR.
KEY[15:8] = 0xA5 per the standard RA family transfer-trigger convention. Bit 0 (TRTRG) starts the transfer.
| Enumerator | |
|---|---|
| k_ra8_mctrcntr_key | RA8 mctrcntr key. |
| k_ra8_mctrcntr_mask_start | RA8 mctrcntr mask start. |
Definition at line 558 of file ra8_flash_regs.h.
| enum ra8_mctrlsr_mask_t : uint8_t |
MCTRLSR field mask (transfer-list select).
| Enumerator | |
|---|---|
| k_ra8_mctrlsr_mask_list_sel | RA8 mctrlsr mask list sel. |
Definition at line 568 of file ra8_flash_regs.h.
| enum ra8_mctrstatr_mask_t : uint16_t |
MCTRSTATR field masks.
The HUM only defines TRBUSY (bit 0) and TRMD (bit 2). The driver surfaces an additional "done" view as TRMD inverted from TRBUSY, and an "err" view masking the upper bits for forward-compat.
| Enumerator | |
|---|---|
| k_ra8_mctrstatr_mask_busy | TRBUSY. |
| k_ra8_mctrstatr_mask_done | TRMD. |
| k_ra8_mctrstatr_mask_err | Reserved-future error. |
Definition at line 582 of file ra8_flash_regs.h.
| enum ra8_mentryr_t : uint16_t |
Keyed values and field masks for the MENTRYR P/E entry register.
Definition at line 379 of file ra8_flash_regs.h.
| enum ra8_mpaeint_mask_t : uint8_t |
MPAEINT field masks (extra MRAM access-error IRQ enable).
| Enumerator | |
|---|---|
| k_ra8_mpaeint_mask_mreaeie | Access-error IRQ enable. |
| k_ra8_mpaeint_mask_cmdlkie | Command-lock IRQ enable. |
Definition at line 322 of file ra8_flash_regs.h.
| enum ra8_mram_base_addr_t : uintptr_t |
MRMS controller base addresses.
The MRMS register window is 0x3808 bytes. Secure alias starts at 0x4013C000. The non-secure alias (BASE_NS_OFFSET = 0x10000000) is 0x5013C000. The MACI command-issuing area is a small two-register window at 0x40120000 (HUM Ch 59 p 3550).
| Enumerator | |
|---|---|
| k_ra8_mram_base_addr | Secure MRMS base. |
| k_ra8_mram_base_addr_ns | Non-secure MRMS alias. |
| k_ra8_mram_cmd_base | MACI command issue area. |
Definition at line 116 of file ra8_flash_regs.h.
| enum ra8_mram_data_const_t : uint32_t |
Sizes used by the driver when chunking writes / counter reads.
Definition at line 703 of file ra8_flash_regs.h.
| enum ra8_mram_off_t : uint16_t |
Byte offsets into the MRMS register window.
Values track the layout in R_MRMS_Type from the FSP CMSIS device header (R7KA8D2KF_core0.h), which mirrors the HUM Ch 59 register descriptions on pages 3551..3624.
Definition at line 137 of file ra8_flash_regs.h.
| enum ra8_mrcbprot0_t : uint16_t |
Keyed values for MRCBPROT0 (non-secure block-protection cancel).
BPCN0 = 0 locks the block (default protect-on); = 1 cancels. KEY[15:8] = 0x88.
| Enumerator | |
|---|---|
| k_ra8_mrcbprot0_key_lock | Keep block protect on. |
| k_ra8_mrcbprot0_key_unlock | Cancel block protect. |
Definition at line 514 of file ra8_flash_regs.h.
| enum ra8_mrcbprot1_t : uint16_t |
Keyed values for MRCBPROT1 (secure block-protection cancel).
KEY[15:8] = 0x44.
| Enumerator | |
|---|---|
| k_ra8_mrcbprot1_key_lock | RA8 mrcbprot1 key lock. |
| k_ra8_mrcbprot1_key_unlock | RA8 mrcbprot1 key unlock. |
Definition at line 527 of file ra8_flash_regs.h.
| enum ra8_mrcdecc_mask_t : uint16_t |
Field masks and key for the MRCDECC ECC decoder control.
| Enumerator | |
|---|---|
| k_ra8_mrcdecc_mask_dececen | Decoder enable (ECCSELC). |
| k_ra8_mrcdecc_key_shift | Pre-shifted KEY[15:8]=0x8C. |
Definition at line 269 of file ra8_flash_regs.h.
| enum ra8_mrceecc_mask_t : uint16_t |
Field masks and key for the MRCEECC ECC encoder control.
The HUM names the enable bit ECCBYPC (bypass-clear, active high for "encoder enabled"). We expose it as eccen to keep driver code intent-readable.
| Enumerator | |
|---|---|
| k_ra8_mrceecc_mask_eccen | Encoder enable bit. |
| k_ra8_mrceecc_key_shift | Pre-shifted KEY[15:8]=0xC0. |
Definition at line 259 of file ra8_flash_regs.h.
| enum ra8_mrcflr_t : uint16_t |
Keyed value for MRCFLR (write-buffer flush).
0xC301 sets MRCFL=1 with KEY[15:8]=0xC3 (HUM Ch 59 p 3601).
| Enumerator | |
|---|---|
| k_ra8_mrcflr_key_flush | RA8 mrcflr key flush. |
Definition at line 540 of file ra8_flash_regs.h.
| enum ra8_mrcpaeint_mask_t : uint8_t |
MRCPAEINT field mask.
| Enumerator | |
|---|---|
| k_ra8_mrcpaeint_mask_mrcaeie | Code program-error IRQ enable. |
Definition at line 313 of file ra8_flash_regs.h.
| enum ra8_mrcpc0_t : uint16_t |
Keyed values for MRCPC0 (non-secure program-gate).
KEY[15:8] = 0x86. Bit 0 enables programming when set.
| Enumerator | |
|---|---|
| k_ra8_mrcpc0_key_enable | RA8 mrcpc0 key enable. |
| k_ra8_mrcpc0_key_disable | RA8 mrcpc0 key disable. |
Definition at line 487 of file ra8_flash_regs.h.
| enum ra8_mrcpc1_t : uint16_t |
Keyed values for MRCPC1 (secure program-gate).
KEY[15:8] = 0x68.
| Enumerator | |
|---|---|
| k_ra8_mrcpc1_key_enable | RA8 mrcpc1 key enable. |
| k_ra8_mrcpc1_key_disable | RA8 mrcpc1 key disable. |
Definition at line 500 of file ra8_flash_regs.h.
| enum ra8_mrcps_mask_t : uint8_t |
Bit masks for the MRCPS Code MRAM Program Status Register.
The error bits (PRGERRC, ECCERRC) are W1C; the busy bits (ABUFEMP, ABUFFULL, PRGBSYC) are read-only status.
Definition at line 235 of file ra8_flash_regs.h.
| enum ra8_mrcraeint_mask_t : uint8_t |
MRCRAEINT / MRERAINT IRQ-enable bits.
INTENBDC enables the DEC IRQ; INTENBTC enables the TED IRQ.
| Enumerator | |
|---|---|
| k_ra8_mrcraeint_mask_intenbdc | DEC error IRQ enable. |
| k_ra8_mrcraeint_mask_intenbtc | TED error IRQ enable. |
Definition at line 303 of file ra8_flash_regs.h.
| enum ra8_mrcraes_mask_t : uint8_t |
MRCRAES / MRERAES read-access error status bits.
Same layout in both code and extra registers (DEC at bit 0, TED at bit 1), so the same enum is reused for both via the names k_ra8_mrcraes_mask_*.
| Enumerator | |
|---|---|
| k_ra8_mrcraes_mask_decerrc | 2-bit DEC error. |
| k_ra8_mrcraes_mask_tederrc | 1-bit TED error. |
| k_ra8_mrcraes_mask_any | Either 1-bit or 2-bit. |
Definition at line 289 of file ra8_flash_regs.h.
| enum ra8_mrdyie_mask_t : uint8_t |
MRDYIE field mask.
| Enumerator | |
|---|---|
| k_ra8_mrdyie_mask_mrdyie | MRDY IRQ enable. |
Definition at line 332 of file ra8_flash_regs.h.
| enum ra8_mrezc_t : uint16_t |
MREZC keyed control words (zeroization).
The HUM specifies WHUKZE[2:0] = 0b101 + KEY[15:8] = 0xA5 to launch a full W-HUK zeroize.
| Enumerator | |
|---|---|
| k_ra8_mrezc_full_zero | RA8 mrezc full zero. |
Definition at line 365 of file ra8_flash_regs.h.
| enum ra8_mrezs_mask_t : uint8_t |
MREZS field masks (zeroization status).
| Enumerator | |
|---|---|
| k_ra8_mrezs_mask_whukzf | W-HUK Zero Flag. |
| k_ra8_mrezs_mask_whukexe | W-HUK Zeroization Executing. |
Definition at line 351 of file ra8_flash_regs.h.
| enum ra8_mrpsc_mask_t : uint8_t |
MRPSC field masks (high-speed program enable).
| Enumerator | |
|---|---|
| k_ra8_mrpsc_mask_mhspen | High-speed program enable. |
Definition at line 475 of file ra8_flash_regs.h.
| enum ra8_msaddr_t : uint32_t |
Well-known MSADDR targets for configuration-set writes.
0x02C9F070 is the start-up-area select (BTFLG / BTSIZE) word group; the SAS halfword sits 4 bytes deeper at 0x02C9F074.
| Enumerator | |
|---|---|
| k_ra8_msaddr_config_set_startup | RA8 msaddr config set startup. |
| k_ra8_msaddr_ofs_sas | RA8 msaddr ofs sas. |
Definition at line 687 of file ra8_flash_regs.h.
| enum ra8_mstatr_mask_t : uint32_t |
MSTATR field masks (extra-MRAM status flags).
Definition at line 448 of file ra8_flash_regs.h.
| enum ra8_msuacr_t : uint16_t |
Keyed values for MSUACR start-up swap.
SAS[1:0] = 0b00 selects default; 0b01 selects alternate. KEY[15:8] must be 0x66 for the write to take effect.
| Enumerator | |
|---|---|
| k_ra8_msuacr_key | RA8 msuacr key. |
| k_ra8_msuacr_swap_default | RA8 msuacr swap default. |
| k_ra8_msuacr_swap_alternate | RA8 msuacr swap alternate. |
Definition at line 401 of file ra8_flash_regs.h.
| enum ra8_msuasmon_mask_t : uint32_t |
MSUASMON read-only field masks.
| Enumerator | |
|---|---|
| k_ra8_msuasmon_mask_fspr | Protection flag. |
| k_ra8_msuasmon_mask_btflg | Boot-swap flag. |
Definition at line 412 of file ra8_flash_regs.h.
| enum ra8_msuinitr_t : uint16_t |
Keyed value + field mask for MSUINITR.
| Enumerator | |
|---|---|
| k_ra8_msuinitr_full_init | KEY=0xAA, SUINIT=1. |
| k_ra8_msuinitr_mask_suinit | SUINIT status bit. |
Definition at line 422 of file ra8_flash_regs.h.
|
inlinestatic |
Pointer to the MACI command-issuing area, halfword-wide.
Definition at line 792 of file ra8_flash_regs.h.
References k_ra8_mram_cmd_base.
Referenced by priv_ra8_flash_internal_maci_cmd16().
|
inlinestatic |
Pointer to the MACI command-issuing area, byte-wide.
Definition at line 779 of file ra8_flash_regs.h.
References k_ra8_mram_cmd_base.
Referenced by priv_ra8_flash_internal_maci_cmd8().
|
inlinestatic |
Pointer to a halfword-wide MRMS register at offset off.
| [in] | off | Byte offset into the MRMS window; must be 16-bit aligned. |
Definition at line 750 of file ra8_flash_regs.h.
References k_ra8_mram_base_addr.
Referenced by internal_flash_program_window(), internal_set_program_gate(), ra8_flash_block_protect_set(), ra8_flash_deinit(), ra8_flash_enter_pe_mode(), ra8_flash_exit_pe_mode(), ra8_flash_get_extended_status(), ra8_flash_get_update_status(), ra8_flash_init(), ra8_flash_lock_set(), ra8_flash_msuinitr_kick(), ra8_flash_resume(), ra8_flash_set_ecc_decoder_enable(), ra8_flash_set_ecc_encoder_enable(), ra8_flash_set_security_attribution(), ra8_flash_set_startup_area(), ra8_flash_set_update_transfer(), ra8_flash_status(), ra8_flash_suspend(), and ra8_flash_zeroize_huk().
|
inlinestatic |
Pointer to a word-wide MRMS register at offset off.
| [in] | off | Byte offset into the MRMS window; must be 32-bit aligned. |
Definition at line 765 of file ra8_flash_regs.h.
References k_ra8_mram_base_addr.
Referenced by internal_arc_read_locked(), internal_dispatch_ecc(), priv_ra8_flash_internal_wait_mrdy(), ra8_flash_config_set_write(), ra8_flash_dispatch_isr(), ra8_flash_get_ecc_error_addr(), ra8_flash_get_extended_status(), ra8_flash_get_program_error_addr(), ra8_flash_get_startup_area(), ra8_flash_init(), ra8_flash_status(), and ra8_flash_update_clock_freq().
|
inlinestatic |
Pointer to a byte-wide MRMS register at offset off.
| [in] | off | Byte offset into the MRMS window. |
Definition at line 735 of file ra8_flash_regs.h.
References k_ra8_mram_base_addr.
Referenced by internal_arc_cmd(), internal_dispatch_ecc(), internal_irq_rmw8(), internal_set_hsp_mode(), internal_wait_buffer_ready(), internal_wait_commit_done(), priv_ra8_flash_internal_set_prefetch(), ra8_flash_clear_status(), ra8_flash_deinit(), ra8_flash_dispatch_isr(), ra8_flash_force_stop(), ra8_flash_get_extended_status(), ra8_flash_get_status(), ra8_flash_init(), ra8_flash_set_irq_enable(), ra8_flash_set_update_transfer(), ra8_flash_status(), ra8_flash_write_block(), and ra8_flash_zeroize_huk().