AM263Px MCU+ SDK: APIs for OSPI LLD

| AM263Px MCU+ SDK 26.00.00 |

Sub Modules | Files | Macros
APIs for OSPI LLD
APIs for SOC Specific Device Drivers

## Introduction

This module contains APIs to program and use the OSPI LLD module. The APIs can be used by other drivers to get access to OSPI and also by application to initiate data transfer operation.

## Sub Modules
| Generic NOR Flash API for single pin mode
| Generic Phy layer API.
| OSPI Callback Initialization
| OSPI Read and Write API's
| Transaction Initialization
| User Interface API's

## Files
file | ospi_lld.h
| OSPI LLD Driver API/interface file.

## Macros
#define | OSPI_RESETPIN_DQ3 (0U)
#define | OSPI_RESETPIN_DEDICATED (1U)
#define | CSL_OSPI_BAUD_RATE_DIVISOR(x) (((x) - 2U) >> 1U)
| OSPI controller controller mode baud rate divisor. OSPI baud rate = controller_ref_clk/BD, where BD is: 0000 = /2 0001 = /4 0010 = /6 ... 1111 = /32. More...
#define | MAX_BAUDRATE_DIVIDER (32U)
#define | CSL_OSPI_BAUD_RATE_DIVISOR_DEFAULT (CSL_OSPI_BAUD_RATE_DIVISOR(MAX_BAUDRATE_DIVIDER))

## Transfer Status Code
Status codes that are set by the OSPI driver
#define | OSPI_TRANSFER_COMPLETED (0U)
#define | OSPI_TRANSFER_STARTED (1U)
#define | OSPI_TRANSFER_CANCELLED (2U)
#define | OSPI_TRANSFER_FAILED (3U)
#define | OSPI_TRANSFER_CSN_DEASSERT (4U)
#define | OSPI_TRANSFER_TIMEOUT (5U)

## Transfer Mode
This determines whether the driver operates synchronously or asynchronously In OSPI_TRANSFER_MODE_BLOCKING OSPI_Transfers block code execution until the transaction has completed In OSPI_TRANSFER_MODE_CALLBACK OSPI_Transfers does not block code execution and instead calls a callback function when the transaction has completed
#define | OSPI_TRANSFER_MODE_BLOCKING (0U)
| OSPI_Transfers blocks execution. This mode can only be used when called within a Task context and is interrupt based More...
#define | OSPI_TRANSFER_MODE_CALLBACK (1U)
| OSPI_Transfers does not block code execution and will call a callback function. This mode can be used in a Task, Swi, or Hwi context More...
#define | OSPI_TRANSFER_MODE_POLLING (2U)
| OSPI_Transfers blocks execution. This mode can only be used when called within a Task context and is polling based. More...

## Frame Format
Definitions for various SPI data frame formats POL0 = OSPICLK is held low during the INACTIVE state POL1 = OSPICLK is held high during the INACTIVE state PHA0 = Data launch is on the falling edge of OSPICLK PHA1 = Data launch is on the rising edge of OSPICLK
#define | OSPI_FF_POL0_PHA0 (0U)
#define | OSPI_FF_POL0_PHA1 (CSL_OSPI_FLASH_CFG_CONFIG_REG_SEL_CLK_PHASE_FLD_MASK | 0U)
#define | OSPI_FF_POL1_PHA0 (0U | CSL_OSPI_FLASH_CFG_CONFIG_REG_SEL_CLK_POL_FLD_MASK)
#define | OSPI_FF_POL1_PHA1

## Macros for invalid commands
Macros for invalid commands
#define | OSPI_CMD_INVALID_OPCODE (0xFFU)
#define | OSPI_CMD_INVALID_DUMMY (0xFFU)
#define | OSPI_CMD_INVALID_ADDR (0xFFFFFFFFU)

## Macros for command extension types
Macros for command extension types
#define | OSPI_CMD_EXT_TYPE_REPEAT (0x00U)
#define | OSPI_CMD_EXT_TYPE_INVERSE (0x01U)
#define | OSPI_CMD_EXT_TYPE_NONE (0x02U)

## Macros for OSPI protocol types
Macros for protocol types
#define | OSPI_NOR_PROTOCOL(cmd, addr, data, dtr)
#define | OSPI_NOR_PROTOCOL_INVALID (uint32_t)(0xFFFFFFFF)
#define | OSPI_PROTO_1S_1S_1S (0x0001)
#define | OSPI_PROTO_1S_1S_2S (0x0002)
#define | OSPI_PROTO_1S_1S_4S (0x0003)
#define | OSPI_PROTO_1S_1S_8S (0x0004)
#define | OSPI_PROTO_1S_8S_8S (0x000A)
#define | OSPI_PROTO_4S_4S_4S (0x0005)
#define | OSPI_PROTO_4S_4D_4D (0x0006)
#define | OSPI_PROTO_8S_8S_8S (0x0007)
#define | OSPI_PROTO_8D_8D_8D (0x0008)
#define | OSPI_PROTO_CUSTOM (0x0009)
#define | OSPI_NAND_PROTOCOL(cmd, addr, data, dtr)
#define | OSPI_NAND_PROTOCOL_INVALID (uint32_t)(0xFFFFFFFF)

## Chip Selects
Chip selects
#define | OSPI_CS0 (0U)
#define | OSPI_CS1 (1U)
#define | OSPI_CS2 (2U)
#define | OSPI_CS3 (3U)
#define | OSPI_CHIP_SELECT(x) ((~((1U) << (x))) & 0xFU)
| OSPI Chip select macro. More...

## Decoder Chip Selects
Decoder Chip selects
#define | OSPI_DECODER_SELECT4 ((uint32_t) 0U)
#define | OSPI_DECODER_SELECT16 ((uint32_t) 1U)

## Macro Definition Documentation

## ◆ OSPI_TRANSFER_COMPLETED

#define OSPI_TRANSFER_COMPLETED (0U)

## ◆ OSPI_TRANSFER_STARTED

#define OSPI_TRANSFER_STARTED (1U)

## ◆ OSPI_TRANSFER_CANCELLED

#define OSPI_TRANSFER_CANCELLED (2U)

## ◆ OSPI_TRANSFER_FAILED

#define OSPI_TRANSFER_FAILED (3U)

## ◆ OSPI_TRANSFER_CSN_DEASSERT

#define OSPI_TRANSFER_CSN_DEASSERT (4U)

## ◆ OSPI_TRANSFER_TIMEOUT

#define OSPI_TRANSFER_TIMEOUT (5U)

## ◆ OSPI_TRANSFER_MODE_BLOCKING

#define OSPI_TRANSFER_MODE_BLOCKING (0U)

OSPI_Transfers blocks execution. This mode can only be used when called within a Task context and is interrupt based

## ◆ OSPI_TRANSFER_MODE_CALLBACK

#define OSPI_TRANSFER_MODE_CALLBACK (1U)

OSPI_Transfers does not block code execution and will call a callback function. This mode can be used in a Task, Swi, or Hwi context

## ◆ OSPI_TRANSFER_MODE_POLLING

#define OSPI_TRANSFER_MODE_POLLING (2U)

OSPI_Transfers blocks execution. This mode can only be used when called within a Task context and is polling based.

## ◆ OSPI_FF_POL0_PHA0

#define OSPI_FF_POL0_PHA0 (0U)

## ◆ OSPI_FF_POL0_PHA1

#define OSPI_FF_POL0_PHA1 (CSL_OSPI_FLASH_CFG_CONFIG_REG_SEL_CLK_PHASE_FLD_MASK | 0U)

## ◆ OSPI_FF_POL1_PHA0

#define OSPI_FF_POL1_PHA0 (0U | CSL_OSPI_FLASH_CFG_CONFIG_REG_SEL_CLK_POL_FLD_MASK)

## ◆ OSPI_FF_POL1_PHA1

#define OSPI_FF_POL1_PHA1

Value:
(CSL_OSPI_FLASH_CFG_CONFIG_REG_SEL_CLK_PHASE_FLD_MASK | \
CSL_OSPI_FLASH_CFG_CONFIG_REG_SEL_CLK_POL_FLD_MASK)

## ◆ OSPI_CMD_INVALID_OPCODE

#define OSPI_CMD_INVALID_OPCODE (0xFFU)

## ◆ OSPI_CMD_INVALID_DUMMY

#define OSPI_CMD_INVALID_DUMMY (0xFFU)

## ◆ OSPI_CMD_INVALID_ADDR

#define OSPI_CMD_INVALID_ADDR (0xFFFFFFFFU)

## ◆ OSPI_CMD_EXT_TYPE_REPEAT

#define OSPI_CMD_EXT_TYPE_REPEAT (0x00U)

## ◆ OSPI_CMD_EXT_TYPE_INVERSE

#define OSPI_CMD_EXT_TYPE_INVERSE (0x01U)

## ◆ OSPI_CMD_EXT_TYPE_NONE

#define OSPI_CMD_EXT_TYPE_NONE (0x02U)

## ◆ OSPI_NOR_PROTOCOL

#define OSPI_NOR_PROTOCOL | ( |  | cmd,
|  |  | addr,
|  |  | data,
|  |  | dtr
| ) |  |

Value:
(uint32_t)(((uint32_t)(dtr) << 24) | \
((uint32_t)(cmd) << 16) | \
((uint32_t)(addr) << 8) | \
((uint32_t)(data) << 0))

## ◆ OSPI_NOR_PROTOCOL_INVALID

#define OSPI_NOR_PROTOCOL_INVALID (uint32_t)(0xFFFFFFFF)

## ◆ OSPI_PROTO_1S_1S_1S

#define OSPI_PROTO_1S_1S_1S (0x0001)

## ◆ OSPI_PROTO_1S_1S_2S

#define OSPI_PROTO_1S_1S_2S (0x0002)

## ◆ OSPI_PROTO_1S_1S_4S

#define OSPI_PROTO_1S_1S_4S (0x0003)

## ◆ OSPI_PROTO_1S_1S_8S

#define OSPI_PROTO_1S_1S_8S (0x0004)

## ◆ OSPI_PROTO_1S_8S_8S

#define OSPI_PROTO_1S_8S_8S (0x000A)

## ◆ OSPI_PROTO_4S_4S_4S

#define OSPI_PROTO_4S_4S_4S (0x0005)

## ◆ OSPI_PROTO_4S_4D_4D

#define OSPI_PROTO_4S_4D_4D (0x0006)

## ◆ OSPI_PROTO_8S_8S_8S

#define OSPI_PROTO_8S_8S_8S (0x0007)

## ◆ OSPI_PROTO_8D_8D_8D

#define OSPI_PROTO_8D_8D_8D (0x0008)

## ◆ OSPI_PROTO_CUSTOM

#define OSPI_PROTO_CUSTOM (0x0009)

## ◆ OSPI_NAND_PROTOCOL

#define OSPI_NAND_PROTOCOL | ( |  | cmd,
|  |  | addr,
|  |  | data,
|  |  | dtr
| ) |  |

Value:
(uint32_t)(((uint32_t)(dtr) << 24) | \
((uint32_t)(cmd) << 16) | \
((uint32_t)(addr) << 8) | \
((uint32_t)(data) << 0))

## ◆ OSPI_NAND_PROTOCOL_INVALID

#define OSPI_NAND_PROTOCOL_INVALID (uint32_t)(0xFFFFFFFF)

## ◆ OSPI_CS0

#define OSPI_CS0 (0U)

## ◆ OSPI_CS1

#define OSPI_CS1 (1U)

## ◆ OSPI_CS2

#define OSPI_CS2 (2U)

## ◆ OSPI_CS3

#define OSPI_CS3 (3U)

## ◆ OSPI_CHIP_SELECT

#define OSPI_CHIP_SELECT | ( |  | x | ) | ((~((1U) << (x))) & 0xFU)

OSPI Chip select macro.

## ◆ OSPI_RESETPIN_DQ3

#define OSPI_RESETPIN_DQ3 (0U)

## ◆ OSPI_RESETPIN_DEDICATED

#define OSPI_RESETPIN_DEDICATED (1U)

## ◆ CSL_OSPI_BAUD_RATE_DIVISOR

#define CSL_OSPI_BAUD_RATE_DIVISOR | ( |  | x | ) | (((x) - 2U) >> 1U)

OSPI controller controller mode baud rate divisor. OSPI baud rate = controller_ref_clk/BD, where BD is: 0000 = /2 0001 = /4 0010 = /6 ... 1111 = /32.

## ◆ MAX_BAUDRATE_DIVIDER

#define MAX_BAUDRATE_DIVIDER (32U)

## ◆ CSL_OSPI_BAUD_RATE_DIVISOR_DEFAULT

#define CSL_OSPI_BAUD_RATE_DIVISOR_DEFAULT (CSL_OSPI_BAUD_RATE_DIVISOR(MAX_BAUDRATE_DIVIDER))

## ◆ OSPI_DECODER_SELECT4

#define OSPI_DECODER_SELECT4 ((uint32_t) 0U)

## ◆ OSPI_DECODER_SELECT16

#define OSPI_DECODER_SELECT16 ((uint32_t) 1U)