29 #define SPI_OPT_GPIO_DIS 0xFF
34 #define SPI_OPT_CS_DIS 0x7
126 #ifdef CONFIG_SPI_MULTI
132 struct spi *(*spi_init)(uint32_t index,
enum spi_mode mode,
struct spi_opt *opt);
134 int32_t (*
spi_setCallback)(
struct spi *spi, bool (*callback)(
struct spi_slave *slave,
void *data),
void *data);
136 struct spi_slave *(*spiSlave_init)(
struct spi *spi,
struct spi_opt *options);
138 int32_t (*
spiSlave_transfer)(
struct spi_slave *slave, uint16_t *sendData, uint16_t *recvData, uint32_t len, TickType_t waittime);
139 int32_t (*
spiSlave_send)(
struct spi_slave *slave, uint16_t *data, uint32_t len, TickType_t waittime);
140 int32_t (*
spiSlave_recv)(
struct spi_slave *slave, uint16_t *data, uint32_t len, TickType_t waittime);
142 int32_t (*
spiSlave_transferISR)(
struct spi_slave *slave, uint16_t *sendData, uint16_t *recvData, uint32_t len);
143 int32_t (*
spiSlave_sendISR)(
struct spi_slave *slave, uint16_t *data, uint32_t len);
144 int32_t (*
spiSlave_recvISR)(
struct spi_slave *slave, uint16_t *data, uint32_t len);
157 #ifdef CONFIG_INSTANCE_NAME
163 #ifdef CONFIG_SPI_THREAD_SAVE
169 #ifdef CONFIG_SPI_MULTI
173 const struct spi_ops *ops;
188 #ifndef CONFIG_SPI_MULTI
215 int32_t
spi_setCallback(
struct spi *spi,
bool (*callback)(
struct spi_slave *slave,
void *data),
void *data);
252 int32_t
spiSlave_transfer(
struct spi_slave *slave, uint16_t *sendData, uint16_t *recvData, uint32_t len, TickType_t waittime);
261 int32_t
spiSlave_send(
struct spi_slave *slave, uint16_t *data, uint32_t len, TickType_t waittime);
270 int32_t
spiSlave_recv(
struct spi_slave *slave, uint16_t *data, uint32_t len, TickType_t waittime);
305 return s->ops->spi_init(index, mode, opt);
309 return s->ops->spi_deinit(spi);
311 inline int32_t
spi_setCallback(
struct spi *spi,
bool (*callback)(
struct spi_slave *slave,
void *data),
void *data) {
313 return s->ops->spi_setCallback(spi, callback, data);
318 return s->ops->spiSlave_init(spi, options);
323 return s->ops->spiSlave_deinit(slave);
325 inline int32_t
spiSlave_transfer(
struct spi_slave *slave, uint16_t *sendData, uint16_t *recvData, uint32_t len, TickType_t waittime) {
328 return s->ops->spiSlave_transfer(slave, sendData, recvData, len, waittime);
330 inline int32_t
spiSlave_send(
struct spi_slave *slave, uint16_t *data, uint32_t len, TickType_t waittime) {
333 return s->ops->spiSlave_send(slave, data, len, waittime);
335 inline int32_t
spiSlave_recv(
struct spi_slave *slave, uint16_t *data, uint32_t len, TickType_t waittime) {
338 return s->ops->spiSlave_recv(slave, data, len, waittime);
341 inline int32_t
spiSlave_transferISR(
struct spi_slave *slave, uint16_t *sendData, uint16_t *recvData, uint32_t len) {
344 return s->ops->spiSlave_transferISR(slave, sendData, recvData, len);
346 inline int32_t
spiSlave_sendISR(
struct spi_slave *slave, uint16_t *data, uint32_t len) {
349 return s->ops->spiSlave_sendISR(slave, data, len);
351 inline int32_t
spiSlave_recvISR(
struct spi_slave *slave, uint16_t *data, uint32_t len) {
354 return s->ops->spiSlave_recvISR(slave, data, len);