[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 { |
---|
[107ce47b] | 44 | THREAD_QUEUE_SYNCHRONIZED, |
---|
[4250c8b] | 45 | THREAD_QUEUE_NOTHING_HAPPENED, |
---|
| 46 | THREAD_QUEUE_TIMEOUT, |
---|
| 47 | THREAD_QUEUE_SATISFIED |
---|
[107ce47b] | 48 | } Thread_queue_States; |
---|
[4250c8b] | 49 | |
---|
[ac7d5ef0] | 50 | /* |
---|
[1a8fde6c] | 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. |
---|
[ac7d5ef0] | 63 | */ |
---|
| 64 | |
---|
[1a8fde6c] | 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 |
---|
[ac7d5ef0] | 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; |
---|
[107ce47b] | 75 | Thread_queue_States sync_state; /* alloc/dealloc critical section */ |
---|
[ac7d5ef0] | 76 | Thread_queue_Disciplines discipline; /* queue discipline */ |
---|
| 77 | States_Control state; /* state of threads on Thread_q */ |
---|
[3a4ae6c] | 78 | unsigned32 timeout_status; |
---|
[5e9b32b] | 79 | unsigned32 count; |
---|
[ac7d5ef0] | 80 | } Thread_queue_Control; |
---|
| 81 | |
---|
[1a8fde6c] | 82 | #ifndef __RTEMS_APPLICATION__ |
---|
[5e9b32b] | 83 | #include <rtems/score/tqdata.inl> |
---|
[1a8fde6c] | 84 | #endif |
---|
[ac7d5ef0] | 85 | |
---|
| 86 | #ifdef __cplusplus |
---|
| 87 | } |
---|
| 88 | #endif |
---|
| 89 | |
---|
| 90 | #endif |
---|
| 91 | /* end of include file */ |
---|