Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2345VOR
rt-thread
提交
ff45ee7b
R
rt-thread
项目概览
2345VOR
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ff45ee7b
编写于
10月 27, 2021
作者:
S
Sherman
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[fix] 格式化代码风格
上级
ec311ee5
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
39 addition
and
39 deletion
+39
-39
bsp/ra6m4-cpk/drivers/drv_common.c
bsp/ra6m4-cpk/drivers/drv_common.c
+5
-5
bsp/ra6m4-cpk/drivers/drv_common.h
bsp/ra6m4-cpk/drivers/drv_common.h
+1
-1
bsp/ra6m4-cpk/drivers/drv_soft_i2c.c
bsp/ra6m4-cpk/drivers/drv_soft_i2c.c
+13
-13
bsp/ra6m4-cpk/drivers/drv_usart_v2.c
bsp/ra6m4-cpk/drivers/drv_usart_v2.c
+12
-12
bsp/ra6m4-cpk/drivers/drv_usart_v2.h
bsp/ra6m4-cpk/drivers/drv_usart_v2.h
+2
-2
bsp/ra6m4-cpk/drivers/drv_wdt.c
bsp/ra6m4-cpk/drivers/drv_wdt.c
+6
-6
未找到文件。
bsp/ra6m4-cpk/drivers/drv_common.c
浏览文件 @
ff45ee7b
...
...
@@ -17,11 +17,11 @@
#endif
#ifdef RT_USING_SERIAL
#ifdef RT_USING_SERIAL_V2
#include <drv_usart_v2.h>
#else
#include <drv_usart.h>
#endif
#ifdef RT_USING_SERIAL_V2
#include <drv_usart_v2.h>
#else
#include <drv_usart.h>
#endif
#endif
#ifdef RT_USING_FINSH
...
...
bsp/ra6m4-cpk/drivers/drv_common.h
浏览文件 @
ff45ee7b
...
...
@@ -14,7 +14,7 @@
#include <rtthread.h>
#include <rthw.h>
#ifdef RT_USING_DEVICE
#include <rtdevice.h>
#include <rtdevice.h>
#endif
#ifdef __cplusplus
...
...
bsp/ra6m4-cpk/drivers/drv_soft_i2c.c
浏览文件 @
ff45ee7b
...
...
@@ -16,14 +16,14 @@
#define DBG_TAG "drv.i2c"
#ifdef DRV_DEBUG
#define DBG_LVL DBG_LOG
#define DBG_LVL DBG_LOG
#else
#define DBG_LVL DBG_INFO
#define DBG_LVL DBG_INFO
#endif
/* DRV_DEBUG */
#if !defined(BSP_USING_I2C0) && !defined(BSP_USING_I2C1)
#error "Please define at least one BSP_USING_I2Cx"
/* this driver can be disabled at menuconfig → RT-Thread Components → Device Drivers */
#error "Please define at least one BSP_USING_I2Cx"
/* this driver can be disabled at menuconfig → RT-Thread Components → Device Drivers */
#endif
static
const
struct
ra_soft_i2c_config
soft_i2c_config
[]
=
...
...
@@ -45,7 +45,7 @@ static struct ra_i2c i2c_obj[sizeof(soft_i2c_config) / sizeof(soft_i2c_config[0]
*/
static
void
ra_i2c_gpio_init
(
struct
ra_i2c
*
i2c
)
{
struct
ra_soft_i2c_config
*
cfg
=
(
struct
ra_soft_i2c_config
*
)
i2c
->
ops
.
data
;
struct
ra_soft_i2c_config
*
cfg
=
(
struct
ra_soft_i2c_config
*
)
i2c
->
ops
.
data
;
rt_pin_mode
(
cfg
->
scl
,
PIN_MODE_OUTPUT_OD
);
rt_pin_mode
(
cfg
->
sda
,
PIN_MODE_OUTPUT_OD
);
...
...
@@ -62,7 +62,7 @@ static void ra_i2c_gpio_init(struct ra_i2c *i2c)
*/
static
void
ra_set_sda
(
void
*
data
,
rt_int32_t
state
)
{
struct
ra_soft_i2c_config
*
cfg
=
(
struct
ra_soft_i2c_config
*
)
data
;
struct
ra_soft_i2c_config
*
cfg
=
(
struct
ra_soft_i2c_config
*
)
data
;
if
(
state
)
{
rt_pin_write
(
cfg
->
sda
,
PIN_HIGH
);
...
...
@@ -81,7 +81,7 @@ static void ra_set_sda(void *data, rt_int32_t state)
*/
static
void
ra_set_scl
(
void
*
data
,
rt_int32_t
state
)
{
struct
ra_soft_i2c_config
*
cfg
=
(
struct
ra_soft_i2c_config
*
)
data
;
struct
ra_soft_i2c_config
*
cfg
=
(
struct
ra_soft_i2c_config
*
)
data
;
if
(
state
)
{
rt_pin_write
(
cfg
->
scl
,
PIN_HIGH
);
...
...
@@ -99,7 +99,7 @@ static void ra_set_scl(void *data, rt_int32_t state)
*/
static
rt_int32_t
ra_get_sda
(
void
*
data
)
{
struct
ra_soft_i2c_config
*
cfg
=
(
struct
ra_soft_i2c_config
*
)
data
;
struct
ra_soft_i2c_config
*
cfg
=
(
struct
ra_soft_i2c_config
*
)
data
;
return
rt_pin_read
(
cfg
->
sda
);
}
...
...
@@ -110,7 +110,7 @@ static rt_int32_t ra_get_sda(void *data)
*/
static
rt_int32_t
ra_get_scl
(
void
*
data
)
{
struct
ra_soft_i2c_config
*
cfg
=
(
struct
ra_soft_i2c_config
*
)
data
;
struct
ra_soft_i2c_config
*
cfg
=
(
struct
ra_soft_i2c_config
*
)
data
;
return
rt_pin_read
(
cfg
->
scl
);
}
/**
...
...
@@ -198,7 +198,7 @@ int rt_hw_i2c_init(void)
for
(
int
i
=
0
;
i
<
obj_num
;
i
++
)
{
i2c_obj
[
i
].
ops
=
ra_bit_ops_default
;
i2c_obj
[
i
].
ops
.
data
=
(
void
*
)
&
soft_i2c_config
[
i
];
i2c_obj
[
i
].
ops
.
data
=
(
void
*
)
&
soft_i2c_config
[
i
];
i2c_obj
[
i
].
i2c2_bus
.
priv
=
&
i2c_obj
[
i
].
ops
;
ra_i2c_gpio_init
(
&
i2c_obj
[
i
]);
result
=
rt_i2c_bit_add_bus
(
&
i2c_obj
[
i
].
i2c2_bus
,
soft_i2c_config
[
i
].
bus_name
);
...
...
@@ -206,9 +206,9 @@ int rt_hw_i2c_init(void)
ra_i2c_bus_unlock
(
&
soft_i2c_config
[
i
]);
LOG_D
(
"software simulation %s init done, pin scl: %d, pin sda %d"
,
soft_i2c_config
[
i
].
bus_name
,
soft_i2c_config
[
i
].
scl
,
soft_i2c_config
[
i
].
sda
);
soft_i2c_config
[
i
].
bus_name
,
soft_i2c_config
[
i
].
scl
,
soft_i2c_config
[
i
].
sda
);
}
return
RT_EOK
;
...
...
bsp/ra6m4-cpk/drivers/drv_usart_v2.c
浏览文件 @
ff45ee7b
...
...
@@ -15,9 +15,9 @@
//#define DRV_DEBUG
#define DBG_TAG "drv.usart"
#ifdef DRV_DEBUG
#define DBG_LVL DBG_LOG
#define DBG_LVL DBG_LOG
#else
#define DBG_LVL DBG_INFO
#define DBG_LVL DBG_INFO
#endif
/* DRV_DEBUG */
#include <rtdbg.h>
...
...
@@ -81,7 +81,7 @@ static rt_err_t ra_uart_configure(struct rt_serial_device *serial, struct serial
uart
=
rt_container_of
(
serial
,
struct
ra_uart
,
serial
);
RT_ASSERT
(
uart
!=
RT_NULL
);
err
=
R_SCI_UART_Open
(
uart
->
config
->
p_api_ctrl
,
uart
->
config
->
p_cfg
);
err
=
R_SCI_UART_Open
(
uart
->
config
->
p_api_ctrl
,
uart
->
config
->
p_cfg
);
if
(
FSP_SUCCESS
!=
err
)
{
return
RT_ERROR
;
...
...
@@ -103,10 +103,10 @@ static int ra_uart_putc(struct rt_serial_device *serial, char c)
uart
=
rt_container_of
(
serial
,
struct
ra_uart
,
serial
);
RT_ASSERT
(
uart
!=
RT_NULL
);
sci_uart_instance_ctrl_t
*
p_ctrl
=
(
sci_uart_instance_ctrl_t
*
)
uart
->
config
->
p_api_ctrl
;
sci_uart_instance_ctrl_t
*
p_ctrl
=
(
sci_uart_instance_ctrl_t
*
)
uart
->
config
->
p_api_ctrl
;
p_ctrl
->
p_reg
->
TDR
=
c
;
while
((
p_ctrl
->
p_reg
->
SSR_b
.
TEND
)
==
0
);
while
((
p_ctrl
->
p_reg
->
SSR_b
.
TEND
)
==
0
);
return
RT_EOK
;
}
...
...
@@ -125,13 +125,13 @@ void uart7_isr_cb(uart_callback_args_t *p_args)
struct
rt_serial_device
*
serial
=
&
uart_obj
[
0
].
serial
;
RT_ASSERT
(
serial
!=
RT_NULL
);
if
(
UART_EVENT_RX_CHAR
==
p_args
->
event
)
if
(
UART_EVENT_RX_CHAR
==
p_args
->
event
)
{
struct
rt_serial_rx_fifo
*
rx_fifo
;
rx_fifo
=
(
struct
rt_serial_rx_fifo
*
)
serial
->
serial_rx
;
RT_ASSERT
(
rx_fifo
!=
RT_NULL
);
rt_ringbuffer_putchar
(
&
(
rx_fifo
->
rb
),
(
rt_uint8_t
)
p_args
->
data
);
rt_ringbuffer_putchar
(
&
(
rx_fifo
->
rb
),
(
rt_uint8_t
)
p_args
->
data
);
rt_hw_serial_isr
(
serial
,
RT_SERIAL_EVENT_RX_IND
);
}
...
...
@@ -149,13 +149,13 @@ void uart1_isr_cb(uart_callback_args_t *p_args)
struct
rt_serial_device
*
serial
=
&
uart_obj
[
1
].
serial
;
RT_ASSERT
(
serial
!=
RT_NULL
);
if
(
UART_EVENT_RX_CHAR
==
p_args
->
event
)
if
(
UART_EVENT_RX_CHAR
==
p_args
->
event
)
{
struct
rt_serial_rx_fifo
*
rx_fifo
;
rx_fifo
=
(
struct
rt_serial_rx_fifo
*
)
serial
->
serial_rx
;
RT_ASSERT
(
rx_fifo
!=
RT_NULL
);
rt_ringbuffer_putchar
(
&
(
rx_fifo
->
rb
),
(
rt_uint8_t
)
p_args
->
data
);
rt_ringbuffer_putchar
(
&
(
rx_fifo
->
rb
),
(
rt_uint8_t
)
p_args
->
data
);
rt_hw_serial_isr
(
serial
,
RT_SERIAL_EVENT_RX_IND
);
}
...
...
@@ -187,9 +187,9 @@ int rt_hw_usart_init(void)
uart_obj
[
i
].
serial
.
ops
=
&
ra_uart_ops
;
/* register UART device */
result
=
rt_hw_serial_register
(
&
uart_obj
[
i
].
serial
,
uart_obj
[
i
].
config
->
name
,
RT_DEVICE_FLAG_RDWR
,
NULL
);
uart_obj
[
i
].
config
->
name
,
RT_DEVICE_FLAG_RDWR
,
NULL
);
RT_ASSERT
(
result
==
RT_EOK
);
}
...
...
bsp/ra6m4-cpk/drivers/drv_usart_v2.h
浏览文件 @
ff45ee7b
...
...
@@ -22,8 +22,8 @@
struct
ra_uart_config
{
const
char
*
name
;
uart_ctrl_t
*
const
p_api_ctrl
;
uart_cfg_t
const
*
const
p_cfg
;
uart_ctrl_t
*
const
p_api_ctrl
;
uart_cfg_t
const
*
const
p_cfg
;
};
struct
ra_uart
...
...
bsp/ra6m4-cpk/drivers/drv_wdt.c
浏览文件 @
ff45ee7b
...
...
@@ -34,30 +34,30 @@ static rt_err_t wdt_control(rt_watchdog_t *wdt, int cmd, void *arg)
struct
st_wdt_timeout_values
*
wdt_value
=
{
0
};
switch
(
cmd
)
{
/* feed the watchdog */
/* feed the watchdog */
case
RT_DEVICE_CTRL_WDT_KEEPALIVE
:
if
(
R_WDT_Refresh
(
&
g_wdt_ctrl
)
!=
FSP_SUCCESS
)
if
(
R_WDT_Refresh
(
&
g_wdt_ctrl
)
!=
FSP_SUCCESS
)
{
LOG_E
(
"watch dog keepalive fail."
);
}
break
;
/* set watchdog timeout */
/* set watchdog timeout */
case
RT_DEVICE_CTRL_WDT_SET_TIMEOUT
:
/**< set*/
// g_wdt_cfg.timeout = *(rt_uint32_t *)arg;
break
;
case
RT_DEVICE_CTRL_WDT_GET_TIMEOUT
:
wdt_value
=
(
struct
st_wdt_timeout_values
*
)
arg
;
if
(
R_WDT_TimeoutGet
(
&
g_wdt_ctrl
,
wdt_value
)
!=
FSP_SUCCESS
)
if
(
R_WDT_TimeoutGet
(
&
g_wdt_ctrl
,
wdt_value
)
!=
FSP_SUCCESS
)
{
LOG_E
(
"wdt get timeout failed."
);
return
-
RT_ERROR
;
}
break
;
case
RT_DEVICE_CTRL_WDT_START
:
if
(
R_WDT_Open
(
&
g_wdt_ctrl
,
&
g_wdt_cfg
)
==
FSP_SUCCESS
)
if
(
R_WDT_Open
(
&
g_wdt_ctrl
,
&
g_wdt_cfg
)
==
FSP_SUCCESS
)
{
if
(
R_WDT_Refresh
(
&
g_wdt_ctrl
)
!=
FSP_SUCCESS
)
if
(
R_WDT_Refresh
(
&
g_wdt_ctrl
)
!=
FSP_SUCCESS
)
{
LOG_E
(
"wdt start failed."
);
return
-
RT_ERROR
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录