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.

148 CHAPTER 4. T-KERNEL/OS FUNCTIONS<br />

tk cre mpf<br />

Create Fixed-size Memory Pool<br />

[C Language Interface]<br />

ID mpfid = tk_cre_mpf ( T_CMPF *pk_cmpf ) ;<br />

[Parameters]<br />

T CMPF* pk cmpf Information about the memory pool to be created<br />

pk cmpf detail:<br />

VP exinf Extended information<br />

ATR mpfatr Memory pool attributes<br />

INT mpfcnt Memory pool block count<br />

INT blfsz Memory block size (in bytes)<br />

(Other implementation-dependent parameters may be added beyond this point.)<br />

[Return Parameters]<br />

ID mpfid Fixed-size memory pool ID<br />

or Error Code<br />

[Error Codes]<br />

E OK<br />

E NOMEM<br />

E LIMIT<br />

E RSATR<br />

E PAR<br />

Normal completion<br />

Insufficient memory (memory for control block or memory pool area cannot be allocated)<br />

Number of fixed-size memory pools exceeds the system limit<br />

Reserved attribute (mpfatr is invalid or cannot be used)<br />

Parameter error (pk cmpf is invalid; mpfsz or blfsz is negative or invalid)<br />

[Description]<br />

Creates a fixed-size memory pool, assigning to it a fixed-size memory pool ID.<br />

This system call allocates a memory space for use as a memory pool based on the information designated<br />

in parameters mpfcnt and blfsz, and assigns a control block to the memory pool. A memory block of<br />

size blfsz can be allocated from the created memory pool by calling the tk get mpf system call.<br />

exinf can be used freely by the user to set miscellaneous information about the created memory pool.<br />

The information set in this parameter can be referenced by tk ref mpf. If a larger area is needed<br />

for indicating user information, or if the information may need to be changed after the memory pool<br />

is created, this can be done by allocating separate memory for this purpose and putting the memory<br />

packet address in exinf. The OS pays no attention to the contents of exinf.<br />

mpfatr indicates system attributes in its low bits and implementation-dependent information in the<br />

high bits. Designation in the system attributes part of mpfatr is as follows.<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!