tget_mpl

Outline

Acquire variable-sized memory block (with timeout).

C format

 ER      tget_mpl (ID mplid, UINT blksz, VP *p_blk, TMO tmout);
Parameter(s)

I/O

Parameter

Description

I

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

I

 UINT    blksz;
Memory block size to be acquired (in bytes).

O

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

I

 TMO     tmout;
Specified timeout (unit:millisecond).

TMO_FEVR: Waiting forever.

TMO_POL: Polling.

Value: Specified timeout.



Explanation

This service call acquires a variable-size memory block of the size specified by parameter blksz from the variable-size memory pool specified by parameter mplid, and stores its start address into the area specified by parameter p_blk.

If no variable-size memory blocks could be acquired from the target variable-size memory pool (no successive areas equivalent to the requested size were available) when this service call is issued, this service call does not acquire variable-size memory blocks but queues the invoking task to the target variable-size memory pool wait queue and moves it from the RUNNING state to the WAITING state with timeout (variable-size memory block acquisition wait state).

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

WAITING State for a Variable-sized Memory Block Cancel Operation

Return Value

The variable-size memory block that satisfies the requested size was returned to the target variable-size memory pool as a result of issuing rel_mpl.

E_OK

The variable-size memory block that satisfies the requested size was returned to the target variable-size memory pool as a result of issuing irel_mpl.

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 1 The RI850V4 acquires variable-size memory blocks in the unit of "integral multiple of 4". If a value other than an integral multiple of 4 is specified for parameter blksz, it is rounded up to be an integral multiple of 4.

Note 2 Invoking tasks are queued to the target variable-size memory pool wait queue in the order defined during configuration (FIFO order or priority order).

Note 3 If the variable-size memory block acquisition wait state is cancelled because rel_wai or irel_wai was issued or the wait time elapsed, the contents in the area specified by parameter p_blk become undefined.

Note 4 TMO_FEVR is specified for wait time tmout, processing equivalent to get_mpl will be executed. When TMO_POL is specified, processing equivalent to pget_mpl /ipget_mpl will be executed.

Return value

Macro

Value

Description

E_OK

0

Normal completion.

E_PAR

-17

Parameter error.

- blksz = 0x0

- blksz > 0x7fffffff

- tmout < TMO_FEVR

E_ID

-18

Invalid ID number.

- mplid < 0x0

- mplid > Maximum ID number

E_CTX

-25

Context error.

- This service call was issued from a non-task.

- This service call was issued in the CPU locked state.

- This service call was issued in the dispatching disabled state.

E_NOEXS

-42

Non-existent object.

- Specified variable-sized memory pool is not registered.

E_RLWAI

-49

Forced release from the WAITING state.

- Accept rel_wai/irel_wai while waiting.

E_TMOUT

-50

Timeout.

- Polling failure or timeout.