Introduced a type for clock points.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14373 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2021-05-15 11:53:13 +00:00
parent 634a9b55d2
commit 50aac6e69f
5 changed files with 11 additions and 6 deletions

View File

@ -301,7 +301,7 @@ static inline bool halClockSwitchMode(const halclkcfg_t *ccp) {
* *
* @xclass * @xclass
*/ */
static inline halfreq_t halClockGetPointX(unsigned clkpt) { static inline halfreq_t halClockGetPointX(halclkpt_t clkpt) {
return hal_lld_get_clock_point(clkpt); return hal_lld_get_clock_point(clkpt);
} }

View File

@ -703,7 +703,7 @@ bool hal_lld_clock_switch_mode(const halclkcfg_t *ccp) {
* *
* @notapi * @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"); osalDbgAssert(clkpt < CLK_ARRAY_SIZE, "invalid clock point");

View File

@ -1542,6 +1542,11 @@
/* Driver data structures and types. */ /* 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__) #if defined(HAL_LLD_USE_CLOCK_MANAGEMENT) || defined(__DOXYGEN__)
/** /**
* @brief Type of a clock point frequency in Hz. * @brief Type of a clock point frequency in Hz.
@ -1619,7 +1624,7 @@ extern "C" {
void stm32_clock_init(void); void stm32_clock_init(void);
#if defined(HAL_LLD_USE_CLOCK_MANAGEMENT) || defined(__DOXYGEN__) #if defined(HAL_LLD_USE_CLOCK_MANAGEMENT) || defined(__DOXYGEN__)
bool hal_lld_clock_switch_mode(const halclkcfg_t *ccp); 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) */ #endif /* defined(HAL_LLD_USE_CLOCK_MANAGEMENT) */
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -100,7 +100,7 @@ bool hal_lld_clock_switch_mode(const halclkcfg_t *ccp) {
* *
* @notapi * @notapi
*/ */
halfreq_t hal_lld_get_clock_point(unsigned clkpt) { halfreq_t hal_lld_get_clock_point(halclkpt_t clkpt) {
(void)clkpt; (void)clkpt;

View File

@ -73,7 +73,7 @@
typedef enum { typedef enum {
clk_core = 0, clk_core = 0,
clk_peripherals = 1 clk_peripherals = 1
} halclkpoint_t; } halclkpt_t;
/** /**
* @brief Type of a clock point frequency in Hz. * @brief Type of a clock point frequency in Hz.
@ -107,7 +107,7 @@ extern "C" {
void hal_lld_init(void); void hal_lld_init(void);
#if defined(HAL_LLD_USE_CLOCK_MANAGEMENT) || defined(__DOXYGEN__) #if defined(HAL_LLD_USE_CLOCK_MANAGEMENT) || defined(__DOXYGEN__)
bool hal_lld_clock_switch_mode(const halclkcfg_t *ccp); 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) */ #endif /* defined(HAL_LLD_USE_CLOCK_MANAGEMENT) */
#ifdef __cplusplus #ifdef __cplusplus
} }