source: rtems/cpukit/sapi/src/extensioncreate.c @ 16351f7a

4.104.114.84.95
Last change on this file since 16351f7a was 16351f7a, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/28/05 at 02:04:21

2005-01-28 Ralf Corsepius <ralf.corsepius@…>

  • sapi/src/debug.c, sapi/src/exinit.c, sapi/src/extension.c, sapi/src/extensioncreate.c, sapi/src/extensiondelete.c, sapi/src/extensionident.c, sapi/src/fatal.c, sapi/src/io.c, sapi/src/itronapi.c, sapi/src/posixapi.c, sapi/src/rtemsapi.c: Include config.h.
  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  Extension Manager -- rtems_extension_create
3 *
4 *
5 *  COPYRIGHT (c) 1989-2002.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/rtems/support.h>
21#include <rtems/score/object.h>
22#include <rtems/score/thread.h>
23#include <rtems/extension.h>
24
25/*PAGE
26 *
27 *  rtems_extension_create
28 *
29 *  This directive creates a extension and performs some initialization.
30 *
31 *  Input parameters:
32 *    name            - extension name
33 *    extension_table - pointer to extension set information
34 *    id              - pointer to extension id
35 *
36 *  Output parameters:
37 *    id                - extension id
38 *    RTEMS_SUCCESSFUL - if successful
39 *    error code        - if unsuccessful
40 */
41
42rtems_status_code rtems_extension_create(
43  rtems_name              name,
44  rtems_extensions_table *extension_table,
45  Objects_Id             *id
46)
47{
48  Extension_Control *the_extension;
49
50  if ( !rtems_is_name_valid( name ) )
51    return RTEMS_INVALID_NAME;
52
53  _Thread_Disable_dispatch();         /* to prevent deletion */
54
55  the_extension = _Extension_Allocate();
56
57  if ( !the_extension ) {
58    _Thread_Enable_dispatch();
59    return RTEMS_TOO_MANY;
60  }
61
62  _User_extensions_Add_set( &the_extension->Extension, extension_table );
63
64  _Objects_Open( &_Extension_Information, &the_extension->Object, &name );
65
66  *id = the_extension->Object.id;
67  _Thread_Enable_dispatch();
68  return RTEMS_SUCCESSFUL;
69}
Note: See TracBrowser for help on using the repository browser.