Changeset 113ef9fc in rtems
- Timestamp:
- 04/09/97 20:02:29 (26 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- eafd698
- Parents:
- 0c3cd61
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/rtems/headers/ratemon.h
r0c3cd61 r113ef9fc 47 47 RATE_MONOTONIC_EXPIRED /* off chain, will be reset by next */ 48 48 /* rtems_rate_monotonic_period */ 49 } Rate_Monotonic_Period_states;49 } rtems_rate_monotonic_period_states; 50 50 51 51 /* … … 56 56 #define RTEMS_PERIOD_STATUS WATCHDOG_NO_TIMEOUT 57 57 58 /* 59 * The following defines the period status structure. 60 */ 61 62 typedef struct { 63 rtems_rate_monotonic_period_states state; 64 unsigned32 ticks_since_last_period; 65 unsigned32 ticks_executed_since_last_period; 66 } rtems_rate_monotonic_period_status; 67 58 68 /* 59 69 * The following structure defines the control block used to manage … … 62 72 63 73 typedef struct { 64 Objects_Control Object; 65 Watchdog_Control Timer; 66 Rate_Monotonic_Period_states state; 67 Thread_Control *owner; 74 Objects_Control Object; 75 Watchdog_Control Timer; 76 rtems_rate_monotonic_period_states state; 77 unsigned32 owner_ticks_executed_at_period; 78 unsigned32 time_at_period; 79 Thread_Control *owner; 68 80 } Rate_monotonic_Control; 69 81 … … 138 150 rtems_status_code rtems_rate_monotonic_delete( 139 151 Objects_Id id 152 ); 153 154 /* 155 * rtems_rate_monotonic_get_status 156 * 157 * DESCRIPTION: 158 * 159 * This routine implements the rtems_rate_monotonic_get_status directive. 160 * Information about the period indicated by ID is returned. 161 * 162 */ 163 164 rtems_status_code rtems_rate_monotonic_get_status( 165 Objects_Id id, 166 rtems_rate_monotonic_period_status *status 140 167 ); 141 168 -
c/src/exec/rtems/include/rtems/rtems/ratemon.h
r0c3cd61 r113ef9fc 47 47 RATE_MONOTONIC_EXPIRED /* off chain, will be reset by next */ 48 48 /* rtems_rate_monotonic_period */ 49 } Rate_Monotonic_Period_states;49 } rtems_rate_monotonic_period_states; 50 50 51 51 /* … … 56 56 #define RTEMS_PERIOD_STATUS WATCHDOG_NO_TIMEOUT 57 57 58 /* 59 * The following defines the period status structure. 60 */ 61 62 typedef struct { 63 rtems_rate_monotonic_period_states state; 64 unsigned32 ticks_since_last_period; 65 unsigned32 ticks_executed_since_last_period; 66 } rtems_rate_monotonic_period_status; 67 58 68 /* 59 69 * The following structure defines the control block used to manage … … 62 72 63 73 typedef struct { 64 Objects_Control Object; 65 Watchdog_Control Timer; 66 Rate_Monotonic_Period_states state; 67 Thread_Control *owner; 74 Objects_Control Object; 75 Watchdog_Control Timer; 76 rtems_rate_monotonic_period_states state; 77 unsigned32 owner_ticks_executed_at_period; 78 unsigned32 time_at_period; 79 Thread_Control *owner; 68 80 } Rate_monotonic_Control; 69 81 … … 138 150 rtems_status_code rtems_rate_monotonic_delete( 139 151 Objects_Id id 152 ); 153 154 /* 155 * rtems_rate_monotonic_get_status 156 * 157 * DESCRIPTION: 158 * 159 * This routine implements the rtems_rate_monotonic_get_status directive. 160 * Information about the period indicated by ID is returned. 161 * 162 */ 163 164 rtems_status_code rtems_rate_monotonic_get_status( 165 Objects_Id id, 166 rtems_rate_monotonic_period_status *status 140 167 ); 141 168 -
c/src/exec/rtems/src/ratemon.c
r0c3cd61 r113ef9fc 216 216 /*PAGE 217 217 * 218 * rtems_rate_monotonic_get_status 219 * 220 * This directive allows a thread to obtain status information on a 221 * period. 222 * 223 * Input parameters: 224 * id - rate monotonic id 225 * status - pointer to status control block 226 * 227 * Output parameters: 228 * RTEMS_SUCCESSFUL - if successful 229 * error code - if unsuccessful 230 * 231 */ 232 233 rtems_status_code rtems_rate_monotonic_get_status( 234 Objects_Id id, 235 rtems_rate_monotonic_period_status *status 236 ) 237 { 238 Objects_Locations location; 239 Rate_monotonic_Control *the_period; 240 241 the_period = _Rate_monotonic_Get( id, &location ); 242 switch ( location ) { 243 case OBJECTS_ERROR: 244 return RTEMS_INVALID_ID; 245 case OBJECTS_REMOTE: /* should never return this */ 246 return RTEMS_INTERNAL_ERROR; 247 case OBJECTS_LOCAL: 248 status->state = the_period->state; 249 250 if ( status->state == RATE_MONOTONIC_INACTIVE ) { 251 status->ticks_since_last_period = 0; 252 status->ticks_executed_since_last_period = 0; 253 } else { 254 status->ticks_since_last_period = 255 _Watchdog_Ticks_since_boot - the_period->time_at_period; 256 257 status->ticks_executed_since_last_period = 258 the_period->owner->ticks_executed - 259 the_period->owner_ticks_executed_at_period; 260 } 261 262 _Thread_Enable_dispatch(); 263 return RTEMS_SUCCESSFUL; 264 } 265 266 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 267 } 268 269 270 /*PAGE 271 * 218 272 * rtems_rate_monotonic_period 219 273 * … … 234 288 ) 235 289 { 236 Rate_monotonic_Control *the_period;237 Objects_Locations location;238 rtems_status_code return_value;239 Rate_Monotonic_Period_states local_state;240 ISR_Level level;290 Rate_monotonic_Control *the_period; 291 Objects_Locations location; 292 rtems_status_code return_value; 293 rtems_rate_monotonic_period_states local_state; 294 ISR_Level level; 241 295 242 296 the_period = _Rate_monotonic_Get( id, &location ); … … 282 336 NULL 283 337 ); 338 339 the_period->owner_ticks_executed_at_period = 340 _Thread_Executing->ticks_executed; 341 342 the_period->time_at_period = _Watchdog_Ticks_since_boot; 343 284 344 _Watchdog_Insert_ticks( &the_period->Timer, length ); 285 345 _Thread_Enable_dispatch(); … … 323 383 _ISR_Enable( level ); 324 384 the_period->state = RATE_MONOTONIC_ACTIVE; 385 the_period->owner_ticks_executed_at_period = 386 _Thread_Executing->ticks_executed; 387 the_period->time_at_period = _Watchdog_Ticks_since_boot; 388 325 389 _Watchdog_Insert_ticks( &the_period->Timer, length ); 326 390 _Thread_Enable_dispatch(); … … 373 437 the_thread->Wait.id == the_period->Object.id ) { 374 438 _Thread_Unblock( the_thread ); 439 the_period->owner_ticks_executed_at_period = 440 the_thread->ticks_executed; 441 442 the_period->time_at_period = _Watchdog_Ticks_since_boot; 443 375 444 _Watchdog_Reset( &the_period->Timer ); 376 445 } else if ( the_period->state == RATE_MONOTONIC_OWNER_IS_BLOCKING ) { 377 446 the_period->state = RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING; 447 the_period->owner_ticks_executed_at_period = 448 the_thread->ticks_executed; 449 450 the_period->time_at_period = _Watchdog_Ticks_since_boot; 378 451 _Watchdog_Reset( &the_period->Timer ); 379 452 } else -
cpukit/rtems/include/rtems/rtems/ratemon.h
r0c3cd61 r113ef9fc 47 47 RATE_MONOTONIC_EXPIRED /* off chain, will be reset by next */ 48 48 /* rtems_rate_monotonic_period */ 49 } Rate_Monotonic_Period_states;49 } rtems_rate_monotonic_period_states; 50 50 51 51 /* … … 56 56 #define RTEMS_PERIOD_STATUS WATCHDOG_NO_TIMEOUT 57 57 58 /* 59 * The following defines the period status structure. 60 */ 61 62 typedef struct { 63 rtems_rate_monotonic_period_states state; 64 unsigned32 ticks_since_last_period; 65 unsigned32 ticks_executed_since_last_period; 66 } rtems_rate_monotonic_period_status; 67 58 68 /* 59 69 * The following structure defines the control block used to manage … … 62 72 63 73 typedef struct { 64 Objects_Control Object; 65 Watchdog_Control Timer; 66 Rate_Monotonic_Period_states state; 67 Thread_Control *owner; 74 Objects_Control Object; 75 Watchdog_Control Timer; 76 rtems_rate_monotonic_period_states state; 77 unsigned32 owner_ticks_executed_at_period; 78 unsigned32 time_at_period; 79 Thread_Control *owner; 68 80 } Rate_monotonic_Control; 69 81 … … 138 150 rtems_status_code rtems_rate_monotonic_delete( 139 151 Objects_Id id 152 ); 153 154 /* 155 * rtems_rate_monotonic_get_status 156 * 157 * DESCRIPTION: 158 * 159 * This routine implements the rtems_rate_monotonic_get_status directive. 160 * Information about the period indicated by ID is returned. 161 * 162 */ 163 164 rtems_status_code rtems_rate_monotonic_get_status( 165 Objects_Id id, 166 rtems_rate_monotonic_period_status *status 140 167 ); 141 168 -
cpukit/rtems/src/ratemon.c
r0c3cd61 r113ef9fc 216 216 /*PAGE 217 217 * 218 * rtems_rate_monotonic_get_status 219 * 220 * This directive allows a thread to obtain status information on a 221 * period. 222 * 223 * Input parameters: 224 * id - rate monotonic id 225 * status - pointer to status control block 226 * 227 * Output parameters: 228 * RTEMS_SUCCESSFUL - if successful 229 * error code - if unsuccessful 230 * 231 */ 232 233 rtems_status_code rtems_rate_monotonic_get_status( 234 Objects_Id id, 235 rtems_rate_monotonic_period_status *status 236 ) 237 { 238 Objects_Locations location; 239 Rate_monotonic_Control *the_period; 240 241 the_period = _Rate_monotonic_Get( id, &location ); 242 switch ( location ) { 243 case OBJECTS_ERROR: 244 return RTEMS_INVALID_ID; 245 case OBJECTS_REMOTE: /* should never return this */ 246 return RTEMS_INTERNAL_ERROR; 247 case OBJECTS_LOCAL: 248 status->state = the_period->state; 249 250 if ( status->state == RATE_MONOTONIC_INACTIVE ) { 251 status->ticks_since_last_period = 0; 252 status->ticks_executed_since_last_period = 0; 253 } else { 254 status->ticks_since_last_period = 255 _Watchdog_Ticks_since_boot - the_period->time_at_period; 256 257 status->ticks_executed_since_last_period = 258 the_period->owner->ticks_executed - 259 the_period->owner_ticks_executed_at_period; 260 } 261 262 _Thread_Enable_dispatch(); 263 return RTEMS_SUCCESSFUL; 264 } 265 266 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 267 } 268 269 270 /*PAGE 271 * 218 272 * rtems_rate_monotonic_period 219 273 * … … 234 288 ) 235 289 { 236 Rate_monotonic_Control *the_period;237 Objects_Locations location;238 rtems_status_code return_value;239 Rate_Monotonic_Period_states local_state;240 ISR_Level level;290 Rate_monotonic_Control *the_period; 291 Objects_Locations location; 292 rtems_status_code return_value; 293 rtems_rate_monotonic_period_states local_state; 294 ISR_Level level; 241 295 242 296 the_period = _Rate_monotonic_Get( id, &location ); … … 282 336 NULL 283 337 ); 338 339 the_period->owner_ticks_executed_at_period = 340 _Thread_Executing->ticks_executed; 341 342 the_period->time_at_period = _Watchdog_Ticks_since_boot; 343 284 344 _Watchdog_Insert_ticks( &the_period->Timer, length ); 285 345 _Thread_Enable_dispatch(); … … 323 383 _ISR_Enable( level ); 324 384 the_period->state = RATE_MONOTONIC_ACTIVE; 385 the_period->owner_ticks_executed_at_period = 386 _Thread_Executing->ticks_executed; 387 the_period->time_at_period = _Watchdog_Ticks_since_boot; 388 325 389 _Watchdog_Insert_ticks( &the_period->Timer, length ); 326 390 _Thread_Enable_dispatch(); … … 373 437 the_thread->Wait.id == the_period->Object.id ) { 374 438 _Thread_Unblock( the_thread ); 439 the_period->owner_ticks_executed_at_period = 440 the_thread->ticks_executed; 441 442 the_period->time_at_period = _Watchdog_Ticks_since_boot; 443 375 444 _Watchdog_Reset( &the_period->Timer ); 376 445 } else if ( the_period->state == RATE_MONOTONIC_OWNER_IS_BLOCKING ) { 377 446 the_period->state = RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING; 447 the_period->owner_ticks_executed_at_period = 448 the_thread->ticks_executed; 449 450 the_period->time_at_period = _Watchdog_Ticks_since_boot; 378 451 _Watchdog_Reset( &the_period->Timer ); 379 452 } else
Note: See TracChangeset
for help on using the changeset viewer.