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

4.115
Last change on this file since f58ef8ae was b7de5de, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on 01/26/10 at 15:01:56

User extension API: add const to some params, inline _User_extensions_Add_API_set

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