1 /*
2  * Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef BSP_CFG_H_
8 #define BSP_CFG_H_
9 
10 #include "soc.h"
11 #include "bsp_clock_cfg.h"
12 #include "bsp_mcu_family_cfg.h"
13 
14 #define SUBCLOCK_STABILIZATION_MAX(x) ((x < 10000) ? x : 10000)
15 
16 /* Disable BSP_CFG_PARAM_CHECKING_ENABLE as default to reduce code size */
17 #define BSP_CFG_PARAM_CHECKING_ENABLE (0)
18 
19 /* Add for zephyr porting */
20 #define BSP_CFG_INTERRUPT_INIT 0
21 #define BSP_CFG_SP_MON_INIT    0
22 
23 #ifndef BSP_CLOCK_CFG_MAIN_OSC_POPULATED
24 #define BSP_CLOCK_CFG_MAIN_OSC_POPULATED (DT_NODE_HAS_STATUS(DT_NODELABEL(xtal), okay))
25 #endif
26 
27 #ifndef BSP_CLOCK_CFG_MAIN_OSC_CLOCK_SOURCE
28 #define BSP_CLOCK_CFG_MAIN_OSC_CLOCK_SOURCE (DT_PROP_OR(DT_NODELABEL(xtal), mosel, 0))
29 #endif
30 
31 /* Keep 0 as default as LPM is not supported */
32 #ifndef BSP_CLOCK_CFG_SUBCLOCK_DRIVE
33 #define BSP_CLOCK_CFG_SUBCLOCK_DRIVE (DT_PROP_OR(DT_NODELABEL(subclk), drive_capability, 0))
34 #endif
35 
36 #ifndef BSP_CLOCK_CFG_SUBCLOCK_POPULATED
37 #define BSP_CLOCK_CFG_SUBCLOCK_POPULATED (DT_NODE_HAS_STATUS(DT_NODELABEL(subclk), okay))
38 #endif
39 #ifndef BSP_CLOCK_CFG_SUBCLOCK_STABILIZATION_MS
40 #define BSP_CLOCK_CFG_SUBCLOCK_STABILIZATION_MS                                                    \
41 	SUBCLOCK_STABILIZATION_MAX((DT_PROP_OR(DT_NODELABEL(subclk), stabilization_time, 1000)))
42 #endif
43 
44 
45 #define BSP_CFG_PFS_PROTECT (1)
46 
47 #endif /* BSP_CFG_H_ */
48