AM263x MCU+ SDK  08.02.00

Introduction

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

Files

file  qspi/v0/qspi.h
 QSPI Driver API/interface file.
 

Data Structures

struct  QSPI_Transaction
 Data structure used with QSPI_Transfers - QSPI_writeConfigMode, QSPI_readMemMapMode. More...
 
struct  QSPI_ReadCmdParams
 
struct  QSPI_WriteCmdParams
 
struct  QSPI_Params
 QSPI Parameters. More...
 
struct  QSPI_EdmaParams
 QSPI EDMA Parameters. More...
 
struct  QSPI_Object
 QSPI driver object. More...
 
struct  QSPI_Attrs
 QSPI instance attributes - used during init time. More...
 
struct  QSPI_Config
 

Functions

void QSPI_init (void)
 This function initializes the QSPI module. More...
 
void QSPI_deinit (void)
 This function de-initializes the QSPI module. More...
 
void QSPI_Params_init (QSPI_Params *qspiParams)
 Initialize data structure with defaults. More...
 
QSPI_Handle QSPI_open (uint32_t index, const QSPI_Params *openParams)
 This function opens a given QSPI peripheral. More...
 
void QSPI_close (QSPI_Handle handle)
 Function to close a QSPI peripheral specified by the QSPI handle. More...
 
QSPI_Handle QSPI_getHandle (uint32_t index)
 This function returns the handle of an open QSPI Instance from the instance index. More...
 
void QSPI_transaction_init (QSPI_Transaction *trans)
 Function to initialize the QSPI_Transaction structure. More...
 
void QSPI_readCmdParams_init (QSPI_ReadCmdParams *rdParams)
 Function to initialize the QSPI_Transaction structure. More...
 
void QSPI_writeCmdParams_init (QSPI_WriteCmdParams *wrParams)
 Function to initialize the QSPI_Transaction structure. More...
 
int32_t QSPI_readCmd (QSPI_Handle handle, QSPI_ReadCmdParams *rdParams)
 Function to send specific commands and receive related data from flash. More...
 
int32_t QSPI_writeCmd (QSPI_Handle handle, QSPI_WriteCmdParams *wrParams)
 Function to send specific commands and related data to flash. More...
 
int32_t QSPI_setWriteCmd (QSPI_Handle handle, uint8_t command)
 Function to set write command to be used. More...
 
int32_t QSPI_setReadCmd (QSPI_Handle handle, uint8_t command)
 Function to set read command to be used. More...
 
int32_t QSPI_setAddressByteCount (QSPI_Handle handle, uint32_t count)
 Function to set number of address bytes to be used. More...
 
int32_t QSPI_setDummyBitCount (QSPI_Handle handle, uint32_t count)
 Function to set number of dummy bits to be used. More...
 
int32_t QSPI_setMemAddrSpace (QSPI_Handle handle, uint32_t memMappedPortSwitch)
 This function is used to switch between memory mapped and configuration mode. More...
 
int32_t QSPI_intEnable (QSPI_Handle handle, uint32_t intFlag)
 This function is used to enable word or frame complete interrupt. More...
 
int32_t QSPI_intDisable (QSPI_Handle handle, uint32_t intFlag)
 This function is used to disable word or frame complete interrupt. More...
 
int32_t QSPI_intClear (QSPI_Handle handle, uint32_t intFlag)
 This function is used to clear word or frame complete interrupt. More...
 
int32_t QSPI_setPreScaler (QSPI_Handle handle, uint32_t clkDividerVal)
 Set the QSPI clock register divider value. More...
 
void OSPI_phyGetTuningData (uint32_t *tuningData, uint32_t *tuningDataSize)
 

Typedefs

typedef void * QSPI_Handle
 A handle that is returned from a QSPI_open() call. More...
 

Chip Selects

Chip selects

#define QSPI_CS0   (0U)
 
#define QSPI_CS1   (1U)
 
#define QSPI_CS2   (2U)
 
#define QSPI_CS3   (3U)
 

Macros for invalid commands

Macros for invalid commands

#define QSPI_CMD_INVALID_OPCODE   (0xFFU)
 
#define QSPI_CMD_INVALID_ADDR   (0xFFFFFFFFU)
 

Transfer Status Code

Status codes that are set by the QSPI driver

#define QSPI_TRANSFER_COMPLETED   (0U)
 
#define QSPI_TRANSFER_STARTED   (1U)
 
#define QSPI_TRANSFER_CANCELLED   (2U)
 
#define QSPI_TRANSFER_FAILED   (3U)
 
#define QSPI_TRANSFER_CSN_DEASSERT   (4U)
 
#define QSPI_TRANSFER_TIMEOUT   (5U)
 

Transfer Lines Number

Number of lines used for QSPI read transaction

#define QSPI_RX_LINES_SINGLE   (0U)
 
#define QSPI_RX_LINES_DUAL   (1U)
 
#define QSPI_RX_LINES_QUAD   (2U)
 

Frame Format

Definitions for various SPI data frame formats

POL0 = QSPICLK is held low during the INACTIVE state POL1 = QSPICLK is held high during the INACTIVE state

PHA0 = Data launch is on the falling edge of QSPICLK PHA1 = Data launch is on the rising edge of QSPICLK

#define QSPI_FF_POL0_PHA0
 
#define QSPI_FF_POL0_PHA1
 
#define QSPI_FF_POL1_PHA0
 
#define QSPI_FF_POL1_PHA1
 

Chip select polarity

Polarity of Chip Select

#define QSPI_CS_POL_ACTIVE_LOW   (CSL_QSPI_SPI_DC_REG_CSP0_ACTIVE_LOW)
 
#define QSPI_CS_POL_ACTIVE_HIGH   (CSL_QSPI_SPI_DC_REG_CSP0_ACTIVE_HIGH)
 

Data Delay

Value of delay in data output after CS goes active.

#define QSPI_DATA_DELAY_0   (CSL_QSPI_SPI_DC_REG_DD0_CS_TO_DATA_DELAY_0)
 
#define QSPI_DATA_DELAY_1   (CSL_QSPI_SPI_DC_REG_DD0_CS_TO_DATA_DELAY_1)
 
#define QSPI_DATA_DELAY_2   (CSL_QSPI_SPI_DC_REG_DD0_CS_TO_DATA_DELAY_2)
 
#define QSPI_DATA_DELAY_3   (CSL_QSPI_SPI_DC_REG_DD0_CS_TO_DATA_DELAY_3)
 

Different QSPI Transfer functions

int32_t QSPI_readMemMapMode (QSPI_Handle handle, QSPI_Transaction *trans)
 Function to perform reads from the flash in memory mapped mode. More...
 
int32_t QSPI_writeConfigMode (QSPI_Handle handle, QSPI_Transaction *trans)
 Function to perform writes to the flash in configuration mode. More...
 

Macro Definition Documentation

◆ QSPI_CS0

#define QSPI_CS0   (0U)

◆ QSPI_CS1

#define QSPI_CS1   (1U)

◆ QSPI_CS2

#define QSPI_CS2   (2U)

◆ QSPI_CS3

#define QSPI_CS3   (3U)

◆ QSPI_CMD_INVALID_OPCODE

#define QSPI_CMD_INVALID_OPCODE   (0xFFU)

◆ QSPI_CMD_INVALID_ADDR

#define QSPI_CMD_INVALID_ADDR   (0xFFFFFFFFU)

◆ QSPI_TRANSFER_COMPLETED

#define QSPI_TRANSFER_COMPLETED   (0U)

◆ QSPI_TRANSFER_STARTED

#define QSPI_TRANSFER_STARTED   (1U)

◆ QSPI_TRANSFER_CANCELLED

#define QSPI_TRANSFER_CANCELLED   (2U)

◆ QSPI_TRANSFER_FAILED

#define QSPI_TRANSFER_FAILED   (3U)

◆ QSPI_TRANSFER_CSN_DEASSERT

#define QSPI_TRANSFER_CSN_DEASSERT   (4U)

◆ QSPI_TRANSFER_TIMEOUT

#define QSPI_TRANSFER_TIMEOUT   (5U)

◆ QSPI_RX_LINES_SINGLE

#define QSPI_RX_LINES_SINGLE   (0U)

◆ QSPI_RX_LINES_DUAL

#define QSPI_RX_LINES_DUAL   (1U)

◆ QSPI_RX_LINES_QUAD

#define QSPI_RX_LINES_QUAD   (2U)

◆ QSPI_FF_POL0_PHA0

#define QSPI_FF_POL0_PHA0
Value:
((CSL_QSPI_SPI_DC_REG_CKPH0_CKP_0_SHIFT_OUT_FALLING_EDGE \
<< CSL_QSPI_SPI_DC_REG_CKPH0_SHIFT) | \
(CSL_QSPI_SPI_DC_REG_CKP0_DATA_INACTIVE << \
CSL_QSPI_SPI_DC_REG_CKP0_SHIFT))

◆ QSPI_FF_POL0_PHA1

#define QSPI_FF_POL0_PHA1
Value:
((CSL_QSPI_SPI_DC_REG_CKPH0_CKP_0_SHIFT_OUT_RISING_EDGE \
<< CSL_QSPI_SPI_DC_REG_CKPH0_SHIFT) | \
(CSL_QSPI_SPI_DC_REG_CKP0_DATA_INACTIVE << \
CSL_QSPI_SPI_DC_REG_CKP0_SHIFT))

◆ QSPI_FF_POL1_PHA0

#define QSPI_FF_POL1_PHA0
Value:
((CSL_QSPI_SPI_DC_REG_CKPH0_CKP_1_SHIFT_OUT_RISING_EDGE \
<< CSL_QSPI_SPI_DC_REG_CKPH0_SHIFT) | \
(CSL_QSPI_SPI_DC_REG_CKP0_DATA_ACTIVE << \
CSL_QSPI_SPI_DC_REG_CKP0_SHIFT))

◆ QSPI_FF_POL1_PHA1

#define QSPI_FF_POL1_PHA1
Value:
((CSL_QSPI_SPI_DC_REG_CKPH0_CKP_1_SHIFT_OUT_FALLING_EDGE \
<< CSL_QSPI_SPI_DC_REG_CKPH0_SHIFT) | \
(CSL_QSPI_SPI_DC_REG_CKP0_DATA_ACTIVE << \
CSL_QSPI_SPI_DC_REG_CKP0_SHIFT))

◆ QSPI_CS_POL_ACTIVE_LOW

#define QSPI_CS_POL_ACTIVE_LOW   (CSL_QSPI_SPI_DC_REG_CSP0_ACTIVE_LOW)

◆ QSPI_CS_POL_ACTIVE_HIGH

#define QSPI_CS_POL_ACTIVE_HIGH   (CSL_QSPI_SPI_DC_REG_CSP0_ACTIVE_HIGH)

◆ QSPI_DATA_DELAY_0

#define QSPI_DATA_DELAY_0   (CSL_QSPI_SPI_DC_REG_DD0_CS_TO_DATA_DELAY_0)

◆ QSPI_DATA_DELAY_1

#define QSPI_DATA_DELAY_1   (CSL_QSPI_SPI_DC_REG_DD0_CS_TO_DATA_DELAY_1)

◆ QSPI_DATA_DELAY_2

#define QSPI_DATA_DELAY_2   (CSL_QSPI_SPI_DC_REG_DD0_CS_TO_DATA_DELAY_2)

◆ QSPI_DATA_DELAY_3

#define QSPI_DATA_DELAY_3   (CSL_QSPI_SPI_DC_REG_DD0_CS_TO_DATA_DELAY_3)

Typedef Documentation

◆ QSPI_Handle

typedef void* QSPI_Handle

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

Function Documentation

◆ QSPI_init()

void QSPI_init ( void  )

This function initializes the QSPI module.

◆ QSPI_deinit()

void QSPI_deinit ( void  )

This function de-initializes the QSPI module.

◆ QSPI_Params_init()

void QSPI_Params_init ( QSPI_Params qspiParams)

Initialize data structure with defaults.

Parameters
qspiParams[out] Initialized parameters

◆ QSPI_open()

QSPI_Handle QSPI_open ( uint32_t  index,
const QSPI_Params openParams 
)

This function opens a given QSPI peripheral.

Precondition
QSPI controller has been initialized using QSPI_init()
Parameters
indexIndex of config to use in the QSPI_Config array
openParamsPointer to parameters to open the driver with
Returns
A QSPI_Handle on success or a NULL on an error or if it has been opened already
See also
QSPI_init()
QSPI_close()

◆ QSPI_close()

void QSPI_close ( QSPI_Handle  handle)

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

Precondition
QSPI_open() has to be called first
Parameters
handleQSPI_Handle returned from QSPI_open()
See also
QSPI_open()

◆ QSPI_getHandle()

QSPI_Handle QSPI_getHandle ( uint32_t  index)

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

Precondition
QSPI controller has been opened using QSPI_open()
Parameters
indexIndex of config to use in the QSPI_Config array
Returns
A QSPI_Handle if it has been opened already or NULL otherwise
See also
QSPI_init()
QSPI_open()

◆ QSPI_readMemMapMode()

int32_t QSPI_readMemMapMode ( QSPI_Handle  handle,
QSPI_Transaction trans 
)

Function to perform reads from the flash in memory mapped mode.

Parameters
handleQSPI_Handle returned from QSPI_open()
transPointer to a QSPI_Transaction
Returns
SystemP_SUCCESS on successful read; else error on failure
See also
QSPI_open

◆ QSPI_writeConfigMode()

int32_t QSPI_writeConfigMode ( QSPI_Handle  handle,
QSPI_Transaction trans 
)

Function to perform writes to the flash in configuration mode.

Parameters
handleQSPI_Handle returned from QSPI_open()
transPointer to a QSPI_Transaction
Returns
SystemP_SUCCESS on successful write; else error on failure
See also
QSPI_open

◆ QSPI_transaction_init()

void QSPI_transaction_init ( QSPI_Transaction trans)

Function to initialize the QSPI_Transaction structure.

Parameters
transPointer to a QSPI_Transaction

◆ QSPI_readCmdParams_init()

void QSPI_readCmdParams_init ( QSPI_ReadCmdParams rdParams)

Function to initialize the QSPI_Transaction structure.

Parameters
rdParamsPointer to a QSPI_ReadCmdParams

◆ QSPI_writeCmdParams_init()

void QSPI_writeCmdParams_init ( QSPI_WriteCmdParams wrParams)

Function to initialize the QSPI_Transaction structure.

Parameters
wrParamsPointer to a QSPI_WriteCmdParams

◆ QSPI_readCmd()

int32_t QSPI_readCmd ( QSPI_Handle  handle,
QSPI_ReadCmdParams rdParams 
)

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

Parameters
handleQSPI_Handle returned from QSPI_open()
rdParamsPointer to a QSPI_ReadCmdParams
Returns
SystemP_SUCCESS if command read was successful; else error on failure
See also
QSPI_open

◆ QSPI_writeCmd()

int32_t QSPI_writeCmd ( QSPI_Handle  handle,
QSPI_WriteCmdParams wrParams 
)

Function to send specific commands and related data to flash.

Parameters
handleQSPI_Handle returned from QSPI_open()
wrParamsPointer to a QSPI_WriteCmdParams
Returns
SystemP_SUCCESS if command write was successful; else error on failure
See also
QSPI_open

◆ QSPI_setWriteCmd()

int32_t QSPI_setWriteCmd ( QSPI_Handle  handle,
uint8_t  command 
)

Function to set write command to be used.

Parameters
handleQSPI_Handle returned from QSPI_open()
commandWrite command for a particular flash
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ QSPI_setReadCmd()

int32_t QSPI_setReadCmd ( QSPI_Handle  handle,
uint8_t  command 
)

Function to set read command to be used.

Parameters
handleQSPI_Handle returned from QSPI_open()
commandRead command for a particular flash
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ QSPI_setAddressByteCount()

int32_t QSPI_setAddressByteCount ( QSPI_Handle  handle,
uint32_t  count 
)

Function to set number of address bytes to be used.

Parameters
handleQSPI_Handle returned from QSPI_open()
countNumber of Address Bytes. This function should always be called before accessing a memory location that doesn't fit in the current address byte range.
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ QSPI_setDummyBitCount()

int32_t QSPI_setDummyBitCount ( QSPI_Handle  handle,
uint32_t  count 
)

Function to set number of dummy bits to be used.

Parameters
handleQSPI_Handle returned from QSPI_open()
countNumber of Dummy Bits. This should be either less than 8 or a multiple of 8, because Bit count field in setup register works only if Byte count is 0.
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ QSPI_setMemAddrSpace()

int32_t QSPI_setMemAddrSpace ( QSPI_Handle  handle,
uint32_t  memMappedPortSwitch 
)

This function is used to switch between memory mapped and configuration mode.

Parameters
handleA QSPI_Handle returned from a QSPI_open()
memMappedPortSwitchFlag for switching mode.
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ QSPI_intEnable()

int32_t QSPI_intEnable ( QSPI_Handle  handle,
uint32_t  intFlag 
)

This function is used to enable word or frame complete interrupt.

Parameters
handleA QSPI_Handle returned from a QSPI_open()
intFlagFlag for enabling interrupt.
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ QSPI_intDisable()

int32_t QSPI_intDisable ( QSPI_Handle  handle,
uint32_t  intFlag 
)

This function is used to disable word or frame complete interrupt.

Parameters
handleA QSPI_Handle returned from a QSPI_open()
intFlagFlag for disabling interrupt.
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ QSPI_intClear()

int32_t QSPI_intClear ( QSPI_Handle  handle,
uint32_t  intFlag 
)

This function is used to clear word or frame complete interrupt.

Parameters
handleA QSPI_Handle returned from a QSPI_open()
intFlagFlag for clearing interrupt.
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ QSPI_setPreScaler()

int32_t QSPI_setPreScaler ( QSPI_Handle  handle,
uint32_t  clkDividerVal 
)

Set the QSPI clock register divider value.

This function sets the QSPI clock control register with serial data clock divider ratio (DCLK_DIV) according to the input clock provided and the output clock required. DCLK_DIV = ((input clock) / (output clock)) - 1. This function also enables the clock for QSPI module. This can only be done if QSPI module is not busy.

Parameters
handleA QSPI_Handle returned from a QSPI_open()
clkDividerValClock divider value to be set.
Returns
SystemP_SUCCESS on success, SystemP_FAILURE otherwise

◆ OSPI_phyGetTuningData()

void OSPI_phyGetTuningData ( uint32_t *  tuningData,
uint32_t *  tuningDataSize 
)

Variable Documentation

◆ gQspiConfig

QSPI_Config gQspiConfig[]
extern

Externally defined driver configuration array.

◆ gQspiConfigNum

uint32_t gQspiConfigNum
extern

Externally defined driver configuration array size.