1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3 * Copyright (c) 2022, STMicroelectronics
4 */
5
6 #ifndef __DRIVERS_STM32_SHARED_IO_H__
7 #define __DRIVERS_STM32_SHARED_IO_H__
8
9 #include <stdint.h>
10 #include <types_ext.h>
11
12 /*
13 * Shared registers support: common lock for accessing SoC registers
14 * shared between several drivers.
15 */
16 void io_clrsetbits32_stm32shregs(vaddr_t va, uint32_t clr, uint32_t set);
17 void io_mask32_stm32shregs(vaddr_t va, uint32_t value, uint32_t mask);
18
io_setbits32_stm32shregs(vaddr_t va,uint32_t value)19 static inline void io_setbits32_stm32shregs(vaddr_t va, uint32_t value)
20 {
21 io_mask32_stm32shregs(va, value, value);
22 }
23
io_clrbits32_stm32shregs(vaddr_t va,uint32_t value)24 static inline void io_clrbits32_stm32shregs(vaddr_t va, uint32_t value)
25 {
26 io_mask32_stm32shregs(va, 0, value);
27 }
28
29 #endif /* __DRIVERS_STM32_SHARED_IO_H__ */
30