| 123456789101112131415161718192021222324252627282930313233343536373839 |
- /*
- * Copyright (c) 2021, Meco Jianting Man <jiantingman@foxmail.com>
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2020-09-30 Meco Man first version
- */
- #include <ucos_ii.h>
- #define TASK_SIZE 256
- #define TASK_PRIO 5
- static OS_STK task_stack [TASK_SIZE];
- static void task(void *p_arg)
- {
- OS_STK_DATA stk;
- while(1)
- {
- OSTaskStkChk(OS_PRIO_SELF, &stk);
- rt_kprintf("task stack free: %d\r\n", stk.OSFree);
- #if OS_TASK_STAT_EN > 0u
- rt_kprintf("CPU Usage:%d%%\r\n",OSCPUUsage);
- #endif
- OSTimeDly(500);
- }
- }
- void task_example (void)
- {
- #if OS_STK_GROWTH == 0u
- OSTaskCreateExt(task,0,&task_stack[0],TASK_PRIO,0,&task_stack[TASK_SIZE-1],TASK_SIZE,0,OS_TASK_OPT_STK_CHK|OS_TASK_OPT_STK_CLR);
- #else
- OSTaskCreateExt(task,0,&task_stack[TASK_SIZE-1],TASK_PRIO,0,&task_stack[0],TASK_SIZE,0,OS_TASK_OPT_STK_CHK|OS_TASK_OPT_STK_CLR);
- #endif
- }
|