FREERTOS可屏蔽中断
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 4 //系统可管理的最高中断优先级
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15 //中断最低优先级
在需要用到 taskENTER_CRITICAL(); //进入临界区 系统会自动屏蔽中断,大于4的中断会被全部屏蔽。小于4的优先级更高则一般为系统中断。
#define taskENTER_CRITICAL() portENTER_CRITICAL()
#define portENTER_CRITICAL() vPortEnterCritical()
查询任务的状态
TaskHandle_t TaskHandle;
TaskStatus_t TaskStatus;
TaskHandle=xTaskGetHandle("dcm250b_task");
vTaskGetInfo((TaskHandle_t)TaskHandle,//任务句柄
(TaskStatus_t*)&TaskStatus,//任务信息结构体
(BaseType_t)pdFALSE,//不允许统计任务堆栈历史最小剩余大小
(eTaskState)eInvalid);//函数自己获取任务运行状态
taskstate_info=TaskStatus.eCurrentState;
SP0_SendBytesInfoProc(&taskstate_info,1);//串口发送任务的状态
eTaskState eCurrentState;
typedef enum
{
eRunning = 0, /* A task is querying the state of itself, so must be running. */
eReady, /* The task being queried is in a read or pending ready list. */
eBlocked, /* The task being queried is in the Blocked state. */
eSuspended, /* The task being queried is in the Suspended state, or is in the Blocked state with an infinite time out. */
eDeleted, /* The task being queried has been deleted, but its TCB has not yet been freed. */
eInvalid /* Used as an 'invalid state' value. */
} eTaskState;
任务状态为一个枚举函数,则运行状态为0,就绪状态为1,阻塞状态为2,挂起状态为3