13.4.2 Semaphore information

Define the following items as semaphore information:

1 ) Semaphore name: semid

2 ) Attribute (queuing method): sematr

3 ) Initial resource count: isemcnt

4 ) System-reserved area: maxsem

The number of semaphore information items that can be specified is defined as being within the range of 0 to 127.

The following shows the semaphore information format.

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


The items constituting the semaphore information are as follows.

1 ) Semaphore name: semid

Specifies the semaphore name.
An object name can be specified for semid.


Note The CF78V4 outputs to the system information header file the correspondence between the semaphore names and IDs, in the following format. Consequently, semaphore names can be used in the place of IDs by including the relevant system information header file using the processing program.

[ Output format to system information header file (for C) ]

 #define semid   ID


[ Output format to system information header file (for assembly language) ]

 semid   .EQU    ID


2 ) Attribute (queuing method): sematr

Specifies the attribute (queuing method) of the semaphore.
The keywords that can be specified for sematr are TA_TFIFO.


[ Queuing method ]

TA_TFIFO: If a resource could not be acquired (semaphore counter is set to 0x0) when wai_sem or twai_sem is issued, the task is queued to the semaphore wait queue in the order of resource acquisition request.

3 ) Initial resource count: isemcnt

Specifies the initial resource count of the semaphore.
A value between 0 and 127 can be specified for isemcnt.


4 ) System-reserved area: maxsem

System-reserved area.
Values that can be specified for maxsem are limited to 127.