|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
PWM Delay Generation Circuit (PDG) register layout for the Renesas RA8D2. More...
Go to the source code of this file.
Data Structures | |
| struct | r_pdg_dly_pair_t |
| Two consecutive 16-bit delay cells that match the PDG layout. More... | |
| struct | r_pdg_regs_t |
| PDG block register window mapped at k_ra8_pdg_base_addr. More... | |
Functions | |
| static volatile r_pdg_regs_t * | ra8_pdg (void) |
| Pointer to the PDG block. | |
PWM Delay Generation Circuit (PDG) register layout for the Renesas RA8D2.
The PDG block (HUM Ch 23 "PWM Delay Generation Circuit (PDG)", p 1152-1163) is the per-edge fine-delay engine that sits between GPT320..GPT323 and the GTIOC0..GTIOC3 output pads. It provides a DLL-based delay line capable of shifting the rising and falling edges of each PWM channel by an integer fraction (1/64 or 1/128) of the GPT core clock (GTCLK) period.
The block exposes the following registers (HUM Ch 23.2):
| Offset | Reg | Width | Purpose |
|---|---|---|---|
| 0x000 | GTDLYCR | 16 | DLL enable, reset, frequency range select |
| 0x002 | GTDLYCR2 | 16 | Per-channel bypass + per-channel power enable |
| 0x018 | GTDLYR0A | 16 | Channel 0 GTIOCnA rising-edge delay code (DLY[6:0]) |
| 0x01C | GTDLYR1A | 16 | Channel 1 GTIOCnA rising-edge delay code |
| 0x020 | GTDLYR2A | 16 | Channel 2 GTIOCnA rising-edge delay code |
| 0x024 | GTDLYR3A | 16 | Channel 3 GTIOCnA rising-edge delay code |
| 0x01A | GTDLYR0B | 16 | Channel 0 GTIOCnB rising-edge delay code |
| 0x01E | GTDLYR1B | 16 | Channel 1 GTIOCnB rising-edge delay code |
| 0x022 | GTDLYR2B | 16 | Channel 2 GTIOCnB rising-edge delay code |
| 0x026 | GTDLYR3B | 16 | Channel 3 GTIOCnB rising-edge delay code |
| 0x028 | GTDLYF0A | 16 | Channel 0 GTIOCnA falling-edge delay code |
| 0x02C | GTDLYF1A | 16 | Channel 1 GTIOCnA falling-edge delay code |
| 0x030 | GTDLYF2A | 16 | Channel 2 GTIOCnA falling-edge delay code |
| 0x034 | GTDLYF3A | 16 | Channel 3 GTIOCnA falling-edge delay code |
| 0x02A | GTDLYF0B | 16 | Channel 0 GTIOCnB falling-edge delay code |
| 0x02E | GTDLYF1B | 16 | Channel 1 GTIOCnB falling-edge delay code |
| 0x032 | GTDLYF2B | 16 | Channel 2 GTIOCnB falling-edge delay code |
| 0x036 | GTDLYF3B | 16 | Channel 3 GTIOCnB falling-edge delay code |
The base address per HUM Ch 23.2.1 (p 1154) is PDG = 0x4032_4000 (Secure alias) / PDG_NS = 0x5032_4000 (Non-Secure alias). Only the Secure alias is exposed here; the driver targets the Secure world.
Register addresses for GTDLYRnA / GTDLYRnB / GTDLYFnA / GTDLYFnB follow the formulas in HUM Ch 23.2.3..23.2.6 (p 1156-1158):
GTDLYRnA -> 0x018 + 0x4 * n GTDLYRnB -> 0x01A + 0x4 * n GTDLYFnA -> 0x028 + 0x4 * n GTDLYFnB -> 0x02A + 0x4 * n
The struct laid out below uses an array of two 16-bit cells per channel grouped by edge so the formula collapses to a clean dly_rise[n].A / dly_fall[n].B index.
Definition in file ra8_pdg_regs.h.
| enum ra8_pdg_addr_t : uintptr_t |
Memory-mapped base addresses for the PDG block.
Cited from HUM Ch 23.2.1 "GTDLYCR : PWM Output Delay Control Register" p 1154. Both PDG (Secure) and PDG_NS (Non-Secure) aliases exist; this driver targets PDG. Use uintptr_t so the value is portable between the 32-bit RA8D2 target and the 64-bit x86_64 host test build.
| Enumerator | |
|---|---|
| k_ra8_pdg_base_addr | PDG Secure alias. |
| k_ra8_pdg_ns_base_addr | PDG Non-Secure alias. |
Definition at line 79 of file ra8_pdg_regs.h.
| enum ra8_pdg_count_t : uint8_t |
Channel count and per-channel structural sizes.
The PDG drives 4 GPT channels (HUM Ch 23.1 p 1152). Each channel has 2 output pins (GTIOCnA / GTIOCnB) and 2 edges (rising / falling), giving 4 * 2 * 2 = 16 individual delay codes. The "edge slot count" field is used by the batch-update API to size its per-call descriptor array.
Definition at line 116 of file ra8_pdg_regs.h.
| enum ra8_pdg_dly_field_t : uint16_t |
Layout of the GTDLYRnA / GTDLYRnB / GTDLYFnA / GTDLYFnB delay registers (HUM Ch 23.2.3..23.2.6 p 1156-1158).
Only DLY[6:0] is software-writable; bits [15:7] read as 0 and must be written as 0. Allowed code range is 0x00..0x7F. Code 0x00 disables the per-edge delay; the meaning of the remaining codes depends on FRANGE (1/128 step in the low band, 1/64 step in the high band).
Definition at line 219 of file ra8_pdg_regs.h.
| enum ra8_pdg_frange_t : uint8_t |
GTDLYCR.FRANGE encoding (HUM Ch 23.2.1 p 1154).
The DLL needs to know the rough GTCLK band to pick its tap count. The lower band gives 1/128 resolution; the upper band runs at 1/64 resolution because the DLL halves its tap count.
| Enumerator | |
|---|---|
| k_ra8_pdg_frange_80_160_mhz | 80..160 MHz, 1/128 step. |
| k_ra8_pdg_frange_155_300_mhz | 155..300 MHz, 1/64 step. |
| k_ra8_pdg_frange_invalid | 0b11 – "Setting prohibited" sentinel. |
Definition at line 168 of file ra8_pdg_regs.h.
| enum ra8_pdg_freq_band_t : uint32_t |
Per-band absolute frequency boundaries (Hz) for FRANGE.
Used by the auto-tune helper to pick a FRANGE value automatically. Boundaries reproduced verbatim from HUM Ch 23.2.1 p 1154.
Definition at line 235 of file ra8_pdg_regs.h.
| enum ra8_pdg_gtdlycr2_mask_t : uint16_t |
Masks for GTDLYCR2 fields.
| Enumerator | |
|---|---|
| k_ra8_pdg_gtdlycr2_mask_dlybs | RA8 pdg gtdlycr2 mask dlybs. |
| k_ra8_pdg_gtdlycr2_mask_dlyen | RA8 pdg gtdlycr2 mask dlyen. |
Definition at line 197 of file ra8_pdg_regs.h.
| enum ra8_pdg_gtdlycr2_shift_t : uint8_t |
Bit positions for GTDLYCR2 fields (HUM Ch 23.2.2 p 1155).
Note the inverted polarity of DLYEN: the bit set means "disabled". The driver hides this in its API (exit_stop clears the bit, enter_stop sets it).
| Enumerator | |
|---|---|
| k_ra8_pdg_gtdlycr2_shift_dlybs | DLYBS field starts at bit 0. |
| k_ra8_pdg_gtdlycr2_shift_dlyen | DLYEN field starts at bit 8. |
Definition at line 187 of file ra8_pdg_regs.h.
| enum ra8_pdg_gtdlycr_bit_t : uint8_t |
Bit positions inside GTDLYCR (HUM Ch 23.2.1 p 1154).
| Enumerator | |
|---|---|
| k_ra8_pdg_gtdlycr_bit_dllen | DLL Operation Enable. |
| k_ra8_pdg_gtdlycr_bit_dlyrst | PDG circuit reset. |
| k_ra8_pdg_gtdlycr_shift_frange | FRANGE[1:0] starts at bit 8. |
Definition at line 137 of file ra8_pdg_regs.h.
| enum ra8_pdg_gtdlycr_mask_t : uint16_t |
Masks for GTDLYCR fields.
| Enumerator | |
|---|---|
| k_ra8_pdg_gtdlycr_mask_dllen | RA8 pdg gtdlycr mask dllen. |
| k_ra8_pdg_gtdlycr_mask_dlyrst | RA8 pdg gtdlycr mask dlyrst. |
| k_ra8_pdg_gtdlycr_mask_frange | RA8 pdg gtdlycr mask frange. |
Definition at line 148 of file ra8_pdg_regs.h.
| enum ra8_pdg_off_t : uintptr_t |
Byte offsets of PDG registers (HUM Ch 23.2.1..23.2.6).
GTDLYRnA / GTDLYRnB / GTDLYFnA / GTDLYFnB obey base + 0x4 * n indexing inside the channel groups; the four "channel 0" offsets are listed here so consumers that prefer raw offsets do not have to recompute them.
Definition at line 95 of file ra8_pdg_regs.h.
|
inlinestatic |
Pointer to the PDG block.
Definition at line 301 of file ra8_pdg_regs.h.
References k_ra8_pdg_base_addr.
Referenced by internal_dly_cell(), internal_pdg_is_initialized(), internal_program_dll(), ra8_pdg_channel_bypass_set(), ra8_pdg_clear_status(), ra8_pdg_deinit(), ra8_pdg_enter_stop(), ra8_pdg_exit_stop(), ra8_pdg_get_status(), ra8_pdg_get_status_full(), and ra8_pdg_set_frange().