18#ifndef LIBOPENCM3_PM_H
19#define LIBOPENCM3_PM_H
26#define PM_MCCTRL MMIO32(PM_BASE + 0x000)
27#define PM_MCCTRL_KEY (PM_UNLOCK_KEY)
30#define PM_CKSEL(I) MMIO32(PM_BASE + 0x004 + (0x004 * (I)))
31#define PM_CKSEL_KEY(I) (PM_UNLOCK_KEY | (0x004 + (0x004 * (I))))
33#define PM_MASK(I) MMIO32(PM_BASE + 0x020 + (0x004) * (I))
34#define PM_MASK_KEY(I) (PM_UNLOCK_KEY | (0x020 + (0x004) * (I)))
37#define PM_CPUMASK MMIO32(PM_BASE + 0x020)
40#define PM_HSBMASK MMIO32(PM_BASE + 0x024)
43#define PM_PBAMASK MMIO32(PM_BASE + 0x028)
44#define PM_PBAMASK_KEY (PM_UNLOCK_KEY | 0x028)
47#define PM_PBBMASK MMIO32(PM_BASE + 0x02C)
50#define PM_PBCMASK MMIO32(PM_BASE + 0x030)
53#define PM_PBDMASK MMIO32(PM_BASE + 0x034)
56#define PM_PBADIVMASK MMIO32(PM_BASE + 0x040)
57#define PM_PBADIVMASK_KEY (PM_UNLOCK_KEY | 0x040)
60#define PM_CFDCTRL MMIO32(PM_BASE + 0x054)
63#define PM_UNLOCK MMIO32(PM_BASE + 0x058)
64#define PM_UNLOCK_KEY (0xAA << 24)
67#define PM_IER MMIO32(PM_BASE + 0x0C0)
70#define PM_IDR MMIO32(PM_BASE + 0x0C4)
73#define PM_IMR MMIO32(PM_BASE + 0x0C8)
76#define PM_ISR MMIO32(PM_BASE + 0x0CC)
79#define PM_ICR MMIO32(PM_BASE + 0x0D0)
82#define PM_SR MMIO32(PM_BASE + 0x0D4)
85#define PM_PPCR MMIO32(PM_BASE + 0x160)
88#define PM_RCAUSE MMIO32(PM_BASE + 0x180)
91#define PM_WCAUSE MMIO32(PM_BASE + 0x184)
94#define PM_AWEN MMIO32(PM_BASE + 0x188)
97#define PM_PROTCTRL MMIO32(PM_BASE + 0x18C)
100#define PM_FASTSLEEP MMIO32(PM_BASE + 0x194)
103#define PM_CONFIG MMIO32(PM_BASE + 0x3F8)
106#define PM_VERSION MMIO32(PM_BASE + 0x3FC)
110#define PM_MCCTRL_MCSEL_SHIFT 0
111#define PM_MCCTRL_MCSEL_MASK 3
114#define PM_CKSEL_DIV (1 << 7)
115#define PM_CKSEL_MASK (3)
117#define PM_CPUMASK_OSC (1 << 0)
119#define PM_HSBMASK_PDCA (1 << 0)
120#define PM_HSBMASK_FLASHCALW (1 << 1)
121#define PM_HSBMASK_FLASHCALW_PICO (1 << 2)
122#define PM_HSBMASK_USBC (1 << 3)
123#define PM_HSBMASK_CRCCU (1 << 4)
124#define PM_HSBMASK_APBA (1 << 5)
125#define PM_HSBMASK_APBB (1 << 6)
126#define PM_HSBMASK_APBC (1 << 7)
127#define PM_HSBMASK_APBD (1 << 8)
128#define PM_HSBMASK_AESA (1 << 9)
130#define PM_PBAMASK_IISC (1 << 0)
131#define PM_PBAMASK_SPI (1 << 1)
132#define PM_PBAMASK_TC0 (1 << 2)
133#define PM_PBAMASK_TC1 (1 << 3)
134#define PM_PBAMASK_TWIM0 (1 << 4)
135#define PM_PBAMASK_TWIS0 (1 << 5)
136#define PM_PBAMASK_TWIM1 (1 << 6)
137#define PM_PBAMASK_TWIS1 (1 << 7)
138#define PM_PBAMASK_USART0 (1 << 8)
139#define PM_PBAMASK_USART1 (1 << 9)
140#define PM_PBAMASK_USART2 (1 << 10)
141#define PM_PBAMASK_USART3 (1 << 11)
142#define PM_PBAMASK_ADCIFE (1 << 12)
143#define PM_PBAMASK_DACC (1 << 13)
144#define PM_PBAMASK_ACIFC (1 << 14)
145#define PM_PBAMASK_GLOC (1 << 15)
146#define PM_PBAMASK_ABDACB (1 << 16)
147#define PM_PBAMASK_TRNG (1 << 17)
148#define PM_PBAMASK_PARC (1 << 18)
149#define PM_PBAMASK_CATB (1 << 19)
151#define PM_PBAMASK_TWIM2 (1 << 21)
152#define PM_PBAMASK_TWIM3 (1 << 22)
153#define PM_PBAMASK_LCDCA (1 << 23)
155#define PM_PBBMASK_FLASHCALW (1 << 0)
156#define PM_PBBMASK_HRAMC1 (1 << 1)
157#define PM_PBBMASK_HMATRIX (1 << 2)
158#define PM_PBBMASK_PDCA (1 << 3)
159#define PM_PBBMASK_CRCCU (1 << 4)
160#define PM_PBBMASK_USBC (1 << 5)
161#define PM_PBBMASK_PEVC (1 << 6)
163#define PM_PBCMASK_PM (1 << 0)
164#define PM_PBCMASK_CHIPID (1 << 1)
165#define PM_PBCMASK_SCIF (1 << 2)
166#define PM_PBCMASK_FREQM (1 << 3)
167#define PM_PBCMASK_GPIO (1 << 4)
169#define PM_PBDMASK_BPM (1 << 0)
170#define PM_PBDMASK_BSCIF (1 << 1)
171#define PM_PBDMASK_AST (1 << 2)
172#define PM_PBDMASK_WDT (1 << 3)
173#define PM_PBDMASK_EIC (1 << 4)
174#define PM_PBDMASK_PICOUART (1 << 5)
176#define PM_PBADIVMASK_TC2 (1 << 0)
177#define PM_PBADIVMASK_USART0 (1 << 2)
178#define PM_PBADIVMASK_USART1 (1 << 2)
179#define PM_PBADIVMASK_USART2 (1 << 2)
180#define PM_PBADIVMASK_USART3 (1 << 2)
181#define PM_PBADIVMASK_TC3 (1 << 2)
182#define PM_PBADIVMASK_TC4 (1 << 4)
183#define PM_PBADIVMASK_TC5 (1 << 6)
185#define PM_SR_CFD (1 << 0)
186#define PM_SR_CKRDY (1 << 5)
187#define PM_SR_WAKE (1 << 8)
void pm_set_divmask_clock(uint8_t mask)
void pm_enable_peripheral_clock(enum pm_peripheral periph)
void pm_disable_peripheral_clock(enum pm_peripheral periph)
void pm_select_main_clock(enum mck_src source_clock)
@ PM_PERIPHERAL_APBC_BRIDGE
@ PM_PERIPHERAL_FLASHCALW_ALT
@ PM_PERIPHERAL_FLASHCALW
@ PM_PERIPHERAL_CRCCU_ALT
@ PM_PERIPHERAL_FLASHCALW_PICORAM
@ PM_PERIPHERAL_APBA_BRIDGE
@ PM_PERIPHERAL_APBD_BRIDGE
@ PM_PERIPHERAL_RESERVED1
@ PM_PERIPHERAL_APBB_BRIDGE
void pm_enable_clock_div(enum pm_cksel sel_target, uint8_t div)