Skip to content

Commit 2585822

Browse files
khoa-nguyen-18KhiemNguyenT
authored andcommitted
hal: renesas: Add support for Renesas RA8P1
Add support for Renesas RA8P1 Signed-off-by: Khoa Nguyen <[email protected]>
1 parent 69a713b commit 2585822

File tree

15 files changed

+191360
-0
lines changed

15 files changed

+191360
-0
lines changed

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

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

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

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

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ extern "C" {
9696
#include "R7FA8M1AH.h"
9797
#elif BSP_MCU_GROUP_RA8D1
9898
#include "R7FA8D1BH.h"
99+
#elif BSP_MCU_GROUP_RA8P1
100+
#if 0U == BSP_CFG_CPU_CORE
101+
#include "R7KA8P1KF_core0.h"
102+
#elif 1U == BSP_CFG_CPU_CORE
103+
#include "R7KA8P1KF_core1.h"
104+
#else
105+
#warning "Unsupported CPU number"
106+
#endif
99107
#elif BSP_MCU_GROUP_RA8T1
100108
#include "R7FA8T1AH.h"
101109
#elif BSP_MCU_GROUP_RA8E1

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

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

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

Lines changed: 617 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright (c) 2020 - 2025 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_RA8P1 RA8P1
10+
* @{
11+
**********************************************************************************************************************/
12+
13+
// RA8P1_TODO: includedoc config_bsp_ra8p1_fsp.html
14+
15+
/** @} (end defgroup BSP_MCU_RA8P1) */
16+
17+
#ifndef BSP_MCU_INFO_H
18+
#define BSP_MCU_INFO_H
19+
20+
/***********************************************************************************************************************
21+
* Includes <System Includes> , "Project Includes"
22+
**********************************************************************************************************************/
23+
24+
/* BSP MCU Specific Includes. */
25+
#include "bsp_elc.h"
26+
#include "bsp_feature.h"
27+
28+
/***********************************************************************************************************************
29+
* Macro definitions
30+
**********************************************************************************************************************/
31+
32+
/***********************************************************************************************************************
33+
* Typedef definitions
34+
**********************************************************************************************************************/
35+
typedef elc_event_t bsp_interrupt_event_t;
36+
37+
/***********************************************************************************************************************
38+
* Exported global variables
39+
**********************************************************************************************************************/
40+
41+
/***********************************************************************************************************************
42+
* Exported global functions (to be accessed by other files)
43+
**********************************************************************************************************************/
44+
45+
#endif
Lines changed: 298 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,298 @@
1+
/*
2+
* Copyright (c) 2020 - 2025 Renesas Electronics Corporation and/or its affiliates
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
/*******************************************************************************************************************//**
8+
* @addtogroup BSP_MCU_RA8P1
9+
* @{
10+
**********************************************************************************************************************/
11+
12+
/** @} (end addtogroup BSP_MCU_RA8P1) */
13+
14+
#ifndef BSP_OVERRIDE_H
15+
#define BSP_OVERRIDE_H
16+
17+
/***********************************************************************************************************************
18+
* Includes <System Includes> , "Project Includes"
19+
**********************************************************************************************************************/
20+
21+
#if __has_include("r_lpm_device_types.h")
22+
#include "r_lpm_device_types.h"
23+
#endif
24+
25+
/***********************************************************************************************************************
26+
* Macro definitions
27+
**********************************************************************************************************************/
28+
29+
/* Define overrides required for this MCU. */
30+
31+
#define BSP_OVERRIDE_CGC_DIVIDER_CFG_T
32+
#define BSP_OVERRIDE_CGC_SYS_CLOCK_DIV_T
33+
#define BSP_OVERRIDE_GROUP_IRQ_T
34+
#define BSP_OVERRIDE_IOPORT_PERIPHERAL_T
35+
#define BSP_OVERRIDE_LVD_PERIPHERAL_T
36+
37+
/* Override definitions. */
38+
39+
/* Private definition to set enumeration values. */
40+
#define IOPORT_PRV_PFS_PSEL_OFFSET (24)
41+
42+
/***********************************************************************************************************************
43+
* Typedef definitions
44+
**********************************************************************************************************************/
45+
46+
/** System clock divider values - The individually selectable divider of each of the system clocks, ICLK, BCLK, FCLK,
47+
* PCLKS A-D. */
48+
typedef enum e_cgc_sys_clock_div
49+
{
50+
CGC_SYS_CLOCK_DIV_1 = 0, ///< System clock divided by 1
51+
CGC_SYS_CLOCK_DIV_2 = 1, ///< System clock divided by 2
52+
CGC_SYS_CLOCK_DIV_4 = 2, ///< System clock divided by 4
53+
CGC_SYS_CLOCK_DIV_8 = 3, ///< System clock divided by 8
54+
CGC_SYS_CLOCK_DIV_16 = 4, ///< System clock divided by 16
55+
CGC_SYS_CLOCK_DIV_32 = 5, ///< System clock divided by 32
56+
CGC_SYS_CLOCK_DIV_64 = 6, ///< System clock divided by 64
57+
CGC_SYS_CLOCK_DIV_3 = 8, ///< System clock divided by 3
58+
CGC_SYS_CLOCK_DIV_6 = 9, ///< System clock divided by 6
59+
CGC_SYS_CLOCK_DIV_12 = 10, ///< System clock divided by 12
60+
CGC_SYS_CLOCK_DIV_24 = 11, ///< System clock divided by 24
61+
} cgc_sys_clock_div_t;
62+
63+
/** Clock configuration structure - Used as an input parameter to the @ref cgc_api_t::systemClockSet and @ref cgc_api_t::systemClockGet
64+
* functions. */
65+
typedef struct st_cgc_divider_cfg
66+
{
67+
union
68+
{
69+
uint32_t sckdivcr_w; ///< System clock Division control register
70+
71+
struct
72+
{
73+
cgc_sys_clock_div_t pclkd_div : 4; ///< Divider value for PCLKD
74+
cgc_sys_clock_div_t pclkc_div : 4; ///< Divider value for PCLKC
75+
cgc_sys_clock_div_t pclkb_div : 4; ///< Divider value for PCLKB
76+
cgc_sys_clock_div_t pclka_div : 4; ///< Divider value for PCLKA
77+
cgc_sys_clock_div_t bclk_div : 4; ///< Divider value for BCLK
78+
cgc_sys_clock_div_t pclke_div : 4; ///< Divider value for PCLKE
79+
cgc_sys_clock_div_t iclk_div : 4; ///< Divider value for ICLK
80+
cgc_sys_clock_div_t fclk_div : 4; ///< Divider value for FCLK
81+
} sckdivcr_b;
82+
};
83+
84+
union
85+
{
86+
uint16_t sckdivcr2; ///< System clock Division control register 2
87+
88+
struct
89+
{
90+
cgc_sys_clock_div_t cpuclk_div : 4; ///< Divider value for CPUCLK0
91+
cgc_sys_clock_div_t cpuclk1_div : 4; ///< Divider value for CPUCLK1
92+
cgc_sys_clock_div_t npuclk_div : 4; ///< Divider value for NPUCLK
93+
cgc_sys_clock_div_t mriclk_div : 4; ///< Divider value for MRICLK
94+
} sckdivcr2_b;
95+
};
96+
} cgc_divider_cfg_t;
97+
98+
/* Which interrupts can have callbacks registered. */
99+
typedef enum e_bsp_grp_irq
100+
{
101+
BSP_GRP_IRQ_IWDT_ERROR = 0, ///< IWDT underflow/refresh error has occurred
102+
BSP_GRP_IRQ_WDT_ERROR = 1, ///< WDT underflow/refresh error has occurred
103+
BSP_GRP_IRQ_LVD1 = 2, ///< Voltage monitoring 1 interrupt
104+
BSP_GRP_IRQ_LVD2 = 3, ///< Voltage monitoring 2 interrupt
105+
BSP_GRP_IRQ_SOSC_STOP_DETECT = 5, ///< Sub Oscillation stop is detected
106+
BSP_GRP_IRQ_OSC_STOP_DETECT = 6, ///< Oscillation stop is detected
107+
BSP_GRP_IRQ_NMI_PIN = 7, ///< NMI Pin interrupt
108+
BSP_GRP_IRQ_MPU_BUS_TZF = 12, ///< MPU Bus or TrustZone Filter Error
109+
BSP_GRP_IRQ_COMMON_MEMORY = 13, ///< SRAM ECC or SRAM Parity Error
110+
BSP_GRP_IRQ_LOCAL_MEMORY = 14, ///< Local Memory Error
111+
BSP_GRP_IRQ_LOCKUP = 15, ///< LockUp Error
112+
BSP_GRP_IRQ_FPU = 16, ///< FPU Exception
113+
BSP_GRP_IRQ_MRC = 17, ///< MRAM Code read error
114+
BSP_GRP_IRQ_MRE = 18, ///< MRAM Extra read error
115+
BSP_GRP_IRQ_IPC = 20, ///< IPC Interrupt
116+
} bsp_grp_irq_t;
117+
118+
/** Superset of all peripheral functions. */
119+
typedef enum e_ioport_peripheral
120+
{
121+
/** Pin will functions as an IO pin */
122+
IOPORT_PERIPHERAL_IO = 0x00,
123+
124+
/** Pin will function as a DEBUG pin */
125+
IOPORT_PERIPHERAL_DEBUG = (0x00UL << IOPORT_PRV_PFS_PSEL_OFFSET),
126+
127+
/** Pin will function as an AGT peripheral pin */
128+
IOPORT_PERIPHERAL_AGT = (0x01UL << IOPORT_PRV_PFS_PSEL_OFFSET),
129+
130+
/** Pin will function as an AGT peripheral pin */
131+
IOPORT_PERIPHERAL_AGTW = (0x01UL << IOPORT_PRV_PFS_PSEL_OFFSET),
132+
133+
/** Pin will function as an AGT peripheral pin */
134+
IOPORT_PERIPHERAL_AGT1 = (0x18UL << IOPORT_PRV_PFS_PSEL_OFFSET),
135+
136+
/** Pin will function as a GPT peripheral pin */
137+
IOPORT_PERIPHERAL_GPT0 = (0x02UL << IOPORT_PRV_PFS_PSEL_OFFSET),
138+
139+
/** Pin will function as a GPT peripheral pin */
140+
IOPORT_PERIPHERAL_GPT1 = (0x03UL << IOPORT_PRV_PFS_PSEL_OFFSET),
141+
142+
/** Pin will function as an SCI peripheral pin */
143+
IOPORT_PERIPHERAL_SCI0_2_4_6_8 = (0x04UL << IOPORT_PRV_PFS_PSEL_OFFSET),
144+
145+
/** Pin will function as an SCI peripheral pin */
146+
IOPORT_PERIPHERAL_SCI1_3_5_7_9 = (0x05UL << IOPORT_PRV_PFS_PSEL_OFFSET),
147+
148+
/** Pin will function as a SPI peripheral pin */
149+
IOPORT_PERIPHERAL_SPI = (0x06UL << IOPORT_PRV_PFS_PSEL_OFFSET),
150+
151+
/** Pin will function as a IIC peripheral pin */
152+
IOPORT_PERIPHERAL_IIC = (0x07UL << IOPORT_PRV_PFS_PSEL_OFFSET),
153+
154+
/** Pin will function as a KEY peripheral pin */
155+
IOPORT_PERIPHERAL_KEY = (0x08UL << IOPORT_PRV_PFS_PSEL_OFFSET),
156+
157+
/** Pin will function as a clock/comparator/RTC peripheral pin */
158+
IOPORT_PERIPHERAL_CLKOUT_COMP_RTC = (0x09UL << IOPORT_PRV_PFS_PSEL_OFFSET),
159+
160+
/** Pin will function as a CAC/ADC peripheral pin */
161+
IOPORT_PERIPHERAL_CAC_AD = (0x0AUL << IOPORT_PRV_PFS_PSEL_OFFSET),
162+
163+
/** Pin will function as a BUS peripheral pin */
164+
IOPORT_PERIPHERAL_BUS = (0x0BUL << IOPORT_PRV_PFS_PSEL_OFFSET),
165+
166+
/** Pin will function as a CTSU peripheral pin */
167+
IOPORT_PERIPHERAL_CTSU = (0x0CUL << IOPORT_PRV_PFS_PSEL_OFFSET),
168+
169+
/** Pin will function as a CMPHS peripheral pin */
170+
IOPORT_PERIPHERAL_ACMPHS = (0x0CUL << IOPORT_PRV_PFS_PSEL_OFFSET),
171+
172+
/** Pin will function as a segment LCD peripheral pin */
173+
IOPORT_PERIPHERAL_LCDC = (0x0DUL << IOPORT_PRV_PFS_PSEL_OFFSET),
174+
175+
#if BSP_FEATURE_SCI_UART_DE_IS_INVERTED
176+
177+
/** Pin will function as an SCI peripheral DEn pin */
178+
IOPORT_PERIPHERAL_DE_SCI1_3_5_7_9 = (0x0DUL << IOPORT_PRV_PFS_PSEL_OFFSET),
179+
180+
/** Pin will function as an SCI DEn peripheral pin */
181+
IOPORT_PERIPHERAL_DE_SCI0_2_4_6_8 = (0x0EUL << IOPORT_PRV_PFS_PSEL_OFFSET),
182+
#else
183+
184+
/** Pin will function as an SCI peripheral DEn pin */
185+
IOPORT_PERIPHERAL_DE_SCI0_2_4_6_8 = (0x0DUL << IOPORT_PRV_PFS_PSEL_OFFSET),
186+
187+
/** Pin will function as an SCI DEn peripheral pin */
188+
IOPORT_PERIPHERAL_DE_SCI1_3_5_7_9 = (0x0EUL << IOPORT_PRV_PFS_PSEL_OFFSET),
189+
#endif
190+
191+
/** Pin will function as a DALI peripheral pin */
192+
IOPORT_PERIPHERAL_DALI = (0x0EUL << IOPORT_PRV_PFS_PSEL_OFFSET),
193+
194+
/** Pin will function as a CEU peripheral pin */
195+
IOPORT_PERIPHERAL_CEU = (0x0FUL << IOPORT_PRV_PFS_PSEL_OFFSET),
196+
197+
/** Pin will function as a CAN peripheral pin */
198+
IOPORT_PERIPHERAL_CAN = (0x10UL << IOPORT_PRV_PFS_PSEL_OFFSET),
199+
200+
/** Pin will function as a QSPI peripheral pin */
201+
IOPORT_PERIPHERAL_QSPI = (0x11UL << IOPORT_PRV_PFS_PSEL_OFFSET),
202+
203+
/** Pin will function as an SSI peripheral pin */
204+
IOPORT_PERIPHERAL_SSI = (0x12UL << IOPORT_PRV_PFS_PSEL_OFFSET),
205+
206+
/** Pin will function as a USB full speed peripheral pin */
207+
IOPORT_PERIPHERAL_USB_FS = (0x13UL << IOPORT_PRV_PFS_PSEL_OFFSET),
208+
209+
/** Pin will function as a USB high speed peripheral pin */
210+
IOPORT_PERIPHERAL_USB_HS = (0x14UL << IOPORT_PRV_PFS_PSEL_OFFSET),
211+
212+
/** Pin will function as a GPT peripheral pin */
213+
IOPORT_PERIPHERAL_GPT2 = (0x14UL << IOPORT_PRV_PFS_PSEL_OFFSET),
214+
215+
/** Pin will function as an SD/MMC peripheral pin */
216+
IOPORT_PERIPHERAL_SDHI_MMC = (0x15UL << IOPORT_PRV_PFS_PSEL_OFFSET),
217+
218+
/** Pin will function as a GPT peripheral pin */
219+
IOPORT_PERIPHERAL_GPT3 = (0x15UL << IOPORT_PRV_PFS_PSEL_OFFSET),
220+
221+
/** Pin will function as an Ethernet MMI peripheral pin */
222+
IOPORT_PERIPHERAL_ETHER_MII = (0x16UL << IOPORT_PRV_PFS_PSEL_OFFSET),
223+
224+
/** Pin will function as a GPT peripheral pin */
225+
IOPORT_PERIPHERAL_GPT4 = (0x16UL << IOPORT_PRV_PFS_PSEL_OFFSET),
226+
227+
/** Pin will function as an Ethernet RMMI peripheral pin */
228+
IOPORT_PERIPHERAL_ETHER_RMII = (0x17UL << IOPORT_PRV_PFS_PSEL_OFFSET),
229+
230+
/** Pin will function as a PDC peripheral pin */
231+
IOPORT_PERIPHERAL_PDC = (0x18UL << IOPORT_PRV_PFS_PSEL_OFFSET),
232+
233+
/** Pin will function as a graphics LCD peripheral pin */
234+
IOPORT_PERIPHERAL_LCD_GRAPHICS = (0x19UL << IOPORT_PRV_PFS_PSEL_OFFSET),
235+
236+
/** Pin will function as a CAC peripheral pin */
237+
IOPORT_PERIPHERAL_CAC = (0x19UL << IOPORT_PRV_PFS_PSEL_OFFSET),
238+
239+
/** Pin will function as a debug trace peripheral pin */
240+
IOPORT_PERIPHERAL_TRACE = (0x1AUL << IOPORT_PRV_PFS_PSEL_OFFSET),
241+
242+
/** Pin will function as a OSPI peripheral pin */
243+
IOPORT_PERIPHERAL_OSPI = (0x1CUL << IOPORT_PRV_PFS_PSEL_OFFSET),
244+
245+
/** Pin will function as a CEC peripheral pin */
246+
IOPORT_PERIPHERAL_CEC = (0x1DUL << IOPORT_PRV_PFS_PSEL_OFFSET),
247+
248+
/** Pin will function as a PGAOUT peripheral pin */
249+
IOPORT_PERIPHERAL_PGAOUT0 = (0x1DUL << IOPORT_PRV_PFS_PSEL_OFFSET),
250+
251+
/** Pin will function as a PGAOUT peripheral pin */
252+
IOPORT_PERIPHERAL_PGAOUT1 = (0x1EUL << IOPORT_PRV_PFS_PSEL_OFFSET),
253+
254+
/** Pin will function as a ULPT peripheral pin */
255+
IOPORT_PERIPHERAL_ULPT = (0x1EUL << IOPORT_PRV_PFS_PSEL_OFFSET),
256+
257+
/** Pin will function as a MIPI DSI peripheral pin */
258+
IOPORT_PERIPHERAL_MIPI = (0x1FUL << IOPORT_PRV_PFS_PSEL_OFFSET),
259+
260+
/** Pin will function as a RGMII peripheral pin */
261+
IOPORT_PERIPHERAL_ETHER_RGMII = (0x18UL << IOPORT_PRV_PFS_PSEL_OFFSET),
262+
263+
/** Pin will function as a ETHERNET slave controller peripheral pin */
264+
IOPORT_PERIPHERAL_ESC = (0x1AUL << IOPORT_PRV_PFS_PSEL_OFFSET),
265+
266+
/** Pin will function as a PDM peripheral pin */
267+
IOPORT_PERIPHERAL_PDM = (0x1BUL << IOPORT_PRV_PFS_PSEL_OFFSET),
268+
} ioport_peripheral_t;
269+
270+
/** The thresholds supported by each MCU are in the MCU User's Manual as well as
271+
* in the r_lvd module description on the stack tab of the RA project. */
272+
typedef enum
273+
{
274+
LVD_THRESHOLD_MONITOR_LEVEL_3_86V = 0x03UL, ///< 3.86V
275+
LVD_THRESHOLD_MONITOR_LEVEL_3_14V = 0x04UL, ///< 3.14V
276+
LVD_THRESHOLD_MONITOR_LEVEL_3_10V = 0x05UL, ///< 3.10V
277+
LVD_THRESHOLD_MONITOR_LEVEL_3_08V = 0x06UL, ///< 3.08V
278+
LVD_THRESHOLD_MONITOR_LEVEL_2_85V = 0x07UL, ///< 2.85V
279+
LVD_THRESHOLD_MONITOR_LEVEL_2_83V = 0x08UL, ///< 2.83V
280+
LVD_THRESHOLD_MONITOR_LEVEL_2_80V = 0x09UL, ///< 2.80V
281+
LVD_THRESHOLD_MONITOR_LEVEL_2_62V = 0x0AUL, ///< 2.62V
282+
LVD_THRESHOLD_MONITOR_LEVEL_2_33V = 0x0BUL, ///< 2.33V
283+
LVD_THRESHOLD_MONITOR_LEVEL_1_90V = 0x0CUL, ///< 1.90V
284+
LVD_THRESHOLD_MONITOR_LEVEL_1_86V = 0x0DUL, ///< 1.86V
285+
LVD_THRESHOLD_MONITOR_LEVEL_1_74V = 0x0EUL, ///< 1.74V
286+
LVD_THRESHOLD_MONITOR_LEVEL_1_71V = 0x0FUL, ///< 1.71V
287+
LVD_THRESHOLD_NOT_AVAILABLE = 0xFFUL, ///< Not Used
288+
} lvd_threshold_t;
289+
290+
/***********************************************************************************************************************
291+
* Exported global variables
292+
**********************************************************************************************************************/
293+
294+
/***********************************************************************************************************************
295+
* Exported global functions (to be accessed by other files)
296+
**********************************************************************************************************************/
297+
298+
#endif

0 commit comments

Comments
 (0)