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 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __THREAD_QUEUE_DATA_h |
---|
18 | #define __THREAD_QUEUE_DATA_h |
---|
19 | |
---|
20 | #ifdef __cplusplus |
---|
21 | extern "C" { |
---|
22 | #endif |
---|
23 | |
---|
24 | #include <rtems/score/chain.h> |
---|
25 | #include <rtems/score/priority.h> |
---|
26 | #include <rtems/score/states.h> |
---|
27 | |
---|
28 | /* |
---|
29 | * The following enumerated type details all of the disciplines |
---|
30 | * supported by the Thread Queue Handler. |
---|
31 | */ |
---|
32 | |
---|
33 | typedef enum { |
---|
34 | THREAD_QUEUE_DISCIPLINE_FIFO, /* FIFO queue discipline */ |
---|
35 | THREAD_QUEUE_DISCIPLINE_PRIORITY /* PRIORITY queue discipline */ |
---|
36 | } Thread_queue_Disciplines; |
---|
37 | |
---|
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 | |
---|
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 */ |
---|
63 | Thread_queue_states sync_state; /* what happened while in sync */ |
---|
64 | Thread_queue_Disciplines discipline; /* queue discipline */ |
---|
65 | States_Control state; /* state of threads on Thread_q */ |
---|
66 | unsigned32 timeout_status; |
---|
67 | unsigned32 count; |
---|
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 ( |
---|
80 | Priority_Control the_priority |
---|
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 ( |
---|
94 | Priority_Control the_priority |
---|
95 | ); |
---|
96 | |
---|
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 | |
---|
110 | #include <rtems/score/tqdata.inl> |
---|
111 | |
---|
112 | #ifdef __cplusplus |
---|
113 | } |
---|
114 | #endif |
---|
115 | |
---|
116 | #endif |
---|
117 | /* end of include file */ |
---|