Changeset fd53d25 in rtems


Ignore:
Timestamp:
Apr 24, 2015, 7:53:58 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
a382010c
Parents:
1ccbd052
git-author:
Sebastian Huber <sebastian.huber@…> (04/24/15 07:53:58)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/19/15 10:00:43)
Message:

score: Move _Watchdog_Tickle()

Make internal function _Watchdog_Remove_it() static to avoid accidental
usage.

Update #2307.

Location:
cpukit/score
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/Makefile.am

    r1ccbd052 rfd53d25  
    325325## WATCHDOG_C_FILES
    326326libscore_a_SOURCES += src/watchdog.c src/watchdogadjust.c \
    327     src/watchdogadjusttochain.c src/watchdoginsert.c src/watchdogremove.c \
    328     src/watchdogtickle.c
     327    src/watchdogadjusttochain.c src/watchdoginsert.c src/watchdogremove.c
    329328libscore_a_SOURCES += src/watchdogtickssinceboot.c
    330329
  • cpukit/score/include/rtems/score/watchdogimpl.h

    r1ccbd052 rfd53d25  
    154154
    155155/**
    156  * @brief Actually removes an WATCHDOG_ACTIVE or WATCHDOG_REMOVE_IT watchdog.
    157  *
    158  * @see _Watchdog_Remove() and _Watchdog_Tickle().
    159  */
    160 void _Watchdog_Remove_it(
    161   Watchdog_Header  *header,
    162   Watchdog_Control *the_watchdog
    163 );
    164 
    165 /**
    166156 *  @brief Adjusts the header watchdog chain in the backward direction for
    167157 *  units ticks.
  • cpukit/score/src/watchdogremove.c

    r1ccbd052 rfd53d25  
    2222#include <rtems/score/assert.h>
    2323
    24 void _Watchdog_Remove_it(
     24static void _Watchdog_Remove_it(
    2525  Watchdog_Header   *header,
    2626  Watchdog_Control  *the_watchdog
     
    108108  return( previous_state );
    109109}
     110
     111void _Watchdog_Tickle(
     112  Watchdog_Header *header
     113)
     114{
     115  ISR_lock_Context lock_context;
     116
     117  _Watchdog_Acquire( header, &lock_context );
     118
     119  if ( !_Watchdog_Is_empty( header ) ) {
     120    Watchdog_Control  *first;
     121    Watchdog_Interval  delta;
     122
     123    first = _Watchdog_First( header );
     124    delta = first->delta_interval;
     125
     126    /*
     127     * Although it is forbidden to insert watchdogs with a delta interval of
     128     * zero it is possible to observe watchdogs with a delta interval of zero
     129     * at this point.  For example lets have a watchdog chain of one watchdog
     130     * with a delta interval of one and insert a new one with an initial value
     131     * of one.  At the start of the insert procedure it will advance one step
     132     * and reduce its delta interval by one yielding zero.  Now a tick happens.
     133     * This will remove the watchdog on the chain and update the insert
     134     * iterator.  Now the insert operation continues and will insert the new
     135     * watchdog with a delta interval of zero.
     136     */
     137    if ( delta > 0 ) {
     138      --delta;
     139      first->delta_interval = delta;
     140    }
     141
     142    while ( delta == 0 ) {
     143      bool                            run;
     144      Watchdog_Service_routine_entry  routine;
     145      Objects_Id                      id;
     146      void                           *user_data;
     147
     148      run = ( first->state == WATCHDOG_ACTIVE );
     149
     150      _Watchdog_Remove_it( header, first );
     151
     152      routine = first->routine;
     153      id = first->id;
     154      user_data = first->user_data;
     155
     156      _Watchdog_Release( header, &lock_context );
     157
     158      if ( run ) {
     159        (*routine)( id, user_data );
     160      }
     161
     162      _Watchdog_Acquire( header, &lock_context );
     163
     164      if ( _Watchdog_Is_empty( header ) ) {
     165        break;
     166      }
     167
     168      first = _Watchdog_First( header );
     169      delta = first->delta_interval;
     170    }
     171  }
     172
     173  _Watchdog_Release( header, &lock_context );
     174}
Note: See TracChangeset for help on using the changeset viewer.