![]() |
RAFW Flexible Software Package Documentation
Release v2.0.1
|
|
Driver for the OSPI_W peripheral on RA6W1/RA6W2 MCUs. This module implements the SPI Flash Interface.
The OSPI_W peripheral supports xSPI (or OSPI) compatible external memory devices, and it interfaces with these devices to perform data I/O Operations. Please note that this document will reference the xSPI protocol to which OSPI is a subset. The OSPI_W peripheral is compatible with a variety of xSPI protocol operating modes.
The OSPI_W driver has the following key features to support the xSPI device:
| Configuration | Options | Default | Description |
|---|---|---|---|
| Memory-mapping Support | |||
| Prefetch Function |
| Enable | Enable prefetch function on memory-mapped reads. |
| XiP Support | Enable | Enable | Enable the use of XiP enter and exit codes. |
| Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
| DMAC Support | Disable | Disable | RRQ61X dose not support DMAC. |
| Autocalibration Support | Disable | Disable | RRQ61x does not support autocalibration. |
| DOTF Support | Disable | Disable | DOTF will activate in secure mode. |
| Configuration | Options | Default | Description |
|---|---|---|---|
| General | |||
| Name | Name must be a valid C symbol | g_ospi | Module name. |
| Channel | Only one channel available | 0 | Specify the OSPI chip select line to use. |
| Initial Protocol Mode |
| SPI (1S-1S-1S) | Select the initial protocol mode of the xSPI target device. Please see the documentation for examples of changing the protocol mode. |
| Initial Address Bytes |
| 3 | Select the number of address bytes. |
| Address line for page program |
| SPI_FLASH_DATA_LINES_4 | Select the number of data line for program address. |
| Write Status Bit | Must be an integer between 0 and 7 | 0 | Which bit contains the write in progress status returned from the Write Status Command. |
| Write Enable Bit | Must be an integer between 0 and 7 | 1 | Which bit contains the write enable status returned from the Write Enable Command. |
| Sector Erase Size | Must be an integer greater than or equal to 0 | 4096 | The sector erase size. Set Sector Erase Size to 0 if Sector Erase is not supported. |
| Block Erase Size | Must be an integer greater than or equal to 0 | 32768 | The block(32k) erase size. Set Block Erase Size to 0 if Block Erase is not supported. |
| General > Block[64k] Erase Size | Must be an integer greater than or equal to 0 | 65536 | The block(64k) erase size. Set Block Erase Size to 0 if Block Erase is not supported. |
| Defaults | |||
| Defaults > Command Definitions | |||
| Page Program Command | Page Program Command under OPI|QPI Mode|Command Definitions | 0x32 | Default command to program a page. |
| Read Command | Read Command under OPQ|QPI Mode|Command Definitions | 0xEB | Default command to read. |
| Write Enable Command | Write Enable Command under SPI Mode|Command Definitions | 0x06 | Default command to enable write. |
| Status Command | Status Command under SPI Mode|Command Definitions | 0x05 | Default command to query the status of a write or erase command. |
| Defaults > Erase Command Definitions | |||
| Sector Erase Command | Must be an integer between 0x01 and 0xFFFF, inclusive. | 0x20 | Default command to erase a sector. The lower byte will be used for 1-byte commands. Set to 0 if unused. |
| Block Erase Command | Must be an integer between 0x01 and 0xFFFF, inclusive. | 0x52 | Default command to erase a block(32k). The lower byte will be used for 1-byte commands. Set to 0 if unused. |
| Block(64k) Erase Command | Must be an integer between 0x01 and 0xFFFF, inclusive. | 0xD8 | Default command to erase a block(64k). The lower byte will be used for 1-byte commands. Set to 0 if unused. |
| High-speed Mode | |||
| High-speed Mode > Command Definitions | |||
| Page Program Command | OSPI|QPI Page Program Command under High-speed Mode|Command Definitions | 0x32 | The command to program a page in OPI|QPI mode. |
| Dual Read Command | OSPI|QSPI Read Command under High-speed Mode|Command Definitions | 0xEB | The command to read in High-speed mode (8DTRD). |
| Write Enable Command | OSPI|QPI Write Enable Command under High-speed Mode|Command Definitions | 0x06 | The command to enable write in OPI mode. Set to 0 to ignore. |
| Status Command | OSPI|QPI Status Command under High-speed Mode|Command Definitions | 0x05 | The command to query the status of a write or erase command in OPI mode. Set to 0 to ignore. |
| Sector Erase Command | Must be an integer between 0x01 and 0xFFFF, inclusive. | 0 | The command to erase a sector for high-speed mode. Set to 0 if unused. |
| Block Erase Command | Must be an integer between 0x01 and 0xFFFF, inclusive. | 0 | The command to erase a block for high-speed mode. Set to 0 if unused. |
| Chip Erase Command | Must be an integer between 0x01 and 0xFFFF, inclusive. | 0 | The command to erase the entire chip for high-speed mode. Set to 0 if unused. |
| Protocol |
| QSPI (1S-4S-4S) | Select the High-Speed xSPI protocol. |
| Command Length Bytes |
| 1 | Command length in bytes |
| Memory Read Dummy Cycles | Must be an integer between 0 and 31 | 0x02 | Memory read dummy cycles |
| Status Read Dummy Cycles | Must be an integer between 0 and 31 | 0 | Status read dummy cycles |
| HW config | |||
| Clk_div |
| Divide by 2 | Clock divide value |
| Clock mode |
| Mode 1 | Clock mode Mode 0: OSPI_W clock is low when CS is high Mode 1: OSPI_W clock is high when CS is high |
| IO2 pad direction |
| Auto Sel | IO2 pad direction Auto sel : Pad is determined by the controller Output : Pad is output |
| IO2 pad value |
| Low | IO2 pad value |
| IO3 pad direction |
| Auto Sel | IO3 pad direction Auto Sel : Pad is determined by HW Output : Pad is output |
| IO3 pad value |
| Low | IO3 pad value |
| IO4_7 pad direction |
| Auto Sel | IO4_7 pad direction Auto Sel : Pad is determined by HW Output : Pad is output |
| IO4_7 pad value |
| 0000 | IO4_7 pad value |
| HREADY mode |
| Wait | HREADY signal mode when accessing the WRITEDATA, READDATA and DUMMYDATA registers. This configuration is useful when the frequency of the OSPI clock is much lower than the clock of the AMBA bus, in order to avoid locking the AMBA bus for a long time. When set to OSPI_W_DEVICE_HREADY_MODE_WAIT, there is no need to check the OSPIC_BUSY for detecting completion of the requested access. |
| Sampling edge |
| Edge neg | Clock edge setting for the sampling of the incoming data when the read pipe is disabled |
| Read pipe setting |
| Enable | Read pipe setting. When read pipe is disabled, the sampling clock is determined by sampling_edge. but when it is enabled, it is determined by pipe_delay. It is always recommended to enable read pipe and set the pipe_delay to the optimal value. |
| Pipe delay |
| Pipe delay 7 | Read pipe clock delay in relation to the falling edge of ospi_w_clock. Always sets this value to PIPE_DELAY_7 for power supply voltage 1.2V and PIPE_DELAY_2 for power supply voltage 0.9V |
| Slew rate control |
| Slew rate 0 | Pads slew rate control Slew rate 0 Rise = 1.7 V/ns, Fall = 1.9 V/ns (weak) Slew rate 1 Rise = 2.0 V/ns, Fall = 2.3 V/ns Slew rate 2 Rise = 2.3 V/ns, Fall = 2.6 V/ns Slew rate 3 Rise = 2.4 V/ns, Fall = 2.7 V/ns (strong) |
| Drive current |
| 12mA | Pads drive current |
| Flash model config | |||
| Instr bus mode |
| Single mode | The bus mode of the instruction phase |
| Bus mode |
| Quad mode | The bus mode of all phases apart from the instruction phase which is determined by instr_bus_mode |
| Instruction size |
| 1byte | Flash instruction size |
| Read opcode | Read command for automode | 0xEB | Read opcode. |
| Erase opcode | Erase command for automode | 0x20 | Erase opcode. |
| Suspend opcode | Suspend command for automode | 0x75 | Suspend opcode. |
| Resume opcode | Resume command for automode | 0x7A | Resume opcode. |
| Read status opcode | Read status command for automode | 0x05 | Read status opcode. |
| Write enable opcode | Read status command for automode | 0x06 | Write enable opcode. |
| Dummy cycles | Dummy cycles | 0x02 | Dummy cycles for fast read(it is related with read opcode). |
| Address size |
| 24bit address size | Flash address size. |
| Instruction mode |
| Once | Instruction mode in auto access mode. Anytime : Transmit instruction at any burst access Once : Transmit instruction only in the first access after the selection of Auto Mode |
| Extra byte setting |
| Enable | Enable/Disable the extra byte phase in automode. Disable : Don't send the extra byte Enable : Send the extra byte |
| Extra byte value | Extra byte vaule | 0xA0 | The value of an extra byte that will be transferred after address phase (if enabled) |
| Busy bit | Must be an integer between 0 and 7 | 0 | Which bit contains the write in progress status returned from the Write Status Command. |
The RA6W1/RA6W2 starts with 40Mhz of OSPI clock. and it can be up to 80Mhz after the PLL turn on. The OSPI_CLK frequencies can be set on the Clocks tab of the RA6W1/RA6W2 Configuration editor.
The following pins are available to connect to an external OSPI device:
After R_OSPI_W_Open() completes successfully, the xSPI device contents are mapped to address 0x2A000000 and can be read like on-chip flash.
RA6W1/RA6W2 does not support this feature.
OSPI_W supports eXecute in Place (XiP) modes of operation. This can be used for read-only memory-mapped accesses to reduce overall read latency by skipping the command sequence in the xSPI transaction. Separate XiP enter and exit codes may be specified for either attached target device. Upon calling R_OSPI_W_XipEnter(), the associated memory region for the target device is switched to read-only mode and the enter code sent to the device. Calling R_OSPI_W_XipExit() will transmit the exit code and transition the memory region back to read-write access.
Only one flash device should be used after entering XiP mode. Once entered, XiP codes will be transmitted to all attached devices.
Decryption-On-The-Fly feature is enabled if the RA6W1/RA6W2 is in secure-mode.
Developers should be aware of the following limitations when using the OSPI_W driver:
This is a basic example of minimal use of the OSPI in an application with OctaFlash(QuadFlash).
This is an example of using R_OSPI_W_DirectTransfer. it read the JEDEC ID of the flash.
Flash contents can be read out by memcpy. During automode, flash address are mapped at 0x2A000000.
This is an example of erasing flash.
The OSPI_W supports an auto-erase function. If the R_OSPI_W_XipExit() is not called before the R_OSPI_W_Erase(), it tries to erase in auto-mode, which means that there is no need to disable interrupts for flash erasing. When an interrupt occurs during the erase or the code is operated in another task, the OSPI_W automatically sends a suspend command. When the code operation is over, it sends a resume command to complete the erase. For using this feature, the flash configuration should be filled through the FSP.
This is an example of writing data to flash.
Data Structures | |
| struct | ospi_w_device_config_t |
| struct | ospi_w_device_read_instr_config_t |
| struct | ospi_w_device_erase_instr_config_t |
| struct | ospi_w_device_read_status_config_t |
| struct | ospi_w_device_write_enable_instr_config_t |
| struct | ospi_w_device_suspend_resume_instr_config_t |
| struct | ospi_w_xspi_command_set_t |
| struct | ospi_w_extended_cfg_t |
| struct | ospi_w_instance_ctrl_t |
Enumerations | |
| enum | ospi_w_device_clk_div |
| enum | ospi_w_device_bus_mode |
| enum | ospi_w_device_access_mode |
| enum | ospi_w_device_clk_mode |
| enum | ospi_w_device_io_dir |
| enum | ospi_w_device_io_value |
| enum | ospi_w_device_io4_7_value |
| enum | ospi_w_device_hready_mode |
| enum | ospi_w_device_sampling_edge |
| enum | ospi_w_device_read_pipe |
| enum | ospi_w_device_read_pipe_delay |
| enum | ospi_w_device_addr_size |
| enum | ospi_w_device_instruct_sz |
| enum | ospi_w_device_dummy_mode |
| enum | ospi_w_device_slew_rate |
| enum | ospi_w_device_drive_current |
| enum | ospi_w_device_extra_byte |
| enum | ospi_w_device_instr_mode |
| enum | ospi_w_device_number_t |
| enum | ospi_w_command_bytes_t |
| enum | ospi_w_command_interval_clocks_t |
| enum | ospi_w_command_cs_pullup_clocks_t |
| enum | ospi_w_command_cs_pulldown_clocks_t |
| struct ospi_w_device_config_t |
OSPI_W configuration structure
| Data Fields | ||
|---|---|---|
| ospi_w_device_clk_div | clk_div: 2 | Clock divider value. |
| ospi_w_device_bus_mode | bus_mode: 3 | Read bus mode. |
| ospi_w_device_access_mode | access_mode: 1 | Access mode. |
| ospi_w_device_clk_mode | clock_mode: 1 | Clock mode. |
| ospi_w_device_io_dir | io2_dir: 1 | IO2 direction. |
| ospi_w_device_io_value | io2_value: 1 | IO2 value. |
| ospi_w_device_io_dir | io3_dir: 1 | IO3 direction. |
| ospi_w_device_io_value | io3_value: 1 | IO3 value. |
| ospi_w_device_io_dir | io4_7_dir: 1 | IO4-7 direction. |
| ospi_w_device_io4_7_value | io4_7_value: 4 | IO4-7 value. |
| ospi_w_device_hready_mode | hready_mode: 1 | HREADY mode. |
| ospi_w_device_sampling_edge | sampling_edge: 1 | Sampling_edge. |
| ospi_w_device_read_pipe | read_pipe: 1 | Read pipe setting. |
| ospi_w_device_read_pipe_delay | read_pipe_delay: 3 | Read pipe delay value. |
| ospi_w_device_addr_size | address_size: 1 | Flash address size. |
| ospi_w_device_dummy_mode | dummy_mode: 1 | Dummy mode. |
| ospi_w_device_slew_rate | slew_rate: 2 | Slew rate. |
| ospi_w_device_drive_current | drive_current: 2 | Drive current. |
| ospi_w_device_manualmode_config_t | manualmode_config | |
| ospi_w_device_automode_config_t | automode_config | |
| struct ospi_w_device_read_instr_config_t |
OSPI_W read instruction configuration structure (auto access mode)
| Data Fields | ||
|---|---|---|
| bool | enable |
Enable read instruction |
| uint8_t | instr |
Instruction code for Incremental Burst or Single read access. Also used when wrapping burst is not supported. |
| uint8_t | instr_extra_byte |
Extra byte instruction. Usually the Mode Bits in Dual/Quad/ Octal SPI I/O instructions |
| ospi_w_device_bus_mode | instr_bus_mode |
Bus mode during the instruction phase |
| ospi_w_device_bus_mode | addr_bus_mode |
Bus mode during the address phase |
| ospi_w_device_bus_mode | extra_byte_bus_mode |
Bus mode during the extra byte phase |
| ospi_w_device_bus_mode | dummy_bus_mode |
Bus mode during the dummy phase |
| ospi_w_device_bus_mode | data_bus_mode |
Bus mode during the data phase |
| ospi_w_device_extra_byte | extra_byte_cfg |
Extra byte enable/disable |
| ospi_w_device_extra_byte_half | extra_byte_half_cfg |
Enable/disable of extra byte half setting |
| uint8_t | dummy_bytes |
The number of dummy bytes (0..32) |
| ospi_w_device_instr_mode | instr_mode | |
| ospi_w_device_idle_state_duration | idle_state_duration | |
| struct ospi_w_device_erase_instr_config_t |
OSPI_W erase instruction configuration structure (auto access mode)
| Data Fields | ||
|---|---|---|
| bool | enable |
Enable erase instruction |
| uint8_t | instr |
Erase instruction code |
| ospi_w_device_bus_mode | instr_bus_mode |
Bus mode during the instruction phase |
| ospi_w_device_bus_mode | addr_bus_mode |
Bus mode during the address phase |
| uint8_t | hclk_cycles |
The number of AMBA AHB hclk cycles (0..15) without memory read requests before the controller can execute erase or erase resume instructions |
| uint8_t | cs_hi_cycles |
The minimum number of QSPI bus clock cycles (0..31) that OSPI_CS remains high after the execution of write enable, erase, erase suspend and erase resume instructions. |
| struct ospi_w_device_read_status_config_t |
OSPI_W read status instruction configuration structure (auto access mode)
| Data Fields | ||
|---|---|---|
| bool | enable |
Enable read status instruction |
| uint8_t | instr |
Read status instruction code |
| ospi_w_device_bus_mode | instr_bus_mode |
Bus mode during the instruction phase |
| ospi_w_device_bus_mode | receive_bus_mode |
Bus mode during the receive status phase |
| ospi_w_device_bus_mode | dummy_bus_mode |
Bus mode during the dummy bytes phase |
| uint8_t | busy_pos |
The position of the Busy bit in the status register (0 - 7) |
| ospi_w_device_busy | busy_val |
Busy status setting |
| uint8_t | read_stat_del |
The minimum time distance between the read status instruction and previous erase or erase/resume instructions. 0: don't wait. The controller can read the memory status register immediately. 1..63 - the controller waits at least this number of QSPI_CLK cycles before reading the memory status register following the end of a previous erase or erase resume |
| ospi_w_device_read_status_reg_cnt | read_stat_reg_cnt | |
| uint8_t | dummy_bytes |
The number of dummy bytes (0..16) |
| ospi_w_device_read_status_dummy_val | dummy_val |
Dummy bytes value |
| struct ospi_w_device_write_enable_instr_config_t |
OSPI_W write enable instruction configuration structure (auto access mode)
| Data Fields | ||
|---|---|---|
| bool | enable |
Enable write enable instruction |
| uint8_t | instr |
Write enable instruction code |
| ospi_w_device_bus_mode | instr_bus_mode |
Bus mode during the instruction phase |
| struct ospi_w_device_suspend_resume_instr_config_t |
OSPI_W erase suspend/resume instruction structure
| Data Fields | ||
|---|---|---|
| bool | enable |
Enable erase suspend/resume instruction |
| uint8_t | suspend_instr |
Erase suspend instruction code |
| uint8_t | resume_instr |
Erase resume instruction code |
| ospi_w_device_bus_mode | suspend_bus_mode |
Bus mode during the erase suspend instruction phase |
| ospi_w_device_bus_mode | resume_bus_mode |
Bus mode during the erase resume instruction phase |
| uint8_t | read_stat_del |
The minimum time distance between the read status instruction and the previous erase or erase/resume instructions. 0: don't wait. The controller can read the memory status register immediately. 1..255 - the controller waits at least this number of OSPI_CLK cycles before reading the memory status register |
| struct ospi_w_xspi_command_set_t |
Command set used for a protocol mode other than normal (1S-1S-1S) SPI.
| Data Fields | ||
|---|---|---|
| spi_flash_protocol_t | protocol | Protocol mode associated with this command set. |
| ospi_w_command_bytes_t | command_bytes | Number of command bytes for each command code. |
| uint16_t | read_command | Read command. |
| uint16_t | page_program_command | Page program/write command. |
| uint16_t | write_enable_command | Command to enable write or erase, set to 0x00 to ignore. |
| uint16_t | status_command | Command to read the write status, set to 0x00 to ignore. |
| uint8_t | read_dummy_cycles | Dummy cycles to be inserted for read commands. |
| uint8_t | program_dummy_cycles | Dummy cycles to be inserted for page program commands. |
| uint8_t | status_dummy_cycles | Dummy cycles to be inserted for status read commands. |
| uint8_t | erase_command_list_length | Length of erase command list. |
| spi_flash_erase_command_t const * | p_erase_command_list | List of all erase commands and associated sizes. |
| struct ospi_w_extended_cfg_t |
OSPI_W Extended configuration.
| Data Fields | ||
|---|---|---|
| ospi_w_device_number_t | channel | Device number to be used for memory device. |
| ospi_w_timing_setting_t const * | p_timing_settings | Memory-mapped timing settings. |
| ospi_w_xspi_command_set_t const * | p_xspi_command_set_list | Additional protocol command sets; if additional protocol commands set are not used set this to NULL. |
| uint8_t | xspi_command_set_list_length | Number of additional protocol command set defined. |
| uint8_t * | p_autocalibration_preamble_pattern_addr | OctaFlash memory address holding the preamble pattern. |
| uint8_t | data_latch_delay_clocks | Specify delay between OM_DQS and OM_DQS Strobe. Set to 0 to auto-calibrate. Typical value is 0x80. |
| ospi_w_device_config_t * | p_ospi_w_device_cfg | OSPI_W HW configuration. |
| ospi_w_device_read_instr_config_t * | p_read_instr_cfg | Automode read instruction configuration. |
| ospi_w_device_wrap_burst_instr_config_t * | p_wrap_burst_instr_cfg | Wrap burst instruction configuration. |
| ospi_w_device_read_status_config_t * | p_read_status_instr_cfg | Automode read status instruction configuration. |
| ospi_w_device_erase_instr_config_t * | p_erase_instr_cfg | Automode erase instruction configuration. |
| ospi_w_device_write_enable_instr_config_t * | p_write_enable_instr_cfg | Automode write enable instruction configuration. |
| ospi_w_device_suspend_resume_instr_config_t * | p_suspend_resume_instr_cfg | Automode suspend and resume instruction configuration. |
| struct ospi_w_instance_ctrl_t |
Instance control block. DO NOT INITIALIZE. Initialization occurs when spi_flash_api_t::open is called
| Data Fields | ||
|---|---|---|
| spi_flash_cfg_t const * | p_cfg | Pointer to initial configuration. |
| uint32_t | open | Whether or not driver is open. |
| spi_flash_protocol_t | spi_protocol | Current OSPI protocol selected. |
| ospi_w_device_number_t | channel | Device number to be used for memory device. |
| ospi_w_xspi_command_set_t const * | p_cmd_set | Command set for the active protocol mode. |
| enum ospi_w_device_io_dir |
OSPI_W IO2/IO3 pad value
OSPI_W IO4-7 pads values
OSPI_W HREADY signal mode when accessing the WRITEDATA, READDATA and DUMMYDATA registers
OSPI_W clock edge setting for the sampling of the incoming data when the read pipe is disabled
OSPI_W read pipe setting When read pipe is disabled the sampling clock is determined by ospi_w_device_sampling_edge while when is enabled by ospi_w_device_read_pipe_delay. In ASIC is always recommended to enable read pipe and set the ospi_w_device_read_pipe_delay to the optimal value.
OSPI_W Read pipe clock delay in relation to the falling edge of OSPI_SCK
| fsp_err_t R_OSPI_W_Open | ( | spi_flash_ctrl_t *const | p_ctrl, |
| spi_flash_cfg_t const *const | p_cfg | ||
| ) |
Open the OSPI driver module. After the driver is open, the OSPI can be accessed like internal flash memory.
Implements spi_flash_api_t::open.
Example:
| FSP_SUCCESS | Configuration was successful. |
| FSP_ERR_ASSERTION | The parameter p_ctrl or p_cfg is NULL. |
| FSP_ERR_ALREADY_OPEN | Driver has already been opened with the same p_ctrl. |
| FSP_ERR_INVALID_ARGUMENT | Attempting to open the driver with an invalid SPI protocol for OctaRAM. |
| fsp_err_t R_OSPI_W_Close | ( | spi_flash_ctrl_t *const | p_ctrl | ) |
Close the OSPI driver module.
Implements spi_flash_api_t::close.
| FSP_SUCCESS | Configuration was successful. |
| FSP_ERR_ASSERTION | p_instance_ctrl is NULL. |
| FSP_ERR_NOT_OPEN | Driver is not opened. |
| fsp_err_t R_OSPI_W_DirectWrite | ( | spi_flash_ctrl_t *const | p_ctrl, |
| uint8_t const *const | p_src, | ||
| uint32_t const | bytes, | ||
| bool const | read_after_write | ||
| ) |
Writes raw data directly to the OctaFlash. API not supported. Use R_OSPI_W_DirectTransfer
Implements spi_flash_api_t::directWrite.
| FSP_ERR_UNSUPPORTED | API not supported by OSPI. |
| fsp_err_t R_OSPI_W_DirectRead | ( | spi_flash_ctrl_t *const | p_ctrl, |
| uint8_t *const | p_dest, | ||
| uint32_t const | bytes | ||
| ) |
Reads raw data directly from the OctaFlash. API not supported. Use R_OSPI_W_DirectTransfer.
Implements spi_flash_api_t::directRead.
| FSP_ERR_UNSUPPORTED | API not supported by OSPI. |
| fsp_err_t R_OSPI_W_DirectTransfer | ( | spi_flash_ctrl_t *const | p_ctrl, |
| spi_flash_direct_transfer_t *const | p_transfer, | ||
| spi_flash_direct_transfer_dir_t | direction | ||
| ) |
Read/Write raw data directly with the OctaFlash.
Implements spi_flash_api_t::directTransfer.
Example:
| FSP_SUCCESS | The flash was programmed successfully. |
| FSP_ERR_ASSERTION | A required pointer is NULL. |
| FSP_ERR_NOT_OPEN | Driver is not opened. |
| FSP_ERR_INVALID_ARGUMENT | The parameters are wrong. |
| fsp_err_t R_OSPI_W_SpiProtocolSet | ( | spi_flash_ctrl_t *const | p_ctrl, |
| spi_flash_protocol_t | spi_protocol | ||
| ) |
Sets the SPI protocol.
Implements spi_flash_api_t::spiProtocolSet.
| FSP_ERR_UNSUPPORTED | API not supported by OSPI. Once the RA6W1/RA6W2 is running, it already be in automode by Booter. |
| fsp_err_t R_OSPI_W_XipEnter | ( | spi_flash_ctrl_t *const | p_ctrl | ) |
Enters XIP (execute in place) mode.
Implements spi_flash_api_t::xipEnter.
| FSP_SUCCESS | XiP mode was entered successfully. |
| FSP_ERR_ASSERTION | A required pointer is NULL. |
| FSP_ERR_NOT_OPEN | Driver is not opened. |
| FSP_ERR_UNSUPPORTED | XiP support is not enabled. |
| fsp_err_t R_OSPI_W_XipExit | ( | spi_flash_ctrl_t *const | p_ctrl | ) |
Exits XIP (execute in place) mode.
Implements spi_flash_api_t::xipExit.
| FSP_SUCCESS | XiP mode was entered successfully. |
| FSP_ERR_ASSERTION | A required pointer is NULL. |
| FSP_ERR_NOT_OPEN | Driver is not opened. |
| FSP_ERR_UNSUPPORTED | XiP support is not enabled. |
| FSP_ERR_INVALID_MODE | Unsupport flash mode. |
| fsp_err_t R_OSPI_W_Write | ( | spi_flash_ctrl_t *const | p_ctrl, |
| uint8_t const *const | p_src, | ||
| uint8_t *const | p_dest, | ||
| uint32_t | byte_count | ||
| ) |
Program a page of data to the flash.
Implements spi_flash_api_t::write.
Example:
| FSP_SUCCESS | The flash was programmed successfully. |
| FSP_ERR_ASSERTION | p_instance_ctrl, p_dest or p_src is NULL, or byte_count crosses a page boundary. |
| FSP_ERR_NOT_OPEN | Driver is not opened. |
| FSP_ERR_INVALID_SIZE | Insufficient space remaining in page or write length is not a multiple of CPU access size when not using the DMAC. |
| FSP_ERR_DEVICE_BUSY | Another Write/Erase transaction is in progress. |
| FSP_ERR_WRITE_FAILED | Write operation failed. |
| FSP_ERR_INVALID_ADDRESS | Destination or source is not aligned to CPU access alignment when not using the DMAC. |
| fsp_err_t R_OSPI_W_Erase | ( | spi_flash_ctrl_t *const | p_ctrl, |
| uint8_t *const | p_device_address, | ||
| uint32_t | byte_count | ||
| ) |
Erase a block or sector of flash. The byte_count must exactly match one of the erase sizes defined in spi_flash_cfg_t. For chip erase, byte_count must be SPI_FLASH_ERASE_SIZE_CHIP_ERASE. If it was opened with auto-erase configuration, it could be called without XIP_Exit() function. Implements spi_flash_api_t::erase.
Example:
| FSP_SUCCESS | The command to erase the flash was executed successfully. |
| FSP_ERR_ASSERTION | p_instance_ctrl or p_device_address is NULL, byte_count doesn't match an erase size defined in spi_flash_cfg_t, or byte_count is set to 0. |
| FSP_ERR_NOT_OPEN | Driver is not opened. |
| FSP_ERR_DEVICE_BUSY | The device is busy. |
| FSP_ERR_WRITE_FAILED | Write operation failed. |
| FSP_ERR_INVALID_ARGUMENT | The parameters are wrong. |
| fsp_err_t R_OSPI_W_StatusGet | ( | spi_flash_ctrl_t *const | p_ctrl, |
| spi_flash_status_t *const | p_status | ||
| ) |
Gets the write or erase status of the flash.
Implements spi_flash_api_t::statusGet.
| FSP_SUCCESS | The write status is in p_status. |
| FSP_ERR_ASSERTION | p_instance_ctrl or p_status is NULL. |
| FSP_ERR_NOT_OPEN | Driver is not opened. |
| fsp_err_t R_OSPI_W_BankSet | ( | spi_flash_ctrl_t *const | p_ctrl, |
| uint32_t | bank | ||
| ) |
Selects the bank to access. Use ospi_w_bank_select_t as the bank value.
Implements spi_flash_api_t::bankSet.
| FSP_ERR_UNSUPPORTED | This function is unsupported. |
| fsp_err_t R_OSPI_W_AutoCalibrate | ( | spi_flash_ctrl_t *const | p_ctrl | ) |
AutoCalibrate the OSPI_W DS signal.
Implements spi_flash_api_t::autoCalibrate.
| FSP_ERR_UNSUPPORTED | Autocalibration support is not enabled. |