金牌会员
- 积分
- 1547
- 金钱
- 1547
- 注册时间
- 2014-7-11
- 在线时间
- 256 小时
|
2金钱
原子哥,我在使用STM32 UCOS 2设置任务不执行是怎么回事
void start_task(void *p_arg)
{
OS_CPU_SR cpu_sr = 0;
CPU_INT32U cnts;
OSStatInit(); /* 开启统计任务 */
/* 根据配置的节拍频率配置SysTick */
cnts = (CPU_INT32U)((168 * 1000000) / OS_TICKS_PER_SEC);
OS_CPU_SysTickInit(cnts);
OS_ENTER_CRITICAL(); /* 进入临界区(关闭中断) */
OSTaskCreateExt((void(*)(void *) )usart1_task,
(void * )0,
(OS_STK * )&USART1_TASK_STK[USART1_STK_SIZE - 1],
(INT8U )USART1_TASK_PRIO,
(INT16U )USART1_TASK_PRIO,
(OS_STK * )&USART1_TASK_STK[0],
(INT32U )USART1_STK_SIZE,
(void * )0,
(INT16U )OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR | OS_TASK_OPT_SAVE_FP);
/* usart1任务 */
OSTaskCreateExt((void(*)(void *) )uart4_task,
(void * )0,
(OS_STK * )&UART4_TASK_STK[UART4_STK_SIZE - 1],
(INT8U )UART4_TASK_PRIO,
(INT16U )UART4_TASK_PRIO,
(OS_STK * )&UART4_TASK_STK[0],
(INT32U )UART4_STK_SIZE,
(void * )0,
(INT16U )OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR | OS_TASK_OPT_SAVE_FP);
/* usart2任务 */
OSTaskCreateExt((void(*)(void *) )usart2_task,
(void * )0,
(OS_STK * )&USART2_TASK_STK[USART2_STK_SIZE - 1],
(INT8U )USART2_TASK_PRIO,
(INT16U )USART2_TASK_PRIO,
(OS_STK * )&USART2_TASK_STK[0],
(INT32U )USART2_STK_SIZE,
(void * )0,
(INT16U )OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR | OS_TASK_OPT_SAVE_FP);
/* usart2任务 */
OSTaskCreateExt((void(*)(void *) )usart3_task,
(void * )0,
(OS_STK * )&USART3_TASK_STK[USART3_STK_SIZE - 1],
(INT8U )USART3_TASK_PRIO,
(INT16U )USART3_TASK_PRIO,
(OS_STK * )&USART3_TASK_STK[0],
(INT32U )USART3_STK_SIZE,
(void * )0,
(INT16U )OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR | OS_TASK_OPT_SAVE_FP);
OS_EXIT_CRITICAL(); /* 退出临界区(开中断) */
OSTaskSuspend(START_TASK_PRIO); /* 挂起开始任务 */
}
这样设置为什么不能执行?
|
|