Everything

cre_dtq

acre_dtq

Outline
Create data queue.
C format
 ER      cre_dtq (ID dtqid, T_CDTQ *pk_cdtq );
 ER_ID   acre_dtq ( T_CDTQ *pk_cdtq );
Parameter(s)
I/O
Parameter
Description
I
 ID      dtqid;
ID number of the data queue.
I
 T_CDTQ  *pk_cdtq;
Pointer to the packet containing the data queue creation information.

[Data queue creation information packet : T_CDTQ]
 typedef struct  t_cdtq {
     ATR    dtqatr; /*Data queue attribute*/
     UINT   dtqcnt; /*Capacity of the data queue area (the number of data elements)*/
     VP     dtq;    /*Start address of the data queue area*/
 } T_CDTQ;

Explanation
This service call can be called from tasks that belong to Trusted Domain.
The cre_dtq creates a data queue with data queue ID indicated by dtqid according to the content of pk_cdtq. The acre_dtq creates a data queue according to the content of pk_cdtq, and returns the created data queue ID.
1 ) Data queue attribute (dtqatr)
The following are specified for dtqatr.
   dtqatr := ( TA_TFIFO || TA_TPRI  
- TA_TFIFO ( = 0x0000)
Task wait queue for sending is managed in FIFO order.
- TA_TPRI ( = 0x0001)
Task wait queue for sending is managed in task current priority order. Among tasks with the same priority, they are queued in FIFO order.
Note Task wait queue for receiving is managed in FIFO order.
2 ) Capacity of the data queue area (dtqcnt), Start address of the data queue area (dtq)
The application acquires TSZ_DTQ(dtqcnt) bytes of data queue area and specifies the start address for dtq.
It is also possible to specify 0 as dtqcnt. In this case, since data cannot be stored in the data queue, the data sending task or data receiving task that has performed its operation first will enter the WAITING state. The WAITING state of that task is canceled when the task of another side has performed its operation. Thus, data sending tasks and data receiving tasks are completely synchronized. Note, dtq is disregarded when dtqcnt is 0.
Note 1 For details of TSZ_DTQ macro, refer to "18.3.2 Macros for Data Queue".
Note 2 The RI600PX is not concerned of anything of the access permission to the data queue area. Usually, the data queue area should be generated to the area other than memory objects and user stacks. When the data queue area is generated in the memory object, a task with the operand-write access permission to the memory object might rewrite data queue area by mistake.
Note 3 The mITRON4.0 specification defines the function that the kernel allocates data queue area when NULL is specified for dtq. But RI600PX does not support this function.
Return value
Macro
Value
Description
-
Positive value
Normal completion of acre_dtq. (Created data queue ID)
E_OK
0
Normal completion of cre_dtq.
E_RSATR
-11
Reserved attribute
- Either of bits in dtqatr except bit0 is 1.
E_PAR
-17
Parameter error.
- pk_cdtq == NULL
- dtqcnt > 65535
- dtqcnt != 0 and dtq + TSZ_DTQ(dtqcnt) > 0x100000000
E_ID
-18
Invalid ID number. (only for cre_dtq)
- dtqid < 0
- dtqid > VTMAX_DTQ
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_cdtq 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.
- dtqcnt != 0 and dtq == NULL
E_NOID
-34
No ID number available.(only for acre_dtq)
E_OBJ
-41
Object state error. (only for cre_dtq)
- The data queue specified by dtqid exists.