36 #include "mcu_periph/spi_arch.h"
162 #ifndef SPI_TRANSACTION_QUEUE_LEN
163 #define SPI_TRANSACTION_QUEUE_LEN 8
235 extern void spi3_init(
void);
240 extern void spi3_arch_init(
void);
296 extern void spi0_slave_init(
void);
301 extern void spi0_slave_arch_init(
void);
308 extern void spi1_slave_init(
void);
313 extern void spi1_slave_arch_init(
void);
320 extern void spi2_slave_init(
void);
325 extern void spi2_slave_arch_init(
void);
332 extern void spi3_slave_init(
void);
337 extern void spi3_slave_arch_init(
void);
SPIClockPolarity
SPI CPOL (clock polarity) options.
enum SPIClockPolarity cpol
clock polarity control
enum SPIClockDiv cdiv
prescaler of main clock to use as SPI clock
bool_t spi_lock(struct spi_periph *p, uint8_t slave)
Lock the SPI fifo.
uint16_t output_length
number of data words to write
SPIDataSizeSelect
SPI data word size of transfer.
struct spi_periph spi2
receive transferred over DMA
slave is selected before transaction but not unselected
void spi1_arch_init(void)
Architecture dependent SPI1 initialization.
bool_t spi_slave_wait(struct spi_periph *p)
Initialized and wait for the next transaction.
slave is not selected but unselected after transaction
SPITransactionStatus
SPI transaction status.
SPI transaction structure.
slave is not selected nor unselected
void(* SPICallback)(struct spi_transaction *trans)
SPI Callback function.
void spi_slave_hs_init(void)
enum SPIBitOrder bitorder
MSB/LSB order.
SPIClockPhase
SPI CPHA (clock phase) options.
volatile uint8_t * output_buf
pointer to transmit buffer for DMA
volatile uint8_t suspend
control for stop/resume of the fifo
enum SPISlaveSelect select
slave selection behavior
void spi_init(struct spi_periph *p)
Initialize a spi peripheral.
SPIStatus
SPI peripheral status.
enum SPIClockPhase cpha
clock phase control
SPI peripheral structure.
void spi_slave_init(struct spi_periph *p)
Initialize a spi peripheral in slave mode.
void spi_slave_unselect(uint8_t slave)
Unselect a slave.
bool_t spi_submit(struct spi_periph *p, struct spi_transaction *t)
Submit a spi transaction.
SPICallback after_cb
NULL or function called after the transaction.
void spi2_arch_init(void)
Architecture dependent SPI2 initialization.
volatile uint8_t tx_idx_buf
uint16_t input_length
number of data words to read
enum SPIStatus status
internal state of the peripheral
bool_t spi_slave_register(struct spi_periph *p, struct spi_transaction *t)
Register a spi transaction in slave mode (only one transaction can be registered).
SPIClockDiv
Peripheral clock divider.
slave is selected before transaction and unselected after
uint8_t trans_extract_idx
enum SPIDataSizeSelect dss
data transfer word size
uint8_t slave_idx
slave id: SPI_SLAVE0 to SPI_SLAVE4
volatile uint8_t * input_buf
pointer to receive buffer for DMA
bool_t spi_resume(struct spi_periph *p, uint8_t slave)
Resume the SPI fifo.
Highspeed SPI Slave Interface.
SPICallback before_cb
NULL or function called before the transaction.
volatile uint8_t rx_idx_buf
#define SPI_TRANSACTION_QUEUE_LEN
SPI transaction queue length.
void spi_init_slaves(void)
Initialize all used slaves and unselect them.
void spi_slave_select(uint8_t slave)
Select a slave.
void spi0_arch_init(void)
Architecture dependent SPI0 initialization.
struct spi_transaction * trans[SPI_TRANSACTION_QUEUE_LEN]
circular buffer holding transactions
struct spi_periph spi1
receive transferred over DMA
SPISlaveSelect
SPI slave selection behavior options.
enum SPITransactionStatus status