RTEMS ITRON 3.0 API User's Guide
ER cre_sem( ID semid, T_CSEM *pk_csem );
E_OK
- Normal Completion
E_ID
- Invalid ID number (semid was invalid or could not be used)
E_NOMEM
- Insufficient memory (Memory for control block cannot be
allocated)
E_OACV
- Object access violation (A semid less than -4 was
specified from a user task.)
E_RSATR
- Reserved attribute (sematr was invalid or could not be
used)
E_OBJ
- Invalid object state (a semaphore of the same ID already
exists)
E_PAR
- Parameter error (pk_csem is invalid and/or isemcnt or
maxsem is negative or invalid)
EN_OBJNO
- An object number which could not be accessed on the
target node is specified.
EN_CTXID
- Specified an object on another node when the system call
was issued from a task in dispatch disabled state or from a task-
independent portion
EN_PAR
- A value outside the range supported by the target node
and/or transmission packet format was specified as a parameter (a value
outside supported range was specified for exinf, sematr, isemcnt and/or
maxsem)
This routine creates a semaphore that resides on the local node. The
semaphore is initialized based on the attributes specified in the
pk_csem
structure. The initial and maximum counts of the
semaphore are set based on the isemcnt
and maxsem
fields
in this structure.
Specifying TA_TPRI
in the sematr
field of the
semaphore attributes structure causes tasks
waiting for a semaphore to be serviced according to task
priority. When TA_TFIFO
is selected, tasks are serviced in First
In-First Out order.
Multiprocessing is not supported. Thus none of the "EN_" status codes will be returned.
All memory is preallocated for RTEMS ITRON objects. Thus, no dynamic
memory allocation is performed by cre_sem
and the E_NOMEM
error can not be returned.
This directive will not cause the running task to be preempted.
The following semaphore attribute constants are defined by RTEMS:
TA_TFIFO
- tasks wait by FIFO
TA_TPRI
- tasks wait by priority
RTEMS ITRON 3.0 API User's Guide
Copyright © 1988-2000 OAR Corporation