source: rtems/cpukit/score/src/thread.c @ 9c9c6a9

Last change on this file since 9c9c6a9 was 9c9c6a9, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 21, 2018 at 4:30:52 PM

score: Remove Objects_Information::is_string

Use Objects_Information::name_length to store this information.

Update #3621.

  • Property mode set to 100644
File size: 2.7 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( Join_queue );
34THREAD_OFFSET_ASSERT( current_state );
35THREAD_OFFSET_ASSERT( Real_priority );
36#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
37THREAD_OFFSET_ASSERT( resource_count );
38#endif
39THREAD_OFFSET_ASSERT( Scheduler );
40THREAD_OFFSET_ASSERT( Wait );
41THREAD_OFFSET_ASSERT( Timer );
42#if defined(RTEMS_MULTIPROCESSING)
43THREAD_OFFSET_ASSERT( receive_packet );
44#endif
45
46Thread_Information _Thread_Internal_information;
47
48void _Thread_Initialize_information(
49  Thread_Information  *information,
50  Objects_APIs         the_api,
51  uint16_t             the_class,
52  uint32_t             maximum
53)
54{
55  _Objects_Initialize_information(
56    &information->Objects,
57    the_api,
58    the_class,
59    maximum,
60    _Thread_Control_size,
61    OBJECTS_NO_STRING_NAME,
62    NULL
63  );
64
65  _Freechain_Initialize(
66    &information->Free_thread_queue_heads,
67    _Workspace_Allocate_or_fatal_error,
68    _Objects_Maximum_per_allocation( maximum ),
69    THREAD_QUEUE_HEADS_SIZE( _Scheduler_Count )
70  );
71}
72
73void _Thread_Handler_initialization(void)
74{
75  rtems_stack_allocate_init_hook stack_allocate_init_hook =
76    rtems_configuration_get_stack_allocate_init_hook();
77  #if defined(RTEMS_MULTIPROCESSING)
78    uint32_t maximum_proxies =
79      _Configuration_MP_table->maximum_proxies;
80  #endif
81
82  if ( rtems_configuration_get_stack_allocate_hook() == NULL ||
83       rtems_configuration_get_stack_free_hook() == NULL)
84    _Internal_error( INTERNAL_ERROR_BAD_STACK_HOOK );
85
86  if ( stack_allocate_init_hook != NULL )
87    (*stack_allocate_init_hook)( rtems_configuration_get_stack_space_size() );
88
89  #if defined(RTEMS_MULTIPROCESSING)
90    _Thread_MP_Handler_initialization( maximum_proxies );
91  #endif
92
93  /*
94   *  Initialize the internal class of threads.  We need an IDLE thread
95   *  per CPU in an SMP system.  In addition, if this is a loosely
96   *  coupled multiprocessing system, account for the MPCI Server Thread.
97   */
98  _Thread_Initialize_information(
99    &_Thread_Internal_information,
100    OBJECTS_INTERNAL_API,
101    OBJECTS_INTERNAL_THREADS,
102    _Thread_Get_maximum_internal_threads()
103  );
104
105}
Note: See TracBrowser for help on using the repository browser.