Skip to content

Commit de75a7e

Browse files
committed
G0: update STM32G0xx HAL Drivers to v1.4.1
Included in STM32CubeG0 FW v1.4.1 Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 6ff7638 commit de75a7e

File tree

131 files changed

+33238
-6325
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+33238
-6325
lines changed

system/Drivers/STM32G0xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h

Lines changed: 166 additions & 28 deletions
Large diffs are not rendered by default.

system/Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal.h

Lines changed: 148 additions & 81 deletions
Large diffs are not rendered by default.

system/Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal_adc.h

Lines changed: 88 additions & 84 deletions
Large diffs are not rendered by default.

system/Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal_adc_ex.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#define STM32G0xx_HAL_ADC_EX_H
2323

2424
#ifdef __cplusplus
25-
extern "C" {
25+
extern "C" {
2626
#endif
2727

2828
/* Includes ------------------------------------------------------------------*/
@@ -143,15 +143,15 @@
143143
/* IO operation functions *****************************************************/
144144

145145
/* ADC calibration */
146-
HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(ADC_HandleTypeDef* hadc);
147-
uint32_t HAL_ADCEx_Calibration_GetValue(ADC_HandleTypeDef* hadc);
148-
HAL_StatusTypeDef HAL_ADCEx_Calibration_SetValue(ADC_HandleTypeDef* hadc, uint32_t CalibrationFactor);
146+
HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(ADC_HandleTypeDef *hadc);
147+
uint32_t HAL_ADCEx_Calibration_GetValue(ADC_HandleTypeDef *hadc);
148+
HAL_StatusTypeDef HAL_ADCEx_Calibration_SetValue(ADC_HandleTypeDef *hadc, uint32_t CalibrationFactor);
149149

150150
/* ADC IRQHandler and Callbacks used in non-blocking modes (Interruption) */
151-
void HAL_ADCEx_LevelOutOfWindow2Callback(ADC_HandleTypeDef* hadc);
152-
void HAL_ADCEx_LevelOutOfWindow3Callback(ADC_HandleTypeDef* hadc);
153-
void HAL_ADCEx_EndOfSamplingCallback(ADC_HandleTypeDef* hadc);
154-
void HAL_ADCEx_ChannelConfigReadyCallback(ADC_HandleTypeDef* hadc);
151+
void HAL_ADCEx_LevelOutOfWindow2Callback(ADC_HandleTypeDef *hadc);
152+
void HAL_ADCEx_LevelOutOfWindow3Callback(ADC_HandleTypeDef *hadc);
153+
void HAL_ADCEx_EndOfSamplingCallback(ADC_HandleTypeDef *hadc);
154+
void HAL_ADCEx_ChannelConfigReadyCallback(ADC_HandleTypeDef *hadc);
155155

156156
/**
157157
* @}
@@ -161,7 +161,7 @@ void HAL_ADCEx_ChannelConfigReadyCallback(ADC_HandleTypeDef*
161161
* @{
162162
*/
163163
/* Peripheral Control functions ***********************************************/
164-
HAL_StatusTypeDef HAL_ADCEx_DisableVoltageRegulator(ADC_HandleTypeDef* hadc);
164+
HAL_StatusTypeDef HAL_ADCEx_DisableVoltageRegulator(ADC_HandleTypeDef *hadc);
165165

166166
/**
167167
* @}

system/Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal_cec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ typedef struct
121121
* b6 Error information
122122
* 0 : No Error
123123
* 1 : Error
124-
* b5 CEC peripheral initilisation status
124+
* b5 CEC peripheral initialization status
125125
* 0 : Reset (peripheral not initialized)
126126
* 1 : Init done (peripheral initialized. HAL CEC Init function already called)
127127
* b4-b3 (not used)
@@ -138,7 +138,7 @@ typedef struct
138138
* RxState value coding follow below described bitmap :
139139
* b7-b6 (not used)
140140
* xx : Should be set to 00
141-
* b5 CEC peripheral initilisation status
141+
* b5 CEC peripheral initialization status
142142
* 0 : Reset (peripheral not initialized)
143143
* 1 : Init done (peripheral initialized)
144144
* b4-b2 (not used)

system/Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal_comp.h

Lines changed: 140 additions & 18 deletions
Large diffs are not rendered by default.

system/Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal_conf_template.h

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,15 @@ extern "C" {
4545
#define HAL_DMA_MODULE_ENABLED
4646
#define HAL_EXTI_MODULE_ENABLED
4747
#define HAL_FLASH_MODULE_ENABLED
48+
#define HAL_FDCAN_MODULE_ENABLED
4849
#define HAL_GPIO_MODULE_ENABLED
4950
#define HAL_I2C_MODULE_ENABLED
5051
#define HAL_I2S_MODULE_ENABLED
5152
#define HAL_IRDA_MODULE_ENABLED
5253
#define HAL_IWDG_MODULE_ENABLED
5354
#define HAL_LPTIM_MODULE_ENABLED
55+
#define HAL_HCD_MODULE_ENABLED
56+
#define HAL_PCD_MODULE_ENABLED
5457
#define HAL_PWR_MODULE_ENABLED
5558
#define HAL_RCC_MODULE_ENABLED
5659
#define HAL_RNG_MODULE_ENABLED
@@ -67,23 +70,27 @@ extern "C" {
6770
/**
6871
* @brief This is the list of modules where register callback can be used
6972
*/
70-
#define USE_HAL_ADC_REGISTER_CALLBACKS 0u
71-
#define USE_HAL_CEC_REGISTER_CALLBACKS 0u
72-
#define USE_HAL_COMP_REGISTER_CALLBACKS 0u
73-
#define USE_HAL_CRYP_REGISTER_CALLBACKS 0u
74-
#define USE_HAL_DAC_REGISTER_CALLBACKS 0u
75-
#define USE_HAL_I2C_REGISTER_CALLBACKS 0u
76-
#define USE_HAL_I2S_REGISTER_CALLBACKS 0u
77-
#define USE_HAL_IRDA_REGISTER_CALLBACKS 0u
78-
#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0u
79-
#define USE_HAL_RNG_REGISTER_CALLBACKS 0u
80-
#define USE_HAL_RTC_REGISTER_CALLBACKS 0u
81-
#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0u
82-
#define USE_HAL_SPI_REGISTER_CALLBACKS 0u
83-
#define USE_HAL_TIM_REGISTER_CALLBACKS 0u
84-
#define USE_HAL_UART_REGISTER_CALLBACKS 0u
85-
#define USE_HAL_USART_REGISTER_CALLBACKS 0u
86-
#define USE_HAL_WWDG_REGISTER_CALLBACKS 0u
73+
#define USE_HAL_ADC_REGISTER_CALLBACKS 0u
74+
#define USE_HAL_CEC_REGISTER_CALLBACKS 0u
75+
#define USE_HAL_COMP_REGISTER_CALLBACKS 0u
76+
#define USE_HAL_CRYP_REGISTER_CALLBACKS 0u
77+
#define USE_HAL_DAC_REGISTER_CALLBACKS 0u
78+
#define USE_HAL_FDCAN_REGISTER_CALLBACKS 0u
79+
#define USE_HAL_I2C_REGISTER_CALLBACKS 0u
80+
#define USE_HAL_I2S_REGISTER_CALLBACKS 0u
81+
#define USE_HAL_IRDA_REGISTER_CALLBACKS 0u
82+
#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0u
83+
#define USE_HAL_HCD_REGISTER_CALLBACKS 0u
84+
#define USE_HAL_PCD_REGISTER_CALLBACKS 0u
85+
#define USE_HAL_RNG_REGISTER_CALLBACKS 0u
86+
#define USE_HAL_RTC_REGISTER_CALLBACKS 0u
87+
#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0u
88+
#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0u
89+
#define USE_HAL_SPI_REGISTER_CALLBACKS 0u
90+
#define USE_HAL_TIM_REGISTER_CALLBACKS 0u
91+
#define USE_HAL_UART_REGISTER_CALLBACKS 0u
92+
#define USE_HAL_USART_REGISTER_CALLBACKS 0u
93+
#define USE_HAL_WWDG_REGISTER_CALLBACKS 0u
8794

8895
/* ########################## Oscillator Values adaptation ####################*/
8996
/**
@@ -108,6 +115,19 @@ extern "C" {
108115
#define HSI_VALUE (16000000UL) /*!< Value of the Internal oscillator in Hz*/
109116
#endif /* HSI_VALUE */
110117

118+
#if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
119+
/**
120+
* @brief Internal High Speed oscillator (HSI48) value for USB FS, SDMMC and RNG.
121+
* This internal oscillator is mainly dedicated to provide a high precision clock to
122+
* the USB peripheral by means of a special Clock Recovery System (CRS) circuitry.
123+
* When the CRS is not used, the HSI48 RC oscillator runs on it default frequency
124+
* which is subject to manufacturing process variations.
125+
*/
126+
#if !defined (HSI48_VALUE)
127+
#define HSI48_VALUE 48000000U /*!< Value of the Internal High Speed oscillator for USB FS/SDMMC/RNG in Hz.
128+
The real value my vary depending on manufacturing process variations.*/
129+
#endif /* HSI48_VALUE */
130+
#endif
111131

112132
/**
113133
* @brief Internal Low Speed oscillator (LSI) value.
@@ -138,6 +158,16 @@ in voltage and temperature.*/
138158
#define EXTERNAL_I2S1_CLOCK_VALUE (48000UL) /*!< Value of the I2S1 External clock source in Hz*/
139159
#endif /* EXTERNAL_I2S1_CLOCK_VALUE */
140160

161+
#if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
162+
/**
163+
* @brief External clock source for I2S2 peripheral
164+
* This value is used by the RCC HAL module to compute the I2S2 clock source
165+
* frequency.
166+
*/
167+
#if !defined (EXTERNAL_I2S2_CLOCK_VALUE)
168+
#define EXTERNAL_I2S2_CLOCK_VALUE 48000U /*!< Value of the I2S2 External clock source in Hz*/
169+
#endif /* EXTERNAL_I2S2_CLOCK_VALUE */
170+
#endif
141171

142172
/* Tip: To avoid modifying this file each time you need to use different HSE,
143173
=== you can define the HSE value in your toolchain compiler preprocessor. */
@@ -223,6 +253,10 @@ in voltage and temperature.*/
223253
#include "stm32g0xx_hal_exti.h"
224254
#endif /* HAL_EXTI_MODULE_ENABLED */
225255

256+
#ifdef HAL_FDCAN_MODULE_ENABLED
257+
#include "stm32g0xx_hal_fdcan.h"
258+
#endif /* HAL_FDCAN_MODULE_ENABLED */
259+
226260
#ifdef HAL_FLASH_MODULE_ENABLED
227261
#include "stm32g0xx_hal_flash.h"
228262
#endif /* HAL_FLASH_MODULE_ENABLED */
@@ -247,6 +281,14 @@ in voltage and temperature.*/
247281
#include "stm32g0xx_hal_lptim.h"
248282
#endif /* HAL_LPTIM_MODULE_ENABLED */
249283

284+
#ifdef HAL_PCD_MODULE_ENABLED
285+
#include "stm32g0xx_hal_pcd.h"
286+
#endif /* HAL_PCD_MODULE_ENABLED */
287+
288+
#ifdef HAL_HCD_MODULE_ENABLED
289+
#include "stm32g0xx_hal_hcd.h"
290+
#endif /* HAL_HCD_MODULE_ENABLED */
291+
250292
#ifdef HAL_PWR_MODULE_ENABLED
251293
#include "stm32g0xx_hal_pwr.h"
252294
#endif /* HAL_PWR_MODULE_ENABLED */

system/Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal_cryp.h

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ typedef struct
6464
uint32_t *Header; /*!< used only in AES GCM and CCM Algorithm for authentication,
6565
GCM : also known as Additional Authentication Data
6666
CCM : named B1 composed of the associated data length and Associated Data. */
67-
uint32_t HeaderSize; /*!< The size of header buffer in word */
67+
uint32_t HeaderSize; /*!< The size of header buffer */
6868
uint32_t *B0; /*!< B0 is first authentication block used only in AES CCM mode */
69-
uint32_t DataWidthUnit; /*!< Data With Unit, this parameter can be value of @ref CRYP_Data_Width_Unit*/
69+
uint32_t DataWidthUnit; /*!< Payload Data Width Unit, this parameter can be value of @ref CRYP_Data_Width_Unit*/
70+
uint32_t HeaderWidthUnit; /*!< Header Width Unit, this parameter can be value of @ref CRYP_Header_Width_Unit*/
7071
uint32_t KeyIVConfigSkip; /*!< CRYP peripheral Key and IV configuration skip, to config Key and Initialization
7172
Vector only once and to skip configuration for consecutive processings.
7273
This parameter can be a value of @ref CRYP_Configuration_Skip */
@@ -108,7 +109,7 @@ typedef struct __CRYP_HandleTypeDef
108109
typedef struct
109110
#endif
110111
{
111-
AES_TypeDef *Instance; /*!< AES Register base address */
112+
AES_TypeDef *Instance; /*!< AES Register base address */
112113

113114
CRYP_ConfigTypeDef Init; /*!< CRYP required parameters */
114115

@@ -119,13 +120,13 @@ typedef struct
119120

120121
uint32_t *pCrypOutBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */
121122

122-
__IO uint16_t CrypHeaderCount; /*!< Counter of header data */
123+
__IO uint16_t CrypHeaderCount; /*!< Counter of header data in words */
123124

124-
__IO uint16_t CrypInCount; /*!< Counter of input data */
125+
__IO uint16_t CrypInCount; /*!< Counter of input data in words */
125126

126-
__IO uint16_t CrypOutCount; /*!< Counter of output data */
127+
__IO uint16_t CrypOutCount; /*!< Counter of output data in words */
127128

128-
uint16_t Size; /*!< length of input data in words */
129+
uint16_t Size; /*!< Length of input data */
129130

130131
uint32_t Phase; /*!< CRYP peripheral phase */
131132

@@ -182,10 +183,12 @@ typedef struct
182183

183184
uint32_t Key_saved[8]; /*!< copy of key registers */
184185

185-
uint32_t Size_saved; /*!< copy of input buffer size */
186+
uint16_t Size_saved; /*!< copy of input buffer size */
186187

187188
uint16_t CrypHeaderCount_saved; /*!< copy of CRYP header data counter when processing is suspended */
188189

190+
uint32_t SizesSum_saved; /*!< copy of SizesSum when processing is suspended */
191+
189192
uint32_t ResumingFlag; /*!< resumption flag to bypass steps already carried out */
190193

191194
FunctionalState AutoKeyDerivation_saved; /*!< copy of CRYP handle auto key derivation parameter */
@@ -259,6 +262,17 @@ typedef void (*pCRYP_CallbackTypeDef)(CRYP_HandleTypeDef *hcryp); /*!< point
259262
#define CRYP_DATAWIDTHUNIT_WORD 0x00000000U /*!< By default, size unit is word */
260263
#define CRYP_DATAWIDTHUNIT_BYTE 0x00000001U /*!< By default, size unit is byte */
261264

265+
/**
266+
* @}
267+
*/
268+
269+
/** @defgroup CRYP_Header_Width_Unit CRYP Header Width Unit
270+
* @{
271+
*/
272+
273+
#define CRYP_HEADERWIDTHUNIT_WORD 0x00000000U /*!< By default, header size unit is word */
274+
#define CRYP_HEADERWIDTHUNIT_BYTE 0x00000001U /*!< By default, header size unit is byte */
275+
262276
/**
263277
* @}
264278
*/
@@ -565,6 +579,13 @@ uint32_t HAL_CRYP_GetError(CRYP_HandleTypeDef *hcryp);
565579
#define IS_CRYP_INIT(CONFIG)(((CONFIG) == CRYP_KEYIVCONFIG_ALWAYS) || \
566580
((CONFIG) == CRYP_KEYIVCONFIG_ONCE))
567581

582+
#define IS_CRYP_BUFFERSIZE(ALGO, DATAWIDTH, SIZE) \
583+
(((((ALGO) == CRYP_AES_CTR)) && \
584+
((((DATAWIDTH) == CRYP_DATAWIDTHUNIT_WORD) && (((SIZE) % 4U) == 0U)) || \
585+
(((DATAWIDTH) == CRYP_DATAWIDTHUNIT_BYTE) && (((SIZE) % 16U) == 0U)))) || \
586+
(((ALGO) == CRYP_AES_ECB) || ((ALGO) == CRYP_AES_CBC) || \
587+
((ALGO)== CRYP_AES_GCM_GMAC) || ((ALGO) == CRYP_AES_CCM)))
588+
568589
/**
569590
* @}
570591
*/

system/Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal_def.h

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,14 @@ typedef enum
107107
}while (0U)
108108
#endif /* USE_RTOS */
109109

110-
#if defined ( __GNUC__ )
110+
#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
111+
#ifndef __weak
112+
#define __weak __attribute__((weak))
113+
#endif
114+
#ifndef __packed
115+
#define __packed __attribute__((packed))
116+
#endif
117+
#elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
111118
#ifndef __weak
112119
#define __weak __attribute__((weak))
113120
#endif /* __weak */
@@ -119,7 +126,14 @@ typedef enum
119126

120127
/* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
121128
/* GNU Compiler */
122-
#if defined (__GNUC__)
129+
#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */
130+
#ifndef __ALIGN_BEGIN
131+
#define __ALIGN_BEGIN
132+
#endif
133+
#ifndef __ALIGN_END
134+
#define __ALIGN_END __attribute__ ((aligned (4)))
135+
#endif
136+
#elif defined (__GNUC__) && !defined (__CC_ARM) /* GNU Compiler */
123137
#ifndef __ALIGN_END
124138
#define __ALIGN_END __attribute__ ((aligned (4U)))
125139
#endif /* __ALIGN_END */
@@ -132,7 +146,7 @@ typedef enum
132146
#endif /* __ALIGN_END */
133147
#ifndef __ALIGN_BEGIN
134148
/* ARM Compiler */
135-
#if defined (__CC_ARM)
149+
#if defined (__CC_ARM) /* ARM Compiler V5 */
136150
#define __ALIGN_BEGIN __align(4U)
137151
/* IAR Compiler */
138152
#elif defined (__ICCARM__)
@@ -144,9 +158,9 @@ typedef enum
144158
/**
145159
* @brief __RAM_FUNC definition
146160
*/
147-
#if defined ( __CC_ARM )
148-
/* ARM Compiler
149-
------------
161+
#if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
162+
/* ARM Compiler V4/V5 and V6
163+
--------------------------
150164
RAM functions are defined using the toolchain options.
151165
Functions that are executed in RAM should reside in a separate source module.
152166
Using the 'Options for File' dialog you can simply change the 'Code / Const'
@@ -176,9 +190,9 @@ typedef enum
176190
/**
177191
* @brief __NOINLINE definition
178192
*/
179-
#if defined ( __CC_ARM ) || defined ( __GNUC__ )
180-
/* ARM & GNUCompiler
181-
----------------
193+
#if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined ( __GNUC__ )
194+
/* ARM V4/V5 and V6 & GNU Compiler
195+
-------------------------------
182196
*/
183197
#define __NOINLINE __attribute__ ( (noinline) )
184198

0 commit comments

Comments
 (0)