source: rtems/cpukit/sapi/src/extensioncreate.c @ 6b0a729b

5
Last change on this file since 6b0a729b was 21275b58, checked in by Sebastian Huber <sebastian.huber@…>, on 11/22/18 at 18:14:51

score: Static Objects_Information initialization

Statically allocate the objects information together with the initial
set of objects either via <rtems/confdefs.h>. Provide default object
informations with zero objects via librtemscpu.a. This greatly
simplifies the workspace size estimate. RTEMS applications which do not
use the unlimited objects option are easier to debug since all objects
reside now in statically allocated objects of the right types.

Close #3621.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ClassicUserExtensions
5 *
6 * @brief User Extensions Implementation.
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-2007.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/extensionimpl.h>
23#include <rtems/rtems/support.h>
24#include <rtems/score/userextimpl.h>
25#include <rtems/sysinit.h>
26
27rtems_status_code rtems_extension_create(
28  rtems_name                    name,
29  const rtems_extensions_table *extension_table,
30  rtems_id                     *id
31)
32{
33  Extension_Control *the_extension;
34
35  if ( !id )
36    return RTEMS_INVALID_ADDRESS;
37
38  if ( !rtems_is_name_valid( name ) )
39    return RTEMS_INVALID_NAME;
40
41  the_extension = _Extension_Allocate();
42
43  if ( !the_extension ) {
44    _Objects_Allocator_unlock();
45    return RTEMS_TOO_MANY;
46  }
47
48  _User_extensions_Add_set_with_table( &the_extension->Extension, extension_table );
49
50  _Objects_Open(
51    &_Extension_Information,
52    &the_extension->Object,
53    (Objects_Name) name
54  );
55
56  *id = the_extension->Object.id;
57  _Objects_Allocator_unlock();
58  return RTEMS_SUCCESSFUL;
59}
60
61static void _Extension_Manager_initialization( void )
62{
63  _Objects_Initialize_information( &_Extension_Information);
64}
65
66RTEMS_SYSINIT_ITEM(
67  _Extension_Manager_initialization,
68  RTEMS_SYSINIT_USER_EXTENSIONS,
69  RTEMS_SYSINIT_ORDER_MIDDLE
70);
Note: See TracBrowser for help on using the repository browser.