ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_nsc_periph_init.c File Reference

NSC veneer: secure peripheral substrate bring-up. More...

#include <stdint.h>
#include "ra8_attributes.h"
#include "ra8_dma.h"
#include "ra8_err.h"
#include "ra8_isr.h"
#include "ra8_log.h"
#include "ra8_mstp.h"
#include "ra8_nsc.h"
#include "ra8_nsc_veneer.h"
#include "ra8_pwr.h"
Include dependency graph for ra8_nsc_periph_init.c:

Go to the source code of this file.

Functions

ra8_err_t ra8_nsc_periph_init (void)
 NSC veneer: bring up the secure-side peripheral substrate.

Variables

static const char * s_tag = "NSCPRH"
static bool s_initialized = false

Detailed Description

NSC veneer: secure peripheral substrate bring-up.

Tag
[Ring 4 / NSC] {World: NSC}

scaffold. Runs the substrate init dance that the NS world cannot do because the MSTP / CGC / ICU register windows live in the secure region partitioning.

The function is idempotent: callers can fire it more than once and get k_ra8_ok for every call after the first.

Definition in file ra8_nsc_periph_init.c.

Function Documentation

◆ ra8_nsc_periph_init()

ra8_err_t ra8_nsc_periph_init ( void )
nodiscard

NSC veneer: bring up the secure-side peripheral substrate.

Sequences the four substrate init calls that the Non-Secure world cannot perform because the MSTP / CGC / ICU / DMA register windows live in the secure region partitioning: ra8_mstp_init -> ra8_pwr_init -> ra8_isr_init -> ra8_dma_init.

The function is idempotent: subsequent calls return k_ra8_ok without redoing the work. On failure the latched s_initialized flag stays false so a future call may retry from scratch.

Returns
ra8_err_t outcome.
Return values
k_ra8_okSubstrate up (or already up).
k_ra8_err_hw_init_failedOne of the secure init steps failed.
Precondition
Reset vector has handed over to the firmware.
TrustZone SAU has been programmed (single-world or NS region carved).
Postcondition
On success the secure peripheral substrate is fully up.
On failure the substrate is in an indeterminate partial state; the caller may retry.
TrustZone:
NS->S boundary via cmse_nonsecure_entry. Argument-less, scalar return – nothing crosses the boundary that needs range-checking.
Note
Thread-safe: no – intended to be called once at boot.
Since
0.1.0

Definition at line 112 of file ra8_nsc_periph_init.c.

References k_ra8_err_hw_init_failed, k_ra8_ok, ra8_board_uart_console_init(), ra8_dma_init(), ra8_isr_init(), ra8_log_error_val, ra8_log_info, ra8_log_set_byte_sink(), ra8_mstp_init(), RA8_NSC_VENEER, ra8_pwr_init(), s_initialized, and s_tag.

Referenced by ns_reset_handler().

Variable Documentation

◆ s_initialized

bool s_initialized = false
static

Definition at line 42 of file ra8_nsc_periph_init.c.

◆ s_tag

const char* s_tag = "NSCPRH"
static

Definition at line 40 of file ra8_nsc_periph_init.c.