source: rtems/cpukit/score/include/rtems/score/tqdata.h @ 20f02c6

4.104.115
Last change on this file since 20f02c6 was 20f02c6, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/28/09 at 05:58:54

Whitespace removal.

  • Property mode set to 100644
File size: 3.4 KB
Line 
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-2008.
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 handler defines the data shared between the thread and thread
26 *  queue handlers.  Having this handler define these data structure
27 *  avoids potentially circular references.
28 */
29/**@{*/
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35#include <rtems/score/chain.h>
36#include <rtems/score/priority.h>
37#include <rtems/score/states.h>
38#include <rtems/score/threadsync.h>
39
40/**
41 *  The following enumerated type details all of the disciplines
42 *  supported by the Thread Queue Handler.
43 */
44typedef enum {
45  THREAD_QUEUE_DISCIPLINE_FIFO,     /* FIFO queue discipline */
46  THREAD_QUEUE_DISCIPLINE_PRIORITY  /* PRIORITY queue discipline */
47}   Thread_queue_Disciplines;
48
49/**
50 *  This is one of the constants used to manage the priority queues.
51 *
52 *  There are four chains used to maintain a priority -- each chain
53 *  manages a distinct set of task priorities.  The number of chains
54 *  is determined by TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS.
55 *  The following set must be consistent.
56 *
57 *  The set below configures 4 headers -- each contains 64 priorities.
58 *  Header x manages priority range (x*64) through ((x*64)+63).  If
59 *  the priority is more than half way through the priority range it
60 *  is in, then the search is performed from the rear of the chain.
61 *  This halves the search time to find the insertion point.
62 */
63#define TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS 4
64
65/**
66 *  This is one of the constants used to manage the priority queues.
67 *  @ref TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS for more details.
68 */
69#define TASK_QUEUE_DATA_PRIORITIES_PER_HEADER      64
70
71/**
72 *  This is one of the constants used to manage the priority queues.
73 *  @ref TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS for more details.
74 */
75#define TASK_QUEUE_DATA_REVERSE_SEARCH_MASK        0x20
76
77/**
78 *  This is the structure used to manage sets of tasks which are blocked
79 *  waiting to acquire a resource.
80 */
81typedef struct {
82  /** This union contains the data structures used to manage the blocked
83   *  set of tasks which varies based upon the discipline.
84   */
85  union {
86    /** This is the FIFO discipline list. */
87    Chain_Control Fifo;
88    /** This is the set of lists for priority discipline waiting. */
89    Chain_Control Priority[TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS];
90  } Queues;
91  /** This field is used to manage the critical section. */
92  Thread_blocking_operation_States sync_state;
93  /** This field indicates the thread queue's blocking discipline. */
94  Thread_queue_Disciplines discipline;
95  /** This indicates the blocking state for threads waiting on this
96   *  thread queue.
97   */
98  States_Control           state;
99  /** This is the status value returned to threads which timeout while
100   *  waiting on this thread queue.
101   */
102  uint32_t                 timeout_status;
103}   Thread_queue_Control;
104
105#ifndef __RTEMS_APPLICATION__
106#include <rtems/score/tqdata.inl>
107#endif
108
109#ifdef __cplusplus
110}
111#endif
112
113/**@}*/
114
115#endif
116/* end of include file */
Note: See TracBrowser for help on using the repository browser.