From 50aac6e69f0e3cc7981a7b580ecbe6d666e136e1 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 15 May 2021 11:53:13 +0000 Subject: [PATCH] Introduced a type for clock points. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14373 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- os/hal/include/hal.h | 2 +- os/hal/ports/STM32/STM32G4xx/hal_lld.c | 2 +- os/hal/ports/STM32/STM32G4xx/hal_lld.h | 7 ++++++- os/hal/templates/hal_lld.c | 2 +- os/hal/templates/hal_lld.h | 4 ++-- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/os/hal/include/hal.h b/os/hal/include/hal.h index 3c1feefed..c093ae9c4 100644 --- a/os/hal/include/hal.h +++ b/os/hal/include/hal.h @@ -301,7 +301,7 @@ static inline bool halClockSwitchMode(const halclkcfg_t *ccp) { * * @xclass */ -static inline halfreq_t halClockGetPointX(unsigned clkpt) { +static inline halfreq_t halClockGetPointX(halclkpt_t clkpt) { return hal_lld_get_clock_point(clkpt); } diff --git a/os/hal/ports/STM32/STM32G4xx/hal_lld.c b/os/hal/ports/STM32/STM32G4xx/hal_lld.c index 8f5351246..ac89d56c9 100644 --- a/os/hal/ports/STM32/STM32G4xx/hal_lld.c +++ b/os/hal/ports/STM32/STM32G4xx/hal_lld.c @@ -703,7 +703,7 @@ bool hal_lld_clock_switch_mode(const halclkcfg_t *ccp) { * * @notapi */ -halfreq_t hal_lld_get_clock_point(unsigned clkpt) { +halfreq_t hal_lld_get_clock_point(halclkpt_t clkpt) { osalDbgAssert(clkpt < CLK_ARRAY_SIZE, "invalid clock point"); diff --git a/os/hal/ports/STM32/STM32G4xx/hal_lld.h b/os/hal/ports/STM32/STM32G4xx/hal_lld.h index f717e092b..19a9db32c 100644 --- a/os/hal/ports/STM32/STM32G4xx/hal_lld.h +++ b/os/hal/ports/STM32/STM32G4xx/hal_lld.h @@ -1542,6 +1542,11 @@ /* Driver data structures and types. */ /*===========================================================================*/ +/** + * @brief Type of a clock point identifier. + */ +typedef unsigned halclkpt_t; + #if defined(HAL_LLD_USE_CLOCK_MANAGEMENT) || defined(__DOXYGEN__) /** * @brief Type of a clock point frequency in Hz. @@ -1619,7 +1624,7 @@ extern "C" { void stm32_clock_init(void); #if defined(HAL_LLD_USE_CLOCK_MANAGEMENT) || defined(__DOXYGEN__) bool hal_lld_clock_switch_mode(const halclkcfg_t *ccp); - halfreq_t hal_lld_get_clock_point(unsigned clkpt); + halfreq_t hal_lld_get_clock_point(halclkpt_t clkpt); #endif /* defined(HAL_LLD_USE_CLOCK_MANAGEMENT) */ #ifdef __cplusplus } diff --git a/os/hal/templates/hal_lld.c b/os/hal/templates/hal_lld.c index e0a141880..80a5c5997 100644 --- a/os/hal/templates/hal_lld.c +++ b/os/hal/templates/hal_lld.c @@ -100,7 +100,7 @@ bool hal_lld_clock_switch_mode(const halclkcfg_t *ccp) { * * @notapi */ -halfreq_t hal_lld_get_clock_point(unsigned clkpt) { +halfreq_t hal_lld_get_clock_point(halclkpt_t clkpt) { (void)clkpt; diff --git a/os/hal/templates/hal_lld.h b/os/hal/templates/hal_lld.h index 9abb44042..3a4f011d5 100644 --- a/os/hal/templates/hal_lld.h +++ b/os/hal/templates/hal_lld.h @@ -73,7 +73,7 @@ typedef enum { clk_core = 0, clk_peripherals = 1 -} halclkpoint_t; +} halclkpt_t; /** * @brief Type of a clock point frequency in Hz. @@ -107,7 +107,7 @@ extern "C" { void hal_lld_init(void); #if defined(HAL_LLD_USE_CLOCK_MANAGEMENT) || defined(__DOXYGEN__) bool hal_lld_clock_switch_mode(const halclkcfg_t *ccp); - halfreq_t hal_lld_get_clock_point(unsigned clkpt); + halfreq_t hal_lld_get_clock_point(halclkpt_t clkpt); #endif /* defined(HAL_LLD_USE_CLOCK_MANAGEMENT) */ #ifdef __cplusplus }