-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathscheduler.h
50 lines (45 loc) · 1.34 KB
/
scheduler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* @file scheduler.h
* @author Ellu ([email protected])
* @version 1.0
* @date 2021-12-11
*
* THINK DIFFERENTLY
*/
#ifndef _SCHEDULER_H_
#define _SCHEDULER_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "modules.h"
#include "scheduler_coroutine.h"
#include "scheduler_event.h"
#include "scheduler_runlater.h"
#include "scheduler_softint.h"
#include "scheduler_task.h"
/**
* @brief 调度器主函数
* @param block 是否阻塞, 若不阻塞则应将此函数放在SuperLoop中
* @retval uint64_t 返回时间: 距离下一次调度的时间(us)
* @note block=0时. SuperLoop应保证在返回时间前交还CPU以最小化调度延迟
* @note block=1时. 查看scheduler_Idle_Callback函数说明
**/
extern uint64_t scheduler_run(const uint8_t block);
/**
* @brief 调度器空闲回调函数, 由用户实现(block=1时调用)
* @param idleTimeUs 空闲时间(us)
* @note 应保证在空闲时间前交还CPU以最小化调度延迟
* @note 可在此函数内实现低功耗
*/
extern void scheduler_idle_handler(uint64_t idleTimeUs);
#if SCH_CFG_ENABLE_TERMINAL
#include "embedded_cli.h"
/**
* @brief 添加调度器相关的终端命令(task/event/cortn/softint)
*/
extern void sch_add_command_to_cli(EmbeddedCli* cli);
#endif // SCH_CFG_ENABLE_TERMINAL
#ifdef __cplusplus
}
#endif
#endif // _SCHEDULER_H_