ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_flash_internal.h
Go to the documentation of this file.
1
15
16#pragma once
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22#include <stdint.h>
23
24#include "ra8_attributes.h"
25#include "ra8_err.h"
26#include "ra8_flash.h"
27
28/* =============================================================================
29 * Cross-TU shared state + constants (split across ra8_flash*.c)
30 *
31 * The ra8_flash driver is split into several translation units that all
32 * compile into libra_hal. The runtime state struct, its single
33 * definition, the module log tag, and the constant blocks referenced by
34 * more than one of those TUs live here so every TU sees one declaration.
35 * =============================================================================
36 */
37
54typedef struct {
56 void* user_ctx;
59 uintptr_t win_low;
60 uintptr_t win_high;
62
76
87extern const char* g_flash_tag;
88
112
129
148
166
184
205
231RA8_PRIV bool priv_ra8_flash_internal_window_allows(uintptr_t addr, uint32_t len);
232
270 uint32_t len,
271 uintptr_t win_low,
272 uintptr_t win_high);
273
303
333
334#if defined(RA8_OFF_TARGET) && defined(UNIT_TEST)
347typedef enum : uint32_t {
348 k_ra8_flash_maci_log_cap = 32U,
349} ra8_flash_maci_log_const_t;
350
367extern uint8_t g_ra8_flash_maci_cmd8_log[k_ra8_flash_maci_log_cap];
368
380extern uint32_t g_ra8_flash_maci_cmd8_len;
381
393extern uint16_t g_ra8_flash_maci_cmd16_log[k_ra8_flash_maci_log_cap];
394
406extern uint32_t g_ra8_flash_maci_cmd16_len;
407
425void ra8_flash_internal_maci_log_reset(void);
426#endif /* RA8_OFF_TARGET && UNIT_TEST */
427
428#ifdef __cplusplus
429}
430#endif
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
ra8_flash_runtime_t g_flash_rt
Single shared ra8_flash runtime-state instance.
Definition ra8_flash.c:67
const char * g_flash_tag
Shared log tag string for the ra8_flash module.
Definition ra8_flash.c:50
Code MRAM + Extra MRAM + Option-Setting driver – DANGEROUS, brick-capable.
bool priv_ra8_flash_internal_window_allows_pure(uintptr_t addr, uint32_t len, uintptr_t win_low, uintptr_t win_high)
Pure (state-free) reimplementation of internal_window_allows.
Definition ra8_flash.c:544
void priv_ra8_flash_internal_maci_cmd8(uint8_t byte)
Send a single byte through the MACI command-issuing area.
Definition ra8_flash.c:341
void priv_ra8_flash_internal_set_prefetch(bool enable)
Set MRCPFB.MPFBEN to enable/disable the prefetch buffer.
Definition ra8_flash.c:296
ra8_err_t priv_ra8_flash_internal_wait_mrdy(uint32_t limit)
Spin until MSTATR.MRDY rises or limit elapses.
Definition ra8_flash.c:203
ra8_err_t priv_ra8_flash_internal_wait_buffer_ready_call(uint32_t limit)
Direct-call test access to internal_wait_buffer_ready.
Definition ra8_flash.c:124
bool priv_ra8_flash_internal_window_allows(uintptr_t addr, uint32_t len)
Test whether [addr, addr+len) lies inside the soft window.
Definition ra8_flash.c:588
void priv_ra8_flash_internal_maci_cmd16(uint16_t half)
Send a halfword through the MACI command-issuing area.
Definition ra8_flash.c:369
ra8_err_t priv_ra8_flash_internal_wait_commit_done_call(uint32_t limit)
Direct-call test access to internal_wait_commit_done.
Definition ra8_flash.c:179
ra8_flash_key_t
KEY-byte shifts and codes that gate writes (cross-TU).
@ k_ra8_flash_mrefreq_key
RA8 flash mrefreq key.
@ k_ra8_flash_mrcfreq_key
RA8 flash mrcfreq key.
@ k_ra8_flash_freq_key_shift
KEY[7:0] @ [31:24] in MRCFREQ/MREFREQ.
ra8_flash_const_t
Bounds on configuration values + spin limits (cross-TU).
@ k_ra8_flash_pe_spin_limit
P/E entry spin limit.
@ k_ra8_flash_max_mrcfreq_mhz
MRCMHZ <= 250.
@ k_ra8_flash_max_list_select
MCTRLSR.LIST max value.
@ k_ra8_flash_maci_spin_limit
MACI command spin limit.
@ k_ra8_flash_zeroize_spin
W-HUK zeroize spin.
@ k_ra8_flash_max_mrefreq_mhz
MREMHZ <= 125.
@ k_ra8_flash_busy_spin_limit
Direct-write busy spin.
void(* ra8_flash_callback_t)(const ra8_flash_isr_event_t *ev)
Callback signature for the unified flash IRQ dispatcher.
File-scope runtime state shared across the ra8_flash TUs.
void * user_ctx
Caller pointer passed to cb.
uintptr_t win_low
Soft access-window low (incl).
bool initialized
True after ra8_flash_init.
uintptr_t win_high
Soft access-window high (excl).
ra8_flash_callback_t cb
Registered IRQ callback (or NULL).
bool prefetch_on
Last-known MRCPFB state.