Skip to content

Commit a34a0c9

Browse files
TriNguyenduynguyenxa
authored andcommitted
hal: renesas: Add BSP config RA4M3
Initial support bsp config for RA4M3 board Signed-off-by: TriNguyen <[email protected]>
1 parent 443920d commit a34a0c9

File tree

10 files changed

+22681
-0
lines changed

10 files changed

+22681
-0
lines changed

drivers/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA4M3AF.h

Lines changed: 21304 additions & 0 deletions
Large diffs are not rendered by default.

drivers/ra/fsp/src/bsp/mcu/ra4m3/bsp_elc.h

Lines changed: 306 additions & 0 deletions
Large diffs are not rendered by default.

drivers/ra/fsp/src/bsp/mcu/ra4m3/bsp_feature.h

Lines changed: 446 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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_FEATURE_GEN_H
8+
#define BSP_FEATURE_GEN_H
9+
10+
/***********************************************************************************************************************
11+
* Includes <System Includes> , "Project Includes"
12+
**********************************************************************************************************************/
13+
14+
/***********************************************************************************************************************
15+
* Macro definitions
16+
**********************************************************************************************************************/
17+
18+
/***********************************************************************************************************************
19+
* Typedef definitions
20+
**********************************************************************************************************************/
21+
22+
/***********************************************************************************************************************
23+
* Exported global variables (to be accessed by other files)
24+
**********************************************************************************************************************/
25+
26+
/***********************************************************************************************************************
27+
* Private global variables and functions
28+
**********************************************************************************************************************/
29+
30+
// *UNCRUSTIFY-OFF*
31+
#define BSP_FEATURE_GPT_AD_DIRECT_START_CHANNEL_MASK (0)
32+
#define BSP_FEATURE_GPT_AD_DIRECT_START_SUPPORTED (0)
33+
#define BSP_FEATURE_GPT_GPTE_CHANNEL_MASK (0)
34+
#define BSP_FEATURE_GPT_GPTE_SUPPORTED (0)
35+
#define BSP_FEATURE_GPT_GPTEH_CHANNEL_MASK (0)
36+
#define BSP_FEATURE_GPT_GPTEH_SUPPORTED (0)
37+
#define BSP_FEATURE_GPT_OPS_CHANNEL_MASK (0)
38+
#define BSP_FEATURE_GPT_OPS_SUPPORTED (0)
39+
// *UNCRUSTIFY-ON*
40+
#endif
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
/*******************************************************************************************************************//**
8+
* @ingroup BSP_MCU
9+
* @defgroup BSP_MCU_RA4M3 RA4M3
10+
* @includedoc config_bsp_ra4m3_fsp.html
11+
* @{
12+
**********************************************************************************************************************/
13+
14+
/** @} (end defgroup BSP_MCU_RA4M3) */
15+
16+
#ifndef BSP_MCU_INFO_H
17+
#define BSP_MCU_INFO_H
18+
19+
/***********************************************************************************************************************
20+
* Includes <System Includes> , "Project Includes"
21+
**********************************************************************************************************************/
22+
23+
/* BSP MCU Specific Includes. */
24+
#include "bsp_elc.h"
25+
#include "bsp_feature.h"
26+
27+
/***********************************************************************************************************************
28+
* Macro definitions
29+
**********************************************************************************************************************/
30+
31+
/***********************************************************************************************************************
32+
* Typedef definitions
33+
**********************************************************************************************************************/
34+
typedef elc_event_t bsp_interrupt_event_t;
35+
36+
/***********************************************************************************************************************
37+
* Exported global variables
38+
**********************************************************************************************************************/
39+
40+
/***********************************************************************************************************************
41+
* Exported global functions (to be accessed by other files)
42+
**********************************************************************************************************************/
43+
44+
#endif
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
#define BSP_CFG_PFS_PROTECT (1)
45+
46+
#endif /* BSP_CFG_H_ */
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
#include <zephyr/devicetree.h>
8+
#include <zephyr/dt-bindings/clock/ra_clock.h>
9+
10+
#ifndef BSP_CLOCK_CFG_H_
11+
#define BSP_CLOCK_CFG_H_
12+
13+
#define BSP_CFG_CLOCKS_SECURE (0)
14+
#define BSP_CFG_CLOCKS_OVERRIDE (0)
15+
#define BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(node_id, prop, default_value) \
16+
(COND_CODE_1(DT_NODE_HAS_STATUS(node_id, okay), (DT_PROP(node_id, prop)), (default_value)))
17+
18+
#define BSP_CFG_XTAL_HZ BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(xtal), clock_frequency, 0)
19+
20+
21+
#if DT_PROP(DT_NODELABEL(hoco), clock_frequency) == 16000000
22+
#define BSP_CFG_HOCO_FREQUENCY 0 /* HOCO 16MHz */
23+
#elif DT_PROP(DT_NODELABEL(hoco), clock_frequency) == 18000000
24+
#define BSP_CFG_HOCO_FREQUENCY 1 /* HOCO 18MHz */
25+
#elif DT_PROP(DT_NODELABEL(hoco), clock_frequency) == 20000000
26+
#define BSP_CFG_HOCO_FREQUENCY 2 /* HOCO 20MHz */
27+
#else
28+
#error "Invalid HOCO frequency, only can be set to 16MHz, 18MHz, and 20MHz"
29+
#endif
30+
31+
#define BSP_CFG_PLL_SOURCE \
32+
BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(pll), source, RA_PLL_SOURCE_DISABLE)
33+
#define BSP_CFG_PLL_DIV BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(pll), div, RA_PLL_DIV_3)
34+
#define BSP_CFG_PLL_MUL \
35+
DT_NODE_HAS_STATUS(DT_NODELABEL(pll), okay) \
36+
? BSP_CLOCKS_PLL_MUL(DT_PROP_BY_IDX(DT_NODELABEL(pll), mul, 0), \
37+
DT_PROP_BY_IDX(DT_NODELABEL(pll), mul, 1)) \
38+
: BSP_CLOCKS_PLL_MUL(0, 0)
39+
40+
#define BSP_CFG_PLL2_SOURCE \
41+
BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(pll2), source, RA_PLL_SOURCE_DISABLE)
42+
#define BSP_CFG_PLL2_DIV BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(pll2), div, RA_PLL_DIV_2)
43+
#define BSP_CFG_PLL2_MUL \
44+
DT_NODE_HAS_STATUS(DT_NODELABEL(pll2), okay) \
45+
? BSP_CLOCKS_PLL_MUL(DT_PROP_BY_IDX(DT_NODELABEL(pll2), mul, 0), \
46+
DT_PROP_BY_IDX(DT_NODELABEL(pll2), mul, 1)) \
47+
: BSP_CLOCKS_PLL_MUL(0, 0)
48+
49+
#define BSP_CFG_CLOCK_SOURCE \
50+
BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(pclkblock), sysclock_src, \
51+
RA_PLL_SOURCE_DISABLE)
52+
53+
#define BSP_CFG_ICLK_DIV \
54+
BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(iclk), clk_div, RA_SYS_CLOCK_DIV_2)
55+
#define BSP_CFG_PCLKA_DIV \
56+
BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(pclka), clk_div, RA_SYS_CLOCK_DIV_2)
57+
#define BSP_CFG_PCLKB_DIV \
58+
BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(pclkb), clk_div, RA_SYS_CLOCK_DIV_4)
59+
#define BSP_CFG_PCLKC_DIV \
60+
BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(pclkc), clk_div, RA_SYS_CLOCK_DIV_4)
61+
#define BSP_CFG_PCLKD_DIV \
62+
BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(pclkd), clk_div, RA_SYS_CLOCK_DIV_2)
63+
#define BSP_CFG_FCLK_DIV \
64+
BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(fclk), clk_div, RA_SYS_CLOCK_DIV_4)
65+
66+
#define BSP_CFG_UCK_SOURCE \
67+
BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(uclk), clk_src, RA_CLOCK_SOURCE_DISABLE)
68+
#define BSP_CFG_UCK_DIV BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(uclk), clk_div, 0)
69+
#define BSP_CFG_CLKOUT_SOURCE \
70+
BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(clkout), clk_src, RA_CLOCK_SOURCE_DISABLE)
71+
#define BSP_CFG_CLKOUT_DIV BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(clkout), clk_div, 0)
72+
73+
#endif /* BSP_CLOCK_CFG_H_ */
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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_MCU_DEVICE_CFG_H_
8+
#define BSP_MCU_DEVICE_CFG_H_
9+
#define BSP_CFG_MCU_PART_SERIES (4)
10+
#endif /* BSP_MCU_DEVICE_CFG_H_ */
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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_MCU_DEVICE_PN_CFG_H_
8+
#define BSP_MCU_DEVICE_PN_CFG_H_
9+
#define BSP_PACKAGE_PINS (144)
10+
#endif /* BSP_MCU_DEVICE_PN_CFG_H_ */

0 commit comments

Comments
 (0)