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 record defines the control block used |
---|
40 | * to manage each thread. |
---|
41 | */ |
---|
42 | |
---|
43 | #define TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS 4 /* # of pri groups */ |
---|
44 | |
---|
45 | typedef struct { |
---|
46 | union { |
---|
47 | Chain_Control Fifo; /* FIFO discipline list */ |
---|
48 | Chain_Control Priority[TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS]; |
---|
49 | /* priority discipline list */ |
---|
50 | } Queues; |
---|
51 | boolean sync; /* alloc/dealloc critical section */ |
---|
52 | Thread_queue_Disciplines discipline; /* queue discipline */ |
---|
53 | States_Control state; /* state of threads on Thread_q */ |
---|
54 | unsigned32 timeout_status; |
---|
55 | unsigned32 count; |
---|
56 | } Thread_queue_Control; |
---|
57 | |
---|
58 | /* |
---|
59 | * _Thread_queue_Header_number |
---|
60 | * |
---|
61 | * DESCRIPTION: |
---|
62 | * |
---|
63 | * This function returns the index of the priority chain on which |
---|
64 | * a thread of the_priority should be placed. |
---|
65 | */ |
---|
66 | |
---|
67 | STATIC INLINE unsigned32 _Thread_queue_Header_number ( |
---|
68 | Priority_Control the_priority |
---|
69 | ); |
---|
70 | |
---|
71 | /* |
---|
72 | * _Thread_queue_Is_reverse_search |
---|
73 | * |
---|
74 | * DESCRIPTION: |
---|
75 | * |
---|
76 | * This function returns TRUE if the_priority indicates that the |
---|
77 | * enqueue search should start at the front of this priority |
---|
78 | * group chain, and FALSE if the search should start at the rear. |
---|
79 | */ |
---|
80 | |
---|
81 | STATIC INLINE boolean _Thread_queue_Is_reverse_search ( |
---|
82 | Priority_Control the_priority |
---|
83 | ); |
---|
84 | |
---|
85 | #include <rtems/score/tqdata.inl> |
---|
86 | |
---|
87 | #ifdef __cplusplus |
---|
88 | } |
---|
89 | #endif |
---|
90 | |
---|
91 | #endif |
---|
92 | /* end of include file */ |
---|