Files
TencentOS-tiny/examples/tickless/tickless_sample.c
supowang edb2879617 first commit for opensource
first commit for opensource
2019-09-16 13:19:50 +08:00

36 lines
1.6 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include "cmsis_os.h"
/*
tos_bsp_tickless_setup函数是板级的tickless设置接口
此sample中:
tos_tickless_wkup_alarm_install(TOS_LOW_POWER_MODE_SLEEP, &tickless_wkup_alarm_tim);
tos_tickless_wkup_alarm_init(TOS_LOW_POWER_MODE_SLEEP);
tos_pm_cpu_lpwr_mode_set(TOS_LOW_POWER_MODE_SLEEP);
我们通过tos_tickless_wkup_alarm_install注册了sleep模式下的唤醒闹钟使用定时器6作为
sleep模式下的唤醒闹钟具体实现可以参考bsp_tickless_alarm.c
通过tos_pm_cpu_lpwr_mode_set我们设置tickless模式为sleep模式如果用户选定tickless
只进入一种模式,那么可以只实现、注册此模式下的唤醒闹钟,其他模式可以不理)
验证用户可以在idle任务入口knl_idle_entry中加入打印log在tickless模式下idle任务
不会一直唤醒因而idle中的日志打印不会频繁出现正常模式下idle在系统中没有就绪任务时
就会被唤醒打印log会频繁出现
注意板子烧录tickless使能的镜像后会导致通过keil烧录新的镜像出现问题低功耗模式下
debug会有问题
- 如果是TencentOS tiny定制的开发板可以在按下板子上的RESET键后立马点击keil上的烧录按钮
- 如果是阿波罗的开发板可以拔掉板子的串口USB线脱离stlink或jlink的USB口与
PC主机的接触再重新将stlink或jlink的USB插上PC主机后大概0.5S后再点击keil上的烧录按钮。
*/
void application_entry(void *arg)
{
int count = 1;
while (1) {
printf("###This is task1, %d\r\n", count++);
osDelay(3000);
}
}