ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_sci_regs.h
Go to the documentation of this file.
1
62
63#pragma once
64
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69#include <stdint.h>
70
71#include "ra8_attributes.h"
72
73/* =============================================================================
74 * Base addresses + layout
75 * =============================================================================
76 */
77
88typedef enum : uintptr_t {
89 k_ra8_sci0_base_addr = 0x40358000UL,
90 k_ra8_sci1_base_addr = 0x40358100UL,
91 k_ra8_sci2_base_addr = 0x40358200UL,
92 k_ra8_sci3_base_addr = 0x40358300UL,
93 k_ra8_sci4_base_addr = 0x40358400UL,
94 k_ra8_sci5_base_addr = 0x40358500UL,
95 k_ra8_sci6_base_addr = 0x40358600UL,
96 k_ra8_sci7_base_addr = 0x40358700UL,
97 k_ra8_sci8_base_addr = 0x40358800UL,
98 k_ra8_sci9_base_addr = 0x40358900UL,
100
110
111/* =============================================================================
112 * Register layout (per channel)
113 * =============================================================================
114 */
115
131typedef struct {
132 volatile uint32_t RDR;
133 volatile uint32_t TDR;
134 volatile uint32_t CCR0;
135 volatile uint32_t CCR1;
136 volatile uint32_t CCR2;
137 volatile uint32_t CCR3;
138 volatile uint32_t CCR4;
139 volatile uint32_t CESR;
140 volatile uint32_t ICR;
141 volatile uint32_t FCR;
142 volatile uint32_t _r_28;
143 volatile uint32_t MCR;
144 volatile uint32_t DCR;
145 volatile uint32_t XCR0;
146 volatile uint32_t XCR1;
147 volatile uint32_t XCR2;
148 volatile uint32_t _r_40[2];
149 volatile uint32_t CSR;
150 volatile uint32_t ISR;
151 volatile uint32_t FRSR;
152 volatile uint32_t FTSR;
153 volatile uint32_t MSR;
154 volatile uint32_t XSR0;
155 volatile uint32_t XSR1;
156 volatile uint32_t _r_64;
157 volatile uint32_t CFCLR;
158 volatile uint32_t ICFCLR;
159 volatile uint32_t FFCLR;
160 volatile uint32_t MFCLR;
161 volatile uint32_t XFCLR;
163
164/* =============================================================================
165 * Accessors
166 * =============================================================================
167 */
168
180static inline volatile r_sci_regs_t* ra8_sci(uint8_t channel)
181{
182 if (channel > k_ra8_sci_channel_max) {
183 return nullptr;
184 }
185 return (volatile r_sci_regs_t*)(k_ra8_sci0_base_addr +
186 ((uintptr_t)channel * (uintptr_t)k_ra8_sci_channel_stride));
187}
188
189/* =============================================================================
190 * CCR0 -- Common Control Register 0
191 * =============================================================================
192 */
193
211
212/* =============================================================================
213 * CCR1 -- Common Control Register 1
214 * =============================================================================
215 */
216
237
238/* =============================================================================
239 * CCR2 -- Common Control Register 2 (BRR / clock select / MDDR)
240 * =============================================================================
241 */
242
259
270
282typedef enum : uint32_t {
285
296typedef enum : uint32_t {
299
300/* =============================================================================
301 * CCR3 -- Common Control Register 3 (mode / FIFO / clock-enable)
302 * =============================================================================
303 */
304
329
340
354
364typedef enum : uint32_t {
367
368/* =============================================================================
369 * XCR0 / XCR1 / XCR2 -- Simple LIN control registers
370 * =============================================================================
371 */
372
395
410
425
437
448typedef enum : uint32_t {
452
453/* =============================================================================
454 * XSR0 / XSR1 -- Simple LIN status registers
455 * =============================================================================
456 */
457
481
495
496/* =============================================================================
497 * XFCLR -- Simple LIN Flag Clear Register
498 * =============================================================================
499 */
500
520
530typedef enum : uint32_t {
533
534/* =============================================================================
535 * CSR -- Common Status Register
536 * =============================================================================
537 */
538
559
560/* =============================================================================
561 * CFCLR -- Common Flag Clear Register
562 * =============================================================================
563 */
564
585
611typedef enum : uint32_t {
614
615/* =============================================================================
616 * FFCLR -- FIFO Flag Clear Register
617 * =============================================================================
618 */
619
628typedef enum : uint8_t {
631
641typedef enum : uint32_t {
644
645/* =============================================================================
646 * RDR / TDR field masks
647 * =============================================================================
648 */
649
654typedef enum : uint32_t {
658
659#ifdef __cplusplus
660}
661#endif
Annotation-attribute framework macros for ra8-firmware.
#define RA8_HW_REGISTER_ACCESS
Mark an MMIO accessor function (returns volatile register pointer).
static volatile r_sci_regs_t * ra8_sci(uint8_t channel)
Get pointer to SCI_B channel N (0..9).
ra8_sci_ccr3_mod_t
Encoded values for CCR3.MOD[2:0] (HUM Ch 38.2.8, p 2204).
@ k_ra8_sci_ccr3_mod_manchester
Manchester.
@ k_ra8_sci_ccr3_mod_async
Asynchronous (UART/multi-proc).
@ k_ra8_sci_ccr3_mod_smartcard
Smart Card.
@ k_ra8_sci_ccr3_mod_simple_iic
Simple IIC.
@ k_ra8_sci_ccr3_mod_clocksync
Clock-synchronous.
@ k_ra8_sci_ccr3_mod_simple_lin
Simple LIN.
@ k_ra8_sci_ccr3_mod_simple_spi
Simple SPI.
ra8_sci_ccr0_bit_t
Bit positions in CCR0.
@ k_ra8_sci_ccr0_bit_re
Receive Enable.
@ k_ra8_sci_ccr0_bit_mpie
Multi-Processor Interrupt Enable.
@ k_ra8_sci_ccr0_bit_tie
Transmit Interrupt Enable.
@ k_ra8_sci_ccr0_bit_rie
Receive Interrupt Enable.
@ k_ra8_sci_ccr0_bit_idsel
ID Frame Select.
@ k_ra8_sci_ccr0_bit_teie
Transmit End Interrupt Enable.
@ k_ra8_sci_ccr0_bit_te
Transmit Enable.
@ k_ra8_sci_ccr0_bit_sse
SSn Pin Function Enable.
@ k_ra8_sci_ccr0_bit_dcme
Data Compare Match Enable.
ra8_sci_ccr2_mddr_const_t
Modulation-duty-setting constants.
@ k_ra8_sci_mddr_default
MDDR reset value (modulation disabled).
ra8_sci_base_addr_t
Per-channel SCI_B base addresses (Secure alias).
@ k_ra8_sci0_base_addr
RA8 sci0 base address.
@ k_ra8_sci6_base_addr
RA8 sci6 base address.
@ k_ra8_sci7_base_addr
RA8 sci7 base address.
@ k_ra8_sci4_base_addr
RA8 sci4 base address.
@ k_ra8_sci2_base_addr
RA8 sci2 base address.
@ k_ra8_sci5_base_addr
RA8 sci5 base address.
@ k_ra8_sci3_base_addr
RA8 sci3 base address.
@ k_ra8_sci1_base_addr
RA8 sci1 base address.
@ k_ra8_sci8_base_addr
RA8 sci8 base address.
@ k_ra8_sci9_base_addr
RA8 sci9 base address.
ra8_sci_xfclr_bit_t
Bit positions in XFCLR (Simple LIN Flag Clear Register).
@ k_ra8_sci_xfclr_bit_bfoc
Clear XSR0.BFOF.
@ k_ra8_sci_xfclr_bit_cf1mc
Clear XSR0.CF1MF.
@ k_ra8_sci_xfclr_bit_pibdc
Clear XSR0.PIBDF.
@ k_ra8_sci_xfclr_bit_cofc
Clear XSR0.COF.
@ k_ra8_sci_xfclr_bit_aedc
Clear XSR0.AEDF.
@ k_ra8_sci_xfclr_bit_bfdc
Clear XSR0.BFDF.
@ k_ra8_sci_xfclr_bit_cf0mc
Clear XSR0.CF0MF.
@ k_ra8_sci_xfclr_bit_bcdc
Clear XSR0.BCDF.
ra8_sci_xcr2_bit_t
Field shifts in XCR2 (Simple LIN Control 2).
@ k_ra8_sci_xcr2_shift_cf0ce
CF0CE[7:0] CF0 compare bit enable.
@ k_ra8_sci_xcr2_shift_bflw
BFLW[15:0] Break Field length.
@ k_ra8_sci_xcr2_shift_cf0d
CF0D[7:0] Control Field 0 compare data.
ra8_sci_xcr2_bflw_t
Break Field length (XCR2.BFLW[15:0]) constants.
@ k_ra8_sci_xcr2_bflw_max
Highest legal BFLW (0xFFFF banned).
@ k_ra8_sci_xcr2_bflw_reset
BFLW reset value.
ra8_sci_cfclr_default_t
CFCLR "clear-all" default mask.
@ k_ra8_sci_cfclr_default
Clear every W1C bit at once.
ra8_sci_data_mask_t
Masks for RDR/TDR data fields (HUM 38.2.2 p 2180, 38.2.3 p 2181).
@ k_ra8_sci_rdr_mask_data8
RDAT[7:0] for 8-bit reception.
@ k_ra8_sci_tdr_mask_data8
TDAT[7:0] for 8-bit transmission.
ra8_sci_ccr3_bit_t
Bit positions / shifts in CCR3.
@ k_ra8_sci_ccr3_bit_gm
Smart-card GSM Mode.
@ k_ra8_sci_ccr3_bit_cpha
Clock Phase (sync only).
@ k_ra8_sci_ccr3_bit_den
RS-485 Driver Enable.
@ k_ra8_sci_ccr3_bit_lsbf
LSB First.
@ k_ra8_sci_ccr3_bit_sinv
Data Invert.
@ k_ra8_sci_ccr3_bit_mp
Multi-Processor mode.
@ k_ra8_sci_ccr3_bit_bpen
Synchronizer Bypass Enable.
@ k_ra8_sci_ccr3_bit_stp
Stop Bit Length (0=1, 1=2).
@ k_ra8_sci_ccr3_shift_chr
CHR[1:0] data-length field.
@ k_ra8_sci_ccr3_shift_cke
CKE[1:0] clock enable.
@ k_ra8_sci_ccr3_bit_fm
FIFO Mode Select.
@ k_ra8_sci_ccr3_bit_rxdesel
Async Start Bit Edge Detect.
@ k_ra8_sci_ccr3_bit_blk
Smart-card Block Transfer.
@ k_ra8_sci_ccr3_shift_mod
MOD[2:0] mode select.
@ k_ra8_sci_ccr3_bit_cpol
Clock Polarity (sync only).
@ k_ra8_sci_ccr3_bit_acs0
Async Mode Clock Source.
ra8_sci_ccr1_bit_t
Bit positions in CCR1.
@ k_ra8_sci_ccr1_bit_pm
Parity Mode (0=even, 1=odd).
@ k_ra8_sci_ccr1_bit_pe
Parity Enable.
@ k_ra8_sci_ccr1_bit_ctse
CTS Enable.
@ k_ra8_sci_ccr1_bit_spb2dt
Serial Port Break Data Select.
@ k_ra8_sci_ccr1_bit_ctspen
CTS External Pin Enable.
@ k_ra8_sci_ccr1_bit_nfm
Noise Filter Mode.
@ k_ra8_sci_ccr1_bit_rinv
RXD Invert.
@ k_ra8_sci_ccr1_bit_sharps
Half-Duplex Communication Select.
@ k_ra8_sci_ccr1_bit_splp
Loopback Control.
@ k_ra8_sci_ccr1_bit_tinv
TXD Invert.
@ k_ra8_sci_ccr1_bit_spb2io
Serial Port Break I/O.
@ k_ra8_sci_ccr1_bit_nfen
Digital Noise Filter Enable.
ra8_sci_ccr3_mod_mask_t
Field mask for CCR3.MOD[18:16] (mode select).
@ k_ra8_sci_ccr3_mask_mod
MOD[18:16] in CCR3.
ra8_sci_ccr2_bit_t
Bit positions / shifts in CCR2.
@ k_ra8_sci_ccr2_bit_abcs
Async Mode Base Clock Select (0=16x).
@ k_ra8_sci_ccr2_bit_bgdm
Baud Rate Generator Double-Speed.
@ k_ra8_sci_ccr2_shift_mddr
MDDR[7:0] field shift.
@ k_ra8_sci_ccr2_bit_abcse2
Async Mode Extended Base Clock 2.
@ k_ra8_sci_ccr2_shift_cks
CKS[1:0] field shift.
@ k_ra8_sci_ccr2_bit_abcse
Async Mode Extended Base Clock.
@ k_ra8_sci_ccr2_shift_brr
BRR[7:0] field shift.
@ k_ra8_sci_ccr2_bit_brme
Bit Rate Modulation Enable.
ra8_sci_csr_bit_t
Bit positions in CSR.
@ k_ra8_sci_csr_bit_tend
Transmit End.
@ k_ra8_sci_csr_bit_ers
Smart-card Error Signal Status.
@ k_ra8_sci_csr_bit_rdrf
Receive Data Full.
@ k_ra8_sci_csr_bit_dfer
Compare-Match Framing Error.
@ k_ra8_sci_csr_bit_dper
Compare-Match Parity Error.
@ k_ra8_sci_csr_bit_mff
Mode Fault Error (SPI).
@ k_ra8_sci_csr_bit_rxdmon
RXDn Pin Monitor.
@ k_ra8_sci_csr_bit_tdre
Transmit Data Empty.
@ k_ra8_sci_csr_bit_fer
Framing Error.
@ k_ra8_sci_csr_bit_orer
Overrun Error.
@ k_ra8_sci_csr_bit_dcmf
Data Compare Match.
@ k_ra8_sci_csr_bit_per
Parity Error.
ra8_sci_ffclr_default_t
FFCLR "clear-all" default mask.
@ k_ra8_sci_ffclr_default
Clear FRSR.DR latch.
ra8_sci_limits_t
Channel-count and stride constants.
@ k_ra8_sci_channel_max
Highest valid channel index.
@ k_ra8_sci_channel_stride
Bytes between SCI channels.
@ k_ra8_sci_channel_count
SCI0..SCI9.
ra8_sci_ccr2_brr_const_t
Constants used in the BRR formula.
@ k_ra8_sci_brr_async_divisor
64 * 2^(2*0 - 1) for n = 0.
ra8_sci_xsr0_bit_t
Bit positions in XSR0 (Simple LIN Status Register 0).
@ k_ra8_sci_xsr0_bit_bfof
Break Field Output Completion Flag.
@ k_ra8_sci_xsr0_bit_bfdf
Break Field Detection Flag (1 = seen).
@ k_ra8_sci_xsr0_bit_sfsf
Start Frame Status (1 = detecting).
@ k_ra8_sci_xsr0_bit_cf0mf
Control Field 0 Compare Match Flag.
@ k_ra8_sci_xsr0_bit_cf1mf
Control Field 1 Compare Match Flag.
@ k_ra8_sci_xsr0_bit_bcdf
Bus Conflict Detection Flag.
@ k_ra8_sci_xsr0_bit_aedf
Active Edge Detection Flag (sync edge).
@ k_ra8_sci_xsr0_bit_rxdsf
RXDn Input Status.
@ k_ra8_sci_xsr0_bit_pibdf
Priority Interrupt Bit Detection Flag.
@ k_ra8_sci_xsr0_bit_cof
Counter Overflow Flag.
ra8_sci_xfclr_default_t
XFCLR "clear-all-LIN-latches" default mask.
@ k_ra8_sci_xfclr_default
Clear every LIN W1C latch at once.
ra8_sci_cfclr_bit_t
Bit positions in CFCLR.
@ k_ra8_sci_cfclr_bit_dcmfc
Clear CSR.DCMF.
@ k_ra8_sci_cfclr_bit_tdrec
Clear CSR.TDRE.
@ k_ra8_sci_cfclr_bit_perc
Clear CSR.PER.
@ k_ra8_sci_cfclr_bit_mffc
Clear CSR.MFF.
@ k_ra8_sci_cfclr_bit_dferc
Clear CSR.DFER.
@ k_ra8_sci_cfclr_bit_dperc
Clear CSR.DPER.
@ k_ra8_sci_cfclr_bit_ferc
Clear CSR.FER.
@ k_ra8_sci_cfclr_bit_rdrfc
Clear CSR.RDRF.
@ k_ra8_sci_cfclr_bit_ersc
Clear CSR.ERS.
@ k_ra8_sci_cfclr_bit_orerc
Clear CSR.ORER.
ra8_sci_xsr1_field_t
Field shift / mask for XSR1 (Simple LIN Status Register 1).
@ k_ra8_sci_xsr1_shift_tcnt
TCNT[15:0] field shift.
@ k_ra8_sci_xsr1_mask_tcnt
TCNT[15:0] field mask.
ra8_sci_xcr0_bit_t
Bit positions / field shifts in XCR0 (Simple LIN Control 0).
@ k_ra8_sci_xcr0_bit_pibe
Priority Interrupt Bit Enable.
@ k_ra8_sci_xcr0_shift_tcss
TCSS[1:0] timer count clock source.
@ k_ra8_sci_xcr0_bit_bfdie
Break Field Detection IE.
@ k_ra8_sci_xcr0_shift_cf1ds
CF1DS[1:0] CF1 compare-data select.
@ k_ra8_sci_xcr0_bit_aedie
Active Edge Detection IE.
@ k_ra8_sci_xcr0_shift_pibs
PIBS[2:0] priority interrupt bit.
@ k_ra8_sci_xcr0_bit_bfoie
Break Field Output Completion IE.
@ k_ra8_sci_xcr0_bit_cf0re
Control Field 0 Enable.
@ k_ra8_sci_xcr0_bit_bfe
Break Field Enable.
@ k_ra8_sci_xcr0_bit_bcdie
Bus Conflict Detection IE.
@ k_ra8_sci_xcr0_bit_cofie
Counter Overflow IE.
@ k_ra8_sci_xcr0_shift_bccs
BCCS[1:0] bus-conflict clock.
ra8_sci_ccr3_chr_t
Encoded values for CCR3.CHR[1:0] (HUM Ch 38.2.8, p 2204).
@ k_ra8_sci_ccr3_chr_8bit
10 = 8-bit data (initial value).
@ k_ra8_sci_ccr3_chr_9bit_b
01 = 9-bit data.
@ k_ra8_sci_ccr3_chr_9bit_a
00 = 9-bit data.
@ k_ra8_sci_ccr3_chr_7bit
11 = 7-bit data.
ra8_sci_xcr1_bit_t
Bit positions / field shifts in XCR1 (Simple LIN Control 1).
@ k_ra8_sci_xcr1_bit_bmen
Bit Rate Measurement Enable.
@ k_ra8_sci_xcr1_shift_cf1ce
CF1CE[7:0] CF1 compare bit enable.
@ k_ra8_sci_xcr1_shift_scf1d
SCF1D[7:0] secondary compare data CF1.
@ k_ra8_sci_xcr1_bit_sdst
Start Frame Detection Enable.
@ k_ra8_sci_xcr1_shift_pcf1d
PCF1D[7:0] priority compare data CF1.
@ k_ra8_sci_xcr1_bit_tcst
Break Field Output Timer Count Start.
ra8_sci_ccr2_mask_t
Field masks (post-shift) for CCR2.
@ k_ra8_sci_ccr2_mask_cks_field
CKS[21:20] in CCR2.
@ k_ra8_sci_ccr2_mask_brr_field
BRR[15:8] in CCR2.
@ k_ra8_sci_ccr2_mask_brr_byte
8-bit BRR value.
@ k_ra8_sci_ccr2_mask_mddr_field
MDDR[31:24].
ra8_sci_ffclr_bit_t
Bit positions in FFCLR.
@ k_ra8_sci_ffclr_bit_drc
Clear FRSR.DR.
ra8_sci_xcr0_tcss_t
Encoded values for XCR0.TCSS[1:0] (timer count clock source).
@ k_ra8_sci_xcr0_tcss_div64
TCLK / 64.
@ k_ra8_sci_xcr0_tcss_div4
TCLK / 4.
@ k_ra8_sci_xcr0_tcss_div16
TCLK / 16.
Per-channel SCI_B register window.
volatile uint32_t CCR4
+0x18 Common Control 4.
volatile uint32_t XCR1
+0x38 Simple LIN Control 1.
volatile uint32_t XSR1
+0x60 Simple LIN Status 1.
volatile uint32_t FCR
+0x24 FIFO Control.
volatile uint32_t FFCLR
+0x70 FIFO Flag Clear.
volatile uint32_t XFCLR
+0x78 Simple LIN Flag Clear.
volatile uint32_t _r_28
Reserved at offset 0x28.
volatile uint32_t CSR
+0x48 Common Status.
volatile uint32_t RDR
+0x00 Receive Data.
volatile uint32_t XSR0
+0x5C Simple LIN Status 0.
volatile uint32_t _r_64
Reserved at offset 0x64.
volatile uint32_t ICFCLR
+0x6C Simple IIC Flag Clear.
volatile uint32_t CCR2
+0x10 Common Control 2.
volatile uint32_t MCR
+0x2C Manchester Control.
volatile uint32_t FTSR
+0x54 FIFO Transmit Status.
volatile uint32_t CESR
+0x1C Communication Enable Status.
volatile uint32_t MSR
+0x58 Manchester Status.
volatile uint32_t TDR
+0x04 Transmit Data.
volatile uint32_t CCR1
+0x0C Common Control 1.
volatile uint32_t DCR
+0x30 Driver Control.
volatile uint32_t MFCLR
+0x74 Manchester Flag Clear.
volatile uint32_t CCR3
+0x14 Common Control 3.
volatile uint32_t CCR0
+0x08 Common Control 0.
volatile uint32_t FRSR
+0x50 FIFO Receive Status.
volatile uint32_t _r_40[2]
Reserved at offsets 0x40..0x47.
volatile uint32_t ICR
+0x20 Simple IIC Control.
volatile uint32_t ISR
+0x4C Simple IIC Status.
volatile uint32_t XCR0
+0x34 Simple LIN Control 0.
volatile uint32_t CFCLR
+0x68 Common Flag Clear.
volatile uint32_t XCR2
+0x3C Simple LIN Control 2.