1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Thread Queue Initialize |
---|
5 | * @ingroup ScoreThreadQ |
---|
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 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/system.h> |
---|
22 | #include <rtems/score/chain.h> |
---|
23 | #include <rtems/score/isr.h> |
---|
24 | #include <rtems/score/object.h> |
---|
25 | #include <rtems/score/states.h> |
---|
26 | #include <rtems/score/thread.h> |
---|
27 | #include <rtems/score/threadq.h> |
---|
28 | #include <rtems/score/tqdata.h> |
---|
29 | |
---|
30 | void _Thread_queue_Initialize( |
---|
31 | Thread_queue_Control *the_thread_queue, |
---|
32 | Thread_queue_Disciplines the_discipline, |
---|
33 | States_Control state, |
---|
34 | uint32_t timeout_status |
---|
35 | ) |
---|
36 | { |
---|
37 | the_thread_queue->state = state; |
---|
38 | the_thread_queue->discipline = the_discipline; |
---|
39 | the_thread_queue->timeout_status = timeout_status; |
---|
40 | the_thread_queue->sync_state = THREAD_BLOCKING_OPERATION_SYNCHRONIZED; |
---|
41 | |
---|
42 | if ( the_discipline == THREAD_QUEUE_DISCIPLINE_PRIORITY ) { |
---|
43 | uint32_t index; |
---|
44 | |
---|
45 | for( index=0 ; |
---|
46 | index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ; |
---|
47 | index++) |
---|
48 | _Chain_Initialize_empty( &the_thread_queue->Queues.Priority[index] ); |
---|
49 | } else { /* must be THREAD_QUEUE_DISCIPLINE_FIFO */ |
---|
50 | _Chain_Initialize_empty( &the_thread_queue->Queues.Fifo ); |
---|
51 | } |
---|
52 | |
---|
53 | } |
---|