2 //#include "ul/ul_list.h"
5 //#include "ul/ul_list.h"
8 int spi_msg_rq_ins(spi_drv_t *ifc, spi_msg_head_t *msg)
10 spi_isr_lock_level_t saveif;
15 if (!(ifc->flags & SPI_IFC_ON))
19 spi_rq_queue_insert(ifc, msg);
20 spi_isr_unlock(saveif);
21 ifc->ctrl_fnc(ifc, SPI_CTRL_WAKE_RQ, NULL);
25 int spi_transfer_callback(struct spi_drv *ifc, int code, struct spi_msg_head *msg)
33 int spi_transfer(spi_drv_t *ifc, int addr, int rq_len, const void *tx_buf, void *rx_buf)
39 spi_rq_queue_init_detached(&msg);
44 msg.callback = spi_transfer_callback;
47 if (spi_msg_rq_ins(ifc, &msg) < 0)
50 /* Wait for the request completion */
56 if (msg.flags & (SPI_MSG_FAIL | SPI_MSG_ABORT))