RTEMS
5.0.0
|
#include "chip.h"
#include "stdlib.h"
#include "string.h"
#include <stdint.h>
#include <bsp/iocopy.h>
Macros | |
#define | SCRAMBLE_KEY 0x0BADDEAD |
Functions | |
__STATIC_INLINE void | QSPI_ConfigureMode (Qspi *pQspi, uint8_t dMode) |
Configure QSPI/SPI mode. More... | |
__STATIC_INLINE void | QSPI_Configure (Qspi *pQspi, uint32_t dwConfiguration) |
Configure mode register of QSPI. More... | |
__STATIC_INLINE void | QSPI_SetInstAddr (Qspi *pQspi, uint32_t dwAddr) |
Configures a instruction address for QSPI in QSPI mode. More... | |
__STATIC_INLINE void | QSPI_SetInst (Qspi *pQspi, uint8_t dwInst, uint8_t dwOpt) |
Configures instruction register with a given command for QSPI. More... | |
__STATIC_INLINE void | QSPI_SetInstFrame (Qspi *pQspi, QspiInstFrame_t *pInstFrame) |
Configures instruction frame register of QSPI. More... | |
__STATIC_INLINE uint32_t | QSPI_GetInstFrame (Qspi *pQspi) |
Reads the Instruction frame of QSPI. More... | |
__STATIC_INLINE uint16_t | QSPI_ReadSPI (Qspi *pQspi) |
Read QSPI RDR register for SPI mode. More... | |
__STATIC_INLINE void | QSPI_WriteSPI (Qspi *pQspi, uint16_t wData) |
Write to QSPI Tx register in SPI mode. More... | |
__STATIC_INLINE void | QSPI_ScrambleData (Qspi *pQspi, uint32_t wKey, uint8_t EnableFlag, uint8_t Random) |
Configures QSPI scrambling with a given Key. More... | |
void | QSPI_Enable (Qspi *pQspi) |
Enables a QSPI peripheral. More... | |
void | QSPI_Disable (Qspi *pQspi) |
Disables a QSPI peripheral. More... | |
void | QSPI_SwReset (Qspi *pQspi) |
Resets a QSPI peripheral. More... | |
QspidStatus_t | QSPI_EnableIt (Qspi *pQspi, uint32_t dwSources) |
Enables one or more interrupt sources of a QSPI peripheral. More... | |
QspidStatus_t | QSPI_DisableIt (Qspi *pQspi, uint32_t dwSources) |
Disables one or more interrupt sources of a QSPI peripheral. More... | |
uint32_t | QSPI_GetItMask (Qspi *pQspi) |
Return the interrupt mask register. More... | |
uint32_t | QSPI_GetEnabledItStatus (Qspi *pQspi) |
Returns enabled interrupt status. More... | |
uint32_t | QSPI_GetStatus (Qspi *pQspi, const QspiStatus_t rStatus) |
Get the current status register of the given QSPI peripheral. More... | |
void | QSPI_ConfigureClock (Qspi *pQspi, QspiClockMode_t ClockMode, uint32_t dwClockCfg) |
Configures peripheral clock of a QSPI/SPI peripheral. More... | |
QspidStatus_t | QSPI_ConfigureInterface (Qspid_t *pQspid, QspiMode_t Mode, uint32_t dwConfiguration) |
Configures QSPI/SPI. More... | |
QspidStatus_t | QSPI_EndTransfer (Qspi *pQspi) |
Ends ongoing transfer by releasing CS of QSPI peripheral. More... | |
QspidStatus_t | QSPI_SingleReadSPI (Qspid_t *pQspid, uint16_t *const pData) |
Reads the data received by a SPI peripheral. This method must be called after a successful SPI_Write call. More... | |
QspidStatus_t | QSPI_MultiReadSPI (Qspid_t *pQspid, uint16_t *const pData, uint32_t NumOfBytes) |
Reads multiple data received by a SPI peripheral. This method must be called after a successful SPI_Write call. More... | |
QspidStatus_t | QSPI_SingleWriteSPI (Qspid_t *pQspid, uint16_t const *pData) |
Sends a single data through a SPI peripheral. More... | |
QspidStatus_t | QSPI_MultiWriteSPI (Qspid_t *pQspid, uint16_t const *pData, uint32_t NumOfBytes) |
Sends multiple data through a SPI peripheral. More... | |
QspidStatus_t | QSPI_SendCommand (Qspid_t *pQspid, uint8_t const KeepCfg) |
Send an instruction over QSPI (oly a flash command no data) More... | |
QspidStatus_t | QSPI_SendCommandWithData (Qspid_t *pQspid, uint8_t const KeepCfg) |
Send instruction over QSPI with data. More... | |
QspidStatus_t | QSPI_ReadCommand (Qspid_t *pQspid, uint8_t const KeepCfg) |
Send instruction over QSPI to read data. More... | |
QspidStatus_t | QSPI_EnableMemAccess (Qspid_t *pQspid, uint8_t const KeepCfg, uint8_t ScrambleFlag) |
Sends an instruction over QSPI and configures other related address like Addr , Frame and synchronise bus access before data read or write. More... | |
QspidStatus_t | QSPI_ReadWriteMem (Qspid_t *pQspid, Access_t const ReadWrite) |
Writes or reads the QSPI memory (0x80000000) to transmit or receive data from Flash memory. More... | |
Implementation of Serial Peripheral Interface (QSPI) controller.
__STATIC_INLINE void QSPI_Configure | ( | Qspi * | pQspi, |
uint32_t | dwConfiguration | ||
) |
Configure mode register of QSPI.
pQspi | Pointer to a Qspi instance. |
void QSPI_ConfigureClock | ( | Qspi * | pQspi, |
QspiClockMode_t | ClockMode, | ||
uint32_t | dwClockCfg | ||
) |
Configures peripheral clock of a QSPI/SPI peripheral.
pQspi | Pointer to an Qspi instance. |
dwConfiguration | Desired clock configuration. |
QspidStatus_t QSPI_ConfigureInterface | ( | Qspid_t * | pQspid, |
QspiMode_t | Mode, | ||
uint32_t | dwConfiguration | ||
) |
Configures QSPI/SPI.
pQspi | Pointer to an Qspi instance. |
Mode | Mode for QSPI or SPI |
dwConfiguration | Config of SPI or QSPI mode |
__STATIC_INLINE void QSPI_ConfigureMode | ( | Qspi * | pQspi, |
uint8_t | dMode | ||
) |
Configure QSPI/SPI mode.
pQspi | Pointer to a Qspi instance. |
void QSPI_Disable | ( | Qspi * | pQspi | ) |
Disables a QSPI peripheral.
pQspi | Pointer to a Qspi instance. |
QspidStatus_t QSPI_DisableIt | ( | Qspi * | pQspi, |
uint32_t | dwSources | ||
) |
Disables one or more interrupt sources of a QSPI peripheral.
pQspi | Pointer to a Qspi instance. |
sources | Bitwise OR of selected interrupt sources. |
void QSPI_Enable | ( | Qspi * | pQspi | ) |
Enables a QSPI peripheral.
pQspi | Pointer to a Qspi instance. |
QspidStatus_t QSPI_EnableIt | ( | Qspi * | pQspi, |
uint32_t | dwSources | ||
) |
Enables one or more interrupt sources of a QSPI peripheral.
pQspi | Pointer to a Qspi instance. |
sources | Bitwise OR of selected interrupt sources. |
QspidStatus_t QSPI_EnableMemAccess | ( | Qspid_t * | pQspid, |
uint8_t const | KeepCfg, | ||
uint8_t | ScrambleFlag | ||
) |
Sends an instruction over QSPI and configures other related address like Addr , Frame and synchronise bus access before data read or write.
pQspi | Pointer to an Qspi instance. |
KeepCfg | To keep Instruction from value or resets to zero |
ScrambleFlag | Enable or disable scramble on QSPI |
QspidStatus_t QSPI_EndTransfer | ( | Qspi * | pQspi | ) |
Ends ongoing transfer by releasing CS of QSPI peripheral.
pQspi | Pointer to an Qspi instance. |
uint32_t QSPI_GetEnabledItStatus | ( | Qspi * | pQspi | ) |
Returns enabled interrupt status.
__STATIC_INLINE uint32_t QSPI_GetInstFrame | ( | Qspi * | pQspi | ) |
Reads the Instruction frame of QSPI.
pQspi | Pointer to an Qspi instance. |
uint32_t QSPI_GetItMask | ( | Qspi * | pQspi | ) |
Return the interrupt mask register.
uint32_t QSPI_GetStatus | ( | Qspi * | pQspi, |
const QspiStatus_t | rStatus | ||
) |
Get the current status register of the given QSPI peripheral.
pQspi | Pointer to a Qspi instance. |
rStatus | Compare status with given status bit |
QspidStatus_t QSPI_MultiReadSPI | ( | Qspid_t * | pQspid, |
uint16_t *const | pData, | ||
uint32_t | NumOfBytes | ||
) |
QspidStatus_t QSPI_MultiWriteSPI | ( | Qspid_t * | pQspid, |
uint16_t const * | pData, | ||
uint32_t | NumOfBytes | ||
) |
Sends multiple data through a SPI peripheral.
pQspid | Pointer to a Qspi instance. |
pData | Pointer to a Tx buffer |
NumOfBytes | Num of data to send. |
QspidStatus_t QSPI_ReadCommand | ( | Qspid_t * | pQspid, |
uint8_t const | KeepCfg | ||
) |
Send instruction over QSPI to read data.
pQspi | Pointer to an Qspi instance. |
KeepCfg | To keep Instruction from value or resets to zero |
__STATIC_INLINE uint16_t QSPI_ReadSPI | ( | Qspi * | pQspi | ) |
Read QSPI RDR register for SPI mode.
pQspi | Pointer to an Qspi instance. |
QspidStatus_t QSPI_ReadWriteMem | ( | Qspid_t * | pQspid, |
Access_t const | ReadWrite | ||
) |
Writes or reads the QSPI memory (0x80000000) to transmit or receive data from Flash memory.
pQspi | Pointer to an Qspi instance. |
ReadWrite | Flag to indicate read/write QSPI memory access |
__STATIC_INLINE void QSPI_ScrambleData | ( | Qspi * | pQspi, |
uint32_t | wKey, | ||
uint8_t | EnableFlag, | ||
uint8_t | Random | ||
) |
Configures QSPI scrambling with a given Key.
pQspi | Pointer to an Qspi instance. |
wKey | Key for scramble/unscramble |
EnableFlag | Enable/disable scramble |
Random | Add random value with given key |
QspidStatus_t QSPI_SendCommand | ( | Qspid_t * | pQspid, |
uint8_t const | KeepCfg | ||
) |
Send an instruction over QSPI (oly a flash command no data)
pQspi | Pointer to an Qspi instance. |
KeepCfg | To keep Instruction fram value or restes to zero |
QspidStatus_t QSPI_SendCommandWithData | ( | Qspid_t * | pQspid, |
uint8_t const | KeepCfg | ||
) |
Send instruction over QSPI with data.
pQspi | Pointer to an Qspi instance. |
KeepCfg | To keep Instruction fram value or restes to zero |
__STATIC_INLINE void QSPI_SetInst | ( | Qspi * | pQspi, |
uint8_t | dwInst, | ||
uint8_t | dwOpt | ||
) |
Configures instruction register with a given command for QSPI.
pQspi | Pointer to a Qspi instance. |
dwInst | Instruction Code |
dwOpt | Instruction Code option |
__STATIC_INLINE void QSPI_SetInstAddr | ( | Qspi * | pQspi, |
uint32_t | dwAddr | ||
) |
Configures a instruction address for QSPI in QSPI mode.
pQspi | Pointer to a Qspi instance. |
dwAddr | Instruction Address |
__STATIC_INLINE void QSPI_SetInstFrame | ( | Qspi * | pQspi, |
QspiInstFrame_t * | pInstFrame | ||
) |
Configures instruction frame register of QSPI.
pQspi | Pointer to a Qspi instance. |
pInstFrame | Instruction Frame configuration |
QspidStatus_t QSPI_SingleReadSPI | ( | Qspid_t * | pQspid, |
uint16_t *const | pData | ||
) |
QspidStatus_t QSPI_SingleWriteSPI | ( | Qspid_t * | pQspid, |
uint16_t const * | pData | ||
) |
void QSPI_SwReset | ( | Qspi * | pQspi | ) |
Resets a QSPI peripheral.
pQspi | Pointer to a Qspi instance. |