ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_register_protection.h
Go to the documentation of this file.
1
34
35#pragma once
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41#include "ra8_system_regs.h"
42
65static inline uint32_t ra8_prot_scope_begin(uint16_t unlock_val)
66{
67 *ra8_sys_prcr() = unlock_val;
68 return 1U;
69}
70
90static inline uint32_t ra8_prot_scope_end(void)
91{
93 return 0U;
94}
95
111#define RA8_PROTECTED_WRITE(unlock_val) \
112 for (uint32_t ra8_prot_once_ = ra8_prot_scope_begin((uint16_t)(unlock_val)); \
113 ra8_prot_once_ != 0U; \
114 ra8_prot_once_ = ra8_prot_scope_end())
115
116#ifdef __cplusplus
117}
118#endif
static uint32_t ra8_prot_scope_begin(uint16_t unlock_val)
Open a scoped PRCR unlock: write unlock_val, return the loop flag.
static uint32_t ra8_prot_scope_end(void)
Close a scoped PRCR unlock: re-lock every group, return the exit flag.
System Control (SYSC) register layout for the Renesas RA8D2.
static void ra8_sys_prcr_lock_all(void)
Re-lock every protection group (write password with all group bits clear).
static volatile uint16_t * ra8_sys_prcr(void)
Get pointer to the 16-bit PRCR register.