1 | /** |
---|
2 | * @file rtems/score/tqdata.h |
---|
3 | * |
---|
4 | * This include file contains all the constants and structures |
---|
5 | * needed to declare a thread queue. |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2004. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | * |
---|
16 | * $Id$ |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _RTEMS_SCORE_TQDATA_H |
---|
20 | #define _RTEMS_SCORE_TQDATA_H |
---|
21 | |
---|
22 | /** |
---|
23 | * @defgroup ScoreThreadQData Thread Queue Handler Data Definition |
---|
24 | * |
---|
25 | * This group contains functionality which XXX |
---|
26 | */ |
---|
27 | /**@{*/ |
---|
28 | |
---|
29 | #ifdef __cplusplus |
---|
30 | extern "C" { |
---|
31 | #endif |
---|
32 | |
---|
33 | #include <rtems/score/chain.h> |
---|
34 | #include <rtems/score/priority.h> |
---|
35 | #include <rtems/score/states.h> |
---|
36 | |
---|
37 | /* |
---|
38 | * The following enumerated type details all of the disciplines |
---|
39 | * supported by the Thread Queue Handler. |
---|
40 | */ |
---|
41 | |
---|
42 | typedef enum { |
---|
43 | THREAD_QUEUE_DISCIPLINE_FIFO, /* FIFO queue discipline */ |
---|
44 | THREAD_QUEUE_DISCIPLINE_PRIORITY /* PRIORITY queue discipline */ |
---|
45 | } Thread_queue_Disciplines; |
---|
46 | |
---|
47 | /* |
---|
48 | * The following enumerated types indicate what happened while the thread |
---|
49 | * queue was in the synchronization window. |
---|
50 | */ |
---|
51 | |
---|
52 | typedef enum { |
---|
53 | THREAD_QUEUE_SYNCHRONIZED, |
---|
54 | THREAD_QUEUE_NOTHING_HAPPENED, |
---|
55 | THREAD_QUEUE_TIMEOUT, |
---|
56 | THREAD_QUEUE_SATISFIED |
---|
57 | } Thread_queue_States; |
---|
58 | |
---|
59 | /* |
---|
60 | * The following constants are used to manage the priority queues. |
---|
61 | * |
---|
62 | * There are four chains used to maintain a priority -- each chain |
---|
63 | * manages a distinct set of task priorities. The number of chains |
---|
64 | * is determined by TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS. |
---|
65 | * The following set must be consistent. |
---|
66 | * |
---|
67 | * The set below configures 4 headers -- each contains 64 priorities. |
---|
68 | * Header x manages priority range (x*64) through ((x*64)+63). If |
---|
69 | * the priority is more than half way through the priority range it |
---|
70 | * is in, then the search is performed from the rear of the chain. |
---|
71 | * This halves the search time to find the insertion point. |
---|
72 | */ |
---|
73 | |
---|
74 | #define TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS 4 |
---|
75 | #define TASK_QUEUE_DATA_PRIORITIES_PER_HEADER 64 |
---|
76 | #define TASK_QUEUE_DATA_REVERSE_SEARCH_MASK 0x20 |
---|
77 | |
---|
78 | typedef struct { |
---|
79 | union { |
---|
80 | Chain_Control Fifo; /* FIFO discipline list */ |
---|
81 | Chain_Control Priority[TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS]; |
---|
82 | /* priority discipline list */ |
---|
83 | } Queues; |
---|
84 | Thread_queue_States sync_state; /* alloc/dealloc critical section */ |
---|
85 | Thread_queue_Disciplines discipline; /* queue discipline */ |
---|
86 | States_Control state; /* state of threads on Thread_q */ |
---|
87 | uint32_t timeout_status; |
---|
88 | } Thread_queue_Control; |
---|
89 | |
---|
90 | #ifndef __RTEMS_APPLICATION__ |
---|
91 | #include <rtems/score/tqdata.inl> |
---|
92 | #endif |
---|
93 | |
---|
94 | #ifdef __cplusplus |
---|
95 | } |
---|
96 | #endif |
---|
97 | |
---|
98 | /**@}*/ |
---|
99 | |
---|
100 | #endif |
---|
101 | /* end of include file */ |
---|