source: rtems/c/src/exec/rtems/src/ratemoncreate.c @ 5f9b3db

4.104.114.84.95
Last change on this file since 5f9b3db was 5f9b3db, checked in by Joel Sherrill <joel.sherrill@…>, on 05/17/99 at 23:03:07

Split Rate Monotonic Manager into one routine per file.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  Rate Monotonic Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-1998.
6 *  On-Line Applications Research Corporation (OAR).
7 *  Copyright assigned to U.S. Government, 1994.
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#include <rtems/system.h>
17#include <rtems/rtems/status.h>
18#include <rtems/rtems/support.h>
19#include <rtems/score/isr.h>
20#include <rtems/score/object.h>
21#include <rtems/rtems/ratemon.h>
22#include <rtems/score/thread.h>
23
24/*PAGE
25 *
26 *  rtems_rate_monotonic_create
27 *
28 *  This directive creates a rate monotonic timer and performs
29 *  some initialization.
30 *
31 *  Input parameters:
32 *    name - name of period
33 *    id   - pointer to rate monotonic id
34 *
35 *  Output parameters:
36 *    id                - rate monotonic id
37 *    RTEMS_SUCCESSFUL - if successful
38 *    error code        - if unsuccessful
39 */
40
41rtems_status_code rtems_rate_monotonic_create(
42  rtems_name    name,
43  Objects_Id   *id
44)
45{
46  Rate_monotonic_Control *the_period;
47
48  if ( !rtems_is_name_valid( name ) )
49    return RTEMS_INVALID_NAME;
50
51  _Thread_Disable_dispatch();            /* to prevent deletion */
52
53  the_period = _Rate_monotonic_Allocate();
54
55  if ( !the_period ) {
56    _Thread_Enable_dispatch();
57    return RTEMS_TOO_MANY;
58  }
59
60  the_period->owner = _Thread_Executing;
61  the_period->state = RATE_MONOTONIC_INACTIVE;
62
63  _Objects_Open( &_Rate_monotonic_Information, &the_period->Object, &name );
64
65  *id = the_period->Object.id;
66  _Thread_Enable_dispatch();
67  return RTEMS_SUCCESSFUL;
68}
Note: See TracBrowser for help on using the repository browser.