Lines Matching refs:twihs

72 static int i2c_clk_set(Twihs *const twihs, uint32_t speed)  in i2c_clk_set()  argument
98 twihs->TWIHS_CWGR = TWIHS_CWGR_CLDIV(cl_div) | TWIHS_CWGR_CHDIV(cl_div) in i2c_clk_set()
107 Twihs *const twihs = dev_cfg->regs; in i2c_sam_twihs_configure() local
136 ret = i2c_clk_set(twihs, bitrate); in i2c_sam_twihs_configure()
142 twihs->TWIHS_CR = TWIHS_CR_SVDIS; in i2c_sam_twihs_configure()
145 twihs->TWIHS_CR = TWIHS_CR_MSEN; in i2c_sam_twihs_configure()
150 static void write_msg_start(Twihs *const twihs, struct twihs_msg *msg, in write_msg_start() argument
154 twihs->TWIHS_MMR = TWIHS_MMR_DADR(daddr); in write_msg_start()
157 twihs->TWIHS_THR = msg->buf[msg->idx++]; in write_msg_start()
160 twihs->TWIHS_IER = TWIHS_IER_TXRDY | TWIHS_IER_TXCOMP | TWIHS_IER_NACK; in write_msg_start()
163 static void read_msg_start(Twihs *const twihs, struct twihs_msg *msg, in read_msg_start() argument
169 twihs->TWIHS_MMR = TWIHS_MMR_MREAD | TWIHS_MMR_DADR(daddr); in read_msg_start()
172 twihs->TWIHS_IER = TWIHS_IER_RXRDY | TWIHS_IER_TXCOMP | TWIHS_IER_NACK; in read_msg_start()
177 twihs->TWIHS_CR = TWIHS_CR_START | twihs_cr_stop; in read_msg_start()
186 Twihs *const twihs = dev_cfg->regs; in i2c_sam_twihs_transfer() local
194 (void)twihs->TWIHS_SR; in i2c_sam_twihs_transfer()
197 twihs->TWIHS_IADR = 0; in i2c_sam_twihs_transfer()
206 read_msg_start(twihs, &dev_data->msg, addr); in i2c_sam_twihs_transfer()
208 write_msg_start(twihs, &dev_data->msg, addr); in i2c_sam_twihs_transfer()
226 Twihs *const twihs = dev_cfg->regs; in i2c_sam_twihs_isr() local
231 isr_status = twihs->TWIHS_SR & twihs->TWIHS_IMR; in i2c_sam_twihs_isr()
242 msg->buf[msg->idx++] = twihs->TWIHS_RHR; in i2c_sam_twihs_isr()
246 twihs->TWIHS_CR = TWIHS_CR_STOP; in i2c_sam_twihs_isr()
255 twihs->TWIHS_CR = TWIHS_CR_STOP; in i2c_sam_twihs_isr()
257 twihs->TWIHS_IDR = TWIHS_IDR_TXRDY; in i2c_sam_twihs_isr()
263 twihs->TWIHS_THR = msg->buf[msg->idx++]; in i2c_sam_twihs_isr()
276 twihs->TWIHS_IDR = twihs->TWIHS_IMR; in i2c_sam_twihs_isr()
285 Twihs *const twihs = dev_cfg->regs; in i2c_sam_twihs_initialize() local
306 twihs->TWIHS_CR = TWIHS_CR_SWRST; in i2c_sam_twihs_initialize()