30.12.2013 Views

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.6. MEMORY POOL MANAGEMENT FUNCTIONS 149<br />

mpfatr:= (TA_TFIFO || TA_TPRI) | [TA_NODISWAI]<br />

| (TA_RNG0 || TA_RNG1 || TA_RNG2 || TA_RNG3)<br />

TA TFIFO<br />

TA TPRI<br />

TA RNGn<br />

TA NODISWAI<br />

Tasks waiting for memory allocation are queued in FIFO order<br />

Tasks waiting for memory allocation are queued in priority order<br />

Memory access privilege is set to protection level n<br />

Wait disabling by tk dis wai is prohibited<br />

#define TA_TFIFO 0x00000000 /* manage task queue by FIFO */<br />

#define TA_TPRI 0x00000001 /* manage task queue by priority */<br />

#define TA_NODISWAI 0x00000080 /* reject wait disabling */<br />

#define TA_RNG0 0x00000000 /* protection level 0 */<br />

#define TA_RNG1 0x00000100 /* protection level 1 */<br />

#define TA_RNG2 0x00000200 /* protection level 2 */<br />

#define TA_RNG3 0x00000300 /* protection level 3 */<br />

The queuing order of tasks waiting for memory block allocation from a memory pool can be designated<br />

in TA TFIFO or TA TPRI. If the attribute is TA TFIFO, tasks are ordered by FIFO, whereas TA TPRI<br />

designates queuing of tasks in order of their priority setting.<br />

TA RNGn is designated to limit the protection levels at which memory can be accessed. Only tasks<br />

running at the same or higher protection level than the one designated can access the allocated memory.<br />

If a task running at a lower protection level attempts access, a CPU protection fault exception is raised.<br />

For example, memory allocated from a memory pool designated as TA RNG1 can be accessed by tasks<br />

running at levels TA RNG0 or TA RNG1, but not by tasks running at levels TA RNG2 or TA RNG3.<br />

The created memory pool is in resident memory in system space. There is no T-<strong>Kernel</strong> function for<br />

creating a memory pool in task space.<br />

[Additional Notes]<br />

In the case of a fixed-size memory pool, separate memory pools must be provided for different block<br />

sizes. That is, if various memory block sizes are required, memory pools must be created for each block<br />

size.<br />

For the sake of portability, the TA RNGn attribute must be accepted even by a system without an MMU.<br />

It is possible, for example, to treat all TA RNGn designations as equivalent to TA RNG0; but error must<br />

not be returned.<br />

Copyright c○ 2002, 2003 by T-Engine Forum<br />

T-<strong>Kernel</strong> <strong>1.B0.02</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!