source: rtems/cpukit/score/src/thread.c @ 358bd740

5
Last change on this file since 358bd740 was 358bd740, checked in by Sebastian Huber <sebastian.huber@…>, on 02/03/16 at 11:41:02

score: Avoid SCORE_EXTERN

Delete SCORE_INIT. This finally removes the

some.h:

#ifndef SOME_XYZ_EXTERN
#define SOME_XYZ_EXTERN extern
#endif
SOME_XYZ_EXTERN type xyz;

some_xyz.c:

#define SOME_XYZ_EXTERN
#include <some.h>

pattern in favour of

some.h:

extern type xyz;

some_xyz.c

#include <some.h>
type xyz;

Update #2559.

  • Property mode set to 100644
File size: 3.3 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Initialize Thread Handler
5 *  @ingroup ScoreThread
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2011.
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.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/threadimpl.h>
22#include <rtems/score/interr.h>
23#include <rtems/score/scheduler.h>
24#include <rtems/score/wkspace.h>
25
26#define THREAD_OFFSET_ASSERT( field ) \
27  RTEMS_STATIC_ASSERT( \
28    offsetof( Thread_Control, field ) == offsetof( Thread_Proxy_control, field ), \
29    field \
30  )
31
32THREAD_OFFSET_ASSERT( Object );
33THREAD_OFFSET_ASSERT( current_state );
34THREAD_OFFSET_ASSERT( current_priority );
35THREAD_OFFSET_ASSERT( real_priority );
36THREAD_OFFSET_ASSERT( priority_generation );
37THREAD_OFFSET_ASSERT( priority_restore_hint );
38THREAD_OFFSET_ASSERT( resource_count );
39THREAD_OFFSET_ASSERT( Wait );
40THREAD_OFFSET_ASSERT( Timer );
41#if defined(RTEMS_MULTIPROCESSING)
42THREAD_OFFSET_ASSERT( receive_packet );
43#endif
44
45Thread_Information _Thread_Internal_information;
46
47void _Thread_Initialize_information(
48  Thread_Information  *information,
49  Objects_APIs         the_api,
50  uint16_t             the_class,
51  uint32_t             maximum,
52  bool                 is_string,
53  uint32_t             maximum_name_length
54#if defined(RTEMS_MULTIPROCESSING)
55  ,
56  bool                 supports_global
57#endif
58)
59{
60  _Objects_Initialize_information(
61    &information->Objects,
62    the_api,
63    the_class,
64    maximum,
65    _Thread_Control_size,
66    is_string,
67    maximum_name_length
68    #if defined(RTEMS_MULTIPROCESSING)
69      ,
70      supports_global,
71      NULL
72    #endif
73  );
74
75  _Freechain_Initialize(
76    &information->Free_thread_queue_heads,
77    _Workspace_Allocate_or_fatal_error,
78    _Objects_Maximum_per_allocation( maximum ),
79    THREAD_QUEUE_HEADS_SIZE( _Scheduler_Count )
80  );
81}
82
83void _Thread_Handler_initialization(void)
84{
85  rtems_stack_allocate_init_hook stack_allocate_init_hook =
86    rtems_configuration_get_stack_allocate_init_hook();
87  #if defined(RTEMS_MULTIPROCESSING)
88    uint32_t maximum_proxies =
89      _Configuration_MP_table->maximum_proxies;
90  #endif
91
92  if ( rtems_configuration_get_stack_allocate_hook() == NULL ||
93       rtems_configuration_get_stack_free_hook() == NULL)
94    _Terminate(
95      INTERNAL_ERROR_CORE,
96      true,
97      INTERNAL_ERROR_BAD_STACK_HOOK
98    );
99
100  if ( stack_allocate_init_hook != NULL )
101    (*stack_allocate_init_hook)( rtems_configuration_get_stack_space_size() );
102
103  #if defined(RTEMS_MULTIPROCESSING)
104    _Thread_MP_Handler_initialization( maximum_proxies );
105  #endif
106
107  /*
108   *  Initialize the internal class of threads.  We need an IDLE thread
109   *  per CPU in an SMP system.  In addition, if this is a loosely
110   *  coupled multiprocessing system, account for the MPCI Server Thread.
111   */
112  _Thread_Initialize_information(
113    &_Thread_Internal_information,
114    OBJECTS_INTERNAL_API,
115    OBJECTS_INTERNAL_THREADS,
116    _Thread_Get_maximum_internal_threads(),
117    false,                      /* true if names for this object are strings */
118    8                           /* maximum length of each object's name */
119    #if defined(RTEMS_MULTIPROCESSING)
120      ,
121      false                       /* true if this is a global object class */
122    #endif
123  );
124
125}
Note: See TracBrowser for help on using the repository browser.