Changeset 6ff1ac4e in rtems
- Timestamp:
- 06/04/99 13:37:23 (24 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- eb91a4b
- Parents:
- 0e99ecfc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/itron3.0/semaphore.t
r0e99ecfc r6ff1ac4e 50 50 @example 51 51 @group 52 /* 53 * Create Semaphore (cre_sem) Structure 54 */ 55 52 56 typedef struct t_csem @{ 53 VP exinf; /* extended information */ 54 ATR sematr; /* semaphore attributes */ 55 /* Following is the extended function for [level X]. */ 56 INT isemcnt; /* initial semaphore count */ 57 INT maxsem; /* maximum semaphore count */ 58 ... 59 /* additional information may be included depending on the 60 implementation */ 61 ... 57 VP exinf; /* extended information */ 58 ATR sematr; /* semaphore attributes */ 59 /* Following is the extended function for [level X]. */ 60 INT isemcnt; /* initial semaphore count */ 61 INT maxsem; /* maximum semaphore count */ 62 /* additional information may be included depending on the implementation */ 62 63 @} T_CSEM; 63 64 64 sematr: 65 TA_TFIFO H'0...00 /* waiting tasks are handled by FIFO */ 66 TA_TPRI H'0...01 /* waiting tasks are handled by priority */ 65 /* 66 * sematr - Semaphore Attribute Values 67 */ 68 69 #define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ 70 #define TA_TPRI 0x01 /* waiting tasks are handled by priority */ 67 71 68 72 @end group … … 73 77 @table @b 74 78 @item exinf 75 is the extended information XXX 79 is for any extended information that the implementation may define. 80 This implementation does not use this field. 76 81 77 82 @item sematr … … 89 94 @end table 90 95 96 @subsection Building a Semaphore's Attribute Set 97 98 In general, an attribute set is built by a bitwise OR 99 of the desired attribute components. The following table lists 100 the set of valid semaphore attributes: 101 102 @itemize @bullet 103 @item @code{TA_TFIFO} - tasks wait by FIFO 104 105 @item @code{TA_TPRI} - tasks wait by priority 106 107 @end itemize 108 109 Attribute values are specifically designed to be 110 mutually exclusive, therefore bitwise OR and addition operations 111 are equivalent as long as each attribute appears exactly once in 112 the component list. 113 91 114 @subsection T_RSEM Structure 92 115 … … 97 120 @example 98 121 @group 122 /* 123 * Reference Semaphore (ref_sem) Structure 124 */ 125 99 126 typedef struct t_rsem @{ 100 VP exinf; /* extended information */ 101 BOOL_ID wtsk; /* indicates whether or not there is a 102 waiting task */ 103 INT semcnt; /* current semaphore count */ 104 ... 105 /* additional information may be included depending on the 106 implementation */ 107 ... 127 VP exinf; /* extended information */ 128 BOOL_ID wtsk; /* indicates whether or not there is a waiting task */ 129 INT semcnt; /* current semaphore count */ 130 /* additional information may be included depending on the implementation */ 108 131 @} T_RSEM; 109 132 @end group … … 113 136 114 137 @item exinf 115 is extended information. 138 is for any extended information that the implementation may define. 139 This implementation does not use this field. 116 140 117 141 @item wtsk 118 142 is TRUE when there is one or more task waiting on the semaphore. 119 It is FALSE if no tasks are currently waiting. 143 It is FALSE if no tasks are currently waiting. The meaning of this 144 field is allowed to vary between ITRON implementations. It may have 145 the ID of a waiting task, the number of tasks waiting, or a boolean 146 indication that one or more tasks are waiting. 120 147 121 148 @item semcnt … … 123 150 124 151 @end table 152 153 The information in this table is very volatile and should be used 154 with caution in an application. 125 155 126 156 @section Operations … … 131 161 restricts the semaphore to being a binary semaphore. When the 132 162 binary semaphore is available, the count is 1. When the binary 133 semaphore is unavailable, the count is 0.; 163 semaphore is unavailable, the count is 0. 164 165 Since this does not result in a true binary semaphore, advanced 166 binary features like the Priority Inheritance and Priority 167 Ceiling Protocols are not available. 134 168 135 169 @section System Calls … … 166 200 @code{E_OK} - Normal Completion 167 201 202 @code{E_ID} - Invalid ID number (semid was invalid or could not be used) 203 168 204 @code{E_NOMEM} - Insufficient memory (Memory for control block cannot be 169 205 allocated) 170 206 171 @code{E_ID} - Invalid ID number (semid was invalid or could not be used) 207 @code{E_OACV} - Object access violation (A semid less than -4 was 208 specified from a user task. This is implementation dependent.) 172 209 173 210 @code{E_RSATR} - Reserved attribute (sematr was invalid or could not be … … 176 213 @code{E_OBJ} - Invalid object state (a semaphore of the same ID already 177 214 exists) 178 179 @code{E_OACV} - Object access violation (A semid less than -4 was180 specified from a user task. This is implementation dependent.)181 215 182 216 @code{E_PAR} - Parameter error (pk_csem is invalid and/or isemcnt or … … 197 231 @subheading DESCRIPTION: 198 232 199 233 This routine creates a semaphore that resides on the local node. The 234 semaphore is initialized based on the attributes specified in the 235 @code{pk_csem} structure. The initial and maximum counts of the 236 semaphore are set based on the @code{isemcnt} and @code{maxsem} fields 237 in this structure. 238 239 Specifying @code{TA_TPRI} in the @code{sematr} field of the 240 semaphore attributes structure causes tasks 241 waiting for a semaphore to be serviced according to task 242 priority. When @code{TA_TFIFO} is selected, tasks are serviced in First 243 In-First Out order. 200 244 201 245 @subheading NOTES: 202 246 203 NONE 204 247 Multiprocessing is not supported. Thus none of the "EN_" status codes 248 will be returned. 249 250 All memory is preallocated for RTEMS ITRON objects. Thus, no dynamic 251 memory allocation is performed by @code{cre_sem} and the @code{E_NOMEM} 252 error can not be returned. 253 254 The ITRON specification calls for @code{E_OACV} to be returned for 255 some invalid semaphore IDs. This implementation returns @code{E_ID} 256 for all invalid IDs as there are no system reserved ITRON objects. 257 258 This directive will not cause the running task to be 259 preempted. 260 261 The following semaphore attribute constants are 262 defined by RTEMS: 263 264 @itemize @bullet 265 @item @code{TA_TFIFO} - tasks wait by FIFO 266 267 @item @code{TA_TPRI} - tasks wait by priority 268 269 @end itemize 205 270 206 271 @c … … 226 291 @subheading STATUS CODES: 227 292 228 @subheading DESCRIPTION:229 230 293 @code{E_OK} - Normal Completion 231 294 … … 245 308 task-independent portion 246 309 310 @subheading DESCRIPTION: 311 312 This routine deletes the semaphore specified by @code{semid}. 313 All tasks blocked waiting to acquire the semaphore will be 314 readied and returned a status code which indicates that the 315 semaphore was deleted. The control block for this semaphore 316 is reclaimed by RTEMS. 317 247 318 248 319 @subheading NOTES: 249 320 250 NONE 321 Multiprocessing is not supported. Thus none of the "EN_" status codes 322 will be returned. 323 324 This implementation does not distinguish between an invalid ID (@code{E_ID}) 325 and a valid id for a non-existent object (@code{E_NOEXS}). In addition, 326 there are no system reserved ITRON objects so the @code{E_OACV} error 327 is not returned. All IDs which do not correspond to an active user 328 created semaphore return @code{E_ID}. 329 330 The calling task will be preempted if it is enabled 331 by the task's execution mode and a higher priority local task is 332 waiting on the deleted semaphore. The calling task will NOT be 333 preempted if all of the tasks that are waiting on the semaphore 334 are remote tasks. 335 336 The calling task does not have to be the task that 337 created the semaphore. Any local task that knows the semaphore 338 id can delete the semaphore. 251 339 252 340 … … 297 385 @subheading NOTES: 298 386 299 NONE 300 387 Multiprocessing is not supported. Thus none of the "EN_" status codes 388 will be returned. 389 390 This implementation does not distinguish between an invalid ID (@code{E_ID}) 391 and a valid id for a non-existent object (@code{E_NOEXS}). In addition, 392 there are no system reserved ITRON objects so the @code{E_OACV} error 393 is not returned. All IDs which do not correspond to an active user 394 created semaphore return @code{E_ID}. 301 395 302 396 @c … … 332 426 specified from a user task. This is implementation dependent.) 333 427 334 @code{E_PAR} - Parameter error (tmout is -2 or less)335 336 428 @code{E_DLT} - The object being waited for was deleted (the specified 337 429 semaphore was deleted while waiting) … … 339 431 @code{E_RLWAI} - Wait state was forcibly released (rel_wai was received 340 432 while waiting) 341 342 @code{E_TMOUT} - Polling failure or timeout exceeded343 433 344 434 @code{E_CTX} - Context error (issued from task-independent portions or a … … 352 442 outside supported range was specified for tmout) 353 443 354 355 444 @subheading DESCRIPTION: 356 445 446 This routine attempts to acquire the semaphore specified by @code{semid}. 447 If the semaphore is available (i.e. positive semaphore count), then the 448 semaphore count is decremented and the calling task returns immediately. 449 Otherwise the calling tasking is blocked until the semaphore is released 450 by a subsequent invocation of @code{sig_sem}. 451 357 452 @subheading NOTES: 358 453 359 NONE 360 454 Multiprocessing is not supported. Thus none of the "EN_" status codes 455 will be returned. 456 457 This implementation does not distinguish between an invalid ID (@code{E_ID}) 458 and a valid id for a non-existent object (@code{E_NOEXS}). In addition, 459 there are no system reserved ITRON objects so the @code{E_OACV} error 460 is not returned. All IDs which do not correspond to an active user 461 created semaphore return @code{E_ID}. 462 463 If the semaphore is not available, then the calling task will be blocked. 361 464 362 465 @c … … 392 495 specified from a user task. This is implementation dependent.) 393 496 394 @code{E_PAR} - Parameter error (tmout is -2 or less)395 396 @code{E_DLT} - The object being waited for was deleted (the specified397 semaphore was deleted while waiting)398 399 @code{E_RLWAI} - Wait state was forcibly released (rel_wai was received400 while waiting)401 402 497 @code{E_TMOUT} - Polling failure or timeout exceeded 403 498 … … 412 507 outside supported range was specified for tmout) 413 508 414 415 509 @subheading DESCRIPTION: 416 510 511 This routine attempts to acquire the semaphore specified by @code{semid}. 512 If the semaphore is available (i.e. positive semaphore count), then the 513 semaphore count is decremented and the calling task returns immediately. 514 Otherwise, the @code{E_TMOUT} error is returned to the calling task to 515 indicate the semaphore is unavailable. 516 417 517 @subheading NOTES: 418 518 419 NONE 420 519 Multiprocessing is not supported. Thus none of the "EN_" status codes 520 will be returned. 521 522 This implementation does not distinguish between an invalid ID (@code{E_ID}) 523 and a valid id for a non-existent object (@code{E_NOEXS}). In addition, 524 there are no system reserved ITRON objects so the @code{E_OACV} error 525 is not returned. All IDs which do not correspond to an active user 526 created semaphore return @code{E_ID}. 527 528 This routine will not cause the running task to be preempted. 421 529 422 530 @c … … 473 581 outside supported range was specified for tmout) 474 582 475 476 583 @subheading DESCRIPTION: 477 584 585 This routine attempts to acquire the semaphore specified by @code{semid}. 586 If the semaphore is available (i.e. positive semaphore count), then the 587 semaphore count is decremented and the calling task returns immediately. 588 Otherwise the calling tasking is blocked until the semaphore is released 589 by a subsequent invocation of @code{sig_sem} or the timeout period specified 590 by @code{tmout} milliseconds is exceeded. If the timeout period is exceeded, 591 then the @code{E_TMOUT} error is returned. 592 593 By specifiying @code{tmout} as @code{TMO_FEVR}, this routine has the same 594 behavior as @code{wai_sem}. Similarly, by specifiying @code{tmout} as 595 @code{TMO_POL}, this routine has the same behavior as @code{preq_sem}. 596 478 597 @subheading NOTES: 479 598 480 NONE 481 599 Multiprocessing is not supported. Thus none of the "EN_" status codes 600 will be returned. 601 602 This implementation does not distinguish between an invalid ID (@code{E_ID}) 603 and a valid id for a non-existent object (@code{E_NOEXS}). In addition, 604 there are no system reserved ITRON objects so the @code{E_OACV} error 605 is not returned. All IDs which do not correspond to an active user 606 created semaphore return @code{E_ID}. 607 608 This routine may cause the calling task to block. 609 610 A clock tick is required to support the timeout functionality of 611 this routine. 482 612 483 613 @c … … 530 660 @subheading DESCRIPTION: 531 661 662 This routine returns status information on the semaphore specified 663 by @code{semid}. The @code{pk_rsem} structure is filled in by 664 this service call. 665 532 666 @subheading NOTES: 533 667 534 NONE 535 668 Multiprocessing is not supported. Thus none of the "EN_" status codes 669 will be returned. 670 671 This implementation does not distinguish between an invalid ID (@code{E_ID}) 672 and a valid id for a non-existent object (@code{E_NOEXS}). In addition, 673 there are no system reserved ITRON objects so the @code{E_OACV} error 674 is not returned. All IDs which do not correspond to an active user 675 created semaphore return @code{E_ID}. 676 677 This routine will not cause the running task to be preempted. 678
Note: See TracChangeset
for help on using the changeset viewer.