AM261x MCU+ SDK: APIs for OSPI

| AM261x MCU+ SDK 26.00.00 |

Sub Modules | Files | Data Structures | Functions | Typedefs
APIs for OSPI
APIs for SOC Specific Device Drivers

## Introduction

This module contains APIs to program and use the OSPI 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

## Files
file | ospi/v0/ospi.h
| OSPI Driver API/interface file.

## Data Structures
struct | OSPI_Attrs
| OSPI instance attributes - used during init time. More...
struct | OSPI_Object
| OSPI driver object. More...
struct | OSPI_Config

## Functions
void | OSPI_init (void)
| This function initializes the OSPI module. More...
void | OSPI_deinit (void)
| This function de-initializes the OSPI module. More...
void | OSPI_Params_init (OSPI_Params *ospiParams)
| Initialize data structure with defaults. More...
OSPI_Handle | OSPI_open (uint32_t index, const OSPI_Params *openParams)
| This function opens a given OSPI peripheral. More...
void | OSPI_close (OSPI_Handle handle)
| Function to close a OSPI peripheral specified by the OSPI handle. More...
OSPI_Handle | OSPI_getHandle (uint32_t index)
| This function returns the handle of an open OSPI Instance from the instance index. More...
int32_t | OSPI_readCmd (OSPI_Handle handle, OSPI_ReadCmdParams *rdParams)
| Function to send specific commands and receive related data from flash. More...
int32_t | OSPI_writeCmd (OSPI_Handle handle, OSPI_WriteCmdParams *wrParams)
| Function to send specific commands and related data to flash. More...
void | OSPI_Transaction_init (OSPI_Transaction *trans)
| Function to initialize the OSPI_Transaction. More...
void | OSPI_ReadCmdParams_init (OSPI_ReadCmdParams *rdParams)
| Function to initialize the OSPI_ReadCmdParams structure. More...
void | OSPI_WriteCmdParams_init (OSPI_WriteCmdParams *wrParams)
| Function to initialize the OSPI_WriteCmdParams structure. More...
uint32_t | OSPI_getInputClk (OSPI_Handle handle)
| This function returns the input clk frequency OSPI was programmed at. More...
uint32_t | OSPI_isDacEnable (OSPI_Handle handle)
| This function checks if the Direct Access Controller mode is enabled. More...
uint32_t | OSPI_isDmaEnable (OSPI_Handle handle)
| This function checks if DMA is enabled for reads. More...
uint32_t | OSPI_isIntrEnable (OSPI_Handle handle)
| This function checks if interrupts are enabled. More...
uint32_t | OSPI_isPhyEnable (OSPI_Handle handle)
| This function checks if the OSPI PHY controller is enabled. More...
uint32_t | OSPI_isDtrEnable (OSPI_Handle handle)
| This function checks if the Dual Transfer Rate (Sampling on both rising and falling edge of the clock) is enabled. More...
int32_t | OSPI_enableDDR (OSPI_Handle handle)
| This function enables the Dual Data Rate (DDR) More...
int32_t | OSPI_enableSDR (OSPI_Handle handle)
| This function enables the Single Data Rate (SDR) More...
int32_t | OSPI_enableDdrRdCmds (OSPI_Handle handle)
| This function sets DDR bit in INSTR_RD register for RD commands. More...
int32_t | OSPI_setRdDataCaptureDelay (OSPI_Handle handle, uint32_t rdDataCapDelay)
| This function sets read data capture cycles in the OSPI controller. More...
void | OSPI_setNumAddrBytes (OSPI_Handle handle, uint32_t numAddrBytes)
| This function set the number of bytes used to send address while reading or writing to flash memory. More...
void | OSPI_setDeviceSize (OSPI_Handle handle, uint32_t pageSize, uint32_t blkSize)
| This function sets the block size and page size of the flash to the device size register in OSPI. More...
void | OSPI_setCmdDummyCycles (OSPI_Handle handle, uint32_t cmdDummyCycles)
| This function sets appropriate dummy cycles to be used while sending STIG commands to flash. More...
void | OSPI_setReadDummyCycles (OSPI_Handle handle, uint32_t dummyCycles)
| This function sets appropriate dummy cycles for flash read. More...
void | OSPI_setWriteDummyCycles (OSPI_Handle handle, uint32_t dummyCycles)
| This function sets appropriate dummy cycles for flash write. More...
void | OSPI_setPhyEnableSuccess (OSPI_Handle handle, uint32_t success)
| This function sets the phyEnableSuccess field in OSPI_Object. Has to be called from flash driver. More...
void | OSPI_setModeBits (OSPI_Handle handle, uint32_t modeBits)
| This function sets mode bits in the mode bit field of OSPI config register. More...
void | OSPI_enableModeBitsCmd (OSPI_Handle handle)
| This function enables mode bits transmission while sending CMDs. More...
void | OSPI_enableModeBitsRead (OSPI_Handle handle)
| This function enables mode bits transmission while reading. More...
uint32_t | OSPI_getPhyEnableSuccess (OSPI_Handle handle)
| This function fetches the phyEnableSuccess field in OSPI_Object. More...
void | OSPI_cmdModeBitSet (OSPI_Handle handle, uint32_t enable)
| This function sets command mode bit. More...
void | OSPI_rdModeBitSet (OSPI_Handle handle, uint32_t enable)
| This function sets Read mode bit. More...
uint32_t | OSPI_getProtocol (OSPI_Handle handle)
| This function returns the current protocol for which the transfer lines in OSPI driver is configured for. More...
void | OSPI_setProtocol (OSPI_Handle handle, uint32_t protocol)
| This function sets the number of transfer lines in the OSPI driver to set the requested protocol. More...
void | OSPI_setDualOpCodeMode (OSPI_Handle handle)
| This function sets OSPI controller to use dual byte opcodes. More...
void | OSPI_clearDualOpCodeMode (OSPI_Handle handle)
| This function sets OSPI controller to not use dual byte opcodes. More...
void | OSPI_setXferOpCodes (OSPI_Handle handle, uint8_t readCmd, uint8_t pageProgCmd)
| This function sets the opcodes for reading and page programming the flash. More...
void | OSPI_setCmdExtType (OSPI_Handle handle, uint32_t cmdExtType)
| This function sets the type of command extension used in dual byte opcode mode. More...
int32_t | OSPI_enableDacMode (OSPI_Handle handle)
| This function enables the Direct Access Mode. More...
int32_t | OSPI_disableDacMode (OSPI_Handle handle)
| This function disables the Direct Access Mode. More...
uint32_t | OSPI_getFlashDataBaseAddr (OSPI_Handle handle)
| This function gets the SOC mapped data base address of the flash. More...
int32_t | OSPI_phyTuneDDR (OSPI_Handle handle, uint32_t flashOffset)
| This function tunes the OSPI PHY for DDR mode to set optimal PHY parameters. More...
int32_t | OSPI_phyTuneSDR (OSPI_Handle handle, uint32_t flashOffset)
int32_t | OSPI_phyTuneGrapher (OSPI_Handle handle, uint32_t flashOffset, uint8_t arrays[5][128][128])
| This function takes a 4x128x128 array and fills it with TX RX DLL data for graphing purpose. More...
void | OSPI_phyGetTuningData (uint32_t *tuningData, uint32_t *tuningDataSize)
| This function returns the address to the attack vector buf required for tuning the PHY. More...
int32_t | OSPI_phyReadAttackVector (OSPI_Handle handle, uint32_t offset)
| This function checks if the attack vector, or the data used for tuning the PHY is present at an offset in the flash. More...
int32_t | OSPI_enablePhy (OSPI_Handle handle)
| This function enables the PHY. More...
int32_t | OSPI_disablePhy (OSPI_Handle handle)
| This function disables the PHY. More...
int32_t | OSPI_enablePhyPipeline (OSPI_Handle handle)
| This function enables the PHY Pipeline. More...
int32_t | OSPI_disablePhyPipeline (OSPI_Handle handle)
| This function disables the PHY Pipeline. More...

## Typedefs
typedef struct OSPI_Config_s * | OSPI_Handle
| A handle that is returned from a OSPI_open() call. More...

## Different OSPI Transfer functions
int32_t | OSPI_readDirect (OSPI_Handle handle, OSPI_Transaction *trans)
| Function to perform direct reads from the flash using DAC controller. More...
int32_t | OSPI_readIndirect (OSPI_Handle handle, OSPI_Transaction *trans)
| Function to perform indirect reads from the flash using INDAC controller. More...
int32_t | OSPI_writeDirect (OSPI_Handle handle, OSPI_Transaction *trans)
| Function to perform direct writes to the flash using DAC controller. More...
int32_t | OSPI_writeIndirect (OSPI_Handle handle, OSPI_Transaction *trans)
| Function to perform indirect writes to the flash using INDAC controller. More...

## Typedef Documentation

## ◆ OSPI_Handle

typedef struct OSPI_Config_s* OSPI_Handle

A handle that is returned from a OSPI_open() call.

## Function Documentation

## ◆ OSPI_init()

void OSPI_init | ( | void |  | ) |

This function initializes the OSPI module.

## ◆ OSPI_deinit()

void OSPI_deinit | ( | void |  | ) |

This function de-initializes the OSPI module.

## ◆ OSPI_Params_init()

void OSPI_Params_init | ( | OSPI_Params * | ospiParams | ) |

Initialize data structure with defaults.

Parameters

  ospiParams | [out] Initialized parameters

## ◆ OSPI_open()

OSPI_Handle OSPI_open | ( | uint32_t | index,
|  | const OSPI_Params * | openParams
| ) |  |

This function opens a given OSPI peripheral.

Precondition
  OSPI controller has been initialized using OSPI_init()

Parameters

  index | Index of config to use in the OSPI_Config array
  openParams | Pointer to parameters to open the driver with

Returns
  A OSPI_Handle on success or a NULL on an error or if it has been opened already

See also
  OSPI_init()
  OSPI_close()

## ◆ OSPI_close()

void OSPI_close | ( | OSPI_Handle | handle | ) |

Function to close a OSPI peripheral specified by the OSPI handle.

Precondition
  OSPI_open() has to be called first

Parameters

  handle | OSPI_Handle returned from OSPI_open()

See also
  OSPI_open()

## ◆ OSPI_getHandle()

OSPI_Handle OSPI_getHandle | ( | uint32_t | index | ) |

This function returns the handle of an open OSPI Instance from the instance index.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  index | Index of config to use in the OSPI_Config array

Returns
  An OSPI_Handle if it has been opened already or NULL otherwise

See also
  OSPI_init()
  OSPI_open()

## ◆ OSPI_readDirect()

int32_t OSPI_readDirect | ( | OSPI_Handle | handle,
|  | OSPI_Transaction * | trans
| ) |  |

Function to perform direct reads from the flash using DAC controller.

Parameters

  handle | OSPI_Handle returned from OSPI_open()
  trans | Pointer to a OSPI_Trans

Returns
  SystemP_SUCCESS on successful read; else error on failure

See also
  OSPI_open

## ◆ OSPI_readIndirect()

int32_t OSPI_readIndirect | ( | OSPI_Handle | handle,
|  | OSPI_Transaction * | trans
| ) |  |

Function to perform indirect reads from the flash using INDAC controller.

Parameters

  handle | OSPI_Handle returned from OSPI_open()
  trans | Pointer to a OSPI_Trans

Returns
  SystemP_SUCCESS on successful read; else error on failure

See also
  OSPI_open

## ◆ OSPI_writeDirect()

int32_t OSPI_writeDirect | ( | OSPI_Handle | handle,
|  | OSPI_Transaction * | trans
| ) |  |

Function to perform direct writes to the flash using DAC controller.

Parameters

  handle | OSPI_Handle returned from OSPI_open()
  trans | Pointer to a OSPI_Trans

Returns
  SystemP_SUCCESS on successful write; else error on failure

See also
  OSPI_open

## ◆ OSPI_writeIndirect()

int32_t OSPI_writeIndirect | ( | OSPI_Handle | handle,
|  | OSPI_Transaction * | trans
| ) |  |

Function to perform indirect writes to the flash using INDAC controller.

Parameters

  handle | OSPI_Handle returned from OSPI_open()
  trans | Pointer to a OSPI_Trans

Returns
  SystemP_SUCCESS on successful write; else error on failure

See also
  OSPI_open

## ◆ OSPI_readCmd()

int32_t OSPI_readCmd | ( | OSPI_Handle | handle,
|  | OSPI_ReadCmdParams * | rdParams
| ) |  |

Function to send specific commands and receive related data from flash.

Parameters

  handle | OSPI_Handle returned from OSPI_open()
  rdParams | Pointer to a OSPI_ReadCmdParams

Returns
  SystemP_SUCCESS if command read was successful; else error on failure

See also
  OSPI_open

## ◆ OSPI_writeCmd()

int32_t OSPI_writeCmd | ( | OSPI_Handle | handle,
|  | OSPI_WriteCmdParams * | wrParams
| ) |  |

Function to send specific commands and related data to flash.

Parameters

  handle | OSPI_Handle returned from OSPI_open()
  wrParams | Pointer to a OSPI_WriteCmdParams

Returns
  SystemP_SUCCESS if command write was successful; else error on failure

See also
  OSPI_open

## ◆ OSPI_Transaction_init()

void OSPI_Transaction_init | ( | OSPI_Transaction * | trans | ) |

Function to initialize the OSPI_Transaction.

Parameters

  trans | Pointer to a OSPI_Transaction

## ◆ OSPI_ReadCmdParams_init()

void OSPI_ReadCmdParams_init | ( | OSPI_ReadCmdParams * | rdParams | ) |

Function to initialize the OSPI_ReadCmdParams structure.

Parameters

  rdParams | Pointer to a OSPI_ReadCmdParams

## ◆ OSPI_WriteCmdParams_init()

void OSPI_WriteCmdParams_init | ( | OSPI_WriteCmdParams * | wrParams | ) |

Function to initialize the OSPI_WriteCmdParams structure.

Parameters

  wrParams | Pointer to a OSPI_WriteCmdParams

## ◆ OSPI_getInputClk()

uint32_t OSPI_getInputClk | ( | OSPI_Handle | handle | ) |

This function returns the input clk frequency OSPI was programmed at.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  OSPI RCLK in Hertz

## ◆ OSPI_isDacEnable()

uint32_t OSPI_isDacEnable | ( | OSPI_Handle | handle | ) |

This function checks if the Direct Access Controller mode is enabled.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  1 if DAC is enabled, 0 otherwise

## ◆ OSPI_isDmaEnable()

uint32_t OSPI_isDmaEnable | ( | OSPI_Handle | handle | ) |

This function checks if DMA is enabled for reads.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  1 if DMA is enabled, 0 otherwise

## ◆ OSPI_isIntrEnable()

uint32_t OSPI_isIntrEnable | ( | OSPI_Handle | handle | ) |

This function checks if interrupts are enabled.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  1 if interrupts are enabled, 0 otherwise

## ◆ OSPI_isPhyEnable()

uint32_t OSPI_isPhyEnable | ( | OSPI_Handle | handle | ) |

This function checks if the OSPI PHY controller is enabled.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  1 if PHY is enabled, 0 otherwise

## ◆ OSPI_isDtrEnable()

uint32_t OSPI_isDtrEnable | ( | OSPI_Handle | handle | ) |

This function checks if the Dual Transfer Rate (Sampling on both rising and falling edge of the clock) is enabled.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  1 if Dual Transfer Rate is enabled, 0 otherwise

## ◆ OSPI_enableDDR()

int32_t OSPI_enableDDR | ( | OSPI_Handle | handle | ) |

This function enables the Dual Data Rate (DDR)

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  SystemP_SUCCESS if DDR successfully enabled, else error on failure

## ◆ OSPI_enableSDR()

int32_t OSPI_enableSDR | ( | OSPI_Handle | handle | ) |

This function enables the Single Data Rate (SDR)

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  SystemP_SUCCESS if SDR successfully enabled, else error on failure

## ◆ OSPI_enableDdrRdCmds()

int32_t OSPI_enableDdrRdCmds | ( | OSPI_Handle | handle | ) |

This function sets DDR bit in INSTR_RD register for RD commands.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  SystemP_SUCCESS if DDR successfully enabled, else error on failure

## ◆ OSPI_setRdDataCaptureDelay()

int32_t OSPI_setRdDataCaptureDelay | ( | OSPI_Handle | handle,
|  | uint32_t | rdDataCapDelay
| ) |  |

This function sets read data capture cycles in the OSPI controller.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  rdDataCapDelay | Number of read data capture cycles to be programmed

Returns
  SystemP_SUCCESS if read data capture cycles successfully set, else error on failure

## ◆ OSPI_setNumAddrBytes()

void OSPI_setNumAddrBytes | ( | OSPI_Handle | handle,
|  | uint32_t | numAddrBytes
| ) |  |

This function set the number of bytes used to send address while reading or writing to flash memory.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  numAddrBytes | Number of address bytes to be used while sending addresses.

## ◆ OSPI_setDeviceSize()

void OSPI_setDeviceSize | ( | OSPI_Handle | handle,
|  | uint32_t | pageSize,
|  | uint32_t | blkSize
| ) |  |

This function sets the block size and page size of the flash to the device size register in OSPI.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  pageSize | Page size of the flash in bytes
  blkSize | Block size of the flash in bytes

## ◆ OSPI_setCmdDummyCycles()

void OSPI_setCmdDummyCycles | ( | OSPI_Handle | handle,
|  | uint32_t | cmdDummyCycles
| ) |  |

This function sets appropriate dummy cycles to be used while sending STIG commands to flash.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  cmdDummyCycles | Dummy cycles to be used for STIG cmd

## ◆ OSPI_setReadDummyCycles()

void OSPI_setReadDummyCycles | ( | OSPI_Handle | handle,
|  | uint32_t | dummyCycles
| ) |  |

This function sets appropriate dummy cycles for flash read.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  dummyCycles | Number of dummy cycles

## ◆ OSPI_setWriteDummyCycles()

void OSPI_setWriteDummyCycles | ( | OSPI_Handle | handle,
|  | uint32_t | dummyCycles
| ) |  |

This function sets appropriate dummy cycles for flash write.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  dummyCycles | Number of dummy cycles

## ◆ OSPI_setPhyEnableSuccess()

void OSPI_setPhyEnableSuccess | ( | OSPI_Handle | handle,
|  | uint32_t | success
| ) |  |

This function sets the phyEnableSuccess field in OSPI_Object. Has to be called from flash driver.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  success | Set this to 1 if phy enable was successful. 0 otherwise

## ◆ OSPI_setModeBits()

void OSPI_setModeBits | ( | OSPI_Handle | handle,
|  | uint32_t | modeBits
| ) |  |

This function sets mode bits in the mode bit field of OSPI config register.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  modeBits | Number of mode bits to be set

## ◆ OSPI_enableModeBitsCmd()

void OSPI_enableModeBitsCmd | ( | OSPI_Handle | handle | ) |

This function enables mode bits transmission while sending CMDs.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

## ◆ OSPI_enableModeBitsRead()

void OSPI_enableModeBitsRead | ( | OSPI_Handle | handle | ) |

This function enables mode bits transmission while reading.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

## ◆ OSPI_getPhyEnableSuccess()

uint32_t OSPI_getPhyEnableSuccess | ( | OSPI_Handle | handle | ) |

This function fetches the phyEnableSuccess field in OSPI_Object.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  1 if phyEnable was successful, 0 otherwise.

## ◆ OSPI_cmdModeBitSet()

void OSPI_cmdModeBitSet | ( | OSPI_Handle | handle,
|  | uint32_t | enable
| ) |  |

This function sets command mode bit.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  enable | command mode bit enable/disable

## ◆ OSPI_rdModeBitSet()

void OSPI_rdModeBitSet | ( | OSPI_Handle | handle,
|  | uint32_t | enable
| ) |  |

This function sets Read mode bit.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  enable | Read mode bit enable/disable

## ◆ OSPI_getProtocol()

uint32_t OSPI_getProtocol | ( | OSPI_Handle | handle | ) |

This function returns the current protocol for which the transfer lines in OSPI driver is configured for.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  protocol Protocol being used

## ◆ OSPI_setProtocol()

void OSPI_setProtocol | ( | OSPI_Handle | handle,
|  | uint32_t | protocol
| ) |  |

This function sets the number of transfer lines in the OSPI driver to set the requested protocol.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  protocol | Protocol to be used

## ◆ OSPI_setDualOpCodeMode()

void OSPI_setDualOpCodeMode | ( | OSPI_Handle | handle | ) |

This function sets OSPI controller to use dual byte opcodes.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

## ◆ OSPI_clearDualOpCodeMode()

void OSPI_clearDualOpCodeMode | ( | OSPI_Handle | handle | ) |

This function sets OSPI controller to not use dual byte opcodes.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

## ◆ OSPI_setXferOpCodes()

void OSPI_setXferOpCodes | ( | OSPI_Handle | handle,
|  | uint8_t | readCmd,
|  | uint8_t | pageProgCmd
| ) |  |

This function sets the opcodes for reading and page programming the flash.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  readCmd | Command opcode to be used for reading from the flash
  pageProgCmd | Command opcode to be used for writing to / programming the flash

## ◆ OSPI_setCmdExtType()

void OSPI_setCmdExtType | ( | OSPI_Handle | handle,
|  | uint32_t | cmdExtType
| ) |  |

This function sets the type of command extension used in dual byte opcode mode.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  cmdExtType | Type of command extension used. As of now only two types are supported - REPEAT and INVERSE

## ◆ OSPI_enableDacMode()

int32_t OSPI_enableDacMode | ( | OSPI_Handle | handle | ) |

This function enables the Direct Access Mode.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  SystemP_SUCCESS on success, SystemP_FAILURE otherwise

## ◆ OSPI_disableDacMode()

int32_t OSPI_disableDacMode | ( | OSPI_Handle | handle | ) |

This function disables the Direct Access Mode.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  SystemP_SUCCESS on success, SystemP_FAILURE otherwise

## ◆ OSPI_getFlashDataBaseAddr()

uint32_t OSPI_getFlashDataBaseAddr | ( | OSPI_Handle | handle | ) |

This function gets the SOC mapped data base address of the flash.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  Data BaseAddress of the flash

## ◆ OSPI_phyTuneDDR()

int32_t OSPI_phyTuneDDR | ( | OSPI_Handle | handle,
|  | uint32_t | flashOffset
| ) |  |

This function tunes the OSPI PHY for DDR mode to set optimal PHY parameters.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  flashOffset | Offset of the flash at which the PHY tuning data is present

Returns
  SystemP_SUCCESS on success, SystemP_FAILURE otherwise

## ◆ OSPI_phyTuneSDR()

int32_t OSPI_phyTuneSDR | ( | OSPI_Handle | handle,
|  | uint32_t | flashOffset
| ) |  |

## ◆ OSPI_phyTuneGrapher()

int32_t OSPI_phyTuneGrapher | ( | OSPI_Handle | handle,
|  | uint32_t | flashOffset,
|  | uint8_t | arrays[5][128][128]
| ) |  |

This function takes a 4x128x128 array and fills it with TX RX DLL data for graphing purpose.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  flashOffset | Offset of the flash at which the PHY tuning data is present
  arrays | A 4x128x128 array. In this, the tx rx dll data for 4 different read delay values will be stored. This can be later used for graphing

Returns
  SystemP_SUCCESS on success, SystemP_FAILURE otherwise

## ◆ OSPI_phyGetTuningData()

void OSPI_phyGetTuningData | ( | uint32_t * | tuningData,
|  | uint32_t * | tuningDataSize
| ) |  |

This function returns the address to the attack vector buf required for tuning the PHY.

Parameters

  tuningData | Address of the tuningData array
  tuningDataSize | Size of the tuningData array

## ◆ OSPI_phyReadAttackVector()

int32_t OSPI_phyReadAttackVector | ( | OSPI_Handle | handle,
|  | uint32_t | offset
| ) |  |

This function checks if the attack vector, or the data used for tuning the PHY is present at an offset in the flash.

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()
  offset | Offset in flash to check for tuningData

Returns
  SystemP_SUCCESS on success, SystemP_FAILURE otherwise

## ◆ OSPI_enablePhy()

int32_t OSPI_enablePhy | ( | OSPI_Handle | handle | ) |

This function enables the PHY.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  SystemP_SUCCESS on success, SystemP_FAILURE otherwise

## ◆ OSPI_disablePhy()

int32_t OSPI_disablePhy | ( | OSPI_Handle | handle | ) |

This function disables the PHY.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  SystemP_SUCCESS on success, SystemP_FAILURE otherwise

## ◆ OSPI_enablePhyPipeline()

int32_t OSPI_enablePhyPipeline | ( | OSPI_Handle | handle | ) |

This function enables the PHY Pipeline.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  SystemP_SUCCESS on success, SystemP_FAILURE otherwise

## ◆ OSPI_disablePhyPipeline()

int32_t OSPI_disablePhyPipeline | ( | OSPI_Handle | handle | ) |

This function disables the PHY Pipeline.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPI_Handle returned from an OSPI_open()

Returns
  SystemP_SUCCESS on success, SystemP_FAILURE otherwise

## Variable Documentation

## ◆ gOspiConfig

OSPI_Config gOspiConfig[]
| extern

Externally defined driver configuration array.

## ◆ gOspiConfigNum

uint32_t gOspiConfigNum
| extern

Externally defined driver configuration array size.

## ◆ gOspiDmaConfig

OSPI_DmaConfig gOspiDmaConfig[]
| extern