Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
智驾
rt-thread
提交
5f0328ee
R
rt-thread
项目概览
智驾
/
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,体验更适合开发者的 AI 搜索 >>
提交
5f0328ee
编写于
7月 20, 2023
作者:
xqyjlj
提交者:
mysterywolf
7月 20, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
✨
feat(ktime): add RT_USING_KTIME to kconfig build
上级
0b966bfc
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
28 addition
and
9 deletion
+28
-9
components/Kconfig
components/Kconfig
+1
-0
components/drivers/rtc/soft_rtc.c
components/drivers/rtc/soft_rtc.c
+11
-0
components/ktime/Kconfig
components/ktime/Kconfig
+3
-0
components/ktime/SConscript
components/ktime/SConscript
+1
-1
components/libc/compilers/common/ctime.c
components/libc/compilers/common/ctime.c
+9
-7
components/libc/posix/Kconfig
components/libc/posix/Kconfig
+2
-1
src/Kconfig
src/Kconfig
+1
-0
未找到文件。
components/Kconfig
浏览文件 @
5f0328ee
...
...
@@ -34,5 +34,6 @@ source "$RTT_DIR/components/libc/Kconfig"
source "$RTT_DIR/components/net/Kconfig"
source "$RTT_DIR/components/utilities/Kconfig"
source "$RTT_DIR/components/vbus/Kconfig"
source "$RTT_DIR/components/ktime/Kconfig"
endmenu
components/drivers/rtc/soft_rtc.c
浏览文件 @
5f0328ee
...
...
@@ -13,7 +13,9 @@
#include <rtthread.h>
#include <rtdevice.h>
#ifdef RT_USING_KTIME
#include <ktime.h>
#endif
#ifdef RT_USING_SOFT_RTC
...
...
@@ -38,8 +40,11 @@ static rt_device_t source_device = RT_NULL;
static
struct
rt_device
soft_rtc_dev
;
static
rt_tick_t
init_tick
;
static
time_t
init_time
;
#ifdef RT_USING_KTIME
static
struct
timeval
init_tv
=
{
0
};
static
struct
timespec
init_ts
=
{
0
};
#endif
#ifdef RT_USING_ALARM
...
...
@@ -92,10 +97,12 @@ static void _source_device_control(int cmd, void *args)
static
rt_err_t
soft_rtc_control
(
rt_device_t
dev
,
int
cmd
,
void
*
args
)
{
time_t
*
t
;
#ifdef RT_USING_KTIME
struct
timeval
*
tv
;
struct
timespec
*
ts
;
struct
timeval
_tv
;
struct
timespec
_ts
;
#endif
struct
tm
time_temp
;
RT_ASSERT
(
dev
!=
RT_NULL
);
...
...
@@ -123,6 +130,7 @@ static rt_err_t soft_rtc_control(rt_device_t dev, int cmd, void *args)
soft_rtc_alarm_update
(
&
wkalarm
);
break
;
#endif
#ifdef RT_USING_KTIME
case
RT_DEVICE_CTRL_RTC_GET_TIMEVAL
:
tv
=
(
struct
timeval
*
)
args
;
rt_ktime_boottime_get_us
(
&
_tv
);
...
...
@@ -154,6 +162,9 @@ static rt_err_t soft_rtc_control(rt_device_t dev, int cmd, void *args)
ts
->
tv_sec
=
0
;
ts
->
tv_nsec
=
(
rt_ktime_cputimer_getres
()
/
RT_KTIME_RESMUL
);
break
;
#endif
default:
return
-
RT_EINVAL
;
}
return
RT_EOK
;
...
...
components/ktime/Kconfig
0 → 100644
浏览文件 @
5f0328ee
menuconfig RT_USING_KTIME
bool "Ktime: kernel time"
default n
components/ktime/SConscript
浏览文件 @
5f0328ee
...
...
@@ -14,6 +14,6 @@ if rtconfig.ARCH in list:
src
+=
Glob
(
"src/"
+
rtconfig
.
ARCH
+
"/*.c"
)
CPPPATH
=
[
cwd
,
cwd
+
"/inc"
]
group
=
DefineGroup
(
'ktime'
,
src
,
depend
=
[
''
],
CPPPATH
=
CPPPATH
)
group
=
DefineGroup
(
'ktime'
,
src
,
depend
=
[
'
RT_USING_KTIME
'
],
CPPPATH
=
CPPPATH
)
Return
(
'group'
)
components/libc/compilers/common/ctime.c
浏览文件 @
5f0328ee
...
...
@@ -25,7 +25,6 @@
*/
#include "sys/time.h"
#include <ktime.h>
#include <rthw.h>
#include <rtthread.h>
#include <sys/errno.h>
...
...
@@ -40,6 +39,9 @@
#if defined( RT_USING_RTC ) || defined( RT_USING_CPUTIME)
#include <rtdevice.h>
#endif
#ifdef RT_USING_KTIME
#include "ktime.h"
#endif
#define DBG_TAG "time"
#define DBG_LVL DBG_INFO
...
...
@@ -459,7 +461,7 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz)
}
RTM_EXPORT
(
settimeofday
);
#if
def RT_USING_POSIX_DELAY
#if
defined(RT_USING_POSIX_DELAY) && defined(RT_USING_KTIME)
int
nanosleep
(
const
struct
timespec
*
rqtp
,
struct
timespec
*
rmtp
)
{
struct
timespec
old_ts
=
{
0
};
...
...
@@ -501,9 +503,9 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
return
0
;
}
RTM_EXPORT
(
nanosleep
);
#endif
/* RT_USING_POSIX_DELAY */
#endif
/* RT_USING_POSIX_DELAY
&& RT_USING_KTIME
*/
#if
def RT_USING_POSIX_CLOCK
#if
defined(RT_USING_POSIX_CLOCK) && defined(RT_USING_KTIME)
int
clock_getres
(
clockid_t
clockid
,
struct
timespec
*
res
)
{
...
...
@@ -693,9 +695,9 @@ int rt_timespec_to_tick(const struct timespec *time)
}
RTM_EXPORT
(
rt_timespec_to_tick
);
#endif
/* RT_USING_POSIX_CLOCK */
#endif
/* RT_USING_POSIX_CLOCK
&& RT_USING_KTIME
*/
#if
def RT_USING_POSIX_TIMER
#if
defined(RT_USING_POSIX_TIMER) && defined(RT_USING_KTIME)
#include <resource_id.h>
...
...
@@ -1111,7 +1113,7 @@ int timer_settime(timer_t timerid, int flags, const struct itimerspec *value,
return
0
;
}
RTM_EXPORT
(
timer_settime
);
#endif
/* RT_USING_POSIX_TIMER */
#endif
/* RT_USING_POSIX_TIMER
&& RT_USING_KTIME
*/
/* timezone */
...
...
components/libc/posix/Kconfig
浏览文件 @
5f0328ee
...
...
@@ -47,6 +47,7 @@ if RT_USING_POSIX_FS
endif
config RT_USING_POSIX_DELAY
select RT_USING_KTIME
bool "Enable delay APIs, sleep()/usleep()/msleep() etc"
default n
...
...
@@ -56,7 +57,7 @@ config RT_USING_POSIX_CLOCK
default n
config RT_USING_POSIX_TIMER
select RT_USING_
TIMER_SOFT
select RT_USING_
KTIME
select RT_USING_RESOURCE_ID
bool "Enable timer APIs, timer_create()/timer_gettime() etc"
default n
...
...
src/Kconfig
浏览文件 @
5f0328ee
...
...
@@ -34,6 +34,7 @@ config RT_USING_SMART
select RT_USING_POSIX_CLOCK
select RT_USING_POSIX_FS
select RT_USING_POSIX_TERMIOS
select RT_USING_KTIME
depends on ARCH_ARM_CORTEX_M || ARCH_ARM_ARM9 || ARCH_ARM_CORTEX_A || ARCH_ARMV8 || ARCH_RISCV64
help
RT-Thread Smart is a microkernel based operating system on RT-Thread.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录