Download Salvo User Manual
Transcript
struct,
and initialize it uniquely for each task. At runtime each
task runs independently of the others, managing its own communications channel, defined by the struct. Since only one task function need be defined, substantial savings in code size can be
realized.
The example in Listing 31 illustrates the use of a single, unsignedchar-sized tcb extension tcbExt1 that each of four identical tasks
uses as an index into an array of offsets in the 4KB buffer the tasks
share.
…
const unsigned offset[4] = { 3072,
2048,
1024,
0
};
void TaskBuff( void )
{
for (;;)
{
printf("Task %d's buffer ",
OStID(OScTcbP));
printf("starts at %d\n", offset[OScTcbExt1]);
…
OS_Yield(label);
}
}
main()
{
OSInit();
OSCreateTask(TaskBuff,
OSCreateTask(TaskBuff,
OSCreateTask(TaskBuff,
OSCreateTask(TaskBuff,
OSTCBP(2),
OSTCBP(6),
OSTCBP(7),
OSTCBP(8),
OStcbExt1(OSTCBP(2))
OStcbExt1(OSTCBP(6))
OStcbExt1(OSTCBP(7))
OStcbExt1(OSTCBP(8))
0;
1;
2;
3;
=
=
=
=
1);
1);
1);
1);
for ( i = 0 ; i < 4 ; i++ )
{
OSSched();
}
}
Listing 31: Tcb Extension Example
Each time TaskBuff() runs, it can obtain its offset into the 4KB
buffer through OStcbExt1 for the current task, namely, itself. For
this example, OSENABLE_TCBEXT1 was set to TRUE and
Salvo User Manual
Chapter 5 • Configuration
151
Related documents
Salvo User Manual
Salvo User Manual
Release Notes
Downloading - Pumpkin, Inc.
RM-MSCX86 Salvo Compiler Reference Manual
Application Note
RM-MCC18 Salvo Compiler Reference Manual
GSG-STELLARIS- KRVMDK-ARM Building a Salvo
AVR-GCC - Pumpkin, Inc.
RM-PICC Salvo Compiler Reference Manual – HI
RM-HTARCLITE Salvo Compiler Reference Manual
AN-4 Building a Salvo Application with HI-TECH