|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
MRAM configuration-set, ARC counters + extra-MRAM programming – DANGEROUS. More...
#include <stdint.h>#include "ra8_attributes.h"#include "ra8_check.h"#include "ra8_err.h"#include "ra8_flash.h"#include "ra8_flash_internal.h"#include "ra8_flash_regs.h"#include "ra8_hw_err.h"#include "ra8_log.h"Go to the source code of this file.
Enumerations | |
| enum | flash_const_t : uint32_t { k_flash_bits_to_words_shift = 5U , k_flash_blank_byte = 0xFFU } |
| ARC bit-to-word shift and blank-flash fill byte. More... | |
| enum | ra8_flash_cfg_word_const_t : uint16_t { k_ra8_flash_cfg_word_all_ones = 0xFFFFU , k_ra8_flash_btflg_default = 0x8000U , k_ra8_flash_btflg_alternate = 0x0000U , k_ra8_flash_btflg_word_keep = 0x1FFFU } |
| Bit patterns for the configuration-set word vector. More... | |
Functions | |
| static uint8_t | internal_arc_to_mcntselr (ra8_flash_arc_id_t id) |
| Translate logical ARC id to MCNTSELR field value. | |
| static uint32_t | internal_arc_max_count (ra8_flash_arc_id_t id) |
| Compute the maximum count for an ARC id. | |
| static uint32_t | internal_popcount32 (uint32_t x) |
| Pop-count helper for 32-bit words used by the ARC reader. | |
| ra8_err_t | ra8_flash_set_startup_area (ra8_flash_startup_t target, bool temporary) |
| Switch the start-up area between default and alternate banks. | |
| ra8_err_t | ra8_flash_get_startup_area (uint8_t *out_btflg, uint8_t *out_fspr) |
| Read the current start-up area selection. | |
| ra8_err_t | ra8_flash_config_set_write (uint32_t target_addr, const uint16_t *words) |
| Issue an 8-halfword MACI program command to the OFS or extra-MRAM area. | |
| static ra8_err_t | internal_arc_cmd (uint8_t mcntselr, uint8_t cmd) |
| Issue a single MACI counter command (read or increment). | |
| static uint32_t | internal_arc_nsec_count (ra8_flash_arc_id_t id) |
| Sum the population count of one of the four ARC_NSEC slots. | |
| static ra8_err_t | internal_arc_read_locked (ra8_flash_arc_id_t id, uint32_t *out_count) |
| ra8_err_t | ra8_flash_arc_increment (ra8_flash_arc_id_t counter) |
| Increment the selected anti-rollback counter. | |
| ra8_err_t | ra8_flash_arc_read (ra8_flash_arc_id_t counter, uint32_t *out_count) |
| Read the current value of an anti-rollback counter. | |
| ra8_err_t | ra8_flash_zeroize_huk (void) |
| Trigger the W-HUK zeroize via MREZC. | |
| ra8_err_t | ra8_flash_set_security_attribution (uint16_t new_msar) |
| Update MSAR (MRAM Security Attribution). | |
| ra8_err_t | ra8_flash_msuinitr_kick (void) |
| Kick MSUINITR to re-load the OFS sequencer. | |
| ra8_err_t | ra8_flash_set_ecc_encoder_enable (bool enable) |
| Toggle MRCEECC.ECCEN (program-side ECC encoder). | |
| ra8_err_t | ra8_flash_set_ecc_decoder_enable (bool enable) |
| Toggle MRCDECC.DECECEN (read-side ECC decoder). | |
| ra8_err_t | ra8_flash_get_ecc_error_addr (uint32_t *out_code_ted, uint32_t *out_code_dec, uint32_t *out_extra_ted, uint32_t *out_extra_dec) |
| Snapshot the latched ECC fault addresses. | |
| ra8_err_t | ra8_flash_get_program_error_addr (uint32_t *out_addr) |
| Snapshot the program-error address (MRCPEA). | |
| ra8_err_t | ra8_flash_update_clock_freq (uint16_t mrcfreq_mhz, uint8_t mrefreq_mhz) |
| Re-issue the keyed MRCFREQ / MREFREQ to track a clock change. | |
| ra8_err_t | ra8_flash_set_update_transfer (uint8_t list_select) |
| Trigger the MRAM update transfer (MCTRCNTR). | |
| ra8_err_t | ra8_flash_get_update_status (uint8_t *out_busy, uint8_t *out_done, uint8_t *out_err) |
| Poll the MRAM update-transfer status. | |
| static void | internal_pack_config_words (const uint8_t *src, uint32_t len, uint32_t done, uint16_t words[k_ra8_mram_config_set_word_count]) |
| Pack one config-set's worth of source bytes into 8 halfwords. | |
| ra8_err_t | ra8_flash_extra_mram_write (uint32_t mram_addr, const uint8_t *src, uint32_t len) |
| Program 1..32 contiguous bytes into the general-purpose extra-MRAM window. | |
| ra8_err_t | ra8_flash_extra_mram_erase (uint32_t mram_addr) |
| Erase one 32-byte block of extra-MRAM via MACI. | |
MRAM configuration-set, ARC counters + extra-MRAM programming – DANGEROUS.
Configuration / data-programming aspect of the ra8_flash driver, split out of ra8_flash.c so every translation unit stays under the file-size cap. Implements the slice of the HUM Ch 7 + Ch 59 surface declared in ra8_flash.h:
Cross-TU shared runtime state, the shared constant blocks, and the promoted low-level MACI / prefetch / wait helpers live in ra8_flash_internal.h. Every register access carries a HUM Ch 7 or Ch 59 citation.
Definition in file ra8_flash_config.c.
| enum flash_const_t : uint32_t |
ARC bit-to-word shift and blank-flash fill byte.
| Enumerator | |
|---|---|
| k_flash_bits_to_words_shift | Divide a bit count by 32 -> words. |
| k_flash_blank_byte | Erased-flash fill byte. |
Definition at line 47 of file ra8_flash_config.c.
| enum ra8_flash_cfg_word_const_t : uint16_t |
Bit patterns for the configuration-set word vector.
HUM Ch 7 "Option-Setting Memory" p 278. The configuration-set vector is written as a sequence of 16-bit words; we OR in only the bits we want to drive low, keeping the remaining bits as 1 to preserve unused fields.
Definition at line 62 of file ra8_flash_config.c.
|
static |
Issue a single MACI counter command (read or increment).
| [in] | mcntselr | MCNTSELR field value. |
| [in] | cmd | MACI opcode. |
See the matching header declaration for the full contract; this site adds no behaviour beyond what the public API documents.
| k_ra8_ok | Success path. |
| k_ra8_err_invalid_arg | Caller violated a precondition. |
Definition at line 327 of file ra8_flash_config.c.
References k_ra8_err_hw_error, k_ra8_flash_maci_spin_limit, k_ra8_maci_cmd_final, k_ra8_mastat_mask_cmdlk, k_ra8_mcntselr_mask, k_ra8_mram_off_mastat, k_ra8_mram_off_mcntselr, k_ra8_ok, priv_ra8_flash_internal_maci_cmd8(), priv_ra8_flash_internal_wait_mrdy(), RA8_INTERNAL, and ra8_mram_reg8().
Referenced by internal_arc_read_locked(), and ra8_flash_arc_increment().
|
static |
Compute the maximum count for an ARC id.
| [in] | id | Logical counter id. |
See the matching header declaration for the full contract; this site adds no behaviour beyond what the public API documents.
| k_ra8_ok | Success path. |
| k_ra8_err_invalid_arg | Caller violated a precondition. |
Definition at line 133 of file ra8_flash_config.c.
References k_ra8_arc_arccs_mask, k_ra8_arc_arcns_single, k_ra8_arc_nsec_multiple, k_ra8_arc_nsec_single, k_ra8_arc_oembl_max_bits, k_ra8_arc_sec_max_bits, k_ra8_flash_arc_oembl, k_ra8_flash_arc_sec, k_ra8_flash_ofs_arccs_addr, and RA8_INTERNAL.
Referenced by ra8_flash_arc_increment().
|
static |
Sum the population count of one of the four ARC_NSEC slots.
HUM Ch 7.2.21 "ARCCS" p 296 + HUM Ch 7.2.23 "ARC_NSEC" p 297. The ARCNS field selects between a single 16-word counter or four 2-word counters. id selects which sub-counter to sum.
| [in] | id | One of k_ra8_flash_arc_nsec_0..3. |
| k_ra8_ok | Success path. |
| k_ra8_err_invalid_arg | Caller violated a precondition. |
Definition at line 368 of file ra8_flash_config.c.
References internal_popcount32(), k_ra8_arc_arccs_mask, k_ra8_arc_arcns_single, k_ra8_flash_arc_nsec_0, k_ra8_flash_arc_nsec_1, k_ra8_flash_arc_nsec_2, k_ra8_flash_ofs_arc_nsec_addr, k_ra8_flash_ofs_arccs_addr, k_ra8_mram_arc_max_words, and RA8_INTERNAL.
Referenced by internal_arc_read_locked().
|
static |
Definition at line 397 of file ra8_flash_config.c.
References internal_arc_cmd(), internal_arc_nsec_count(), internal_arc_to_mcntselr(), internal_popcount32(), k_flash_bits_to_words_shift, k_ra8_arc_sec_max_bits, k_ra8_flash_arc_oembl, k_ra8_flash_arc_sec, k_ra8_flash_ofs_arc_sec_addr, k_ra8_maci_cmd_read_counter, k_ra8_mram_off_mcntdtr0, k_ra8_mram_off_mcntdtr1, k_ra8_ok, RA8_INTERNAL, and ra8_mram_reg32().
Referenced by ra8_flash_arc_increment(), and ra8_flash_arc_read().
|
static |
Translate logical ARC id to MCNTSELR field value.
| [in] | id | Logical counter id. |
See the matching header declaration for the full contract; this site adds no behaviour beyond what the public API documents.
| k_ra8_ok | Success path. |
| k_ra8_err_invalid_arg | Caller violated a precondition. |
Definition at line 93 of file ra8_flash_config.c.
References k_ra8_flash_arc_nsec_0, k_ra8_flash_arc_nsec_1, k_ra8_flash_arc_nsec_2, k_ra8_flash_arc_nsec_3, k_ra8_flash_arc_oembl, k_ra8_flash_arc_sec, k_ra8_mcntselr_nsec_0, k_ra8_mcntselr_oembl, k_ra8_mcntselr_sec, and RA8_INTERNAL.
Referenced by internal_arc_read_locked(), and ra8_flash_arc_increment().
|
static |
Pack one config-set's worth of source bytes into 8 halfwords.
Builds the k_ra8_mram_config_set_word_count-halfword payload for the config-set starting at byte offset done into src, packing two bytes per halfword (little-endian) and padding any byte at or beyond len with k_flash_blank_byte (0xFF). Extracted from ra8_flash_extra_mram_write so the multi-config-set loop stays under the complexity gate.
| [in] | src | Source buffer being programmed. |
| [in] | len | Total valid source length in bytes. |
| [in] | done | Byte offset of this config-set within src. |
| [out] | words | Receives the packed halfword payload. |
src and words are non-NULL. words holds k_ra8_mram_config_set_word_count entries. words[i] holds src[done+2i] in its low byte (0xFF past len). Definition at line 682 of file ra8_flash_config.c.
References k_flash_blank_byte, and k_ra8_mram_config_set_word_count.
Referenced by ra8_flash_extra_mram_write().
|
static |
Pop-count helper for 32-bit words used by the ARC reader.
| [in] | x | Input word. |
See the matching header declaration for the full contract; this site adds no behaviour beyond what the public API documents.
| k_ra8_ok | Success path. |
| k_ra8_err_invalid_arg | Caller violated a precondition. |
Definition at line 171 of file ra8_flash_config.c.
References RA8_INTERNAL.
Referenced by internal_arc_nsec_count(), and internal_arc_read_locked().
|
nodiscard |
Increment the selected anti-rollback counter.
Issues the MACI increment command (HUM Ch 7.2.21..23 p 296..297
| [in] | counter | Counter to increment. |
| k_ra8_ok | Counter incremented. |
| k_ra8_err_invalid_arg | counter out of range. |
| k_ra8_err_out_of_range | Counter already at its max value. |
| k_ra8_err_hw_error | MSTATR reported an error after the cmd. |
| k_ra8_err_hw_timeout | MACI never returned MRDY. |
Definition at line 432 of file ra8_flash_config.c.
References g_flash_rt, g_flash_tag, internal_arc_cmd(), internal_arc_max_count(), internal_arc_read_locked(), internal_arc_to_mcntselr(), k_ra8_err_invalid_arg, k_ra8_err_out_of_range, k_ra8_flash_arc_count, k_ra8_maci_cmd_increment_counter, k_ra8_ok, ra8_flash_enter_pe_mode(), ra8_flash_exit_pe_mode(), and RA8_VALIDATE_INIT.
|
nodiscard |
Read the current value of an anti-rollback counter.
Returns the population count of the ARC bit-vector. ARC_OEMBL goes through the MACI read counter command (HUM Ch 59 p 3589); the other counters are memory-mapped reads of MCNTDTR0/1 or the extra-MRAM ARC region (HUM Ch 7.2.22..23 p 296..297).
| [in] | counter | Counter to read. |
| [out] | out_count | Non-NULL destination for the count value. |
| k_ra8_ok | Counter read. |
| k_ra8_err_null_ptr | out_count was NULL. |
| k_ra8_err_invalid_arg | counter out of range. |
| k_ra8_err_hw_timeout | MACI never returned MRDY (OEMBL only). |
Definition at line 467 of file ra8_flash_config.c.
References g_flash_rt, g_flash_tag, internal_arc_read_locked(), k_ra8_err_invalid_arg, k_ra8_flash_arc_count, k_ra8_flash_arc_oembl, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_flash_enter_pe_mode(), ra8_flash_exit_pe_mode(), and RA8_VALIDATE_INIT.
|
nodiscard |
Issue an 8-halfword MACI program command to the OFS or extra-MRAM area.
Low-level primitive that streams <opener>, N, 8 halfwords, 0xD0 through the MACI command-issuing area at 0x4012_0000 and waits for MSTATR.MRDY. The opener opcode is chosen from target_addr's region so the HARDWARE- correct command is issued:
| [in] | target_addr | OFS-window or extra-MRAM-window address to program. |
| [in] | words | Pointer to 8 halfwords. |
| k_ra8_ok | Write completed. |
| k_ra8_err_null_ptr | words was NULL. |
| k_ra8_err_invalid_arg | target_addr outside both windows. |
| k_ra8_err_hw_error | MSTATR reported an error. |
| k_ra8_err_hw_timeout | MACI never returned MRDY. |
Definition at line 247 of file ra8_flash_config.c.
References g_flash_tag, k_ra8_err_hw_error, k_ra8_err_invalid_arg, k_ra8_flash_extra_size, k_ra8_flash_extra_start, k_ra8_flash_maci_spin_limit, k_ra8_flash_ofs_size, k_ra8_flash_ofs_start, k_ra8_maci_cmd_config_set, k_ra8_maci_cmd_final, k_ra8_maci_cmd_program, k_ra8_maci_cmd_word_count_n, k_ra8_mram_config_set_word_count, k_ra8_mram_off_msaddr, k_ra8_mram_off_mstatr, k_ra8_mstatr_mask_any_err, k_ra8_ok, priv_ra8_flash_internal_maci_cmd16(), priv_ra8_flash_internal_maci_cmd8(), priv_ra8_flash_internal_wait_mrdy(), RA8_CHECK_NULL_PTR, and ra8_mram_reg32().
Referenced by ra8_flash_extra_mram_write(), and ra8_flash_set_startup_area().
|
nodiscard |
Erase one 32-byte block of extra-MRAM via MACI.
Equivalent to ra8_flash_extra_mram_write with a 32-byte payload of 0xFF.
| [in] | mram_addr | 32-byte aligned destination inside the extra-MRAM window. |
| k_ra8_ok | Block erased. |
| k_ra8_err_invalid_arg | Misaligned or out-of-range address. |
| k_ra8_err_hw_error | MSTATR error after the command. |
| k_ra8_err_hw_timeout | MACI never returned MRDY. |
Definition at line 751 of file ra8_flash_config.c.
References k_ra8_err_invalid_arg, k_ra8_mram_block_size_bytes, and ra8_flash_extra_mram_write().
Referenced by app_flash_erase(), app_write_bootsel(), and internal_mram_erase().
|
nodiscard |
Program 1..32 contiguous bytes into the general-purpose extra-MRAM window.
The extra-MRAM option-setting / OTP window ([k_ra8_flash_extra_start, +k_ra8_flash_extra_size), HUM Ch 59.7.4.5 Table 59.15 p 3592) is programmed through the MACI Program command rather than the direct STR gate. This API mirrors ra8_flash_write_block semantics: 1..32 bytes inside one page.
OTP-misuse guard (#397): this is the general-purpose write path, so it refuses any target at or above k_ra8_flash_extra_locked_start – the permanent, irreversible structures (PBPS, POFSPS, REVOKE, HUK-zeroize enable, anti-rollback). Programming those can brick the part or destroy the wrapped HUK, so they require the deliberate, separately-named ra8_flash_config_set_write. The general-purpose OTP sub-range (k_ra8_flash_gpotp_start, HUM Ch 7.2.25 p 299) is the intended target for ordinary callers. Note that the whole window is one-time-programmable on this silicon – there is no rewritable data-flash to erase and re-use.
| [in] | mram_addr | Destination inside the extra-MRAM window, below k_ra8_flash_extra_locked_start. |
| [in] | src | Non-NULL source buffer of at least len bytes. |
| [in] | len | 1..32. |
| k_ra8_ok | Bytes written. |
| k_ra8_err_null_ptr | src was NULL. |
| k_ra8_err_invalid_arg | Range / alignment violation, or the target is a permanent structure at/above the guard boundary. |
| k_ra8_err_hw_error | MSTATR error after the command. |
| k_ra8_err_hw_timeout | MACI never returned MRDY. |
Definition at line 695 of file ra8_flash_config.c.
References g_flash_tag, internal_pack_config_words(), k_ra8_err_invalid_arg, k_ra8_flash_extra_locked_start, k_ra8_flash_extra_start, k_ra8_mram_config_set_bytes, k_ra8_mram_config_set_word_count, k_ra8_mram_write_size_bytes, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_flash_config_set_write(), ra8_flash_enter_pe_mode(), and ra8_flash_exit_pe_mode().
Referenced by app_flash_program(), app_write_bootsel(), internal_devcfg_xm_write(), internal_mram_write(), and ra8_flash_extra_mram_erase().
|
nodiscard |
Snapshot the latched ECC fault addresses.
Reads MRCRTEA / MRCRDEA / MRERTEA / MRERDEA (HUM Ch 59 p 3555..3558). Each output gets its register value or 0 if no fault was latched since the last read-clear.
| [out] | out_code_ted | Non-NULL destination for MRCRTEA. |
| [out] | out_code_dec | Non-NULL destination for MRCRDEA. |
| [out] | out_extra_ted | Non-NULL destination for MRERTEA. |
| [out] | out_extra_dec | Non-NULL destination for MRERDEA. |
| k_ra8_ok | Addresses copied. |
| k_ra8_err_null_ptr | Any destination pointer was NULL. |
Definition at line 567 of file ra8_flash_config.c.
References g_flash_tag, k_ra8_mram_off_mrcrdea, k_ra8_mram_off_mrcrtea, k_ra8_mram_off_mrerdea, k_ra8_mram_off_mrertea, k_ra8_ok, RA8_CHECK_NULL_PTR, and ra8_mram_reg32().
|
nodiscard |
Snapshot the program-error address (MRCPEA).
| [out] | out_addr | Non-NULL destination for MRCPEA. |
| k_ra8_ok | Address copied. |
| k_ra8_err_null_ptr | out_addr was NULL. |
Definition at line 588 of file ra8_flash_config.c.
References g_flash_tag, k_ra8_mram_off_mrcpea, k_ra8_ok, RA8_CHECK_NULL_PTR, and ra8_mram_reg32().
|
nodiscard |
Read the current start-up area selection.
Returns the bit-shifted MSUASMON snapshot so callers can decide whether the part is currently booting from block 0 or 1, and whether the swap is permanent.
| [out] | out_btflg | Non-NULL destination for MSUASMON.BTFLG (0/1). |
| [out] | out_fspr | Non-NULL destination for MSUASMON.FSPR (0/1). |
| k_ra8_ok | Status copied. |
| k_ra8_err_null_ptr | Either output pointer was NULL. |
Definition at line 231 of file ra8_flash_config.c.
References g_flash_tag, k_ra8_mram_off_msuasmon, k_ra8_msuasmon_mask_btflg, k_ra8_msuasmon_mask_fspr, k_ra8_ok, RA8_CHECK_NULL_PTR, and ra8_mram_reg32().
|
nodiscard |
Poll the MRAM update-transfer status.
| [out] | out_busy | Non-NULL destination for MCTRSTATR.BUSY. |
| [out] | out_done | Non-NULL destination for MCTRSTATR.DONE. |
| [out] | out_err | Non-NULL destination for MCTRSTATR.ERR. |
| k_ra8_ok | Status copied. |
| k_ra8_err_null_ptr | Any destination pointer was NULL. |
Definition at line 636 of file ra8_flash_config.c.
References g_flash_tag, k_ra8_mctrstatr_mask_busy, k_ra8_mctrstatr_mask_done, k_ra8_mctrstatr_mask_err, k_ra8_mram_off_mctrstatr, k_ra8_ok, RA8_CHECK_NULL_PTR, and ra8_mram_reg16().
|
nodiscard |
Kick MSUINITR to re-load the OFS sequencer.
Writes the keyed value 0xA501 to MSUINITR (HUM Ch 59 p 3585) and waits for the SUINIT bit to fall. Used after a configuration-set write to make the controller pick up the new option-setting bytes without requiring a chip reset.
| k_ra8_ok | Re-init complete. |
| k_ra8_err_hw_timeout | SUINIT never cleared. |
Definition at line 518 of file ra8_flash_config.c.
References k_ra8_err_hw_timeout, k_ra8_flash_pe_spin_limit, k_ra8_mram_off_msuinitr, k_ra8_msuinitr_full_init, k_ra8_msuinitr_mask_suinit, k_ra8_ok, and ra8_mram_reg16().
|
nodiscard |
Toggle MRCDECC.DECECEN (read-side ECC decoder).
| [in] | enable | true => MRCDECC.DECECEN:= 1. |
| k_ra8_ok | Always. |
Definition at line 556 of file ra8_flash_config.c.
References k_ra8_mram_off_mrcdecc, k_ra8_mrcdecc_key_shift, k_ra8_mrcdecc_mask_dececen, k_ra8_ok, and ra8_mram_reg16().
|
nodiscard |
Toggle MRCEECC.ECCEN (program-side ECC encoder).
| [in] | enable | true => MRCEECC.ECCEN:= 1. |
| k_ra8_ok | Always. |
Definition at line 545 of file ra8_flash_config.c.
References k_ra8_mram_off_mrceecc, k_ra8_mrceecc_key_shift, k_ra8_mrceecc_mask_eccen, k_ra8_ok, and ra8_mram_reg16().
|
nodiscard |
Update MSAR (MRAM Security Attribution).
HUM Ch 59.5.13 p 3559. Each bit selects whether the matching register subset is reachable from the secure (1) or non-secure (0) world. new_msar is written verbatim; the caller is responsible for understanding the per-bit semantics in ra8_msar_mask_t.
| [in] | new_msar | Value to store. |
| k_ra8_ok | Always. |
Definition at line 511 of file ra8_flash_config.c.
References k_ra8_mram_off_msar, k_ra8_ok, and ra8_mram_reg16().
|
nodiscard |
Switch the start-up area between default and alternate banks.
HUM Ch 7 "Option-Setting Memory" p 278..299 documents the BTFLG boot-area swap. temporary=true writes MSUACR (KEY=0x66) and the swap takes effect immediately but is forgotten on reset. temporary=false issues a configuration-set MACI command to update BTFLG in extra-MRAM so the swap survives reset.
| [in] | target | k_ra8_flash_startup_default or _alternate. |
| [in] | temporary | true => MSUACR-only; false => BTFLG persistent. |
| k_ra8_ok | Swap applied. |
| k_ra8_err_invalid_arg | target out of range. |
| k_ra8_err_hw_error | Controller reported MSTATR error. |
| k_ra8_err_hw_timeout | MACI did not return MRDY in time. |
Definition at line 190 of file ra8_flash_config.c.
References k_ra8_err_invalid_arg, k_ra8_flash_btflg_alternate, k_ra8_flash_btflg_default, k_ra8_flash_btflg_word_keep, k_ra8_flash_cfg_word_all_ones, k_ra8_flash_startup_alternate, k_ra8_flash_startup_btflg, k_ra8_flash_startup_default, k_ra8_mram_config_set_word_count, k_ra8_mram_off_msuacr, k_ra8_msaddr_config_set_startup, k_ra8_msuacr_key, k_ra8_msuacr_swap_alternate, k_ra8_msuacr_swap_default, k_ra8_ok, ra8_flash_config_set_write(), ra8_flash_enter_pe_mode(), ra8_flash_exit_pe_mode(), and ra8_mram_reg16().
|
nodiscard |
Trigger the MRAM update transfer (MCTRCNTR).
Selects an MCTRLSR list, writes the keyed start to MCTRCNTR (HUM Ch 59 p 3580), and returns immediately. Use ra8_flash_get_update_status to poll for completion.
| [in] | list_select | Which list (0..15) to run. |
| k_ra8_ok | Transfer kicked. |
| k_ra8_err_invalid_arg | list_select > 15. |
Definition at line 623 of file ra8_flash_config.c.
References k_ra8_err_invalid_arg, k_ra8_flash_max_list_select, k_ra8_mctrcntr_key, k_ra8_mctrcntr_mask_start, k_ra8_mctrlsr_mask_list_sel, k_ra8_mram_off_mctrcntr, k_ra8_mram_off_mctrlsr, k_ra8_ok, ra8_mram_reg16(), and ra8_mram_reg8().
|
nodiscard |
Re-issue the keyed MRCFREQ / MREFREQ to track a clock change.
Disables prefetch, writes the new frequency notifications, then restores prefetch. Mirrors FSP R_MRAM_UpdateFlashClockFreq.
| [in] | mrcfreq_mhz | New code-MRAM clock in MHz, 0..0x0FA. |
| [in] | mrefreq_mhz | New extra-MRAM clock in MHz, 0..0x07D. |
| k_ra8_ok | Frequencies applied. |
| k_ra8_err_invalid_arg | Either value out of range. |
Definition at line 596 of file ra8_flash_config.c.
References g_flash_rt, k_ra8_err_invalid_arg, k_ra8_flash_freq_key_shift, k_ra8_flash_max_mrcfreq_mhz, k_ra8_flash_max_mrefreq_mhz, k_ra8_flash_mrcfreq_key, k_ra8_flash_mrefreq_key, k_ra8_mram_off_mrcfreq, k_ra8_mram_off_mrefreq, k_ra8_ok, priv_ra8_flash_internal_set_prefetch(), and ra8_mram_reg32().
|
nodiscard |
Trigger the W-HUK zeroize via MREZC.
Permanently destroys the wrapped HUK (HUM Ch 59 p 3565). The driver writes the keyed value 0x5501 to MREZC and waits for MREZS.WHUKEXE to fall.
| k_ra8_ok | Zeroization complete. |
| k_ra8_err_hw_timeout | WHUKEXE never cleared. |
Definition at line 495 of file ra8_flash_config.c.
References g_flash_rt, g_flash_tag, k_ra8_err_hw_timeout, k_ra8_flash_zeroize_spin, k_ra8_mram_off_mrezc, k_ra8_mram_off_mrezs, k_ra8_mrezc_full_zero, k_ra8_mrezs_mask_whukexe, k_ra8_ok, ra8_mram_reg16(), ra8_mram_reg8(), and RA8_VALIDATE_INIT.