|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
SPI_B register layout for the Renesas RA8D2. More...
Go to the source code of this file.
Data Structures | |
| struct | r_spi_regs_t |
| SPI_B register-window mirror (matches FSP R_SPI_B0_Type, 0x70 bytes). More... | |
Functions | |
| static volatile r_spi_regs_t * | ra8_spi (uint8_t channel) |
Get pointer to SPI_B channel channel (0..1). | |
SPI_B register layout for the Renesas RA8D2.
The RA8D2 has two channels of the SPI_B (Type-B SPI) peripheral. HUM Ch 43 "Serial Peripheral Interface (SPI)" (p 2877-2985) opens with the explicit note that "this is the SPI_B version of the SPI peripheral module" and that SPI_B is referred to as SPI in the chapter. The earlier (legacy) SPI block in ra8_spi_regs.h before this commit was modeled after the older 8/16-bit register stack (SPCR uint8_t, SPCMD[8] uint16_t, SPPCR/SPCKD/SSLND/SPND single-byte registers). That layout does not exist on RA8D2 – SPI_B uses a fully 32-bit register file with FIFO and three SPCR registers.
This header is re-derived against FSP R_SPI_B0_Type (R7KA8D2KF_core0.h lines 25545-25946; total size 0x70 = 112 bytes per channel) at base 0x4035C000 (SPI0) / 0x4035C100 (SPI1).
| Offset | Name | Width | HUM | Purpose |
|---|---|---|---|---|
| 0x00 | SPDR | 32 | 2881 | Data (FIFO front-end). |
| 0x04 | SPDECR | 32 | 2883 | Delay control (SCKDL/...). |
| 0x08 | SPCR | 32 | 2884 | Control 1 (SPE/MSTR/SPTIE/...) |
| 0x0C | SPCR2 | 32 | 2889 | Control 2 (loopback, MOIFE). |
| 0x10 | SPCR3 | 32 | 2891 | Control 3 (SPBR, SSLnP). |
| 0x14 | SPCMD0 | 32 | 2893 | Command 0 (CPHA/CPOL/SPB). |
| 0x18 | SPCMD1 | 32 | 2893 | Command 1. |
| 0x1C | SPCMD2 | 32 | 2893 | Command 2. |
| 0x20 | SPCMD3 | 32 | 2893 | Command 3. |
| 0x24 | SPCMD4 | 32 | 2893 | Command 4. |
| 0x28 | SPCMD5 | 32 | 2893 | Command 5. |
| 0x2C | SPCMD6 | 32 | 2893 | Command 6. |
| 0x30 | SPCMD7 | 32 | 2893 | Command 7. |
| 0x40 | SPDCR | 32 | 2896 | Data control (BYSW/SPFC). |
| 0x44 | SPDCR2 | 32 | 2897 | Data control 2 (RTRG/TTRG). |
| 0x50 | SPSR | 32 | 2898 | Status. |
| 0x58 | SPTFSR | 32 | 2904 | TX FIFO data stage. |
| 0x5C | SPRFSR | 32 | 2904 | RX FIFO data stage. |
| 0x60 | SPPSR | 32 | 2905 | Polling status. |
| 0x68 | SPSRC | 32 | 2905 | Status clear (write-1). |
| 0x6C | SPFCR | 32 | 2906 | FIFO clear (SPFRST). |
Definition in file ra8_spi_regs.h.
| enum ra8_spcmd_bit_t : uint8_t |
SPCMDn (command register) bit positions.
HUM Ch 43.2.7 p 2893.
Definition at line 207 of file ra8_spi_regs.h.
| enum ra8_spcmd_mask_t : uint32_t |
SPCMDn bit-masks (HUM Ch 43.2.7 p 2893).
Definition at line 224 of file ra8_spi_regs.h.
| enum ra8_spcmd_spb_t : uint8_t |
SPB[4:0] data-length encodings used by the driver.
HUM Ch 43.2.7 lists the full SPB encoding table – SPB = (N-1) for an N-bit frame width. Mirrored against FSP spi_bit_width_t so the same numeric value can flow from the public driver enum straight into the SPCMDn.SPB field. Values not used by the bring-up driver are not exposed here.
| Enumerator | |
|---|---|
| k_ra8_spcmd_spb_8bit | 0b00111 -> 8-bit frame. |
| k_ra8_spcmd_spb_16bit | 0b01111 -> 16-bit frame. |
| k_ra8_spcmd_spb_32bit | 0b11111 -> 32-bit frame. |
Definition at line 248 of file ra8_spi_regs.h.
| enum ra8_spcr2_mask_t : uint32_t |
SPCR2 (control 2) masks.
HUM Ch 43.2.4 p 2889.
Definition at line 297 of file ra8_spi_regs.h.
| enum ra8_spcr3_bit_t : uint8_t |
SPCR3 bit positions (SSLnP polarity, SPBR, SPSLN).
HUM Ch 43.2.6 p 2891.
Definition at line 258 of file ra8_spi_regs.h.
| enum ra8_spcr3_mask_t : uint32_t |
SPCR3 masks.
HUM Ch 43.2.6 p 2891.
| Enumerator | |
|---|---|
| k_ra8_spcr3_mask_ssl_pol | [3:0] SSLnP. |
| k_ra8_spcr3_mask_spbr | [15:8] bit-rate divider. |
| k_ra8_spcr3_mask_spsln | [26:24] sequence length. |
Definition at line 271 of file ra8_spi_regs.h.
| enum ra8_spcr3_misc_t : uint8_t |
SPCR3 misc constants used in driver-side bit-shifting math.
| Enumerator | |
|---|---|
| k_ra8_spbr_max | SPBR is 8-bit unsigned. |
Definition at line 281 of file ra8_spi_regs.h.
| enum ra8_spcr_bit_t : uint8_t |
SPCR (control register 1) bit positions.
HUM Ch 43.2.4 p 2884.
Definition at line 116 of file ra8_spi_regs.h.
| enum ra8_spcr_mask_t : uint32_t |
SPCR bit-masks.
HUM Ch 43.2.4 p 2884.
Definition at line 142 of file ra8_spi_regs.h.
| enum ra8_spfcr_mask_t : uint32_t |
SPFCR (FIFO clear) masks.
HUM Ch 43.2.14 p 2906.
| Enumerator | |
|---|---|
| k_ra8_spfcr_mask_spfrst | Reset both FIFOs. |
Definition at line 289 of file ra8_spi_regs.h.
| enum ra8_spi_addr_t : uintptr_t |
SPI_B register-window base addresses (FSP R_SPI_B0_BASE / R_SPI_B1_BASE).
| Enumerator | |
|---|---|
| k_ra8_spi0_base_addr | HUM Ch 43, SPI0 base. |
| k_ra8_spi1_base_addr | HUM Ch 43, SPI1 base. |
Definition at line 64 of file ra8_spi_regs.h.
| enum ra8_spi_b_channel_count_t : uint8_t |
Channel count addressed by the SPI_B driver.
Shared between ra8_spi_b.c (core ops + ISR dispatch) and ra8_spi_b_dma.c (DMA pipes) so both translation units bound their per-channel tables and channel-range checks against the same constant.
| Enumerator | |
|---|---|
| k_ra8_spi_b_channel_count | SPI0 + SPI1. |
Definition at line 321 of file ra8_spi_regs.h.
| enum ra8_spi_limits_t : uint16_t |
SPI_B static dimensioning constants.
Definition at line 73 of file ra8_spi_regs.h.
| enum ra8_sppsr_mask_t : uint32_t |
SPPSR (polling status) masks.
HUM Ch 43.2.12 p 2905.
| Enumerator | |
|---|---|
| k_ra8_sppsr_mask_speps | Asserted while SPI is busy. |
Definition at line 308 of file ra8_spi_regs.h.
| enum ra8_spsr_bit_t : uint8_t |
SPSR (status register) bit positions.
HUM Ch 43.2.9 p 2898.
Definition at line 158 of file ra8_spi_regs.h.
| enum ra8_spsr_mask_t : uint32_t |
SPSR bit-masks.
HUM Ch 43.2.9 p 2898.
Definition at line 174 of file ra8_spi_regs.h.
| enum ra8_spsrc_mask_t : uint32_t |
SPSRC (status clear, write-1-to-clear) masks.
HUM Ch 43.2.13 p 2905.
Definition at line 191 of file ra8_spi_regs.h.
|
inlinestatic |
Get pointer to SPI_B channel channel (0..1).
| [in] | channel | Channel index, must be < k_ra8_spi_primary_count. |
channel encoded as uint8_t (0..255). Definition at line 341 of file ra8_spi_regs.h.
References k_ra8_spi0_base_addr, k_ra8_spi_channel_stride, and k_ra8_spi_primary_count.
Referenced by internal_xfer_common(), ra8_spi_b_target_init(), ra8_spi_b_target_xfer(), ra8_spi_clear_errors(), ra8_spi_controller_init(), ra8_spi_deinit(), ra8_spi_enter_stop(), ra8_spi_get_errors(), ra8_spi_init(), ra8_spi_read_dma(), ra8_spi_set_clock(), ra8_spi_write_dma(), and ra8_spi_xfer8().