Changeset 54cf0e34 in rtems


Ignore:
Timestamp:
Apr 10, 2015, 2:19:48 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
1dc6662
Parents:
bcf536a
git-author:
Sebastian Huber <sebastian.huber@…> (04/10/15 14:19:48)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/13/15 11:39:26)
Message:

score: Add Watchdog_Header

This type is intended to encapsulate all state to manage a watchdog
chain.

Update #2307.

Files:
13 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/include/rtems/rtems/timerimpl.h

    rbcf536a r54cf0e34  
    2222#include <rtems/score/objectimpl.h>
    2323#include <rtems/score/thread.h>
     24#include <rtems/score/watchdogimpl.h>
    2425
    2526#ifdef __cplusplus
     
    6566
    6667  /**
    67    * @brief Chain for watchdogs which will be triggered by the timer server.
    68    */
    69   Chain_Control Chain;
     68   * @brief Watchdog header managed by the timer server.
     69   */
     70  Watchdog_Header Header;
    7071
    7172  /**
  • cpukit/rtems/src/timerreset.c

    rbcf536a r54cf0e34  
    5353      if ( the_timer->the_class == TIMER_INTERVAL ) {
    5454        _Watchdog_Remove( &the_timer->Ticker );
    55         _Watchdog_Insert( &_Watchdog_Ticks_chain, &the_timer->Ticker );
     55        _Watchdog_Insert( &_Watchdog_Ticks_header, &the_timer->Ticker );
    5656      } else if ( the_timer->the_class == TIMER_INTERVAL_ON_TASK ) {
    5757        Timer_server_Control *timer_server = _Timer_server;
  • cpukit/rtems/src/timerserver.c

    rbcf536a r54cf0e34  
    3232#include <rtems/score/threadimpl.h>
    3333#include <rtems/score/todimpl.h>
    34 #include <rtems/score/watchdogimpl.h>
    3534
    3635static Timer_server_Control _Timer_server_Default;
     
    5251
    5352  _ISR_Disable( level );
    54   if ( !_Chain_Is_empty( &ts->Interval_watchdogs.Chain ) ) {
     53  if ( !_Watchdog_Is_empty( &ts->Interval_watchdogs.Header ) ) {
    5554    Watchdog_Interval delta_interval =
    56       _Watchdog_First( &ts->Interval_watchdogs.Chain )->delta_interval;
     55      _Watchdog_First( &ts->Interval_watchdogs.Header )->delta_interval;
    5756    _ISR_Enable( level );
    5857
     
    8584
    8685  _ISR_Disable( level );
    87   if ( !_Chain_Is_empty( &ts->TOD_watchdogs.Chain ) ) {
     86  if ( !_Watchdog_Is_empty( &ts->TOD_watchdogs.Header ) ) {
    8887    Watchdog_Interval delta_interval =
    89       _Watchdog_First( &ts->TOD_watchdogs.Chain )->delta_interval;
     88      _Watchdog_First( &ts->TOD_watchdogs.Header )->delta_interval;
    9089    _ISR_Enable( level );
    9190
     
    108107{
    109108  if ( timer->the_class == TIMER_INTERVAL_ON_TASK ) {
    110     _Watchdog_Insert( &ts->Interval_watchdogs.Chain, &timer->Ticker );
     109    _Watchdog_Insert( &ts->Interval_watchdogs.Header, &timer->Ticker );
    111110  } else if ( timer->the_class == TIMER_TIME_OF_DAY_ON_TASK ) {
    112     _Watchdog_Insert( &ts->TOD_watchdogs.Chain, &timer->Ticker );
     111    _Watchdog_Insert( &ts->TOD_watchdogs.Header, &timer->Ticker );
    113112  }
    114113}
     
    145144    snapshot = _Watchdog_Ticks_since_boot;
    146145    last_snapshot = ts->Interval_watchdogs.last_snapshot;
    147     if ( !_Chain_Is_empty( &ts->Interval_watchdogs.Chain ) ) {
    148       first_watchdog = _Watchdog_First( &ts->Interval_watchdogs.Chain );
     146    if ( !_Watchdog_Is_empty( &ts->Interval_watchdogs.Header ) ) {
     147      first_watchdog = _Watchdog_First( &ts->Interval_watchdogs.Header );
    149148
    150149      /*
     
    164163    _ISR_Enable( level );
    165164
    166     _Watchdog_Insert( &ts->Interval_watchdogs.Chain, &timer->Ticker );
     165    _Watchdog_Insert( &ts->Interval_watchdogs.Header, &timer->Ticker );
    167166
    168167    if ( !ts->active ) {
     
    177176    snapshot = (Watchdog_Interval) _TOD_Seconds_since_epoch();
    178177    last_snapshot = ts->TOD_watchdogs.last_snapshot;
    179     if ( !_Chain_Is_empty( &ts->TOD_watchdogs.Chain ) ) {
    180       first_watchdog = _Watchdog_First( &ts->TOD_watchdogs.Chain );
     178    if ( !_Watchdog_Is_empty( &ts->TOD_watchdogs.Header ) ) {
     179      first_watchdog = _Watchdog_First( &ts->TOD_watchdogs.Header );
    181180      delta_interval = first_watchdog->delta_interval;
    182181      if ( snapshot > last_snapshot ) {
     
    202201    _ISR_Enable( level );
    203202
    204     _Watchdog_Insert( &ts->TOD_watchdogs.Chain, &timer->Ticker );
     203    _Watchdog_Insert( &ts->TOD_watchdogs.Header, &timer->Ticker );
    205204
    206205    if ( !ts->active ) {
     
    245244  watchdogs->last_snapshot = snapshot;
    246245
    247   _Watchdog_Adjust_to_chain( &watchdogs->Chain, delta, fire_chain );
     246  _Watchdog_Adjust_to_chain( &watchdogs->Header, delta, fire_chain );
    248247}
    249248
     
    260259   *  Process the seconds chain.  Start by checking that the Time
    261260   *  of Day (TOD) has not been set backwards.  If it has then
    262    *  we want to adjust the watchdogs->Chain to indicate this.
     261   *  we want to adjust the watchdogs->Header to indicate this.
    263262   */
    264263  if ( snapshot > last_snapshot ) {
     
    268267     */
    269268    delta = snapshot - last_snapshot;
    270     _Watchdog_Adjust_to_chain( &watchdogs->Chain, delta, fire_chain );
     269    _Watchdog_Adjust_to_chain( &watchdogs->Header, delta, fire_chain );
    271270
    272271  } else if ( snapshot < last_snapshot ) {
     
    276275      */
    277276     delta = last_snapshot - snapshot;
    278      _Watchdog_Adjust_backward( &watchdogs->Chain, delta );
     277     _Watchdog_Adjust_backward( &watchdogs->Header, delta );
    279278  }
    280279
     
    544543   *  Initialize the timer lists that the server will manage.
    545544   */
    546   _Chain_Initialize_empty( &ts->Interval_watchdogs.Chain );
    547   _Chain_Initialize_empty( &ts->TOD_watchdogs.Chain );
     545  _Watchdog_Header_initialize( &ts->Interval_watchdogs.Header );
     546  _Watchdog_Header_initialize( &ts->TOD_watchdogs.Header );
    548547
    549548  /*
  • cpukit/score/include/rtems/score/watchdogimpl.h

    rbcf536a r54cf0e34  
    5454
    5555/**
     56 * @brief Watchdog header.
     57 */
     58typedef struct {
     59  /**
     60   * @brief The chain of active or transient watchdogs.
     61   */
     62  Chain_Control Watchdogs;
     63} Watchdog_Header;
     64
     65/**
    5666 *  @brief Watchdog synchronization level.
    5767 *
     
    7484 *  This is the watchdog chain which is managed at ticks.
    7585 */
    76 SCORE_EXTERN Chain_Control _Watchdog_Ticks_chain;
     86SCORE_EXTERN Watchdog_Header _Watchdog_Ticks_header;
    7787
    7888/**
     
    8191 *  This is the watchdog chain which is managed at second boundaries.
    8292 */
    83 SCORE_EXTERN Chain_Control _Watchdog_Seconds_chain;
     93SCORE_EXTERN Watchdog_Header _Watchdog_Seconds_header;
    8494
    8595/**
     
    113123 */
    114124void _Watchdog_Adjust_backward(
    115   Chain_Control     *header,
     125  Watchdog_Header   *header,
    116126  Watchdog_Interval  units
    117127);
     
    127137 */
    128138void _Watchdog_Adjust_forward(
    129   Chain_Control     *header,
     139  Watchdog_Header   *header,
    130140  Watchdog_Interval  units
    131141);
     
    146156 */
    147157void _Watchdog_Adjust_to_chain(
    148   Chain_Control               *header,
    149   Watchdog_Interval            units_arg,
    150   Chain_Control               *to_fire
     158  Watchdog_Header   *header,
     159  Watchdog_Interval  units_arg,
     160  Chain_Control     *to_fire
    151161
    152162);
     
    164174 */
    165175void _Watchdog_Insert (
    166   Chain_Control         *header,
    167   Watchdog_Control      *the_watchdog
     176  Watchdog_Header  *header,
     177  Watchdog_Control *the_watchdog
    168178);
    169179
     
    179189 */
    180190void _Watchdog_Tickle (
    181   Chain_Control *header
     191  Watchdog_Header *header
    182192);
    183193
     
    251261{
    252262
    253   _Watchdog_Tickle( &_Watchdog_Ticks_chain );
     263  _Watchdog_Tickle( &_Watchdog_Ticks_header );
    254264
    255265}
     
    263273{
    264274
    265   _Watchdog_Tickle( &_Watchdog_Seconds_chain );
     275  _Watchdog_Tickle( &_Watchdog_Seconds_header );
    266276
    267277}
     
    282292  the_watchdog->initial = units;
    283293
    284   _Watchdog_Insert( &_Watchdog_Ticks_chain, the_watchdog );
     294  _Watchdog_Insert( &_Watchdog_Ticks_header, the_watchdog );
    285295
    286296}
     
    301311  the_watchdog->initial = units;
    302312
    303   _Watchdog_Insert( &_Watchdog_Seconds_chain, the_watchdog );
     313  _Watchdog_Insert( &_Watchdog_Seconds_header, the_watchdog );
    304314
    305315}
     
    319329  (void) _Watchdog_Remove( the_watchdog );
    320330
    321   _Watchdog_Insert( &_Watchdog_Ticks_chain, the_watchdog );
     331  _Watchdog_Insert( &_Watchdog_Ticks_header, the_watchdog );
    322332
    323333}
     
    357367
    358368RTEMS_INLINE_ROUTINE Watchdog_Control *_Watchdog_First(
    359   Chain_Control *header
    360 )
    361 {
    362 
    363   return ( (Watchdog_Control *) _Chain_First( header ) );
     369  Watchdog_Header *header
     370)
     371{
     372
     373  return ( (Watchdog_Control *) _Chain_First( &header->Watchdogs ) );
    364374
    365375}
     
    371381
    372382RTEMS_INLINE_ROUTINE Watchdog_Control *_Watchdog_Last(
    373   Chain_Control *header
    374 )
    375 {
    376 
    377   return ( (Watchdog_Control *) _Chain_Last( header ) );
    378 
     383  Watchdog_Header *header
     384)
     385{
     386
     387  return ( (Watchdog_Control *) _Chain_Last( &header->Watchdogs ) );
     388
     389}
     390
     391RTEMS_INLINE_ROUTINE bool _Watchdog_Is_empty(
     392  const Watchdog_Header *header
     393)
     394{
     395  return _Chain_Is_empty( &header->Watchdogs );
     396}
     397
     398RTEMS_INLINE_ROUTINE void _Watchdog_Header_initialize(
     399  Watchdog_Header *header
     400)
     401{
     402  _Chain_Initialize_empty( &header->Watchdogs );
    379403}
    380404
  • cpukit/score/src/coretodset.c

    rbcf536a r54cf0e34  
    3232  Watchdog_Interval seconds_now;
    3333  ISR_lock_Context lock_context;
    34   Chain_Control *header;
     34  Watchdog_Header *header;
    3535
    3636  _Thread_Disable_dispatch();
    3737
    3838  seconds_now = _TOD_Seconds_since_epoch();
    39   header = &_Watchdog_Seconds_chain;
     39  header = &_Watchdog_Seconds_header;
    4040
    4141  if ( seconds_next < seconds_now )
  • cpukit/score/src/watchdog.c

    rbcf536a r54cf0e34  
    2222#endif
    2323
    24 #include <rtems/system.h>
    25 #include <rtems/score/isr.h>
    2624#include <rtems/score/watchdogimpl.h>
    2725
     
    3230  _Watchdog_Ticks_since_boot = 0;
    3331
    34   _Chain_Initialize_empty( &_Watchdog_Ticks_chain );
    35   _Chain_Initialize_empty( &_Watchdog_Seconds_chain );
     32  _Watchdog_Header_initialize( &_Watchdog_Ticks_header );
     33  _Watchdog_Header_initialize( &_Watchdog_Seconds_header );
    3634}
  • cpukit/score/src/watchdogadjust.c

    rbcf536a r54cf0e34  
    2424
    2525void _Watchdog_Adjust_backward(
    26   Chain_Control     *header,
     26  Watchdog_Header   *header,
    2727  Watchdog_Interval  units
    2828)
     
    3232  _ISR_Disable( level );
    3333
    34   if ( !_Chain_Is_empty( header ) ) {
     34  if ( !_Watchdog_Is_empty( header ) ) {
    3535     _Watchdog_First( header )->delta_interval += units;
    3636  }
     
    4040
    4141void _Watchdog_Adjust_forward(
    42   Chain_Control     *header,
     42  Watchdog_Header   *header,
    4343  Watchdog_Interval  units
    4444)
     
    4848  _ISR_Disable( level );
    4949
    50   while ( !_Chain_Is_empty( header ) && units > 0 ) {
     50  while ( !_Watchdog_Is_empty( header ) && units > 0 ) {
    5151    Watchdog_Control *first = _Watchdog_First( header );
    5252
  • cpukit/score/src/watchdogadjusttochain.c

    rbcf536a r54cf0e34  
    1919#endif
    2020
    21 #include <rtems/system.h>
    22 #include <rtems/score/isr.h>
    2321#include <rtems/score/watchdogimpl.h>
     22#include <rtems/score/isrlevel.h>
    2423
    2524void _Watchdog_Adjust_to_chain(
    26   Chain_Control               *header,
    27   Watchdog_Interval            units_arg,
    28   Chain_Control               *to_fire
     25  Watchdog_Header   *header,
     26  Watchdog_Interval  units_arg,
     27  Chain_Control     *to_fire
    2928
    3029)
     
    3736
    3837  while ( 1 ) {
    39     if ( _Chain_Is_empty( header ) ) {
     38    if ( _Watchdog_Is_empty( header ) ) {
    4039      break;
    4140    }
     
    6463      _ISR_Flash( level );
    6564
    66       if ( _Chain_Is_empty( header ) )
     65      if ( _Watchdog_Is_empty( header ) )
    6766        break;
    6867      first = _Watchdog_First( header );
  • cpukit/score/src/watchdoginsert.c

    rbcf536a r54cf0e34  
    1919#endif
    2020
    21 #include <rtems/system.h>
    22 #include <rtems/score/isr.h>
    2321#include <rtems/score/watchdogimpl.h>
     22#include <rtems/score/isrlevel.h>
     23#include <rtems/score/percpu.h>
    2424
    2525void _Watchdog_Insert(
    26   Chain_Control         *header,
     26  Watchdog_Header       *header,
    2727  Watchdog_Control      *the_watchdog
    2828)
  • cpukit/score/src/watchdogtickle.c

    rbcf536a r54cf0e34  
    1919#endif
    2020
    21 #include <rtems/system.h>
    22 #include <rtems/score/isr.h>
    2321#include <rtems/score/watchdogimpl.h>
     22#include <rtems/score/isrlevel.h>
    2423
    2524void _Watchdog_Tickle(
    26   Chain_Control *header
     25  Watchdog_Header *header
    2726)
    2827{
     
    3938  _ISR_Disable( level );
    4039
    41   if ( _Chain_Is_empty( header ) )
     40  if ( _Watchdog_Is_empty( header ) )
    4241    goto leave;
    4342
     
    111110
    112111     the_watchdog = _Watchdog_First( header );
    113    } while ( !_Chain_Is_empty( header ) &&
     112   } while ( !_Watchdog_Is_empty( header ) &&
    114113             (the_watchdog->delta_interval == 0) );
    115114
  • testsuites/sptests/spintrcritical08/init.c

    rbcf536a r54cf0e34  
    4747)
    4848{
    49   Chain_Control *chain = &_Watchdog_Ticks_chain;
     49  Watchdog_Header *header = &_Watchdog_Ticks_header;
    5050
    51   if ( !_Chain_Is_empty( chain ) ) {
    52     Watchdog_Control *watchdog = _Watchdog_First( chain );
     51  if ( !_Watchdog_Is_empty( header ) ) {
     52    Watchdog_Control *watchdog = _Watchdog_First( header );
    5353
    5454    if (
  • testsuites/sptests/spintrcritical09/init.c

    rbcf536a r54cf0e34  
    4444)
    4545{
    46   Chain_Control *chain = &_Watchdog_Ticks_chain;
     46  Watchdog_Header *header = &_Watchdog_Ticks_header;
    4747
    48   if ( !_Chain_Is_empty( chain ) ) {
    49     Watchdog_Control *watchdog = _Watchdog_First( chain );
     48  if ( !_Watchdog_Is_empty( header ) ) {
     49    Watchdog_Control *watchdog = _Watchdog_First( header );
    5050
    5151    if (
  • testsuites/sptests/spsize/size.c

    rbcf536a r54cf0e34  
    403403                (sizeof _Watchdog_Sync_count)             +
    404404                (sizeof _Watchdog_Ticks_since_boot)       +
    405                 (sizeof _Watchdog_Ticks_chain)            +
    406                 (sizeof _Watchdog_Seconds_chain)          +
     405                (sizeof _Watchdog_Ticks_header)           +
     406                (sizeof _Watchdog_Seconds_header)         +
    407407
    408408/*wkspace.h*/   (sizeof _Workspace_Area);
Note: See TracChangeset for help on using the changeset viewer.