ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_i2c.c
Go to the documentation of this file.
1
41
42#include "ra8_i2c.h"
43
44#include <stdint.h>
45
46#include "ra8_attributes.h"
47#include "ra8_check.h"
48#include "ra8_err.h"
49#include "ra8_hw_err.h"
50#include "ra8_i2c_internal.h"
51#include "ra8_i2c_regs.h"
52
65const char* const g_i2c_tag = "I2C";
66
82
97
114bool priv_ra8_i2c_internal_clk_invalid(uint32_t bus_hz, uint32_t pclkb_hz)
115{
116 return (bus_hz == 0U) || (pclkb_hz == 0U);
117}
118
133
156 uint8_t mask)
157{
158 for (uint32_t i = 0U; i < (uint32_t)k_ra8_i2c_poll_limit; i++) {
159 /* HUM Ch 39.2.10 "ICSR2 : I2C Bus Status Register 2" p 2384 */
160#if defined(RA8_OFF_TARGET) && defined(UNIT_TEST)
161 /* HUM Ch 39.2.10 "ICSR2 : I2C Bus Status Register 2" p 2384 */
162 if (ra8_fake_mmio_poll(&reg->ICSR2, i, (reg->ICSR2 & mask) != 0U)) {
163#else
164 /* HUM Ch 39.2.10 "ICSR2 : I2C Bus Status Register 2" p 2384 */
165 if ((reg->ICSR2 & mask) != 0U) {
166#endif
167 return k_ra8_ok;
168 }
169 }
171}
172
195{
196 if ((icsr2 & (uint8_t)k_ra8_i2c_msk_icsr2_nackf) != 0U) {
197 return k_ra8_err_nack;
198 }
199 if ((icsr2 & (uint8_t)k_ra8_i2c_msk_icsr2_al) != 0U) {
200 return k_ra8_err_hw_error;
201 }
202 return k_ra8_ok;
203}
204
223{
224 enum : uint8_t {
225 k_ra8_i2c_status_clear_mask =
226 (uint8_t)((1U << (uint8_t)k_ra8_i2c_icsr2_start_pos) | (uint8_t)k_ra8_i2c_msk_icsr2_stop |
228 (uint8_t)k_ra8_i2c_msk_icsr2_al),
229 };
230 /* HUM Ch 39.2.10 "ICSR2 : I2C Bus Status Register 2 -- W0C" p 2384 */
231 reg->ICSR2 = (uint8_t)(reg->ICSR2 & (uint8_t)~(uint8_t)k_ra8_i2c_status_clear_mask);
232}
233
251{
252 /* HUM Ch 39.2.2 "ICCR2 : I2C Bus Control Register 2" p 2371 */
253 reg->ICCR2 = (uint8_t)(reg->ICCR2 | (uint8_t)k_ra8_i2c_msk_iccr2_st);
254}
255
273{
274 /* HUM Ch 39.2.2 "ICCR2 : I2C Bus Control Register 2" p 2371 */
275 reg->ICCR2 = (uint8_t)(reg->ICCR2 | (uint8_t)k_ra8_i2c_msk_iccr2_rs);
276 /* RS auto-clears once the restart condition is issued. The peripheral
277 * address must be written to ICDRT only after RS reads 0 -- a write
278 * while RS = 1 is silently dropped (HUM Ch 39.11 "Issuing a Restart
279 * Condition" Note, p 2434). After a send_stop=false write TDRE is
280 * already 1, so without this wait send_address would write the address
281 * before the restart completed and the transmit would never happen. */
282 for (uint32_t i = 0U; i < (uint32_t)k_ra8_i2c_poll_limit; i++) {
283 /* HUM Ch 39.2.2 "ICCR2 : I2C Bus Control Register 2" p 2371 */
284 const bool restart_complete = (reg->ICCR2 & (uint8_t)k_ra8_i2c_msk_iccr2_rs) == 0U;
285#if defined(RA8_OFF_TARGET) && defined(UNIT_TEST)
286 /* HUM Ch 39.2.2 "ICCR2 : I2C Bus Control Register 2" p 2371 */
287 const bool observed = ra8_fake_mmio_poll(&reg->ICCR2, i, restart_complete);
288#else
289 const bool observed = restart_complete;
290#endif
291 if (observed) {
292 break;
293 }
294 }
295}
296
315{
316 /* HUM Ch 39.2.2 "ICCR2 : I2C Bus Control Register 2 -- BBSY" p 2371 */
317 for (uint32_t i = 0U; i < (uint32_t)k_ra8_i2c_poll_limit; i++) {
318 /* HUM Ch 39.2.2 "ICCR2 : I2C Bus Control Register 2" p 2371 */
319 if ((reg->ICCR2 & (uint8_t)k_ra8_i2c_msk_iccr2_bbsy) == 0U) {
320 break;
321 }
322 }
323}
324
344{
345 /* HUM Ch 39.2.10 "ICSR2 : I2C Bus Status Register 2" p 2384 */
346 reg->ICSR2 = (uint8_t)(reg->ICSR2 & (uint8_t)~(uint8_t)k_ra8_i2c_msk_icsr2_stop);
347 /* HUM Ch 39.2.2 "ICCR2 : I2C Bus Control Register 2" p 2371 */
348 reg->ICCR2 = (uint8_t)(reg->ICCR2 | (uint8_t)k_ra8_i2c_msk_iccr2_sp);
349}
350
373
392{
393 /* HUM Ch 39.2.5 "ICMR3 : I2C Bus Mode Register 3 -- ACKWP/ACKBT" p 2376 */
394 reg->ICMR3 = (uint8_t)(reg->ICMR3 | (uint8_t)k_ra8_i2c_msk_icmr3_ackwp);
395 reg->ICMR3 = (uint8_t)(reg->ICMR3 | (uint8_t)k_ra8_i2c_msk_icmr3_ackbt);
396 reg->ICMR3 = (uint8_t)(reg->ICMR3 & (uint8_t)~(uint8_t)k_ra8_i2c_msk_icmr3_ackwp);
397}
398
417RA8_INTERNAL static void internal_i2c_open_phase(volatile r_i2c_regs_t* reg, bool bus_held)
418{
419 if (bus_held) {
421 } else {
423 }
424}
425
449 bool bus_held)
450{
451 if (bus_held) {
452 return k_ra8_ok;
453 }
454 /* HUM Ch 39.2.2 "ICCR2 : I2C Bus Control Register 2 -- BBSY" p 2371 */
455 return ((reg->ICCR2 & (uint8_t)k_ra8_i2c_msk_iccr2_bbsy) == 0U) ? k_ra8_ok : k_ra8_err_busy;
456}
457
482 uint8_t address_byte)
483{
484 /* Wait for TDRE (set after START issues and TRS = transmit).
485 * HUM Ch 39.2.10 "ICSR2 : I2C Bus Status Register 2" p 2384 */
487 if (err != k_ra8_ok) {
488 return err;
489 }
490 /* HUM Ch 39.2.17 "ICDRT : I2C Bus Transmit Data Register" p 2393 */
491 reg->ICDRT = address_byte;
493}
494
518internal_i2c_drain_tx(volatile r_i2c_regs_t* reg, const uint8_t* data, uint32_t len)
519{
520 ra8_err_t err = k_ra8_ok;
521 for (uint32_t i = 0U; i < len; i++) {
523 if (err != k_ra8_ok) {
524 break;
525 }
526 /* HUM Ch 39.2.10 "ICSR2 : I2C Bus Status Register 2 -- NACKF" p 2384 */
527 if ((reg->ICSR2 & (uint8_t)k_ra8_i2c_msk_icsr2_nackf) != 0U) {
528 err = k_ra8_err_nack;
529 break;
530 }
531 /* HUM Ch 39.2.17 "ICDRT : I2C Bus Transmit Data Register" p 2393 */
532 reg->ICDRT = data[i];
533 }
534 return err;
535}
536
562internal_i2c_finish_tx(volatile r_i2c_regs_t* reg, uint8_t channel, ra8_err_t err, bool send_stop)
563{
564 if (err == k_ra8_ok) {
565 /* Wait for TEND before issuing STOP (Controller Transmit step 5).
566 * HUM Ch 39.2.10 "ICSR2 : I2C Bus Status Register 2" p 2384 */
568 }
569 if ((err != k_ra8_ok) || send_stop) {
572 s_i2c_state[channel].bus_held = false;
573 } else {
574 s_i2c_state[channel].bus_held = true;
575 }
576 return err;
577}
578
579ra8_err_t ra8_i2c_write(uint8_t channel,
580 uint8_t peripheral_7b,
581 const uint8_t* data,
582 uint32_t len,
583 bool send_stop)
584{
585 volatile r_i2c_regs_t* reg = ra8_i2c_regs(channel);
586 RA8_CHECK_NULL_PTR(reg, g_i2c_tag, "i2c_write: channel");
587 RA8_CHECK_NULL_PTR(data, g_i2c_tag, "i2c_write: data");
588
589 const bool bus_held = s_i2c_state[channel].bus_held;
590 const ra8_err_t busy_gate = internal_i2c_busy_gate(reg, bus_held);
591 if (busy_gate != k_ra8_ok) {
592 return busy_gate;
593 }
594
596 internal_i2c_open_phase(reg, bus_held);
597
598 const uint8_t address_byte =
599 (uint8_t)(((uint32_t)peripheral_7b << (uint32_t)k_ra8_i2c_addr_shift) |
600 (uint32_t)k_ra8_i2c_addr_rw_write);
601 ra8_err_t err = internal_i2c_send_address(reg, address_byte);
602 if (err != k_ra8_ok) {
604 s_i2c_state[channel].bus_held = false;
605 return err;
606 }
607
608 err = internal_i2c_drain_tx(reg, data, len);
609 return internal_i2c_finish_tx(reg, channel, err, send_stop);
610}
611
640internal_i2c_drain_rx(volatile r_i2c_regs_t* reg, uint8_t* out, uint32_t len)
641{
642 /* First RDRF marks the address-phase completion. Arm the short-read
643 * end-of-frame controls before the dummy read kicks off the data clock.
644 * HUM Ch 39.3.4 "Controller Receive Operation" p 2400 */
646 if (err != k_ra8_ok) {
647 return err;
648 }
649 if (len <= (uint32_t)k_ra8_i2c_rx_short_len) {
650 /* HUM Ch 39.2.5 "ICMR3 : I2C Bus Mode Register 3 -- WAIT" p 2376 */
651 reg->ICMR3 = (uint8_t)(reg->ICMR3 | (uint8_t)k_ra8_i2c_msk_icmr3_wait);
652 }
653 if (len == (uint32_t)k_ra8_i2c_rx_single_len) {
655 }
656 /* Dummy read starts the data clock.
657 * HUM Ch 39.2.18 "ICDRR : I2C Bus Receive Data Register" p 2393 */
658 (void)reg->ICDRR;
659
660 for (uint32_t loaded = 0U; loaded < len; loaded++) {
662 if (err != k_ra8_ok) {
663 break;
664 }
665 const uint32_t remain = len - loaded;
666 if (remain == (uint32_t)k_ra8_i2c_rx_remain_wait) {
667 /* HUM Ch 39.2.5 "ICMR3 : I2C Bus Mode Register 3 -- WAIT" p 2376 */
668 reg->ICMR3 = (uint8_t)(reg->ICMR3 | (uint8_t)k_ra8_i2c_msk_icmr3_wait);
669 } else if (remain == (uint32_t)k_ra8_i2c_rx_remain_nack) {
671 } else if (remain == (uint32_t)k_ra8_i2c_rx_remain_stop) {
673 } else {
674 /* Mid-stream byte: no end-of-frame control to arm. */
675 }
676 /* HUM Ch 39.2.18 "ICDRR : I2C Bus Receive Data Register" p 2393 */
677 out[loaded] = reg->ICDRR;
678 }
679 /* Clear WAIT (lets the requested STOP fire) and ACKBT for the next
680 * transaction, then wait for the bus to be released.
681 * HUM Ch 39.2.5 "ICMR3 : I2C Bus Mode Register 3" p 2376 */
682 reg->ICMR3 = (uint8_t)(reg->ICMR3 & (uint8_t)~(uint8_t)((uint8_t)k_ra8_i2c_msk_icmr3_wait |
683 (uint8_t)k_ra8_i2c_msk_icmr3_ackbt));
685 return err;
686}
687
688ra8_err_t ra8_i2c_read(uint8_t channel, uint8_t peripheral_7b, uint8_t* data, uint32_t len)
689{
690 volatile r_i2c_regs_t* reg = ra8_i2c_regs(channel);
691 RA8_CHECK_NULL_PTR(reg, g_i2c_tag, "i2c_read: channel");
692 RA8_CHECK_NULL_PTR(data, g_i2c_tag, "i2c_read: data");
693 if (len == 0U) {
695 }
696
697 const bool bus_held = s_i2c_state[channel].bus_held;
698 const ra8_err_t busy_gate = internal_i2c_busy_gate(reg, bus_held);
699 if (busy_gate != k_ra8_ok) {
700 return busy_gate;
701 }
702
704 internal_i2c_open_phase(reg, bus_held);
705
706 const uint8_t address_byte =
707 (uint8_t)(((uint32_t)peripheral_7b << (uint32_t)k_ra8_i2c_addr_shift) |
708 (uint32_t)k_ra8_i2c_addr_rw_read);
709 ra8_err_t err = internal_i2c_send_address(reg, address_byte);
710 if (err != k_ra8_ok) {
712 s_i2c_state[channel].bus_held = false;
713 return err;
714 }
715
716 err = internal_i2c_drain_rx(reg, data, len);
717 const ra8_err_t status_err = internal_i2c_status_from_icsr2(reg->ICSR2);
718 if (status_err != k_ra8_ok) {
719 err = status_err;
720 }
722 s_i2c_state[channel].bus_held = false;
723 return err;
724}
725
727 uint8_t peripheral_7b,
728 const uint8_t* wr,
729 uint32_t wr_len,
730 uint8_t* rd,
731 uint32_t rd_len)
732{
733 if (ra8_i2c_regs(channel) == nullptr) {
734 return k_ra8_err_null_ptr;
735 }
736 if ((wr_len == 0U) && (rd_len == 0U)) {
738 }
739 if ((wr_len != 0U) && (wr == nullptr)) {
740 return k_ra8_err_null_ptr;
741 }
742 if ((rd_len != 0U) && (rd == nullptr)) {
743 return k_ra8_err_null_ptr;
744 }
745
746 /* Phase 1: write, holding the bus when a read phase follows. */
747 if (wr_len != 0U) {
748 const ra8_err_t w_err =
749 ra8_i2c_write(channel, peripheral_7b, wr, wr_len, /*send_stop=*/(rd_len == 0U));
750 if (w_err != k_ra8_ok) {
751 return w_err;
752 }
753 }
754
755 /* Phase 2: read (issues STOP and releases the bus). */
756 if (rd_len != 0U) {
757 return ra8_i2c_read(channel, peripheral_7b, rd, rd_len);
758 }
759 return k_ra8_ok;
760}
761
762ra8_err_t ra8_i2c_scan(uint8_t channel, uint8_t peripheral_7b, bool* out_acked)
763{
764 volatile r_i2c_regs_t* reg = ra8_i2c_regs(channel);
765 RA8_CHECK_NULL_PTR(reg, g_i2c_tag, "i2c_scan: channel");
766 RA8_CHECK_NULL_PTR(out_acked, g_i2c_tag, "i2c_scan: out_acked");
767
768 *out_acked = false;
769 const ra8_err_t busy_gate = internal_i2c_busy_gate(reg, s_i2c_state[channel].bus_held);
770 if (busy_gate != k_ra8_ok) {
771 return busy_gate;
772 }
773
776
777 const uint8_t address_byte =
778 (uint8_t)(((uint32_t)peripheral_7b << (uint32_t)k_ra8_i2c_addr_shift) |
779 (uint32_t)k_ra8_i2c_addr_rw_write);
780 ra8_err_t err = internal_i2c_send_address(reg, address_byte);
781 /* Address NACK is a valid probe outcome, not a hard failure. */
782 if ((err != k_ra8_ok) && (err != k_ra8_err_nack)) {
784 s_i2c_state[channel].bus_held = false;
785 return err;
786 }
787
788 /* Wait for TEND (peripheral ACKed) or NACKF (no peripheral answered).
789 * HUM Ch 39.2.10 "ICSR2 : I2C Bus Status Register 2" p 2384 */
791 reg,
792 (uint8_t)((uint8_t)k_ra8_i2c_msk_icsr2_tend | (uint8_t)k_ra8_i2c_msk_icsr2_nackf));
793 if (err == k_ra8_ok) {
794 *out_acked = (reg->ICSR2 & (uint8_t)k_ra8_i2c_msk_icsr2_nackf) == 0U;
795 }
796
799 s_i2c_state[channel].bus_held = false;
800 return err;
801}
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Definition ra8_check.h:243
Error Code Definitions for ra8-firmware.
@ k_ra8_err_busy
Resource busy – blocking operation cannot proceed.
Definition ra8_err.h:195
@ k_ra8_err_invalid_arg
Invalid function argument.
Definition ra8_err.h:152
@ k_ra8_err_hw_timeout
Hardware timed out waiting for a flag or handshake.
Definition ra8_err.h:304
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Definition ra8_err.h:119
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
Definition ra8_err.h:478
@ k_ra8_err_hw_error
Generic hardware fault detected (error flag set, fault interrupt).
Definition ra8_err.h:310
@ k_ra8_err_nack
Peer responded with NACK (negative acknowledgement).
Definition ra8_err.h:435
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Bounded wait-flag primitives for RA8D2 HAL drivers.
static void internal_i2c_stop_request(volatile r_i2c_regs_t *reg)
Request a STOP condition without waiting for it to complete.
Definition ra8_i2c.c:343
ra8_err_t ra8_i2c_scan(uint8_t channel, uint8_t peripheral_7b, bool *out_acked)
Probe whether a 7-bit peripheral address ACKs.
Definition ra8_i2c.c:762
static void internal_i2c_restart(volatile r_i2c_regs_t *reg)
Issue a repeated-START condition (HUM Ch 39.11 p 2434).
Definition ra8_i2c.c:272
ra8_i2c_state_t s_i2c_state[k_ra8_i2c_channel_count]
Per-channel state table indexed by channel.
Definition ra8_i2c.c:132
ra8_err_t ra8_i2c_write(uint8_t channel, uint8_t peripheral_7b, const uint8_t *data, uint32_t len, bool send_stop)
Polling write of len bytes to a 7-bit peripheral address.
Definition ra8_i2c.c:579
static void internal_i2c_wait_bus_free(volatile const r_i2c_regs_t *reg)
Spin (bounded) until the bus is free (ICCR2.BBSY clears).
Definition ra8_i2c.c:314
static void internal_i2c_stop(volatile r_i2c_regs_t *reg)
Issue a STOP condition and wait for the bus to be released.
Definition ra8_i2c.c:368
static void internal_i2c_clear_status(volatile r_i2c_regs_t *reg)
Clear the START / STOP / NACK status flags ahead of a transfer.
Definition ra8_i2c.c:222
static ra8_err_t internal_i2c_busy_gate(volatile const r_i2c_regs_t *reg, bool bus_held)
Bus-busy gate: reject a fresh transaction while BBSY is set, unless the channel currently holds the b...
Definition ra8_i2c.c:448
static ra8_err_t internal_i2c_wait_icsr2(volatile const r_i2c_regs_t *reg, uint8_t mask)
Wait for a flag in ICSR2 to set, with a bounded spin budget.
Definition ra8_i2c.c:155
ra8_err_t ra8_i2c_read(uint8_t channel, uint8_t peripheral_7b, uint8_t *data, uint32_t len)
Polling read of len bytes from a 7-bit peripheral.
Definition ra8_i2c.c:688
ra8_i2c_rx_phase_t
Controller-receive end-of-frame boundaries (HUM Ch 39.3.4 p 2400).
Definition ra8_i2c.c:90
@ k_ra8_i2c_rx_remain_wait
bytes-remaining == this: arm WAIT.
Definition ra8_i2c.c:93
@ k_ra8_i2c_rx_remain_nack
bytes-remaining == this: NACK final byte.
Definition ra8_i2c.c:94
@ k_ra8_i2c_rx_remain_stop
bytes-remaining == this: request STOP.
Definition ra8_i2c.c:95
@ k_ra8_i2c_rx_short_len
len <= this: arm WAIT in the dummy phase.
Definition ra8_i2c.c:91
@ k_ra8_i2c_rx_single_len
len == this: NACK in the dummy phase.
Definition ra8_i2c.c:92
ra8_i2c_internal_t
Implementation constants – spin budgets and addressing helpers.
Definition ra8_i2c.c:71
@ k_ra8_i2c_addr_rw_write
R/W bit value for a write transaction (0 in LSB).
Definition ra8_i2c.c:78
@ k_ra8_i2c_addr_rw_read
R/W bit value for a read transaction (1 in LSB).
Definition ra8_i2c.c:80
@ k_ra8_i2c_poll_limit
Generic spin budget for status-flag polls.
Definition ra8_i2c.c:74
@ k_ra8_i2c_addr_shift
Shift count to convert a 7-bit address into the on-the-wire byte.
Definition ra8_i2c.c:76
bool priv_ra8_i2c_internal_clk_invalid(uint32_t bus_hz, uint32_t pclkb_hz)
Pure predicate: either clock argument is zero.
Definition ra8_i2c.c:114
static ra8_err_t internal_i2c_drain_rx(volatile r_i2c_regs_t *reg, uint8_t *out, uint32_t len)
Drain len bytes from ICDRR into out (controller receive).
Definition ra8_i2c.c:640
static void internal_i2c_open_phase(volatile r_i2c_regs_t *reg, bool bus_held)
Issue START or RESTART based on whether the bus is held.
Definition ra8_i2c.c:417
static void internal_i2c_start(volatile r_i2c_regs_t *reg)
Issue a START condition (HUM Ch 39.3.3 step 2 p 2396).
Definition ra8_i2c.c:250
ra8_err_t ra8_i2c_transfer(uint8_t channel, uint8_t peripheral_7b, const uint8_t *wr, uint32_t wr_len, uint8_t *rd, uint32_t rd_len)
Combined write-then-RESTART-then-read in one bus transaction.
Definition ra8_i2c.c:726
static ra8_err_t internal_i2c_status_from_icsr2(uint8_t icsr2)
Map latched ICSR2 error bits to a high-level status code.
Definition ra8_i2c.c:194
static ra8_err_t internal_i2c_drain_tx(volatile r_i2c_regs_t *reg, const uint8_t *data, uint32_t len)
Push len bytes from data into ICDRT.
Definition ra8_i2c.c:518
const char *const g_i2c_tag
Log tag for this driver, shared with ra8_i2c_config.c.
Definition ra8_i2c.c:65
static ra8_err_t internal_i2c_finish_tx(volatile r_i2c_regs_t *reg, uint8_t channel, ra8_err_t err, bool send_stop)
Finish a write: wait for TEND, then STOP or hold the bus.
Definition ra8_i2c.c:562
static void internal_i2c_set_nack(volatile r_i2c_regs_t *reg)
Set ICMR3.ACKBT (transmit NACK) under ACKWP write-enable.
Definition ra8_i2c.c:391
static ra8_err_t internal_i2c_send_address(volatile r_i2c_regs_t *reg, uint8_t address_byte)
Transmit one address byte (HUM Ch 39.3.3 step 3 p 2396).
Definition ra8_i2c.c:481
I2C Bus Interface (IIC) controller driver – polling mode.
Test-access surface for ra8_i2c internal helpers (MC/DC).
I2C Bus Interface (IIC) register layout for the Renesas RA8D2.
@ k_ra8_i2c_msk_icsr2_al
HUM 39.2.10 ICSR2.AL, p 2384.
@ k_ra8_i2c_msk_iccr2_rs
HUM 39.2.2 ICCR2.RS, p 2371.
@ k_ra8_i2c_msk_iccr2_st
HUM 39.2.2 ICCR2.ST, p 2371.
@ k_ra8_i2c_msk_icsr2_nackf
HUM 39.2.10 ICSR2.NACKF, p 2384.
@ k_ra8_i2c_msk_iccr2_sp
HUM 39.2.2 ICCR2.SP, p 2371.
@ k_ra8_i2c_msk_icsr2_tdre
HUM 39.2.10 ICSR2.TDRE, p 2384.
@ k_ra8_i2c_msk_icmr3_wait
HUM 39.2.5 ICMR3.WAIT, p 2376.
@ k_ra8_i2c_msk_iccr2_bbsy
HUM 39.2.2 ICCR2.BBSY, p 2371.
@ k_ra8_i2c_msk_icsr2_stop
HUM 39.2.10 ICSR2.STOP, p 2384.
@ k_ra8_i2c_msk_icmr3_ackbt
HUM 39.2.5 ICMR3.ACKBT, p 2376.
@ k_ra8_i2c_msk_icsr2_tend
HUM 39.2.10 ICSR2.TEND, p 2384.
@ k_ra8_i2c_msk_icmr3_ackwp
HUM 39.2.5 ICMR3.ACKWP, p 2376.
@ k_ra8_i2c_msk_icsr2_rdrf
HUM 39.2.10 ICSR2.RDRF, p 2384.
@ k_ra8_i2c_channel_count
HUM Ch 39.1, p 2367 (3 channels).
static volatile r_i2c_regs_t * ra8_i2c_regs(uint8_t channel)
Get a pointer to the IIC channel channel register block.
@ k_ra8_i2c_icsr2_start_pos
Start condition detection flag.
Memory-mapped register block for one IIC channel.
volatile uint8_t ICCR2
+0x01 Bus Control Register 2 (HUM 39.2.2, p 2371).
volatile uint8_t ICDRT
+0x12 Transmit Data Register (HUM 39.2.17, p 2393).
volatile uint8_t ICDRR
+0x13 Receive Data Register (HUM 39.2.18, p 2393).
volatile uint8_t ICMR3
+0x04 Bus Mode Register 3 (HUM 39.2.5, p 2376).
volatile uint8_t ICSR2
+0x09 Bus Status Register 2 (HUM 39.2.10, p 2384).
Per-channel driver state shared by both I2C translation units.