|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
SDHI (SD/MMC host interface) register layout for the Renesas RA8D2. More...
Go to the source code of this file.
Data Structures | |
| struct | r_sdhi_regs_t |
| SDHI register window. More... | |
Functions | |
| static volatile r_sdhi_regs_t * | ra8_sdhi (uint8_t instance) |
| Get pointer to SDHI instance N (0 or 1). | |
SDHI (SD/MMC host interface) register layout for the Renesas RA8D2.
Two SDHI instances at 0x40252000 (SDHI0) and 0x40252400 (SDHI1). The full register window covers command issue, response, status, interrupt mask, clock control, transfer-data length, access option, error status, FIFO buffer, SDIO mode, DMA enable, software reset, SD interface mode, and endianness swap.
Layout cross-verified against FSP R_SDHI0_Type (sibling RA SoC BSP header R7FA6M3AH.h lines 14964-15442, structure size 0x1E4 bytes) – the same hardware block ships unchanged across RA6M3, RA6M5, and RA8 series. Register access widths and bit positions are identical; only the base address differs on RA8D2.
Definition in file ra8_sdhi_regs.h.
| enum ra8_sdhi_acmd6_bits_t : uint32_t |
ACMD6 (SET_BUS_WIDTH) argument + R1 status-bit masks.
The ACMD6 application command negotiates the card-side data-bus width. Its 32-bit argument carries the width in bits [1:0] (0b00 = 1-bit, 0b10 = 4-bit); the SDHI replays the R1 card-status response in SD_RSP10 (HUM Ch 47.2.5 "SD_RSP10..76 : SD Response Registers" p 3132). These constants name the bits the ACMD6 negotiation inspects so the driver carries no magic numbers:
Definition at line 176 of file ra8_sdhi_regs.h.
| enum ra8_sdhi_addr_t : uintptr_t |
| Enumerator | |
|---|---|
| k_ra8_sdhi0_base_addr | RA8 sdhi0 base address. |
| k_ra8_sdhi1_base_addr | RA8 sdhi1 base address. |
| k_ra8_sdhi_stride | RA8 SDHI stride. |
Definition at line 33 of file ra8_sdhi_regs.h.
| enum ra8_sdhi_arg_shift_t : uint8_t |
Bit-shift amounts for SD command-argument packing.
CMD55 (APP_CMD) carries the card's relative address (RCA) in the upper half of SD_ARG, i.e. SD_ARG[31:16] = RCA; the lower 16 bits are stuff bits. Naming the shift keeps the packing free of inline magic numbers.
| Enumerator | |
|---|---|
| k_ra8_sdhi_rca_arg_shift | RCA occupies SD_ARG[31:16]. |
Definition at line 225 of file ra8_sdhi_regs.h.
| enum ra8_sdhi_cmd6_switch_bits_t : uint32_t |
eMMC CMD6 (SWITCH) argument fields for the 8-bit bus-width switch.
SD cards top out at a 4-bit bus (negotiated with ACMD6); the 8-bit data bus is an eMMC-only feature reached through the JEDEC CMD6 SWITCH command (JESD84-B51 Section 6.6.4) rather than an application command – there is no CMD55 prefix. The 32-bit argument packs four fields:
| Bits | Field | Value here | |---------|--------|-----------------------------------------| | [25:24] | Access | 0b11 Write Byte | | [23:16] | Index | 183 (0xB7) = EXT_CSD BUS_WIDTH byte | | [15:8] | Value | 2 = 8-bit SDR (1 = 4-bit, 0 = 1-bit) | | [2:0] | CmdSet | 0 |
The card replays an R1b card-status response in SD_RSP10; the same k_ra8_sdhi_r1_error_mask that guards ACMD6 rejects a switch that the card refused. k_ra8_sdhi_cmd6_arg_8bit is the whole argument composed from the three named field selectors so the driver carries no inline magic number.
Definition at line 207 of file ra8_sdhi_regs.h.
| enum ra8_sdhi_cmd_id_t : uint8_t |
SD command numbers used by the block-transfer API.
Mirrors FSP r_sdhi_private.h SDHI_PRV_CMD_*. The hardware SD_CMD register accepts the bare command index (0..63) for data transfer commands; the SDHI block infers the response and data direction from the command index alone – no additional data-phase or response-type bits are required for the four commands used by ra8_sdhi_read_block and ra8_sdhi_write_block.
Definition at line 82 of file ra8_sdhi_regs.h.
| enum ra8_sdhi_geometry_t : uint32_t |
Block-transfer geometry constants.
SD cards use a fixed 512-byte block size for SDHC/SDXC. The SDHI FIFO is 4 bytes wide (SD_BUF0 is a 32-bit register), so each block requires 128 four-byte transfers.
| Enumerator | |
|---|---|
| k_ra8_sdhi_block_bytes | SD block size in bytes. |
| k_ra8_sdhi_fifo_word_bytes | SD_BUF0 FIFO word width. |
| k_ra8_sdhi_words_per_block | 512 / 4 = 128 word fills per block |
Definition at line 101 of file ra8_sdhi_regs.h.
| enum ra8_sdhi_limits_t : uint8_t |
| Enumerator | |
|---|---|
| k_ra8_sdhi_instance_count | RA8 SDHI instance count. |
Definition at line 39 of file ra8_sdhi_regs.h.
| enum ra8_sdhi_option_bits_t : uint32_t |
SD_OPTION bus-width selectors and timeout-field defaults.
SD_OPTION (HUM Ch 47.2.16 "SD_OPTION : SD Card Access Control Option Register" p 3139-3140) packs two bus-width bits, a timeout mask, and two timeout counters:
| WIDTH | WIDTH8 | Bus width |
|---|---|---|
| 1 | 0 | 1-bit |
| 0 | 0 | 4-bit |
| 0 | 1 | 8-bit |
| 1 | 1 | 1-bit |
The three k_ra8_sdhi_option_bus_* values are the only ones the driver writes whole; k_ra8_sdhi_option_width_mask is the read-modify-write clear mask that isolates WIDTH+WIDTH8 so the timeout fields survive a bus-width change.
Definition at line 141 of file ra8_sdhi_regs.h.
| enum ra8_sdhi_xfer_bits_t : uint32_t |
SD_INFO2 / SD_STOP bit-masks used by the block-transfer path.
These bits are documented in HUM Ch 47.2.15 / 47.2.13. FSP's r_sdhi.c exposes them as private macros SDHI_PRV_SDHI_INFO2_CARD_BRE / CARD_BWE and SDHI_PRV_SD_STOP_SD_SECCNT_ENABLE. We mirror them here so the polled FIFO drain in :c:func:ra8_sdhi_read_block / :c:func:ra8_sdhi_write_block does not carry magic numbers.
Definition at line 63 of file ra8_sdhi_regs.h.
|
inlinestatic |
Get pointer to SDHI instance N (0 or 1).
Definition at line 291 of file ra8_sdhi_regs.h.
References k_ra8_sdhi0_base_addr, k_ra8_sdhi_instance_count, and k_ra8_sdhi_stride.
Referenced by ra8_sdhi_attach_dma(), ra8_sdhi_clear_status(), ra8_sdhi_deinit(), ra8_sdhi_dispatch(), ra8_sdhi_get_status(), ra8_sdhi_init(), ra8_sdhi_read_block(), ra8_sdhi_send_command(), ra8_sdhi_set_bus_width(), ra8_sdhi_set_bus_width_4bit(), ra8_sdhi_set_bus_width_8bit(), ra8_sdhi_set_clock(), and ra8_sdhi_write_block().