Lines Matching refs:req

56 	mxc_spi_req_t req;  member
80 static void spi_max32_callback(mxc_spi_req_t *req, int error);
166 static void spi_max32_setup(mxc_spi_regs_t *spi, mxc_spi_req_t *req) in spi_max32_setup() argument
168 req->rxCnt = 0; in spi_max32_setup()
169 req->txCnt = 0; in spi_max32_setup()
172 MXC_SPI_SetSlave(spi, req->ssIdx); in spi_max32_setup()
175 if (req->rxData && req->rxLen) { in spi_max32_setup()
177 req->rxLen << MXC_F_SPI_CTRL1_RX_NUM_CHAR_POS); in spi_max32_setup()
184 if (req->txLen) { in spi_max32_setup()
186 req->txLen << MXC_F_SPI_CTRL1_TX_NUM_CHAR_POS); in spi_max32_setup()
203 mxc_spi_req_t *req = &data->req; in spi_max32_transceive_sync() local
209 tx_len = req->txLen << dfs_shift; in spi_max32_transceive_sync()
210 rx_len = req->rxLen << dfs_shift; in spi_max32_transceive_sync()
212 remain = tx_len - req->txCnt; in spi_max32_transceive_sync()
214 if (!data->req.txData) { in spi_max32_transceive_sync()
215 req->txCnt += MXC_SPI_WriteTXFIFO(spi, data->dummy, in spi_max32_transceive_sync()
218 req->txCnt += in spi_max32_transceive_sync()
219 MXC_SPI_WriteTXFIFO(spi, &req->txData[req->txCnt], remain); in spi_max32_transceive_sync()
226 if (req->rxCnt < rx_len) { in spi_max32_transceive_sync()
227 req->rxCnt += MXC_SPI_ReadRXFIFO(spi, &req->rxData[req->rxCnt], in spi_max32_transceive_sync()
228 rx_len - req->rxCnt); in spi_max32_transceive_sync()
230 } while ((req->txCnt < tx_len) || (req->rxCnt < rx_len)); in spi_max32_transceive_sync()
264 data->req.rxData = sqe->rx.buf; in spi_max32_transceive()
265 data->req.rxLen = sqe->rx.buf_len; in spi_max32_transceive()
266 data->req.txData = NULL; in spi_max32_transceive()
267 data->req.txLen = len >> dfs_shift; in spi_max32_transceive()
271 data->req.rxLen = 0; in spi_max32_transceive()
272 data->req.rxData = data->dummy; in spi_max32_transceive()
273 data->req.txData = (uint8_t *)sqe->tx.buf; in spi_max32_transceive()
274 data->req.txLen = len >> dfs_shift; in spi_max32_transceive()
278 data->req.txData = (uint8_t *)sqe->tiny_tx.buf; in spi_max32_transceive()
279 data->req.rxData = data->dummy; in spi_max32_transceive()
280 data->req.txLen = len >> dfs_shift; in spi_max32_transceive()
281 data->req.rxLen = 0; in spi_max32_transceive()
285 data->req.txData = (uint8_t *)sqe->txrx.tx_buf; in spi_max32_transceive()
286 data->req.rxData = sqe->txrx.rx_buf; in spi_max32_transceive()
287 data->req.txLen = len >> dfs_shift; in spi_max32_transceive()
288 data->req.rxLen = len >> dfs_shift; in spi_max32_transceive()
294 data->req.txLen = len >> dfs_shift; in spi_max32_transceive()
295 data->req.txData = (uint8_t *)ctx->tx_buf; in spi_max32_transceive()
296 data->req.rxLen = len >> dfs_shift; in spi_max32_transceive()
297 data->req.rxData = ctx->rx_buf; in spi_max32_transceive()
299 data->req.rxData = ctx->rx_buf; in spi_max32_transceive()
301 data->req.rxLen = len >> dfs_shift; in spi_max32_transceive()
302 if (!data->req.rxData) { in spi_max32_transceive()
306 data->req.rxData = data->dummy; in spi_max32_transceive()
307 data->req.rxLen = 0; in spi_max32_transceive()
310 data->req.spi = cfg->regs; in spi_max32_transceive()
311 data->req.ssIdx = ctx->config->slave; in spi_max32_transceive()
312 data->req.ssDeassert = 0; in spi_max32_transceive()
313 data->req.txCnt = 0; in spi_max32_transceive()
314 data->req.rxCnt = 0; in spi_max32_transceive()
315 spi_max32_setup(cfg->regs, &data->req); in spi_max32_transceive()
318 if (data->req.rxLen) { in spi_max32_transceive()
324 if (!data->req.txData) { in spi_max32_transceive()
325 data->req.txCnt = in spi_max32_transceive()
328 data->req.txCnt = MXC_SPI_WriteTXFIFO(cfg->regs, data->req.txData, len); in spi_max32_transceive()
742 static void spi_max32_callback(mxc_spi_req_t *req, int error) in spi_max32_callback() argument
744 struct max32_spi_data *data = CONTAINER_OF(req, struct max32_spi_data, req); in spi_max32_callback()
766 req->spi->ctrl0 &= ~(MXC_F_SPI_CTRL0_START | MXC_F_SPI_CTRL0_SS_CTRL | in spi_max32_callback()
768 req->spi->ctrl0 |= MXC_F_SPI_CTRL0_EN; in spi_max32_callback()
795 mxc_spi_req_t *req = &data->req; in spi_max32_isr() local
803 remain = (req->txLen << dfs_shift) - req->txCnt; in spi_max32_isr()
806 if (!data->req.txData) { in spi_max32_isr()
807 req->txCnt += MXC_SPI_WriteTXFIFO(cfg->regs, data->dummy, in spi_max32_isr()
810 req->txCnt += in spi_max32_isr()
811 MXC_SPI_WriteTXFIFO(spi, &req->txData[req->txCnt], remain); in spi_max32_isr()
818 remain = (req->rxLen << dfs_shift) - req->rxCnt; in spi_max32_isr()
820 req->rxCnt += MXC_SPI_ReadRXFIFO(spi, &req->rxData[req->rxCnt], remain); in spi_max32_isr()
821 remain = (req->rxLen << dfs_shift) - req->rxCnt; in spi_max32_isr()
831 if ((req->txLen == req->txCnt) && (req->rxLen == req->rxCnt)) { in spi_max32_isr()
835 spi_max32_callback(req, 0); in spi_max32_isr()