Mercurial > ecos
comparison packages/kernel/current/src/common/timer.cxx @ 2:443894e2e912 ecos-v1_2_1-release
Block commit of eCos version 1.2.1
| author | jlarmour |
|---|---|
| date | Tue, 11 May 1999 12:24:34 +0000 |
| parents | 3111d98ba7b3 |
| children | c38311975d4f |
comparison
equal
deleted
inserted
replaced
| 1:72f549f0d891 | 2:443894e2e912 |
|---|---|
| 1 //========================================================================== | 1 //========================================================================== |
| 2 // | 2 // |
| 3 // common/timer.cxx | 3 // common/timer.cxx |
| 4 // | 4 // |
| 5 // Timer class implementations | 5 // Timer class implementations |
| 6 // | 6 // |
| 7 //========================================================================== | 7 //========================================================================== |
| 8 //####COPYRIGHTBEGIN#### | 8 //####COPYRIGHTBEGIN#### |
| 9 // | 9 // |
| 10 // ------------------------------------------- | 10 // ------------------------------------------- |
| 20 // | 20 // |
| 21 // The Original Code is eCos - Embedded Cygnus Operating System, released | 21 // The Original Code is eCos - Embedded Cygnus Operating System, released |
| 22 // September 30, 1998. | 22 // September 30, 1998. |
| 23 // | 23 // |
| 24 // The Initial Developer of the Original Code is Cygnus. Portions created | 24 // The Initial Developer of the Original Code is Cygnus. Portions created |
| 25 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. | 25 // by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved. |
| 26 // ------------------------------------------- | 26 // ------------------------------------------- |
| 27 // | 27 // |
| 28 //####COPYRIGHTEND#### | 28 //####COPYRIGHTEND#### |
| 29 //========================================================================== | 29 //========================================================================== |
| 30 //#####DESCRIPTIONBEGIN#### | 30 //#####DESCRIPTIONBEGIN#### |
| 31 // | 31 // |
| 32 // Author(s): dsm | 32 // Author(s): dsm |
| 33 // Contributors: dsm | 33 // Contributors: dsm |
| 34 // Date: 1998-06-11 | 34 // Date: 1998-06-11 |
| 35 // Purpose: Clock class implementation | 35 // Purpose: Clock class implementation |
| 36 // Description: This file implements the Timer class which is derived from | 36 // Description: This file implements the Timer class which is derived from |
| 37 // the Alarm class to support uITRON type functionality | 37 // the Alarm class to support uITRON type functionality |
| 38 // | 38 // |
| 39 //####DESCRIPTIONEND#### | 39 //####DESCRIPTIONEND#### |
| 40 // | 40 // |
| 41 //========================================================================== | 41 //========================================================================== |
| 93 } | 93 } |
| 94 | 94 |
| 95 void | 95 void |
| 96 Cyg_Timer::activate(cyg_uint32 action) // (DISABLE | ENABLE) [|RESET] | 96 Cyg_Timer::activate(cyg_uint32 action) // (DISABLE | ENABLE) [|RESET] |
| 97 { | 97 { |
| 98 if(!(action & ENABLE)) | 98 // we must also disable the alarm when resetting it so as to remove it |
| 99 disable(); | 99 // from its queue, so that the enable afterwards places it on the right |
| 100 // queue instead of assuming that, being enabled, it's already there. | |
| 101 // (if not enabling, the behaviour is unchanged and correct) | |
| 102 if(!(action & ENABLE) || (action & RESET) ) | |
| 103 disable(); // otherwise, the enable below does nothing... | |
| 100 | 104 |
| 101 if((action & RESET)) | 105 if((action & RESET)) |
| 102 { | 106 { |
| 103 cyg_tick_count t; | 107 cyg_tick_count t; |
| 104 t = counter->current_value(); | 108 t = counter->current_value(); |
| 105 trigger = t + interval; | 109 trigger = t + interval; |
| 106 } | 110 } |
| 107 | 111 |
| 108 if((action & ENABLE)) { | 112 if((action & ENABLE)) { |
| 109 enable(); | 113 enable(); // ...when it should put the timer on a new queue. |
| 110 } | 114 } |
| 111 } | 115 } |
| 112 | 116 |
| 113 // ------------------------------------------------------------------------- | 117 // ------------------------------------------------------------------------- |
| 114 // EOF common/timer.cxx | 118 // EOF common/timer.cxx |
