RTEMS
5.0.0
|
#include "chip.h"
Go to the source code of this file.
Data Structures | |
struct | _SpidCmd |
Spi Transfer Request prepared by the application upper layer. More... | |
struct | _Spid |
Macros | |
#define | SPID_ERROR 1 |
#define | SPID_ERROR_LOCK 2 |
#define | SPID_CSR_SCBR(mck, spck) SPI_CSR_SCBR((mck) / (spck)) |
#define | SPID_CSR_DLYBS(mck, delay) |
#define | SPID_CSR_DLYBCT(mck, delay) |
Typedefs | |
typedef void(* | SpidCallback) (uint8_t, void *) |
typedef struct _SpidCmd | SpidCmd |
Spi Transfer Request prepared by the application upper layer. More... | |
typedef struct _Spid | Spid |
Functions | |
uint32_t | SPID_Configure (Spid *pSpid, Spi *pSpiHw, uint8_t spiId, uint32_t SpiMode, sXdmad *pXdmad) |
Initializes the Spid structure and the corresponding SPI & DMA hardware. select value. The driver will uses DMA channel 0 for RX and DMA channel 1 for TX. The DMA channels are freed automatically when no SPI command processing. More... | |
void | SPID_ConfigureCS (Spid *pSpid, uint32_t dwCS, uint32_t dwCsr) |
Configures the parameters for the device corresponding to the cs value. More... | |
uint32_t | SPID_SendCommand (Spid *pSpid, SpidCmd *pCommand) |
Starts a SPI master transfer. This is a non blocking function. It will return as soon as the transfer is started. More... | |
void | SPID_Handler (Spid *pSpid) |
void | SPID_DmaHandler (Spid *pSpid) |
uint32_t | SPID_IsBusy (const Spid *pSpid) |
Check if the SPI driver is busy. More... | |
Implementation of SPI driver, transfer data through DMA.
#define SPID_CSR_DLYBCT | ( | mck, | |
delay | |||
) |
Calculates the value of the DLYBCT field of the Chip Select Register given delay in ns and MCK.
#define SPID_CSR_DLYBS | ( | mck, | |
delay | |||
) |
Calculates the value of the DLYBS field of the Chip Select Register given delay in ns and MCK.
#define SPID_CSR_SCBR | ( | mck, | |
spck | |||
) | SPI_CSR_SCBR((mck) / (spck)) |
Calculates the value of the SCBR field of the Chip Select Register given MCK and SPCK.
#define SPID_ERROR 1 |
An unspecified error has occurred.
#define SPID_ERROR_LOCK 2 |
SPI driver is currently in use.
Constant structure associated with SPI port. This structure prevents client applications to have access in the same time.
typedef void(* SpidCallback) (uint8_t, void *) |
SPI transfer complete callback.
Spi Transfer Request prepared by the application upper layer.
This structure is sent to the SPI_SendCommand function to start the transfer. At the end of the transfer, the callback is invoked by the interrupt handler.
uint32_t SPID_Configure | ( | Spid * | pSpid, |
Spi * | pSpiHw, | ||
uint8_t | spiId, | ||
uint32_t | spiMode, | ||
sXdmad * | pXdmad | ||
) |
Initializes the Spid structure and the corresponding SPI & DMA hardware. select value. The driver will uses DMA channel 0 for RX and DMA channel 1 for TX. The DMA channels are freed automatically when no SPI command processing.
pSpid | Pointer to a Spid instance. |
pSpiHw | Associated SPI peripheral. |
spiId | SPI peripheral identifier. |
pDmad | Pointer to a Dmad instance. |
void SPID_ConfigureCS | ( | Spid * | pSpid, |
uint32_t | dwCS, | ||
uint32_t | dwCsr | ||
) |
Configures the parameters for the device corresponding to the cs value.
pSpid | Pointer to a Spid instance. |
cs | number corresponding to the SPI chip select. |
csr | SPI_CSR value to setup. |
uint32_t SPID_IsBusy | ( | const Spid * | pSpid | ) |
Check if the SPI driver is busy.
pSpid | Pointer to a Spid instance. |
Starts a SPI master transfer. This is a non blocking function. It will return as soon as the transfer is started.
pSpid | Pointer to a Spid instance. |
pCommand | Pointer to the SPI command to execute. |