17.5.2 Semaphore information

The semaphore information defines ID number: semid, Attribute: sematr, Initial resource count: isemcnt, Maximum resource count: maxsem for a semaphore.

The number of items that can be defined as semaphore information is limited to one for each ID number.

The following shows the semaphore information format.

 CRE_SEM (semid, { sematr, isemcnt, maxsem });


The items constituting the semaphore information are as follows.

1 ) ID number: semid

Specifies the ID number for a semaphore.
A value from 0x1 to 0xff, or a name, can be specified for semid.


Note When a name is specified, the CF850V4 automatically assigns an ID number.
The CF850V4 outputs the relationship between a name and an ID number to the system information header file in the following format:


 #define semid   value
2 ) Attribute: sematr

Specifies the task queuing method for a semaphore.
The keyword that can be specified for sematr is TA_TFIFO or TA_TPRI.


TA_TFIFO: Task wait queue is in FIFO order.

TA_TPRI: Task wait queue is in task priority order.

3 ) Initial resource count: isemcnt

Specifies the initial resource count for a semaphore.
A value from "0x0 to Maximum resource count: maxsem" can be specified for isemcnt.


4 ) Maximum resource count: maxsem

Specifies the maximum resource count for a semaphore.
A value from 0x1 to 0xffff can be specified for maxsem.