tget_mpf

Outline

Acquire fixed-sized memory block (with timeout).

C format

 ER      tget_mpf ( ID mpfid, VP *p_blk, TMO tmout );


Assembly format

 MOVW    AX, #tmout_hi
 PUSH    AX
 MOVW    AX, #tmout_lo
 PUSH    AX
 MOVW    BC, #LOWW(_p_blk)
 MOV     A, #mpfid
 CALL    !!_tget_mpf
 ADDW    SP, #0x0004


Parameter(s)

I/O

Parameter

Description

I

 ID      mpfid;
ID number of the fixed-sized memory pool from which a memory block is acquired.

O

 VP      *p_blk;
Start address of the acquired memory block.

I

 TMO     tmout;
Specified timeout (unit: ticks).

TMO_FEVR: Waiting forever.

TMO_POL: Polling.

Value: Specified timeout.



Explanation

This service call acquires the memory block from the fixed-sized memory pool specified by parameter mpfid and stores the start address in the area specified by parameter p_blk.

If a memory block could not be acquired from the target fixed-sized memory pool (no available memory blocks exist) when this service call is issued, memory block acquisition processing is not performed but the invoking task is queued to the target fixed-sized memory pool wait queue in the order of memory block acquisition request (FIFO order).

As a result, the invoking task is unlinked from the ready queue and is moved from the RUNNING state to the WAITING state (waiting state for a fixed-sized memory block).

The waiting state for a fixed-sized memory block is cancelled in the following cases, and then moved to the READY state.

Waiting State for a Fixed-sized Memory Block Cancel Operation

Return Value

A memory block was returned to the target fixed-sized memory pool as a result of issuing rel_mpf.

E_OK

Forced release from waiting (accept rel_wai while waiting).

E_RLWAI

Forced release from waiting (accept irel_wai while waiting).

E_RLWAI

Polling failure or timeout.

E_TMOUT



Note When TMO_FEVR is specified for wait time tmout, processing equivalent to get_mpf will be executed. When TMO_POL is specified, processing equivalent to pget_mpf will be executed.

Return value

Macro

Value

Description

E_OK

0

Normal completion.

E_RLWAI

-49

Forced release from waiting (accept rel_wai/irel_wai while waiting).

E_TMOUT

-50

Polling failure or timeout.