stm32_ota/ABM开发板(APP源码)/YcOS版本/APPV3.0/YCOS/ycos.h
2024-12-17 20:03:43 +08:00

55 lines
2.2 KiB
C
Raw Permalink 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.

#ifndef __YCOS_H
#define __YCOS_H
#include <stdint.h>
#include <stdbool.h>
#define YCOSTASK_MAX 16 //YCOS轮询操作系统最多可以轮询的任务数
#define YCOSTICK_RATE_HZ (100) //YCOS时钟节拍频率这里设置为100周期就是1/10 = 100ms
/******************************************************************************
*用户自定义数据类型
*******************************************************************************/
typedef void (*YCOSTASKFP)() ; //定义任务函数指针类型变量
typedef enum
{
YCOSTASK_HIGHPRIO = 1 , //YcOS高优先级任务
YCOSTASK_LOWPRIO = 2 //YcOS低优先级任务
}YcOSTaskPrio_e ; //YcOS任务优先级
typedef struct //YcOSTasks结构体用来保存一个YcOS任务的信息
{
const char *taskName ; //YcOS任务名称名称
bool enTask ; //YcOS任务使能标志位
YcOSTaskPrio_e eTaskPrio ; //YcOS任务优先级
uint32_t taskTickInterval ; //YcOS任务轮询间隔节拍数
YCOSTASKFP pFunc; //YcOS任务轮询间隔到达时要执行的代码函数指针
}YcOSTask_s ; //YcOS任务结构体 存储任务参数信息
typedef YcOSTask_s* psYcOSTaskHandle ; //YsOS任务句柄
/******************************************************************************
*常变量定义
*******************************************************************************/
extern YcOSTask_s sYcOSTask[YCOSTASK_MAX] ; //定义YcOSTasks类型的数组用来保存所有的YCOS任务信息
/*****************************************
*对外接口函数声明
****************************************/
extern psYcOSTaskHandle YcOSTaskCreate( const char * const pcTaskName,
const YcOSTaskPrio_e eTaskPrio,
const uint32_t taskTickInterval,
const int taskID,
const YCOSTASKFP pCallback ); //YcOS任务创建函数
extern void YcOSTaskDelete(psYcOSTaskHandle psTask) ;
extern void YcOSTaskStart(psYcOSTaskHandle psTask) ;
extern void YcOSTaskStop(psYcOSTaskHandle psTask) ;
extern void YcOSLowPrioSchedulerCallback(void) ; //YcOS低优先级任务的轮询调度器
extern void YcOSHighPrioSchedulerCallback(void) ; //YcOS高优先级任务的轮询调度器
#endif