![]() |
RA Flexible Software Package Documentation
Release v6.0.0
|
|
Driver for the OSPI_B peripheral on RA MCUs. This module implements the SPI Flash Interface.
The OSPI_B peripheral supports xSPI (or OSPI) compatible external memory devices, and it interfaces with these devices to perform data I/O Operations. The OSPI_B peripheral does not support addressable devices, so all connected memory devices must be connected to an individual chip-select pin. Please note that this document will reference the xSPI protocol to which OSPI is a subset. The OSPI_B peripheral is compatible with a variety of xSPI protocol operating modes.
The OSPI_B driver has the following key features to support the xSPI device:
Additional build-time features:
Configuration | Options | Default | Description |
---|---|---|---|
Memory-mapping Support | |||
Prefetch Function |
| Enable | Enable prefetch function on memory-mapped reads. |
Combination Function | Refer to the RA Configuration tool for available options. | 64 Bytes | Enable combination function on memory-mapped writes. |
XiP Support |
| Disable | 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 | Enable DMAC support for the OSPI module. |
Autocalibration Support |
| Disable | Enable DS autocalibration for dual-data-rate modes. |
DOTF Support |
| Disable | Enable DOTF support for the OSPI module. |
Row Addressing Support |
| Disable | Enable support for xSPI devices which utilize row-column addressing of the memory array. |
Configuration | Options | Default | Description |
---|---|---|---|
General | |||
Name | Name must be a valid C symbol | g_ospi0 | Module name. |
Unit | MCU Specific Options | Specify the OSPI peripheral to use. | |
Chip Select |
| CS1 | Specify the OSPI chip select line to use. |
Write Status Bit |
| b0 | Which bit contains the write in progress status returned from the Write Status Command. |
Write Enable Bit |
| b1 | Which bit contains the write enable status returned from the Write Enable Command. |
DS Auto-calibration Pattern Address | Must be a valid pointer address | 0 | Address to the auto-calibration pattern in the target flash memory's address space. |
Command Sets | |||
Command Sets > Custom Table | |||
Table Pointer | Must be a vaild C symbol | Specify the custom command set table (ospi_b_xspi_command_set_t[]) to use. If provided, all other command set settings are ignored. | |
Table Length | Length must be an integer greater than or equal to zero. | 0 | Length of the custom command set table. |
Command Sets > Erase Sizes | |||
Sector Erase | Erase size must be an integer greater-than or equal-to zero and less than 4,294,967,296 (0xFFFF_FFFF). | 4096 | Size of the memory region erased by Sector Erase |
Block Erase | Erase size must be an integer greater-than or equal-to zero and less than 4,294,967,296 (0xFFFF_FFFF). | 262144 | Size of the memory region erased by Block Erase |
Command Sets > Initial Mode | |||
Command Sets > Initial Mode > Read | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0x13 | Read command code. Set to 0x00 to disable. |
Dummy Cycles | Dummy cycle counts must be an integer between 0 and 31. | 0 | Dummy cycles to use between the address and data phase for Read commands. Set to 0 to disable dummy cycles. |
Command Sets > Initial Mode > Program | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0x12 | Program command code. Set to 0x00 to disable. |
Dummy Cycles | Dummy cycle counts must be an integer between 0 and 31. | 0 | Dummy cycles to use between the address and data phase for Program commands. Set to 0 to disable dummy cycles. |
Command Sets > Initial Mode > Row Load | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0x00 | Row Load command code. Set to 0x00 to disable. |
Dummy Cycles | Dummy cycle counts must be an integer between 0 and 31. | 0 | Dummy cycles to use between the address and data phase for Row Load commands. Set to 0 to disable dummy cycles. |
Command Sets > Initial Mode > Row Store | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0x00 | Row Store command code. Set to 0x00 to disable. |
Dummy Cycles | Dummy cycle counts must be an integer between 0 and 31. | 0 | Dummy cycles to use between the address and data phase for Row Store commands. Set to 0 to disable dummy cycles. |
Command Sets > Initial Mode > Write Enable | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0x06 | Write Enable command code. Set to 0x00 to disable. |
Command Sets > Initial Mode > Status Read | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0x05 | Status Read command code. Set to 0x00 to disable. |
Dummy Cycles | Dummy cycle counts must be an integer between 0 and 31. | 0 | Dummy cycles to use between the address and data phase for Status Read commands. Set to 0 to disable dummy cycles. |
Command Sets > Initial Mode > Sector Erase | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0x21 | Sector Erase command code. Set to 0x00 to disable. |
Command Sets > Initial Mode > Block Erase | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0xDC | Block Erase command code. Set to 0x00 to disable. |
Command Sets > Initial Mode > Chip Erase | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0x60 | Chip Erase command code. Set to 0x00 to disable. |
Protocol Mode |
| SPI (1S-1S-1S) | Signal protocol mode to use for this command set. |
Frame Format |
| Standard | Frame format to use with this command set. |
Latency Mode |
| Fixed | Latency mode to use with this command set. |
Address Length |
| 3 bytes | Number of bytes used to address data in a memory page or row. |
Address MSB Mask | Address mask must be between 0x00 and 0xFF. | 0xF0 | Mask of bits to zero for the most-significant byte of the address stage during memory-mapped operations |
Command Code Length |
| 1 byte | |
Status Register Address Length |
| No address | Number of bytes used for addressing the status register. |
Status Register Address | Status register address must be between 0x00 and 0xFFFF_FFFF, inclusive. | 0x00 | Address of the status register that reports Write-in-Progress and Write-Enable flags. |
Command Sets > High-speed Mode | |||
Command Sets > High-speed Mode > Read | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0xEEEE | Read command code. Set to 0x00 to disable. |
Dummy Cycles | Dummy cycle counts must be an integer between 0 and 31. | 20 | Dummy cycles to use between the address and data phase for Read commands. Set to 0 to disable dummy cycles. |
Command Sets > High-speed Mode > Program | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0x1212 | Program command code. Set to 0x00 to disable. |
Dummy Cycles | Dummy cycle counts must be an integer between 0 and 31. | 0 | Dummy cycles to use between the address and data phase for Program commands. Set to 0 to disable dummy cycles. |
Command Sets > High-speed Mode > Row Load | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0x00 | Row Load command code. Set to 0x00 to disable. |
Dummy Cycles | Dummy cycle counts must be an integer between 0 and 31. | 0 | Dummy cycles to use between the address and data phase for Row Load commands. Set to 0 to disable dummy cycles. |
Command Sets > High-speed Mode > Row Store | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0x00 | Row Store command code. Set to 0x00 to disable. |
Dummy Cycles | Dummy cycle counts must be an integer between 0 and 31. | 0 | Dummy cycles to use between the address and data phase for Row Store commands. Set to 0 to disable dummy cycles. |
Command Sets > High-speed Mode > Write Enable | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0x0606 | Write Enable command code. Set to 0x00 to disable. |
Command Sets > High-speed Mode > Status Read | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0x0505 | Status Read command code. Set to 0x00 to disable. |
Dummy Cycles | Dummy cycle counts must be an integer between 0 and 31. | 3 | Dummy cycles to use between the address and data phase for Status Read commands. Set to 0 to disable dummy cycles. |
Command Sets > High-speed Mode > Sector Erase | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0x2121 | Sector Erase command code. Set to 0x00 to disable. |
Command Sets > High-speed Mode > Block Erase | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0xDCDC | Block Erase command code. Set to 0x00 to disable. |
Command Sets > High-speed Mode > Chip Erase | |||
Command Code | Command codes must be positive and fit in the selected command byte length. | 0x6060 | Chip Erase command code. Set to 0x00 to disable. |
Protocol Mode |
| Dual data rate OPI (8D-8D-8D) | Signal protocol mode to use for this command set. |
Frame Format |
| xSPI Profile 1.0 | Frame format to use with this command set. |
Latency Mode |
| Fixed | Latency mode to use with this command set. |
Address Length |
| 4 bytes | Number of bytes used to address data in a memory page or row. |
Address MSB Mask | Address mask must be between 0x00 and 0xFF. | 0xF0 | Mask of bits to zero for the most-significant byte of the address stage during memory-mapped operations |
Command Code Length |
| 2 bytes | |
Status Register Address Length |
| 4 bytes | Number of bytes used for addressing the status register. |
Status Register Address | Status register address must be between 0x00 and 0xFFFF_FFFF, inclusive. | 0x00 | Address of the status register that reports Write-in-Progress and Write-Enable flags. |
Timing Settings | |||
Timing Settings > Chip Select | |||
Command Interval | Refer to the RA Configuration tool for available options. | 2 cycles | Minimum clock cycles between two consecutive xSPI frames (CS idle time). |
Pull-up Timing |
| No Extension | Signal pull-up timing (CS asserting extension) setting in OCTACLK units |
Pull-down Timing |
| No Extension | Signal pull-down timing (CS negating extension) setting in OCTACLK units |
Timing Settings > SDR | |||
Drive Timing |
| Drive 1/2 cycle before CK | Data signal timing relative to the rising-edge of the CK signal. |
CK Sampling Edge |
| Falling edge | Selects the clock edge to sample the data signal. |
Sampling Delay |
| None | Number of cycles to delay before sampling the data signal. |
Timing Settings > DDR | |||
Sampling Window Extension |
| None | Number of cycles to extending the data sampling window in DDR mode. |
DS Latching Delay | Refer to the RA Configuration tool for available options. | Auto-calibrate | Number of delay cells for the data strobe signal. This value must be set to zero if auto-calibration is used. |
XiP Mode | |||
XiP Enter Code | Must be an integer between 0 and 255 | 0 | XiP enter code. |
XiP Exit Code | Must be an integer between 0 and 255 | 0 | XiP exit code. |
DOTF | |||
Name | Name must be a valid C symbol | g_ospi_dotf | DOTF Configuration name. |
AES Key | Name must be a valid C symbol | g_ospi_dotf_key | Name of Key variable. |
AES IV | Name must be a valid C symbol | g_ospi_dotf_iv | Name of IV variable |
AES Key Length | MCU Specific Options | Select AES key length | |
Key Format | MCU Specific Options | Select key format | |
Decryption start address | Value must be an integer between 0x80000000 and 0x9FFFF000 | 0x90000000 | OSPI decryption start address |
Decryption end address | Value must be an integer between 0x80000FFF and 0x9FFFFFFF | 0x90001FFF | OSPI decryption end address |
Row Addressing | |||
Row Address Length |
| No address | Number of bytes used for addressing the row index. |
The signals to the xSPI target device are derived from OCTACLK. OCTACLK must be set to twice the desired OMSCLK signal frequency. This allows data to be latched on either clock edge for Dual-Data-Rate modes (4S-4D-4D or 8D-8D-8D).
Please refer to the Hardware User Manual for the clocks which control the OSPI_B registers. These along with OCTACLK can be set on the Clocks tab of the RA Configuration editor.
The following pins are available to connect to an external OSPI device:
After R_OSPI_B_Open() completes successfully, the xSPI device contents are mapped to the appropriate external memory regions for each OSPI_B unit. For example, on the RA8M1, R_OSPI_B0 maps the CS0 device to address 0x80000000 and the CS1 device to address 0x90000000. After opening, the addresses can be accessed like on-chip flash.
Bank CS0 and CS1 support up to 256 MB of address space each depending on the platform.
If support is enabled, auto-calibration procedures are triggered automatically when the 'Data latching delay' field in the configurator properties is set to 0. The user application is responsible for setting the appropriate preamble pattern before calling R_OSPI_B_Open() when using a data strobe (DS) mode or changing the SPI protocol to a DS mode using the R_OSPI_B_SpiProtocolSet() API. The appropriate preamble pattern can be written to the desired address using the R_OSPI_B_Write() API while in simple SPI mode (recommended), or a non-DS mode. Ensure that the same address is passed through the configurator. If the xSPI device is already in a DS mode, the preamble pattern must be programmed using the debugger before calling R_OSPI_B_Open().
The preamble pattern is expected to be { 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x08, 0x00, 0x00, 0xF7, 0xFF, 0x00, 0x08, 0xF7, 0x00, 0xF7 }
.
Chip select latencies can be set through the configurator. The default settings support SPI at minimum latency. In case the driver is opened in SPI mode and will be switched to DOPI mode later using R_OSPI_B_SpiProtocolSet(), please select latencies required for DOPI before calling R_OSPI_B_Open().
OSPI_B 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_B_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_B_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.
Command sets and erase commands may be specified individually for each supported protocol mode. By default, the configurator only supports an alternative command set for "High-Speed Mode" (DOPI 8D-8D-8D) mode. The command sets cannot be changed during run-time, but the appropriate command set will be selected when changing protocol modes. If a command set is not found, an FSP_ERR_INVALID_MODE
error code will be returned.
If custom DOPI erase commands are not specified, ensure the erase commands are the appropriate 2-byte DOPI commands. The lower byte will be used for 1-byte command protocols.
Decryption-On-The-Fly is configurable for OSPI Flash and is disabled from the build by default.
Using the DOTF feature requires first creating the encrypted blob on the PC and then configuring the DOTF module with the appropriate parameters to allow decryption of the blob once it is programmed into OSPI. Use the Security Key Management Tool (https://www.renesas.com/us/en/software-tool/security-key-management-tool) to create the encrypted blob.
Example: To encrypt a 4096 byte area in a input srec file from 0x90000000
to 0x90000FFF
using a 128 AES encryption key FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
and IV 00000000000000000000000000000000
use SKMT with the following arguments:
The values for key, iv and decryption area start and end addresses that were used to create the blob using SKMT must be set in the DOTF configuration in FSP.
Make sure that the Key and IV passed into DOTF configuration are 4 byte aligned. This can be done using a compiler alignment attribute as shown below:
When configuring the DOTF options, make sure that the key format is specified.
Developers should be aware of the following limitations when using the OSPI_B driver:
const
) data used with R_OSPI_B_Write()
is word (4-byte) aligned if the DMAC is not being used. If parameter checking is enabled, the source pointer alignment will be verified for calls to R_OSPI_B_Write()
.const
qualified to be downloaded by the debugger.The following definitions are used across various example snippets below.
This is a basic example of minimal use of the OSPI in an application with OctaFlash.
This is an example of using R_OSPI_B_DirectWrite followed by R_OSPI_B_DirectRead to send the read status register command and read back the status register from the device.
This is an example of using R_OSPI_B_SpiProtocolSet to change the operating mode from SPI to DOPI and allow the driver to initiate auto-calibration.
This is an example of using R_BSP_OctaclkUpdate to change the Octal-SPI clock frequency during run time. The OCTACLK frequency must be updated before calling the R_OSPI_B_SpiProtocolSet with appropriate clock source and divider settings required to be set for the new SPI protocol mode. Ensure that the clock source selected is started.
This is an example of using custom command sets for 8D-8D-8D and 4S-4S-4S protocol modes.
This is an example of using R_OSPI_B_DirectTransfer to change the attached flash device to a new protocol mode during run time.
Data Structures | |
struct | ospi_b_table_t |
struct | ospi_b_timing_setting_t |
struct | ospi_b_xspi_command_set_t |
struct | ospi_b_dotf_cfg_t |
struct | ospi_b_extended_cfg_t |
struct | ospi_b_instance_ctrl_t |
Macros | |
#define | OSPI_B_MAX_WRITE_ENABLE_POLLING_LOOPS |
Enumerations | |
enum | ospi_b_device_number_t |
enum | ospi_b_command_bytes_t |
enum | ospi_b_command_interval_clocks_t |
enum | ospi_b_command_cs_pullup_clocks_t |
enum | ospi_b_command_cs_pulldown_clocks_t |
enum | ospi_b_ds_timing_delay_t |
enum | ospi_b_sdr_drive_timing_t |
enum | ospi_b_ck_edge_t |
enum | ospi_b_sdr_sampling_delay_t |
enum | ospi_b_ddr_sampling_extension_t |
enum | ospi_b_frame_format_t |
enum | ospi_b_latency_mode_t |
enum | ospi_b_prefetch_function_t |
enum | ospi_b_combination_function_t |
enum | ospi_b_dotf_aes_key_length_words_t |
enum | ospi_b_dotf_aes_key_type_t |
enum | ospi_b_dotf_key_format_t |
struct ospi_b_table_t |
struct ospi_b_timing_setting_t |
Fixed timing configuration for bus signals.
Data Fields | ||
---|---|---|
ospi_b_command_interval_clocks_t | command_to_command_interval | Interval between 2 consecutive commands. |
ospi_b_command_cs_pullup_clocks_t | cs_pullup_lag | Duration to de-assert CS line after the last command. |
ospi_b_command_cs_pulldown_clocks_t | cs_pulldown_lead | Duration to assert CS line before the first command. |
ospi_b_sdr_drive_timing_t | sdr_drive_timing | Data signal timing relative to the rising-edge of the CK signal. |
ospi_b_ck_edge_t | sdr_sampling_edge | Selects the clock edge to sample the data signal. |
ospi_b_sdr_sampling_delay_t | sdr_sampling_delay | Number of cycles to delay before sampling the data signal. |
ospi_b_ddr_sampling_extension_t | ddr_sampling_extension | Number of cycles to extending the data sampling window in DDR mode. |
struct ospi_b_xspi_command_set_t |
Command set used for a protocol mode.
Data Fields | ||
---|---|---|
spi_flash_protocol_t | protocol | Protocol mode associated with this command set. |
ospi_b_frame_format_t | frame_format | Frame format to use for this command set. |
ospi_b_latency_mode_t | latency_mode | Configurable or variable latency, only valid for OSPI_B_FRAME_FORMAT_XSPI_PROFILE_2 and OSPI_B_FRAME_FORMAT_XSPI_PROFILE_2_EXTENDED. |
ospi_b_command_bytes_t | command_bytes | Number of command bytes for each command code. |
spi_flash_address_bytes_t | address_bytes | Number of bytes used during the address phase. |
uint16_t | read_command | Read command. |
uint16_t | program_command | Memory 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. |
uint16_t | row_load_command | Load a page into the device's internal buffer, set to 0x00 to ignore. |
uint16_t | row_store_command | Stores the device's internal buffer to the memory page, 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 | row_load_dummy_cycles | Dummy cycles to be inserted for the page load command. |
uint8_t | row_store_dummy_cycles | Dummy cycles to be inserted for the page store command. |
uint8_t | address_msb_mask | Mask of bits to zero when using memory-mapped operations; only applies to the most-significant byte. |
bool | status_needs_address | Indicates that reading the status register requires an address stage. |
uint32_t | status_address | Address to use for reading the status register with "busy" and "write-enable" flags. |
spi_flash_address_bytes_t | status_address_bytes | Number of bytes used for status register addressing. |
ospi_b_table_t const * | p_erase_commands | List of all erase commands and associated sizes. |
struct ospi_b_dotf_cfg_t |
This structure is used to hold all the DOTF related configuration.
struct ospi_b_extended_cfg_t |
OSPI_B Extended configuration.
Data Fields | ||
---|---|---|
uint8_t | ospi_b_unit | The OSPI_B unit corresponding to the selected channel. |
ospi_b_device_number_t | channel | Device number to be used for memory device. |
ospi_b_timing_setting_t const * | p_timing_settings | Fixed protocol timing settings. |
ospi_b_table_t const * | p_xspi_command_set | Additional protocol command sets; if additional protocol commands set are not used set this to NULL. |
ospi_b_ds_timing_delay_t | data_latch_delay_clocks | Delay after assertion of the DS signal where data should be latched. |
uint8_t * | p_autocalibration_preamble_pattern_addr | OctaFlash memory address holding the preamble pattern. |
transfer_instance_t const * | p_lower_lvl_transfer | DMA Transfer instance used for data transmission. |
struct ospi_b_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_b_device_number_t | channel | Device number to be used for memory device. |
uint8_t | ospi_b_unit | OSPI_B instance number. |
ospi_b_xspi_command_set_t const * | p_cmd_set | Command set for the active protocol mode. |
R_XSPI0_Type * | p_reg | Address for the OSPI peripheral associated with this channel. |
#define OSPI_B_MAX_WRITE_ENABLE_POLLING_LOOPS |
Maximum number of status polling checks after enabling memory writes.
OSPI frame to frame interval
OSPI data strobe delay.
enum ospi_b_ck_edge_t |
SDR sampling window delay.
DDR sampling window extension.
Format of data frames used for communicating with the target device.
Variable or fixed latency selection for flash devices which can notify the host of requiring additional time.
Combination function settings
OSPI DOTF AES Key Lengths.
PSPI DOTF AES Type.
OSPI DOTF key Type.
fsp_err_t R_OSPI_B_Open | ( | spi_flash_ctrl_t *const | p_ctrl, |
spi_flash_cfg_t const *const | p_cfg | ||
) |
Open the xSPI device. After the driver is open, the xSPI device can be accessed like internal flash memory.
Implements spi_flash_api_t::open.
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_CALIBRATE_FAILED | Failed to perform auto-calibrate. |
fsp_err_t R_OSPI_B_DirectWrite | ( | spi_flash_ctrl_t * | 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_B_DirectTransfer
Implements spi_flash_api_t::directWrite.
FSP_ERR_UNSUPPORTED | API not supported by OSPI. |
fsp_err_t R_OSPI_B_DirectRead | ( | spi_flash_ctrl_t * | p_ctrl, |
uint8_t *const | p_dest, | ||
uint32_t const | bytes | ||
) |
Reads raw data directly from the OctaFlash. API not supported. Use R_OSPI_B_DirectTransfer.
Implements spi_flash_api_t::directRead.
FSP_ERR_UNSUPPORTED | API not supported by OSPI. |
fsp_err_t R_OSPI_B_DirectTransfer | ( | spi_flash_ctrl_t * | 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.
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_t R_OSPI_B_XipEnter | ( | spi_flash_ctrl_t * | 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_B_XipExit | ( | spi_flash_ctrl_t * | 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_t R_OSPI_B_Write | ( | spi_flash_ctrl_t * | 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.
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_B_Erase | ( | spi_flash_ctrl_t * | 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.
Implements spi_flash_api_t::erase.
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_t R_OSPI_B_StatusGet | ( | spi_flash_ctrl_t * | 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_B_BankSet | ( | spi_flash_ctrl_t * | p_ctrl, |
uint32_t | bank | ||
) |
Selects the bank to access. Use ospi_b_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_B_SpiProtocolSet | ( | spi_flash_ctrl_t * | p_ctrl, |
spi_flash_protocol_t | spi_protocol | ||
) |
Sets the SPI protocol.
Implements spi_flash_api_t::spiProtocolSet.
FSP_SUCCESS | SPI protocol updated on MPU peripheral. |
FSP_ERR_ASSERTION | A required pointer is NULL. |
FSP_ERR_NOT_OPEN | Driver is not opened. |
FSP_ERR_CALIBRATE_FAILED | Failed to perform auto-calibrate. |
fsp_err_t R_OSPI_B_Close | ( | spi_flash_ctrl_t * | 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_B_AutoCalibrate | ( | spi_flash_ctrl_t *const | p_ctrl | ) |
AutoCalibrate the OSPI_B DS signal.
Implements spi_flash_api_t::autoCalibrate.
FSP_SUCCESS | Autocalibration completed successfully. |
FSP_ERR_ASSERTION | A required pointer is NULL. |
FSP_ERR_NOT_OPEN | Driver is not opened. |
FSP_ERR_UNSUPPORTED | Autocalibration support is not enabled. |
FSP_ERR_CALIBRATE_FAILED | Failed to perform auto-calibrate. |
fsp_err_t R_OSPI_B_RowLoad | ( | spi_flash_ctrl_t *const | p_ctrl, |
uint32_t | row_index | ||
) |
Loads a row into the page buffer on devices which support row addressing.
[in] | p_ctrl | Pointer to a driver handle. |
row_index | Index of the row in the OSPI device. |
FSP_SUCCESS | Page transaction succeeded. |
FSP_ERR_INVALID_ARGUMENT | Invalid argument. |
FSP_ERR_NOT_OPEN | Driver has not been opened. |
FSP_ERR_UNSUPPORTED | Row addressing support is not enabled |
FSP_ERR_DEVICE_BUSY | On going asynchronous operation or the device in in XiP mode. |
fsp_err_t R_OSPI_B_RowStore | ( | spi_flash_ctrl_t *const | p_ctrl, |
uint32_t | row_index | ||
) |
Stores (programs) the page buffer to a row on devices which support row addressing.
[in] | p_ctrl | Pointer to a driver handle. |
row_index | Index of the row in the OSPI device. |
FSP_SUCCESS | Page transaction succeeded. |
FSP_ERR_INVALID_ARGUMENT | Invalid argument. |
FSP_ERR_NOT_OPEN | Driver has not been opened. |
FSP_ERR_UNSUPPORTED | Row addressing support is not enabled |
FSP_ERR_DEVICE_BUSY | On going asynchronous operation or the device in in XiP mode. |
fsp_err_t R_OSPI_B_DOTF_Configure | ( | spi_flash_ctrl_t *const | p_ctrl, |
ospi_b_dotf_cfg_t *const | p_dotf_cfg | ||
) |
Configure DOTF
[in] | p_ctrl | Pointer to OSPI specific control structure |
[in] | p_dotf_cfg | Pointer to DOTF configuration structure |
FSP_SUCCESS | DOTF enabled successfully |
FSP_ERR_CRYPTO_SCE_KEY_SET_FAIL | Key initialization failed. |
FSP_ERR_CRYPTO_SCE_FAIL | Key wrapping failed. |
FSP_ERR_INVALID_ARGUMENT | Invalid key type argument. |
FSP_ERR_UNSUPPORTED | DOTF support is not enabled |