25#ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32675_SPI_H_
26#define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32675_SPI_H_
31#include "mxc_assert.h"
168 unsigned ssPolarity,
unsigned int hz);
Definition: spi_regs.h:76
uint8_t * txData
Definition: spi.h:113
uint32_t rxLen
Number of bytes to be stored in rxData.
Definition: spi.h:122
uint32_t rxCnt
Number of bytes stored in rxData.
Definition: spi.h:124
int ssIdx
Slave select line to use (Master only, ignored in slave mode)
Definition: spi.h:111
mxc_spi_regs_t * spi
Point to SPI registers.
Definition: spi.h:110
spi_complete_cb_t completeCB
Pointer to function called when transaction is complete.
Definition: spi.h:126
uint32_t txCnt
Number of bytes actually transmitted from txData.
Definition: spi.h:123
uint8_t * rxData
Definition: spi.h:117
uint32_t txLen
Number of bytes to be sent from txData.
Definition: spi.h:121
int ssDeassert
1 - Deassert SS at end of transaction, 0 - leave SS asserted
Definition: spi.h:112
int MXC_SPI_SetFrequency(mxc_spi_regs_t *spi, unsigned int hz)
Set the frequency of the SPI interface.
unsigned int MXC_SPI_GetFlags(mxc_spi_regs_t *spi)
Gets the interrupt flags that are currently set.
int MXC_SPI_GetSlave(mxc_spi_regs_t *spi)
Gets the slave select (SS) line used for transmissions.
unsigned int MXC_SPI_GetTXFIFOAvailable(mxc_spi_regs_t *spi)
Get the amount of free space available in the transmit FIFO.
void MXC_SPI_ClearFlags(mxc_spi_regs_t *spi)
Clears the interrupt flags that are currently set.
void MXC_SPI_EnableInt(mxc_spi_regs_t *spi, unsigned int mask)
Enables specific interrupts.
unsigned int MXC_SPI_ReadRXFIFO(mxc_spi_regs_t *spi, unsigned char *bytes, unsigned int len)
Unloads bytes from the receive FIFO.
void MXC_SPI_DisableInt(mxc_spi_regs_t *spi, unsigned int mask)
Disables specific interrupts.
int MXC_SPI_SetRXThreshold(mxc_spi_regs_t *spi, unsigned int numBytes)
Set the receive threshold level.
int MXC_SPI_SetWidth(mxc_spi_regs_t *spi, mxc_spi_width_t spiWidth)
Sets the SPI width used for transmissions.
int MXC_SPI_SetSlave(mxc_spi_regs_t *spi, int ssIdx)
Sets the slave select (SS) line used for transmissions.
int MXC_SPI_GetDataSize(mxc_spi_regs_t *spi)
Gets the number of bits per character.
unsigned int MXC_SPI_GetTXThreshold(mxc_spi_regs_t *spi)
Get the current transmit threshold level.
int MXC_SPI_GetPeripheralClock(mxc_spi_regs_t *spi)
Returns the frequency of the clock used as the bit rate generator for a given SPI instance.
int MXC_SPI_SetDataSize(mxc_spi_regs_t *spi, int dataSize)
Sets the number of bits per character.
int MXC_SPI_ReadyForSleep(mxc_spi_regs_t *spi)
Checks if the given SPI bus can be placed in sleep mode.
mxc_spi_mode_t MXC_SPI_GetMode(mxc_spi_regs_t *spi)
Gets the spi mode.
unsigned int MXC_SPI_GetRXFIFOAvailable(mxc_spi_regs_t *spi)
Get the number of bytes currently available in the receive FIFO.
mxc_spi_mode_t
The list of SPI modes.
Definition: spi.h:86
int MXC_SPI_SlaveTransactionAsync(mxc_spi_req_t *req)
Setup an interrupt-driven SPI transaction.
unsigned int MXC_SPI_GetFrequency(mxc_spi_regs_t *spi)
Get the frequency of the SPI interface.
void MXC_SPI_ClearTXFIFO(mxc_spi_regs_t *spi)
Removes and discards all bytes currently in the transmit FIFO.
int MXC_SPI_MasterTransactionAsync(mxc_spi_req_t *req)
Setup an interrupt-driven SPI transaction.
mxc_spi_width_t
The list of SPI Widths supported.
Definition: spi.h:68
int MXC_SPI_SetTXThreshold(mxc_spi_regs_t *spi, unsigned int numBytes)
Set the transmit threshold level.
int MXC_SPI_Shutdown(mxc_spi_regs_t *spi)
Disable and shutdown SPI peripheral.
int MXC_SPI_SlaveTransactionDMA(mxc_spi_req_t *req)
Setup a DMA driven SPI transaction.
mxc_spi_width_t MXC_SPI_GetWidth(mxc_spi_regs_t *spi)
Gets the SPI width used for transmissions.
int MXC_SPI_SlaveTransaction(mxc_spi_req_t *req)
Performs a blocking SPI transaction.
int MXC_SPI_SetMode(mxc_spi_regs_t *spi, mxc_spi_mode_t spiMode)
Sets the spi mode using clock polarity and clock phase.
void MXC_SPI_AsyncHandler(mxc_spi_regs_t *spi)
The processing function for asynchronous transactions.
int MXC_SPI_GetActive(mxc_spi_regs_t *spi)
Checks the SPI Peripheral for an ongoing transmission.
void MXC_SPI_ClearRXFIFO(mxc_spi_regs_t *spi)
Removes and discards all bytes currently in the receive FIFO.
int MXC_SPI_AbortTransmission(mxc_spi_regs_t *spi)
Aborts an ongoing SPI Transmission.
unsigned int MXC_SPI_WriteTXFIFO(mxc_spi_regs_t *spi, unsigned char *bytes, unsigned int len)
Loads bytes into the transmit FIFO.
int MXC_SPI_SetDefaultTXData(mxc_spi_regs_t *spi, unsigned int defaultTXData)
Sets the TX data to transmit as a 'dummy' byte.
void MXC_SPI_AbortAsync(mxc_spi_regs_t *spi)
Abort any asynchronous requests in progress.
int MXC_SPI_Init(mxc_spi_regs_t *spi, int masterMode, int quadModeUsed, int numSlaves, unsigned ssPolarity, unsigned int hz)
Initialize and enable SPI peripheral.
unsigned int MXC_SPI_GetRXThreshold(mxc_spi_regs_t *spi)
Get the current receive threshold level.
int MXC_SPI_StartTransmission(mxc_spi_regs_t *spi)
Starts a SPI Transmission.
int MXC_SPI_MasterTransactionDMA(mxc_spi_req_t *req)
Setup a DMA driven SPI transaction.
int MXC_SPI_MasterTransaction(mxc_spi_req_t *req)
Performs a blocking SPI transaction.
void(* spi_complete_cb_t)(void *req, int result)
The callback routine used to indicate the transaction has terminated.
Definition: spi.h:101
void MXC_SPI_HWSSControl(mxc_spi_regs_t *spi, int state)
Enable/Disable HW CS control feature.
@ SPI_MODE_0
clock phase = 0, clock polarity = 0
Definition: spi.h:87
@ SPI_MODE_2
clock phase = 1, clock polarity = 0
Definition: spi.h:89
@ SPI_MODE_1
clock phase = 0, clock polarity = 1
Definition: spi.h:88
@ SPI_MODE_3
clock phase = 1, clock polarity = 1
Definition: spi.h:90
@ SPI_WIDTH_QUAD
4 Data lines, half duplex
Definition: spi.h:72
@ SPI_WIDTH_STANDARD
MISO/MOSI, full duplex.
Definition: spi.h:70
@ SPI_WIDTH_3WIRE
1 Data line, half duplex
Definition: spi.h:69
@ SPI_WIDTH_DUAL
2 Data lines, half duplex
Definition: spi.h:71
The information required to perform a complete SPI transaction.
Definition: spi.h:109
Registers, Bit Masks and Bit Positions for the SPI Peripheral Module.