54#include "interrupts.h"
72#define VBUS_SENSE_OFF false
74#define pointer_byte(_reg) (*(volatile uint8_t *)(uint32_t)(_reg))
75#define pointer_word(_reg) (*(volatile uint16_t *)(uint32_t)(_reg))
76#define pointer_dword(_reg) (*(volatile uint32_t *)(uint32_t)(_reg))
78#define HXTAL_STARTUP_TIMEOUT ((uint16_t)0xFFFF)
80#define BITS(start, end) ((0xFFFFFFFFUL << (start)) & (0xFFFFFFFFUL >> (31U - (uint32_t)(end))))
83#define CFG0_AHBPSC(regval) (BITS(4,7) & ((uint32_t)(regval) << 4))
84#define RCU_AHB_CKSYS_DIV1 CFG0_AHBPSC(0)
85#define RCU_AHB_CKSYS_DIV2 CFG0_AHBPSC(8)
86#define RCU_AHB_CKSYS_DIV4 CFG0_AHBPSC(9)
87#define RCU_AHB_CKSYS_DIV8 CFG0_AHBPSC(10)
88#define RCU_AHB_CKSYS_DIV16 CFG0_AHBPSC(11)
89#define RCU_AHB_CKSYS_DIV64 CFG0_AHBPSC(12)
90#define RCU_AHB_CKSYS_DIV128 CFG0_AHBPSC(13)
91#define RCU_AHB_CKSYS_DIV256 CFG0_AHBPSC(14)
92#define RCU_AHB_CKSYS_DIV512 CFG0_AHBPSC(15)
95#define CFG0_APB1PSC(regval) (BITS(8,10) & ((uint32_t)(regval) << 8))
96#define RCU_APB1_CKAHB_DIV1 CFG0_APB1PSC(0)
97#define RCU_APB1_CKAHB_DIV2 CFG0_APB1PSC(4)
98#define RCU_APB1_CKAHB_DIV4 CFG0_APB1PSC(5)
99#define RCU_APB1_CKAHB_DIV8 CFG0_APB1PSC(6)
100#define RCU_APB1_CKAHB_DIV16 CFG0_APB1PSC(7)
103#define CFG0_APB2PSC(regval) (BITS(11,13) & ((uint32_t)(regval) << 11))
104#define RCU_APB2_CKAHB_DIV1 CFG0_APB2PSC(0)
105#define RCU_APB2_CKAHB_DIV2 CFG0_APB2PSC(4)
106#define RCU_APB2_CKAHB_DIV4 CFG0_APB2PSC(5)
107#define RCU_APB2_CKAHB_DIV8 CFG0_APB2PSC(6)
108#define RCU_APB2_CKAHB_DIV16 CFG0_APB2PSC(7)
111#define CFG0_SCS(regval) (BITS(0,1) & ((uint32_t)(regval) << 0))
112#define RCU_CKSYSSRC_IRC8M CFG0_SCS(0)
113#define RCU_CKSYSSRC_HXTAL CFG0_SCS(1)
114#define RCU_CKSYSSRC_PLL CFG0_SCS(2)
117#define CFG0_SCSS(regval) (BITS(2,3) & ((uint32_t)(regval) << 2))
118#define RCU_SCSS_IRC8M CFG0_SCSS(0)
119#define RCU_SCSS_HXTAL CFG0_SCSS(1)
120#define RCU_SCSS_PLL CFG0_SCSS(2)
123#define RCU_PLLSRC_IRC8M_DIV2 ((uint32_t)0x00000000U)
124#define RCU_PLLSRC_HXTAL RCU_CFG0_PLLSEL
127#define PLLMF_4 RCU_CFG0_PLLMF_4
129#define CFG0_PLLMF(regval) (BITS(18,21) & ((uint32_t)(regval) << 18))
130#define RCU_PLL_MUL2 CFG0_PLLMF(0)
131#define RCU_PLL_MUL3 CFG0_PLLMF(1)
132#define RCU_PLL_MUL4 CFG0_PLLMF(2)
133#define RCU_PLL_MUL5 CFG0_PLLMF(3)
134#define RCU_PLL_MUL6 CFG0_PLLMF(4)
135#define RCU_PLL_MUL7 CFG0_PLLMF(5)
136#define RCU_PLL_MUL8 CFG0_PLLMF(6)
137#define RCU_PLL_MUL9 CFG0_PLLMF(7)
138#define RCU_PLL_MUL10 CFG0_PLLMF(8)
139#define RCU_PLL_MUL11 CFG0_PLLMF(9)
140#define RCU_PLL_MUL12 CFG0_PLLMF(10)
141#define RCU_PLL_MUL13 CFG0_PLLMF(11)
142#define RCU_PLL_MUL14 CFG0_PLLMF(12)
143#define RCU_PLL_MUL6_5 CFG0_PLLMF(13)
144#define RCU_PLL_MUL16 CFG0_PLLMF(14)
145#define RCU_PLL_MUL17 (PLLMF_4 | CFG0_PLLMF(0))
146#define RCU_PLL_MUL18 (PLLMF_4 | CFG0_PLLMF(1))
147#define RCU_PLL_MUL19 (PLLMF_4 | CFG0_PLLMF(2))
148#define RCU_PLL_MUL20 (PLLMF_4 | CFG0_PLLMF(3))
149#define RCU_PLL_MUL21 (PLLMF_4 | CFG0_PLLMF(4))
150#define RCU_PLL_MUL22 (PLLMF_4 | CFG0_PLLMF(5))
151#define RCU_PLL_MUL23 (PLLMF_4 | CFG0_PLLMF(6))
152#define RCU_PLL_MUL24 (PLLMF_4 | CFG0_PLLMF(7))
153#define RCU_PLL_MUL25 (PLLMF_4 | CFG0_PLLMF(8))
154#define RCU_PLL_MUL26 (PLLMF_4 | CFG0_PLLMF(9))
155#define RCU_PLL_MUL27 (PLLMF_4 | CFG0_PLLMF(10))
156#define RCU_PLL_MUL28 (PLLMF_4 | CFG0_PLLMF(11))
157#define RCU_PLL_MUL29 (PLLMF_4 | CFG0_PLLMF(12))
158#define RCU_PLL_MUL30 (PLLMF_4 | CFG0_PLLMF(13))
159#define RCU_PLL_MUL31 (PLLMF_4 | CFG0_PLLMF(14))
160#define RCU_PLL_MUL32 (PLLMF_4 | CFG0_PLLMF(15))
163#define RCU_PREDV0SRC_HXTAL ((uint32_t)0x00000000U)
164#define RCU_PREDV0SRC_CKPLL1 RCU_CFG1_PREDV0SEL
167#define CFG1_PLL1MF(regval) (BITS(8,11) & ((uint32_t)(regval) << 8))
168#define RCU_PLL1_MUL8 CFG1_PLL1MF(6)
169#define RCU_PLL1_MUL9 CFG1_PLL1MF(7)
170#define RCU_PLL1_MUL10 CFG1_PLL1MF(8)
171#define RCU_PLL1_MUL11 CFG1_PLL1MF(9)
172#define RCU_PLL1_MUL12 CFG1_PLL1MF(10)
173#define RCU_PLL1_MUL13 CFG1_PLL1MF(11)
174#define RCU_PLL1_MUL14 CFG1_PLL1MF(12)
175#define RCU_PLL1_MUL15 CFG1_PLL1MF(13)
176#define RCU_PLL1_MUL16 CFG1_PLL1MF(14)
177#define RCU_PLL1_MUL20 CFG1_PLL1MF(15)
180#define CFG1_PREDV0(regval) (BITS(0,3) & ((uint32_t)(regval) << 0))
181#define RCU_PREDV0_DIV1 CFG1_PREDV0(0)
182#define RCU_PREDV0_DIV2 CFG1_PREDV0(1)
183#define RCU_PREDV0_DIV3 CFG1_PREDV0(2)
184#define RCU_PREDV0_DIV4 CFG1_PREDV0(3)
185#define RCU_PREDV0_DIV5 CFG1_PREDV0(4)
186#define RCU_PREDV0_DIV6 CFG1_PREDV0(5)
187#define RCU_PREDV0_DIV7 CFG1_PREDV0(6)
188#define RCU_PREDV0_DIV8 CFG1_PREDV0(7)
189#define RCU_PREDV0_DIV9 CFG1_PREDV0(8)
190#define RCU_PREDV0_DIV10 CFG1_PREDV0(9)
191#define RCU_PREDV0_DIV11 CFG1_PREDV0(10)
192#define RCU_PREDV0_DIV12 CFG1_PREDV0(11)
193#define RCU_PREDV0_DIV13 CFG1_PREDV0(12)
194#define RCU_PREDV0_DIV14 CFG1_PREDV0(13)
195#define RCU_PREDV0_DIV15 CFG1_PREDV0(14)
196#define RCU_PREDV0_DIV16 CFG1_PREDV0(15)
199#define CFG1_PREDV1(regval) (BITS(4,7) & ((uint32_t)(regval) << 4))
200#define RCU_PREDV1_DIV1 CFG1_PREDV1(0)
201#define RCU_PREDV1_DIV2 CFG1_PREDV1(1)
202#define RCU_PREDV1_DIV3 CFG1_PREDV1(2)
203#define RCU_PREDV1_DIV4 CFG1_PREDV1(3)
204#define RCU_PREDV1_DIV5 CFG1_PREDV1(4)
205#define RCU_PREDV1_DIV6 CFG1_PREDV1(5)
206#define RCU_PREDV1_DIV7 CFG1_PREDV1(6)
207#define RCU_PREDV1_DIV8 CFG1_PREDV1(7)
208#define RCU_PREDV1_DIV9 CFG1_PREDV1(8)
209#define RCU_PREDV1_DIV10 CFG1_PREDV1(9)
210#define RCU_PREDV1_DIV11 CFG1_PREDV1(10)
211#define RCU_PREDV1_DIV12 CFG1_PREDV1(11)
212#define RCU_PREDV1_DIV13 CFG1_PREDV1(12)
213#define RCU_PREDV1_DIV14 CFG1_PREDV1(13)
214#define RCU_PREDV1_DIV15 CFG1_PREDV1(14)
215#define RCU_PREDV1_DIV16 CFG1_PREDV1(15)
218#define _RCU_CFG0_PLLMF BITS(18,21)
219#define _RCU_CFG1_PLL1MF BITS(8,11)
220#define _RCU_CFG1_PREDV0 BITS(0,3)
221#define _RCU_CFG1_PREDV1 BITS(4,7)
222#define _RCU_CFG0_SCS BITS(0,1)
224static inline void system_rcu_clock_reset(
void ) {
225 pointer_dword(RCU_BASE+RCU_CTL) |= RCU_CTL_IRC8MEN;
228 while( !(pointer_dword(RCU_BASE+RCU_CTL) & RCU_CTL_IRC8MSTB ) );
235 pointer_dword(RCU_BASE+RCU_CFG0) &= ~(RCU_CFG0_SCS_Msk | RCU_CFG0_AHBPSC_Msk |
236 RCU_CFG0_APB1PSC_Msk | RCU_CFG0_APB2PSC_Msk |
237 RCU_CFG0_ADCPSC_Msk | RCU_CFG0_CKOUT0SEL_Msk |
238 RCU_CFG0_PLLSEL | RCU_CFG0_PREDV0_LSB |
239 RCU_CFG0_PLLMF_Msk | RCU_CFG0_USBFSPSC_Msk);
242 pointer_dword(RCU_BASE+RCU_CTL) &= ~(RCU_CTL_HXTALEN |
250 while( ( pointer_dword(RCU_BASE+RCU_CTL) & RCU_CTL_HXTALEN ) );
251 pointer_dword(RCU_BASE+RCU_CTL) &= ~(RCU_CTL_HXTALBPS);
254 pointer_dword(RCU_BASE+RCU_CFG0) &= ~(RCU_CFG0_PLLSEL | RCU_CFG0_PREDV0_LSB |
255 RCU_CFG0_PLLMF_Msk | RCU_CFG0_USBFSPSC_Msk);
261 pointer_dword(RCU_BASE+RCU_CFG1) &= ~(0x7FFFFul);
264 pointer_dword(RCU_BASE+RCU_CTL) &= ~(RCU_CTL_PLLEN | RCU_CTL_PLL1EN |
265 RCU_CTL_PLL2EN | RCU_CTL_CKMEN |
272 pointer_dword(RCU_BASE+RCU_INT) |= 0x00FF0000ul;
275static uint8_t clock_48m_hxtal(
bool hse_25) {
276 uint32_t timeout = 0U;
277 uint32_t stab_flag = 0U;
279 (void)system_rcu_clock_reset();
282 *(uint32_t
volatile *)(RCU_BASE+RCU_CTL) |= RCU_CTL_HXTALEN;
287 stab_flag = (*(uint32_t
volatile *)(RCU_BASE+RCU_CTL) & RCU_CTL_HXTALSTB);
288 }
while((0U == stab_flag) && (HXTAL_STARTUP_TIMEOUT != timeout));
291 if(0U == (*(uint32_t
volatile *)(RCU_BASE+RCU_CTL) & RCU_CTL_HXTALSTB)){
298 *(uint32_t
volatile *)(RCU_BASE+RCU_CFG0) |= RCU_AHB_CKSYS_DIV1;
300 *(uint32_t
volatile *)(RCU_BASE+RCU_CFG0) |= RCU_APB2_CKAHB_DIV1;
302 *(uint32_t
volatile *)(RCU_BASE+RCU_CFG0) |= RCU_APB1_CKAHB_DIV2;
305 *(uint32_t
volatile *)(RCU_BASE+RCU_CFG0) &= ~(_RCU_CFG0_PLLMF | RCU_CFG0_PLLMF_4);
306 *(uint32_t
volatile *)(RCU_BASE+RCU_CFG0) |= (RCU_PLLSRC_HXTAL | RCU_PLL_MUL12);
311 *(uint32_t
volatile *)(RCU_BASE+RCU_CFG1) &= ~(RCU_CFG1_PREDV0SEL | _RCU_CFG1_PLL1MF | _RCU_CFG1_PREDV1 | _RCU_CFG1_PREDV0);
312 *(uint32_t
volatile *)(RCU_BASE+RCU_CFG1) |= (RCU_PREDV0SRC_CKPLL1 | RCU_PLL1_MUL8 | RCU_PREDV1_DIV5 | RCU_PREDV0_DIV10);
315 *(uint32_t
volatile *)(RCU_BASE+RCU_CTL) |= RCU_CTL_PLL1EN;
317 while((*(uint32_t
volatile *)(RCU_BASE+RCU_CTL) & RCU_CTL_PLL1STB) == 0){
321 *(uint32_t
volatile *)(RCU_BASE+RCU_CFG1) &= ~(RCU_CFG1_PREDV0SEL | _RCU_CFG1_PREDV1 | _RCU_CFG1_PLL1MF | _RCU_CFG1_PREDV0);
322 *(uint32_t
volatile *)(RCU_BASE+RCU_CFG1) |= (RCU_PREDV0SRC_HXTAL | RCU_PREDV0_DIV2 );
326 *(uint32_t
volatile *)(RCU_BASE+RCU_CTL) |= RCU_CTL_PLLEN;
329 while(0U == (*(uint32_t
volatile *)(RCU_BASE+RCU_CTL) & RCU_CTL_PLLSTB)){
333 *(uint32_t
volatile *)(RCU_BASE+RCU_CFG0) &= ~_RCU_CFG0_SCS;
334 *(uint32_t
volatile *)(RCU_BASE+RCU_CFG0) |= RCU_CKSYSSRC_PLL;
337 while(0U == (*(uint32_t
volatile *)(RCU_BASE+RCU_CFG0) & RCU_SCSS_PLL)){
344#define GPIO_MODE_SET(n,mode) ((uint32_t)((uint32_t)(mode) << (4U * (n))))
345#define GPIO_MODE_MASK(n) (0xFU << (4U * (n)))
348#define GPIO_MODE_AIN ((uint8_t)0x00U)
349#define GPIO_MODE_IN_FLOATING ((uint8_t)0x04U)
350#define GPIO_MODE_IPD ((uint8_t)0x28U)
351#define GPIO_MODE_IPU ((uint8_t)0x48U)
352#define GPIO_MODE_OUT_OD ((uint8_t)0x14U)
353#define GPIO_MODE_OUT_PP ((uint8_t)0x10U)
354#define GPIO_MODE_AF_OD ((uint8_t)0x1CU)
355#define GPIO_MODE_AF_PP ((uint8_t)0x18U)
358#define GPIO_OSPEED_10MHZ ((uint8_t)0x01U)
359#define GPIO_OSPEED_2MHZ ((uint8_t)0x02U)
360#define GPIO_OSPEED_50MHZ ((uint8_t)0x03U)
363#define GPIO_PIN_0 BIT(0)
364#define GPIO_PIN_1 BIT(1)
365#define GPIO_PIN_2 BIT(2)
366#define GPIO_PIN_3 BIT(3)
367#define GPIO_PIN_4 BIT(4)
368#define GPIO_PIN_5 BIT(5)
369#define GPIO_PIN_6 BIT(6)
370#define GPIO_PIN_7 BIT(7)
371#define GPIO_PIN_8 BIT(8)
372#define GPIO_PIN_9 BIT(9)
373#define GPIO_PIN_10 BIT(10)
374#define GPIO_PIN_11 BIT(11)
375#define GPIO_PIN_12 BIT(12)
376#define GPIO_PIN_13 BIT(13)
377#define GPIO_PIN_14 BIT(14)
378#define GPIO_PIN_15 BIT(15)
379#define GPIO_PIN_ALL BITS(0, 15)
381#define BIT(x) ((uint32_t)((uint32_t)0x01U<<(x)))
383static void gpio_init_ctlx(
384 uint32_t gpio_periph, uint32_t mode[2],
385 uint32_t speed, uint32_t pin
388 uint32_t offset, reg = 0U;
391 if (pin > GPIO_PIN_7)
394 for (uint8_t i = 0U; i < 8U; i++) {
395 if ((1U << i) & pin) {
396 reg = *(uint32_t
volatile *)(gpio_periph+offset);
399 reg &= ~GPIO_MODE_MASK(i);
401 reg |= GPIO_MODE_SET(i, mode[1]);
404 if (GPIO_MODE_IPD == mode[0]) {
406 *(uint32_t
volatile *)(gpio_periph+GPIO_BC) = (uint32_t) ((1U << i) & pin);
409 if (GPIO_MODE_IPU == mode[0]) {
410 *(uint32_t
volatile *)(gpio_periph+GPIO_BOP) = (uint32_t) ((1U << i) & pin);
414 *(uint32_t
volatile *)(gpio_periph+offset) = reg;
419static void gpio_init(
420 uint32_t gpio_periph, uint32_t mode,
421 uint32_t speed, uint32_t pin
425 uint32_t temp_mode[2] = {mode, 0U};
429 temp_mode[1] = (uint32_t) (mode & ((uint32_t) 0x0FU));
432 if (((uint32_t) 0x00U) != ((uint32_t) mode & ((uint32_t) 0x10U))) {
434 temp_mode[1] |= (uint32_t) speed;
438 gpio_init_ctlx(gpio_periph, temp_mode, speed, pin);
441#define GET_BITS(regval, start, end) (((regval) & BITS((start),(end))) >> (start))
444#define SEL_IRC8M ((uint16_t)0U)
445#define SEL_HXTAL ((uint16_t)1U)
446#define SEL_PLL ((uint16_t)2U)
449#define CFG0_USBPSC(regval) (BITS(22,23) & ((uint32_t)(regval) << 22))
450#define RCU_CKUSB_CKPLL_DIV1_5 CFG0_USBPSC(0)
451#define RCU_CKUSB_CKPLL_DIV1 CFG0_USBPSC(1)
452#define RCU_CKUSB_CKPLL_DIV2_5 CFG0_USBPSC(2)
453#define RCU_CKUSB_CKPLL_DIV2 CFG0_USBPSC(3)
454#define _RCU_CFG0_USBFSPSC BITS(22,23)
456#define IRC8M_VALUE ((uint32_t)8000000)
457#define MIKROE_HW_HXTAL ((uint32_t)25000000)
460#if !defined HXTAL_VALUE
461 #ifdef MCU_CARD_FOR_RISC_V
462 #define HXTAL_VALUE MIKROE_HW_HXTAL
464 #define HXTAL_VALUE IRC8M_VALUE
474} rcu_clock_freq_enum;
487static uint32_t rcu_clock_freq_get(rcu_clock_freq_enum clock)
489 uint32_t sws, ck_freq = 0U;
490 uint32_t cksys_freq, ahb_freq, apb1_freq, apb2_freq;
491 uint32_t pllsel, predv0sel, pllmf,ck_src, idx, clk_exp;
492 uint32_t predv0, predv1, pll1mf;
495 uint8_t ahb_exp[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
496 uint8_t apb1_exp[8] = {0, 0, 0, 0, 1, 2, 3, 4};
497 uint8_t apb2_exp[8] = {0, 0, 0, 0, 1, 2, 3, 4};
499 sws = GET_BITS(pointer_dword(RCU_BASE+RCU_CFG0), 2, 3);
503 cksys_freq = IRC8M_VALUE;
507 cksys_freq = HXTAL_VALUE;
512 pllsel = (pointer_dword(RCU_BASE+RCU_CFG0) & RCU_CFG0_PLLSEL);
514 if(RCU_PLLSRC_HXTAL == pllsel) {
516 ck_src = HXTAL_VALUE;
518 predv0sel = (pointer_dword(RCU_BASE+RCU_CFG1) & RCU_CFG1_PREDV0SEL);
520 if(RCU_PREDV0SRC_CKPLL1 == predv0sel){
521 predv1 = (uint32_t)((pointer_dword(RCU_BASE+RCU_CFG1) & _RCU_CFG1_PREDV1) >> 4) + 1U;
522 pll1mf = (uint32_t)((pointer_dword(RCU_BASE+RCU_CFG1) & _RCU_CFG1_PLL1MF) >> 8) + 2U;
526 ck_src = (ck_src / predv1) * pll1mf;
528 predv0 = (pointer_dword(RCU_BASE+RCU_CFG1) & _RCU_CFG1_PREDV0) + 1U;
532 ck_src = IRC8M_VALUE/2U;
536 pllmf = GET_BITS(pointer_dword(RCU_BASE+RCU_CFG0), 18, 21);
537 if((pointer_dword(RCU_BASE+RCU_CFG0) & RCU_CFG0_PLLMF_4)){
546 cksys_freq = ck_src * pllmf;
550 cksys_freq = ck_src * 6U + ck_src / 2U;
557 cksys_freq = IRC8M_VALUE;
562 idx = GET_BITS(pointer_dword(RCU_BASE+RCU_CFG0), 4, 7);
563 clk_exp = ahb_exp[idx];
564 ahb_freq = cksys_freq >> clk_exp;
567 idx = GET_BITS(pointer_dword(RCU_BASE+RCU_CFG0), 8, 10);
568 clk_exp = apb1_exp[idx];
569 apb1_freq = ahb_freq >> clk_exp;
572 idx = GET_BITS(pointer_dword(RCU_BASE+RCU_CFG0), 11, 13);
573 clk_exp = apb2_exp[idx];
574 apb2_freq = ahb_freq >> clk_exp;
579 ck_freq = cksys_freq;
598static inline void rcu_usb_clock_config(uint32_t usb_psc)
602 reg = pointer_dword(RCU_BASE+RCU_CFG0);
605 reg &= ~_RCU_CFG0_USBFSPSC;
606 pointer_dword(RCU_BASE+RCU_CFG0) = (reg | usb_psc);
609static inline void usb_rcu_config(
bool config_clock) {
612 (void)clock_48m_hxtal(HXTAL_VALUE == MIKROE_HW_HXTAL);
614 static volatile uint32_t usbfs_prescaler = 0;
615 volatile uint32_t system_clock = rcu_clock_freq_get(CK_SYS);
617 if (system_clock == 48000000) {
618 usbfs_prescaler = RCU_CKUSB_CKPLL_DIV1;
619 }
else if (system_clock == 72000000) {
620 usbfs_prescaler = RCU_CKUSB_CKPLL_DIV1_5;
621 }
else if (system_clock == 96000000) {
622 usbfs_prescaler = RCU_CKUSB_CKPLL_DIV2;
628 rcu_usb_clock_config(usbfs_prescaler);
629 pointer_dword(RCU_BASE+RCU_AHBEN) |= RCU_AHBEN_USBFSEN;
640static inline void usb_hw_init(
void) {
641 interrupts_disable();
642 (void)usb_rcu_config(
false);
643 pointer_dword(RCU_BASE+RCU_APB2EN) |= RCU_APB2EN_PAEN;
644 pointer_dword(RCU_BASE+RCU_APB2EN) |= RCU_APB2EN_AFEN;
646 gpio_init(
GPIOA_BASE, GPIO_MODE_IN_FLOATING, GPIO_OSPEED_50MHZ, GPIO_PIN_9);
647 pointer_dword(USBFS_BASE+USBFS_GCCFG) |= USBFS_GCCFG_VBUSIG;
649 pointer_dword(USBFS_BASE+USBFS_GCCFG) |= USBFS_GCCFG_VBUSBCEN | USBFS_GCCFG_PWRON;
650 pointer_dword(RCU_BASE+RCU_APB1EN) |= RCU_APB1EN_PMUEN;
#define GPIOA_BASE
Definition MK60D10.h:6908