Lines Matching refs:regs
27 SercomSpi *regs; member
56 static void wait_synchronization(SercomSpi *regs) in wait_synchronization() argument
60 while ((regs->SYNCBUSY.reg & SERCOM_SPI_SYNCBUSY_MASK) != 0) { in wait_synchronization()
64 while ((regs->STATUS.reg & SERCOM_SPI_STATUS_SYNCBUSY) != 0) { in wait_synchronization()
76 SercomSpi *regs = cfg->regs; in spi_sam0_configure() local
132 if (regs->CTRLA.reg != ctrla.reg || regs->CTRLB.reg != ctrlb.reg || in spi_sam0_configure()
133 regs->BAUD.reg != div) { in spi_sam0_configure()
134 regs->CTRLA.bit.ENABLE = 0; in spi_sam0_configure()
135 wait_synchronization(regs); in spi_sam0_configure()
137 regs->CTRLB = ctrlb; in spi_sam0_configure()
138 wait_synchronization(regs); in spi_sam0_configure()
139 regs->BAUD.reg = div; in spi_sam0_configure()
140 wait_synchronization(regs); in spi_sam0_configure()
141 regs->CTRLA = ctrla; in spi_sam0_configure()
142 wait_synchronization(regs); in spi_sam0_configure()
155 static void spi_sam0_shift_master(SercomSpi *regs, struct spi_sam0_data *data) in spi_sam0_shift_master() argument
166 while (!regs->INTFLAG.bit.DRE) { in spi_sam0_shift_master()
169 regs->DATA.reg = tx; in spi_sam0_shift_master()
172 while (!regs->INTFLAG.bit.RXC) { in spi_sam0_shift_master()
175 rx = regs->DATA.reg; in spi_sam0_shift_master()
184 static void spi_sam0_finish(SercomSpi *regs) in spi_sam0_finish() argument
186 while (!regs->INTFLAG.bit.TXC) { in spi_sam0_finish()
189 while (regs->INTFLAG.bit.RXC) { in spi_sam0_finish()
190 (void)regs->DATA.reg; in spi_sam0_finish()
195 static void spi_sam0_fast_tx(SercomSpi *regs, const struct spi_buf *tx_buf) in spi_sam0_fast_tx() argument
204 while (!regs->INTFLAG.bit.DRE) { in spi_sam0_fast_tx()
207 regs->DATA.reg = ch; in spi_sam0_fast_tx()
210 spi_sam0_finish(regs); in spi_sam0_fast_tx()
214 static void spi_sam0_fast_rx(SercomSpi *regs, const struct spi_buf *rx_buf) in spi_sam0_fast_rx() argument
225 regs->DATA.reg = 0; in spi_sam0_fast_rx()
229 while (!regs->INTFLAG.bit.RXC) { in spi_sam0_fast_rx()
231 *rx++ = regs->DATA.reg; in spi_sam0_fast_rx()
234 spi_sam0_finish(regs); in spi_sam0_fast_rx()
238 static void spi_sam0_fast_txrx(SercomSpi *regs, in spi_sam0_fast_txrx() argument
253 regs->DATA.reg = *tx++; in spi_sam0_fast_txrx()
256 while (!regs->INTFLAG.bit.RXC) { in spi_sam0_fast_txrx()
258 *rx++ = regs->DATA.reg; in spi_sam0_fast_txrx()
261 spi_sam0_finish(regs); in spi_sam0_fast_txrx()
273 SercomSpi *regs = cfg->regs; in spi_sam0_fast_transceive() local
291 spi_sam0_fast_rx(regs, rx); in spi_sam0_fast_transceive()
293 spi_sam0_fast_tx(regs, tx); in spi_sam0_fast_transceive()
295 spi_sam0_fast_txrx(regs, tx, rx); in spi_sam0_fast_transceive()
305 spi_sam0_fast_tx(regs, tx++); in spi_sam0_fast_transceive()
309 spi_sam0_fast_rx(regs, rx++); in spi_sam0_fast_transceive()
359 SercomSpi *regs = cfg->regs; in spi_sam0_transceive() local
382 spi_sam0_shift_master(regs, data); in spi_sam0_transceive()
411 SercomSpi *regs = cfg->regs; in spi_sam0_dma_rx_load() local
436 dma_blk.source_address = (uint32_t)(&(regs->DATA.reg)); in spi_sam0_dma_rx_load()
452 SercomSpi *regs = cfg->regs; in spi_sam0_dma_tx_load() local
475 dma_blk.dest_address = (uint32_t)(&(regs->DATA.reg)); in spi_sam0_dma_tx_load()
646 SercomSpi *regs = cfg->regs; in spi_sam0_init() local
665 regs->INTENCLR.reg = SERCOM_SPI_INTENCLR_MASK; in spi_sam0_init()
666 wait_synchronization(regs); in spi_sam0_init()
723 .regs = (SercomSpi *)DT_INST_REG_ADDR(n), \
734 .regs = (SercomSpi *)DT_INST_REG_ADDR(n), \