Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PHPmihuan
rt-thread
提交
1c95670b
R
rt-thread
项目概览
PHPmihuan
/
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,发现更多精彩内容 >>
提交
1c95670b
编写于
4月 29, 2022
作者:
mysterywolf
提交者:
guo
6月 22, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[rtdevices] eliminate recursion
上级
c13b0360
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
108 addition
and
93 deletion
+108
-93
components/drivers/include/drivers/hwtimer.h
components/drivers/include/drivers/hwtimer.h
+0
-1
components/drivers/include/drivers/mtd_nand.h
components/drivers/include/drivers/mtd_nand.h
+11
-58
components/drivers/include/drivers/mtd_nor.h
components/drivers/include/drivers/mtd_nor.h
+8
-25
components/drivers/include/drivers/pulse_encoder.h
components/drivers/include/drivers/pulse_encoder.h
+0
-1
components/drivers/include/drivers/rt_drv_pwm.h
components/drivers/include/drivers/rt_drv_pwm.h
+0
-1
components/drivers/include/drivers/rt_inputcapture.h
components/drivers/include/drivers/rt_inputcapture.h
+0
-1
components/drivers/misc/pulse_encoder.c
components/drivers/misc/pulse_encoder.c
+0
-1
components/drivers/misc/rt_drv_pwm.c
components/drivers/misc/rt_drv_pwm.c
+1
-1
components/drivers/misc/rt_inputcapture.c
components/drivers/misc/rt_inputcapture.c
+0
-2
components/drivers/mtd/mtd_nand.c
components/drivers/mtd/mtd_nand.c
+64
-1
components/drivers/mtd/mtd_nor.c
components/drivers/mtd/mtd_nor.c
+24
-1
未找到文件。
components/drivers/include/drivers/hwtimer.h
浏览文件 @
1c95670b
...
...
@@ -10,7 +10,6 @@
#define __HWTIMER_H__
#include <rtthread.h>
#include <rtdevice.h>
#ifdef __cplusplus
extern
"C"
{
...
...
components/drivers/include/drivers/mtd_nand.h
浏览文件 @
1c95670b
...
...
@@ -16,7 +16,7 @@
#ifndef __MTD_NAND_H__
#define __MTD_NAND_H__
#include <rt
device
.h>
#include <rt
thread
.h>
struct
rt_mtd_nand_driver_ops
;
#define RT_MTD_NAND_DEVICE(device) ((struct rt_mtd_nand_device*)(device))
...
...
@@ -73,68 +73,21 @@ struct rt_mtd_nand_driver_ops
};
rt_err_t
rt_mtd_nand_register_device
(
const
char
*
name
,
struct
rt_mtd_nand_device
*
device
);
rt_inline
rt_uint32_t
rt_mtd_nand_read_id
(
struct
rt_mtd_nand_device
*
device
)
{
RT_ASSERT
(
device
->
ops
->
read_id
);
return
device
->
ops
->
read_id
(
device
);
}
rt_inline
rt_err_t
rt_mtd_nand_read
(
rt_uint32_t
rt_mtd_nand_read_id
(
struct
rt_mtd_nand_device
*
device
);
rt_err_t
rt_mtd_nand_read
(
struct
rt_mtd_nand_device
*
device
,
rt_off_t
page
,
rt_uint8_t
*
data
,
rt_uint32_t
data_len
,
rt_uint8_t
*
spare
,
rt_uint32_t
spare_len
)
{
RT_ASSERT
(
device
->
ops
->
read_page
);
return
device
->
ops
->
read_page
(
device
,
page
,
data
,
data_len
,
spare
,
spare_len
);
}
rt_inline
rt_err_t
rt_mtd_nand_write
(
rt_uint8_t
*
spare
,
rt_uint32_t
spare_len
);
rt_err_t
rt_mtd_nand_write
(
struct
rt_mtd_nand_device
*
device
,
rt_off_t
page
,
const
rt_uint8_t
*
data
,
rt_uint32_t
data_len
,
const
rt_uint8_t
*
spare
,
rt_uint32_t
spare_len
)
{
RT_ASSERT
(
device
->
ops
->
write_page
);
return
device
->
ops
->
write_page
(
device
,
page
,
data
,
data_len
,
spare
,
spare_len
);
}
rt_inline
rt_err_t
rt_mtd_nand_move_page
(
struct
rt_mtd_nand_device
*
device
,
rt_off_t
src_page
,
rt_off_t
dst_page
)
{
RT_ASSERT
(
device
->
ops
->
move_page
);
return
device
->
ops
->
move_page
(
device
,
src_page
,
dst_page
);
}
rt_inline
rt_err_t
rt_mtd_nand_erase_block
(
struct
rt_mtd_nand_device
*
device
,
rt_uint32_t
block
)
{
RT_ASSERT
(
device
->
ops
->
erase_block
);
return
device
->
ops
->
erase_block
(
device
,
block
);
}
rt_inline
rt_err_t
rt_mtd_nand_check_block
(
struct
rt_mtd_nand_device
*
device
,
rt_uint32_t
block
)
{
if
(
device
->
ops
->
check_block
)
{
return
device
->
ops
->
check_block
(
device
,
block
);
}
else
{
return
-
RT_ENOSYS
;
}
}
rt_inline
rt_err_t
rt_mtd_nand_mark_badblock
(
struct
rt_mtd_nand_device
*
device
,
rt_uint32_t
block
)
{
if
(
device
->
ops
->
mark_badblock
)
{
return
device
->
ops
->
mark_badblock
(
device
,
block
);
}
else
{
return
-
RT_ENOSYS
;
}
}
const
rt_uint8_t
*
spare
,
rt_uint32_t
spare_len
);
rt_err_t
rt_mtd_nand_move_page
(
struct
rt_mtd_nand_device
*
device
,
rt_off_t
src_page
,
rt_off_t
dst_page
);
rt_err_t
rt_mtd_nand_erase_block
(
struct
rt_mtd_nand_device
*
device
,
rt_uint32_t
block
);
rt_err_t
rt_mtd_nand_check_block
(
struct
rt_mtd_nand_device
*
device
,
rt_uint32_t
block
);
rt_err_t
rt_mtd_nand_mark_badblock
(
struct
rt_mtd_nand_device
*
device
,
rt_uint32_t
block
);
#endif
/* MTD_NAND_H_ */
components/drivers/include/drivers/mtd_nor.h
浏览文件 @
1c95670b
...
...
@@ -11,7 +11,7 @@
#ifndef __MTD_NOR_H__
#define __MTD_NOR_H__
#include <rt
device
.h>
#include <rt
thread
.h>
struct
rt_mtd_nor_driver_ops
;
#define RT_MTD_NOR_DEVICE(device) ((struct rt_mtd_nor_device*)(device))
...
...
@@ -39,29 +39,12 @@ struct rt_mtd_nor_driver_ops
};
rt_err_t
rt_mtd_nor_register_device
(
const
char
*
name
,
struct
rt_mtd_nor_device
*
device
);
rt_inline
rt_uint32_t
rt_mtd_nor_read_id
(
struct
rt_mtd_nor_device
*
device
)
{
return
device
->
ops
->
read_id
(
device
);
}
rt_inline
rt_size_t
rt_mtd_nor_read
(
struct
rt_mtd_nor_device
*
device
,
rt_off_t
offset
,
rt_uint8_t
*
data
,
rt_uint32_t
length
)
{
return
device
->
ops
->
read
(
device
,
offset
,
data
,
length
);
}
rt_inline
rt_size_t
rt_mtd_nor_write
(
struct
rt_mtd_nor_device
*
device
,
rt_off_t
offset
,
const
rt_uint8_t
*
data
,
rt_uint32_t
length
)
{
return
device
->
ops
->
write
(
device
,
offset
,
data
,
length
);
}
rt_inline
rt_err_t
rt_mtd_nor_erase_block
(
struct
rt_mtd_nor_device
*
device
,
rt_off_t
offset
,
rt_size_t
length
)
{
return
device
->
ops
->
erase_block
(
device
,
offset
,
length
);
}
rt_uint32_t
rt_mtd_nor_read_id
(
struct
rt_mtd_nor_device
*
device
);
rt_size_t
rt_mtd_nor_read
(
struct
rt_mtd_nor_device
*
device
,
rt_off_t
offset
,
rt_uint8_t
*
data
,
rt_uint32_t
length
);
rt_size_t
rt_mtd_nor_write
(
struct
rt_mtd_nor_device
*
device
,
rt_off_t
offset
,
const
rt_uint8_t
*
data
,
rt_uint32_t
length
);
rt_err_t
rt_mtd_nor_erase_block
(
struct
rt_mtd_nor_device
*
device
,
rt_off_t
offset
,
rt_size_t
length
);
#endif
components/drivers/include/drivers/pulse_encoder.h
浏览文件 @
1c95670b
...
...
@@ -12,7 +12,6 @@
#define __PULSE_ENCODER_H__
#include <rtthread.h>
#include <rtdevice.h>
#ifdef __cplusplus
extern
"C"
{
...
...
components/drivers/include/drivers/rt_drv_pwm.h
浏览文件 @
1c95670b
...
...
@@ -12,7 +12,6 @@
#define __DRV_PWM_H_INCLUDE__
#include <rtthread.h>
#include <rtdevice.h>
#define PWM_CMD_ENABLE (RT_DEVICE_CTRL_BASE(PWM) + 0)
#define PWM_CMD_DISABLE (RT_DEVICE_CTRL_BASE(PWM) + 1)
...
...
components/drivers/include/drivers/rt_inputcapture.h
浏览文件 @
1c95670b
...
...
@@ -12,7 +12,6 @@
#define __RT_INPUT_CAPTURE_H__
#include <rtthread.h>
#include <rtdevice.h>
#ifdef __cplusplus
extern
"C"
{
...
...
components/drivers/misc/pulse_encoder.c
浏览文件 @
1c95670b
...
...
@@ -8,7 +8,6 @@
* 2019-08-08 balanceTWK the first version
*/
#include <rtthread.h>
#include <rtdevice.h>
static
rt_err_t
rt_pulse_encoder_init
(
struct
rt_device
*
dev
)
...
...
components/drivers/misc/rt_drv_pwm.c
浏览文件 @
1c95670b
...
...
@@ -9,7 +9,7 @@
* 2022-05-14 Stanley Lwin add pwm function
*/
#include <
drivers/rt_drv_pwm
.h>
#include <
rtdevice
.h>
static
rt_err_t
_pwm_control
(
rt_device_t
dev
,
int
cmd
,
void
*
args
)
{
...
...
components/drivers/misc/rt_inputcapture.c
浏览文件 @
1c95670b
...
...
@@ -8,9 +8,7 @@
* 2019-08-13 balanceTWK the first version
*/
#include <rtthread.h>
#include <rtdevice.h>
#include <rtdbg.h>
static
rt_err_t
rt_inputcapture_init
(
struct
rt_device
*
dev
)
{
...
...
components/drivers/mtd/mtd_nand.c
浏览文件 @
1c95670b
...
...
@@ -12,7 +12,7 @@
* COPYRIGHT (C) 2012, Shanghai Real Thread
*/
#include <
drivers/mtd_nand
.h>
#include <
rtdevice
.h>
#ifdef RT_USING_MTD_NAND
...
...
@@ -95,6 +95,69 @@ rt_err_t rt_mtd_nand_register_device(const char *name,
return
rt_device_register
(
dev
,
name
,
RT_DEVICE_FLAG_RDWR
|
RT_DEVICE_FLAG_STANDALONE
);
}
rt_uint32_t
rt_mtd_nand_read_id
(
struct
rt_mtd_nand_device
*
device
)
{
RT_ASSERT
(
device
->
ops
->
read_id
);
return
device
->
ops
->
read_id
(
device
);
}
rt_err_t
rt_mtd_nand_read
(
struct
rt_mtd_nand_device
*
device
,
rt_off_t
page
,
rt_uint8_t
*
data
,
rt_uint32_t
data_len
,
rt_uint8_t
*
spare
,
rt_uint32_t
spare_len
)
{
RT_ASSERT
(
device
->
ops
->
read_page
);
return
device
->
ops
->
read_page
(
device
,
page
,
data
,
data_len
,
spare
,
spare_len
);
}
rt_err_t
rt_mtd_nand_write
(
struct
rt_mtd_nand_device
*
device
,
rt_off_t
page
,
const
rt_uint8_t
*
data
,
rt_uint32_t
data_len
,
const
rt_uint8_t
*
spare
,
rt_uint32_t
spare_len
)
{
RT_ASSERT
(
device
->
ops
->
write_page
);
return
device
->
ops
->
write_page
(
device
,
page
,
data
,
data_len
,
spare
,
spare_len
);
}
rt_err_t
rt_mtd_nand_move_page
(
struct
rt_mtd_nand_device
*
device
,
rt_off_t
src_page
,
rt_off_t
dst_page
)
{
RT_ASSERT
(
device
->
ops
->
move_page
);
return
device
->
ops
->
move_page
(
device
,
src_page
,
dst_page
);
}
rt_err_t
rt_mtd_nand_erase_block
(
struct
rt_mtd_nand_device
*
device
,
rt_uint32_t
block
)
{
RT_ASSERT
(
device
->
ops
->
erase_block
);
return
device
->
ops
->
erase_block
(
device
,
block
);
}
rt_err_t
rt_mtd_nand_check_block
(
struct
rt_mtd_nand_device
*
device
,
rt_uint32_t
block
)
{
if
(
device
->
ops
->
check_block
)
{
return
device
->
ops
->
check_block
(
device
,
block
);
}
else
{
return
-
RT_ENOSYS
;
}
}
rt_err_t
rt_mtd_nand_mark_badblock
(
struct
rt_mtd_nand_device
*
device
,
rt_uint32_t
block
)
{
if
(
device
->
ops
->
mark_badblock
)
{
return
device
->
ops
->
mark_badblock
(
device
,
block
);
}
else
{
return
-
RT_ENOSYS
;
}
}
#if defined(RT_MTD_NAND_DEBUG) && defined(RT_USING_FINSH)
#include <finsh.h>
#define __is_print(ch) ((unsigned int)((ch) - ' ') < 127u - ' ')
...
...
components/drivers/mtd/mtd_nor.c
浏览文件 @
1c95670b
...
...
@@ -8,7 +8,7 @@
* 2012-5-30 Bernard the first version
*/
#include <
drivers/mtd_nor
.h>
#include <
rtdevice
.h>
#ifdef RT_USING_MTD_NOR
...
...
@@ -91,4 +91,27 @@ rt_err_t rt_mtd_nor_register_device(const char *name,
return
rt_device_register
(
dev
,
name
,
RT_DEVICE_FLAG_RDWR
|
RT_DEVICE_FLAG_STANDALONE
);
}
rt_uint32_t
rt_mtd_nor_read_id
(
struct
rt_mtd_nor_device
*
device
)
{
return
device
->
ops
->
read_id
(
device
);
}
rt_size_t
rt_mtd_nor_read
(
struct
rt_mtd_nor_device
*
device
,
rt_off_t
offset
,
rt_uint8_t
*
data
,
rt_uint32_t
length
)
{
return
device
->
ops
->
read
(
device
,
offset
,
data
,
length
);
}
rt_size_t
rt_mtd_nor_write
(
struct
rt_mtd_nor_device
*
device
,
rt_off_t
offset
,
const
rt_uint8_t
*
data
,
rt_uint32_t
length
)
{
return
device
->
ops
->
write
(
device
,
offset
,
data
,
length
);
}
rt_err_t
rt_mtd_nor_erase_block
(
struct
rt_mtd_nor_device
*
device
,
rt_off_t
offset
,
rt_size_t
length
)
{
return
device
->
ops
->
erase_block
(
device
,
offset
,
length
);
}
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录