1 /*
2  * Copyright (c) 2024 Google Inc
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #ifndef INCLUDE_ZEPHYR_DRIVERS_BBRAM_IT8XXX2_H_
7 #define INCLUDE_ZEPHYR_DRIVERS_BBRAM_IT8XXX2_H_
8 
9 #include <stdint.h>
10 
11 #include <zephyr/devicetree.h>
12 
13 /** Device config */
14 struct bbram_it8xxx2_config {
15 	/** BBRAM base address */
16 	uintptr_t base_addr;
17 	/** BBRAM size (Unit:bytes) */
18 	int size;
19 };
20 
21 #ifdef CONFIG_BBRAM_IT8XXX2_EMUL
22 #define BBRAM_IT8XXX2_DECL_CONFIG(inst)                                                            \
23 	static uint8_t bbram_it8xxx2_emul_buffer_##inst[DT_INST_REG_SIZE(inst)];                   \
24 	static const struct bbram_it8xxx2_config bbram_cfg_##inst = {                              \
25 		.base_addr = (uintptr_t)bbram_it8xxx2_emul_buffer_##inst,                          \
26 		.size = DT_INST_REG_SIZE(inst),                                                    \
27 	}
28 #else
29 #define BBRAM_IT8XXX2_DECL_CONFIG(inst)                                                            \
30 	static const struct bbram_it8xxx2_config bbram_cfg_##inst = {                              \
31 		.base_addr = DT_INST_REG_ADDR(inst),                                               \
32 		.size = DT_INST_REG_SIZE(inst),                                                    \
33 	}
34 #endif
35 
36 #endif /* INCLUDE_ZEPHYR_DRIVERS_BBRAM_IT8XXX2_H_ */
37