这代码不像COsyOS的风格呀, 你应该看的是uCOS的代码吧
OSTaskCreate函数的原型为:
INT8U OSTaskCreate (void (*task)(void *p_arg),
void *p_arg,
OS_STK *ptos,
INT16U stk_size,
INT8U prio) large reentrant
5个参数: @task 对应任务函数名
@p_arg 对应要传给任务函数的数据指针
@ptos 任务栈栈顶
@stk_size 指定任务栈大小
@prio 指定任务优先级
告诉你一个学习方法, 在函数名字上鼠标右键弹出菜单选择"Go To Definition xxxx"即可跳转的函数这义处, 此处可看到该函数的具体信息, 函数前有函数相关的说明如下, 如果英文不行, 可以用翻译看, 学习一样东西是师傅领进门, 修行靠个人
- /*
- *********************************************************************************************************
- * CREATE A TASK
- *
- * Description: This function is used to have uC/OS-II manage the execution of a task. Tasks can either
- * be created prior to the start of multitasking or by a running task. A task cannot be
- * created by an ISR.
- *
- * Arguments : task is a pointer to the task's code
- *
- * p_arg is a pointer to an optional data area which can be used to pass parameters to
- * the task when the task first executes. Where the task is concerned it thinks
- * it was invoked and passed the argument 'p_arg' as follows:
- *
- * void Task (void *p_arg)
- * {
- * for (;;) {
- * Task code;
- * }
- * }
- *
- * ptos is a pointer to the task's top of stack. If the configuration constant
- * OS_STK_GROWTH is set to 1, the stack is assumed to grow downward (i.e. from high
- * memory to low memory). 'pstk' will thus point to the highest (valid) memory
- * location of the stack. If OS_STK_GROWTH is set to 0, 'pstk' will point to the
- * lowest memory location of the stack and the stack will grow with increasing
- * memory locations.
- *
- * prio is the task's priority. A unique priority MUST be assigned to each task and the
- * lower the number, the higher the priority.
- *
- * Returns : OS_ERR_NONE if the function was successful.
- * OS_ERR_PRIO_EXIST if the task priority already exist
- * (each task MUST have a unique priority).
- * OS_ERR_PRIO_INVALID if the priority you specify is higher that the maximum
- * allowed (i.e. >= OS_LOWEST_PRIO)
- * OS_ERR_TASK_CREATE_ISR if you tried to create a task from an ISR.
- * OS_ERR_ILLEGAL_CREATE_RUN_TIME if you tried to create a task after safety critical
- * operation started.
- *********************************************************************************************************
- */
-
- #if OS_TASK_CREATE_EN > 0u
- INT8U OSTaskCreate (void (*task)(void *p_arg),
- void *p_arg,
- OS_STK *ptos,
- INT16U stk_size,
- INT8U prio) large reentrant
复制代码
|