source: rtems/c/src/exec/sapi/src/extension.c @ b3ac6a8d

4.104.114.84.95
Last change on this file since b3ac6a8d was 3a4ae6c, checked in by Joel Sherrill <joel.sherrill@…>, on 09/11/95 at 19:35:39

The word "RTEMS" almost completely removed from the core.

Configuration Table Template file added and all tests
modified to use this. All gvar.h and conftbl.h files
removed from test directories.

Configuration parameter maximum_devices added.

Core semaphore and mutex handlers added and RTEMS API Semaphore
Manager updated to reflect this.

Initialization sequence changed to invoke API specific initialization
routines. Initialization tasks table now owned by RTEMS Tasks Manager.

Added user extension for post-switch.

Utilized user extensions to implement API specific functionality
like signal dispatching.

Added extensions to the System Initialization Thread so that an
API can register a function to be invoked while the system
is being initialized. These are largely equivalent to the
pre-driver and post-driver hooks.

Added the Modules file oar-go32_p5, modified oar-go32, and modified
the file make/custom/go32.cfg to look at an environment varable which
determines what CPU model is being used.

All BSPs updated to reflect named devices and clock driver's IOCTL
used by the Shared Memory Driver. Also merged clock isr into
main file and removed ckisr.c where possible.

Updated spsize to reflect new and moved variables.

Makefiles for the executive source and include files updated to show
break down of files into Core, RTEMS API, and Neither.

Header and inline files installed into subdirectory based on whether
logically in the Core or a part of the RTEMS API.

  • Property mode set to 100644
File size: 3.8 KB
Line 
1/*
2 *  Extension Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
6 *  On-Line Applications Research Corporation (OAR).
7 *  All rights assigned to U.S. Government, 1994.
8 *
9 *  This material may be reproduced by or for the U.S. Government pursuant
10 *  to the copyright license under the clause at DFARS 252.227-7013.  This
11 *  notice must appear in all copies of this file and its derivatives.
12 *
13 *  $Id$
14 */
15
16#include <rtems/system.h>
17#include <rtems/rtems/support.h>
18#include <rtems/core/object.h>
19#include <rtems/core/thread.h>
20#include <rtems/extension.h>
21
22/*PAGE
23 *
24 *  _Extension_Manager_initialization
25 *
26 *  This routine initializes all extension manager related data structures.
27 *
28 *  Input parameters:
29 *    maximum_extensions - number of extensions to initialize
30 *
31 *  Output parameters:  NONE
32 */
33
34void _Extension_Manager_initialization(
35  unsigned32 maximum_extensions
36)
37{
38  _Objects_Initialize_information(
39    &_Extension_Information,
40    OBJECTS_RTEMS_EXTENSIONS,
41    FALSE,
42    maximum_extensions,
43    sizeof( Extension_Control ),
44    FALSE,
45    RTEMS_MAXIMUM_NAME_LENGTH,
46    FALSE
47  );
48}
49
50/*PAGE
51 *
52 *  rtems_extension_create
53 *
54 *  This directive creates a extension and performs some initialization.
55 *
56 *  Input parameters:
57 *    name            - extension name
58 *    extension_table - pointer to extension set information
59 *    id              - pointer to extension id
60 *
61 *  Output parameters:
62 *    id                - extension id
63 *    RTEMS_SUCCESSFUL - if successful
64 *    error code        - if unsuccessful
65 */
66
67rtems_status_code rtems_extension_create(
68  rtems_name              name,
69  rtems_extensions_table *extension_table,
70  Objects_Id             *id
71)
72{
73  Extension_Control *the_extension;
74
75  if ( !rtems_is_name_valid( name ) )
76    return RTEMS_INVALID_NAME;
77
78  _Thread_Disable_dispatch();         /* to prevent deletion */
79
80  the_extension = _Extension_Allocate();
81
82  if ( !the_extension ) {
83    _Thread_Enable_dispatch();
84    return RTEMS_TOO_MANY;
85  }
86
87  _User_extensions_Add_set( &the_extension->Extension, extension_table );
88
89  _Objects_Open( &_Extension_Information, &the_extension->Object, &name );
90
91  *id = the_extension->Object.id;
92  _Thread_Enable_dispatch();
93  return RTEMS_SUCCESSFUL;
94}
95
96/*PAGE
97 *
98 *  rtems_extension_ident
99 *
100 *  This directive returns the system ID associated with
101 *  the extension name.
102 *
103 *  Input parameters:
104 *    name - user defined message queue name
105 *    id   - pointer to extension id
106 *
107 *  Output parameters:
108 *    *id               - message queue id
109 *    RTEMS_SUCCESSFUL - if successful
110 *    error code        - if unsuccessful
111 */
112
113rtems_status_code rtems_extension_ident(
114  rtems_name    name,
115  Objects_Id   *id
116)
117{
118  Objects_Name_to_id_errors  status;
119
120  status = _Objects_Name_to_id(
121    &_Extension_Information,
122    &name,
123    OBJECTS_SEARCH_LOCAL_NODE,
124    id
125  );
126
127  return _Status_Object_name_errors_to_status[ status ];
128}
129
130/*PAGE
131 *
132 *  rtems_extension_delete
133 *
134 *  This directive allows a thread to delete a extension.
135 *
136 *  Input parameters:
137 *    id - extension id
138 *
139 *  Output parameters:
140 *    RTEMS_SUCCESSFUL - if successful
141 *    error code - if unsuccessful
142 */
143
144rtems_status_code rtems_extension_delete(
145  Objects_Id id
146)
147{
148  Extension_Control   *the_extension;
149  Objects_Locations    location;
150
151  the_extension = _Extension_Get( id, &location );
152  switch ( location ) {
153    case OBJECTS_ERROR:
154    case OBJECTS_REMOTE:            /* should never return this */
155      return RTEMS_INVALID_ID;
156    case OBJECTS_LOCAL:
157      _User_extensions_Remove_set( &the_extension->Extension );
158      _Objects_Close( &_Extension_Information, &the_extension->Object );
159      _Extension_Free( the_extension );
160      _Thread_Enable_dispatch();
161      return RTEMS_SUCCESSFUL;
162  }
163
164  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
165}
Note: See TracBrowser for help on using the repository browser.