source: rtems/cpukit/score/src/threadcreateidle.c @ 976162a6

4.104.114.9
Last change on this file since 976162a6 was 976162a6, checked in by Joel Sherrill <joel.sherrill@…>, on Dec 3, 2007 at 10:23:13 PM

2007-12-03 Joel Sherrill <joel.sherrill@…>

  • libcsupport/src/malloc.c, libmisc/monitor/mon-command.c, posix/preinstall.am, posix/include/rtems/posix/cond.h, posix/include/rtems/posix/mqueue.h, posix/include/rtems/posix/mutex.h, posix/include/rtems/posix/pthread.h, posix/include/rtems/posix/semaphore.h, posix/src/conddestroy.c, posix/src/mutexdestroy.c, posix/src/mutexinit.c, posix/src/mutexsetprioceiling.c, posix/src/mutexunlock.c, sapi/include/confdefs.h, sapi/include/rtems/config.h, sapi/include/rtems/init.h, sapi/include/rtems/sptables.h, sapi/src/exinit.c, score/include/rtems/system.h, score/include/rtems/score/mpci.h, score/src/mpci.c, score/src/thread.c, score/src/threadcreateidle.c, score/src/threadstackallocate.c, score/src/threadstackfree.c, score/src/wkspace.c: Moved most of the remaining CPU Table fields to the Configuration Table. This included pretasking_hook, predriver_hook, postdriver_hook, idle_task, do_zero_of_workspace, extra_mpci_receive_server_stack, stack_allocate_hook, and stack_free_hook. As a side-effect of this effort some multiprocessing code was made conditional and some style clean up occurred.
  • Property mode set to 100644
File size: 2.3 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#include <rtems/config.h>
33
34/*PAGE
35 *
36 *  _Thread_Create_idle
37 */
38
39const char *_Thread_Idle_name = "IDLE";
40
41void _Thread_Create_idle( void )
42{
43  void       *idle;
44  uint32_t    idle_task_stack_size;
45
46  /*
47   *  The entire workspace is zeroed during its initialization.  Thus, all
48   *  fields not explicitly assigned were explicitly zeroed by
49   *  _Workspace_Initialization.
50   */
51
52  _Thread_Idle = _Thread_Internal_allocate();
53
54  /*
55   *  Initialize the IDLE task.
56   */
57
58#if (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
59  idle = (void *) _CPU_Thread_Idle_body;
60#else
61  idle = (void *) _Thread_Idle_body;
62#endif
63
64  if ( _Configuration_Table->idle_task )
65    idle = _Configuration_Table->idle_task;
66
67  idle_task_stack_size =  _Configuration_Table->idle_task_stack_size;
68  if ( idle_task_stack_size < STACK_MINIMUM_SIZE )
69    idle_task_stack_size = STACK_MINIMUM_SIZE;
70
71  _Thread_Initialize(
72    &_Thread_Internal_information,
73    _Thread_Idle,
74    NULL,        /* allocate the stack */
75    idle_task_stack_size,
76    CPU_IDLE_TASK_IS_FP,
77    PRIORITY_MAXIMUM,
78    TRUE,        /* preemptable */
79    THREAD_CPU_BUDGET_ALGORITHM_NONE,
80    NULL,        /* no budget algorithm callout */
81    0,           /* all interrupts enabled */
82    (Objects_Name) _Thread_Idle_name
83  );
84
85  /*
86   *  WARNING!!! This is necessary to "kick" start the system and
87   *             MUST be done before _Thread_Start is invoked.
88   */
89
90  _Thread_Heir      =
91  _Thread_Executing = _Thread_Idle;
92
93  _Thread_Start(
94    _Thread_Idle,
95    THREAD_START_NUMERIC,
96    idle,
97    NULL,
98    0
99  );
100
101}
Note: See TracBrowser for help on using the repository browser.