source: rtems/cpukit/score/src/userext.c @ 0a97ba5b

5
Last change on this file since 0a97ba5b was 0a97ba5b, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 12, 2016 at 3:02:27 PM

score: _User_extensions_Handler_initialization()

Simplify _User_extensions_Handler_initialization().

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[c42d1a4]1/**
2 * @file
3 *
4 * @ingroup ScoreUserExt
5 *
6 * @brief User Extension Handler implementation.
7 */
8
[5072b07]9/*
[790b50b]10 *  COPYRIGHT (c) 1989-2008.
[5072b07]11 *  On-Line Applications Research Corporation (OAR).
12 *
[98e4ebf]13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
[c499856]15 *  http://www.rtems.org/license/LICENSE.
[5072b07]16 */
17
[a8eed23]18#if HAVE_CONFIG_H
[466cf31]19  #include "config.h"
[a8eed23]20#endif
21
[790b50b]22#include <rtems/config.h>
[3be0c9a]23#include <rtems/score/userextimpl.h>
[c3db01d0]24#include <rtems/score/wkspace.h>
[5072b07]25
[0a97ba5b]26void _User_extensions_Handler_initialization(void)
[5072b07]27{
[0a97ba5b]28  User_extensions_Switch_control *initial_extension_switch_controls;
29  const User_extensions_Table    *initial_table;
30  uint32_t                        n;
31  uint32_t                        i;
[790b50b]32
[0a97ba5b]33  n = rtems_configuration_get_number_of_initial_extensions();
[05279b84]34
[0a97ba5b]35  initial_extension_switch_controls = _Workspace_Allocate_or_fatal_error(
36    n * sizeof( *initial_extension_switch_controls )
37  );
[466cf31]38
[0a97ba5b]39  initial_table = rtems_configuration_get_user_extension_table();
[05279b84]40
[0a97ba5b]41  for ( i = 0 ; i < n ; ++i ) {
42    User_extensions_thread_switch_extension callout;
43
44    callout = initial_table[ i ].thread_switch;
45
46    if ( callout != NULL ) {
47      User_extensions_Switch_control *c;
48
49      c = &initial_extension_switch_controls[ i ];
50      c->thread_switch = callout;
51      _Chain_Append_unprotected( &_User_extensions_Switches_list, &c->Node );
52    }
53  }
[5072b07]54}
Note: See TracBrowser for help on using the repository browser.