stm32h7: add function to get frequency of a clock

Change-Id: Ice60bc0e443a134ebb8ec03015fef98991ef9b05
This commit is contained in:
Aidan MacDonald 2025-12-26 21:47:50 +00:00 committed by Solomon Peachy
parent a9b75fc4c4
commit a4b0af2a44

View file

@ -23,6 +23,7 @@
#include "system.h"
#include <stdbool.h>
#include <stddef.h>
enum stm_clock
{
@ -54,6 +55,14 @@ void stm_target_clock_init(void) INIT_ATTR;
*/
void stm_target_clock_enable(enum stm_clock clock, bool enable);
/*
* Callback to return a specific clock's frequency. For most
* peripherals the frequency must be known at initialization
* and not change afterwards; see peripheral drivers for the
* details, as their exact requirements may vary.
*/
size_t stm_target_clock_get_frequency(enum stm_clock clock);
/*
* Called from system_init(). Sets up internal book-keeping
* and then calls stm_target_clock_init().
@ -66,4 +75,12 @@ void stm_clock_init(void) INIT_ATTR;
void stm_clock_enable(enum stm_clock clock);
void stm_clock_disable(enum stm_clock clock);
/*
* Get a clock's frequency in Hz.
*/
static inline size_t stm_clock_get_frequency(enum stm_clock clock)
{
return stm_target_clock_get_frequency(clock);
}
#endif /* __CLOCK_STM32H7_H__ */