You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/driver/include/driver/spi_common.h
+6-5Lines changed: 6 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -62,11 +62,12 @@ extern "C"
62
62
#defineSPICOMMON_BUSFLAG_SLAVE 0 ///< Initialize I/O in slave mode
63
63
#defineSPICOMMON_BUSFLAG_MASTER (1<<0) ///< Initialize I/O in master mode
64
64
#defineSPICOMMON_BUSFLAG_IOMUX_PINS (1<<1) ///< Check using iomux pins. Or indicates the pins are configured through the IO mux rather than GPIO matrix.
65
-
#defineSPICOMMON_BUSFLAG_SCLK (1<<2) ///< Check existing of SCLK pin. Or indicates CLK line initialized.
66
-
#defineSPICOMMON_BUSFLAG_MISO (1<<3) ///< Check existing of MISO pin. Or indicates MISO line initialized.
67
-
#defineSPICOMMON_BUSFLAG_MOSI (1<<4) ///< Check existing of MOSI pin. Or indicates CLK line initialized.
68
-
#defineSPICOMMON_BUSFLAG_DUAL (1<<5) ///< Check MOSI and MISO pins can output. Or indicates bus able to work under DIO mode.
69
-
#defineSPICOMMON_BUSFLAG_WPHD (1<<6) ///< Check existing of WP and HD pins. Or indicates WP & HD pins initialized.
65
+
#defineSPICOMMON_BUSFLAG_GPIO_PINS (1<<2) ///< Force the signals to be routed through GPIO matrix. Or indicates the pins are routed through the GPIO matrix.
66
+
#defineSPICOMMON_BUSFLAG_SCLK (1<<3) ///< Check existing of SCLK pin. Or indicates CLK line initialized.
67
+
#defineSPICOMMON_BUSFLAG_MISO (1<<4) ///< Check existing of MISO pin. Or indicates MISO line initialized.
68
+
#defineSPICOMMON_BUSFLAG_MOSI (1<<5) ///< Check existing of MOSI pin. Or indicates MOSI line initialized.
69
+
#defineSPICOMMON_BUSFLAG_DUAL (1<<6) ///< Check MOSI and MISO pins can output. Or indicates bus able to work under DIO mode.
70
+
#defineSPICOMMON_BUSFLAG_WPHD (1<<7) ///< Check existing of WP and HD pins. Or indicates WP & HD pins initialized.
70
71
#defineSPICOMMON_BUSFLAG_QUAD (SPICOMMON_BUSFLAG_DUAL|SPICOMMON_BUSFLAG_WPHD) ///< Check existing of MOSI/MISO/WP/HD pins as output. Or indicates bus able to work under QIO mode.
#error The SPI peripheral does not support this feature
32
+
#endif
33
+
34
+
/// Descriptor of data to send/receive
35
+
typedefstruct {
36
+
uint8_t*data; ///< Buffer to send, must be DMA capable
37
+
size_tlen; ///< Len of data to send/receive. For receiving the buffer length should be multiples of 4 bytes, otherwise the extra part will be truncated.
38
+
size_ttrans_len; ///< Data actually received
39
+
void*arg; ///< Extra argument indiciating this data
40
+
} spi_slave_hd_data_t;
41
+
42
+
/// Information of SPI Slave HD event
43
+
typedefstruct {
44
+
spi_event_tevent; ///< Event type
45
+
spi_slave_hd_data_t*trans; ///< Corresponding transaction for SPI_EV_SEND and SPI_EV_RECV events
/// Channel of SPI Slave HD to do data transaction
52
+
typedefenum {
53
+
SPI_SLAVE_CHAN_TX=0, ///< The output channel (RDDMA)
54
+
SPI_SLAVE_CHAN_RX=1, ///< The input channel (WRDMA)
55
+
} spi_slave_chan_t;
56
+
57
+
/// Callback configuration structure for SPI Slave HD
58
+
typedefstruct {
59
+
slave_cb_tcb_recv; ///< Callback when receive data
60
+
slave_cb_tcb_sent; ///< Callback when data sent
61
+
slave_cb_tcb_buffer_tx; ///< Callback when master reads from shared buffer
62
+
slave_cb_tcb_buffer_rx; ///< Callback when master writes to shared buffer
63
+
slave_cb_tcb_cmd9; ///< Callback when CMD9 received
64
+
slave_cb_tcb_cmdA; ///< Callback when CMDA received
65
+
void*arg; ///< Argument indicating this SPI Slave HD peripheral instance
66
+
} spi_slave_hd_callback_config_t;
67
+
68
+
/// Configuration structure for the SPI Slave HD driver
69
+
typedefstruct {
70
+
intspics_io_num; ///< CS GPIO pin for this device
71
+
uint32_tflags; ///< Bitwise OR of SPI_SLAVE_HD_* flags
72
+
#defineSPI_SLAVE_HD_TXBIT_LSBFIRST (1<<0) ///< Transmit command/address/data LSB first instead of the default MSB first
73
+
#defineSPI_SLAVE_HD_RXBIT_LSBFIRST (1<<1) ///< Receive data LSB first instead of the default MSB first
74
+
#defineSPI_SLAVE_HD_BIT_LSBFIRST (SPI_SLAVE_HD_TXBIT_LSBFIRST|SPI_SLAVE_HD_RXBIT_LSBFIRST) ///< Transmit and receive LSB first
75
+
76
+
uint8_tmode; ///< SPI mode (0-3)
77
+
intcommand_bits; ///< command field bits, multiples of 8 and at least 8.
78
+
intaddress_bits; ///< address field bits, multiples of 8 and at least 8.
79
+
intdummy_bits; ///< dummy field bits, multiples of 8 and at least 8.
80
+
81
+
intqueue_size; ///< Transaction queue size. This sets how many transactions can be 'in the air' (queued using spi_slave_hd_queue_trans but not yet finished using spi_slave_hd_get_trans_result) at the same time
0 commit comments