|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Module Stop Control (MSTP) register layout for the Renesas RA8D2. More...
#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | r_mstp_regs_t |
| Memory layout of the Module Stop Control Register block. More... | |
Enumerations | |
| enum | ra8_mstp_addr_t : uintptr_t { k_ra8_mstp_base_addr = 0x40203000UL } |
| enum | ra8_mstp_block_size_t : uint8_t { k_ra8_mstp_block_bytes = 20U } |
| Expected byte size of the MSTP register block. More... | |
| enum | ra8_mstp_reg_t : uint8_t { k_ra8_mstp_reg_a = 0U , k_ra8_mstp_reg_b = 1U , k_ra8_mstp_reg_c = 2U , k_ra8_mstp_reg_d = 3U , k_ra8_mstp_reg_e = 4U } |
| Which of MSTPCRA..MSTPCRE owns the bit. More... | |
| enum | ra8_mstp_t : uint16_t { k_ra8_mstp_sram0 = (uint16_t)(k_ra8_mstp_reg_a << 8) , k_ra8_mstp_sram1 = (uint16_t)((k_ra8_mstp_reg_a << 8) | 1U) , k_ra8_mstp_sram2 = (uint16_t)((k_ra8_mstp_reg_a << 8) | 2U) , k_ra8_mstp_sram3 = (uint16_t)((k_ra8_mstp_reg_a << 8) | 3U) , k_ra8_mstp_dmac0_dtc0 , k_ra8_mstp_dmac1_dtc1 , k_ra8_mstp_i3c = (uint16_t)((k_ra8_mstp_reg_b << 8) | 4U) , k_ra8_mstp_iic2 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 7U) , k_ra8_mstp_iic1 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 8U) , k_ra8_mstp_iic0 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 9U) , k_ra8_mstp_usbfs = (uint16_t)((k_ra8_mstp_reg_b << 8) | 11U) , k_ra8_mstp_usbhs = (uint16_t)((k_ra8_mstp_reg_b << 8) | 12U) , k_ra8_mstp_ospi0 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 16U) , k_ra8_mstp_ospi1 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 17U) , k_ra8_mstp_spi1 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 18U) , k_ra8_mstp_spi0 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 19U) , k_ra8_mstp_sci9 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 22U) , k_ra8_mstp_sci8 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 23U) , k_ra8_mstp_sci7 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 24U) , k_ra8_mstp_sci6 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 25U) , k_ra8_mstp_sci5 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 26U) , k_ra8_mstp_sci4 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 27U) , k_ra8_mstp_sci3 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 28U) , k_ra8_mstp_sci2 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 29U) , k_ra8_mstp_sci1 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 30U) , k_ra8_mstp_sci0 = (uint16_t)((k_ra8_mstp_reg_b << 8) | 31U) , k_ra8_mstp_cac = (uint16_t)(k_ra8_mstp_reg_c << 8) , k_ra8_mstp_crc = (uint16_t)((k_ra8_mstp_reg_c << 8) | 1U) , k_ra8_mstp_glcdc = (uint16_t)((k_ra8_mstp_reg_c << 8) | 4U) , k_ra8_mstp_drw = (uint16_t)((k_ra8_mstp_reg_c << 8) | 6U) , k_ra8_mstp_ssie1 = (uint16_t)((k_ra8_mstp_reg_c << 8) | 7U) , k_ra8_mstp_ssie0 = (uint16_t)((k_ra8_mstp_reg_c << 8) | 8U) , k_ra8_mstp_mipi_dsi = (uint16_t)((k_ra8_mstp_reg_c << 8) | 10U) , k_ra8_mstp_sdhi1 = (uint16_t)((k_ra8_mstp_reg_c << 8) | 11U) , k_ra8_mstp_sdhi0 = (uint16_t)((k_ra8_mstp_reg_c << 8) | 12U) , k_ra8_mstp_doc = (uint16_t)((k_ra8_mstp_reg_c << 8) | 13U) , k_ra8_mstp_elc = (uint16_t)((k_ra8_mstp_reg_c << 8) | 14U) , k_ra8_mstp_ceu = (uint16_t)((k_ra8_mstp_reg_c << 8) | 16U) , k_ra8_mstp_mipi_csi = (uint16_t)((k_ra8_mstp_reg_c << 8) | 17U) , k_ra8_mstp_pdmif = (uint16_t)((k_ra8_mstp_reg_c << 8) | 24U) , k_ra8_mstp_canfd1 = (uint16_t)((k_ra8_mstp_reg_c << 8) | 26U) , k_ra8_mstp_canfd0 = (uint16_t)((k_ra8_mstp_reg_c << 8) | 27U) , k_ra8_mstp_ethphyclk = (uint16_t)((k_ra8_mstp_reg_c << 8) | 28U) , k_ra8_mstp_eswm = (uint16_t)((k_ra8_mstp_reg_c << 8) | 30U) , k_ra8_mstp_rsip = (uint16_t)((k_ra8_mstp_reg_c << 8) | 31U) , k_ra8_mstp_agt1 = (uint16_t)((k_ra8_mstp_reg_d << 8) | 4U) , k_ra8_mstp_agt0 = (uint16_t)((k_ra8_mstp_reg_d << 8) | 5U) , k_ra8_mstp_pdg = (uint16_t)((k_ra8_mstp_reg_d << 8) | 6U) , k_ra8_mstp_poeg_d = (uint16_t)((k_ra8_mstp_reg_d << 8) | 11U) , k_ra8_mstp_poeg_c = (uint16_t)((k_ra8_mstp_reg_d << 8) | 12U) , k_ra8_mstp_poeg_b = (uint16_t)((k_ra8_mstp_reg_d << 8) | 13U) , k_ra8_mstp_poeg_a = (uint16_t)((k_ra8_mstp_reg_d << 8) | 14U) , k_ra8_mstp_dac12_1 = (uint16_t)((k_ra8_mstp_reg_d << 8) | 19U) , k_ra8_mstp_dac12_0 = (uint16_t)((k_ra8_mstp_reg_d << 8) | 20U) , k_ra8_mstp_adc16h = (uint16_t)((k_ra8_mstp_reg_d << 8) | 21U) , k_ra8_mstp_tsn = (uint16_t)((k_ra8_mstp_reg_d << 8) | 22U) , k_ra8_mstp_acmphs3 = (uint16_t)((k_ra8_mstp_reg_d << 8) | 25U) , k_ra8_mstp_acmphs2 = (uint16_t)((k_ra8_mstp_reg_d << 8) | 26U) , k_ra8_mstp_acmphs1 = (uint16_t)((k_ra8_mstp_reg_d << 8) | 27U) , k_ra8_mstp_acmphs0 = (uint16_t)((k_ra8_mstp_reg_d << 8) | 28U) , k_ra8_mstp_ulpt1 = (uint16_t)((k_ra8_mstp_reg_e << 8) | 8U) , k_ra8_mstp_ulpt0 = (uint16_t)((k_ra8_mstp_reg_e << 8) | 9U) , k_ra8_mstp_gpt13 = (uint16_t)((k_ra8_mstp_reg_e << 8) | 18U) , k_ra8_mstp_gpt12 = (uint16_t)((k_ra8_mstp_reg_e << 8) | 19U) , k_ra8_mstp_gpt11 = (uint16_t)((k_ra8_mstp_reg_e << 8) | 20U) , k_ra8_mstp_gpt10 = (uint16_t)((k_ra8_mstp_reg_e << 8) | 21U) , k_ra8_mstp_gpt4_9 = (uint16_t)((k_ra8_mstp_reg_e << 8) | 27U) , k_ra8_mstp_gpt3 = (uint16_t)((k_ra8_mstp_reg_e << 8) | 28U) , k_ra8_mstp_gpt2 = (uint16_t)((k_ra8_mstp_reg_e << 8) | 29U) , k_ra8_mstp_gpt1 = (uint16_t)((k_ra8_mstp_reg_e << 8) | 30U) , k_ra8_mstp_gpt0 = (uint16_t)((k_ra8_mstp_reg_e << 8) | 31U) } |
| Packed (reg << 8) | bit module-stop identifier. More... | |
Functions | |
| static volatile r_mstp_regs_t * | ra8_mstp (void) |
| Get pointer to the MSTP register block. | |
| ra8_mstp_reg_t | ra8_mstp_id_reg (ra8_mstp_t id) |
| Extract the register index from a packed MSTP id. | |
| uint8_t | ra8_mstp_id_bit (ra8_mstp_t id) |
| Extract the bit number from a packed MSTP id. | |
Module Stop Control (MSTP) register layout for the Renesas RA8D2.
Every RA-family peripheral has a Module Stop bit. When that bit is 1 the peripheral is clock-gated off and does not respond to bus accesses. Module Stop Control Registers A..E (MSTPCRA..MSTPCRE) at 0x40203000 (Secure alias) hold 32 bits each, one bit per peripheral. The Non-Secure alias is at 0x50203000 and is referenced once TrustZone is wired up.
The exact MSTP bit for each peripheral is documented in HUM Chapter 11 "Low Power Mode", sections 11.2.6..11.2.10 (MSTPCRA..E). Bit assignments here are taken from the per-register tables on pages 443..450 (Rev. 1.30) and cited inline.
Drivers must NOT write these registers directly. The substrate file libs/ra8_hal/src/ra8_mstp.c exposes a ref-counted ra8_mstp_enable(id) / ra8_mstp_disable(id) pair that tracks shared modules (DMAC + DTC, RSIP + TRNG, etc.) so two unrelated drivers can both request the same MSTP bit without trampling each other.
ra8_mstp_t is a 16-bit value packed as (reg << 8) | bit:
Names in the enum follow the canonical "MSTP target module" column from the HUM tables, prefixed with k_ra8_mstp_.
Definition in file ra8_mstp_regs.h.
| enum ra8_mstp_addr_t : uintptr_t |
| Enumerator | |
|---|---|
| k_ra8_mstp_base_addr | R_MSTP block base. (anon). |
Definition at line 67 of file ra8_mstp_regs.h.
| enum ra8_mstp_block_size_t : uint8_t |
Expected byte size of the MSTP register block.
| Enumerator | |
|---|---|
| k_ra8_mstp_block_bytes | 5 x uint32_t = 20 bytes. |
Definition at line 96 of file ra8_mstp_regs.h.
| enum ra8_mstp_reg_t : uint8_t |
Which of MSTPCRA..MSTPCRE owns the bit.
| Enumerator | |
|---|---|
| k_ra8_mstp_reg_a | RA8 mstp register a. |
| k_ra8_mstp_reg_b | RA8 mstp register b. |
| k_ra8_mstp_reg_c | RA8 mstp register c. |
| k_ra8_mstp_reg_d | RA8 mstp register d. |
| k_ra8_mstp_reg_e | RA8 mstp register e. |
Definition at line 118 of file ra8_mstp_regs.h.
| enum ra8_mstp_t : uint16_t |
Packed (reg << 8) | bit module-stop identifier.
Every peripheral the firmware can ungate has an entry below. Each value packs the (MSTPCR register, bit) pair from HUM Ch 11.2.6..10 into a single uint16_t. Drivers feed these into ra8_mstp_enable(id) / ra8_mstp_disable(id), never write the register directly.
Bit numbering matches the manual exactly (0-based from the LSB), which is also what the 32-bit registers expect.
Definition at line 140 of file ra8_mstp_regs.h.
|
inlinestatic |
Get pointer to the MSTP register block.
Definition at line 104 of file ra8_mstp_regs.h.
References k_ra8_mstp_base_addr.
Referenced by internal_mipi_phy_mstp_unstop(), internal_reg_ptr(), ra8_cgc_usbfs_clock_enable(), and ra8_cgc_usbhs_pll_enable().
| uint8_t ra8_mstp_id_bit | ( | ra8_mstp_t | id | ) |
Extract the bit number from a packed MSTP id.
| [in] | id | Packed id. |
Defined in libs/ra8_hal/src/ra8_mstp.c.
| k_ra8_ok | Operation succeeded. |
Definition at line 139 of file ra8_mstp.c.
References k_ra8_mask_byte.
Referenced by internal_decode().
| ra8_mstp_reg_t ra8_mstp_id_reg | ( | ra8_mstp_t | id | ) |
Extract the register index from a packed MSTP id.
| [in] | id | Packed id. |
Real (non-inline) function so coverage tooling can attribute line counts to a single defining translation unit. The body is in libs/ra8_hal/src/ra8_mstp.c.
| k_ra8_ok | Operation succeeded. |
Definition at line 134 of file ra8_mstp.c.
References k_ra8_bits_per_byte, and k_ra8_mask_byte.
Referenced by internal_decode().