ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
usb_selftest_ospi_rw_device.c
Go to the documentation of this file.
1
26
27#include <stdint.h>
28
29#include "ra8_board_ek_ra8d2.h"
30#include "ra8_err.h"
31#include "ra8_xspi.h"
33
34#ifndef RA8_OFF_TARGET
35
36/* -------------------------------------------------------------------------- */
37/* J-Link probes (OSPI bring-up side) */
38/* -------------------------------------------------------------------------- */
39
41static volatile uint32_t s_dbg_ospi_prov = (uint32_t)k_ospirw_no_mismatch;
43static volatile uint32_t s_dbg_ospi_id;
44
46{
49 if (err != k_ra8_ok) {
50 s_dbg_ospi_prov = (uint32_t)err;
51 return err;
52 }
54 if (err != k_ra8_ok) {
55 s_dbg_ospi_prov = (uint32_t)err;
56 return err;
57 }
58 uint32_t id = 0U;
59 (void)ra8_xspi_flash_read_id((uint8_t)k_ospirw_instance, &id);
60 s_dbg_ospi_id = id;
61 const uint32_t windows =
62 ((uint32_t)k_ospirw_sectors * (uint32_t)k_ospirw_block_size) / (uint32_t)k_ospirw_erase_sector;
63 for (uint32_t e = 0U; e < windows; e++) {
64 const uint32_t addr = (uint32_t)k_ospirw_offset + (e * (uint32_t)k_ospirw_erase_sector);
66 if (err != k_ra8_ok) {
67 s_dbg_ospi_prov = (uint32_t)err;
68 return err;
69 }
70 }
71 s_dbg_ospi_prov = 0U;
72 return k_ra8_ok;
73}
74
75#endif /* !RA8_OFF_TARGET */
static volatile uint32_t s_dbg_ospi_prov
OSPI provisioning result (sentinel = pending, 0 = done, else err).
Definition main.c:184
static volatile uint32_t s_dbg_ospi_id
OSPI JEDEC id read at boot (IS25LX512M = 0x009D5A1A).
Definition main.c:182
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
ra8_err_t ra8_board_io_expander_set_octospi_active(void)
Program the U15 I/O expander to request the Octo-SPI SW4 layout.
ra8_err_t ra8_board_xspi_pins_init(void)
Route the 12 OCTA bus pins to the xSPI peripheral and pulse RESET_L.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Definition ra8_err.h:119
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
@ k_ra8_xspi_lio_1s1s1s
1S-1S-1S extended SPI.
xSPI / Octo-SPI driver (flash read/program/erase + ID/status)
ra8_err_t ra8_xspi_init(uint8_t instance, ra8_xspi_lio_mode_t mode)
Initialise an xSPI instance in the chosen link-layer IO mode.
Definition ra8_xspi.c:372
ra8_err_t ra8_xspi_flash_erase_sector(uint8_t instance, uint32_t flash_addr)
Erase the 4 KiB sector containing flash_addr.
ra8_err_t ra8_xspi_flash_read_id(uint8_t instance, uint32_t *out_id)
Read the JEDEC ID (opcode 0x9F), returning 24 bits in a uint32_t.
ra8_err_t ospirw_ospi_provision(void)
Bring the OSPI flash up and erase the writable window.
Shared tunables + host-side worker seam for the writable-OSPI self-loop.
@ k_ospirw_no_mismatch
Probe: no mismatch.
@ k_ospirw_block_size
SCSI logical block size.
@ k_ospirw_offset
2 MiB into the chip (scratch).
@ k_ospirw_instance
xSPI controller instance.
@ k_ospirw_sectors
512-byte sectors (OSPI window = 32 KiB).
@ k_ospirw_erase_sector
IS25LX512M 4 KiB erase sector.