Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
stm32_common_clocks.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 STMicroelectronics
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32_COMMON_CLOCKS_H_
7#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32_COMMON_CLOCKS_H_
8
10#define STM32_SRC_SYSCLK 0x001
12#define STM32_SRC_LSE 0x002
13#define STM32_SRC_LSI 0x003
14
16#define NO_SEL 0xFF
17
18#define STM32_CLOCK_DIV_SHIFT 12
19
21#define STM32_CLOCK_DIV(div) (((div) - 1) << STM32_CLOCK_DIV_SHIFT)
22
24#define STM32_MCO_CFGR_REG_MASK 0xFFFFU
25#define STM32_MCO_CFGR_REG_SHIFT 0U
26#define STM32_MCO_CFGR_SHIFT_MASK 0x3FU
27#define STM32_MCO_CFGR_SHIFT_SHIFT 16U
28#define STM32_MCO_CFGR_MASK_MASK 0x1FU
29#define STM32_MCO_CFGR_MASK_SHIFT 22U
30#define STM32_MCO_CFGR_VAL_MASK 0x1FU
31#define STM32_MCO_CFGR_VAL_SHIFT 27U
32
47#define STM32_MCO_CFGR(val, mask, shift, reg) \
48 ((((reg) & STM32_MCO_CFGR_REG_MASK) << STM32_MCO_CFGR_REG_SHIFT) | \
49 (((shift) & STM32_MCO_CFGR_SHIFT_MASK) << STM32_MCO_CFGR_SHIFT_SHIFT) | \
50 (((mask) & STM32_MCO_CFGR_MASK_MASK) << STM32_MCO_CFGR_MASK_SHIFT) | \
51 (((val) & STM32_MCO_CFGR_VAL_MASK) << STM32_MCO_CFGR_VAL_SHIFT))
52
60#define STM32_CLOCK(bus, bit) (STM32_CLOCK_BUS_##bus) (1 << bit)
61
62#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32_COMMON_CLOCKS_H_ */