RTEMS
extensioncreate.c
Go to the documentation of this file.
1 
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.org/license/LICENSE.
16  */
17 
18 #ifdef HAVE_CONFIG_H
19 #include "config.h"
20 #endif
21 
22 #include <rtems/extensionimpl.h>
23 #include <rtems/rtems/support.h>
25 #include <rtems/sysinit.h>
26 
28  rtems_name name,
29  const rtems_extensions_table *extension_table,
30  rtems_id *id
31 )
32 {
33  Extension_Control *the_extension;
34 
35  if ( !rtems_is_name_valid( name ) ) {
36  return RTEMS_INVALID_NAME;
37  }
38 
39  if ( extension_table == NULL ) {
40  return RTEMS_INVALID_ADDRESS;
41  }
42 
43  if ( id == NULL ) {
44  return RTEMS_INVALID_ADDRESS;
45  }
46 
47  the_extension = _Extension_Allocate();
48 
49  if ( the_extension == NULL ) {
51  return RTEMS_TOO_MANY;
52  }
53 
54  _User_extensions_Add_set_with_table( &the_extension->Extension, extension_table );
55 
58  &the_extension->Object,
59  (Objects_Name) name
60  );
61 
62  *id = the_extension->Object.id;
64  return RTEMS_SUCCESSFUL;
65 }
66 
67 static void _Extension_Manager_initialization( void )
68 {
70 }
71 
72 RTEMS_SYSINIT_ITEM(
73  _Extension_Manager_initialization,
74  RTEMS_SYSINIT_USER_EXTENSIONS,
75  RTEMS_SYSINIT_ORDER_MIDDLE
76 );
This status code indicates you have attempted to create too many instances of a particular object cla...
Definition: status.h:112
static __inline__ void _Objects_Allocator_unlock(void)
Unlocks the object allocator mutex.
Definition: objectimpl.h:846
This header file defines support services of the API.
uint32_t rtems_name
This type is used to represent a Classic API object name.
Definition: types.h:227
void _Objects_Initialize_information(Objects_Information *information)
Initializes the specified objects information.
static bool rtems_is_name_valid(rtems_status_code name)
Returns true, if the specified object name is valid, otherwise returns false.
Definition: support.h:126
User Extension Handler API.
This status code indicates successful completion.
Definition: status.h:86
Classic User Extensions Implementation.
static __inline__ void _Objects_Open(Objects_Information *information, Objects_Control *the_object, Objects_Name name)
Places the_object control pointer and object name in the Local Pointer and Local Name Tables...
Definition: objectimpl.h:750
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
static __inline__ void _User_extensions_Add_set_with_table(User_extensions_Control *extension, const User_extensions_Table *extension_table)
Adds a user extension with the given extension table as callouts.
Definition: userextimpl.h:117
rtems_status_code rtems_extension_create(rtems_name name, const rtems_extensions_table *extension_table, rtems_id *id)
%
This status code indicates that a specified address was invalid.
Definition: status.h:133
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
User extension table.
Definition: userext.h:230
This status code indicates that an object name was invalid.
Definition: status.h:101
Objects_Information _Extension_Information
The Classic Extensions objects information.
Definition: extension.c:47
Objects_Id id
Definition: objectdata.h:43