cre_flg

acre_flg

Outline

Create eventflag.

C format

 ER      cre_flg (ID flgid, T_CFLG *pk_cflg );
 ER_ID   acre_flg ( T_CFLG *pk_cflg );
Parameter(s)

I/O

Parameter

Description

I

 ID      flgid;
ID number of the eventflag.

I

 T_CFLG  *pk_cflg;
Pointer to the packet containing the eventflag creation information.



[Eventflag creation information packet : T_CFLG]

 typedef struct  t_cflg {
     ATR     flgatr;         /*Eventflag attribute*/
     FLGPTN  iflgptn;        /*Initial bit pattern*/
 } T_CFLG;


Explanation

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

The cre_flg creates a eventflag with eventflag ID indicated by flgid according to the content of pk_cflg. The acre_flg creates a eventflag according to the content of pk_cflg, and returns the created eventflag ID.

1 ) Eventflag attribute (flgatr)
The following are specified for flgatr.


   flgatr := ( ( TA_TFIFO || TA_TPRI  | ( TA_WSGL || TA_WMUL ) | [TA_CLR] )
- 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.
When TA_CLR attribute is not specified, even if there is the TA_TPRI attribute specified, the queue is managed in the same way as for the TA_TFIFO attribute. This behavior falls outside mITRON4.0 specification.



- TA_WSGL ( = 0x0000)
Does not permit multiple tasks to wait for the eventflag.


- TA_WMUL ( = 0x0002)
Permit multiple tasks to wait for the eventflag.


- TA_CLR ( = 0x0004)
All the bits of the eventflag are cleared when wai_flg, pol_flg, ipol_flg or twai_flg ends normally.


2 ) Initial bit pattern (iflgptn)
Specify initial eventflag bit pattern.


Return value

Macro

Value

Description

-

Positive value

Normal completion of acre_flg. (Created eventflag ID)

E_OK

0

Normal completion of cre_flg.

E_RSATR

-11

Reserved attribute

- Either of bits in flgatr except bit0, bit1 and bit2 is 1.

E_PAR

-17

Parameter error.

- pk_cflg == NULL

E_ID

-18

Invalid ID number. (only for cre_flg)

- flgid < 0

- flgid > VTMAX_FLG

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_cflg 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_flg)

E_OBJ

-41

Object state error. (only for cre_flg)

- The eventflag specified by flgid exists.