source: rtems/cpukit/score/src/threadcreateidle.c @ a8eed23

4.104.114.84.9
Last change on this file since a8eed23 was a8eed23, checked in by Ralf Corsepius <ralf.corsepius@…>, on Jan 27, 2005 at 5:57:05 AM

Include config.h.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 *  Thread Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/score/apiext.h>
21#include <rtems/score/context.h>
22#include <rtems/score/interr.h>
23#include <rtems/score/isr.h>
24#include <rtems/score/object.h>
25#include <rtems/score/priority.h>
26#include <rtems/score/states.h>
27#include <rtems/score/sysstate.h>
28#include <rtems/score/thread.h>
29#include <rtems/score/threadq.h>
30#include <rtems/score/userext.h>
31#include <rtems/score/wkspace.h>
32
33/*PAGE
34 *
35 *  _Thread_Create_idle
36 */
37
38const char *_Thread_Idle_name = "IDLE";
39
40void _Thread_Create_idle( void )
41{
42  void       *idle;
43  uint32_t    idle_task_stack_size;
44
45  /*
46   *  The entire workspace is zeroed during its initialization.  Thus, all
47   *  fields not explicitly assigned were explicitly zeroed by
48   *  _Workspace_Initialization.
49   */
50
51  _Thread_Idle = _Thread_Internal_allocate();
52
53  /*
54   *  Initialize the IDLE task.
55   */
56
57#if (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
58  idle = (void *) _CPU_Thread_Idle_body;
59#else
60  idle = (void *) _Thread_Idle_body;
61#endif
62
63  if ( _CPU_Table.idle_task )
64    idle = _CPU_Table.idle_task;
65
66  idle_task_stack_size =  _CPU_Table.idle_task_stack_size;
67  if ( idle_task_stack_size < STACK_MINIMUM_SIZE )
68    idle_task_stack_size = STACK_MINIMUM_SIZE;
69
70  _Thread_Initialize(
71    &_Thread_Internal_information,
72    _Thread_Idle,
73    NULL,        /* allocate the stack */
74    idle_task_stack_size,
75    CPU_IDLE_TASK_IS_FP,
76    PRIORITY_MAXIMUM,
77    TRUE,        /* preemptable */
78    THREAD_CPU_BUDGET_ALGORITHM_NONE,
79    NULL,        /* no budget algorithm callout */
80    0,           /* all interrupts enabled */
81    (Objects_Name) _Thread_Idle_name
82  );
83
84  /*
85   *  WARNING!!! This is necessary to "kick" start the system and
86   *             MUST be done before _Thread_Start is invoked.
87   */
88
89  _Thread_Heir      =
90  _Thread_Executing = _Thread_Idle;
91
92  _Thread_Start(
93    _Thread_Idle,
94    THREAD_START_NUMERIC,
95    idle,
96    NULL,
97    0
98  );
99
100}
Note: See TracBrowser for help on using the repository browser.