72 #define SPI_MAX_BYTES 16
73 #define SPI_MAX_SLAVE 8
76 #define SPI_MIN_BITRATE ( WISHBONE_FREQ / ( ( SPI_DIV_MASK + 1 ) * 2 ) )
78 #define SPI_MAX_BITRATE ( WISHBONE_FREQ / 2 )
80 #define E_SPI_TIMEOUT ( E_SPI + 1 )
81 #define E_SPI_TIMEOUT_DESCR "SPI transmission timeout"
104 #define SPI_DEFAULT_INIT \
106 .bitrate = 1000000, \
109 .intEnable = false, \
110 .autoSlaveSelect = false \
SPI initialization structure.
Defines the configuration of the LM32 SOC for the CLBv2.
uint8_t mode
SPI mode (0 - 3, see Wikipedia, 0 - default).
bool lsbFirst
Transfer LSB first.
void spiSelect(SPI_Device *dev, uint32_t slaveNo)
Selects a specific slave.
Structure defines OpenCores SPI Device.
void spiASyncRx(SPI_Device *dev, uint8_t *dataOut)
Reads the data received in the previous transmission.
int spiASyncLength(SPI_Device *dev)
Last lenght of data transmitted.
bool spiASyncBusy(SPI_Device *dev)
Returns whether or not the SPI driver is busy tranceiving data.
uint32_t bitrate
Bit-rate.
bool spiInit(SPI_Device *dev, SpiInit *init)
Initializes the specified SPI device with the specified parameters.
void spiAsyncTx(SPI_Device *dev, uint8_t *dataIn, int length)
Start a asynchronous SPI transmission.
void spiDeselect(SPI_Device *dev)
Deselects all slaves.
This module is responsible for distributing error codes.
bool autoSlaveSelect
Auto slave select.
bool spiTxRx(SPI_Device *dev, uint8_t *dataIn, uint8_t *dataOut, int len)
Transfers a specific number of bytes in a synchronous way.
bool intEnable
Interrupts enabled (not implemented yet).