|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
SDRAM block-device backend – the 64 MiB SDRAM window as a ramdisk. More...
#include "ra8_io_blockdev_sdram.h"#include <stdint.h>#include "ra8_attributes.h"#include "ra8_check.h"#include "ra8_err.h"#include "ra8_io_blockdev_ram.h"#include "ra8_sdramc.h"#include "ra8_sdramc_regs.h"Go to the source code of this file.
Enumerations | |
| enum | ra8_io_sdram_const_t : uint32_t { k_ra8_io_sdram_min_blocks = 1 } |
| SDRAM-backend layout constants. More... | |
Functions | |
| static uint32_t | internal_sdram_max_blocks (void) |
| Maximum block count the SDRAM window can hold. | |
| ra8_err_t | ra8_io_blockdev_sdram_init (ra8_io_blockdev_t *bd, ra8_io_blockdev_ram_state_t *state, uint32_t block_count) |
| Bring up the SDRAM controller and bind it as a volatile ramdisk. | |
Variables | |
| static const char *const | s_tag = "ra8_io_blockdev_sdram" |
| Module log tag. | |
SDRAM block-device backend – the 64 MiB SDRAM window as a ramdisk.
Once ra8_sdramc_init has brought the SDRAM controller up, the external 64 MiB window is plain memory, so this backend reuses the RAM backend's vtable and state. ra8_io_blockdev_sdram_init validates the requested block count against the window, starts the controller, and delegates the binding (and thereby every read/write/erase/caps callback) to ra8_io_blockdev_ram_init. Contents are volatile across a power cycle.
Definition in file ra8_io_blockdev_sdram.c.
| enum ra8_io_sdram_const_t : uint32_t |
SDRAM-backend layout constants.
| Enumerator | |
|---|---|
| k_ra8_io_sdram_min_blocks | Smallest legal device size, in blocks. |
Definition at line 40 of file ra8_io_blockdev_sdram.c.
|
static |
Maximum block count the SDRAM window can hold.
The 64 MiB window divided by the 512-byte logical block size, computed once so ra8_io_blockdev_sdram_init expresses no magic ratio inline.
| 131072 | The 64 MiB window divided by 512 bytes. |
Definition at line 64 of file ra8_io_blockdev_sdram.c.
References k_ra8_io_block_size_bytes, k_ra8_sdram_size_bytes, and RA8_INTERNAL.
Referenced by ra8_io_blockdev_sdram_init().
|
nodiscard |
Bring up the SDRAM controller and bind it as a volatile ramdisk.
Validates block_count against the 64 MiB SDRAM window, initialises the SDRAM controller via ra8_sdramc_init, then delegates to ra8_io_blockdev_ram_init using the SDRAM base address as the backing buffer (writable, never read-only). The reused ra8_io_blockdev_ram_state_t is caller-owned and must out-live every call made through the device.
| [out] | bd | Handle to bind (zero-initialised by the caller). |
| [out] | state | Caller-owned RAM-backend state to populate. |
| [in] | block_count | Number of 512-byte logical blocks (>= 1, <= window). |
| k_ra8_ok | Controller up and backend bound; bd is usable. |
| k_ra8_err_null_ptr | bd or state was NULL. |
| k_ra8_err_invalid_size | block_count was zero or exceeds the window. |
Definition at line 69 of file ra8_io_blockdev_sdram.c.
References internal_sdram_max_blocks(), k_ra8_err_invalid_size, k_ra8_io_sdram_min_blocks, k_ra8_sdram_base_addr, RA8_CHECK_NULL_PTR, ra8_io_blockdev_ram_init(), RA8_RETURN_ON_ERROR, ra8_sdramc_init(), and s_tag.
Referenced by demo_run(), and internal_demo_run().
|
static |
Module log tag.
Definition at line 32 of file ra8_io_blockdev_sdram.c.