RTEMS
ratemoncreate.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 
23 #include <rtems/rtems/status.h>
24 #include <rtems/rtems/support.h>
25 #include <rtems/score/isr.h>
26 #include <rtems/score/thread.h>
28 #include <rtems/sysinit.h>
29 
31  rtems_name name,
32  rtems_id *id
33 )
34 {
35  Rate_monotonic_Control *the_period;
36 
37  if ( !rtems_is_name_valid( name ) )
38  return RTEMS_INVALID_NAME;
39 
40  if ( !id )
41  return RTEMS_INVALID_ADDRESS;
42 
43  the_period = _Rate_monotonic_Allocate();
44 
45  if ( !the_period ) {
47  return RTEMS_TOO_MANY;
48  }
49 
50  _ISR_lock_Initialize( &the_period->Lock, "Rate Monotonic Period" );
51  _Priority_Node_initialize( &the_period->Priority, 0 );
52  _Priority_Node_set_inactive( &the_period->Priority );
53 
54  the_period->owner = _Thread_Get_executing();
55  the_period->state = RATE_MONOTONIC_INACTIVE;
56 
57  _Watchdog_Preinitialize( &the_period->Timer, _Per_CPU_Get_by_index( 0 ) );
58  _Watchdog_Initialize( &the_period->Timer, _Rate_monotonic_Timeout );
59 
60  _Rate_monotonic_Reset_statistics( the_period );
61 
64  &the_period->Object,
65  (Objects_Name) name
66  );
67 
68  *id = the_period->Object.id;
70  return RTEMS_SUCCESSFUL;
71 }
72 
73 static void _Rate_monotonic_Manager_initialization( void )
74 {
76 }
77 
78 RTEMS_SYSINIT_ITEM(
79  _Rate_monotonic_Manager_initialization,
80  RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC,
81  RTEMS_SYSINIT_ORDER_MIDDLE
82 );
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.
Objects_Control Object
Definition: ratemondata.h:71
uint32_t rtems_name
This type is used to represent a Classic API object name.
Definition: types.h:227
Objects_Information _Rate_monotonic_Information
The Classic Rate Monotonic objects information.
Definition: ratemon.c:47
Watchdog_Control Timer
Protects the rate monotonic period state.
Definition: ratemondata.h:79
Data Related to the Management of Processor Interrupt Levels.
Inlined Routines in the Watchdog Handler.
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
static __inline__ void _Priority_Node_set_inactive(Priority_Node *node)
Sets the priority node inactive.
Definition: priorityimpl.h:184
Thread_Control * owner
Definition: ratemondata.h:100
static __inline__ struct _Thread_Control * _Thread_Get_executing(void)
Returns the thread control block of the executing thread.
Definition: percpu.h:878
This header file defines the status codes and support functions of the Classic API.
static __inline__ void _Watchdog_Preinitialize(Watchdog_Control *the_watchdog, Per_CPU_Control *cpu)
Pre-initializes a watchdog.
Definition: watchdogimpl.h:214
rtems_status_code rtems_rate_monotonic_create(rtems_name name, rtems_id *id)
%
Definition: ratemoncreate.c:30
This status code indicates successful completion.
Definition: status.h:86
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
rtems_rate_monotonic_period_states state
Definition: ratemondata.h:82
static __inline__ void _Watchdog_Initialize(Watchdog_Control *the_watchdog, Watchdog_Service_routine_entry routine)
Initializes a watchdog with a new service routine.
Definition: watchdogimpl.h:236
This status code indicates that a specified address was invalid.
Definition: status.h:133
The following structure defines the control block used to manage each period.
Definition: ratemondata.h:69
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
#define _ISR_lock_Initialize(_lock, _name)
Initializes an ISR lock.
Definition: isrlock.h:182
Classic Rate Monotonic Scheduler Implementation.
static __inline__ Rate_monotonic_Control * _Rate_monotonic_Allocate(void)
Allocates a period control block from the inactive chain of free period control blocks.
Definition: ratemonimpl.h:58
This status code indicates that an object name was invalid.
Definition: status.h:101
Priority_Node Priority
A priority node for use by the scheduler job release and cancel operations.
Definition: ratemondata.h:88
Constants and Structures Related with the Thread Control Block.
static __inline__ void _Priority_Node_initialize(Priority_Node *node, Priority_Control priority)
Initializes the priority node to the given priority.
Definition: priorityimpl.h:156
Objects_Id id
Definition: objectdata.h:43