SPECALIZED EXPERIMENTS ON EMBEDDED SYSTEMS
SPECALIZED EXPERIMENTS ON EMBEDDED SYSTEMS
#include "vxWorks.h"
#include "taskLib.h"
#include "semLib.h"
#include "msgQLib.h"
#include "msgqdemo.h"
#include "sysLib.h"
#include "stdio.h"
/* function prototypes */
/* DESCRIPTION
* Creates a Message Queue for inter Task communication between
the producer Task and the consumer Task. Spawns the producer Task
that creates messages and sends messages to the consumer Task
using the message queue. Spawns the consumer Task that reads
messages from the message queue. After consumer Task has consumed
all the messages, the message queue is deleted.
*/
STATUS msgQDemo()
{
notDone = TRUE; /* initialize the global flag */
== NULL)
{
perror ("Error in creating msgQ");
return (ERROR);
}
/* Send Messages */
if ((msgQSend (msgQId, (char *) &producedItem, sizeof
(producedItem), WAIT_FOREVER, MSG_PRI_NORMAL)) == ERROR)
{
perror ("Error in sending the message");
return (ERROR);
}
else
{
if (semGive (semId2) == ERROR)
{
perror ("taskA: Error in semGive");
return (ERROR);
}
printf ("ProducerTask: tid = %#x, produced value
= %d \n", taskIdSelf (), value);
}
}
return (OK);
}
/**************************************************************
* consumerTask - consumes all the messages from the message
queue.
* RETURNS: OK or ERROR
*/
CREATING A PROJECT:
6. For that new project create a new workspace and create the downloadable
application modules and press OK….
7. Again specify the type and location of this new project which is created.
10. Again we come to the main workspace window where we can see the new
project we created. Click on the project files and Rebuild All in VxWorks.
11. If properly done, the following will be the results.
12. Click “new” and select C/C++ as a Source File and give the “C” file name and
also give the location.
13. So a new c-file is added in the project and now we compile the program.
18. Go to the “Tools” and select “Target Server” and click “Configure”
19. Now configure the target servers. Give the target server name and specify its properties
also give file name and give Target IP address.
20. Go back to workspace and expand the object Modules. Click “ex1.o” and download it.
21. After downloading we get the following results….