get_mpf

Outline

Acquire fixed-sized memory block (waiting forever).

C format

 ER      get_mpf (ID mpfid, VP *p_blk);
Parameter(s)

I/O

Parameter

Description

I

 ID      mpfid;
ID number of the fixed-sized memory pool.

O

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



Explanation

This service call acquires the fixed-sized 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 no fixed-size memory blocks could be acquired from the target fixed-size memory pool (no available fixed-size memory blocks exist) when this service call is issued, this service call does not acquire the fixed-size memory block but queues the invoking task to the target fixed-size memory pool wait queue and moves it from the RUNNING state to the WAITING state (fixed-size memory block acquisition wait state).

The WAITING state for a fixed-sized memory block is cancelled in the following cases.

WAITING State for a Fixed-sized Memory Block Cancel Operation

Return Value

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

E_OK

A fixed-sized memory block was returned to the target fixed-sized memory pool as a result of issuing irel_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

The fixed-sized memory pool is reset as a result of issuing vrst_mpf.

EV_RST



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

Note 2 The contents of the block are undefined.

Note 3 The boundary alignment for the memory blocks acquired is 1. If memory blocks need to be acquired with a larger boundary alignment than that, observe the following:

- Set The size of the fixed-sized memory block (siz_block) in Fixed-sized Memory Pool Information (memorypool[]) to multiple of the desired boundary alignment.

- Specify unique section name to the Section name assigned to the memory pool area (section) in Fixed-sized Memory Pool Information (memorypool[]) and locate the section to the address of the desired boundary alignment when linking.

Return value

Macro

Value

Description

E_OK

0

Normal completion.

E_ID

-18

Invalid ID number.

- mpfid < 0

- mpfid > VTMAX_MPF

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.

- This service call was issued in the status "PSW.IPL > kernel interrupt mask level".

E_RLWAI

-49

Forced release from the WAITING state.

- Accept rel_wai/irel_wai while waiting.

EV_RST

-127

Released from WAITING state by the object reset (vrst_mpf)