source: rtems/cpukit/sapi/src/extensioncreate.c @ 23de794d

4.11
Last change on this file since 23de794d was a2e3f33, checked in by Sebastian Huber <sebastian.huber@…>, on Jul 24, 2013 at 11:50:54 AM

score: Create object implementation header

Move implementation specific parts of object.h and object.inl into new
header file objectimpl.h. The object.h contains now only the
application visible API.

  • Property mode set to 100644
File size: 1.3 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.com/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/system.h>
23#include <rtems/rtems/support.h>
24#include <rtems/score/thread.h>
25#include <rtems/score/userextimpl.h>
26#include <rtems/extensionimpl.h>
27
28rtems_status_code rtems_extension_create(
29  rtems_name                    name,
30  const rtems_extensions_table *extension_table,
31  rtems_id                     *id
32)
33{
34  Extension_Control *the_extension;
35
36  if ( !id )
37    return RTEMS_INVALID_ADDRESS;
38
39  if ( !rtems_is_name_valid( name ) )
40    return RTEMS_INVALID_NAME;
41
42  _Thread_Disable_dispatch();         /* to prevent deletion */
43
44  the_extension = _Extension_Allocate();
45
46  if ( !the_extension ) {
47    _Thread_Enable_dispatch();
48    return RTEMS_TOO_MANY;
49  }
50
51  _User_extensions_Add_set_with_table( &the_extension->Extension, extension_table );
52
53  _Objects_Open(
54    &_Extension_Information,
55    &the_extension->Object,
56    (Objects_Name) name
57  );
58
59  *id = the_extension->Object.id;
60  _Thread_Enable_dispatch();
61  return RTEMS_SUCCESSFUL;
62}
Note: See TracBrowser for help on using the repository browser.