Everything

cre_mbf

acre_mbf

Outline
Create message buffer.
C format
 ER      cre_mbf (ID mbfid, T_CMBF *pk_cmbf );
 ER_ID   acre_mbf ( T_CMBF *pk_cmbf );
Parameter(s)
I/O
Parameter
Description
I
 ID      mbfid;
ID number of the message buffer.
I
 T_CMBF  *pk_cmbf;
Pointer to the packet containing the message buffer creation information.

[Message buffer creation information packet : T_CMBF]
 typedef struct  t_cmbf {
     ATR     mbfatr;   /*Message buffer attribute*/
     UINT    maxmsz;   /*Maximum message size (in bytes)*/
     UINT    mbfsz;    /*Size of the message buffer area (in bytes)*/
     VP      mbf;      /*Start address of the message buffer area*/
 } T_CMBF;

Explanation
This service call can be called from tasks that belong to Trusted Domain.
The cre_mbf creates a message buffer with message buffer ID indicated by mbfid according to the content of pk_cmbf. The acre_mbf creates a message buffer according to the content of pk_cmbf, and returns the created message buffer ID.
1 ) Message buffer attribute (mbfatr)
Only TA_TFIFO can be specified for mbfatr.
- TA_TFIFO ( = 0x0000)
Task wait queue for sending is managed in FIFO order.
Note Task wait queue for receiving is managed in FIFO order.
2 ) Maximum message size (maxmsz)
Specify the maximum size of message which can be sent to this message buffer. The size of the reception area specified by rcv_mbf, prcv_mbf and trcv_mbf must be not less than maxmsz.
3 ) Size of the message buffer area (mbfsz), Start address of the message buffer area (mbf)
The application acquires mbfsz bytes of message buffer area and specifies the start address for mbf.
It is also possible to specify 0 as mbfsz. In this case, since message cannot be stored in the message buffer, the message sending task or message 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, message sending tasks and message receiving tasks are completely synchronized. Note, mbf is disregarded when mbfsz is 0.
Note 1 The RI600PX is not concerned of anything of the access permission to the message buffer area. Usually, the message buffer area should be generated to the area other than memory objects and user stacks. When the message buffer area is generated in the memory object, a task with the operand-writie access permission to the memory object might rewrite message buffer area by mistake.
Note 2 The mITRON4.0 specification defines the function that the kernel allocates message buffer area when NULL is specified for mbf. But RI600PX does not support this function.
Return value
Macro
Value
Description
-
Positive value
Normal completion of acre_mbf. (Created message buffer ID)
E_OK
0
Normal completion of cre_mbf.
E_RSATR
-11
Reserved attribute
- mbfatr != TA_TFIFO
E_PAR
-17
Parameter error.
- pk_cmbf == NULL
- maxmsz == 0, maxmsz > 65528
- 0 < mbfsz < 8, mbfsz > 65532
- mbfsz == 0 and mbf + mbfsz > 0x100000000
- mbfsz == 0 and mbfsz < maxmsz + VTSZ_MBFTBL
E_ID
-18
Invalid ID number. (only for cre_mbf)
- mbfid < 0
- mbfid > VTMAX_MBF
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_cmbf 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.
- mbfsz != 0 and mbf == NULL
E_NOID
-34
No ID number available.(only for acre_mbf)
E_OBJ
-41
Object state error. (only for cre_mbf)
- The message buffer specified by mbfid exists.