HAL
Select one of the symbols to view example projects that use it.
 
Outline
#include "stm32f4xx_ll_rcc.h"
#include "stm32_assert.h"
#define assert_param
Private macros
#define IS_LL_RCC_FMPI2C_CLKSOURCE
#define IS_LL_RCC_LPTIM_CLKSOURCE
#define IS_LL_RCC_SDIO_CLKSOURCE
#define IS_LL_RCC_RNG_CLKSOURCE
#define IS_LL_RCC_USB_CLKSOURCE
#define IS_LL_RCC_DFSDM_CLKSOURCE
#define IS_LL_RCC_DFSDM_CLKSOURCE
#define IS_LL_RCC_DFSDM_AUDIO_CLKSOURCE
#define IS_LL_RCC_I2S_CLKSOURCE
#define IS_LL_RCC_CEC_CLKSOURCE
#define IS_LL_RCC_DSI_CLKSOURCE
#define IS_LL_RCC_LTDC_CLKSOURCE
#define IS_LL_RCC_SPDIFRX_CLKSOURCE
Private function prototypes
LL_RCC_DeInit()
LL_RCC_GetSystemClocksFreq(LL_RCC_ClocksTypeDef *)
LL_RCC_GetFMPI2CClockFreq(uint32_t)
LL_RCC_GetI2SClockFreq(uint32_t)
LL_RCC_GetLPTIMClockFreq(uint32_t)
LL_RCC_GetRNGClockFreq(uint32_t)
RCC_GetSystemClockFreq()
RCC_GetHCLKClockFreq(uint32_t)
RCC_GetPCLK1ClockFreq(uint32_t)
RCC_GetPCLK2ClockFreq(uint32_t)
RCC_PLL_GetFreqDomain_SYS(uint32_t)
RCC_PLL_GetFreqDomain_48M()
RCC_PLL_GetFreqDomain_I2S()
Files
loading...
SourceVuSTM32 Libraries and SamplesHALSrc/stm32f4xx_ll_rcc.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file stm32f4xx_ll_rcc.c * @author MCD Application Team * @brief RCC LL module driver. ****************************************************************************** * @attention * * Copyright (c) 2017 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file in * the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. ****************************************************************************** *//* ... */ #if defined(USE_FULL_LL_DRIVER) /* Includes ------------------------------------------------------------------*/ #include "stm32f4xx_ll_rcc.h" #ifdef USE_FULL_ASSERT #include "stm32_assert.h" #else #define assert_param(expr) ((void)0U) #endif /** @addtogroup STM32F4xx_LL_Driver * @{ *//* ... */ #if defined(RCC) /** @addtogroup RCC_LL * @{ *//* ... */ /* Private types -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private constants ---------------------------------------------------------*/ /* Private macros ------------------------------------------------------------*/ /** @addtogroup RCC_LL_Private_Macros * @{ *//* ... */ #if defined(FMPI2C1) #define IS_LL_RCC_FMPI2C_CLKSOURCE(__VALUE__) ((__VALUE__) == LL_RCC_FMPI2C1_CLKSOURCE) #endif /* FMPI2C1 */ #if defined(LPTIM1) #define IS_LL_RCC_LPTIM_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_LPTIM1_CLKSOURCE)) #endif /* LPTIM1 */ #if defined(SAI1) #if defined(RCC_DCKCFGR_SAI1SRC) #define IS_LL_RCC_SAI_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_SAI1_CLKSOURCE) \ || ((__VALUE__) == LL_RCC_SAI2_CLKSOURCE))... /* ... */#elif defined(RCC_DCKCFGR_SAI1ASRC) #define IS_LL_RCC_SAI_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_SAI1_A_CLKSOURCE) \ || ((__VALUE__) == LL_RCC_SAI1_B_CLKSOURCE))... /* ... */#endif /* RCC_DCKCFGR_SAI1SRC *//* ... */ #endif /* SAI1 */ #if defined(SDIO) #define IS_LL_RCC_SDIO_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_SDIO_CLKSOURCE)) #endif /* SDIO */ #if defined(RNG) #define IS_LL_RCC_RNG_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_RNG_CLKSOURCE)) #endif /* RNG */ #if defined(USB_OTG_FS) || defined(USB_OTG_HS) #define IS_LL_RCC_USB_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_USB_CLKSOURCE)) #endif /* USB_OTG_FS || USB_OTG_HS */ #if defined(DFSDM2_Channel0) #define IS_LL_RCC_DFSDM_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_DFSDM1_CLKSOURCE)) #define IS_LL_RCC_DFSDM_AUDIO_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_DFSDM1_AUDIO_CLKSOURCE) \ || ((__VALUE__) == LL_RCC_DFSDM2_AUDIO_CLKSOURCE))... /* ... */#elif defined(DFSDM1_Channel0) #define IS_LL_RCC_DFSDM_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_DFSDM1_CLKSOURCE)) #define IS_LL_RCC_DFSDM_AUDIO_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_DFSDM1_AUDIO_CLKSOURCE)) /* ... */#endif /* DFSDM2_Channel0 */ #if defined(RCC_DCKCFGR_I2S2SRC) #define IS_LL_RCC_I2S_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_I2S1_CLKSOURCE) \ || ((__VALUE__) == LL_RCC_I2S2_CLKSOURCE))... /* ... */#else #define IS_LL_RCC_I2S_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_I2S1_CLKSOURCE)) #endif /* RCC_DCKCFGR_I2S2SRC */ #if defined(CEC) #define IS_LL_RCC_CEC_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_CEC_CLKSOURCE)) #endif /* CEC */ #if defined(DSI) #define IS_LL_RCC_DSI_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_DSI_CLKSOURCE)) #endif /* DSI */ #if defined(LTDC) #define IS_LL_RCC_LTDC_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_LTDC_CLKSOURCE)) #endif /* LTDC */ #if defined(SPDIFRX) #define IS_LL_RCC_SPDIFRX_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_SPDIFRX1_CLKSOURCE)) #endif /* SPDIFRX */ /** * @} *//* ... */ Private macros /* Private function prototypes -----------------------------------------------*/ /** @defgroup RCC_LL_Private_Functions RCC Private functions * @{ *//* ... */ uint32_t RCC_GetSystemClockFreq(void); uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency); uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency); uint32_t RCC_GetPCLK2ClockFreq(uint32_t HCLK_Frequency); uint32_t RCC_PLL_GetFreqDomain_SYS(uint32_t SYSCLK_Source); uint32_t RCC_PLL_GetFreqDomain_48M(void); #if defined(RCC_DCKCFGR_I2SSRC) || defined(RCC_DCKCFGR_I2S1SRC) uint32_t RCC_PLL_GetFreqDomain_I2S(void); #endif /* RCC_DCKCFGR_I2SSRC || RCC_DCKCFGR_I2S1SRC */ #if defined(SPDIFRX) uint32_t RCC_PLL_GetFreqDomain_SPDIFRX(void); #endif /* SPDIFRX */ #if defined(RCC_PLLCFGR_PLLR) #if defined(SAI1) uint32_t RCC_PLL_GetFreqDomain_SAI(void); #endif /* SAI1 *//* ... */ #endif /* RCC_PLLCFGR_PLLR */ #if defined(DSI) uint32_t RCC_PLL_GetFreqDomain_DSI(void); #endif /* DSI */ #if defined(RCC_PLLSAI_SUPPORT) uint32_t RCC_PLLSAI_GetFreqDomain_SAI(void); #if defined(RCC_PLLSAICFGR_PLLSAIP) uint32_t RCC_PLLSAI_GetFreqDomain_48M(void); #endif /* RCC_PLLSAICFGR_PLLSAIP */ #if defined(LTDC) uint32_t RCC_PLLSAI_GetFreqDomain_LTDC(void); #endif /* LTDC *//* ... */ #endif /* RCC_PLLSAI_SUPPORT */ #if defined(RCC_PLLI2S_SUPPORT) uint32_t RCC_PLLI2S_GetFreqDomain_I2S(void); #if defined(RCC_PLLI2SCFGR_PLLI2SQ) && !defined(RCC_DCKCFGR_PLLI2SDIVQ) uint32_t RCC_PLLI2S_GetFreqDomain_48M(void); #endif /* RCC_PLLI2SCFGR_PLLI2SQ && !RCC_DCKCFGR_PLLI2SDIVQ */ #if defined(SAI1) uint32_t RCC_PLLI2S_GetFreqDomain_SAI(void); #endif /* SAI1 */ #if defined(SPDIFRX) uint32_t RCC_PLLI2S_GetFreqDomain_SPDIFRX(void); #endif /* SPDIFRX *//* ... */ #endif /* RCC_PLLI2S_SUPPORT */ /** * @} *//* ... */ Private function prototypes /* Exported functions --------------------------------------------------------*/ /** @addtogroup RCC_LL_Exported_Functions * @{ *//* ... */ /** @addtogroup RCC_LL_EF_Init * @{ *//* ... */ /** * @brief Reset the RCC clock configuration to the default reset state. * @note The default reset state of the clock configuration is given below: * - HSI ON and used as system clock source * - HSE and PLL OFF * - AHB, APB1 and APB2 prescaler set to 1. * - CSS, MCO OFF * - All interrupts disabled * @note This function doesn't modify the configuration of the * - Peripheral clocks * - LSI, LSE and RTC clocks * @retval An ErrorStatus enumeration value: * - SUCCESS: RCC registers are de-initialized * - ERROR: not applicable *//* ... */ ErrorStatus LL_RCC_DeInit(void) { __IO uint32_t vl_mask; /* Set HSION bit */ LL_RCC_HSI_Enable(); /* Wait for HSI READY bit */ while(LL_RCC_HSI_IsReady() != 1U) {}while (LL_RCC_HSI_IsReady() != 1U) { ... } /* Reset CFGR register */ LL_RCC_WriteReg(CFGR, 0x00000000U); /* Read CR register */ vl_mask = LL_RCC_ReadReg(CR); /* Reset HSEON, HSEBYP, PLLON, CSSON bits */ CLEAR_BIT(vl_mask, (RCC_CR_HSEON | RCC_CR_HSEBYP | RCC_CR_PLLON | RCC_CR_CSSON)); #if defined(RCC_PLLSAI_SUPPORT) /* Reset PLLSAION bit */ CLEAR_BIT(vl_mask, RCC_CR_PLLSAION);/* ... */ #endif /* RCC_PLLSAI_SUPPORT */ #if defined(RCC_PLLI2S_SUPPORT) /* Reset PLLI2SON bit */ CLEAR_BIT(vl_mask, RCC_CR_PLLI2SON);/* ... */ #endif /* RCC_PLLI2S_SUPPORT */ /* Write new value in CR register */ LL_RCC_WriteReg(CR, vl_mask); /* Set HSITRIM bits to the reset value*/ LL_RCC_HSI_SetCalibTrimming(0x10U); /* Wait for PLL READY bit to be reset */ while(LL_RCC_PLL_IsReady() != 0U) {}while (LL_RCC_PLL_IsReady() != 0U) { ... } /* Reset PLLCFGR register */ LL_RCC_WriteReg(PLLCFGR, RCC_PLLCFGR_RST_VALUE); #if defined(RCC_PLLI2S_SUPPORT) /* Reset PLLI2SCFGR register */ LL_RCC_WriteReg(PLLI2SCFGR, RCC_PLLI2SCFGR_RST_VALUE);/* ... */ #endif /* RCC_PLLI2S_SUPPORT */ #if defined(RCC_PLLSAI_SUPPORT) /* Reset PLLSAICFGR register */ LL_RCC_WriteReg(PLLSAICFGR, RCC_PLLSAICFGR_RST_VALUE);/* ... */ #endif /* RCC_PLLSAI_SUPPORT */ /* Disable all interrupts */ CLEAR_BIT(RCC->CIR, RCC_CIR_LSIRDYIE | RCC_CIR_LSERDYIE | RCC_CIR_HSIRDYIE | RCC_CIR_HSERDYIE | RCC_CIR_PLLRDYIE); #if defined(RCC_CIR_PLLI2SRDYIE) CLEAR_BIT(RCC->CIR, RCC_CIR_PLLI2SRDYIE); #endif /* RCC_CIR_PLLI2SRDYIE */ #if defined(RCC_CIR_PLLSAIRDYIE) CLEAR_BIT(RCC->CIR, RCC_CIR_PLLSAIRDYIE); #endif /* RCC_CIR_PLLSAIRDYIE */ /* Clear all interrupt flags */ SET_BIT(RCC->CIR, RCC_CIR_LSIRDYC | RCC_CIR_LSERDYC | RCC_CIR_HSIRDYC | RCC_CIR_HSERDYC | RCC_CIR_PLLRDYC | RCC_CIR_CSSC); #if defined(RCC_CIR_PLLI2SRDYC) SET_BIT(RCC->CIR, RCC_CIR_PLLI2SRDYC); #endif /* RCC_CIR_PLLI2SRDYC */ #if defined(RCC_CIR_PLLSAIRDYC) SET_BIT(RCC->CIR, RCC_CIR_PLLSAIRDYC); #endif /* RCC_CIR_PLLSAIRDYC */ /* Clear LSION bit */ CLEAR_BIT(RCC->CSR, RCC_CSR_LSION); /* Reset all CSR flags */ SET_BIT(RCC->CSR, RCC_CSR_RMVF); return SUCCESS; }{ ... } /** * @} *//* ... */ /** @addtogroup RCC_LL_EF_Get_Freq * @brief Return the frequencies of different on chip clocks; System, AHB, APB1 and APB2 buses clocks * and different peripheral clocks available on the device. * @note If SYSCLK source is HSI, function returns values based on HSI_VALUE(**) * @note If SYSCLK source is HSE, function returns values based on HSE_VALUE(***) * @note If SYSCLK source is PLL, function returns values based on HSE_VALUE(***) * or HSI_VALUE(**) multiplied/divided by the PLL factors. * @note (**) HSI_VALUE is a constant defined in this file (default value * 16 MHz) but the real value may vary depending on the variations * in voltage and temperature. * @note (***) HSE_VALUE is a constant defined in this file (default value * 25 MHz), user has to ensure that HSE_VALUE is same as the real * frequency of the crystal used. Otherwise, this function may * have wrong result. * @note The result of this function could be incorrect when using fractional * value for HSE crystal. * @note This function can be used by the user application to compute the * baud-rate for the communication peripherals or configure other parameters. * @{ *//* ... */ /** * @brief Return the frequencies of different on chip clocks; System, AHB, APB1 and APB2 buses clocks * @note Each time SYSCLK, HCLK, PCLK1 and/or PCLK2 clock changes, this function * must be called to update structure fields. Otherwise, any * configuration based on this function will be incorrect. * @param RCC_Clocks pointer to a @ref LL_RCC_ClocksTypeDef structure which will hold the clocks frequencies * @retval None *//* ... */ void LL_RCC_GetSystemClocksFreq(LL_RCC_ClocksTypeDef *RCC_Clocks) { /* Get SYSCLK frequency */ RCC_Clocks->SYSCLK_Frequency = RCC_GetSystemClockFreq(); /* HCLK clock frequency */ RCC_Clocks->HCLK_Frequency = RCC_GetHCLKClockFreq(RCC_Clocks->SYSCLK_Frequency); /* PCLK1 clock frequency */ RCC_Clocks->PCLK1_Frequency = RCC_GetPCLK1ClockFreq(RCC_Clocks->HCLK_Frequency); /* PCLK2 clock frequency */ RCC_Clocks->PCLK2_Frequency = RCC_GetPCLK2ClockFreq(RCC_Clocks->HCLK_Frequency); }{ ... } #if defined(FMPI2C1) /** * @brief Return FMPI2Cx clock frequency * @param FMPI2CxSource This parameter can be one of the following values: * @arg @ref LL_RCC_FMPI2C1_CLKSOURCE * @retval FMPI2C clock frequency (in Hz) * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that HSI oscillator is not ready *//* ... */ uint32_t LL_RCC_GetFMPI2CClockFreq(uint32_t FMPI2CxSource) { uint32_t FMPI2C_frequency = LL_RCC_PERIPH_FREQUENCY_NO; /* Check parameter */ assert_param(IS_LL_RCC_FMPI2C_CLKSOURCE(FMPI2CxSource)); if (FMPI2CxSource == LL_RCC_FMPI2C1_CLKSOURCE) { /* FMPI2C1 CLK clock frequency */ switch (LL_RCC_GetFMPI2CClockSource(FMPI2CxSource)) { case LL_RCC_FMPI2C1_CLKSOURCE_SYSCLK: /* FMPI2C1 Clock is System Clock */ FMPI2C_frequency = RCC_GetSystemClockFreq(); break; case LL_RCC_FMPI2C1_CLKSOURCE_SYSCLK: case LL_RCC_FMPI2C1_CLKSOURCE_HSI: /* FMPI2C1 Clock is HSI Osc. */ if (LL_RCC_HSI_IsReady()) { FMPI2C_frequency = HSI_VALUE; }if (LL_RCC_HSI_IsReady()) { ... } break; case LL_RCC_FMPI2C1_CLKSOURCE_HSI: case LL_RCC_FMPI2C1_CLKSOURCE_PCLK1: /* FMPI2C1 Clock is PCLK1 */ default: FMPI2C_frequency = RCC_GetPCLK1ClockFreq(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq())); break;default }switch (LL_RCC_GetFMPI2CClockSource(FMPI2CxSource)) { ... } }if (FMPI2CxSource == LL_RCC_FMPI2C1_CLKSOURCE) { ... } return FMPI2C_frequency; }{ ... } #endif/* ... */ /* FMPI2C1 */ /** * @brief Return I2Sx clock frequency * @param I2SxSource This parameter can be one of the following values: * @arg @ref LL_RCC_I2S1_CLKSOURCE * @arg @ref LL_RCC_I2S2_CLKSOURCE (*) * * (*) value not defined in all devices. * @retval I2S clock frequency (in Hz) * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready *//* ... */ uint32_t LL_RCC_GetI2SClockFreq(uint32_t I2SxSource) { uint32_t i2s_frequency = LL_RCC_PERIPH_FREQUENCY_NO; /* Check parameter */ assert_param(IS_LL_RCC_I2S_CLKSOURCE(I2SxSource)); if (I2SxSource == LL_RCC_I2S1_CLKSOURCE) { /* I2S1 CLK clock frequency */ switch (LL_RCC_GetI2SClockSource(I2SxSource)) { #if defined(RCC_PLLI2S_SUPPORT) case LL_RCC_I2S1_CLKSOURCE_PLLI2S: /* I2S1 Clock is PLLI2S */ if (LL_RCC_PLLI2S_IsReady()) { i2s_frequency = RCC_PLLI2S_GetFreqDomain_I2S(); }if (LL_RCC_PLLI2S_IsReady()) { ... } break;/* ... */ #endif /* RCC_PLLI2S_SUPPORT */ #if defined(RCC_DCKCFGR_I2SSRC) || defined(RCC_DCKCFGR_I2S1SRC)case LL_RCC_I2S1_CLKSOURCE_PLLI2S: case LL_RCC_I2S1_CLKSOURCE_PLL: /* I2S1 Clock is PLL */ if (LL_RCC_PLL_IsReady()) { i2s_frequency = RCC_PLL_GetFreqDomain_I2S(); }if (LL_RCC_PLL_IsReady()) { ... } break; case LL_RCC_I2S1_CLKSOURCE_PLL: case LL_RCC_I2S1_CLKSOURCE_PLLSRC: /* I2S1 Clock is PLL Main source */ switch (LL_RCC_PLL_GetMainSource()) { case LL_RCC_PLLSOURCE_HSE: /* I2S1 Clock is HSE Osc. */ if (LL_RCC_HSE_IsReady()) { i2s_frequency = HSE_VALUE; }if (LL_RCC_HSE_IsReady()) { ... } break; case LL_RCC_PLLSOURCE_HSE: case LL_RCC_PLLSOURCE_HSI: /* I2S1 Clock is HSI Osc. */ default: if (LL_RCC_HSI_IsReady()) { i2s_frequency = HSI_VALUE; }if (LL_RCC_HSI_IsReady()) { ... } break;default }switch (LL_RCC_PLL_GetMainSource()) { ... } break;/* ... */ #endif /* RCC_DCKCFGR_I2SSRC || RCC_DCKCFGR_I2S1SRC */ case LL_RCC_I2S1_CLKSOURCE_PIN: /* I2S1 Clock is External clock */ default: i2s_frequency = EXTERNAL_CLOCK_VALUE; break;default }switch (LL_RCC_GetI2SClockSource(I2SxSource)) { ... } }if (I2SxSource == LL_RCC_I2S1_CLKSOURCE) { ... } #if defined(RCC_DCKCFGR_I2S2SRC) else { /* I2S2 CLK clock frequency */ switch (LL_RCC_GetI2SClockSource(I2SxSource)) { case LL_RCC_I2S2_CLKSOURCE_PLLI2S: /* I2S2 Clock is PLLI2S */ if (LL_RCC_PLLI2S_IsReady()) { i2s_frequency = RCC_PLLI2S_GetFreqDomain_I2S(); }if (LL_RCC_PLLI2S_IsReady()) { ... } break; case LL_RCC_I2S2_CLKSOURCE_PLLI2S: case LL_RCC_I2S2_CLKSOURCE_PLL: /* I2S2 Clock is PLL */ if (LL_RCC_PLL_IsReady()) { i2s_frequency = RCC_PLL_GetFreqDomain_I2S(); }if (LL_RCC_PLL_IsReady()) { ... } break; case LL_RCC_I2S2_CLKSOURCE_PLL: case LL_RCC_I2S2_CLKSOURCE_PLLSRC: /* I2S2 Clock is PLL Main source */ switch (LL_RCC_PLL_GetMainSource()) { case LL_RCC_PLLSOURCE_HSE: /* I2S2 Clock is HSE Osc. */ if (LL_RCC_HSE_IsReady()) { i2s_frequency = HSE_VALUE; }if (LL_RCC_HSE_IsReady()) { ... } break; case LL_RCC_PLLSOURCE_HSE: case LL_RCC_PLLSOURCE_HSI: /* I2S2 Clock is HSI Osc. */ default: if (LL_RCC_HSI_IsReady()) { i2s_frequency = HSI_VALUE; }if (LL_RCC_HSI_IsReady()) { ... } break;default }switch (LL_RCC_PLL_GetMainSource()) { ... } break; case LL_RCC_I2S2_CLKSOURCE_PLLSRC: case LL_RCC_I2S2_CLKSOURCE_PIN: /* I2S2 Clock is External clock */ default: i2s_frequency = EXTERNAL_CLOCK_VALUE; break;default }switch (LL_RCC_GetI2SClockSource(I2SxSource)) { ... } }else { ... } /* ... */#endif /* RCC_DCKCFGR_I2S2SRC */ return i2s_frequency; }{ ... } #if defined(LPTIM1) /** * @brief Return LPTIMx clock frequency * @param LPTIMxSource This parameter can be one of the following values: * @arg @ref LL_RCC_LPTIM1_CLKSOURCE * @retval LPTIM clock frequency (in Hz) * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (HSI, LSI or LSE) is not ready *//* ... */ uint32_t LL_RCC_GetLPTIMClockFreq(uint32_t LPTIMxSource) { uint32_t lptim_frequency = LL_RCC_PERIPH_FREQUENCY_NO; /* Check parameter */ assert_param(IS_LL_RCC_LPTIM_CLKSOURCE(LPTIMxSource)); if (LPTIMxSource == LL_RCC_LPTIM1_CLKSOURCE) { /* LPTIM1CLK clock frequency */ switch (LL_RCC_GetLPTIMClockSource(LPTIMxSource)) { case LL_RCC_LPTIM1_CLKSOURCE_LSI: /* LPTIM1 Clock is LSI Osc. */ if (LL_RCC_LSI_IsReady()) { lptim_frequency = LSI_VALUE; }if (LL_RCC_LSI_IsReady()) { ... } break; case LL_RCC_LPTIM1_CLKSOURCE_LSI: case LL_RCC_LPTIM1_CLKSOURCE_HSI: /* LPTIM1 Clock is HSI Osc. */ if (LL_RCC_HSI_IsReady()) { lptim_frequency = HSI_VALUE; }if (LL_RCC_HSI_IsReady()) { ... } break; case LL_RCC_LPTIM1_CLKSOURCE_HSI: case LL_RCC_LPTIM1_CLKSOURCE_LSE: /* LPTIM1 Clock is LSE Osc. */ if (LL_RCC_LSE_IsReady()) { lptim_frequency = LSE_VALUE; }if (LL_RCC_LSE_IsReady()) { ... } break; case LL_RCC_LPTIM1_CLKSOURCE_LSE: case LL_RCC_LPTIM1_CLKSOURCE_PCLK1: /* LPTIM1 Clock is PCLK1 */ default: lptim_frequency = RCC_GetPCLK1ClockFreq(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq())); break;default }switch (LL_RCC_GetLPTIMClockSource(LPTIMxSource)) { ... } }if (LPTIMxSource == LL_RCC_LPTIM1_CLKSOURCE) { ... } return lptim_frequency; }{ ... } #endif/* ... */ /* LPTIM1 */ #if defined(SAI1) /** * @brief Return SAIx clock frequency * @param SAIxSource This parameter can be one of the following values: * @arg @ref LL_RCC_SAI1_CLKSOURCE (*) * @arg @ref LL_RCC_SAI2_CLKSOURCE (*) * @arg @ref LL_RCC_SAI1_A_CLKSOURCE (*) * @arg @ref LL_RCC_SAI1_B_CLKSOURCE (*) * * (*) value not defined in all devices. * @retval SAI clock frequency (in Hz) * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready *//* ... */ uint32_t LL_RCC_GetSAIClockFreq(uint32_t SAIxSource) { uint32_t sai_frequency = LL_RCC_PERIPH_FREQUENCY_NO; /* Check parameter */ assert_param(IS_LL_RCC_SAI_CLKSOURCE(SAIxSource)); #if defined(RCC_DCKCFGR_SAI1SRC) if ((SAIxSource == LL_RCC_SAI1_CLKSOURCE) || (SAIxSource == LL_RCC_SAI2_CLKSOURCE)) { /* SAI1CLK clock frequency */ switch (LL_RCC_GetSAIClockSource(SAIxSource)) { case LL_RCC_SAI1_CLKSOURCE_PLLSAI: /* PLLSAI clock used as SAI1 clock source */ case LL_RCC_SAI2_CLKSOURCE_PLLSAI: /* PLLSAI clock used as SAI2 clock source */ if (LL_RCC_PLLSAI_IsReady()) { sai_frequency = RCC_PLLSAI_GetFreqDomain_SAI(); }if (LL_RCC_PLLSAI_IsReady()) { ... } break; case LL_RCC_SAI2_CLKSOURCE_PLLSAI: case LL_RCC_SAI1_CLKSOURCE_PLLI2S: /* PLLI2S clock used as SAI1 clock source */ case LL_RCC_SAI2_CLKSOURCE_PLLI2S: /* PLLI2S clock used as SAI2 clock source */ if (LL_RCC_PLLI2S_IsReady()) { sai_frequency = RCC_PLLI2S_GetFreqDomain_SAI(); }if (LL_RCC_PLLI2S_IsReady()) { ... } break; case LL_RCC_SAI2_CLKSOURCE_PLLI2S: case LL_RCC_SAI1_CLKSOURCE_PLL: /* PLL clock used as SAI1 clock source */ case LL_RCC_SAI2_CLKSOURCE_PLL: /* PLL clock used as SAI2 clock source */ if (LL_RCC_PLL_IsReady()) { sai_frequency = RCC_PLL_GetFreqDomain_SAI(); }if (LL_RCC_PLL_IsReady()) { ... } break; case LL_RCC_SAI2_CLKSOURCE_PLL: case LL_RCC_SAI2_CLKSOURCE_PLLSRC: switch (LL_RCC_PLL_GetMainSource()) { case LL_RCC_PLLSOURCE_HSE: /* HSE clock used as SAI2 clock source */ if (LL_RCC_HSE_IsReady()) { sai_frequency = HSE_VALUE; }if (LL_RCC_HSE_IsReady()) { ... } break; case LL_RCC_PLLSOURCE_HSE: case LL_RCC_PLLSOURCE_HSI: /* HSI clock used as SAI2 clock source */ default: if (LL_RCC_HSI_IsReady()) { sai_frequency = HSI_VALUE; }if (LL_RCC_HSI_IsReady()) { ... } break;default }switch (LL_RCC_PLL_GetMainSource()) { ... } break; case LL_RCC_SAI2_CLKSOURCE_PLLSRC: case LL_RCC_SAI1_CLKSOURCE_PIN: /* External input clock used as SAI1 clock source */ default: sai_frequency = EXTERNAL_CLOCK_VALUE; break;default }switch (LL_RCC_GetSAIClockSource(SAIxSource)) { ... } }if ((SAIxSource == LL_RCC_SAI1_CLKSOURCE) || (SAIxSource == LL_RCC_SAI2_CLKSOURCE)) { ... } /* ... */#endif /* RCC_DCKCFGR_SAI1SRC */ #if defined(RCC_DCKCFGR_SAI1ASRC) if ((SAIxSource == LL_RCC_SAI1_A_CLKSOURCE) || (SAIxSource == LL_RCC_SAI1_B_CLKSOURCE)) { /* SAI1CLK clock frequency */ switch (LL_RCC_GetSAIClockSource(SAIxSource)) { #if defined(RCC_PLLSAI_SUPPORT) case LL_RCC_SAI1_A_CLKSOURCE_PLLSAI: /* PLLSAI clock used as SAI1 Block A clock source */ case LL_RCC_SAI1_B_CLKSOURCE_PLLSAI: /* PLLSAI clock used as SAI1 Block B clock source */ if (LL_RCC_PLLSAI_IsReady()) { sai_frequency = RCC_PLLSAI_GetFreqDomain_SAI(); }if (LL_RCC_PLLSAI_IsReady()) { ... } break;/* ... */ #endif /* RCC_PLLSAI_SUPPORT */ case LL_RCC_SAI1_A_CLKSOURCE_PLLI2S: /* PLLI2S clock used as SAI1 Block A clock source */ case LL_RCC_SAI1_B_CLKSOURCE_PLLI2S: /* PLLI2S clock used as SAI1 Block B clock source */ if (LL_RCC_PLLI2S_IsReady()) { sai_frequency = RCC_PLLI2S_GetFreqDomain_SAI(); }if (LL_RCC_PLLI2S_IsReady()) { ... } break; #if defined(RCC_SAI1A_PLLSOURCE_SUPPORT)case LL_RCC_SAI1_B_CLKSOURCE_PLLI2S: case LL_RCC_SAI1_A_CLKSOURCE_PLL: /* PLL clock used as SAI1 Block A clock source */ case LL_RCC_SAI1_B_CLKSOURCE_PLL: /* PLL clock used as SAI1 Block B clock source */ if (LL_RCC_PLL_IsReady()) { sai_frequency = RCC_PLL_GetFreqDomain_SAI(); }if (LL_RCC_PLL_IsReady()) { ... } break; case LL_RCC_SAI1_B_CLKSOURCE_PLL: case LL_RCC_SAI1_A_CLKSOURCE_PLLSRC: case LL_RCC_SAI1_B_CLKSOURCE_PLLSRC: switch (LL_RCC_PLL_GetMainSource()) { case LL_RCC_PLLSOURCE_HSE: /* HSE clock used as SAI1 Block A or B clock source */ if (LL_RCC_HSE_IsReady()) { sai_frequency = HSE_VALUE; }if (LL_RCC_HSE_IsReady()) { ... } break; case LL_RCC_PLLSOURCE_HSE: case LL_RCC_PLLSOURCE_HSI: /* HSI clock used as SAI1 Block A or B clock source */ default: if (LL_RCC_HSI_IsReady()) { sai_frequency = HSI_VALUE; }if (LL_RCC_HSI_IsReady()) { ... } break;default }switch (LL_RCC_PLL_GetMainSource()) { ... } break;/* ... */ #endif /* RCC_SAI1A_PLLSOURCE_SUPPORT */ case LL_RCC_SAI1_A_CLKSOURCE_PIN: /* External input clock used as SAI1 Block A clock source */ case LL_RCC_SAI1_B_CLKSOURCE_PIN: /* External input clock used as SAI1 Block B clock source */ default: sai_frequency = EXTERNAL_CLOCK_VALUE; break;default }switch (LL_RCC_GetSAIClockSource(SAIxSource)) { ... } }if ((SAIxSource == LL_RCC_SAI1_A_CLKSOURCE) || (SAIxSource == LL_RCC_SAI1_B_CLKSOURCE)) { ... } /* ... */#endif /* RCC_DCKCFGR_SAI1ASRC */ return sai_frequency; }LL_RCC_GetSAIClockFreq (uint32_t SAIxSource) { ... } /* ... */#endif /* SAI1 */ #if defined(SDIO) /** * @brief Return SDIOx clock frequency * @param SDIOxSource This parameter can be one of the following values: * @arg @ref LL_RCC_SDIO_CLKSOURCE * @retval SDIO clock frequency (in Hz) * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready *//* ... */ uint32_t LL_RCC_GetSDIOClockFreq(uint32_t SDIOxSource) { uint32_t SDIO_frequency = LL_RCC_PERIPH_FREQUENCY_NO; /* Check parameter */ assert_param(IS_LL_RCC_SDIO_CLKSOURCE(SDIOxSource)); if (SDIOxSource == LL_RCC_SDIO_CLKSOURCE) { #if defined(RCC_DCKCFGR_SDIOSEL) || defined(RCC_DCKCFGR2_SDIOSEL) /* SDIOCLK clock frequency */ switch (LL_RCC_GetSDIOClockSource(SDIOxSource)) { case LL_RCC_SDIO_CLKSOURCE_PLL48CLK: /* PLL48M clock used as SDIO clock source */ switch (LL_RCC_GetCK48MClockSource(LL_RCC_CK48M_CLKSOURCE)) { case LL_RCC_CK48M_CLKSOURCE_PLL: /* PLL clock used as 48Mhz domain clock */ if (LL_RCC_PLL_IsReady()) { SDIO_frequency = RCC_PLL_GetFreqDomain_48M(); }if (LL_RCC_PLL_IsReady()) { ... } break; #if defined(RCC_PLLSAI_SUPPORT)case LL_RCC_CK48M_CLKSOURCE_PLL: case LL_RCC_CK48M_CLKSOURCE_PLLSAI: /* PLLSAI clock used as 48Mhz domain clock */ default: if (LL_RCC_PLLSAI_IsReady()) { SDIO_frequency = RCC_PLLSAI_GetFreqDomain_48M(); }if (LL_RCC_PLLSAI_IsReady()) { ... } break;/* ... */ #endif /* RCC_PLLSAI_SUPPORT */ #if defined(RCC_PLLI2SCFGR_PLLI2SQ) && !defined(RCC_DCKCFGR_PLLI2SDIVQ) case LL_RCC_CK48M_CLKSOURCE_PLLI2S: /* PLLI2S clock used as 48Mhz domain clock */ default: if (LL_RCC_PLLI2S_IsReady()) { SDIO_frequency = RCC_PLLI2S_GetFreqDomain_48M(); }if (LL_RCC_PLLI2S_IsReady()) { ... } break;/* ... */ #endif /* RCC_PLLI2SCFGR_PLLI2SQ && !RCC_DCKCFGR_PLLI2SDIVQ */ }switch (LL_RCC_GetCK48MClockSource(LL_RCC_CK48M_CLKSOURCE)) { ... } break; case LL_RCC_SDIO_CLKSOURCE_PLL48CLK: case LL_RCC_SDIO_CLKSOURCE_SYSCLK: /* PLL clock used as SDIO clock source */ default: SDIO_frequency = RCC_GetSystemClockFreq(); break;default }switch (LL_RCC_GetSDIOClockSource(SDIOxSource)) { ... } /* ... */#else /* PLL clock used as 48Mhz domain clock */ if (LL_RCC_PLL_IsReady()) { SDIO_frequency = RCC_PLL_GetFreqDomain_48M(); }if (LL_RCC_PLL_IsReady()) { ... } /* ... */#endif /* RCC_DCKCFGR_SDIOSEL || RCC_DCKCFGR2_SDIOSEL */ }if (SDIOxSource == LL_RCC_SDIO_CLKSOURCE) { ... } return SDIO_frequency; }LL_RCC_GetSDIOClockFreq (uint32_t SDIOxSource) { ... } /* ... */#endif /* SDIO */ #if defined(RNG) /** * @brief Return RNGx clock frequency * @param RNGxSource This parameter can be one of the following values: * @arg @ref LL_RCC_RNG_CLKSOURCE * @retval RNG clock frequency (in Hz) * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready *//* ... */ uint32_t LL_RCC_GetRNGClockFreq(uint32_t RNGxSource) { uint32_t rng_frequency = LL_RCC_PERIPH_FREQUENCY_NO; /* Check parameter */ assert_param(IS_LL_RCC_RNG_CLKSOURCE(RNGxSource)); #if defined(RCC_DCKCFGR_CK48MSEL) || defined(RCC_DCKCFGR2_CK48MSEL) /* RNGCLK clock frequency */ switch (LL_RCC_GetRNGClockSource(RNGxSource)) { #if defined(RCC_PLLI2SCFGR_PLLI2SQ) && !defined(RCC_DCKCFGR_PLLI2SDIVQ) case LL_RCC_RNG_CLKSOURCE_PLLI2S: /* PLLI2S clock used as RNG clock source */ if (LL_RCC_PLLI2S_IsReady()) { rng_frequency = RCC_PLLI2S_GetFreqDomain_48M(); }if (LL_RCC_PLLI2S_IsReady()) { ... } break;/* ... */ #endif /* RCC_PLLI2SCFGR_PLLI2SQ && !RCC_DCKCFGR_PLLI2SDIVQ */ #if defined(RCC_PLLSAI_SUPPORT)case LL_RCC_RNG_CLKSOURCE_PLLI2S: case LL_RCC_RNG_CLKSOURCE_PLLSAI: /* PLLSAI clock used as RNG clock source */ if (LL_RCC_PLLSAI_IsReady()) { rng_frequency = RCC_PLLSAI_GetFreqDomain_48M(); }if (LL_RCC_PLLSAI_IsReady()) { ... } break;/* ... */ #endif /* RCC_PLLSAI_SUPPORT */ case LL_RCC_RNG_CLKSOURCE_PLLSAI: case LL_RCC_RNG_CLKSOURCE_PLL: /* PLL clock used as RNG clock source */ default: if (LL_RCC_PLL_IsReady()) { rng_frequency = RCC_PLL_GetFreqDomain_48M(); }if (LL_RCC_PLL_IsReady()) { ... } break;default }switch (LL_RCC_GetRNGClockSource(RNGxSource)) { ... } /* ... */#else /* PLL clock used as RNG clock source */ if (LL_RCC_PLL_IsReady()) { rng_frequency = RCC_PLL_GetFreqDomain_48M(); }if (LL_RCC_PLL_IsReady()) { ... } /* ... */#endif /* RCC_DCKCFGR_CK48MSEL || RCC_DCKCFGR2_CK48MSEL */ return rng_frequency; }{ ... } #endif/* ... */ /* RNG */ #if defined(CEC) /** * @brief Return CEC clock frequency * @param CECxSource This parameter can be one of the following values: * @arg @ref LL_RCC_CEC_CLKSOURCE * @retval CEC clock frequency (in Hz) * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (HSI or LSE) is not ready *//* ... */ uint32_t LL_RCC_GetCECClockFreq(uint32_t CECxSource) { uint32_t cec_frequency = LL_RCC_PERIPH_FREQUENCY_NO; /* Check parameter */ assert_param(IS_LL_RCC_CEC_CLKSOURCE(CECxSource)); /* CECCLK clock frequency */ switch (LL_RCC_GetCECClockSource(CECxSource)) { case LL_RCC_CEC_CLKSOURCE_LSE: /* CEC Clock is LSE Osc. */ if (LL_RCC_LSE_IsReady()) { cec_frequency = LSE_VALUE; }if (LL_RCC_LSE_IsReady()) { ... } break; case LL_RCC_CEC_CLKSOURCE_LSE: case LL_RCC_CEC_CLKSOURCE_HSI_DIV488: /* CEC Clock is HSI Osc. */ default: if (LL_RCC_HSI_IsReady()) { cec_frequency = HSI_VALUE/488U; }if (LL_RCC_HSI_IsReady()) { ... } break;default }switch (LL_RCC_GetCECClockSource(CECxSource)) { ... } return cec_frequency; }LL_RCC_GetCECClockFreq (uint32_t CECxSource) { ... } /* ... */#endif /* CEC */ #if defined(USB_OTG_FS) || defined(USB_OTG_HS) /** * @brief Return USBx clock frequency * @param USBxSource This parameter can be one of the following values: * @arg @ref LL_RCC_USB_CLKSOURCE * @retval USB clock frequency (in Hz) * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready *//* ... */ uint32_t LL_RCC_GetUSBClockFreq(uint32_t USBxSource) { uint32_t usb_frequency = LL_RCC_PERIPH_FREQUENCY_NO; /* Check parameter */ assert_param(IS_LL_RCC_USB_CLKSOURCE(USBxSource)); #if defined(RCC_DCKCFGR_CK48MSEL) || defined(RCC_DCKCFGR2_CK48MSEL) /* USBCLK clock frequency */ switch (LL_RCC_GetUSBClockSource(USBxSource)) { #if defined(RCC_PLLI2SCFGR_PLLI2SQ) && !defined(RCC_DCKCFGR_PLLI2SDIVQ) case LL_RCC_USB_CLKSOURCE_PLLI2S: /* PLLI2S clock used as USB clock source */ if (LL_RCC_PLLI2S_IsReady()) { usb_frequency = RCC_PLLI2S_GetFreqDomain_48M(); }if (LL_RCC_PLLI2S_IsReady()) { ... } break; /* ... */ #endif /* RCC_PLLI2SCFGR_PLLI2SQ && !RCC_DCKCFGR_PLLI2SDIVQ */ #if defined(RCC_PLLSAI_SUPPORT)case LL_RCC_USB_CLKSOURCE_PLLI2S: case LL_RCC_USB_CLKSOURCE_PLLSAI: /* PLLSAI clock used as USB clock source */ if (LL_RCC_PLLSAI_IsReady()) { usb_frequency = RCC_PLLSAI_GetFreqDomain_48M(); }if (LL_RCC_PLLSAI_IsReady()) { ... } break;/* ... */ #endif /* RCC_PLLSAI_SUPPORT */ case LL_RCC_USB_CLKSOURCE_PLLSAI: case LL_RCC_USB_CLKSOURCE_PLL: /* PLL clock used as USB clock source */ default: if (LL_RCC_PLL_IsReady()) { usb_frequency = RCC_PLL_GetFreqDomain_48M(); }if (LL_RCC_PLL_IsReady()) { ... } break;default }switch (LL_RCC_GetUSBClockSource(USBxSource)) { ... } /* ... */#else /* PLL clock used as USB clock source */ if (LL_RCC_PLL_IsReady()) { usb_frequency = RCC_PLL_GetFreqDomain_48M(); }if (LL_RCC_PLL_IsReady()) { ... } /* ... */#endif /* RCC_DCKCFGR_CK48MSEL || RCC_DCKCFGR2_CK48MSEL */ return usb_frequency; }LL_RCC_GetUSBClockFreq (uint32_t USBxSource) { ... } /* ... */#endif /* USB_OTG_FS || USB_OTG_HS */ #if defined(DFSDM1_Channel0) /** * @brief Return DFSDMx clock frequency * @param DFSDMxSource This parameter can be one of the following values: * @arg @ref LL_RCC_DFSDM1_CLKSOURCE * @arg @ref LL_RCC_DFSDM2_CLKSOURCE (*) * * (*) value not defined in all devices. * @retval DFSDM clock frequency (in Hz) *//* ... */ uint32_t LL_RCC_GetDFSDMClockFreq(uint32_t DFSDMxSource) { uint32_t dfsdm_frequency = LL_RCC_PERIPH_FREQUENCY_NO; /* Check parameter */ assert_param(IS_LL_RCC_DFSDM_CLKSOURCE(DFSDMxSource)); if (DFSDMxSource == LL_RCC_DFSDM1_CLKSOURCE) { /* DFSDM1CLK clock frequency */ switch (LL_RCC_GetDFSDMClockSource(DFSDMxSource)) { case LL_RCC_DFSDM1_CLKSOURCE_SYSCLK: /* DFSDM1 Clock is SYSCLK */ dfsdm_frequency = RCC_GetSystemClockFreq(); break; case LL_RCC_DFSDM1_CLKSOURCE_SYSCLK: case LL_RCC_DFSDM1_CLKSOURCE_PCLK2: /* DFSDM1 Clock is PCLK2 */ default: dfsdm_frequency = RCC_GetPCLK2ClockFreq(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq())); break;default }switch (LL_RCC_GetDFSDMClockSource(DFSDMxSource)) { ... } }if (DFSDMxSource == LL_RCC_DFSDM1_CLKSOURCE) { ... } #if defined(DFSDM2_Channel0) else { /* DFSDM2CLK clock frequency */ switch (LL_RCC_GetDFSDMClockSource(DFSDMxSource)) { case LL_RCC_DFSDM2_CLKSOURCE_SYSCLK: /* DFSDM2 Clock is SYSCLK */ dfsdm_frequency = RCC_GetSystemClockFreq(); break; case LL_RCC_DFSDM2_CLKSOURCE_SYSCLK: case LL_RCC_DFSDM2_CLKSOURCE_PCLK2: /* DFSDM2 Clock is PCLK2 */ default: dfsdm_frequency = RCC_GetPCLK2ClockFreq(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq())); break;default }switch (LL_RCC_GetDFSDMClockSource(DFSDMxSource)) { ... } }else { ... } /* ... */#endif /* DFSDM2_Channel0 */ return dfsdm_frequency; }LL_RCC_GetDFSDMClockFreq (uint32_t DFSDMxSource) { ... } /** * @brief Return DFSDMx Audio clock frequency * @param DFSDMxSource This parameter can be one of the following values: * @arg @ref LL_RCC_DFSDM1_AUDIO_CLKSOURCE * @arg @ref LL_RCC_DFSDM2_AUDIO_CLKSOURCE (*) * * (*) value not defined in all devices. * @retval DFSDM clock frequency (in Hz) * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready *//* ... */ uint32_t LL_RCC_GetDFSDMAudioClockFreq(uint32_t DFSDMxSource) { uint32_t dfsdm_frequency = LL_RCC_PERIPH_FREQUENCY_NO; /* Check parameter */ assert_param(IS_LL_RCC_DFSDM_AUDIO_CLKSOURCE(DFSDMxSource)); if (DFSDMxSource == LL_RCC_DFSDM1_AUDIO_CLKSOURCE) { /* DFSDM1CLK clock frequency */ switch (LL_RCC_GetDFSDMAudioClockSource(DFSDMxSource)) { case LL_RCC_DFSDM1_AUDIO_CLKSOURCE_I2S1: /* I2S1 clock used as DFSDM1 clock */ dfsdm_frequency = LL_RCC_GetI2SClockFreq(LL_RCC_I2S1_CLKSOURCE); break; case LL_RCC_DFSDM1_AUDIO_CLKSOURCE_I2S1: case LL_RCC_DFSDM1_AUDIO_CLKSOURCE_I2S2: /* I2S2 clock used as DFSDM1 clock */ default: dfsdm_frequency = LL_RCC_GetI2SClockFreq(LL_RCC_I2S2_CLKSOURCE); break;default }switch (LL_RCC_GetDFSDMAudioClockSource(DFSDMxSource)) { ... } }if (DFSDMxSource == LL_RCC_DFSDM1_AUDIO_CLKSOURCE) { ... } #if defined(DFSDM2_Channel0) else { /* DFSDM2CLK clock frequency */ switch (LL_RCC_GetDFSDMAudioClockSource(DFSDMxSource)) { case LL_RCC_DFSDM2_AUDIO_CLKSOURCE_I2S1: /* I2S1 clock used as DFSDM2 clock */ dfsdm_frequency = LL_RCC_GetI2SClockFreq(LL_RCC_I2S1_CLKSOURCE); break; case LL_RCC_DFSDM2_AUDIO_CLKSOURCE_I2S1: case LL_RCC_DFSDM2_AUDIO_CLKSOURCE_I2S2: /* I2S2 clock used as DFSDM2 clock */ default: dfsdm_frequency = LL_RCC_GetI2SClockFreq(LL_RCC_I2S2_CLKSOURCE); break;default }switch (LL_RCC_GetDFSDMAudioClockSource(DFSDMxSource)) { ... } }else { ... } /* ... */#endif /* DFSDM2_Channel0 */ return dfsdm_frequency; }LL_RCC_GetDFSDMAudioClockFreq (uint32_t DFSDMxSource) { ... } /* ... */#endif /* DFSDM1_Channel0 */ #if defined(DSI) /** * @brief Return DSI clock frequency * @param DSIxSource This parameter can be one of the following values: * @arg @ref LL_RCC_DSI_CLKSOURCE * @retval DSI clock frequency (in Hz) * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready * - @ref LL_RCC_PERIPH_FREQUENCY_NA indicates that external clock is used *//* ... */ uint32_t LL_RCC_GetDSIClockFreq(uint32_t DSIxSource) { uint32_t dsi_frequency = LL_RCC_PERIPH_FREQUENCY_NO; /* Check parameter */ assert_param(IS_LL_RCC_DSI_CLKSOURCE(DSIxSource)); /* DSICLK clock frequency */ switch (LL_RCC_GetDSIClockSource(DSIxSource)) { case LL_RCC_DSI_CLKSOURCE_PLL: /* DSI Clock is PLL Osc. */ if (LL_RCC_PLL_IsReady()) { dsi_frequency = RCC_PLL_GetFreqDomain_DSI(); }if (LL_RCC_PLL_IsReady()) { ... } break; case LL_RCC_DSI_CLKSOURCE_PLL: case LL_RCC_DSI_CLKSOURCE_PHY: /* DSI Clock is DSI physical clock. */ default: dsi_frequency = LL_RCC_PERIPH_FREQUENCY_NA; break;default }switch (LL_RCC_GetDSIClockSource(DSIxSource)) { ... } return dsi_frequency; }LL_RCC_GetDSIClockFreq (uint32_t DSIxSource) { ... } /* ... */#endif /* DSI */ #if defined(LTDC) /** * @brief Return LTDC clock frequency * @param LTDCxSource This parameter can be one of the following values: * @arg @ref LL_RCC_LTDC_CLKSOURCE * @retval LTDC clock frequency (in Hz) * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator PLLSAI is not ready *//* ... */ uint32_t LL_RCC_GetLTDCClockFreq(uint32_t LTDCxSource) { uint32_t ltdc_frequency = LL_RCC_PERIPH_FREQUENCY_NO; /* Check parameter */ assert_param(IS_LL_RCC_LTDC_CLKSOURCE(LTDCxSource)); if (LL_RCC_PLLSAI_IsReady()) { ltdc_frequency = RCC_PLLSAI_GetFreqDomain_LTDC(); }if (LL_RCC_PLLSAI_IsReady()) { ... } return ltdc_frequency; }LL_RCC_GetLTDCClockFreq (uint32_t LTDCxSource) { ... } /* ... */#endif /* LTDC */ #if defined(SPDIFRX) /** * @brief Return SPDIFRX clock frequency * @param SPDIFRXxSource This parameter can be one of the following values: * @arg @ref LL_RCC_SPDIFRX1_CLKSOURCE * @retval SPDIFRX clock frequency (in Hz) * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator is not ready *//* ... */ uint32_t LL_RCC_GetSPDIFRXClockFreq(uint32_t SPDIFRXxSource) { uint32_t spdifrx_frequency = LL_RCC_PERIPH_FREQUENCY_NO; /* Check parameter */ assert_param(IS_LL_RCC_SPDIFRX_CLKSOURCE(SPDIFRXxSource)); /* SPDIFRX1CLK clock frequency */ switch (LL_RCC_GetSPDIFRXClockSource(SPDIFRXxSource)) { case LL_RCC_SPDIFRX1_CLKSOURCE_PLLI2S: /* SPDIFRX Clock is PLLI2S Osc. */ if (LL_RCC_PLLI2S_IsReady()) { spdifrx_frequency = RCC_PLLI2S_GetFreqDomain_SPDIFRX(); }if (LL_RCC_PLLI2S_IsReady()) { ... } break; case LL_RCC_SPDIFRX1_CLKSOURCE_PLLI2S: case LL_RCC_SPDIFRX1_CLKSOURCE_PLL: /* SPDIFRX Clock is PLL Osc. */ default: if (LL_RCC_PLL_IsReady()) { spdifrx_frequency = RCC_PLL_GetFreqDomain_SPDIFRX(); }if (LL_RCC_PLL_IsReady()) { ... } break;default }switch (LL_RCC_GetSPDIFRXClockSource(SPDIFRXxSource)) { ... } return spdifrx_frequency; }LL_RCC_GetSPDIFRXClockFreq (uint32_t SPDIFRXxSource) { ... } /* ... */#endif /* SPDIFRX */ /** * @} *//* ... */ /** * @} *//* ... */ /** @addtogroup RCC_LL_Private_Functions * @{ *//* ... */ /** * @brief Return SYSTEM clock frequency * @retval SYSTEM clock frequency (in Hz) *//* ... */ uint32_t RCC_GetSystemClockFreq(void) { uint32_t frequency = 0U; /* Get SYSCLK source -------------------------------------------------------*/ switch (LL_RCC_GetSysClkSource()) { case LL_RCC_SYS_CLKSOURCE_STATUS_HSI: /* HSI used as system clock source */ frequency = HSI_VALUE; break; case LL_RCC_SYS_CLKSOURCE_STATUS_HSI: case LL_RCC_SYS_CLKSOURCE_STATUS_HSE: /* HSE used as system clock source */ frequency = HSE_VALUE; break; case LL_RCC_SYS_CLKSOURCE_STATUS_HSE: case LL_RCC_SYS_CLKSOURCE_STATUS_PLL: /* PLL used as system clock source */ frequency = RCC_PLL_GetFreqDomain_SYS(LL_RCC_SYS_CLKSOURCE_STATUS_PLL); break; #if defined(RCC_PLLR_SYSCLK_SUPPORT)case LL_RCC_SYS_CLKSOURCE_STATUS_PLL: case LL_RCC_SYS_CLKSOURCE_STATUS_PLLR: /* PLLR used as system clock source */ frequency = RCC_PLL_GetFreqDomain_SYS(LL_RCC_SYS_CLKSOURCE_STATUS_PLLR); break;/* ... */ #endif /* RCC_PLLR_SYSCLK_SUPPORT */ case LL_RCC_SYS_CLKSOURCE_STATUS_PLLR: default: frequency = HSI_VALUE; break;default }switch (LL_RCC_GetSysClkSource()) { ... } return frequency; }{ ... } /** * @brief Return HCLK clock frequency * @param SYSCLK_Frequency SYSCLK clock frequency * @retval HCLK clock frequency (in Hz) *//* ... */ uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency) { /* HCLK clock frequency */ return __LL_RCC_CALC_HCLK_FREQ(SYSCLK_Frequency, LL_RCC_GetAHBPrescaler()); }{ ... } /** * @brief Return PCLK1 clock frequency * @param HCLK_Frequency HCLK clock frequency * @retval PCLK1 clock frequency (in Hz) *//* ... */ uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency) { /* PCLK1 clock frequency */ return __LL_RCC_CALC_PCLK1_FREQ(HCLK_Frequency, LL_RCC_GetAPB1Prescaler()); }{ ... } /** * @brief Return PCLK2 clock frequency * @param HCLK_Frequency HCLK clock frequency * @retval PCLK2 clock frequency (in Hz) *//* ... */ uint32_t RCC_GetPCLK2ClockFreq(uint32_t HCLK_Frequency) { /* PCLK2 clock frequency */ return __LL_RCC_CALC_PCLK2_FREQ(HCLK_Frequency, LL_RCC_GetAPB2Prescaler()); }{ ... } /** * @brief Return PLL clock frequency used for system domain * @param SYSCLK_Source System clock source * @retval PLL clock frequency (in Hz) *//* ... */ uint32_t RCC_PLL_GetFreqDomain_SYS(uint32_t SYSCLK_Source) { uint32_t pllinputfreq = 0U, pllsource = 0U, plloutputfreq = 0U; /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM) * PLLN SYSCLK = PLL_VCO / (PLLP or PLLR) *//* ... */ pllsource = LL_RCC_PLL_GetMainSource(); switch (pllsource) { case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLL clock source */ pllinputfreq = HSI_VALUE; break; case LL_RCC_PLLSOURCE_HSI: case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLL clock source */ pllinputfreq = HSE_VALUE; break; case LL_RCC_PLLSOURCE_HSE: default: pllinputfreq = HSI_VALUE; break;default }switch (pllsource) { ... } if (SYSCLK_Source == LL_RCC_SYS_CLKSOURCE_STATUS_PLL) { plloutputfreq = __LL_RCC_CALC_PLLCLK_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), LL_RCC_PLL_GetN(), LL_RCC_PLL_GetP()); }if (SYSCLK_Source == LL_RCC_SYS_CLKSOURCE_STATUS_PLL) { ... } #if defined(RCC_PLLR_SYSCLK_SUPPORT) else { plloutputfreq = __LL_RCC_CALC_PLLRCLK_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), LL_RCC_PLL_GetN(), LL_RCC_PLL_GetR()); }else { ... } /* ... */#endif /* RCC_PLLR_SYSCLK_SUPPORT */ return plloutputfreq; }{ ... } /** * @brief Return PLL clock frequency used for 48 MHz domain * @retval PLL clock frequency (in Hz) *//* ... */ uint32_t RCC_PLL_GetFreqDomain_48M(void) { uint32_t pllinputfreq = 0U, pllsource = 0U; /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM ) * PLLN 48M Domain clock = PLL_VCO / PLLQ *//* ... */ pllsource = LL_RCC_PLL_GetMainSource(); switch (pllsource) { case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLL clock source */ pllinputfreq = HSI_VALUE; break; case LL_RCC_PLLSOURCE_HSI: case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLL clock source */ pllinputfreq = HSE_VALUE; break; case LL_RCC_PLLSOURCE_HSE: default: pllinputfreq = HSI_VALUE; break;default }switch (pllsource) { ... } return __LL_RCC_CALC_PLLCLK_48M_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), LL_RCC_PLL_GetN(), LL_RCC_PLL_GetQ()); }{ ... } #if defined(DSI) /** * @brief Return PLL clock frequency used for DSI clock * @retval PLL clock frequency (in Hz) *//* ... */ uint32_t RCC_PLL_GetFreqDomain_DSI(void) { uint32_t pllinputfreq = 0U, pllsource = 0U; /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM) * PLLN DSICLK = PLL_VCO / PLLR *//* ... */ pllsource = LL_RCC_PLL_GetMainSource(); switch (pllsource) { case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLL clock source */ pllinputfreq = HSE_VALUE; break; case LL_RCC_PLLSOURCE_HSE: case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLL clock source */ default: pllinputfreq = HSI_VALUE; break;default }switch (pllsource) { ... } return __LL_RCC_CALC_PLLCLK_DSI_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), LL_RCC_PLL_GetN(), LL_RCC_PLL_GetR()); }RCC_PLL_GetFreqDomain_DSI (void) { ... } /* ... */#endif /* DSI */ #if defined(RCC_DCKCFGR_I2SSRC) || defined(RCC_DCKCFGR_I2S1SRC) /** * @brief Return PLL clock frequency used for I2S clock * @retval PLL clock frequency (in Hz) *//* ... */ uint32_t RCC_PLL_GetFreqDomain_I2S(void) { uint32_t pllinputfreq = 0U, pllsource = 0U; /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM) * PLLN I2SCLK = PLL_VCO / PLLR *//* ... */ pllsource = LL_RCC_PLL_GetMainSource(); switch (pllsource) { case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLL clock source */ pllinputfreq = HSE_VALUE; break; case LL_RCC_PLLSOURCE_HSE: case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLL clock source */ default: pllinputfreq = HSI_VALUE; break;default }switch (pllsource) { ... } return __LL_RCC_CALC_PLLCLK_I2S_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), LL_RCC_PLL_GetN(), LL_RCC_PLL_GetR()); }{ ... } #endif/* ... */ /* RCC_DCKCFGR_I2SSRC || RCC_DCKCFGR_I2S1SRC */ #if defined(SPDIFRX) /** * @brief Return PLL clock frequency used for SPDIFRX clock * @retval PLL clock frequency (in Hz) *//* ... */ uint32_t RCC_PLL_GetFreqDomain_SPDIFRX(void) { uint32_t pllinputfreq = 0U, pllsource = 0U; /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM) * PLLN SPDIFRXCLK = PLL_VCO / PLLR *//* ... */ pllsource = LL_RCC_PLL_GetMainSource(); switch (pllsource) { case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLL clock source */ pllinputfreq = HSE_VALUE; break; case LL_RCC_PLLSOURCE_HSE: case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLL clock source */ default: pllinputfreq = HSI_VALUE; break;default }switch (pllsource) { ... } return __LL_RCC_CALC_PLLCLK_SPDIFRX_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), LL_RCC_PLL_GetN(), LL_RCC_PLL_GetR()); }RCC_PLL_GetFreqDomain_SPDIFRX (void) { ... } /* ... */#endif /* SPDIFRX */ #if defined(RCC_PLLCFGR_PLLR) #if defined(SAI1) /** * @brief Return PLL clock frequency used for SAI clock * @retval PLL clock frequency (in Hz) *//* ... */ uint32_t RCC_PLL_GetFreqDomain_SAI(void) { uint32_t pllinputfreq = 0U, pllsource = 0U, plloutputfreq = 0U; /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM) * PLLN SAICLK = (PLL_VCO / PLLR) / PLLDIVR or SAICLK = PLL_VCO / PLLR *//* ... */ pllsource = LL_RCC_PLL_GetMainSource(); switch (pllsource) { case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLL clock source */ pllinputfreq = HSE_VALUE; break; case LL_RCC_PLLSOURCE_HSE: case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLL clock source */ default: pllinputfreq = HSI_VALUE; break;default }switch (pllsource) { ... } #if defined(RCC_DCKCFGR_PLLDIVR) plloutputfreq = __LL_RCC_CALC_PLLCLK_SAI_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), LL_RCC_PLL_GetN(), LL_RCC_PLL_GetR(), LL_RCC_PLL_GetDIVR());/* ... */ #else plloutputfreq = __LL_RCC_CALC_PLLCLK_SAI_FREQ(pllinputfreq, LL_RCC_PLL_GetDivider(), LL_RCC_PLL_GetN(), LL_RCC_PLL_GetR());/* ... */ #endif /* RCC_DCKCFGR_PLLDIVR */ return plloutputfreq; }RCC_PLL_GetFreqDomain_SAI (void) { ... } /* ... */#endif /* SAI1 *//* ... */ #endif /* RCC_PLLCFGR_PLLR */ #if defined(RCC_PLLSAI_SUPPORT) /** * @brief Return PLLSAI clock frequency used for SAI domain * @retval PLLSAI clock frequency (in Hz) *//* ... */ uint32_t RCC_PLLSAI_GetFreqDomain_SAI(void) { uint32_t pllinputfreq = 0U, pllsource = 0U; /* PLLSAI_VCO = (HSE_VALUE or HSI_VALUE / PLLSAIM) * PLLSAIN SAI domain clock = (PLLSAI_VCO / PLLSAIQ) / PLLSAIDIVQ *//* ... */ pllsource = LL_RCC_PLL_GetMainSource(); switch (pllsource) { case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLLSAI clock source */ pllinputfreq = HSI_VALUE; break; case LL_RCC_PLLSOURCE_HSI: case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLLSAI clock source */ pllinputfreq = HSE_VALUE; break; case LL_RCC_PLLSOURCE_HSE: default: pllinputfreq = HSI_VALUE; break;default }switch (pllsource) { ... } return __LL_RCC_CALC_PLLSAI_SAI_FREQ(pllinputfreq, LL_RCC_PLLSAI_GetDivider(), LL_RCC_PLLSAI_GetN(), LL_RCC_PLLSAI_GetQ(), LL_RCC_PLLSAI_GetDIVQ()); }RCC_PLLSAI_GetFreqDomain_SAI (void) { ... } #if defined(RCC_PLLSAICFGR_PLLSAIP) /** * @brief Return PLLSAI clock frequency used for 48Mhz domain * @retval PLLSAI clock frequency (in Hz) *//* ... */ uint32_t RCC_PLLSAI_GetFreqDomain_48M(void) { uint32_t pllinputfreq = 0U, pllsource = 0U; /* PLLSAI_VCO = (HSE_VALUE or HSI_VALUE / PLLSAIM) * PLLSAIN 48M Domain clock = PLLSAI_VCO / PLLSAIP *//* ... */ pllsource = LL_RCC_PLL_GetMainSource(); switch (pllsource) { case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLLSAI clock source */ pllinputfreq = HSI_VALUE; break; case LL_RCC_PLLSOURCE_HSI: case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLLSAI clock source */ pllinputfreq = HSE_VALUE; break; case LL_RCC_PLLSOURCE_HSE: default: pllinputfreq = HSI_VALUE; break;default }switch (pllsource) { ... } return __LL_RCC_CALC_PLLSAI_48M_FREQ(pllinputfreq, LL_RCC_PLLSAI_GetDivider(), LL_RCC_PLLSAI_GetN(), LL_RCC_PLLSAI_GetP()); }RCC_PLLSAI_GetFreqDomain_48M (void) { ... } /* ... */#endif /* RCC_PLLSAICFGR_PLLSAIP */ #if defined(LTDC) /** * @brief Return PLLSAI clock frequency used for LTDC domain * @retval PLLSAI clock frequency (in Hz) *//* ... */ uint32_t RCC_PLLSAI_GetFreqDomain_LTDC(void) { uint32_t pllinputfreq = 0U, pllsource = 0U; /* PLLSAI_VCO = (HSE_VALUE or HSI_VALUE / PLLSAIM) * PLLSAIN LTDC Domain clock = (PLLSAI_VCO / PLLSAIR) / PLLSAIDIVR *//* ... */ pllsource = LL_RCC_PLL_GetMainSource(); switch (pllsource) { case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLLSAI clock source */ pllinputfreq = HSI_VALUE; break; case LL_RCC_PLLSOURCE_HSI: case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLLSAI clock source */ pllinputfreq = HSE_VALUE; break; case LL_RCC_PLLSOURCE_HSE: default: pllinputfreq = HSI_VALUE; break;default }switch (pllsource) { ... } return __LL_RCC_CALC_PLLSAI_LTDC_FREQ(pllinputfreq, LL_RCC_PLLSAI_GetDivider(), LL_RCC_PLLSAI_GetN(), LL_RCC_PLLSAI_GetR(), LL_RCC_PLLSAI_GetDIVR()); }RCC_PLLSAI_GetFreqDomain_LTDC (void) { ... } /* ... */#endif /* LTDC *//* ... */ #endif /* RCC_PLLSAI_SUPPORT */ #if defined(RCC_PLLI2S_SUPPORT) #if defined(SAI1) /** * @brief Return PLLI2S clock frequency used for SAI domains * @retval PLLI2S clock frequency (in Hz) *//* ... */ uint32_t RCC_PLLI2S_GetFreqDomain_SAI(void) { uint32_t plli2sinputfreq = 0U, plli2ssource = 0U, plli2soutputfreq = 0U; /* PLLI2S_VCO = (HSE_VALUE or HSI_VALUE / PLLI2SM) * PLLI2SN SAI domain clock = (PLLI2S_VCO / PLLI2SQ) / PLLI2SDIVQ or SAI domain clock = (PLLI2S_VCO / PLLI2SR) / PLLI2SDIVR *//* ... */ plli2ssource = LL_RCC_PLLI2S_GetMainSource(); switch (plli2ssource) { case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLLI2S clock source */ plli2sinputfreq = HSE_VALUE; break; #if defined(RCC_PLLI2SCFGR_PLLI2SSRC)case LL_RCC_PLLSOURCE_HSE: case LL_RCC_PLLI2SSOURCE_PIN: /* External pin input clock used as PLLI2S clock source */ plli2sinputfreq = EXTERNAL_CLOCK_VALUE; break;/* ... */ #endif /* RCC_PLLI2SCFGR_PLLI2SSRC */ case LL_RCC_PLLI2SSOURCE_PIN: case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLLI2S clock source */ default: plli2sinputfreq = HSI_VALUE; break;default }switch (plli2ssource) { ... } #if defined(RCC_DCKCFGR_PLLI2SDIVQ) plli2soutputfreq = __LL_RCC_CALC_PLLI2S_SAI_FREQ(plli2sinputfreq, LL_RCC_PLLI2S_GetDivider(), LL_RCC_PLLI2S_GetN(), LL_RCC_PLLI2S_GetQ(), LL_RCC_PLLI2S_GetDIVQ());/* ... */ #else plli2soutputfreq = __LL_RCC_CALC_PLLI2S_SAI_FREQ(plli2sinputfreq, LL_RCC_PLLI2S_GetDivider(), LL_RCC_PLLI2S_GetN(), LL_RCC_PLLI2S_GetR(), LL_RCC_PLLI2S_GetDIVR());/* ... */ #endif /* RCC_DCKCFGR_PLLI2SDIVQ */ return plli2soutputfreq; }RCC_PLLI2S_GetFreqDomain_SAI (void) { ... } /* ... */#endif /* SAI1 */ #if defined(SPDIFRX) /** * @brief Return PLLI2S clock frequency used for SPDIFRX domain * @retval PLLI2S clock frequency (in Hz) *//* ... */ uint32_t RCC_PLLI2S_GetFreqDomain_SPDIFRX(void) { uint32_t pllinputfreq = 0U, pllsource = 0U; /* PLLI2S_VCO = (HSE_VALUE or HSI_VALUE / PLLI2SM) * PLLI2SN SPDIFRX Domain clock = PLLI2S_VCO / PLLI2SP *//* ... */ pllsource = LL_RCC_PLLI2S_GetMainSource(); switch (pllsource) { case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLLI2S clock source */ pllinputfreq = HSE_VALUE; break; case LL_RCC_PLLSOURCE_HSE: case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLLI2S clock source */ default: pllinputfreq = HSI_VALUE; break;default }switch (pllsource) { ... } return __LL_RCC_CALC_PLLI2S_SPDIFRX_FREQ(pllinputfreq, LL_RCC_PLLI2S_GetDivider(), LL_RCC_PLLI2S_GetN(), LL_RCC_PLLI2S_GetP()); }RCC_PLLI2S_GetFreqDomain_SPDIFRX (void) { ... } /* ... */#endif /* SPDIFRX */ /** * @brief Return PLLI2S clock frequency used for I2S domain * @retval PLLI2S clock frequency (in Hz) *//* ... */ uint32_t RCC_PLLI2S_GetFreqDomain_I2S(void) { uint32_t plli2sinputfreq = 0U, plli2ssource = 0U, plli2soutputfreq = 0U; /* PLLI2S_VCO = (HSE_VALUE or HSI_VALUE / PLLI2SM) * PLLI2SN I2S Domain clock = PLLI2S_VCO / PLLI2SR *//* ... */ plli2ssource = LL_RCC_PLLI2S_GetMainSource(); switch (plli2ssource) { case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLLI2S clock source */ plli2sinputfreq = HSE_VALUE; break; #if defined(RCC_PLLI2SCFGR_PLLI2SSRC)case LL_RCC_PLLSOURCE_HSE: case LL_RCC_PLLI2SSOURCE_PIN: /* External pin input clock used as PLLI2S clock source */ plli2sinputfreq = EXTERNAL_CLOCK_VALUE; break;/* ... */ #endif /* RCC_PLLI2SCFGR_PLLI2SSRC */ case LL_RCC_PLLI2SSOURCE_PIN: case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLLI2S clock source */ default: plli2sinputfreq = HSI_VALUE; break;default }switch (plli2ssource) { ... } plli2soutputfreq = __LL_RCC_CALC_PLLI2S_I2S_FREQ(plli2sinputfreq, LL_RCC_PLLI2S_GetDivider(), LL_RCC_PLLI2S_GetN(), LL_RCC_PLLI2S_GetR()); return plli2soutputfreq; }RCC_PLLI2S_GetFreqDomain_I2S (void) { ... } #if defined(RCC_PLLI2SCFGR_PLLI2SQ) && !defined(RCC_DCKCFGR_PLLI2SDIVQ) /** * @brief Return PLLI2S clock frequency used for 48Mhz domain * @retval PLLI2S clock frequency (in Hz) *//* ... */ uint32_t RCC_PLLI2S_GetFreqDomain_48M(void) { uint32_t plli2sinputfreq = 0U, plli2ssource = 0U, plli2soutputfreq = 0U; /* PLL48M_VCO = (HSE_VALUE or HSI_VALUE / PLLI2SM) * PLLI2SN 48M Domain clock = PLLI2S_VCO / PLLI2SQ *//* ... */ plli2ssource = LL_RCC_PLLI2S_GetMainSource(); switch (plli2ssource) { case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLLI2S clock source */ plli2sinputfreq = HSE_VALUE; break; #if defined(RCC_PLLI2SCFGR_PLLI2SSRC)case LL_RCC_PLLSOURCE_HSE: case LL_RCC_PLLI2SSOURCE_PIN: /* External pin input clock used as PLLI2S clock source */ plli2sinputfreq = EXTERNAL_CLOCK_VALUE; break;/* ... */ #endif /* RCC_PLLI2SCFGR_PLLI2SSRC */ case LL_RCC_PLLI2SSOURCE_PIN: case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLLI2S clock source */ default: plli2sinputfreq = HSI_VALUE; break;default }switch (plli2ssource) { ... } plli2soutputfreq = __LL_RCC_CALC_PLLI2S_48M_FREQ(plli2sinputfreq, LL_RCC_PLLI2S_GetDivider(), LL_RCC_PLLI2S_GetN(), LL_RCC_PLLI2S_GetQ()); return plli2soutputfreq; }RCC_PLLI2S_GetFreqDomain_48M (void) { ... } /* ... */#endif /* RCC_PLLI2SCFGR_PLLI2SQ && !RCC_DCKCFGR_PLLI2SDIVQ *//* ... */ #endif /* RCC_PLLI2S_SUPPORT */ /** * @} *//* ... */ /** * @} *//* ... */ /* ... */ #endif /* defined(RCC) */ /** * @} *//* ... */ /* ... */ #endif /* USE_FULL_LL_DRIVER */
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.