fsl_clock.c
Go to the documentation of this file.
1 /*
2  * Copyright 2017 - 2019 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #include "fsl_clock.h"
9 /* Component ID definition, used by tools. */
10 #ifndef FSL_COMPONENT_ID
11 #define FSL_COMPONENT_ID "platform.drivers.clock"
12 #endif
13 /*******************************************************************************
14  * Definitions
15  ******************************************************************************/
16 /* To make full use of CM7 hardware FPU, use double instead of uint64_t in clock driver to
17 achieve better performance, it is depend on the IDE Floating point settings, if double precision is selected
18 in IDE, clock_64b_t will switch to double type automatically. only support IAR and MDK here */
19 #if __FPU_USED
20 
21 #if (defined(__ICCARM__))
22 
23 #if (__ARMVFP__ >= __ARMFPV5__) && \
24  (__ARM_FP == 0xE) /*0xe implies support for half, single and double precision operations*/
25 typedef double clock_64b_t;
26 #else
27 typedef uint64_t clock_64b_t;
28 #endif
29 
30 #elif (defined(__GNUC__))
31 
32 #if (__ARM_FP == 0xE) /*0xe implies support for half, single and double precision operations*/
33 typedef double clock_64b_t;
34 #else
35 typedef uint64_t clock_64b_t;
36 #endif
37 
38 #elif defined(__CC_ARM) || defined(__ARMCC_VERSION)
39 
40 #if defined __TARGET_FPU_FPV5_D16
41 typedef double clock_64b_t;
42 #else
43 typedef uint64_t clock_64b_t;
44 #endif
45 
46 #else
47 typedef uint64_t clock_64b_t;
48 #endif
49 
50 #else
51 typedef uint64_t clock_64b_t;
52 #endif
53 
54 /*******************************************************************************
55  * Variables
56  ******************************************************************************/
57 
58 /* External XTAL (OSC) clock frequency. */
59 volatile uint32_t g_xtalFreq;
60 /* External RTC XTAL clock frequency. */
61 volatile uint32_t g_rtcXtalFreq;
62 
63 /*******************************************************************************
64  * Prototypes
65  ******************************************************************************/
66 
72 static uint32_t CLOCK_GetPeriphClkFreq(void);
73 
74 /*******************************************************************************
75  * Code
76  ******************************************************************************/
77 
78 static uint32_t CLOCK_GetPeriphClkFreq(void)
79 {
80  uint32_t freq;
81 
82  /* Periph_clk2_clk ---> Periph_clk */
83  if ((CCM->CBCDR & CCM_CBCDR_PERIPH_CLK_SEL_MASK) != 0U)
84  {
85  switch (CCM->CBCMR & CCM_CBCMR_PERIPH_CLK2_SEL_MASK)
86  {
87  /* Pll3_sw_clk ---> Periph_clk2_clk ---> Periph_clk */
90  break;
91 
92  /* Osc_clk ---> Periph_clk2_clk ---> Periph_clk */
94  freq = CLOCK_GetOscFreq();
95  break;
96 
99  break;
100 
101  case CCM_CBCMR_PERIPH_CLK2_SEL(3U):
102  default:
103  freq = 0U;
104  break;
105  }
106 
108  }
109  /* Pre_Periph_clk ---> Periph_clk */
110  else
111  {
112  switch (CCM->CBCMR & CCM_CBCMR_PRE_PERIPH_CLK_SEL_MASK)
113  {
114  /* PLL2 ---> Pre_Periph_clk ---> Periph_clk */
117  break;
118 
119  /* PLL2 PFD2 ---> Pre_Periph_clk ---> Periph_clk */
122  break;
123 
124  /* PLL2 PFD0 ---> Pre_Periph_clk ---> Periph_clk */
127  break;
128 
129  /* PLL1 divided(/2) ---> Pre_Periph_clk ---> Periph_clk */
133  break;
134 
135  default:
136  freq = 0U;
137  break;
138  }
139  }
140 
141  return freq;
142 }
143 
158 void CLOCK_InitExternalClk(bool bypassXtalOsc)
159 {
160  /* This device does not support bypass XTAL OSC. */
161  assert(!bypassXtalOsc);
162 
163  CCM_ANALOG->MISC0_CLR = CCM_ANALOG_MISC0_XTAL_24M_PWD_MASK; /* Power up */
164  while ((XTALOSC24M->LOWPWR_CTRL & XTALOSC24M_LOWPWR_CTRL_XTALOSC_PWRUP_STAT_MASK) == 0U)
165  {
166  }
167  CCM_ANALOG->MISC0_SET = CCM_ANALOG_MISC0_OSC_XTALOK_EN_MASK; /* detect freq */
168  while ((CCM_ANALOG->MISC0 & CCM_ANALOG_MISC0_OSC_XTALOK_MASK) == 0UL)
169  {
170  }
172 }
173 
183 {
184  CCM_ANALOG->MISC0_SET = CCM_ANALOG_MISC0_XTAL_24M_PWD_MASK; /* Power down */
185 }
186 
195 {
196  if (osc == kCLOCK_RcOsc)
197  {
199  }
200  else
201  {
203  }
204 }
205 
210 {
212 }
213 
218 {
220 }
221 
227 uint32_t CLOCK_GetAhbFreq(void)
228 {
230 }
231 
237 uint32_t CLOCK_GetSemcFreq(void)
238 {
239  uint32_t freq;
240 
241  /* SEMC alternative clock ---> SEMC Clock */
242  if ((CCM->CBCDR & CCM_CBCDR_SEMC_CLK_SEL_MASK) != 0U)
243  {
244  /* PLL3 PFD1 ---> SEMC alternative clock ---> SEMC Clock */
245  if ((CCM->CBCDR & CCM_CBCDR_SEMC_ALT_CLK_SEL_MASK) != 0U)
246  {
248  }
249  /* PLL2 PFD2 ---> SEMC alternative clock ---> SEMC Clock */
250  else
251  {
253  }
254  }
255  /* Periph_clk ---> SEMC Clock */
256  else
257  {
258  freq = CLOCK_GetPeriphClkFreq();
259  }
260 
261  freq /= (((CCM->CBCDR & CCM_CBCDR_SEMC_PODF_MASK) >> CCM_CBCDR_SEMC_PODF_SHIFT) + 1U);
262 
263  return freq;
264 }
265 
271 uint32_t CLOCK_GetIpgFreq(void)
272 {
273  return CLOCK_GetAhbFreq() / (((CCM->CBCDR & CCM_CBCDR_IPG_PODF_MASK) >> CCM_CBCDR_IPG_PODF_SHIFT) + 1U);
274 }
275 
281 uint32_t CLOCK_GetPerClkFreq(void)
282 {
283  uint32_t freq;
284 
285  /* Osc_clk ---> PER Clock*/
286  if ((CCM->CSCMR1 & CCM_CSCMR1_PERCLK_CLK_SEL_MASK) != 0U)
287  {
288  freq = CLOCK_GetOscFreq();
289  }
290  /* Periph_clk ---> AHB Clock ---> IPG Clock ---> PER Clock */
291  else
292  {
293  freq = CLOCK_GetIpgFreq();
294  }
295 
296  freq /= (((CCM->CSCMR1 & CCM_CSCMR1_PERCLK_PODF_MASK) >> CCM_CSCMR1_PERCLK_PODF_SHIFT) + 1U);
297 
298  return freq;
299 }
300 
311 {
312  uint32_t freq;
313 
314  switch (name)
315  {
316  case kCLOCK_CpuClk:
317  case kCLOCK_AhbClk:
318  freq = CLOCK_GetAhbFreq();
319  break;
320 
321  case kCLOCK_SemcClk:
322  freq = CLOCK_GetSemcFreq();
323  break;
324 
325  case kCLOCK_IpgClk:
326  freq = CLOCK_GetIpgFreq();
327  break;
328 
329  case kCLOCK_PerClk:
330  freq = CLOCK_GetPerClkFreq();
331  break;
332 
333  case kCLOCK_OscClk:
334  freq = CLOCK_GetOscFreq();
335  break;
336  case kCLOCK_RtcClk:
337  freq = CLOCK_GetRtcFreq();
338  break;
339  case kCLOCK_ArmPllClk:
341  break;
342  case kCLOCK_Usb1PllClk:
344  break;
347  break;
350  break;
353  break;
356  break;
357  case kCLOCK_Usb2PllClk:
359  break;
360  case kCLOCK_SysPllClk:
362  break;
365  break;
368  break;
371  break;
374  break;
375  case kCLOCK_EnetPll0Clk:
377  break;
378  case kCLOCK_EnetPll1Clk:
380  break;
381  case kCLOCK_AudioPllClk:
383  break;
384  case kCLOCK_VideoPllClk:
386  break;
387  default:
388  freq = 0U;
389  break;
390  }
391 
392  return freq;
393 }
394 
406 bool CLOCK_EnableUsbhs0Clock(clock_usb_src_t src, uint32_t freq)
407 {
408  uint32_t i;
409  CCM->CCGR6 |= CCM_CCGR6_CG0_MASK;
410  USB1->USBCMD |= USBHS_USBCMD_RST_MASK;
411 
412  /* Add a delay between RST and RS so make sure there is a DP pullup sequence*/
413  for (i = 0; i < 400000U; i++)
414  {
415  __ASM("nop");
416  }
417  PMU->REG_3P0 = (PMU->REG_3P0 & (~PMU_REG_3P0_OUTPUT_TRG_MASK)) |
419  return true;
420 }
421 
433 bool CLOCK_EnableUsbhs1Clock(clock_usb_src_t src, uint32_t freq)
434 {
435  uint32_t i = 0;
436  CCM->CCGR6 |= CCM_CCGR6_CG0_MASK;
437  USB2->USBCMD |= USBHS_USBCMD_RST_MASK;
438 
439  /* Add a delay between RST and RS so make sure there is a DP pullup sequence*/
440  for (i = 0; i < 400000U; i++)
441  {
442  __ASM("nop");
443  }
444  PMU->REG_3P0 = (PMU->REG_3P0 & (~PMU_REG_3P0_OUTPUT_TRG_MASK)) |
446  return true;
447 }
448 
459 {
460  const clock_usb_pll_config_t g_ccmConfigUsbPll = {.loopDivider = 0U};
461  if ((CCM_ANALOG->PLL_USB1 & CCM_ANALOG_PLL_USB1_ENABLE_MASK) != 0U)
462  {
464  }
465  else
466  {
467  CLOCK_InitUsb1Pll(&g_ccmConfigUsbPll);
468  }
469  USBPHY1->CTRL &= ~USBPHY_CTRL_SFTRST_MASK; /* release PHY from reset */
471 
472  USBPHY1->PWD = 0;
475  return true;
476 }
477 
483 {
485  USBPHY1->CTRL |= USBPHY_CTRL_CLKGATE_MASK; /* Set to 1U to gate clocks */
486 }
487 
496 {
497  /* Bypass PLL first */
500 
501  CCM_ANALOG->PLL_ARM =
504 
505  while ((CCM_ANALOG->PLL_ARM & CCM_ANALOG_PLL_ARM_LOCK_MASK) == 0UL)
506  {
507  }
508 
509  /* Disable Bypass */
511 }
512 
517 {
519 }
520 
529 {
530  /* Bypass PLL first */
533 
534  CCM_ANALOG->PLL_SYS =
537 
538  /* Initialize the fractional mode */
539  CCM_ANALOG->PLL_SYS_NUM = CCM_ANALOG_PLL_SYS_NUM_A(config->numerator);
540  CCM_ANALOG->PLL_SYS_DENOM = CCM_ANALOG_PLL_SYS_DENOM_B(config->denominator);
541 
542  /* Initialize the spread spectrum mode */
543  CCM_ANALOG->PLL_SYS_SS = CCM_ANALOG_PLL_SYS_SS_STEP(config->ss_step) |
546 
547  while ((CCM_ANALOG->PLL_SYS & CCM_ANALOG_PLL_SYS_LOCK_MASK) == 0UL)
548  {
549  }
550 
551  /* Disable Bypass */
553 }
554 
559 {
561 }
562 
571 {
572  /* Bypass PLL first */
573  CCM_ANALOG->PLL_USB1 = (CCM_ANALOG->PLL_USB1 & (~CCM_ANALOG_PLL_USB1_BYPASS_CLK_SRC_MASK)) |
575 
576  CCM_ANALOG->PLL_USB1 = (CCM_ANALOG->PLL_USB1 & (~CCM_ANALOG_PLL_USB1_DIV_SELECT_MASK)) |
579 
580  while ((CCM_ANALOG->PLL_USB1 & CCM_ANALOG_PLL_USB1_LOCK_MASK) == 0UL)
581  {
582  }
583 
584  /* Disable Bypass */
586 }
587 
592 {
593  CCM_ANALOG->PLL_USB1 = 0U;
594 }
595 
604 {
605  /* Bypass PLL first */
606  CCM_ANALOG->PLL_USB2 = (CCM_ANALOG->PLL_USB2 & (~CCM_ANALOG_PLL_USB2_BYPASS_CLK_SRC_MASK)) |
608 
609  CCM_ANALOG->PLL_USB2 = (CCM_ANALOG->PLL_USB2 & (~CCM_ANALOG_PLL_USB2_DIV_SELECT_MASK)) |
612 
613  while ((CCM_ANALOG->PLL_USB2 & CCM_ANALOG_PLL_USB2_LOCK_MASK) == 0UL)
614  {
615  }
616 
617  /* Disable Bypass */
619 }
620 
625 {
626  CCM_ANALOG->PLL_USB2 = 0U;
627 }
628 
637 {
638  uint32_t pllAudio;
639  uint32_t misc2 = 0;
640 
641  /* Bypass PLL first */
642  CCM_ANALOG->PLL_AUDIO = (CCM_ANALOG->PLL_AUDIO & (~CCM_ANALOG_PLL_AUDIO_BYPASS_CLK_SRC_MASK)) |
644 
645  CCM_ANALOG->PLL_AUDIO_NUM = CCM_ANALOG_PLL_AUDIO_NUM_A(config->numerator);
646  CCM_ANALOG->PLL_AUDIO_DENOM = CCM_ANALOG_PLL_AUDIO_DENOM_B(config->denominator);
647 
648  /*
649  * Set post divider:
650  *
651  * ------------------------------------------------------------------------
652  * | config->postDivider | PLL_AUDIO[POST_DIV_SELECT] | MISC2[AUDIO_DIV] |
653  * ------------------------------------------------------------------------
654  * | 1 | 2 | 0 |
655  * ------------------------------------------------------------------------
656  * | 2 | 1 | 0 |
657  * ------------------------------------------------------------------------
658  * | 4 | 2 | 3 |
659  * ------------------------------------------------------------------------
660  * | 8 | 1 | 3 |
661  * ------------------------------------------------------------------------
662  * | 16 | 0 | 3 |
663  * ------------------------------------------------------------------------
664  */
665  pllAudio =
668 
669  switch (config->postDivider)
670  {
671  case 16:
674  break;
675 
676  case 8:
679  break;
680 
681  case 4:
684  break;
685 
686  case 2:
688  break;
689 
690  default:
692  break;
693  }
694 
695  CCM_ANALOG->MISC2 =
697 
698  CCM_ANALOG->PLL_AUDIO = pllAudio;
699 
700  while ((CCM_ANALOG->PLL_AUDIO & CCM_ANALOG_PLL_AUDIO_LOCK_MASK) == 0UL)
701  {
702  }
703 
704  /* Disable Bypass */
706 }
707 
712 {
713  CCM_ANALOG->PLL_AUDIO = (uint32_t)CCM_ANALOG_PLL_AUDIO_POWERDOWN_MASK;
714 }
715 
724 {
725  uint32_t pllVideo;
726  uint32_t misc2 = 0;
727 
728  /* Bypass PLL first */
729  CCM_ANALOG->PLL_VIDEO = (CCM_ANALOG->PLL_VIDEO & (~CCM_ANALOG_PLL_VIDEO_BYPASS_CLK_SRC_MASK)) |
731 
732  CCM_ANALOG->PLL_VIDEO_NUM = CCM_ANALOG_PLL_VIDEO_NUM_A(config->numerator);
733  CCM_ANALOG->PLL_VIDEO_DENOM = CCM_ANALOG_PLL_VIDEO_DENOM_B(config->denominator);
734 
735  /*
736  * Set post divider:
737  *
738  * ------------------------------------------------------------------------
739  * | config->postDivider | PLL_VIDEO[POST_DIV_SELECT] | MISC2[VIDEO_DIV] |
740  * ------------------------------------------------------------------------
741  * | 1 | 2 | 0 |
742  * ------------------------------------------------------------------------
743  * | 2 | 1 | 0 |
744  * ------------------------------------------------------------------------
745  * | 4 | 2 | 3 |
746  * ------------------------------------------------------------------------
747  * | 8 | 1 | 3 |
748  * ------------------------------------------------------------------------
749  * | 16 | 0 | 3 |
750  * ------------------------------------------------------------------------
751  */
752  pllVideo =
755 
756  switch (config->postDivider)
757  {
758  case 16:
760  misc2 = CCM_ANALOG_MISC2_VIDEO_DIV(3);
761  break;
762 
763  case 8:
765  misc2 = CCM_ANALOG_MISC2_VIDEO_DIV(3);
766  break;
767 
768  case 4:
770  misc2 = CCM_ANALOG_MISC2_VIDEO_DIV(3);
771  break;
772 
773  case 2:
775  break;
776 
777  default:
779  break;
780  }
781 
782  CCM_ANALOG->MISC2 = (CCM_ANALOG->MISC2 & ~CCM_ANALOG_MISC2_VIDEO_DIV_MASK) | misc2;
783 
784  CCM_ANALOG->PLL_VIDEO = pllVideo;
785 
786  while ((CCM_ANALOG->PLL_VIDEO & CCM_ANALOG_PLL_VIDEO_LOCK_MASK) == 0UL)
787  {
788  }
789 
790  /* Disable Bypass */
792 }
793 
798 {
800 }
801 
810 {
811  uint32_t enet_pll = CCM_ANALOG_PLL_ENET_DIV_SELECT(config->loopDivider);
812 
813  CCM_ANALOG->PLL_ENET = (CCM_ANALOG->PLL_ENET & (~CCM_ANALOG_PLL_ENET_BYPASS_CLK_SRC_MASK)) |
815 
816  if (config->enableClkOutput)
817  {
819  }
820 
821  if (config->enableClkOutput25M)
822  {
824  }
825 
826  CCM_ANALOG->PLL_ENET =
828  enet_pll;
829 
830  /* Wait for stable */
831  while ((CCM_ANALOG->PLL_ENET & CCM_ANALOG_PLL_ENET_LOCK_MASK) == 0UL)
832  {
833  }
834 
835  /* Disable Bypass */
837 }
838 
845 {
847 }
848 
858 {
859  uint32_t freq;
860  uint32_t divSelect;
861  clock_64b_t freqTmp;
862 
863  const uint32_t enetRefClkFreq[] = {
864  25000000U, /* 25M */
865  50000000U, /* 50M */
866  100000000U, /* 100M */
867  125000000U /* 125M */
868  };
869 
870  /* check if PLL is enabled */
871  if (!CLOCK_IsPllEnabled(CCM_ANALOG, pll))
872  {
873  return 0U;
874  }
875 
876  /* get pll reference clock */
878 
879  /* check if pll is bypassed */
881  {
882  return freq;
883  }
884 
885  switch (pll)
886  {
887  case kCLOCK_PllArm:
888  freq = ((freq * ((CCM_ANALOG->PLL_ARM & CCM_ANALOG_PLL_ARM_DIV_SELECT_MASK) >>
890  1U);
891  break;
892  case kCLOCK_PllSys:
893  /* PLL output frequency = Fref * (DIV_SELECT + NUM/DENOM). */
894  freqTmp = ((clock_64b_t)freq * ((clock_64b_t)(CCM_ANALOG->PLL_SYS_NUM)));
895  freqTmp /= ((clock_64b_t)(CCM_ANALOG->PLL_SYS_DENOM));
896 
897  if ((CCM_ANALOG->PLL_SYS & CCM_ANALOG_PLL_SYS_DIV_SELECT_MASK) != 0U)
898  {
899  freq *= 22U;
900  }
901  else
902  {
903  freq *= 20U;
904  }
905 
906  freq += (uint32_t)freqTmp;
907  break;
908 
909  case kCLOCK_PllUsb1:
910  freq = (freq * (((CCM_ANALOG->PLL_USB1 & CCM_ANALOG_PLL_USB1_DIV_SELECT_MASK) != 0UL) ? 22U : 20U));
911  break;
912 
913  case kCLOCK_PllAudio:
914  /* PLL output frequency = Fref * (DIV_SELECT + NUM/DENOM). */
915  divSelect =
917 
918  freqTmp = ((clock_64b_t)freq * ((clock_64b_t)(CCM_ANALOG->PLL_AUDIO_NUM)));
919  freqTmp /= ((clock_64b_t)(CCM_ANALOG->PLL_AUDIO_DENOM));
920 
921  freq = freq * divSelect + (uint32_t)freqTmp;
922 
923  /* AUDIO PLL output = PLL output frequency / POSTDIV. */
924 
925  /*
926  * Post divider:
927  *
928  * PLL_AUDIO[POST_DIV_SELECT]:
929  * 0x00: 4
930  * 0x01: 2
931  * 0x02: 1
932  *
933  * MISC2[AUDO_DIV]:
934  * 0x00: 1
935  * 0x01: 2
936  * 0x02: 1
937  * 0x03: 4
938  */
940  {
942  freq = freq >> 2U;
943  break;
944 
946  freq = freq >> 1U;
947  break;
948 
950  freq = freq >> 0U;
951  break;
952 
953  default:
954  assert(false);
955  break;
956  }
957 
959  {
961  freq >>= 2U;
962  break;
963 
965  freq >>= 1U;
966  break;
967 
970  freq >>= 0U;
971  break;
972 
973  default:
974  assert(false);
975  break;
976  }
977  break;
978 
979  case kCLOCK_PllVideo:
980  /* PLL output frequency = Fref * (DIV_SELECT + NUM/DENOM). */
981  divSelect =
983 
984  freqTmp = ((clock_64b_t)freq * ((clock_64b_t)(CCM_ANALOG->PLL_VIDEO_NUM)));
985  freqTmp /= ((clock_64b_t)(CCM_ANALOG->PLL_VIDEO_DENOM));
986  freq = freq * divSelect + (uint32_t)freqTmp;
987 
988  /* VIDEO PLL output = PLL output frequency / POSTDIV. */
989 
990  /*
991  * Post divider:
992  *
993  * PLL_VIDEO[POST_DIV_SELECT]:
994  * 0x00: 4
995  * 0x01: 2
996  * 0x02: 1
997  *
998  * MISC2[VIDEO_DIV]:
999  * 0x00: 1
1000  * 0x01: 2
1001  * 0x02: 1
1002  * 0x03: 4
1003  */
1005  {
1007  freq = freq >> 2U;
1008  break;
1009 
1011  freq = freq >> 1U;
1012  break;
1013 
1015  freq = freq >> 0U;
1016  break;
1017 
1018  default:
1019  assert(false);
1020  break;
1021  }
1022 
1024  {
1025  case CCM_ANALOG_MISC2_VIDEO_DIV(3U):
1026  freq >>= 2U;
1027  break;
1028 
1029  case CCM_ANALOG_MISC2_VIDEO_DIV(1U):
1030  freq >>= 1U;
1031  break;
1032 
1033  case CCM_ANALOG_MISC2_VIDEO_DIV(0U):
1034  case CCM_ANALOG_MISC2_VIDEO_DIV(2U):
1035  freq >>= 0U;
1036  break;
1037 
1038  default:
1039  assert(false);
1040  break;
1041  }
1042  break;
1043  case kCLOCK_PllEnet:
1044  divSelect =
1046  freq = enetRefClkFreq[divSelect];
1047  break;
1048 
1049  case kCLOCK_PllEnet25M:
1050  /* ref_enetpll1 if fixed at 25MHz. */
1051  freq = 25000000UL;
1052  break;
1053 
1054  case kCLOCK_PllUsb2:
1055  freq = (freq * (((CCM_ANALOG->PLL_USB2 & CCM_ANALOG_PLL_USB2_DIV_SELECT_MASK) != 0U) ? 22U : 20U));
1056  break;
1057  default:
1058  freq = 0U;
1059  break;
1060  }
1061 
1062  return freq;
1063 }
1064 
1075 void CLOCK_InitSysPfd(clock_pfd_t pfd, uint8_t pfdFrac)
1076 {
1077  uint32_t pfdIndex = (uint32_t)pfd;
1078  uint32_t pfd528;
1079 
1080  pfd528 = CCM_ANALOG->PFD_528 &
1082  << (8UL * pfdIndex)));
1083 
1084  /* Disable the clock output first. */
1085  CCM_ANALOG->PFD_528 = pfd528 | ((uint32_t)CCM_ANALOG_PFD_528_PFD0_CLKGATE_MASK << (8UL * pfdIndex));
1086 
1087  /* Set the new value and enable output. */
1088  CCM_ANALOG->PFD_528 = pfd528 | (CCM_ANALOG_PFD_528_PFD0_FRAC(pfdFrac) << (8UL * pfdIndex));
1089 }
1090 
1099 {
1100  CCM_ANALOG->PFD_528 |= (uint32_t)CCM_ANALOG_PFD_528_PFD0_CLKGATE_MASK << (8U * (uint8_t)pfd);
1101 }
1102 
1113 void CLOCK_InitUsb1Pfd(clock_pfd_t pfd, uint8_t pfdFrac)
1114 {
1115  uint32_t pfdIndex = (uint32_t)pfd;
1116  uint32_t pfd480;
1117 
1118  pfd480 = CCM_ANALOG->PFD_480 &
1120  << (8UL * pfdIndex)));
1121 
1122  /* Disable the clock output first. */
1123  CCM_ANALOG->PFD_480 = pfd480 | ((uint32_t)CCM_ANALOG_PFD_480_PFD0_CLKGATE_MASK << (8UL * pfdIndex));
1124 
1125  /* Set the new value and enable output. */
1126  CCM_ANALOG->PFD_480 = pfd480 | (CCM_ANALOG_PFD_480_PFD0_FRAC(pfdFrac) << (8UL * pfdIndex));
1127 }
1128 
1137 {
1138  CCM_ANALOG->PFD_480 |= (uint32_t)CCM_ANALOG_PFD_480_PFD0_CLKGATE_MASK << (8UL * (uint8_t)pfd);
1139 }
1140 
1150 {
1151  uint32_t freq = CLOCK_GetPllFreq(kCLOCK_PllSys);
1152 
1153  switch (pfd)
1154  {
1155  case kCLOCK_Pfd0:
1157  break;
1158 
1159  case kCLOCK_Pfd1:
1161  break;
1162 
1163  case kCLOCK_Pfd2:
1165  break;
1166 
1167  case kCLOCK_Pfd3:
1169  break;
1170 
1171  default:
1172  freq = 0U;
1173  break;
1174  }
1175  freq *= 18U;
1176 
1177  return freq;
1178 }
1179 
1189 {
1190  uint32_t freq = CLOCK_GetPllFreq(kCLOCK_PllUsb1);
1191 
1192  switch (pfd)
1193  {
1194  case kCLOCK_Pfd0:
1196  break;
1197 
1198  case kCLOCK_Pfd1:
1200  break;
1201 
1202  case kCLOCK_Pfd2:
1204  break;
1205 
1206  case kCLOCK_Pfd3:
1208  break;
1209 
1210  default:
1211  freq = 0U;
1212  break;
1213  }
1214  freq *= 18U;
1215 
1216  return freq;
1217 }
1218 
1229 {
1230  const clock_usb_pll_config_t g_ccmConfigUsbPll = {.loopDivider = 0U};
1231  CLOCK_InitUsb2Pll(&g_ccmConfigUsbPll);
1232  USBPHY2->CTRL &= ~USBPHY_CTRL_SFTRST_MASK; /* release PHY from reset */
1234 
1235  USBPHY2->PWD = 0;
1238 
1239  return true;
1240 }
1241 
1247 {
1249  USBPHY2->CTRL |= USBPHY_CTRL_CLKGATE_MASK; /* Set to 1U to gate clocks */
1250 }
CCM_ANALOG_PLL_SYS_DENOM_B
#define CCM_ANALOG_PLL_SYS_DENOM_B(x)
Definition: MIMXRT1052.h:6671
CCM_ANALOG_PLL_USB2_DIV_SELECT
#define CCM_ANALOG_PLL_USB2_DIV_SELECT(x)
Definition: MIMXRT1052.h:6407
kCLOCK_AudioPllClk
@ kCLOCK_AudioPllClk
Definition: fsl_clock.h:434
g_xtalFreq
volatile uint32_t g_xtalFreq
External XTAL (24M OSC/SYSOSC) clock frequency.
Definition: fsl_clock.c:59
_clock_video_pll_config
PLL configuration for AUDIO and VIDEO.
Definition: fsl_clock.h:904
CCM_ANALOG_PLL_AUDIO_NUM_A
#define CCM_ANALOG_PLL_AUDIO_NUM_A(x)
Definition: MIMXRT1052.h:6838
kCLOCK_SemcClk
@ kCLOCK_SemcClk
Definition: fsl_clock.h:408
kCLOCK_PllEnet
@ kCLOCK_PllEnet
Definition: fsl_clock.h:938
CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT
#define CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT(x)
Definition: MIMXRT1052.h:6882
CCM_ANALOG_PLL_ENET_BYPASS_MASK
#define CCM_ANALOG_PLL_ENET_BYPASS_MASK
Definition: MIMXRT1052.h:7042
CCM_ANALOG
#define CCM_ANALOG
Definition: MIMXRT1052.h:8520
XTALOSC24M_LOWPWR_CTRL_SET_OSC_SEL_MASK
#define XTALOSC24M_LOWPWR_CTRL_SET_OSC_SEL_MASK
Definition: MIMXRT1052.h:45672
CLOCK_GetAhbFreq
uint32_t CLOCK_GetAhbFreq(void)
Gets the AHB clock frequency.
Definition: fsl_clock.c:227
clock_pfd_t
enum _clock_pfd clock_pfd_t
PLL PFD name.
CCM_ANALOG_MISC0_OSC_XTALOK_EN_MASK
#define CCM_ANALOG_MISC0_OSC_XTALOK_EN_MASK
Definition: MIMXRT1052.h:7534
USBPHY_CTRL_ENAUTOCLR_CLKGATE_MASK
#define USBPHY_CTRL_ENAUTOCLR_CLKGATE_MASK
Definition: MIMXRT1052.h:41119
CCM_ANALOG_PFD_528_PFD3_FRAC_MASK
#define CCM_ANALOG_PFD_528_PFD3_FRAC_MASK
Definition: MIMXRT1052.h:7347
CCM_ANALOG_PLL_ARM_BYPASS_CLK_SRC
#define CCM_ANALOG_PLL_ARM_BYPASS_CLK_SRC(x)
Definition: MIMXRT1052.h:6166
CCM_ANALOG_PLL_SYS_NUM_A
#define CCM_ANALOG_PLL_SYS_NUM_A(x)
Definition: MIMXRT1052.h:6664
CCM_ANALOG_PLL_SYS_DIV_SELECT
#define CCM_ANALOG_PLL_SYS_DIV_SELECT(x)
Definition: MIMXRT1052.h:6531
CCM_ANALOG_PFD_528_PFD0_FRAC
#define CCM_ANALOG_PFD_528_PFD0_FRAC(x)
Definition: MIMXRT1052.h:7322
CCM_ANALOG_PLL_ENET_LOCK_MASK
#define CCM_ANALOG_PLL_ENET_LOCK_MASK
Definition: MIMXRT1052.h:7051
CCM_ANALOG_PLL_AUDIO_BYPASS_MASK
#define CCM_ANALOG_PLL_AUDIO_BYPASS_MASK
Definition: MIMXRT1052.h:6694
CCM_ANALOG_PLL_ARM_LOCK_MASK
#define CCM_ANALOG_PLL_ARM_LOCK_MASK
Definition: MIMXRT1052.h:6173
CLOCK_GetPeriphClkFreq
static uint32_t CLOCK_GetPeriphClkFreq(void)
Get the periph clock frequency.
Definition: fsl_clock.c:78
CLOCK_DeinitAudioPll
void CLOCK_DeinitAudioPll(void)
De-initialize the Audio PLL.
Definition: fsl_clock.c:711
CCM_ANALOG_MISC0_XTAL_24M_PWD_MASK
#define CCM_ANALOG_MISC0_XTAL_24M_PWD_MASK
Definition: MIMXRT1052.h:7564
CCM_ANALOG_PLL_VIDEO_BYPASS_CLK_SRC
#define CCM_ANALOG_PLL_VIDEO_BYPASS_CLK_SRC(x)
Definition: MIMXRT1052.h:6867
CLOCK_GetPllBypassRefClk
static uint32_t CLOCK_GetPllBypassRefClk(CCM_ANALOG_Type *base, clock_pll_t pll)
Get PLL bypass clock value, it is PLL reference clock actually. If CLOCK1_P,CLOCK1_N is choose as the...
Definition: fsl_clock.h:1329
clock_osc_t
enum _clock_osc clock_osc_t
OSC 24M sorce select.
CCM_CBCDR_AHB_PODF_SHIFT
#define CCM_CBCDR_AHB_PODF_SHIFT
Definition: MIMXRT1052.h:4313
CLOCK_DisableUsbhs0PhyPllClock
void CLOCK_DisableUsbhs0PhyPllClock(void)
Disable USB HS PHY PLL clock.
Definition: fsl_clock.c:482
CCM_ANALOG_PFD_480_PFD1_FRAC_SHIFT
#define CCM_ANALOG_PFD_480_PFD1_FRAC_SHIFT
Definition: MIMXRT1052.h:7170
CCM_ANALOG_PLL_ARM_BYPASS_MASK
#define CCM_ANALOG_PLL_ARM_BYPASS_MASK
Definition: MIMXRT1052.h:6167
CLOCK_DeinitUsb1Pfd
void CLOCK_DeinitUsb1Pfd(clock_pfd_t pfd)
De-initialize the USB1 PLL PFD.
Definition: fsl_clock.c:1136
CLOCK_GetPerClkFreq
uint32_t CLOCK_GetPerClkFreq(void)
Gets the PER clock frequency.
Definition: fsl_clock.c:281
kCLOCK_PllVideo
@ kCLOCK_PllVideo
Definition: fsl_clock.h:936
CLOCK_GetRtcFreq
static uint32_t CLOCK_GetRtcFreq(void)
Gets the RTC clock frequency.
Definition: fsl_clock.h:1191
CCM_ANALOG_PFD_528_PFD0_FRAC_SHIFT
#define CCM_ANALOG_PFD_528_PFD0_FRAC_SHIFT
Definition: MIMXRT1052.h:7321
CCM_CCGR6_CG0_MASK
#define CCM_CCGR6_CG0_MASK
Definition: MIMXRT1052.h:5943
CCM_ANALOG_PLL_AUDIO_DIV_SELECT_SHIFT
#define CCM_ANALOG_PLL_AUDIO_DIV_SELECT_SHIFT
Definition: MIMXRT1052.h:6677
CCM_ANALOG_PFD_528_PFD1_FRAC_SHIFT
#define CCM_ANALOG_PFD_528_PFD1_FRAC_SHIFT
Definition: MIMXRT1052.h:7330
CCM_ANALOG_PLL_VIDEO_POWERDOWN_MASK
#define CCM_ANALOG_PLL_VIDEO_POWERDOWN_MASK
Definition: MIMXRT1052.h:6853
CCM_ANALOG_PLL_USB1_LOCK_MASK
#define CCM_ANALOG_PLL_USB1_LOCK_MASK
Definition: MIMXRT1052.h:6299
USB1
#define USB1
Definition: MIMXRT1052.h:39949
CCM_CBCDR_PERIPH_CLK_SEL_MASK
#define CCM_CBCDR_PERIPH_CLK_SEL_MASK
Definition: MIMXRT1052.h:4338
CCM_ANALOG_PFD_480_PFD2_FRAC_MASK
#define CCM_ANALOG_PFD_480_PFD2_FRAC_MASK
Definition: MIMXRT1052.h:7178
CCM_ANALOG_MISC2_VIDEO_DIV_MASK
#define CCM_ANALOG_MISC2_VIDEO_DIV_MASK
Definition: MIMXRT1052.h:8154
CCM_CBCMR_PRE_PERIPH_CLK_SEL_MASK
#define CCM_CBCMR_PRE_PERIPH_CLK_SEL_MASK
Definition: MIMXRT1052.h:4389
CCM_CSCMR1_PERCLK_PODF_MASK
#define CCM_CSCMR1_PERCLK_PODF_MASK
Definition: MIMXRT1052.h:4428
CLOCK_GetUsb1PfdFreq
uint32_t CLOCK_GetUsb1PfdFreq(clock_pfd_t pfd)
Get current USB1 PLL PFD output frequency.
Definition: fsl_clock.c:1188
CCM_CBCDR_SEMC_PODF_MASK
#define CCM_CBCDR_SEMC_PODF_MASK
Definition: MIMXRT1052.h:4325
CCM_CBCDR_SEMC_CLK_SEL_MASK
#define CCM_CBCDR_SEMC_CLK_SEL_MASK
Definition: MIMXRT1052.h:4289
CCM_CBCDR_PERIPH_CLK2_PODF_MASK
#define CCM_CBCDR_PERIPH_CLK2_PODF_MASK
Definition: MIMXRT1052.h:4345
CCM_CBCDR_IPG_PODF_SHIFT
#define CCM_CBCDR_IPG_PODF_SHIFT
Definition: MIMXRT1052.h:4304
CCM_ANALOG_PLL_ARM_DIV_SELECT_MASK
#define CCM_ANALOG_PLL_ARM_DIV_SELECT_MASK
Definition: MIMXRT1052.h:6149
CLOCK_EnableUsbhs1Clock
bool CLOCK_EnableUsbhs1Clock(clock_usb_src_t src, uint32_t freq)
Enable USB HS clock.
Definition: fsl_clock.c:433
CLOCK_InitVideoPll
void CLOCK_InitVideoPll(const clock_video_pll_config_t *config)
Initialize the video PLL.
Definition: fsl_clock.c:723
CCM_ANALOG_MISC2_AUDIO_DIV_MSB_MASK
#define CCM_ANALOG_MISC2_AUDIO_DIV_MSB_MASK
Definition: MIMXRT1052.h:8120
CCM_ANALOG_PFD_528_PFD3_FRAC_SHIFT
#define CCM_ANALOG_PFD_528_PFD3_FRAC_SHIFT
Definition: MIMXRT1052.h:7348
CCM_ANALOG_PLL_VIDEO_NUM_A
#define CCM_ANALOG_PLL_VIDEO_NUM_A(x)
Definition: MIMXRT1052.h:7012
USBPHY_CTRL_ENUTMILEVEL2_MASK
#define USBPHY_CTRL_ENUTMILEVEL2_MASK
Definition: MIMXRT1052.h:41104
USBHS_USBCMD_RST_MASK
#define USBHS_USBCMD_RST_MASK
Definition: MIMXRT1052.h:40102
CLOCK_GetPllFreq
uint32_t CLOCK_GetPllFreq(clock_pll_t pll)
Get current PLL output frequency.
Definition: fsl_clock.c:857
CLOCK_InitUsb2Pll
void CLOCK_InitUsb2Pll(const clock_usb_pll_config_t *config)
Initialize the USB2 PLL.
Definition: fsl_clock.c:603
CLOCK_DeinitSysPfd
void CLOCK_DeinitSysPfd(clock_pfd_t pfd)
De-initialize the System PLL PFD.
Definition: fsl_clock.c:1098
CCM_ANALOG_PFD_480_PFD0_FRAC_SHIFT
#define CCM_ANALOG_PFD_480_PFD0_FRAC_SHIFT
Definition: MIMXRT1052.h:7161
PMU_REG_3P0_ENABLE_LINREG_MASK
#define PMU_REG_3P0_ENABLE_LINREG_MASK
Definition: MIMXRT1052.h:28882
CCM_ANALOG_PFD_480_PFD3_FRAC_SHIFT
#define CCM_ANALOG_PFD_480_PFD3_FRAC_SHIFT
Definition: MIMXRT1052.h:7188
CCM_CBCDR_IPG_PODF_MASK
#define CCM_CBCDR_IPG_PODF_MASK
Definition: MIMXRT1052.h:4303
CLOCK_DeinitSysPll
void CLOCK_DeinitSysPll(void)
De-initialize the System PLL.
Definition: fsl_clock.c:558
CCM_ANALOG_PLL_VIDEO_ENABLE_MASK
#define CCM_ANALOG_PLL_VIDEO_ENABLE_MASK
Definition: MIMXRT1052.h:6856
CCM_ANALOG_PLL_AUDIO_DENOM_B
#define CCM_ANALOG_PLL_AUDIO_DENOM_B(x)
Definition: MIMXRT1052.h:6845
CCM_CBCMR_PERIPH_CLK2_SEL_MASK
#define CCM_CBCMR_PERIPH_CLK2_SEL_MASK
Definition: MIMXRT1052.h:4371
clock_usb_phy_src_t
enum _clock_usb_phy_src clock_usb_phy_src_t
Source of the USB HS PHY.
CCM_ANALOG_PLL_USB2_LOCK_MASK
#define CCM_ANALOG_PLL_USB2_LOCK_MASK
Definition: MIMXRT1052.h:6429
CCM_ANALOG_PLL_AUDIO_BYPASS_CLK_SRC
#define CCM_ANALOG_PLL_AUDIO_BYPASS_CLK_SRC(x)
Definition: MIMXRT1052.h:6693
kCLOCK_Pfd3
@ kCLOCK_Pfd3
Definition: fsl_clock.h:952
CCM_CSCMR1_PERCLK_CLK_SEL_MASK
#define CCM_CSCMR1_PERCLK_CLK_SEL_MASK
Definition: MIMXRT1052.h:4497
CCM_ANALOG_PLL_ENET_POWERDOWN_MASK
#define CCM_ANALOG_PLL_ENET_POWERDOWN_MASK
Definition: MIMXRT1052.h:7027
CCM_ANALOG_PLL_AUDIO_DIV_SELECT
#define CCM_ANALOG_PLL_AUDIO_DIV_SELECT(x)
Definition: MIMXRT1052.h:6678
CLOCK_InitAudioPll
void CLOCK_InitAudioPll(const clock_audio_pll_config_t *config)
Initializes the Audio PLL.
Definition: fsl_clock.c:636
CCM_ANALOG_PLL_ARM_BYPASS_CLK_SRC_MASK
#define CCM_ANALOG_PLL_ARM_BYPASS_CLK_SRC_MASK
Definition: MIMXRT1052.h:6158
CCM_ANALOG_PFD_480_PFD0_CLKGATE_MASK
#define CCM_ANALOG_PFD_480_PFD0_CLKGATE_MASK
Definition: MIMXRT1052.h:7166
CCM_ANALOG_PLL_USB2_BYPASS_CLK_SRC
#define CCM_ANALOG_PLL_USB2_BYPASS_CLK_SRC(x)
Definition: MIMXRT1052.h:6425
CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT_MASK
#define CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT_MASK
Definition: MIMXRT1052.h:6700
kCLOCK_Usb1PllPfd2Clk
@ kCLOCK_Usb1PllPfd2Clk
Definition: fsl_clock.h:420
CLOCK_DisableUsbhs1PhyPllClock
void CLOCK_DisableUsbhs1PhyPllClock(void)
Disable USB HS PHY PLL clock.
Definition: fsl_clock.c:1246
XTALOSC24M_LOWPWR_CTRL_CLR_OSC_SEL_MASK
#define XTALOSC24M_LOWPWR_CTRL_CLR_OSC_SEL_MASK
Definition: MIMXRT1052.h:45740
USBPHY_CTRL_ENAUTOCLR_PHY_PWD_MASK
#define USBPHY_CTRL_ENAUTOCLR_PHY_PWD_MASK
Definition: MIMXRT1052.h:41122
kCLOCK_VideoPllClk
@ kCLOCK_VideoPllClk
Definition: fsl_clock.h:435
CLOCK_InitUsb1Pfd
void CLOCK_InitUsb1Pfd(clock_pfd_t pfd, uint8_t pfdFrac)
Initialize the USB1 PLL PFD.
Definition: fsl_clock.c:1113
clock_64b_t
uint64_t clock_64b_t
Definition: fsl_clock.c:51
PMU_REG_3P0_OUTPUT_TRG
#define PMU_REG_3P0_OUTPUT_TRG(x)
Definition: MIMXRT1052.h:28908
CCM_ANALOG_PLL_USB1_ENABLE_MASK
#define CCM_ANALOG_PLL_USB1_ENABLE_MASK
Definition: MIMXRT1052.h:6286
CCM_CBCDR_AHB_PODF_MASK
#define CCM_CBCDR_AHB_PODF_MASK
Definition: MIMXRT1052.h:4312
CCM_ANALOG_PLL_VIDEO_DIV_SELECT_SHIFT
#define CCM_ANALOG_PLL_VIDEO_DIV_SELECT_SHIFT
Definition: MIMXRT1052.h:6851
CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT
#define CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT(x)
Definition: MIMXRT1052.h:6708
_clock_arm_pll_config
PLL configuration for ARM.
Definition: fsl_clock.h:862
USBPHY1
#define USBPHY1
Definition: MIMXRT1052.h:41763
XTALOSC24M_LOWPWR_CTRL_RC_OSC_EN_MASK
#define XTALOSC24M_LOWPWR_CTRL_RC_OSC_EN_MASK
Definition: MIMXRT1052.h:45597
CLOCK_DeinitUsb2Pll
void CLOCK_DeinitUsb2Pll(void)
Deinitialize the USB2 PLL.
Definition: fsl_clock.c:624
CCM_ANALOG_PLL_ENET_DIV_SELECT_MASK
#define CCM_ANALOG_PLL_ENET_DIV_SELECT_MASK
Definition: MIMXRT1052.h:7024
CCM_ANALOG_PLL_SYS_ENABLE_MASK
#define CCM_ANALOG_PLL_SYS_ENABLE_MASK
Definition: MIMXRT1052.h:6535
CCM_ANALOG_PLL_VIDEO_LOCK_MASK
#define CCM_ANALOG_PLL_VIDEO_LOCK_MASK
Definition: MIMXRT1052.h:6883
CCM_ANALOG_PFD_528_PFD1_FRAC_MASK
#define CCM_ANALOG_PFD_528_PFD1_FRAC_MASK
Definition: MIMXRT1052.h:7329
CCM_ANALOG_PLL_USB2_DIV_SELECT_MASK
#define CCM_ANALOG_PLL_USB2_DIV_SELECT_MASK
Definition: MIMXRT1052.h:6405
PMU
#define PMU
Definition: MIMXRT1052.h:30822
kCLOCK_SysPllClk
@ kCLOCK_SysPllClk
Definition: fsl_clock.h:425
CCM_ANALOG_PLL_AUDIO_BYPASS_CLK_SRC_MASK
#define CCM_ANALOG_PLL_AUDIO_BYPASS_CLK_SRC_MASK
Definition: MIMXRT1052.h:6685
CCM_ANALOG_PLL_ENET_DIV_SELECT
#define CCM_ANALOG_PLL_ENET_DIV_SELECT(x)
Definition: MIMXRT1052.h:7026
CCM_ANALOG_PLL_VIDEO_DIV_SELECT_MASK
#define CCM_ANALOG_PLL_VIDEO_DIV_SELECT_MASK
Definition: MIMXRT1052.h:6850
python.setup.name
name
Definition: porcupine/binding/python/setup.py:69
CCM_CBCMR_PERIPH_CLK2_SEL
#define CCM_CBCMR_PERIPH_CLK2_SEL(x)
Definition: MIMXRT1052.h:4379
CCM_CBCDR_SEMC_ALT_CLK_SEL_MASK
#define CCM_CBCDR_SEMC_ALT_CLK_SEL_MASK
Definition: MIMXRT1052.h:4296
kCLOCK_PllUsb2
@ kCLOCK_PllUsb2
Definition: fsl_clock.h:942
CCM_ANALOG_PLL_USB2_EN_USB_CLKS_MASK
#define CCM_ANALOG_PLL_USB2_EN_USB_CLKS_MASK
Definition: MIMXRT1052.h:6408
CCM_ANALOG_PLL_ENET_BYPASS_CLK_SRC
#define CCM_ANALOG_PLL_ENET_BYPASS_CLK_SRC(x)
Definition: MIMXRT1052.h:7041
CCM_ANALOG_PLL_USB2_ENABLE_MASK
#define CCM_ANALOG_PLL_USB2_ENABLE_MASK
Definition: MIMXRT1052.h:6414
kCLOCK_PerClk
@ kCLOCK_PerClk
Definition: fsl_clock.h:410
CCM_ANALOG_PFD_528_PFD0_CLKGATE_MASK
#define CCM_ANALOG_PFD_528_PFD0_CLKGATE_MASK
Definition: MIMXRT1052.h:7326
kCLOCK_Pfd0
@ kCLOCK_Pfd0
Definition: fsl_clock.h:949
CCM_ANALOG_PLL_ARM_ENABLE_MASK
#define CCM_ANALOG_PLL_ARM_ENABLE_MASK
Definition: MIMXRT1052.h:6155
CLOCK_DeinitArmPll
void CLOCK_DeinitArmPll(void)
De-initialize the ARM PLL.
Definition: fsl_clock.c:516
CCM_ANALOG_PLL_USB1_DIV_SELECT_MASK
#define CCM_ANALOG_PLL_USB1_DIV_SELECT_MASK
Definition: MIMXRT1052.h:6273
CCM_ANALOG_PLL_AUDIO_ENABLE_MASK
#define CCM_ANALOG_PLL_AUDIO_ENABLE_MASK
Definition: MIMXRT1052.h:6682
CCM_ANALOG_PLL_ARM_DIV_SELECT
#define CCM_ANALOG_PLL_ARM_DIV_SELECT(x)
Definition: MIMXRT1052.h:6151
CCM_ANALOG_PLL_USB1_POWER_MASK
#define CCM_ANALOG_PLL_USB1_POWER_MASK
Definition: MIMXRT1052.h:6283
kCLOCK_Usb1PllClk
@ kCLOCK_Usb1PllClk
Definition: fsl_clock.h:417
kCLOCK_SysPllPfd1Clk
@ kCLOCK_SysPllPfd1Clk
Definition: fsl_clock.h:427
CCM_ANALOG_PLL_USB2_BYPASS_CLK_SRC_MASK
#define CCM_ANALOG_PLL_USB2_BYPASS_CLK_SRC_MASK
Definition: MIMXRT1052.h:6417
CLOCK_InitSysPfd
void CLOCK_InitSysPfd(clock_pfd_t pfd, uint8_t pfdFrac)
Initialize the System PLL PFD.
Definition: fsl_clock.c:1075
CCM_ANALOG_PLL_USB1_BYPASS_MASK
#define CCM_ANALOG_PLL_USB1_BYPASS_MASK
Definition: MIMXRT1052.h:6296
_clock_audio_pll_config
PLL configuration for AUDIO and VIDEO.
Definition: fsl_clock.h:894
CCM_CBCMR_PRE_PERIPH_CLK_SEL
#define CCM_CBCMR_PRE_PERIPH_CLK_SEL(x)
Definition: MIMXRT1052.h:4397
CCM
#define CCM
Definition: MIMXRT1052.h:6049
CCM_ANALOG_PLL_SYS_BYPASS_CLK_SRC_MASK
#define CCM_ANALOG_PLL_SYS_BYPASS_CLK_SRC_MASK
Definition: MIMXRT1052.h:6538
CLOCK_InitRcOsc24M
void CLOCK_InitRcOsc24M(void)
Initialize the RC oscillator 24MHz clock.
Definition: fsl_clock.c:209
CCM_ANALOG_PLL_VIDEO_BYPASS_MASK
#define CCM_ANALOG_PLL_VIDEO_BYPASS_MASK
Definition: MIMXRT1052.h:6868
CLOCK_EnableUsbhs0Clock
bool CLOCK_EnableUsbhs0Clock(clock_usb_src_t src, uint32_t freq)
Enable USB HS clock.
Definition: fsl_clock.c:406
kCLOCK_Usb2PllClk
@ kCLOCK_Usb2PllClk
Definition: fsl_clock.h:423
CLOCK_InitEnetPll
void CLOCK_InitEnetPll(const clock_enet_pll_config_t *config)
Initialize the ENET PLL.
Definition: fsl_clock.c:809
kCLOCK_IpgClk
@ kCLOCK_IpgClk
Definition: fsl_clock.h:409
CCM_ANALOG_PFD_528_PFD2_FRAC_SHIFT
#define CCM_ANALOG_PFD_528_PFD2_FRAC_SHIFT
Definition: MIMXRT1052.h:7339
CLOCK_EnableUsbhs1PhyPllClock
bool CLOCK_EnableUsbhs1PhyPllClock(clock_usb_phy_src_t src, uint32_t freq)
Enable USB HS PHY PLL clock.
Definition: fsl_clock.c:1228
kCLOCK_OscClk
@ kCLOCK_OscClk
Definition: fsl_clock.h:412
CCM_CSCMR1_PERCLK_PODF_SHIFT
#define CCM_CSCMR1_PERCLK_PODF_SHIFT
Definition: MIMXRT1052.h:4429
CLOCK_DeinitRcOsc24M
void CLOCK_DeinitRcOsc24M(void)
Power down the RCOSC 24M clock.
Definition: fsl_clock.c:217
CCM_ANALOG_PLL_USB2_POWER_MASK
#define CCM_ANALOG_PLL_USB2_POWER_MASK
Definition: MIMXRT1052.h:6411
CCM_ANALOG_PLL_ENET_ENABLE_MASK
#define CCM_ANALOG_PLL_ENET_ENABLE_MASK
Definition: MIMXRT1052.h:7030
CCM_ANALOG_PLL_SYS_BYPASS_MASK
#define CCM_ANALOG_PLL_SYS_BYPASS_MASK
Definition: MIMXRT1052.h:6545
XTALOSC24M_LOWPWR_CTRL_XTALOSC_PWRUP_STAT_MASK
#define XTALOSC24M_LOWPWR_CTRL_XTALOSC_PWRUP_STAT_MASK
Definition: MIMXRT1052.h:45648
CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT_MASK
#define CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT_MASK
Definition: MIMXRT1052.h:6874
USB2
#define USB2
Definition: MIMXRT1052.h:39953
CCM_ANALOG_PLL_ARM_POWERDOWN_MASK
#define CCM_ANALOG_PLL_ARM_POWERDOWN_MASK
Definition: MIMXRT1052.h:6152
CLOCK_DeinitVideoPll
void CLOCK_DeinitVideoPll(void)
De-initialize the Video PLL.
Definition: fsl_clock.c:797
kCLOCK_SysPllPfd3Clk
@ kCLOCK_SysPllPfd3Clk
Definition: fsl_clock.h:429
_clock_usb_pll_config
PLL configuration for USB.
Definition: fsl_clock.h:869
CLOCK_InitUsb1Pll
void CLOCK_InitUsb1Pll(const clock_usb_pll_config_t *config)
Initialize the USB1 PLL.
Definition: fsl_clock.c:570
CCM_CACRR_ARM_PODF_SHIFT
#define CCM_CACRR_ARM_PODF_SHIFT
Definition: MIMXRT1052.h:4273
kCLOCK_Usb1PllPfd0Clk
@ kCLOCK_Usb1PllPfd0Clk
Definition: fsl_clock.h:418
USBPHY2
#define USBPHY2
Definition: MIMXRT1052.h:41767
kCLOCK_PllAudio
@ kCLOCK_PllAudio
Definition: fsl_clock.h:935
CCM_ANALOG_PFD_480_PFD0_FRAC_MASK
#define CCM_ANALOG_PFD_480_PFD0_FRAC_MASK
Definition: MIMXRT1052.h:7160
kCLOCK_Usb1PllPfd1Clk
@ kCLOCK_Usb1PllPfd1Clk
Definition: fsl_clock.h:419
XTALOSC24M
#define XTALOSC24M
Definition: MIMXRT1052.h:46093
clock_usb_src_t
enum _clock_usb_src clock_usb_src_t
USB clock source definition.
kCLOCK_ArmPllClk
@ kCLOCK_ArmPllClk
Definition: fsl_clock.h:415
clock_pll_t
enum _clock_pll clock_pll_t
PLL name.
CCM_ANALOG_PLL_SYS_POWERDOWN_MASK
#define CCM_ANALOG_PLL_SYS_POWERDOWN_MASK
Definition: MIMXRT1052.h:6532
CCM_ANALOG_PLL_AUDIO_POWERDOWN_MASK
#define CCM_ANALOG_PLL_AUDIO_POWERDOWN_MASK
Definition: MIMXRT1052.h:6679
kCLOCK_RtcClk
@ kCLOCK_RtcClk
Definition: fsl_clock.h:413
CCM_ANALOG_PFD_480_PFD3_FRAC_MASK
#define CCM_ANALOG_PFD_480_PFD3_FRAC_MASK
Definition: MIMXRT1052.h:7187
kCLOCK_Usb1PllPfd3Clk
@ kCLOCK_Usb1PllPfd3Clk
Definition: fsl_clock.h:421
CCM_ANALOG_PLL_USB1_EN_USB_CLKS_MASK
#define CCM_ANALOG_PLL_USB1_EN_USB_CLKS_MASK
Definition: MIMXRT1052.h:6276
CCM_ANALOG_PLL_AUDIO_DIV_SELECT_MASK
#define CCM_ANALOG_PLL_AUDIO_DIV_SELECT_MASK
Definition: MIMXRT1052.h:6676
CCM_ANALOG_PLL_USB2_BYPASS_MASK
#define CCM_ANALOG_PLL_USB2_BYPASS_MASK
Definition: MIMXRT1052.h:6426
kCLOCK_Pfd1
@ kCLOCK_Pfd1
Definition: fsl_clock.h:950
_clock_usb_pll_config::loopDivider
uint8_t loopDivider
Definition: fsl_clock.h:871
kCLOCK_SysPllPfd2Clk
@ kCLOCK_SysPllPfd2Clk
Definition: fsl_clock.h:428
CCM_ANALOG_MISC2_AUDIO_DIV_LSB
#define CCM_ANALOG_MISC2_AUDIO_DIV_LSB(x)
Definition: MIMXRT1052.h:8103
CLOCK_SwitchOsc
void CLOCK_SwitchOsc(clock_osc_t osc)
Switch the OSC.
Definition: fsl_clock.c:194
CCM_ANALOG_MISC2_VIDEO_DIV
#define CCM_ANALOG_MISC2_VIDEO_DIV(x)
Definition: MIMXRT1052.h:8162
CLOCK_InitSysPll
void CLOCK_InitSysPll(const clock_sys_pll_config_t *config)
Initialize the System PLL.
Definition: fsl_clock.c:528
CCM_ANALOG_MISC0_OSC_XTALOK_MASK
#define CCM_ANALOG_MISC0_OSC_XTALOK_MASK
Definition: MIMXRT1052.h:7531
CCM_ANALOG_PLL_SYS_BYPASS_CLK_SRC
#define CCM_ANALOG_PLL_SYS_BYPASS_CLK_SRC(x)
Definition: MIMXRT1052.h:6544
CLOCK_DeinitEnetPll
void CLOCK_DeinitEnetPll(void)
Deinitialize the ENET PLL.
Definition: fsl_clock.c:844
fsl_clock.h
CLOCK_GetSemcFreq
uint32_t CLOCK_GetSemcFreq(void)
Gets the SEMC clock frequency.
Definition: fsl_clock.c:237
CCM_ANALOG_PLL_ENET_ENET_25M_REF_EN_MASK
#define CCM_ANALOG_PLL_ENET_ENET_25M_REF_EN_MASK
Definition: MIMXRT1052.h:7048
kCLOCK_EnetPll0Clk
@ kCLOCK_EnetPll0Clk
Definition: fsl_clock.h:431
CLOCK_DeinitExternalClk
void CLOCK_DeinitExternalClk(void)
Deinitialize the external 24MHz clock.
Definition: fsl_clock.c:182
clock_name_t
enum _clock_name clock_name_t
Clock name used to get clock frequency.
CCM_ANALOG_PLL_ENET_BYPASS_CLK_SRC_MASK
#define CCM_ANALOG_PLL_ENET_BYPASS_CLK_SRC_MASK
Definition: MIMXRT1052.h:7033
CLOCK_EnableUsbhs0PhyPllClock
bool CLOCK_EnableUsbhs0PhyPllClock(clock_usb_phy_src_t src, uint32_t freq)
Enable USB HS PHY PLL clock.
Definition: fsl_clock.c:458
kCLOCK_Pfd2
@ kCLOCK_Pfd2
Definition: fsl_clock.h:951
kCLOCK_AhbClk
@ kCLOCK_AhbClk
Definition: fsl_clock.h:407
CCM_ANALOG_PLL_SYS_LOCK_MASK
#define CCM_ANALOG_PLL_SYS_LOCK_MASK
Definition: MIMXRT1052.h:6551
CCM_ANALOG_PFD_528_PFD0_FRAC_MASK
#define CCM_ANALOG_PFD_528_PFD0_FRAC_MASK
Definition: MIMXRT1052.h:7320
CCM_ANALOG_PLL_SYS_SS_STOP
#define CCM_ANALOG_PLL_SYS_SS_STOP(x)
Definition: MIMXRT1052.h:6657
CCM_CACRR_ARM_PODF_MASK
#define CCM_CACRR_ARM_PODF_MASK
Definition: MIMXRT1052.h:4272
CCM_ANALOG_PLL_SYS_DIV_SELECT_MASK
#define CCM_ANALOG_PLL_SYS_DIV_SELECT_MASK
Definition: MIMXRT1052.h:6529
CCM_ANALOG_PLL_VIDEO_DENOM_B
#define CCM_ANALOG_PLL_VIDEO_DENOM_B(x)
Definition: MIMXRT1052.h:7019
CCM_ANALOG_PLL_ARM_DIV_SELECT_SHIFT
#define CCM_ANALOG_PLL_ARM_DIV_SELECT_SHIFT
Definition: MIMXRT1052.h:6150
CCM_ANALOG_PFD_480_PFD0_FRAC
#define CCM_ANALOG_PFD_480_PFD0_FRAC(x)
Definition: MIMXRT1052.h:7162
CLOCK_GetOscFreq
static uint32_t CLOCK_GetOscFreq(void)
Gets the OSC clock frequency.
Definition: fsl_clock.h:1092
kCLOCK_PllUsb1
@ kCLOCK_PllUsb1
Definition: fsl_clock.h:934
CLOCK_InitExternalClk
void CLOCK_InitExternalClk(bool bypassXtalOsc)
Initialize the external 24MHz clock.
Definition: fsl_clock.c:158
CCM_ANALOG_PLL_AUDIO_LOCK_MASK
#define CCM_ANALOG_PLL_AUDIO_LOCK_MASK
Definition: MIMXRT1052.h:6709
CCM_ANALOG_MISC2_AUDIO_DIV_LSB_MASK
#define CCM_ANALOG_MISC2_AUDIO_DIV_LSB_MASK
Definition: MIMXRT1052.h:8097
CCM_ANALOG_PFD_480_PFD2_FRAC_SHIFT
#define CCM_ANALOG_PFD_480_PFD2_FRAC_SHIFT
Definition: MIMXRT1052.h:7179
CCM_ANALOG_PFD_528_PFD2_FRAC_MASK
#define CCM_ANALOG_PFD_528_PFD2_FRAC_MASK
Definition: MIMXRT1052.h:7338
CLOCK_DeinitUsb1Pll
void CLOCK_DeinitUsb1Pll(void)
Deinitialize the USB1 PLL.
Definition: fsl_clock.c:591
USBPHY_CTRL_ENUTMILEVEL3_MASK
#define USBPHY_CTRL_ENUTMILEVEL3_MASK
Definition: MIMXRT1052.h:41107
CCM_ANALOG_PLL_USB1_DIV_SELECT
#define CCM_ANALOG_PLL_USB1_DIV_SELECT(x)
Definition: MIMXRT1052.h:6275
CCM_ANALOG_PLL_SYS_SS_ENABLE
#define CCM_ANALOG_PLL_SYS_SS_ENABLE(x)
Definition: MIMXRT1052.h:6654
CCM_ANALOG_PLL_VIDEO_BYPASS_CLK_SRC_MASK
#define CCM_ANALOG_PLL_VIDEO_BYPASS_CLK_SRC_MASK
Definition: MIMXRT1052.h:6859
CLOCK_IsPllEnabled
static bool CLOCK_IsPllEnabled(CCM_ANALOG_Type *base, clock_pll_t pll)
Check if PLL is enabled.
Definition: fsl_clock.h:1303
config
static sai_transceiver_t config
Definition: imxrt1050/imxrt1050-evkb/source/pv_audio_rec.c:75
CCM_ANALOG_PLL_USB1_BYPASS_CLK_SRC
#define CCM_ANALOG_PLL_USB1_BYPASS_CLK_SRC(x)
Definition: MIMXRT1052.h:6295
CLOCK_GetSysPfdFreq
uint32_t CLOCK_GetSysPfdFreq(clock_pfd_t pfd)
Get current System PLL PFD output frequency.
Definition: fsl_clock.c:1149
CLOCK_InitArmPll
void CLOCK_InitArmPll(const clock_arm_pll_config_t *config)
Initialize the ARM PLL.
Definition: fsl_clock.c:495
CCM_ANALOG_PLL_SYS_SS_STEP
#define CCM_ANALOG_PLL_SYS_SS_STEP(x)
Definition: MIMXRT1052.h:6647
__ASM
#define __ASM
Definition: imxrt1050/imxrt1050-evkb/CMSIS/cmsis_armcc.h:57
CCM_ANALOG_PLL_USB1_BYPASS_CLK_SRC_MASK
#define CCM_ANALOG_PLL_USB1_BYPASS_CLK_SRC_MASK
Definition: MIMXRT1052.h:6289
CCM_CBCDR_PERIPH_CLK2_PODF_SHIFT
#define CCM_CBCDR_PERIPH_CLK2_PODF_SHIFT
Definition: MIMXRT1052.h:4346
USBPHY_CTRL_CLKGATE_MASK
#define USBPHY_CTRL_CLKGATE_MASK
Definition: MIMXRT1052.h:41149
USBPHY_CTRL_SFTRST_MASK
#define USBPHY_CTRL_SFTRST_MASK
Definition: MIMXRT1052.h:41152
CCM_ANALOG_MISC2_AUDIO_DIV_MSB
#define CCM_ANALOG_MISC2_AUDIO_DIV_MSB(x)
Definition: MIMXRT1052.h:8126
kCLOCK_RcOsc
@ kCLOCK_RcOsc
Definition: fsl_clock.h:578
kCLOCK_SysPllPfd0Clk
@ kCLOCK_SysPllPfd0Clk
Definition: fsl_clock.h:426
_clock_enet_pll_config
PLL configuration for ENET.
Definition: fsl_clock.h:915
CCM_ANALOG_PFD_480_PFD1_FRAC_MASK
#define CCM_ANALOG_PFD_480_PFD1_FRAC_MASK
Definition: MIMXRT1052.h:7169
CCM_CBCDR_SEMC_PODF_SHIFT
#define CCM_CBCDR_SEMC_PODF_SHIFT
Definition: MIMXRT1052.h:4326
g_rtcXtalFreq
volatile uint32_t g_rtcXtalFreq
External RTC XTAL (32K OSC) clock frequency.
Definition: fsl_clock.c:61
_clock_sys_pll_config
PLL configuration for System.
Definition: fsl_clock.h:879
kCLOCK_PllArm
@ kCLOCK_PllArm
Definition: fsl_clock.h:932
CLOCK_IsPllBypassed
static bool CLOCK_IsPllBypassed(CCM_ANALOG_Type *base, clock_pll_t pll)
Check if PLL is bypassed.
Definition: fsl_clock.h:1289
kCLOCK_CpuClk
@ kCLOCK_CpuClk
Definition: fsl_clock.h:406
kCLOCK_PllSys
@ kCLOCK_PllSys
Definition: fsl_clock.h:933
kCLOCK_EnetPll1Clk
@ kCLOCK_EnetPll1Clk
Definition: fsl_clock.h:432
PMU_REG_3P0_OUTPUT_TRG_MASK
#define PMU_REG_3P0_OUTPUT_TRG_MASK
Definition: MIMXRT1052.h:28901
CCM_ANALOG_PLL_ENET_DIV_SELECT_SHIFT
#define CCM_ANALOG_PLL_ENET_DIV_SELECT_SHIFT
Definition: MIMXRT1052.h:7025
CLOCK_GetFreq
uint32_t CLOCK_GetFreq(clock_name_t name)
Gets the clock frequency for a specific clock name.
Definition: fsl_clock.c:310
CCM_ANALOG_PLL_VIDEO_DIV_SELECT
#define CCM_ANALOG_PLL_VIDEO_DIV_SELECT(x)
Definition: MIMXRT1052.h:6852
kCLOCK_PllEnet25M
@ kCLOCK_PllEnet25M
Definition: fsl_clock.h:940
CLOCK_GetIpgFreq
uint32_t CLOCK_GetIpgFreq(void)
Gets the IPG clock frequency.
Definition: fsl_clock.c:271


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:13:55