AM263Px MCU+ SDK: User Interface API's

| AM263Px MCU+ SDK 26.00.00 |

Functions
User Interface API's
APIs for SOC Specific Device Drivers » APIs for OSPI LLD

## Introduction

These APIs try are used for the phy tuning

## Functions
uint32_t | OSPI_lld_getInputClk (OSPILLD_Handle handle)
| This function returns the input clk frequency OSPI was programmed at. More...
uint32_t | OSPI_lld_isDacEnable (OSPILLD_Handle handle)
| This function checks if the Direct Access Controller is enabled. More...
uint32_t | OSPI_lld_isDmaEnable (OSPILLD_Handle handle)
| This function checks if DMA is enabled for reads. More...
uint32_t | OSPI_lld_isIntrEnable (OSPILLD_Handle handle)
| This function checks if interrupts are enabled. More...
uint32_t | OSPI_lld_isPhyEnable (OSPILLD_Handle handle)
| This function checks if the OSPI PHY controller is enabled. More...
int32_t | OSPI_lld_enableDDR (OSPILLD_Handle handle)
| This function enables the Dual Data Rate (DDR) More...
int32_t | OSPI_lld_enableSDR (OSPILLD_Handle handle)
| This function enables the Single Data Rate (SDR) More...
int32_t | OSPI_lld_enableDdrRdCmds (OSPILLD_Handle handle)
| This function sets DDR bit in INSTR_RD register for RD commands. More...
int32_t | OSPI_lld_setRdDataCaptureDelay (OSPILLD_Handle handle, uint32_t rdDataCapDelay)
| This function sets read data capture cycles in the OSPI controller. More...
void | OSPI_lld_setNumAddrBytes (OSPILLD_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_lld_setDeviceSize (OSPILLD_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_lld_setCmdDummyCycles (OSPILLD_Handle handle, uint32_t cmdDummyCycles)
| This function sets appropriate dummy cycles to be used while sending STIG commands to flash. More...
void | OSPI_lld_setReadDummyCycles (OSPILLD_Handle handle, uint32_t dummyCycles)
| This function sets appropriate dummy cycles for flash read. More...
void | OSPI_lld_setWriteDummyCycles (OSPILLD_Handle handle, uint32_t dummyCycles)
| This function sets appropriate dummy cycles for flash write. More...
void | OSPI_lld_setPhyEnableSuccess (OSPILLD_Handle handle, uint32_t success)
| This function sets the phyEnableSuccess field in OSPILLD_Object. Has to be called from flash driver. More...
void | OSPI_lld_setModeBits (OSPILLD_Handle handle, uint32_t modeBits)
| This function sets mode bits in the mode bit field of OSPI config register. More...
void | OSPI_lld_enableModeBitsCmd (OSPILLD_Handle handle)
| This function enables mode bits transmission while sending CMDs. More...
void | OSPI_lld_enableModeBitsRead (OSPILLD_Handle handle)
| This function enables mode bits transmission while reading. More...
uint32_t | OSPI_lld_getPhyEnableSuccess (OSPILLD_Handle handle)
| This function fetches the phyEnableSuccess field in OSPILLD_Object. More...
uint32_t | OSPI_lld_getProtocol (OSPILLD_Handle handle)
| This function returns the current protocol for which the transfer lines in OSPI driver is configured for. More...
void | OSPI_lld_setProtocol (OSPILLD_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_lld_setDualOpCodeMode (OSPILLD_Handle handle)
| This function sets OSPI controller to use dual byte opcodes. More...
void | OSPI_lld_clearDualOpCodeMode (OSPILLD_Handle handle)
| This function sets OSPI controller to not use dual byte opcodes. More...
void | OSPI_lld_setXferOpCodes (OSPILLD_Handle handle, uint8_t readCmd, uint8_t pageProgCmd)
| This function sets the opcodes for reading and page programming the flash. More...
void | OSPI_lld_setCmdExtType (OSPILLD_Handle handle, uint32_t cmdExtType)
| This function sets the type of command extension used in dual byte opcode mode. More...
int32_t | OSPI_lld_enableDacMode (OSPILLD_Handle handle)
| This function enables the Direct Access Mode. More...
int32_t | OSPI_lld_disableDacMode (OSPILLD_Handle handle)
| This function disables the Direct Access Mode. More...
uint32_t | OSPI_lld_getFlashDataBaseAddr (OSPILLD_Handle handle)
| This function gets the SOC mapped data base address of the flash. More...

## Function Documentation

## ◆ OSPI_lld_getInputClk()

uint32_t OSPI_lld_getInputClk | ( | OSPILLD_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 OSPILLD_Handle returned from an OSPI_open()

Returns
  OSPI RCLK in Hertz

## ◆ OSPI_lld_isDacEnable()

uint32_t OSPI_lld_isDacEnable | ( | OSPILLD_Handle | handle | ) |

This function checks if the Direct Access Controller is enabled.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPILLD_Handle returned from an OSPI_open()

Returns
  1 if DAC is enabled, 0 otherwise

## ◆ OSPI_lld_isDmaEnable()

uint32_t OSPI_lld_isDmaEnable | ( | OSPILLD_Handle | handle | ) |

This function checks if DMA is enabled for reads.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPILLD_Handle returned from an OSPI_open()

Returns
  1 if DMA is enabled, 0 otherwise

## ◆ OSPI_lld_isIntrEnable()

uint32_t OSPI_lld_isIntrEnable | ( | OSPILLD_Handle | handle | ) |

This function checks if interrupts are enabled.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPILLD_Handle returned from an OSPI_open()

Returns
  1 if interrupts are enabled, 0 otherwise

## ◆ OSPI_lld_isPhyEnable()

uint32_t OSPI_lld_isPhyEnable | ( | OSPILLD_Handle | handle | ) |

This function checks if the OSPI PHY controller is enabled.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPILLD_Handle returned from an OSPI_open()

Returns
  1 if PHY is enabled, 0 otherwise

## ◆ OSPI_lld_enableDDR()

int32_t OSPI_lld_enableDDR | ( | OSPILLD_Handle | handle | ) |

This function enables the Dual Data Rate (DDR)

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPILLD_Handle returned from an OSPI_open()

Returns
  OSPI_SYSTEM_SUCCESS if DDR successfully enabled, else error on failure

## ◆ OSPI_lld_enableSDR()

int32_t OSPI_lld_enableSDR | ( | OSPILLD_Handle | handle | ) |

This function enables the Single Data Rate (SDR)

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPILLD_Handle returned from an OSPI_open()

Returns
  OSPI_SYSTEM_SUCCESS if SDR successfully enabled, else error on failure

## ◆ OSPI_lld_enableDdrRdCmds()

int32_t OSPI_lld_enableDdrRdCmds | ( | OSPILLD_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 OSPILLD_Handle returned from an OSPI_open()

Returns
  OSPI_SYSTEM_SUCCESS if DDR successfully enabled, else error on failure

## ◆ OSPI_lld_setRdDataCaptureDelay()

int32_t OSPI_lld_setRdDataCaptureDelay | ( | OSPILLD_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 OSPILLD_Handle returned from an OSPI_open()
  rdDataCapDelay | Number of read data capture cycles to be programmed

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

## ◆ OSPI_lld_setNumAddrBytes()

void OSPI_lld_setNumAddrBytes | ( | OSPILLD_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 OSPILLD_Handle returned from an OSPI_open()
  numAddrBytes | Number of address bytes to be used while sending addresses.

## ◆ OSPI_lld_setDeviceSize()

void OSPI_lld_setDeviceSize | ( | OSPILLD_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 OSPILLD_Handle returned from an OSPI_open()
  pageSize | Page size of the flash in bytes
  blkSize | Block size of the flash in bytes

## ◆ OSPI_lld_setCmdDummyCycles()

void OSPI_lld_setCmdDummyCycles | ( | OSPILLD_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 OSPILLD_Handle returned from an OSPI_open()
  cmdDummyCycles | Dummy cycles to be used for STIG cmd

## ◆ OSPI_lld_setReadDummyCycles()

void OSPI_lld_setReadDummyCycles | ( | OSPILLD_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 OSPILLD_Handle returned from an OSPI_open()
  dummyCycles | Number of dummy cycles

## ◆ OSPI_lld_setWriteDummyCycles()

void OSPI_lld_setWriteDummyCycles | ( | OSPILLD_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 OSPILLD_Handle returned from an OSPI_open()
  dummyCycles | Number of dummy cycles

## ◆ OSPI_lld_setPhyEnableSuccess()

void OSPI_lld_setPhyEnableSuccess | ( | OSPILLD_Handle | handle,
|  | uint32_t | success
| ) |  |

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

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

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

## ◆ OSPI_lld_setModeBits()

void OSPI_lld_setModeBits | ( | OSPILLD_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 OSPILLD_Handle returned from an OSPI_open()
  modeBits | Number of mode bits to be set

## ◆ OSPI_lld_enableModeBitsCmd()

void OSPI_lld_enableModeBitsCmd | ( | OSPILLD_Handle | handle | ) |

This function enables mode bits transmission while sending CMDs.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPILLD_Handle returned from an OSPI_open()

## ◆ OSPI_lld_enableModeBitsRead()

void OSPI_lld_enableModeBitsRead | ( | OSPILLD_Handle | handle | ) |

This function enables mode bits transmission while reading.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPILLD_Handle returned from an OSPI_open()

## ◆ OSPI_lld_getPhyEnableSuccess()

uint32_t OSPI_lld_getPhyEnableSuccess | ( | OSPILLD_Handle | handle | ) |

This function fetches the phyEnableSuccess field in OSPILLD_Object.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPILLD_Handle returned from an OSPI_open()

Returns
  1 if phyEnable was successful, 0 otherwise.

## ◆ OSPI_lld_getProtocol()

uint32_t OSPI_lld_getProtocol | ( | OSPILLD_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 OSPILLD_Handle returned from an OSPI_open()

Returns
  protocol Protocol being used

## ◆ OSPI_lld_setProtocol()

void OSPI_lld_setProtocol | ( | OSPILLD_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 OSPILLD_Handle returned from an OSPI_open()
  protocol | Protocol to be used

## ◆ OSPI_lld_setDualOpCodeMode()

void OSPI_lld_setDualOpCodeMode | ( | OSPILLD_Handle | handle | ) |

This function sets OSPI controller to use dual byte opcodes.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPILLD_Handle returned from an OSPI_open()

## ◆ OSPI_lld_clearDualOpCodeMode()

void OSPI_lld_clearDualOpCodeMode | ( | OSPILLD_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 OSPILLD_Handle returned from an OSPI_open()

## ◆ OSPI_lld_setXferOpCodes()

void OSPI_lld_setXferOpCodes | ( | OSPILLD_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 OSPILLD_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_lld_setCmdExtType()

void OSPI_lld_setCmdExtType | ( | OSPILLD_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 OSPILLD_Handle returned from an OSPI_open()
  cmdExtType | Type of command extension used. As of now only two types are supported - REPEAT and INVERSE

## ◆ OSPI_lld_enableDacMode()

int32_t OSPI_lld_enableDacMode | ( | OSPILLD_Handle | handle | ) |

This function enables the Direct Access Mode.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPILLD_Handle returned from an OSPI_open()

Returns
  OSPI_SYSTEM_SUCCESS on success, OSPI_SYSTEM_FAILURE otherwise

## ◆ OSPI_lld_disableDacMode()

int32_t OSPI_lld_disableDacMode | ( | OSPILLD_Handle | handle | ) |

This function disables the Direct Access Mode.

Precondition
  OSPI controller has been opened using OSPI_open()

Parameters

  handle | An OSPILLD_Handle returned from an OSPI_open()

Returns
  OSPI_SYSTEM_SUCCESS on success, OSPI_SYSTEM_FAILURE otherwise

## ◆ OSPI_lld_getFlashDataBaseAddr()

uint32_t OSPI_lld_getFlashDataBaseAddr | ( | OSPILLD_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 OSPILLD_Handle returned from an OSPI_open()

Returns
  Data BaseAddress of the flash