Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yunke120
rt-thread
提交
67627942
R
rt-thread
项目概览
yunke120
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
67627942
编写于
9月 25, 2019
作者:
B
Bernard Xiong
提交者:
GitHub
9月 25, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3098 from murphyzhao/fix-data-type-problem
[components/drivers][pm] fix data type problem
上级
8fdff1da
260a61d3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
30 deletion
+30
-30
components/drivers/include/drivers/pm.h
components/drivers/include/drivers/pm.h
+12
-12
components/drivers/pm/pm.c
components/drivers/pm/pm.c
+18
-18
未找到文件。
components/drivers/include/drivers/pm.h
浏览文件 @
67627942
...
...
@@ -86,8 +86,8 @@ struct rt_pm;
*/
struct
rt_pm_ops
{
void
(
*
sleep
)(
struct
rt_pm
*
pm
,
uint8_t
mode
);
void
(
*
run
)(
struct
rt_pm
*
pm
,
uint8_t
mode
);
void
(
*
sleep
)(
struct
rt_pm
*
pm
,
rt_
uint8_t
mode
);
void
(
*
run
)(
struct
rt_pm
*
pm
,
rt_
uint8_t
mode
);
void
(
*
timer_start
)(
struct
rt_pm
*
pm
,
rt_uint32_t
timeout
);
void
(
*
timer_stop
)(
struct
rt_pm
*
pm
);
rt_tick_t
(
*
timer_get_tick
)(
struct
rt_pm
*
pm
);
...
...
@@ -95,9 +95,9 @@ struct rt_pm_ops
struct
rt_device_pm_ops
{
int
(
*
suspend
)(
const
struct
rt_device
*
device
,
uint8_t
mode
);
void
(
*
resume
)(
const
struct
rt_device
*
device
,
uint8_t
mode
);
int
(
*
frequency_change
)(
const
struct
rt_device
*
device
,
uint8_t
mode
);
int
(
*
suspend
)(
const
struct
rt_device
*
device
,
rt_
uint8_t
mode
);
void
(
*
resume
)(
const
struct
rt_device
*
device
,
rt_
uint8_t
mode
);
int
(
*
frequency_change
)(
const
struct
rt_device
*
device
,
rt_
uint8_t
mode
);
};
struct
rt_device_pm
...
...
@@ -137,22 +137,22 @@ enum
struct
rt_pm_notify
{
void
(
*
notify
)(
uint8_t
event
,
uint8_t
mode
,
void
*
data
);
void
(
*
notify
)(
rt_uint8_t
event
,
rt_
uint8_t
mode
,
void
*
data
);
void
*
data
;
};
void
rt_pm_request
(
uint8_t
sleep_mode
);
void
rt_pm_release
(
uint8_t
sleep_mode
);
int
rt_pm_run_enter
(
uint8_t
run_mode
);
void
rt_pm_request
(
rt_
uint8_t
sleep_mode
);
void
rt_pm_release
(
rt_
uint8_t
sleep_mode
);
int
rt_pm_run_enter
(
rt_
uint8_t
run_mode
);
void
rt_pm_device_register
(
struct
rt_device
*
device
,
const
struct
rt_device_pm_ops
*
ops
);
void
rt_pm_device_unregister
(
struct
rt_device
*
device
);
void
rt_pm_notify_set
(
void
(
*
notify
)(
uint8_t
event
,
uint8_t
mode
,
void
*
data
),
void
*
data
);
void
rt_pm_default_set
(
uint8_t
sleep_mode
);
void
rt_pm_notify_set
(
void
(
*
notify
)(
rt_uint8_t
event
,
rt_
uint8_t
mode
,
void
*
data
),
void
*
data
);
void
rt_pm_default_set
(
rt_
uint8_t
sleep_mode
);
void
rt_system_pm_init
(
const
struct
rt_pm_ops
*
ops
,
uint8_t
timer_mask
,
rt_
uint8_t
timer_mask
,
void
*
user_data
);
#endif
/* __PM_H__ */
components/drivers/pm/pm.c
浏览文件 @
67627942
...
...
@@ -17,18 +17,18 @@
#ifdef RT_USING_PM
static
struct
rt_pm
_pm
;
static
uint8_t
_pm_default_sleep
=
RT_PM_DEFAULT_SLEEP_MODE
;
static
rt_
uint8_t
_pm_default_sleep
=
RT_PM_DEFAULT_SLEEP_MODE
;
static
struct
rt_pm_notify
_pm_notify
;
static
uint8_t
_pm_init_flag
=
0
;
static
rt_
uint8_t
_pm_init_flag
=
0
;
#define RT_PM_TICKLESS_THRESH (2)
RT_WEAK
uint32_t
rt_pm_enter_critical
(
uint8_t
sleep_mode
)
RT_WEAK
rt_uint32_t
rt_pm_enter_critical
(
rt_
uint8_t
sleep_mode
)
{
return
rt_hw_interrupt_disable
();
}
RT_WEAK
void
rt_pm_exit_critical
(
uint32_t
ctx
,
uint8_t
sleep_mode
)
RT_WEAK
void
rt_pm_exit_critical
(
rt_uint32_t
ctx
,
rt_
uint8_t
sleep_mode
)
{
rt_hw_interrupt_enable
(
ctx
);
}
...
...
@@ -36,7 +36,7 @@ RT_WEAK void rt_pm_exit_critical(uint32_t ctx, uint8_t sleep_mode)
/**
* This function will suspend all registered devices
*/
static
int
_pm_device_suspend
(
uint8_t
mode
)
static
int
_pm_device_suspend
(
rt_
uint8_t
mode
)
{
int
index
,
ret
=
RT_EOK
;
...
...
@@ -45,8 +45,8 @@ static int _pm_device_suspend(uint8_t mode)
if
(
_pm
.
device_pm
[
index
].
ops
->
suspend
!=
RT_NULL
)
{
ret
=
_pm
.
device_pm
[
index
].
ops
->
suspend
(
_pm
.
device_pm
[
index
].
device
,
mode
);
if
(
ret
!=
RT_EOK
)
break
;
if
(
ret
!=
RT_EOK
)
break
;
}
}
...
...
@@ -56,7 +56,7 @@ static int _pm_device_suspend(uint8_t mode)
/**
* This function will resume all registered devices
*/
static
void
_pm_device_resume
(
uint8_t
mode
)
static
void
_pm_device_resume
(
rt_
uint8_t
mode
)
{
int
index
;
...
...
@@ -72,7 +72,7 @@ static void _pm_device_resume(uint8_t mode)
/**
* This function will update the frequency of all registered devices
*/
static
void
_pm_device_frequency_change
(
uint8_t
mode
)
static
void
_pm_device_frequency_change
(
rt_
uint8_t
mode
)
{
rt_uint32_t
index
;
...
...
@@ -106,10 +106,10 @@ static void _pm_frequency_scaling(struct rt_pm *pm)
/**
* This function selects the sleep mode according to the rt_pm_request/rt_pm_release count.
*/
static
uint8_t
_pm_select_sleep_mode
(
struct
rt_pm
*
pm
)
static
rt_
uint8_t
_pm_select_sleep_mode
(
struct
rt_pm
*
pm
)
{
int
index
;
uint8_t
mode
;
rt_
uint8_t
mode
;
mode
=
_pm_default_sleep
;
for
(
index
=
PM_SLEEP_MODE_NONE
;
index
<
PM_SLEEP_MODE_MAX
;
index
++
)
...
...
@@ -128,7 +128,7 @@ static uint8_t _pm_select_sleep_mode(struct rt_pm *pm)
/**
* This function changes the power sleep mode base on the result of selection
*/
static
void
_pm_change_sleep_mode
(
struct
rt_pm
*
pm
,
uint8_t
mode
)
static
void
_pm_change_sleep_mode
(
struct
rt_pm
*
pm
,
rt_
uint8_t
mode
)
{
rt_tick_t
timeout_tick
,
delta_tick
;
rt_base_t
level
;
...
...
@@ -214,7 +214,7 @@ static void _pm_change_sleep_mode(struct rt_pm *pm, uint8_t mode)
*/
void
rt_system_power_manager
(
void
)
{
uint8_t
mode
;
rt_
uint8_t
mode
;
if
(
_pm_init_flag
==
0
)
return
;
...
...
@@ -233,7 +233,7 @@ void rt_system_power_manager(void)
*
* @param parameter the parameter of run mode or sleep mode
*/
void
rt_pm_request
(
uint8_t
mode
)
void
rt_pm_request
(
rt_
uint8_t
mode
)
{
rt_base_t
level
;
struct
rt_pm
*
pm
;
...
...
@@ -258,7 +258,7 @@ void rt_pm_request(uint8_t mode)
* @param parameter the parameter of run mode or sleep mode
*
*/
void
rt_pm_release
(
uint8_t
mode
)
void
rt_pm_release
(
rt_
uint8_t
mode
)
{
rt_ubase_t
level
;
struct
rt_pm
*
pm
;
...
...
@@ -342,7 +342,7 @@ void rt_pm_device_unregister(struct rt_device *device)
/**
* This function set notification callback for application
*/
void
rt_pm_notify_set
(
void
(
*
notify
)(
uint8_t
event
,
uint8_t
mode
,
void
*
data
),
void
*
data
)
void
rt_pm_notify_set
(
void
(
*
notify
)(
rt_uint8_t
event
,
rt_
uint8_t
mode
,
void
*
data
),
void
*
data
)
{
_pm_notify
.
notify
=
notify
;
_pm_notify
.
data
=
data
;
...
...
@@ -351,7 +351,7 @@ void rt_pm_notify_set(void (*notify)(uint8_t event, uint8_t mode, void *data), v
/**
* This function set default sleep mode when no pm_request
*/
void
rt_pm_default_set
(
uint8_t
sleep_mode
)
void
rt_pm_default_set
(
rt_
uint8_t
sleep_mode
)
{
_pm_default_sleep
=
sleep_mode
;
}
...
...
@@ -428,7 +428,7 @@ static rt_err_t _rt_pm_device_control(rt_device_t dev,
return
RT_EOK
;
}
int
rt_pm_run_enter
(
uint8_t
mode
)
int
rt_pm_run_enter
(
rt_
uint8_t
mode
)
{
rt_base_t
level
;
struct
rt_pm
*
pm
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录