OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 6129|回复: 2

为什么我想跟进程序中的OSMboxCreate函数,却出现以上截图,进不去这个函数,为什么呢?

[复制链接]

18

主题

53

帖子

0

精华

初级会员

Rank: 2

积分
145
金钱
145
注册时间
2014-4-15
在线时间
0 小时
发表于 2014-4-24 12:43:06 | 显示全部楼层 |阅读模式
[mw_shl_code=c,true]#include "includes.h" OS_STK App_TaskStartStk[APP_TASK_START_STK_SIZE]; // TaskStart 任务堆栈 void App_TaskStart(void* p_arg); // 声明 TaskStart 函数 //static OS_STK App_TaskFLICKERStk[APP_TASK_FLICKER_STK_SIZE]; // TaskFLICKER 任务堆栈 //static void App_TaskFLICKER(void* p_arg); OS_STK App_TaskMAINStk[APP_TASK_MAIN_STK_SIZE]; // 声明 TaskFLICKER 函数 void App_TaskMAIN(void* p_arg); OS_STK App_TaskKEYStk[APP_TASK_KEY_STK_SIZE]; void App_TaskKEY(void* p_arg); OS_EVENT *msg_key; //void LED1234_ON_OFF(CPU_INT08U Num); // 声明流水灯函数 /* ********************************************************************************************************* main() ********************************************************************************************************* */ INT8U ChkKey(void) { if(GPIO_ReadInputDataBit(GPIOD, GPIO_Pin_0) == 0){return(4);} // 确定 if(GPIO_ReadInputDataBit(GPIOD, GPIO_Pin_4) == 0){return(0);} // 上 if(GPIO_ReadInputDataBit(GPIOD, GPIO_Pin_1) == 0){return(1);} // 下 if(GPIO_ReadInputDataBit(GPIOD, GPIO_Pin_3) == 0){return(2);} // 左 if(GPIO_ReadInputDataBit(GPIOD, GPIO_Pin_2) == 0){return(3);} // 右 return(5); // 没有按下 } int main(void) { OSInit(); SysClock_Init(); /* 初始化系统外设、 CPU 时钟,仅此而已 */ msg_key=OSMboxCreate((void*)0); /* 建立系统的第一个任务 */ OSTaskCreate(App_TaskStart,(void *)0,&App_TaskStartStk[APP_TASK_START_STK_SIZE-1],APP_TASK_START_PRIO); OSStart(); /* 开始任务调度 */ return (0); } /* ********************************************************************************************************* 系统的第一个任务,负责开OS时钟,建立其他任务 ********************************************************************************************************* */ void App_TaskStart(void* p_arg) { p_arg = p_arg; /* 初始化 OS 时钟 */ OS_CPU_SysTickInit(); /* 统计任务 */ #if (OS_TASK_STAT_EN > 0) OSStatInit(); #endif //OSTaskCreateExt(App_TaskFLICKER, (void *) 0, (OS_STK *) &App_TaskFLICKERStk[APP_TASK_FLICKER_STK_SIZE - 1], APP_TASK_FLICKER_PRIO, // APP_TASK_FLICKER_PRIO, (OS_STK *) &App_TaskFLICKERStk[0], APP_TASK_FLICKER_STK_SIZE , (void *) 0, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR // ); // 建立流水灯线程 OSTaskCreate(App_TaskMAIN,(void *)0,&App_TaskMAINStk[APP_TASK_MAIN_STK_SIZE-1],APP_TASK_MAIN_PRIO); OSTaskCreate(App_TaskKEY,(void *)0,&App_TaskKEYStk[APP_TASK_KEY_STK_SIZE-1],APP_TASK_KEY_PRIO); /* 初始化外设 */ BSP_Init(); // 开启CPU外设 while (1) { OSTaskSuspend(OS_PRIO_SELF); // 挂起任务 } } void App_TaskMAIN(void* p_arg) { p_arg = p_arg; { INT8U* Num; INT8U err; while(1) { Num=(INT8U*)OSMboxPend(msg_key,0,&err); switch (*Num) { case 0: GPIO_SetBits(GPIOD, GPIO_Pin_8); GPIO_ResetBits(GPIOD, GPIO_Pin_9); GPIO_ResetBits(GPIOD, GPIO_Pin_10); GPIO_ResetBits(GPIOD, GPIO_Pin_11); break; case 1: GPIO_ResetBits(GPIOD, GPIO_Pin_8); GPIO_SetBits(GPIOD, GPIO_Pin_9); GPIO_ResetBits(GPIOD, GPIO_Pin_10); GPIO_ResetBits(GPIOD, GPIO_Pin_11); break; case 2: GPIO_ResetBits(GPIOD, GPIO_Pin_8); GPIO_ResetBits(GPIOD, GPIO_Pin_9); GPIO_SetBits(GPIOD, GPIO_Pin_10); GPIO_ResetBits(GPIOD, GPIO_Pin_11); break; case 3: GPIO_ResetBits(GPIOD, GPIO_Pin_8); GPIO_ResetBits(GPIOD, GPIO_Pin_9); GPIO_ResetBits(GPIOD, GPIO_Pin_10); GPIO_SetBits(GPIOD, GPIO_Pin_11); break; case 4: GPIO_SetBits(GPIOD, GPIO_Pin_8); GPIO_SetBits(GPIOD, GPIO_Pin_9); GPIO_SetBits(GPIOD, GPIO_Pin_10); GPIO_SetBits(GPIOD, GPIO_Pin_11); break; case 5: GPIO_ResetBits(GPIOD, GPIO_Pin_8); GPIO_ResetBits(GPIOD, GPIO_Pin_9); GPIO_ResetBits(GPIOD, GPIO_Pin_10); GPIO_ResetBits(GPIOD, GPIO_Pin_11); break; default: break;} } } } void App_TaskKEY(void* p_arg) { p_arg=p_arg; //u32 key=key_scan(void); while(1) { INT8U JZ; JZ=ChkKey(); // if(JZ) OSMboxPost(msg_key,&JZ); } } /* ********************************************************************************************************* 流水灯线程 ********************************************************************************************************* */ /*static void App_TaskFLICKER(void* p_arg) { INT8U i; p_arg = p_arg; while (1) { for(i = 0 ; i < 4; i++){ LED1234_ON_OFF(i); OSTimeDlyHMSM(0,0,1,0); // 延时一秒 } } }*/ /* ********************************************************************************************************* ********************************************************************************************************* * uC/OS-II APP HOOKS ********************************************************************************************************* ********************************************************************************************************* */ #if (OS_APP_HOOKS_EN > 0) /* ********************************************************************************************************* * TASK CREATION HOOK (APPLICATION) * * Description : This function is called when a task is created. * * Argument : ptcb is a pointer to the task control block of the task being created. * * Note : (1) Interrupts are disabled during this call. ********************************************************************************************************* */ void App_TaskCreateHook(OS_TCB* ptcb) { } /* ********************************************************************************************************* * TASK DELETION HOOK (APPLICATION) * * Description : This function is called when a task is deleted. * * Argument : ptcb is a pointer to the task control block of the task being deleted. * * Note : (1) Interrupts are disabled during this call. ********************************************************************************************************* */ void App_TaskDelHook(OS_TCB* ptcb) { (void) ptcb; } /* ********************************************************************************************************* * IDLE TASK HOOK (APPLICATION) * * Description : This function is called by OSTaskIdleHook(), which is called by the idle task. This hook * has been added to allow you to do such things as STOP the CPU to conserve power. * * Argument : none. * * Note : (1) Interrupts are enabled during this call. ********************************************************************************************************* */ #if OS_VERSION >= 251 void App_TaskIdleHook(void) { } #endif /* ********************************************************************************************************* * STATISTIC TASK HOOK (APPLICATION) * * Description : This function is called by OSTaskStatHook(), which is called every second by uC/OS-II's * statistics task. This allows your application to add functionality to the statistics task. * * Argument : none. ********************************************************************************************************* */ void App_TaskStatHook(void) { } /* ********************************************************************************************************* * TASK SWITCH HOOK (APPLICATION) * * Description : This function is called when a task switch is performed. This allows you to perform other * operations during a context switch. * * Argument : none. * * Note : 1 Interrupts are disabled during this call. * * 2 It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that * will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the * task being switched out (i.e. the preempted task). ********************************************************************************************************* */ #if OS_TASK_SW_HOOK_EN > 0 void App_TaskSwHook(void) { } #endif /* ********************************************************************************************************* * OS_TCBInit() HOOK (APPLICATION) * * Description : This function is called by OSTCBInitHook(), which is called by OS_TCBInit() after setting * up most of the TCB. * * Argument : ptcb is a pointer to the TCB of the task being created. * * Note : (1) Interrupts may or may not be ENABLED during this call. ********************************************************************************************************* */ #if OS_VERSION >= 204 void App_TCBInitHook(OS_TCB* ptcb) { (void) ptcb; } #endif #endif /****************************************** * * LED 流水灯 * ****************************************/ void LED1234_ON_OFF(CPU_INT08U Num) { switch (Num) { case 0: GPIO_SetBits(GPIOD, GPIO_Pin_8); GPIO_ResetBits(GPIOD, GPIO_Pin_9); GPIO_ResetBits(GPIOD, GPIO_Pin_10); GPIO_ResetBits(GPIOD, GPIO_Pin_11); break; case 1: GPIO_ResetBits(GPIOD, GPIO_Pin_8); GPIO_SetBits(GPIOD, GPIO_Pin_9); GPIO_ResetBits(GPIOD, GPIO_Pin_10); GPIO_ResetBits(GPIOD, GPIO_Pin_11); break; case 2: GPIO_ResetBits(GPIOD, GPIO_Pin_8); GPIO_ResetBits(GPIOD, GPIO_Pin_9); GPIO_SetBits(GPIOD, GPIO_Pin_10); GPIO_ResetBits(GPIOD, GPIO_Pin_11); break; case 3: GPIO_ResetBits(GPIOD, GPIO_Pin_8); GPIO_ResetBits(GPIOD, GPIO_Pin_9); GPIO_ResetBits(GPIOD, GPIO_Pin_10); GPIO_SetBits(GPIOD, GPIO_Pin_11); break; default: break; } }

为什么我想跟进程序中的OSMboxCreate函数,却出现以上截图,进不去这个函数,为什么呢?[/mw_shl_code]
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165540
金钱
165540
注册时间
2010-12-1
在线时间
2117 小时
发表于 2014-4-24 23:38:57 | 显示全部楼层
回复【楼主位】a598009273:
---------------------------------
截图在哪里?
我是开源电子网www.openedv.com站长,有关站务问题请与我联系。
正点原子STM32开发板购买店铺http://openedv.taobao.com
正点原子官方微信公众平台,点击这里关注“正点原子”
回复 支持 反对

使用道具 举报

18

主题

53

帖子

0

精华

初级会员

Rank: 2

积分
145
金钱
145
注册时间
2014-4-15
在线时间
0 小时
 楼主| 发表于 2014-4-25 09:14:54 | 显示全部楼层


这是我想跟进OSMboxPost 这个函数出现的情况。


这是编译时总出现那个错误,求解啊
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-7-7 11:43

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表