include: zephyr: dt-bindings: clock: Define STM32_CLOCK macro

Define new macro for reading and writing convenience.

Signed-off-by: Hubert Guan <hguan@ucsb.edu>
This commit is contained in:
Hubert Guan 2024-10-09 23:52:12 -07:00 committed by Carles Cufí
parent 22ad205919
commit d2273c02df

View File

@ -45,4 +45,13 @@
(((mask) & STM32_MCO_CFGR_MASK_MASK) << STM32_MCO_CFGR_MASK_SHIFT) | \
(((val) & STM32_MCO_CFGR_VAL_MASK) << STM32_MCO_CFGR_VAL_SHIFT))
/**
* Pack RCC clock register offset and bit in two 32-bit values
* as expected for the Device Tree `clocks` property on STM32.
*
* @param bus STM32 bus name (expands to STM32_CLOCK_BUS_{bus})
* @param bit Clock bit
*/
#define STM32_CLOCK(bus, bit) (STM32_CLOCK_BUS_##bus) (1 << bit)
#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32_COMMON_CLOCKS_H_ */