source: rtems/cpukit/sapi/src/extensioncreate.c @ ac252bdc

4.115
Last change on this file since ac252bdc was ac252bdc, checked in by Sebastian Huber <sebastian.huber@…>, on 07/23/13 at 08:04:19

sapi: Create extension implementation header

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

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