source: rtems/cpukit/rtems/src/ratemoncreate.c @ ebe61382

4.104.114.95
Last change on this file since ebe61382 was e1bce86, checked in by Joel Sherrill <joel.sherrill@…>, on 05/15/07 at 20:16:16

2007-05-15 Joel Sherrill <joel.sherrill@…>

  • Makefile.am, preinstall.am, libmisc/Makefile.am, rtems/Makefile.am, rtems/include/rtems.h, rtems/include/rtems/rtems/ratemon.h, rtems/inline/rtems/rtems/ratemon.inl, rtems/src/ratemoncancel.c, rtems/src/ratemoncreate.c, rtems/src/ratemondelete.c, rtems/src/ratemongetstatus.c, rtems/src/ratemonident.c, rtems/src/ratemonperiod.c, rtems/src/ratemontimeout.c, score/Makefile.am, score/include/rtems/score/object.h, score/src/threadhandler.c, wrapup/Makefile.am: Integrate Rate Monotonic Statistics and Period Usage into Rate Monotonic Manager. Added the following directives: rtems_rate_monotonic_get_statistics, rtems_rate_monotonic_reset_statistics, rtems_rate_montonic_reset_all_statistics, rtems_rate_montonic_report_statistics, and rtems_object_get_name. Obsoleted the rtems/rtmonuse.h file as a public interface.
  • rtems/src/ratemongetstatistics.c, rtems/src/ratemonreportstatistics.c, rtems/src/ratemonresetall.c, rtems/src/ratemonresetstatistics.c, rtems/src/rtemsobjectgetname.c, score/src/objectgetnameasstring.c: New files.
  • libmisc/rtmonuse/rtmonuse.c, libmisc/rtmonuse/rtmonuse.h: Removed.
  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  Rate Monotonic Manager -- Create a Period
3 *
4 *  COPYRIGHT (c) 1989-2007.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/system.h>
19#include <rtems/rtems/status.h>
20#include <rtems/rtems/support.h>
21#include <rtems/score/isr.h>
22#include <rtems/score/object.h>
23#include <rtems/rtems/ratemon.h>
24#include <rtems/score/thread.h>
25
26/*PAGE
27 *
28 *  rtems_rate_monotonic_create
29 *
30 *  This directive creates a rate monotonic timer and performs
31 *  some initialization.
32 *
33 *  Input parameters:
34 *    name - name of period
35 *    id   - pointer to rate monotonic id
36 *
37 *  Output parameters:
38 *    id               - rate monotonic id
39 *    RTEMS_SUCCESSFUL - if successful
40 *    error code       - if unsuccessful
41 */
42
43rtems_status_code rtems_rate_monotonic_create(
44  rtems_name    name,
45  Objects_Id   *id
46)
47{
48  Rate_monotonic_Control *the_period;
49
50  if ( !rtems_is_name_valid( name ) )
51    return RTEMS_INVALID_NAME;
52
53  if ( !id )
54    return RTEMS_INVALID_ADDRESS;
55
56  _Thread_Disable_dispatch();            /* to prevent deletion */
57
58  the_period = _Rate_monotonic_Allocate();
59
60  if ( !the_period ) {
61    _Thread_Enable_dispatch();
62    return RTEMS_TOO_MANY;
63  }
64
65  the_period->owner = _Thread_Executing;
66  the_period->state = RATE_MONOTONIC_INACTIVE;
67
68  _Watchdog_Initialize( &the_period->Timer, NULL, 0, NULL );
69
70  _Rate_monotonic_Reset_statistics( the_period );
71
72  _Objects_Open(
73    &_Rate_monotonic_Information,
74    &the_period->Object,
75    (Objects_Name) name
76  );
77
78  *id = the_period->Object.id;
79  _Thread_Enable_dispatch();
80  return RTEMS_SUCCESSFUL;
81}
Note: See TracBrowser for help on using the repository browser.