Everything

cre_mpf

acre_mpf

Outline
Create fixed-sized memory pool.
C format
 ER      cre_mpf (ID mpfid, T_CMPF *pk_cmpf );
 ER_ID   acre_mpf ( T_CMPF *pk_cmpf );
Parameter(s)
I/O
Parameter
Description
I
 ID      mpfid;
ID number of the fixed-sized memory pool.
I
 T_CMPF  *pk_cmpf;
Pointer to the packet containing the fixed-sized memory pool creation information.

[Fixed-sized memory pool creation information packet : T_CMPF]
 typedef struct  t_cmpf {
     ATR    mpfatr;  /*fixed-sized memory pool attribute*/
     UINT   blkcnt;  /*Total number of memory blocks*/
     UINT   blksz;   /*Memory block size (in bytes)*/
     VP     mpf;     /*Start address of the fixed-sized memory pool area*/
     VP     mpfmb;   /*Start address of the fixed-sized memory pool management area*/
 } T_CMPF;

Explanation
This service call can be called from tasks that belong to Trusted Domain.
The cre_mpf creates a fixed-sized memory pool with fixed-sized memory pool ID indicated by mpfid according to the content of pk_cmpf. The acre_mpf creates a fixed-sized memory pool according to the content of pk_cmpf, and returns the created fixed-sized memory pool ID.
1 ) Fixed-sized memory pool attribute (mpfatr)
The following are specified for mpfatr.
   mpfatr := ( TA_TFIFO | TA_TPRI )
- TA_TFIFO ( = 0x0000)
Task wait queue is managed in FIFO order.
- TA_TPRI ( = 0x0001)
Task wait queue is managed in task current priority order. Among tasks with the same priority, they are queued in FIFO order.
2 ) Total number of memory blocks (blkcnt), memory block size (blksz), Start address of the fixed-sized memory pool area (mpf)
The application acquires TSZ_MPF( blkcnt, blksz ) bytes of fixed-sized memory pool area and specifies the start address for mpf.
Note 1 For details of TSZ_MPF macro, refer to "18.3.3 Macros for Fixed-sized Memory Pool".
Note 2 The RI600PX is not concerned of anything of the access permission to the fixed-sized memory pool area. To access to the memory block from task, the memory pool area must be in the memory object with appropriate permission.
Note, the RI600PX generates management tables in the memory pool area. If the management table is rewritten by allocation, correct system operation cannot be guaranteed.
Note 3 The mITRON4.0 specification defines the function that the kernel allocates fixed-sized memory pool area when NULL is specified for mpf. But RI600PX does not support this function.
Note 4 The alignment number of memory block is 1. Please perform the following, in order to enlarge the alignment number of memory blocks.
- Specify the memory block size to a multiple of the desired alignment number at fixed-sized memory pool creation.
- Make the start address of the fixed-sized memory pool area into the address of the desired alignment number.
3 ) Start address of the fixed-sized memory pool management area (mpfmb)
The application acquires TSZ_MPFMB( blkcnt, blksz ) bytes of fixed-sized memory pool management area and specifies the start address for mpfmb.
Note 1 For details of TSZ_MPFMB macro, refer to "18.3.3 Macros for Fixed-sized Memory Pool".
Note 2 The RI600PX is not concerned of anything of the access permission to the fixed-sized memory pool management area. Usually, the fixed-sized memory pool management area should be generated to the area other than memory objects and user stacks. When the fixed-sized memory pool management area is generated in the memory object, a task with the operand-write access permission to the memory object might rewrite the fixed-sized memory pool management area by mistake.
Return value
Macro
Value
Description
-
Positive value
Normal completion of acre_mpf. (Created fixed-sized memory pool ID)
E_OK
0
Normal completion of cre_mpf.
E_RSATR
-11
Reserved attribute
- Either of bits in mpfatr except bit0 is 1.
E_PAR
-17
Parameter error.
- pk_cmpf == NULL
- blkcnt == 0, blkcnt > 65535
- blksz == 0, blksz > 65535
- TSZ_MPF(blkcnt, blksz) > VTMAX_AREASIZE
- mpf + TSZ_MPF(blkcnt, blksz) > 0x100000000
E_ID
-18
Invalid ID number. (only for cre_mpf)
- mpfid < 0
- mpfid > VTMAX_MPF
E_CTX
-25
Context error.
- This service call was issued in the CPU locked state.
- This service call was issued from non-task.
- This service call was issued in the status "PSW.IPL > kernel interrupt mask level".
E_MACV
-26
Memory access violation.
- Stack pointer points out of user stack for invoking task.
- The operand-read access to the area indicated by pk_cmpf has not been permitted to the invoking task.
E_OACV
-27
Object access violation.
- The invoking task does not belong to trusted domain.
E_NOMEM
-33
Insufficient memory.
- mpf == NULL
- mpfmb == NULL
E_NOID
-34
No ID number available.(only for acre_mpf)
E_OBJ
-41
Object state error. (only for cre_mpf)
- The fixed-sized memory pool specified by mpfid exists.