Skip to content

Commit 70c9e39

Browse files
committed
添加RA RAW61 BSP
1 parent b7eb6fb commit 70c9e39

195 files changed

Lines changed: 121521 additions & 5 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bsp/renesas/libraries/HAL_Drivers/drivers/config/drv_config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ extern "C"
263263
#endif
264264
#endif /* SOC_SERIES_R7FA6E2 */
265265

266+
#if defined(SOC_SERIES_R7SA6W1)
267+
#include "ra6w1/uart_config.h"
268+
#endif /* SOC_SERIES_R7SA6W1 */
269+
266270
#if defined(SOC_SERIES_R7FA2A1)
267271
#include "ra2a1/uart_config.h"
268272

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2006-2025, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2021-07-29 KyleChan first version
9+
*/
10+
11+
#ifndef __RA6W1_UART_CONFIG_H__
12+
#define __RA6W1_UART_CONFIG_H__
13+
14+
#include <rtthread.h>
15+
#include "hal_data.h"
16+
17+
#ifdef __cplusplus
18+
extern "C" {
19+
#endif
20+
21+
#if defined(BSP_USING_UART0)
22+
#ifndef UART0_CONFIG
23+
#define UART0_CONFIG \
24+
{ \
25+
.name = "uart0", \
26+
.p_api_ctrl = &g_uart0_ctrl, \
27+
.p_cfg = &g_uart0_cfg, \
28+
}
29+
#endif /* UART0_CONFIG */
30+
#endif /* BSP_USING_UART0 */
31+
32+
#ifdef __cplusplus
33+
}
34+
#endif
35+
36+
#endif /* __RA6W1_UART_CONFIG_H__ */

bsp/renesas/libraries/HAL_Drivers/drivers/drv_usart_v2.c

Lines changed: 65 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,17 @@ static rt_err_t ra_uart_configure(struct rt_serial_device *serial, struct serial
211211
uart = rt_container_of(serial, struct ra_uart, serial);
212212
RT_ASSERT(uart != RT_NULL);
213213

214-
#if defined(SOC_SERIES_R7FA8M85) || defined(SOC_SERIES_R7KA8P1)
214+
#if defined(SOC_SERIES_R7SA6W1)
215+
uart_w_extended_cfg_t *p_extend = (uart_w_extended_cfg_t *)uart->config->p_cfg->p_extend;
216+
RT_ASSERT(p_extend != RT_NULL);
217+
RT_ASSERT(p_extend->p_baud_setting != RT_NULL);
218+
219+
err = R_UART_W_BaudCalculate(cfg->baud_rate, p_extend->p_baud_setting);
220+
if (FSP_SUCCESS == err)
221+
{
222+
err = R_UART_W_Open(uart->config->p_api_ctrl, uart->config->p_cfg);
223+
}
224+
#elif defined(SOC_SERIES_R7FA8M85) || defined(SOC_SERIES_R7KA8P1)
215225
err = R_SCI_B_UART_Open(uart->config->p_api_ctrl, uart->config->p_cfg);
216226
#else
217227
err = R_SCI_UART_Open(uart->config->p_api_ctrl, uart->config->p_cfg);
@@ -237,26 +247,66 @@ static int ra_uart_putc(struct rt_serial_device *serial, char c)
237247
uart = rt_container_of(serial, struct ra_uart, serial);
238248
RT_ASSERT(uart != RT_NULL);
239249

240-
#if defined(SOC_SERIES_R7FA8M85) || defined(SOC_SERIES_R7KA8P1)
250+
#if defined(SOC_SERIES_R7SA6W1)
251+
uart_w_instance_ctrl_t *p_ctrl = (uart_w_instance_ctrl_t *)uart->config->p_api_ctrl;
252+
253+
if (!R_UART_W_IsOpened(uart->config->p_api_ctrl))
254+
{
255+
return -1;
256+
}
257+
258+
while (p_ctrl->p_reg->UART_FR_REG_b.TXFF)
259+
{
260+
}
261+
262+
(*(volatile rt_uint8_t *) &p_ctrl->p_reg->UART_DR_REG) = (rt_uint8_t)c;
263+
264+
while (p_ctrl->p_reg->UART_FR_REG_b.BUSY)
265+
{
266+
}
267+
#elif defined(SOC_SERIES_R7FA8M85) || defined(SOC_SERIES_R7KA8P1)
241268
sci_b_uart_instance_ctrl_t *p_ctrl = (sci_b_uart_instance_ctrl_t *)uart->config->p_api_ctrl;
269+
270+
p_ctrl->p_reg->TDR = c;
271+
272+
while ((p_ctrl->p_reg->CSR_b.TEND) == 0);
242273
#else
243274
sci_uart_instance_ctrl_t *p_ctrl = (sci_uart_instance_ctrl_t *)uart->config->p_api_ctrl;
244-
#endif
245275

246276
p_ctrl->p_reg->TDR = c;
247277

248-
#if defined(SOC_SERIES_R7FA8M85) || defined(SOC_SERIES_R9A07G0) || defined(SOC_SERIES_R7KA8P1)
278+
#if defined(SOC_SERIES_R9A07G0)
249279
while ((p_ctrl->p_reg->CSR_b.TEND) == 0);
250-
#else
280+
#else
251281
while ((p_ctrl->p_reg->SSR_b.TEND) == 0);
282+
#endif
252283
#endif
253284

254285
return RT_EOK;
255286
}
256287

257288
static int ra_uart_getc(struct rt_serial_device *serial)
258289
{
290+
#if defined(SOC_SERIES_R7SA6W1)
291+
struct ra_uart *uart;
292+
uart_w_instance_ctrl_t *p_ctrl;
293+
294+
RT_ASSERT(serial != RT_NULL);
295+
296+
uart = rt_container_of(serial, struct ra_uart, serial);
297+
RT_ASSERT(uart != RT_NULL);
298+
299+
p_ctrl = (uart_w_instance_ctrl_t *)uart->config->p_api_ctrl;
300+
301+
if (!R_UART_W_IsOpened(uart->config->p_api_ctrl) || p_ctrl->p_reg->UART_FR_REG_b.RXFE)
302+
{
303+
return -1;
304+
}
305+
306+
return (int)(*(volatile rt_uint8_t *) &p_ctrl->p_reg->UART_DR_REG);
307+
#else
259308
return RT_EOK;
309+
#endif
260310
}
261311

262312
static rt_ssize_t ra_uart_transmit(struct rt_serial_device *serial,
@@ -271,7 +321,17 @@ static rt_ssize_t ra_uart_transmit(struct rt_serial_device *serial,
271321
uart = rt_container_of(serial, struct ra_uart, serial);
272322
RT_ASSERT(uart != RT_NULL);
273323

324+
#if defined(SOC_SERIES_R7SA6W1)
325+
RT_UNUSED(uart);
326+
RT_UNUSED(tx_flag);
327+
328+
for (rt_size_t i = 0; i < size; i++)
329+
{
330+
ra_uart_putc(serial, (char)buf[i]);
331+
}
332+
#else
274333
ra_uart_control(serial, RT_DEVICE_CTRL_SET_INT, (void *)tx_flag);
334+
#endif
275335

276336
return size;
277337
}

bsp/renesas/libraries/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ config SOC_SERIES_R7FA6E2
7979
select SOC_FAMILY_RENESAS_RA
8080
default n
8181

82+
config SOC_SERIES_R7SA6W1
83+
bool
84+
select ARCH_ARM_CORTEX_M33
85+
select SOC_FAMILY_RENESAS_RA
86+
default n
87+
8288
config SOC_SERIES_R7FA2A1
8389
bool
8490
select ARCH_ARM_CORTEX_M23

0 commit comments

Comments
 (0)