Changeset 6d253941 in rtems


Ignore:
Timestamp:
Apr 15, 2015, 2:28:42 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
1ccbd052
Parents:
2903090
git-author:
Sebastian Huber <sebastian.huber@…> (04/15/15 14:28:42)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/19/15 10:00:42)
Message:

score: Add _Watchdog_Acquire|Release|Flash()

Update #2307.

Location:
cpukit/score
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/watchdogimpl.h

    r2903090 r6d253941  
    2222#include <rtems/score/watchdog.h>
    2323#include <rtems/score/chainimpl.h>
     24#include <rtems/score/isrlock.h>
    2425
    2526#ifdef __cplusplus
     
    5051typedef struct {
    5152  /**
     53   * @brief ISR lock to protect this watchdog chain.
     54   */
     55  ISR_LOCK_MEMBER( Lock )
     56
     57  /**
    5258   * @brief The chain of active or transient watchdogs.
    5359   */
     
    8490 */
    8591SCORE_EXTERN Watchdog_Header _Watchdog_Seconds_header;
     92
     93RTEMS_INLINE_ROUTINE void _Watchdog_Acquire(
     94  Watchdog_Header  *header,
     95  ISR_lock_Context *lock_context
     96)
     97{
     98  _ISR_lock_ISR_disable_and_acquire( &header->Lock, lock_context );
     99}
     100
     101RTEMS_INLINE_ROUTINE void _Watchdog_Release(
     102  Watchdog_Header  *header,
     103  ISR_lock_Context *lock_context
     104)
     105{
     106  _ISR_lock_Release_and_ISR_enable( &header->Lock, lock_context );
     107}
     108
     109RTEMS_INLINE_ROUTINE void _Watchdog_Flash(
     110  Watchdog_Header  *header,
     111  ISR_lock_Context *lock_context
     112)
     113{
     114  _ISR_lock_Flash( &header->Lock, lock_context );
     115}
    86116
    87117/**
  • cpukit/score/src/watchdogadjust.c

    r2903090 r6d253941  
    2828)
    2929{
    30   ISR_Level level;
     30  ISR_lock_Context lock_context;
    3131
    32   _ISR_Disable( level );
     32  _Watchdog_Acquire( header, &lock_context );
    3333
    3434  if ( !_Watchdog_Is_empty( header ) ) {
     
    3636  }
    3737
    38   _ISR_Enable( level );
     38  _Watchdog_Release( header, &lock_context );
    3939}
    4040
     
    4444)
    4545{
    46   ISR_Level level;
     46  ISR_lock_Context lock_context;
    4747
    48   _ISR_Disable( level );
     48  _Watchdog_Acquire( header, &lock_context );
    4949
    5050  while ( !_Watchdog_Is_empty( header ) && units > 0 ) {
     
    5858      first->delta_interval = 1;
    5959
    60       _ISR_Enable( level );
     60      _Watchdog_Release( header, &lock_context );
    6161
    6262      _Watchdog_Tickle( header );
    6363
    64       _ISR_Disable( level );
     64      _Watchdog_Acquire( header, &lock_context );
    6565    }
    6666  }
    6767
    68   _ISR_Enable( level );
     68  _Watchdog_Release( header, &lock_context );
    6969}
  • cpukit/score/src/watchdogadjusttochain.c

    r2903090 r6d253941  
    3030{
    3131  Watchdog_Interval  units = units_arg;
    32   ISR_Level          level;
     32  ISR_lock_Context   lock_context;
    3333  Watchdog_Control  *first;
    3434
    35   _ISR_Disable( level );
     35  _Watchdog_Acquire( header, &lock_context );
    3636
    3737  while ( 1 ) {
     
    6161      _Chain_Append_unprotected( to_fire, &first->Node );
    6262
    63       _ISR_Flash( level );
     63      _Watchdog_Flash( header, &lock_context );
    6464
    6565      if ( _Watchdog_Is_empty( header ) )
     
    7171  }
    7272
    73   _ISR_Enable( level );
     73  _Watchdog_Release( header, &lock_context );
    7474}
    7575
  • cpukit/score/src/watchdoginsert.c

    r2903090 r6d253941  
    2828)
    2929{
    30   ISR_Level          level;
     30  ISR_lock_Context   lock_context;
    3131  Watchdog_Control  *after;
    3232  uint32_t           insert_isr_nest_level;
     
    3636  insert_isr_nest_level   = _ISR_Nest_level;
    3737
    38   _ISR_Disable( level );
     38  _Watchdog_Acquire( header, &lock_context );
    3939
    4040  /*
     
    4444
    4545  if ( the_watchdog->state != WATCHDOG_INACTIVE ) {
    46     _ISR_Enable( level );
     46    _Watchdog_Release( header, &lock_context );
    4747    return;
    4848  }
     
    6868     delta_interval -= after->delta_interval;
    6969
    70      _ISR_Flash( level );
     70     _Watchdog_Flash( header, &lock_context );
    7171
    7272     if ( the_watchdog->state != WATCHDOG_BEING_INSERTED ) {
     
    9191  _Watchdog_Sync_level = insert_isr_nest_level;
    9292  _Watchdog_Sync_count--;
    93   _ISR_Enable( level );
     93  _Watchdog_Release( header, &lock_context );
    9494}
  • cpukit/score/src/watchdogremove.c

    r2903090 r6d253941  
    2828)
    2929{
    30   ISR_Level         level;
     30  ISR_lock_Context  lock_context;
    3131  Watchdog_States   previous_state;
    3232  Watchdog_Control *next_watchdog;
    3333
    34   _ISR_Disable( level );
     34  _Watchdog_Acquire( header, &lock_context );
    3535  previous_state = the_watchdog->state;
    3636  switch ( previous_state ) {
     
    6464  the_watchdog->stop_time = _Watchdog_Ticks_since_boot;
    6565
    66   _ISR_Enable( level );
     66  _Watchdog_Release( header, &lock_context );
    6767  return( previous_state );
    6868}
  • cpukit/score/src/watchdogtickle.c

    r2903090 r6d253941  
    2626)
    2727{
    28   ISR_Level level;
     28  ISR_lock_Context  lock_context;
    2929  Watchdog_Control *the_watchdog;
    30   Watchdog_States  watchdog_state;
     30  Watchdog_States   watchdog_state;
    3131
    3232  /*
     
    3636   */
    3737
    38   _ISR_Disable( level );
     38  _Watchdog_Acquire( header, &lock_context );
    3939
    4040  if ( _Watchdog_Is_empty( header ) )
     
    7777     watchdog_state = _Watchdog_Remove( header, the_watchdog );
    7878
    79      _ISR_Enable( level );
     79     _Watchdog_Release( header, &lock_context );
    8080
    8181     switch( watchdog_state ) {
     
    107107     }
    108108
    109      _ISR_Disable( level );
     109     _Watchdog_Acquire( header, &lock_context );
    110110
    111111     the_watchdog = _Watchdog_First( header );
     
    114114
    115115leave:
    116    _ISR_Enable(level);
     116   _Watchdog_Release( header, &lock_context );
    117117}
Note: See TracChangeset for help on using the changeset viewer.