1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/msp430: aid optimizer

Declare functions retrieving the clock domains frequency as pure so
that common subexpressions can be eliminated more easily.
This commit is contained in:
Marian Buschsieweke 2023-12-06 20:35:19 +01:00
parent 7044699388
commit e6154a04a1
No known key found for this signature in database
GPG Key ID: 77AA882EC78084E6
2 changed files with 5 additions and 4 deletions

View File

@ -348,7 +348,8 @@ void default_clock_init(void)
__attribute__((weak, alias("default_clock_init"))) void clock_init(void);
uint32_t msp430_submain_clock_freq(void) {
uint32_t PURE msp430_submain_clock_freq(void)
{
uint16_t shift = (clock_params.submain_clock_divier >> 1) & 0x3;
switch (clock_params.submain_clock_source) {
case SUBMAIN_CLOCK_SOURCE_LFXT1CLK:
@ -365,7 +366,7 @@ uint32_t msp430_submain_clock_freq(void) {
}
}
uint32_t msp430_auxiliary_clock_freq(void)
uint32_t PURE msp430_auxiliary_clock_freq(void)
{
uint16_t shift = (clock_params.auxiliary_clock_divier >> 4) & 0x3;
return clock_params.lfxt1_frequency >> shift;

View File

@ -358,14 +358,14 @@ void clock_init(void);
*
* @note This is only useful when implementing MSP430 peripheral drivers
*/
uint32_t msp430_submain_clock_freq(void);
uint32_t PURE msp430_submain_clock_freq(void);
/**
* @brief Get the configured auxiliary clock frequency
*
* @note This is only useful when implementing MSP430 peripheral drivers
*/
uint32_t msp430_auxiliary_clock_freq(void);
uint32_t PURE msp430_auxiliary_clock_freq(void);
#ifdef __cplusplus
}