ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_lpm_safe_boot.h
Go to the documentation of this file.
1
38
39#pragma once
40
41#include <stdint.h>
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
59
82
96
124[[gnu::always_inline]] static inline void ra8_lpm_safe_boot(void)
125{
126#ifndef RA8_OFF_TARGET
127 /* SYSC.PRCR (16-bit, write-protect key) */
128 volatile uint16_t* const prcr = (volatile uint16_t*)k_ra8_lpm_safe_boot_prcr_addr;
129 /* SBYCR (8-bit) -- Standby Control Register */
130 volatile uint8_t* const sbycr = (volatile uint8_t*)k_ra8_lpm_safe_boot_sbycr_addr;
131 /* LPSCR (8-bit) -- Low Power State Control Register */
132 volatile uint8_t* const lpscr = (volatile uint8_t*)k_ra8_lpm_safe_boot_lpscr_addr;
133 /* DPSBYCR (8-bit) -- Deep Software Standby Ctrl */
134 volatile uint8_t* const dpsbycr = (volatile uint8_t*)k_ra8_lpm_safe_boot_dpsbycr_addr;
135
136 *prcr = (uint16_t)k_ra8_lpm_safe_boot_prcr_unlock;
137 *lpscr = (uint8_t)k_ra8_lpm_safe_boot_lpscr_sleep;
138 *sbycr = (uint8_t)k_ra8_lpm_safe_boot_sbycr_reset;
139 *dpsbycr = (uint8_t)k_ra8_lpm_safe_boot_dpsbycr_reset;
140 *prcr = (uint16_t)k_ra8_lpm_safe_boot_prcr_relock;
141#endif /* RA8_OFF_TARGET */
142}
143
144#ifdef __cplusplus
145}
146#endif
static void ra8_lpm_safe_boot(void)
Restore LPSCR / SBYCR / DPSBYCR to cold-reset values.
ra8_lpm_safe_boot_addr_t
Absolute addresses of the four SYSC LPM registers this restores.
@ k_ra8_lpm_safe_boot_sbycr_addr
SYSC.SBYCR, 8-bit.
@ k_ra8_lpm_safe_boot_dpsbycr_addr
SYSC.DPSBYCR, 8-bit.
@ k_ra8_lpm_safe_boot_prcr_addr
SYSC.PRCR, 16-bit.
@ k_ra8_lpm_safe_boot_lpscr_addr
SYSC.LPSCR, 8-bit.
ra8_lpm_safe_boot_val_t
Cold-reset values for LPSCR / SBYCR / DPSBYCR.
@ k_ra8_lpm_safe_boot_lpscr_sleep
LPMD = Sleep mode.
@ k_ra8_lpm_safe_boot_dpsbycr_reset
DCSSMODE = 01b.
@ k_ra8_lpm_safe_boot_sbycr_reset
OPE = 1, rest 0.
ra8_lpm_safe_boot_prcr_t
PRCR keyed values used by ra8_lpm_safe_boot.
@ k_ra8_lpm_safe_boot_prcr_unlock
Key + PRC1 = 1.
@ k_ra8_lpm_safe_boot_prcr_relock
Key only, PRC1 = 0.