这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » VxWorks入门求助

共6条 1/1 1 跳转至

VxWorks入门求助

菜鸟
2006-07-12 07:24:59     打赏

请教诸位高手:我是一个初学者,我在我的第一个 VxWorks 程序实验模拟时发现一个问题,我在调用函

数progStart()和progStop()时,按先后次序各调用一次任务创建和删除没什么问题,但是若连续调用两

次progStart()然后再连续调用progStop()两次,则只能删除一组任务,有一组任务是删不掉的,而且这

个时候也只会运行taskSend()而不会运行taskReceive() 了,请问我的程序哪里出现了问题,请高手们帮

忙指点一下,小弟先谢过了!
调用两次progStart()和两次progStop()后的结果:
-> progStart(一次)

HELLO_OK!value = 0 = 0x0
-> i
NAME ENTRY TID PRI STATUS PC SP ERRNO DELAY
---------- ------------ -------- --- ---------- -------- -------- ------- -----
tExcTask _excTask f18de0 0 PEND 408358 f18ce0 0 0
tLogTask _logTask f132b0 0 PEND 408358 f131b0 0 0
tWdbTask _wdbTask f0e668 3 READY 408358 f0e518 0 0
tSend _taskSend f1e610 200 DELAY 408358 f1e564 0 84
tReceive _taskReceive f00f60 220 PEND 408358 f00e74 0 0
value = 0 = 0x0
-> progStart (两次)

HELLO_OK!value = 0 = 0x0
-> i
NAME ENTRY TID PRI STATUS PC SP ERRNO DELAY
---------- ------------ -------- --- ---------- -------- -------- ------- -----
tExcTask _excTask f18de0 0 PEND 408358 f18ce0 0 0
tLogTask _logTask f132b0 0 PEND 408358 f131b0 0 0
tWdbTask _wdbTask f0e668 3 READY 408358 f0e518 0 0
tSend _taskSend f1e610 200 DELAY 408358 f1e564 0 114
tSend _taskSend f091c8 200 DELAY 408358 f0911c 0 80
tReceive _taskReceive f00f60 220 PEND 408358 f00e74 0 0
tReceive _taskReceive f05648 220 PEND 408358 f0555c 0 0
value = 0 = 0x0
-> progStop (一次)
BYE!The End!
value = 13 = 0xd = __major_os_version__ + 0x9
-> i
NAME ENTRY TID PRI STATUS PC SP ERRNO DELAY
---------- ------------ -------- --- ---------- -------- -------- ------- -----
tExcTask _excTask f18de0 0 PEND 408358 f18ce0 0 0
tLogTask _logTask f132b0 0 PEND 408358 f131b0 0 0
tWdbTask _wdbTask f0e668 3 READY 408358 f0e518 0 0
tSend _taskSend f1e610 200 DELAY 408358 f1e564 0 15
tReceive _taskReceive f00f60 220 PEND 408358 f00e74 0 0
value = 0 = 0x0
-> progStop (两次)
BYE!The End!
value = 13 = 0xd = __major_os_version__ + 0x9
-> i
NAME ENTRY TID PRI STATUS PC SP ERRNO DELAY
---------- ------------ -------- --- ---------- -------- -------- ------- -----
tExcTask _excTask f18de0 0 PEND 408358 f18ce0 0 0
tLogTask _logTask f132b0 0 PEND 408358 f131b0 0 0
tWdbTask _wdbTask f0e668 3 READY 408358 f0e518 0 0
tSend _taskSend f1e610 200 DELAY 408358 f1e564 3d0001 11
tReceive _taskReceive f00f60 220 PEND 408358 f00e74 0 0
value = 0 = 0x0
-> progStop (三次)
BYE!The End!
value = 13 = 0xd = __major_os_version__ + 0x9
-> i
NAME ENTRY TID PRI STATUS PC SP ERRNO DELAY
---------- ------------ -------- --- ---------- -------- -------- ------- -----
tExcTask _excTask f18de0 0 PEND 408358 f18ce0 0 0
tLogTask _logTask f132b0 0 PEND 408358 f131b0 0 0
tWdbTask _wdbTask f0e668 3 READY 408358 f0e518 0 0
tSend _taskSend f1e610 200 DELAY 408358 f1e564 3d0001 116
tReceive _taskReceive f00f60 220 PEND 408358 f00e74 0 0
value = 0 = 0x0
VxSim窗口结果:

Send a data!Receive a data!
Send a data!Receive a data!
Send a data!Receive a data!
到现在为止是正常的结果,调用两次两次progStop()后的结果变为:
Send a data!
Send a data!
Send a data!
Send a data!
程序源代码:
/*File name:example_task
Deskription:This example is my first example using ARM_IDE
in this example,there are some functions it's a simple multi_task example*/
/* includes */

#include "vxWorks.h"
#include "stdio.h"
#include "stdlib.h"
#include "semLib.h"
#include "taskLib.h"
#include "sysLib.h"


/* defines */

#define STACK_SIZE 2000


/* globals */

SEM_ID dataSemId; /* Given when a datum is available */
int tidSend; /*Send task_id*/
int tidReceive; /*Receive task_id*/

/* forward declarations */

/*void progStart (void);*/
void taskSend (void);
void taskReceive (void);
void SendInit (void);
void ReceiveInit (void);
void progStop (void);

/*************************************************************************
*
* progStart - start the sample program.
*
* Create various semaphores and spawn various tasks, while doing
* incredibly little error checking.
* RETURNS: OK
* RETURNS: N/A
*/

STATUS progStart (void)
{
dataSemId = semBCreate (SEM_Q_FIFO, SEM_EMPTY);

/* get started */

tidSend = taskSpawn ("tSend", 200, 0, STACK_SIZE,
(FUNCPTR) taskSend,0,0,0,0,0,0,0,0,0,0);

tidReceive = taskSpawn ("tReceive", 220, 0, STACK_SIZE,
(FUNCPTR) taskReceive,0,0,0,0,0,0,0,0,0,0);

printf("\nHELLO_OK!");
return (OK) ;
}

/*************************************************************************
* name:taskSend
* send dataSemId per 2s
*/

void taskSend (void)
{
SendInit();

while(1)
{
taskDelay(sysClkRateGet()*2);
semGive(dataSemId);
printf("\nSend a data!");
}
return;
}

/*************************************************************************
* name:taskReceive
* waiting dataSemId
*/

void taskReceive (void)
{
ReceiveInit();

while(1)
{
semTake(dataSemId,WAIT_FOREVER);
printf("\nReceive a data!");

}
return;
}

/*************************************************************************
* name:SendInit
*
*/

void SendInit (void)
{

printf("\nInitial Send Task!");

return;
}

/*************************************************************************
* name:ReceiveInit
*
*/

void ReceiveInit (void)
{

printf("\nInitial Receive Task!");

return;
}

/*************************************************************************
*
* progStop - stops the program
*
* Call this routine to end it all.
*/

void progStop (void)
{

semDelete (dataSemId);

taskDelete (tidSend);
taskDelete (tidReceive);

printf ("BYE!The End!\n");
return;
}




关键词: VxWorks     入门     求助     progStop     ta    

菜鸟
2006-07-12 07:27:00     打赏
2楼
请教各位高手留步指点了,小弟不胜感激!

菜鸟
2006-07-12 23:35:00     打赏
3楼

高手啊 ,帮帮我啊 !


菜鸟
2006-07-13 17:56:00     打赏
4楼

各位高手 版主支持一下啊,帮帮看看!谢谢


菜鸟
2006-07-15 22:26:00     打赏
5楼

哈哈,真搞笑,竟然没有人肯帮忙!!!!!!!!!!


菜鸟
2006-07-20 21:30:00     打赏
6楼

加一个群里,问问!你的这个操作系统是不对外开放源码的,所以知道的 人也少


共6条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]