Lines Matching refs:regs

36 	Spi *regs;  member
99 Spi *regs = cfg->regs; in spi_sam_configure() local
153 regs->SPI_CR = SPI_CR_SPIDIS; /* Disable SPI */ in spi_sam_configure()
154 regs->SPI_MR = spi_mr; in spi_sam_configure()
155 regs->SPI_CSR[spi_csr_idx] = spi_csr; in spi_sam_configure()
156 regs->SPI_CR = SPI_CR_SPIEN; /* Enable SPI */ in spi_sam_configure()
164 static void spi_sam_finish(Spi *regs) in spi_sam_finish() argument
166 while ((regs->SPI_SR & SPI_SR_TXEMPTY) == 0) { in spi_sam_finish()
169 while (regs->SPI_SR & SPI_SR_RDRF) { in spi_sam_finish()
170 (void)regs->SPI_RDR; in spi_sam_finish()
175 static void spi_sam_fast_tx(Spi *regs, const uint8_t *tx_buf, const uint32_t tx_buf_len) in spi_sam_fast_tx() argument
184 while ((regs->SPI_SR & SPI_SR_TDRE) == 0) { in spi_sam_fast_tx()
187 regs->SPI_TDR = SPI_TDR_TD(ch); in spi_sam_fast_tx()
192 static void spi_sam_fast_rx(Spi *regs, uint8_t *rx_buf, const uint32_t rx_buf_len) in spi_sam_fast_rx() argument
202 regs->SPI_TDR = SPI_TDR_TD(0); in spi_sam_fast_rx()
206 while ((regs->SPI_SR & SPI_SR_TDRE) == 0) { in spi_sam_fast_rx()
210 while ((regs->SPI_SR & SPI_SR_RDRF) == 0) { in spi_sam_fast_rx()
213 *rx = (uint8_t)regs->SPI_RDR; in spi_sam_fast_rx()
217 regs->SPI_TDR = SPI_TDR_TD(0); in spi_sam_fast_rx()
222 while ((regs->SPI_SR & SPI_SR_RDRF) == 0) { in spi_sam_fast_rx()
225 *rx = (uint8_t)regs->SPI_RDR; in spi_sam_fast_rx()
229 static void spi_sam_fast_txrx(Spi *regs, in spi_sam_fast_txrx() argument
255 regs->SPI_TDR = SPI_TDR_TD(*tx++); in spi_sam_fast_txrx()
258 while ((regs->SPI_SR & SPI_SR_TDRE) == 0) { in spi_sam_fast_txrx()
265 regs->SPI_TDR = SPI_TDR_TD(*tx++); in spi_sam_fast_txrx()
268 while ((regs->SPI_SR & SPI_SR_RDRF) == 0) { in spi_sam_fast_txrx()
271 *rx++ = (uint8_t)regs->SPI_RDR; in spi_sam_fast_txrx()
275 while ((regs->SPI_SR & SPI_SR_RDRF) == 0) { in spi_sam_fast_txrx()
278 *rx = (uint8_t)regs->SPI_RDR; in spi_sam_fast_txrx()
316 Spi *regs, in spi_sam_dma_txrx() argument
360 .source_address = (uint32_t)&regs->SPI_RDR, in spi_sam_dma_txrx()
393 .dest_address = (uint32_t)&regs->SPI_TDR in spi_sam_dma_txrx()
426 spi_sam_finish(regs); in spi_sam_dma_txrx()
439 Spi *regs, in spi_sam_rx() argument
451 spi_sam_fast_rx(regs, rx_buf, rx_buf_len); in spi_sam_rx()
454 return spi_sam_dma_txrx(dev, regs, NULL, rx_buf, rx_buf_len); in spi_sam_rx()
458 spi_sam_fast_rx(regs, rx_buf, rx_buf_len); in spi_sam_rx()
460 spi_sam_finish(regs); in spi_sam_rx()
467 Spi *regs, in spi_sam_tx() argument
479 spi_sam_fast_tx(regs, tx_buf, tx_buf_len); in spi_sam_tx()
482 return spi_sam_dma_txrx(dev, regs, tx_buf, NULL, tx_buf_len); in spi_sam_tx()
486 spi_sam_fast_tx(regs, tx_buf, tx_buf_len); in spi_sam_tx()
488 spi_sam_finish(regs); in spi_sam_tx()
495 Spi *regs, in spi_sam_txrx() argument
508 spi_sam_fast_txrx(regs, tx_buf, rx_buf, buf_len); in spi_sam_txrx()
511 return spi_sam_dma_txrx(dev, regs, tx_buf, rx_buf, buf_len); in spi_sam_txrx()
515 spi_sam_fast_txrx(regs, tx_buf, rx_buf, buf_len); in spi_sam_txrx()
517 spi_sam_finish(regs); in spi_sam_txrx()
533 Spi *regs = cfg->regs; in spi_sam_fast_transceive() local
549 spi_sam_rx(dev, regs, rx->buf, rx->len); in spi_sam_fast_transceive()
551 spi_sam_tx(dev, regs, tx->buf, tx->len); in spi_sam_fast_transceive()
553 spi_sam_txrx(dev, regs, tx->buf, rx->buf, rx->len); in spi_sam_fast_transceive()
565 spi_sam_tx(dev, regs, tx->buf, tx->len); in spi_sam_fast_transceive()
570 spi_sam_rx(dev, regs, rx->buf, rx->len); in spi_sam_fast_transceive()
580 static void spi_sam_shift_master(Spi *regs, struct spi_sam_data *data) in spi_sam_shift_master() argument
591 while ((regs->SPI_SR & SPI_SR_TDRE) == 0) { in spi_sam_shift_master()
594 regs->SPI_TDR = SPI_TDR_TD(tx); in spi_sam_shift_master()
597 while ((regs->SPI_SR & SPI_SR_RDRF) == 0) { in spi_sam_shift_master()
600 rx = (uint8_t)regs->SPI_RDR; in spi_sam_shift_master()
665 ret = spi_sam_rx(dev, cfg->regs, sqe->rx.buf, sqe->rx.buf_len); in spi_sam_iodev_start()
668 ret = spi_sam_tx(dev, cfg->regs, sqe->tx.buf, sqe->tx.buf_len); in spi_sam_iodev_start()
671 ret = spi_sam_tx(dev, cfg->regs, sqe->tiny_tx.buf, sqe->tiny_tx.buf_len); in spi_sam_iodev_start()
674 ret = spi_sam_txrx(dev, cfg->regs, sqe->txrx.tx_buf, sqe->txrx.rx_buf, in spi_sam_iodev_start()
767 spi_sam_shift_master(cfg->regs, data); in spi_sam_transceive()
872 .regs = (Spi *)DT_INST_REG_ADDR(n), \