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-1998. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * Copyright assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.OARcorp.com/rtems/license.html. |
---|
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_SYNCHRONIZED, |
---|
45 | THREAD_QUEUE_NOTHING_HAPPENED, |
---|
46 | THREAD_QUEUE_TIMEOUT, |
---|
47 | THREAD_QUEUE_SATISFIED |
---|
48 | } Thread_queue_States; |
---|
49 | |
---|
50 | /* |
---|
51 | * The following constants are used to manage the priority queues. |
---|
52 | * |
---|
53 | * There are four chains used to maintain a priority -- each chain |
---|
54 | * manages a distinct set of task priorities. The number of chains |
---|
55 | * is determined by TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS. |
---|
56 | * The following set must be consistent. |
---|
57 | * |
---|
58 | * The set below configures 4 headers -- each contains 64 priorities. |
---|
59 | * Header x manages priority range (x*64) through ((x*64)+63). If |
---|
60 | * the priority is more than half way through the priority range it |
---|
61 | * is in, then the search is performed from the rear of the chain. |
---|
62 | * This halves the search time to find the insertion point. |
---|
63 | */ |
---|
64 | |
---|
65 | #define TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS 4 |
---|
66 | #define TASK_QUEUE_DATA_PRIORITIES_PER_HEADER 64 |
---|
67 | #define TASK_QUEUE_DATA_REVERSE_SEARCH_MASK 0x20 |
---|
68 | |
---|
69 | typedef struct { |
---|
70 | union { |
---|
71 | Chain_Control Fifo; /* FIFO discipline list */ |
---|
72 | Chain_Control Priority[TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS]; |
---|
73 | /* priority discipline list */ |
---|
74 | } Queues; |
---|
75 | Thread_queue_States sync_state; /* alloc/dealloc critical section */ |
---|
76 | Thread_queue_Disciplines discipline; /* queue discipline */ |
---|
77 | States_Control state; /* state of threads on Thread_q */ |
---|
78 | unsigned32 timeout_status; |
---|
79 | } Thread_queue_Control; |
---|
80 | |
---|
81 | #ifndef __RTEMS_APPLICATION__ |
---|
82 | #include <rtems/score/tqdata.inl> |
---|
83 | #endif |
---|
84 | |
---|
85 | #ifdef __cplusplus |
---|
86 | } |
---|
87 | #endif |
---|
88 | |
---|
89 | #endif |
---|
90 | /* end of include file */ |
---|