46 #include "spi17y_regs.h" 71 #define MXC_SPI0 MXC_SPI17Y0 // SPI17Y instance 0, 72 #define MXC_SPI1 MXC_SPI17Y1 // SPI17Y instance 1 73 #define MXC_SPI2 MXC_SPI17Y2 // SPI17Y instance 2 78 #define SPI0_IRQn SPI17Y0_IRQn 79 #define SPI1_IRQn SPI17Y1_IRQn 80 #define SPI2_IRQn SPI17Y2_IRQn 86 #define SPI_WIDTH_1 SPI17Y_WIDTH_1 87 #define SPI_WIDTH_2 SPI17Y_WIDTH_2 88 #define SPI_WIDTH_4 SPI17Y_WIDTH_4 93 #define SPI_POL_LOW SPI17Y_POL_LOW 94 #define SPI_POL_HIGH SPI17Y_POL_HIGH 96 typedef sys_cfg_spi17y_t sys_cfg_spi_t; 110 typedef struct spi_req spi_req_t;
125 typedef void (*spi_callback_fn)(
void * req,
int error_code);
spi17y_width_t width
Number of data lines to use, see spi17y_width_t.
Definition: spi.h:139
int SPI_Enable(spi_type spi_name)
Enable SPI.
unsigned bits
Number of bits in transfer unit (e.g.
Definition: spi.h:141
int SPI_AbortAsync(spi_type spi_name, spi_req_t *req)
Aborts an Asynchronous request.
int SPI_Disable(spi_type spi_name)
Disable SPI.
spi17y_sspol_t ssel_pol
Slave select line polarity.
Definition: spi.h:136
int SPI_SlaveTransAsync(spi_type spi_name, spi_req_t *req)
Asynchronously read/write SPI Slave data.
spi17y_width_t
Enumeration type for setting the number data lines to use for communication.
Definition: spi17y.h:66
int SPI_Clear_fifo(spi_type spi_name)
Clear the TX and RX FIFO.
const void * tx_data
Pointer to a buffer to transmit data from.
Definition: spi.h:137
int SPI_SlaveTrans(spi_type spi_name, spi_req_t *req)
Execute a slave transaction.
SPI17Y Configuration Object.
Definition: mxc_sys.h:177
int SPI_Init(spi_type spi_name, unsigned int mode, unsigned int freq, sys_cfg_spi_t spi17y_cfg)
Initialize the spi.
void * rx_data
Pointer to a buffer to store data received.
Definition: spi.h:138
spi_callback_fn callback
Callback function if desired, NULL otherwise.
Definition: spi.h:144
int SPI_MasterTransAsync(spi_type spi_name, spi_req_t *req)
Asynchronously read/write SPI Master data.
uint8_t deass
Non-zero to de-assert slave select after transaction.
Definition: spi.h:135
unsigned len
Number of transfer units to send from the tx_data buffer.
Definition: spi.h:140
spi17y_sspol_t
Enumeration type for setting the polarity of ss lines.
Definition: spi17y.h:75
Structure type to access the SPI17Y Registers.
Definition: spi17y_regs.h:88
Union consolidating SPI registers.
Definition: spi.h:102
unsigned tx_num
Number of bytes actually sent from the tx_data buffer.
Definition: spi.h:143
uint8_t ssel
Slave select line to use.
Definition: spi.h:134
Structure type representing a SPI Master Transaction request.
Definition: spi.h:133
int SPI_Shutdown(spi_type spi_name)
Shutdown SPI module.
int SPI_Handler(spi_type spi_name)
Execute SPI transaction based on interrupt handler.
unsigned rx_num
Number of bytes actually read into the rx_data buffer.
Definition: spi.h:142
int SPI_MasterTrans(spi_type spi_name, spi_req_t *req)
Execute a master transaction.
spi_type
Assigning SPI0 instances.
Definition: spi.h:65