[ac7d5ef0] | 1 | /* tqdata.h |
---|
| 2 | * |
---|
| 3 | * This include file contains all the constants and structures |
---|
| 4 | * needed to declare a thread queue. |
---|
| 5 | * |
---|
| 6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
| 7 | * On-Line Applications Research Corporation (OAR). |
---|
| 8 | * All rights assigned to U.S. Government, 1994. |
---|
| 9 | * |
---|
| 10 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
| 11 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
| 12 | * notice must appear in all copies of this file and its derivatives. |
---|
| 13 | * |
---|
[da6375b] | 14 | * $Id$ |
---|
[ac7d5ef0] | 15 | */ |
---|
| 16 | |
---|
[3a4ae6c] | 17 | #ifndef __THREAD_QUEUE_DATA_h |
---|
| 18 | #define __THREAD_QUEUE_DATA_h |
---|
[ac7d5ef0] | 19 | |
---|
| 20 | #ifdef __cplusplus |
---|
| 21 | extern "C" { |
---|
| 22 | #endif |
---|
| 23 | |
---|
[5e9b32b] | 24 | #include <rtems/score/chain.h> |
---|
| 25 | #include <rtems/score/priority.h> |
---|
| 26 | #include <rtems/score/states.h> |
---|
[ac7d5ef0] | 27 | |
---|
| 28 | /* |
---|
| 29 | * The following enumerated type details all of the disciplines |
---|
| 30 | * supported by the Thread Queue Handler. |
---|
| 31 | */ |
---|
| 32 | |
---|
| 33 | typedef enum { |
---|
[3a4ae6c] | 34 | THREAD_QUEUE_DISCIPLINE_FIFO, /* FIFO queue discipline */ |
---|
| 35 | THREAD_QUEUE_DISCIPLINE_PRIORITY /* PRIORITY queue discipline */ |
---|
[ac7d5ef0] | 36 | } Thread_queue_Disciplines; |
---|
| 37 | |
---|
[4250c8b] | 38 | /* |
---|
| 39 | * The following enumerated types indicate what happened while the thread |
---|
| 40 | * queue was in the synchronization window. |
---|
| 41 | */ |
---|
| 42 | |
---|
| 43 | typedef enum { |
---|
| 44 | THREAD_QUEUE_NOTHING_HAPPENED, |
---|
| 45 | THREAD_QUEUE_TIMEOUT, |
---|
| 46 | THREAD_QUEUE_SATISFIED |
---|
| 47 | } Thread_queue_states; |
---|
| 48 | |
---|
[ac7d5ef0] | 49 | /* |
---|
| 50 | * The following record defines the control block used |
---|
| 51 | * to manage each thread. |
---|
| 52 | */ |
---|
| 53 | |
---|
| 54 | #define TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS 4 /* # of pri groups */ |
---|
| 55 | |
---|
| 56 | typedef struct { |
---|
| 57 | union { |
---|
| 58 | Chain_Control Fifo; /* FIFO discipline list */ |
---|
| 59 | Chain_Control Priority[TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS]; |
---|
| 60 | /* priority discipline list */ |
---|
| 61 | } Queues; |
---|
| 62 | boolean sync; /* alloc/dealloc critical section */ |
---|
[4250c8b] | 63 | Thread_queue_states sync_state; /* what happened while in sync */ |
---|
[ac7d5ef0] | 64 | Thread_queue_Disciplines discipline; /* queue discipline */ |
---|
| 65 | States_Control state; /* state of threads on Thread_q */ |
---|
[3a4ae6c] | 66 | unsigned32 timeout_status; |
---|
[5e9b32b] | 67 | unsigned32 count; |
---|
[ac7d5ef0] | 68 | } Thread_queue_Control; |
---|
| 69 | |
---|
| 70 | /* |
---|
| 71 | * _Thread_queue_Header_number |
---|
| 72 | * |
---|
| 73 | * DESCRIPTION: |
---|
| 74 | * |
---|
| 75 | * This function returns the index of the priority chain on which |
---|
| 76 | * a thread of the_priority should be placed. |
---|
| 77 | */ |
---|
| 78 | |
---|
| 79 | STATIC INLINE unsigned32 _Thread_queue_Header_number ( |
---|
[7f6a24ab] | 80 | Priority_Control the_priority |
---|
[ac7d5ef0] | 81 | ); |
---|
| 82 | |
---|
| 83 | /* |
---|
| 84 | * _Thread_queue_Is_reverse_search |
---|
| 85 | * |
---|
| 86 | * DESCRIPTION: |
---|
| 87 | * |
---|
| 88 | * This function returns TRUE if the_priority indicates that the |
---|
| 89 | * enqueue search should start at the front of this priority |
---|
| 90 | * group chain, and FALSE if the search should start at the rear. |
---|
| 91 | */ |
---|
| 92 | |
---|
| 93 | STATIC INLINE boolean _Thread_queue_Is_reverse_search ( |
---|
[7f6a24ab] | 94 | Priority_Control the_priority |
---|
[ac7d5ef0] | 95 | ); |
---|
| 96 | |
---|
[4250c8b] | 97 | /* |
---|
| 98 | * _Thread_queue_Enter_critical_section |
---|
| 99 | * |
---|
| 100 | * DESCRIPTION: |
---|
| 101 | * |
---|
| 102 | * This routine is invoked to indicate that the specified thread queue is |
---|
| 103 | * entering a critical section. |
---|
| 104 | */ |
---|
| 105 | |
---|
| 106 | STATIC INLINE void _Thread_queue_Enter_critical_section ( |
---|
| 107 | Thread_queue_Control *the_thread_queue |
---|
| 108 | ); |
---|
| 109 | |
---|
[5e9b32b] | 110 | #include <rtems/score/tqdata.inl> |
---|
[ac7d5ef0] | 111 | |
---|
| 112 | #ifdef __cplusplus |
---|
| 113 | } |
---|
| 114 | #endif |
---|
| 115 | |
---|
| 116 | #endif |
---|
| 117 | /* end of include file */ |
---|