embassy-rp

Crates

git

Versions

rp235xb

Flavors

Function embassy_rp::rom_data::flash_select_xip_read_mode

source ·
pub unsafe extern "C" fn flash_select_xip_read_mode(
    bootrom_xip_mode: u8,
    clkdiv: u8,
)
Expand description

Configure QMI for one of a small menu of XIP read modes supported by the bootrom. This mode is configured for both memory windows (both chip selects), and the clock divisor is also applied to direct mode.

The available modes are:

  • 0: 03h serial read: serial address, serial data, no wait cycles
  • 1: 0Bh serial read: serial address, serial data, 8 wait cycles
  • 2: BBh dual-IO read: dual address, dual data, 4 wait cycles (including MODE bits, which are driven to 0)
  • 3: EBh quad-IO read: quad address, quad data, 6 wait cycles (including MODE bits, which are driven to 0)

The XIP write command/format are not configured by this function. When booting from flash, the bootrom tries each of these modes in turn, from 3 down to 0. The first mode that is found to work is remembered, and a default XIP setup function is written into bootram that calls this function (flash_select_xip_read_mode) with the parameters discovered during flash scanning. This can be called at any time to restore the flash parameters discovered during flash boot.

All XIP modes configured by the bootrom have an 8-bit serial command prefix, so that the flash can remain in a serial command state, meaning XIP accesses can be mixed more freely with program/erase serial operations. This has a performance penalty, so users can perform their own flash setup after flash boot using continuous read mode or QPI mode to avoid or alleviate the command prefix cost.

Supported architectures: ARM-S, RISC-V

§Safety

This is a low-level C function. It may be difficult to call safely from Rust. If in doubt, check the rp235x datasheet for details and do your own safety evaluation.