47
47
/* Private typedef -----------------------------------------------------------*/
48
48
/* Private define ------------------------------------------------------------*/
49
49
/**
50
- * @brief STM32H7xx HAL Driver version number V1.6 .0
50
+ * @brief STM32H7xx HAL Driver version number V1.8 .0
51
51
*/
52
52
#define __STM32H7xx_HAL_VERSION_MAIN (0x01UL) /*!< [31:24] main version */
53
- #define __STM32H7xx_HAL_VERSION_SUB1 (0x06UL ) /*!< [23:16] sub1 version */
53
+ #define __STM32H7xx_HAL_VERSION_SUB1 (0x08UL ) /*!< [23:16] sub1 version */
54
54
#define __STM32H7xx_HAL_VERSION_SUB2 (0x00UL) /*!< [15:8] sub2 version */
55
55
#define __STM32H7xx_HAL_VERSION_RC (0x00UL) /*!< [7:0] release candidate */
56
56
#define __STM32H7xx_HAL_VERSION ((__STM32H7xx_HAL_VERSION_MAIN << 24)\
@@ -134,6 +134,8 @@ HAL_TickFreqTypeDef uwTickFreq = HAL_TICK_FREQ_DEFAULT; /* 1KHz */
134
134
HAL_StatusTypeDef HAL_Init (void )
135
135
{
136
136
137
+ uint32_t common_system_clock ;
138
+
137
139
#if defined(DUAL_CORE ) && defined(CORE_CM4 )
138
140
/* Configure Cortex-M4 Instruction cache through ART accelerator */
139
141
__HAL_RCC_ART_CLK_ENABLE (); /* Enable the Cortex-M4 ART Clock */
@@ -145,10 +147,24 @@ HAL_StatusTypeDef HAL_Init(void)
145
147
HAL_NVIC_SetPriorityGrouping (NVIC_PRIORITYGROUP_4 );
146
148
147
149
/* Update the SystemCoreClock global variable */
148
- SystemD1Clock = HAL_RCC_GetSysClockFreq () >> ((D1CorePrescTable [(RCC -> D1CFGR & RCC_D1CFGR_D1CPRE )>> RCC_D1CFGR_D1CPRE_Pos ]) & 0x1FU );
150
+ #if defined(RCC_D1CFGR_D1CPRE )
151
+ common_system_clock = HAL_RCC_GetSysClockFreq () >> ((D1CorePrescTable [(RCC -> D1CFGR & RCC_D1CFGR_D1CPRE )>> RCC_D1CFGR_D1CPRE_Pos ]) & 0x1FU );
152
+ #else
153
+ common_system_clock = HAL_RCC_GetSysClockFreq () >> ((D1CorePrescTable [(RCC -> CDCFGR1 & RCC_CDCFGR1_CDCPRE )>> RCC_CDCFGR1_CDCPRE_Pos ]) & 0x1FU );
154
+ #endif
149
155
150
156
/* Update the SystemD2Clock global variable */
151
- SystemD2Clock = (SystemD1Clock >> ((D1CorePrescTable [(RCC -> D1CFGR & RCC_D1CFGR_HPRE )>> RCC_D1CFGR_HPRE_Pos ]) & 0x1FU ));
157
+ #if defined(RCC_D1CFGR_HPRE )
158
+ SystemD2Clock = (common_system_clock >> ((D1CorePrescTable [(RCC -> D1CFGR & RCC_D1CFGR_HPRE )>> RCC_D1CFGR_HPRE_Pos ]) & 0x1FU ));
159
+ #else
160
+ SystemD2Clock = (common_system_clock >> ((D1CorePrescTable [(RCC -> CDCFGR1 & RCC_CDCFGR1_HPRE )>> RCC_CDCFGR1_HPRE_Pos ]) & 0x1FU ));
161
+ #endif
162
+
163
+ #if defined(DUAL_CORE ) && defined(CORE_CM4 )
164
+ SystemCoreClock = SystemD2Clock ;
165
+ #else
166
+ SystemCoreClock = common_system_clock ;
167
+ #endif /* DUAL_CORE && CORE_CM4 */
152
168
153
169
/* Use systick as time base source and configure 1ms tick (default clock after Reset is HSI) */
154
170
if (HAL_InitTick (TICK_INT_PRIORITY ) != HAL_OK )
@@ -340,14 +356,26 @@ uint32_t HAL_GetTickPrio(void)
340
356
HAL_StatusTypeDef HAL_SetTickFreq (HAL_TickFreqTypeDef Freq )
341
357
{
342
358
HAL_StatusTypeDef status = HAL_OK ;
359
+ HAL_TickFreqTypeDef prevTickFreq ;
360
+
343
361
assert_param (IS_TICKFREQ (Freq ));
344
362
345
363
if (uwTickFreq != Freq )
346
364
{
365
+
366
+ /* Back up uwTickFreq frequency */
367
+ prevTickFreq = uwTickFreq ;
368
+
369
+ /* Update uwTickFreq global variable used by HAL_InitTick() */
347
370
uwTickFreq = Freq ;
348
371
349
372
/* Apply the new tick Freq */
350
373
status = HAL_InitTick (uwTickPrio );
374
+ if (status != HAL_OK )
375
+ {
376
+ /* Restore previous tick frequency */
377
+ uwTickFreq = prevTickFreq ;
378
+ }
351
379
}
352
380
353
381
return status ;
@@ -560,6 +588,7 @@ void HAL_SYSCFG_DisableVREFBUF(void)
560
588
CLEAR_BIT (VREFBUF -> CSR , VREFBUF_CSR_ENVR );
561
589
}
562
590
591
+ #if defined(SYSCFG_PMCR_EPIS_SEL )
563
592
/**
564
593
* @brief Ethernet PHY Interface Selection either MII or RMII
565
594
* @param SYSCFG_ETHInterface: Selects the Ethernet PHY interface
@@ -575,7 +604,7 @@ void HAL_SYSCFG_ETHInterfaceSelect(uint32_t SYSCFG_ETHInterface)
575
604
576
605
MODIFY_REG (SYSCFG -> PMCR , SYSCFG_PMCR_EPIS_SEL , (uint32_t )(SYSCFG_ETHInterface ));
577
606
}
578
-
607
+ #endif /* SYSCFG_PMCR_EPIS_SEL */
579
608
580
609
/**
581
610
* @brief Analog Switch control for dual analog pads.
@@ -607,7 +636,7 @@ void HAL_SYSCFG_AnalogSwitchConfig(uint32_t SYSCFG_AnalogSwitch , uint32_t SYSCF
607
636
MODIFY_REG (SYSCFG -> PMCR , (uint32_t ) SYSCFG_AnalogSwitch , (uint32_t )(SYSCFG_SwitchState ));
608
637
}
609
638
610
-
639
+ #if defined( SYSCFG_PMCR_BOOSTEN )
611
640
/**
612
641
* @brief Enables the booster to reduce the total harmonic distortion of the analog
613
642
* switch when the supply voltage is lower than 2.7 V.
@@ -632,8 +661,9 @@ void HAL_SYSCFG_DisableBOOST(void)
632
661
{
633
662
CLEAR_BIT (SYSCFG -> PMCR , SYSCFG_PMCR_BOOSTEN ) ;
634
663
}
664
+ #endif /* SYSCFG_PMCR_BOOSTEN */
635
665
636
-
666
+ #if defined ( SYSCFG_UR2_BOOT_ADD0 ) || defined ( SYSCFG_UR2_BCM7_ADD0 )
637
667
/**
638
668
* @brief BootCM7 address 0 configuration
639
669
* @param BootRegister :Specifies the Boot Address register (Address0 or Address1)
@@ -666,8 +696,8 @@ void HAL_SYSCFG_CM7BootAddConfig(uint32_t BootRegister, uint32_t BootAddress)
666
696
MODIFY_REG (SYSCFG -> UR3 , SYSCFG_UR3_BOOT_ADD1 , (BootAddress >> 16 ));
667
697
#endif /*DUAL_CORE*/
668
698
}
669
-
670
699
}
700
+ #endif /* SYSCFG_UR2_BOOT_ADD0 || SYSCFG_UR2_BCM7_ADD0 */
671
701
672
702
#if defined(DUAL_CORE )
673
703
/**
@@ -736,7 +766,6 @@ void HAL_SYSCFG_DisableCM4BOOT(void)
736
766
CLEAR_BIT (SYSCFG -> UR1 , SYSCFG_UR1_BCM4 );
737
767
}
738
768
#endif /*DUAL_CORE*/
739
-
740
769
/**
741
770
* @brief Enables the I/O Compensation Cell.
742
771
* @note The I/O compensation cell can be used only when the device supply
@@ -769,7 +798,11 @@ void HAL_DisableCompensationCell(void)
769
798
*/
770
799
void HAL_SYSCFG_EnableIOSpeedOptimize (void )
771
800
{
801
+ #if defined(SYSCFG_CCCSR_HSLV )
772
802
SET_BIT (SYSCFG -> CCCSR , SYSCFG_CCCSR_HSLV );
803
+ #else
804
+ SET_BIT (SYSCFG -> CCCSR , (SYSCFG_CCCSR_HSLV0 | SYSCFG_CCCSR_HSLV1 | SYSCFG_CCCSR_HSLV2 | SYSCFG_CCCSR_HSLV3 ));
805
+ #endif /* SYSCFG_CCCSR_HSLV */
773
806
}
774
807
775
808
/**
@@ -781,7 +814,11 @@ void HAL_SYSCFG_EnableIOSpeedOptimize(void)
781
814
*/
782
815
void HAL_SYSCFG_DisableIOSpeedOptimize (void )
783
816
{
817
+ #if defined(SYSCFG_CCCSR_HSLV )
784
818
CLEAR_BIT (SYSCFG -> CCCSR , SYSCFG_CCCSR_HSLV );
819
+ #else
820
+ CLEAR_BIT (SYSCFG -> CCCSR , (SYSCFG_CCCSR_HSLV0 | SYSCFG_CCCSR_HSLV1 | SYSCFG_CCCSR_HSLV2 | SYSCFG_CCCSR_HSLV3 ));
821
+ #endif /* SYSCFG_CCCSR_HSLV */
785
822
}
786
823
787
824
/**
@@ -817,9 +854,28 @@ void HAL_SYSCFG_CompensationCodeConfig(uint32_t SYSCFG_PMOSCode, uint32_t SYSCFG
817
854
MODIFY_REG (SYSCFG -> CCCR , SYSCFG_CCCR_NCC |SYSCFG_CCCR_PCC , (((uint32_t )(SYSCFG_PMOSCode )<< 4 )|(uint32_t )(SYSCFG_NMOSCode )) );
818
855
}
819
856
857
+ #if defined(SYSCFG_CCCR_NCC_MMC )
858
+ /**
859
+ * @brief Code selection for the I/O Compensation cell
860
+ * @param SYSCFG_PMOSCode: VDDMMC PMOS compensation code
861
+ * This code is applied to the I/O compensation cell when the CS bit of the
862
+ * SYSCFG_CMPCR is set
863
+ * @param SYSCFG_NMOSCode: VDDMMC NMOS compensation code
864
+ * This code is applied to the I/O compensation cell when the CS bit of the
865
+ * SYSCFG_CMPCR is set
866
+ * @retval None
867
+ */
868
+ void HAL_SYSCFG_VDDMMC_CompensationCodeConfig (uint32_t SYSCFG_PMOSCode , uint32_t SYSCFG_NMOSCode )
869
+ {
870
+ /* Check the parameter */
871
+ assert_param (IS_SYSCFG_CODE_CONFIG (SYSCFG_PMOSCode ));
872
+ assert_param (IS_SYSCFG_CODE_CONFIG (SYSCFG_NMOSCode ));
873
+ MODIFY_REG (SYSCFG -> CCCR , (SYSCFG_CCCR_NCC_MMC | SYSCFG_CCCR_PCC_MMC ), (((uint32_t )(SYSCFG_PMOSCode )<< 4 )|(uint32_t )(SYSCFG_NMOSCode )) );
874
+ }
875
+ #endif /* SYSCFG_CCCR_NCC_MMC */
820
876
821
877
/**
822
- * @brief Enable the Debug Module during Domain1 SLEEP mode
878
+ * @brief Enable the Debug Module during Domain1/CDomain SLEEP mode
823
879
* @retval None
824
880
*/
825
881
void HAL_EnableDBGSleepMode (void )
@@ -828,16 +884,17 @@ void HAL_EnableDBGSleepMode(void)
828
884
}
829
885
830
886
/**
831
- * @brief Disable the Debug Module during Domain1 SLEEP mode
887
+ * @brief Disable the Debug Module during Domain1/CDomain SLEEP mode
832
888
* @retval None
833
889
*/
834
890
void HAL_DisableDBGSleepMode (void )
835
891
{
836
892
CLEAR_BIT (DBGMCU -> CR , DBGMCU_CR_DBG_SLEEPD1 );
837
893
}
838
894
895
+
839
896
/**
840
- * @brief Enable the Debug Module during Domain1 STOP mode
897
+ * @brief Enable the Debug Module during Domain1/CDomain STOP mode
841
898
* @retval None
842
899
*/
843
900
void HAL_EnableDBGStopMode (void )
@@ -846,7 +903,7 @@ void HAL_EnableDBGStopMode(void)
846
903
}
847
904
848
905
/**
849
- * @brief Disable the Debug Module during Domain1 STOP mode
906
+ * @brief Disable the Debug Module during Domain1/CDomain STOP mode
850
907
* @retval None
851
908
*/
852
909
void HAL_DisableDBGStopMode (void )
@@ -855,7 +912,7 @@ void HAL_DisableDBGStopMode(void)
855
912
}
856
913
857
914
/**
858
- * @brief Enable the Debug Module during Domain1 STANDBY mode
915
+ * @brief Enable the Debug Module during Domain1/CDomain STANDBY mode
859
916
* @retval None
860
917
*/
861
918
void HAL_EnableDBGStandbyMode (void )
@@ -864,7 +921,7 @@ void HAL_EnableDBGStandbyMode(void)
864
921
}
865
922
866
923
/**
867
- * @brief Disable the Debug Module during Domain1 STANDBY mode
924
+ * @brief Disable the Debug Module during Domain1/CDomain STANDBY mode
868
925
* @retval None
869
926
*/
870
927
void HAL_DisableDBGStandbyMode (void )
@@ -928,18 +985,16 @@ void HAL_DisableDomain2DBGStandbyMode(void)
928
985
}
929
986
#endif /*DUAL_CORE*/
930
987
931
-
932
988
/**
933
- * @brief Enable the Debug Module during Domain3 STOP mode
989
+ * @brief Enable the Debug Module during Domain3/SRDomain STOP mode
934
990
* @retval None
935
991
*/
936
992
void HAL_EnableDomain3DBGStopMode (void )
937
993
{
938
994
SET_BIT (DBGMCU -> CR , DBGMCU_CR_DBG_STOPD3 );
939
995
}
940
-
941
996
/**
942
- * @brief Disable the Debug Module during Domain3 STOP mode
997
+ * @brief Disable the Debug Module during Domain3/SRDomain STOP mode
943
998
* @retval None
944
999
*/
945
1000
void HAL_DisableDomain3DBGStopMode (void )
@@ -948,7 +1003,7 @@ void HAL_DisableDomain3DBGStopMode(void)
948
1003
}
949
1004
950
1005
/**
951
- * @brief Enable the Debug Module during Domain3 STANDBY mode
1006
+ * @brief Enable the Debug Module during Domain3/SRDomain STANDBY mode
952
1007
* @retval None
953
1008
*/
954
1009
void HAL_EnableDomain3DBGStandbyMode (void )
@@ -957,7 +1012,7 @@ void HAL_EnableDomain3DBGStandbyMode(void)
957
1012
}
958
1013
959
1014
/**
960
- * @brief Disable the Debug Module during Domain3 STANDBY mode
1015
+ * @brief Disable the Debug Module during Domain3/SRDomain STANDBY mode
961
1016
* @retval None
962
1017
*/
963
1018
void HAL_DisableDomain3DBGStandbyMode (void )
@@ -1045,7 +1100,7 @@ void HAL_EXTI_D1_ClearFlag(uint32_t EXTI_Line)
1045
1100
{
1046
1101
/* Check the parameters */
1047
1102
assert_param (IS_EXTI_D1_LINE (EXTI_Line ));
1048
- SET_BIT (* (__IO uint32_t * ) ( ((uint32_t ) & (EXTI_D1 -> PR1 )) + ((EXTI_Line >> 5 ) * 0x10UL )), (uint32_t )(1UL << (EXTI_Line & 0x1FUL )));
1103
+ WRITE_REG (* (__IO uint32_t * ) ( ((uint32_t ) & (EXTI_D1 -> PR1 )) + ((EXTI_Line >> 5 ) * 0x10UL )), (uint32_t )(1UL << (EXTI_Line & 0x1FUL )));
1049
1104
1050
1105
}
1051
1106
@@ -1060,7 +1115,7 @@ void HAL_EXTI_D2_ClearFlag(uint32_t EXTI_Line)
1060
1115
{
1061
1116
/* Check the parameters */
1062
1117
assert_param (IS_EXTI_D2_LINE (EXTI_Line ));
1063
- SET_BIT (* (__IO uint32_t * ) ( ((uint32_t ) & (EXTI_D2 -> PR1 )) + ((EXTI_Line >> 5 ) * 0x10UL )), (uint32_t )(1UL << (EXTI_Line & 0x1FUL )));
1118
+ WRITE_REG (* (__IO uint32_t * ) ( ((uint32_t ) & (EXTI_D2 -> PR1 )) + ((EXTI_Line >> 5 ) * 0x10UL )), (uint32_t )(1UL << (EXTI_Line & 0x1FUL )));
1064
1119
}
1065
1120
1066
1121
#endif /*DUAL_CORE*/
0 commit comments