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 #151 background imageLoading...
Page #151 background image
Tasks
Thread Scheduling 4-47
Example 4.7. Time-Slice Scheduling (continued)
/* ======== main ======== */
Void main()
{
LOG_printf(&trace, "Slice example started!");
counts_per_us = CLK_countspms() / 1000;
}
/* ======== task ======== */
Void task(Arg id_arg)
{
Int id = ArgToInt(id_arg);
LgUns time;
LgUns prevtime;
/*
* The while loop below simulates the work load of
* the time sharing tasks
*/
while (1) {
time = CLK_gethtime() / counts_per_us;
/* print time only every 200 usec */
if (time >= prevtime + 200) {
prevtime = time;
LOG_printf(&trace, "Task %d: time is(us) Ox%x",
id, (Int)time);
}
/* check for rollover */
if (prevtime > time) {
prevtime = time;
}
/*
* pass through idle loop to pump data to the Real-Time
* Analysis tools
*/
TSK_disable();
IDL_run();
TSK_enable();
}
}
/* ======== hi_pri_task ======== */
Void hi_pri_task(Arg id_arg)
{
Int id = ArgToInt(id_arg);
while (1) {
LOG_printf(&trace, "Task %d here", id);
SEM_pend(&sem, SYS_FOREVER);
}
}

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