[ac7d5ef0] | 1 | /* ratemon.h |
---|
| 2 | * |
---|
| 3 | * This include file contains all the constants, structures, and |
---|
| 4 | * prototypes associated with the Rate Monotonic Manager. This manager |
---|
| 5 | * provides facilities to implement tasks which execute in a periodic fashion. |
---|
| 6 | * |
---|
| 7 | * Directives provided are: |
---|
| 8 | * |
---|
| 9 | * + create a rate monotonic timer |
---|
| 10 | * + cancel a period |
---|
| 11 | * + delete a rate monotonic timer |
---|
| 12 | * + conclude current and start the next period |
---|
| 13 | * |
---|
| 14 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
| 15 | * On-Line Applications Research Corporation (OAR). |
---|
| 16 | * All rights assigned to U.S. Government, 1994. |
---|
| 17 | * |
---|
| 18 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
| 19 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
| 20 | * notice must appear in all copies of this file and its derivatives. |
---|
| 21 | * |
---|
| 22 | * $Id$ |
---|
| 23 | */ |
---|
| 24 | |
---|
| 25 | #ifndef __RTEMS_RATE_MONOTONIC_h |
---|
| 26 | #define __RTEMS_RATE_MONOTONIC_h |
---|
| 27 | |
---|
| 28 | #ifdef __cplusplus |
---|
| 29 | extern "C" { |
---|
| 30 | #endif |
---|
| 31 | |
---|
[5e9b32b] | 32 | #include <rtems/score/object.h> |
---|
| 33 | #include <rtems/score/thread.h> |
---|
| 34 | #include <rtems/score/watchdog.h> |
---|
[ac7d5ef0] | 35 | |
---|
| 36 | /* |
---|
| 37 | * The following enumerated type defines the states in which a |
---|
| 38 | * period may be. |
---|
| 39 | */ |
---|
| 40 | |
---|
| 41 | typedef enum { |
---|
[11ab74e] | 42 | RATE_MONOTONIC_INACTIVE, /* off chain, never initialized */ |
---|
| 43 | RATE_MONOTONIC_OWNER_IS_BLOCKING, /* on chain, owner is blocking on it */ |
---|
| 44 | RATE_MONOTONIC_ACTIVE, /* on chain, running continuously */ |
---|
| 45 | RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING, /* on chain, expired while owner was */ |
---|
| 46 | /* was blocking on it */ |
---|
| 47 | RATE_MONOTONIC_EXPIRED /* off chain, will be reset by next */ |
---|
| 48 | /* rtems_rate_monotonic_period */ |
---|
[ac7d5ef0] | 49 | } Rate_Monotonic_Period_states; |
---|
| 50 | |
---|
| 51 | /* |
---|
| 52 | * The following constant is the interval passed to the rate_monontonic_period |
---|
| 53 | * directive to obtain status information. |
---|
| 54 | */ |
---|
| 55 | |
---|
[3a4ae6c] | 56 | #define RTEMS_PERIOD_STATUS WATCHDOG_NO_TIMEOUT |
---|
[ac7d5ef0] | 57 | |
---|
| 58 | /* |
---|
| 59 | * The following structure defines the control block used to manage |
---|
| 60 | * each period. |
---|
| 61 | */ |
---|
| 62 | |
---|
| 63 | typedef struct { |
---|
| 64 | Objects_Control Object; |
---|
| 65 | Watchdog_Control Timer; |
---|
| 66 | Rate_Monotonic_Period_states state; |
---|
| 67 | Thread_Control *owner; |
---|
| 68 | } Rate_monotonic_Control; |
---|
| 69 | |
---|
[c627b2a3] | 70 | RTEMS_EXTERN Objects_Information _Rate_monotonic_Information; |
---|
[ac7d5ef0] | 71 | |
---|
| 72 | /* |
---|
| 73 | * _Rate_monotonic_Manager_initialization |
---|
| 74 | * |
---|
| 75 | * DESCRIPTION: |
---|
| 76 | * |
---|
| 77 | * This routine performs the initialization necessary for this manager. |
---|
| 78 | */ |
---|
| 79 | |
---|
| 80 | void _Rate_monotonic_Manager_initialization( |
---|
| 81 | unsigned32 maximum_periods |
---|
| 82 | ); |
---|
| 83 | |
---|
| 84 | /* |
---|
| 85 | * rtems_rate_monotonic_create |
---|
| 86 | * |
---|
| 87 | * DESCRIPTION: |
---|
| 88 | * |
---|
| 89 | * This routine implements the rate_monotonic_create directive. The |
---|
| 90 | * period will have the name name. It returns the id of the |
---|
| 91 | * created period in ID. |
---|
| 92 | */ |
---|
| 93 | |
---|
| 94 | rtems_status_code rtems_rate_monotonic_create( |
---|
[3235ad9] | 95 | rtems_name name, |
---|
[ac7d5ef0] | 96 | Objects_Id *id |
---|
| 97 | ); |
---|
| 98 | |
---|
| 99 | /* |
---|
| 100 | * rtems_rate_monotonic_ident |
---|
| 101 | * |
---|
| 102 | * DESCRIPTION: |
---|
| 103 | * |
---|
| 104 | * This routine implements the rtems_rate_monotonic_ident directive. |
---|
| 105 | * This directive returns the period ID associated with name. |
---|
| 106 | * If more than one period is named name, then the period |
---|
| 107 | * to which the ID belongs is arbitrary. |
---|
| 108 | */ |
---|
| 109 | |
---|
| 110 | rtems_status_code rtems_rate_monotonic_ident( |
---|
[3235ad9] | 111 | rtems_name name, |
---|
[ac7d5ef0] | 112 | Objects_Id *id |
---|
| 113 | ); |
---|
| 114 | |
---|
| 115 | /* |
---|
| 116 | * rtems_rate_monotonic_cancel |
---|
| 117 | * |
---|
| 118 | * DESCRIPTION: |
---|
| 119 | * |
---|
| 120 | * This routine implements the rtems_rate_monotonic_cancel directive. This |
---|
| 121 | * directive stops the period associated with ID from continuing to |
---|
| 122 | * run. |
---|
| 123 | */ |
---|
| 124 | |
---|
| 125 | rtems_status_code rtems_rate_monotonic_cancel( |
---|
| 126 | Objects_Id id |
---|
| 127 | ); |
---|
| 128 | |
---|
| 129 | /* |
---|
| 130 | * rtems_rate_monotonic_delete |
---|
| 131 | * |
---|
| 132 | * DESCRIPTION: |
---|
| 133 | * |
---|
| 134 | * This routine implements the rtems_rate_monotonic_delete directive. The |
---|
| 135 | * period indicated by ID is deleted. |
---|
| 136 | */ |
---|
| 137 | |
---|
| 138 | rtems_status_code rtems_rate_monotonic_delete( |
---|
| 139 | Objects_Id id |
---|
| 140 | ); |
---|
| 141 | |
---|
| 142 | /* |
---|
| 143 | * rtems_rate_monotonic_period |
---|
| 144 | * |
---|
| 145 | * DESCRIPTION: |
---|
| 146 | * |
---|
| 147 | * This routine implements the rtems_rate_monotonic_period directive. When |
---|
| 148 | * length is non-zero, this directive initiates the period associated with |
---|
| 149 | * ID from continuing for a period of length. If length is zero, then |
---|
| 150 | * result is set to indicate the current state of the period. |
---|
| 151 | */ |
---|
| 152 | |
---|
| 153 | rtems_status_code rtems_rate_monotonic_period( |
---|
[3a4ae6c] | 154 | Objects_Id id, |
---|
| 155 | rtems_interval length |
---|
[ac7d5ef0] | 156 | ); |
---|
| 157 | |
---|
| 158 | /* |
---|
| 159 | * _Rate_monotonic_Timeout |
---|
| 160 | * |
---|
| 161 | * DESCRIPTION: |
---|
| 162 | * |
---|
| 163 | * This routine is invoked when the period represented |
---|
| 164 | * by ID expires. If the task which owns this period is blocked |
---|
| 165 | * waiting for the period to expire, then it is readied and the |
---|
| 166 | * period is restarted. If the owning task is not waiting for the |
---|
| 167 | * period to expire, then the period is placed in the EXPIRED |
---|
| 168 | * state and not restarted. |
---|
| 169 | */ |
---|
| 170 | |
---|
| 171 | void _Rate_monotonic_Timeout ( |
---|
| 172 | Objects_Id id, |
---|
| 173 | void *ignored |
---|
| 174 | ); |
---|
| 175 | |
---|
[1a8fde6c] | 176 | #ifndef __RTEMS_APPLICATION__ |
---|
[3a4ae6c] | 177 | #include <rtems/rtems/ratemon.inl> |
---|
[1a8fde6c] | 178 | #endif |
---|
[ac7d5ef0] | 179 | |
---|
| 180 | #ifdef __cplusplus |
---|
| 181 | } |
---|
| 182 | #endif |
---|
| 183 | |
---|
| 184 | #endif |
---|
| 185 | /* end of include file */ |
---|