EasyManuals Logo

Texas Instruments TMS320 User Manual

Texas Instruments TMS320
288 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #171 background imageLoading...
Page #171 background image
Mailboxes
Thread Scheduling 4-67
Example 4-15. MBX Example With Two Types of Tasks
/*
* ======== mbxtest.c ========
* Use a MBX mailbox to send messages from multiple writer()
* tasks to a single reader() task.
* The mailbox, reader task, and 3 writer tasks are created
* statically.
*
* This example is similar to semtest.c. The major differences
* are:
* - MBX is used in place of QUE and SEM.
* - the ‘elem’ field is removed from MsgObj.
* - reader() task is *not* higher priority than writer task.
* - reader() looks at return value of MBX_pend() for timeout
*/
#include <std.h>
#include <log.h>
#include <mbx.h>
#include <tsk.h>
#define NUMMSGS 3 /* number of messages */
#define TIMEOUT 10
typedef struct MsgObj {
Int id; /* writer task id */
Char val; /* message value */
} MsgObj, *Msg;
/* Mailbox created with Config Tool */
extern MBX_Obj mbx;
/* "trace" Log created with Config Tool */
extern LOG_Obj trace;
Void reader(Void);
Void writer(Int id);
/*
* ======== main ========
*/
Void main()
{
/* Does nothing */
}

Table of Contents

Other manuals for Texas Instruments TMS320

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TMS320 and is the answer not in the manual?

Texas Instruments TMS320 Specifications

General IconGeneral
BrandTexas Instruments
ModelTMS320
CategoryComputer Hardware
LanguageEnglish

Related product manuals