ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_io_blockdev_sdram.h File Reference

ra8_io block-device backend over the external 64 MiB SDRAM window. More...

#include <stdint.h>
#include "ra8_err.h"
#include "ra8_io_blockdev.h"
#include "ra8_io_blockdev_ram.h"
Include dependency graph for ra8_io_blockdev_sdram.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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.

Detailed Description

ra8_io block-device backend over the external 64 MiB SDRAM window.

Tag
[Ring 4 / PAL] {World: NS}

The SDRAM backend is a volatile ramdisk: once the SDRAM controller is brought up, the external 64 MiB window at k_ra8_sdram_base_addr is plain memory, so this backend reuses the RAM backend's vtable and state (ra8_io_blockdev_ram_state_t) verbatim. It treats the SDRAM window as an array of 512-byte logical blocks, erases to zero, and needs no erase-before-write. Contents do not survive a power cycle.

Since
0.1.0

Definition in file ra8_io_blockdev_sdram.h.

Function Documentation

◆ ra8_io_blockdev_sdram_init()

ra8_err_t ra8_io_blockdev_sdram_init ( ra8_io_blockdev_t * bd,
ra8_io_blockdev_ram_state_t * state,
uint32_t block_count )
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.

Parameters
[out]bdHandle to bind (zero-initialised by the caller).
[out]stateCaller-owned RAM-backend state to populate.
[in]block_countNumber of 512-byte logical blocks (>= 1, <= window).
Returns
ra8_err_t Error code.
Return values
k_ra8_okController up and backend bound; bd is usable.
k_ra8_err_null_ptrbd or state was NULL.
k_ra8_err_invalid_sizeblock_count was zero or exceeds the window.
Precondition
bd and state out-live every call made through the device.
The SDRAM pins/clocks are configured for ra8_sdramc_init to succeed.
Postcondition
On success bd dispatches to the RAM backend over the SDRAM window.
On any non-ok return bd and state are left unbound/untouched.
Note
Not thread-safe with respect to the same device.
Since
0.1.0

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().