cre_mtx

acre_mtx

Outline

Create mutex.

C format

 ER      cre_mtx (ID mtxid, T_CMTX *pk_cmtx );
 ER_ID   acre_mtx ( T_CMTX *pk_cmtx );
Parameter(s)

I/O

Parameter

Description

I

 ID      mtxid;
ID number of the mutex.

I

 T_CMTX  *pk_cmtx;
Pointer to the packet containing the mutex creation information.



[Mutex creation information packet : T_CMTX]

 typedef struct  t_cmtx {
     ATR    mtxatr;         /*Mutex attribute*/
     PRI    ceilpri;        /*Ceiling priority*/
 } T_CMTX;


Explanation

This service call can be called from tasks that belong to Trusted Domain.

The cre_mtx creates a mutex with mutex ID indicated by mtxid according to the content of pk_cmtx. The acre_mtx creates a mutex according to the content of pk_cmtx, and returns the created mutex ID.

1 ) Mutex attribute (mtxatr)
Only TA_CEILING can be specified for mtxatr.


- TA_CEILING ( = 0x0003)
Priority ceiling protocol
For details, refer to "8.2.3 Simplified priority ceiling protocol".



Note Task wait queue is managed in task current priority order. Note, tasks of the same current priority are managed in FIFO order.

2 ) Ceiling priority (ceilpri)
The current task priority of the task which locks a mutex rises to the ceilpri.
Ranges of the value that can be specified are from 1 to TMAX_TPRI.



Return value

Macro

Value

Description

-

Positive value

Normal completion of acre_mtx. (Created mutex ID)

E_OK

0

Normal completion of cre_mtx.

E_RSATR

-11

Reserved attribute

- mtxatr != TA_CEILING.

E_PAR

-17

Parameter error.

- pk_cmtx == NULL

- ceilpri <= 0

- ceilpri > TMAX_TPRI

E_ID

-18

Invalid ID number. (only for cre_mtx)

- mtxid < 0

- mtxid > VTMAX_MTX

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_cmtx has not been permitted to the invoking task.

E_OACV

-27

Object access violation.

- The invoking task does not belong to trusted domain.

E_NOID

-34

No ID number available.(only for acre_mtx)

E_OBJ

-41

Object state error. (only for cre_mtx)

- The mutex specified by mtxid exists.