Mercurial > flash_v2
comparison packages/kernel/current/include/timer.hxx @ 0:3111d98ba7b3 ecos-v1_1-release
Initial commit of eCos version 1.1
| author | jlarmour |
|---|---|
| date | Tue, 11 May 1999 11:16:07 +0000 |
| parents | |
| children | 443894e2e912 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:3111d98ba7b3 |
|---|---|
| 1 #ifndef CYGONCE_KERNEL_TIMER_HXX | |
| 2 #define CYGONCE_KERNEL_TIMER_HXX | |
| 3 | |
| 4 //========================================================================== | |
| 5 // | |
| 6 // timer.hxx | |
| 7 // | |
| 8 // Timer handler class declaration(s) | |
| 9 // | |
| 10 //========================================================================== | |
| 11 //####COPYRIGHTBEGIN#### | |
| 12 // | |
| 13 // ------------------------------------------- | |
| 14 // The contents of this file are subject to the Cygnus eCos Public License | |
| 15 // Version 1.0 (the "License"); you may not use this file except in | |
| 16 // compliance with the License. You may obtain a copy of the License at | |
| 17 // http://sourceware.cygnus.com/ecos | |
| 18 // | |
| 19 // Software distributed under the License is distributed on an "AS IS" | |
| 20 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
| 21 // License for the specific language governing rights and limitations under | |
| 22 // the License. | |
| 23 // | |
| 24 // The Original Code is eCos - Embedded Cygnus Operating System, released | |
| 25 // September 30, 1998. | |
| 26 // | |
| 27 // The Initial Developer of the Original Code is Cygnus. Portions created | |
| 28 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. | |
| 29 // ------------------------------------------- | |
| 30 // | |
| 31 //####COPYRIGHTEND#### | |
| 32 //========================================================================== | |
| 33 //#####DESCRIPTIONBEGIN#### | |
| 34 // | |
| 35 // Author(s): dsm | |
| 36 // Contributors: dsm | |
| 37 // Date: 1998-06-10 | |
| 38 // Purpose: Define Timer class interfaces | |
| 39 // Description: This file defines the Timer class which is derived from | |
| 40 // the Alarm class to support uITRON type functionality | |
| 41 // Usage: #include <cyg/kernel/timer.hxx> | |
| 42 // | |
| 43 //####DESCRIPTIONEND#### | |
| 44 // | |
| 45 //========================================================================== | |
| 46 | |
| 47 #include <cyg/kernel/ktypes.h> | |
| 48 #include <cyg/infra/cyg_ass.h> // assertion macros | |
| 49 #include <cyg/kernel/clock.hxx> // Cyg_Alarm | |
| 50 | |
| 51 // ------------------------------------------------------------------------- | |
| 52 // Timer handler class | |
| 53 | |
| 54 class Cyg_Timer | |
| 55 : public Cyg_Alarm | |
| 56 { | |
| 57 public: | |
| 58 | |
| 59 CYGDBG_DEFINE_CHECK_THIS | |
| 60 | |
| 61 Cyg_Timer(); | |
| 62 | |
| 63 ~Cyg_Timer(); | |
| 64 | |
| 65 enum { | |
| 66 DISABLE = 0, | |
| 67 ENABLE = 1, | |
| 68 RESET = 2, | |
| 69 }; | |
| 70 | |
| 71 void initialize( | |
| 72 Cyg_Counter *counter, | |
| 73 cyg_alarm_fn alarm_fn, | |
| 74 CYG_ADDRWORD data, | |
| 75 cyg_tick_count trigger, // absolute time | |
| 76 cyg_tick_count interval, // 0 => one shot, else repeating | |
| 77 cyg_uint32 action // (DISABLE | ENABLE) | |
| 78 ); | |
| 79 | |
| 80 void activate(cyg_uint32 action); // (DISABLE | ENABLE) [|RESET] | |
| 81 | |
| 82 cyg_tick_count get_trigger(); | |
| 83 cyg_bool is_enabled(); | |
| 84 cyg_bool is_initialized(); | |
| 85 CYG_ADDRWORD get_data(); | |
| 86 }; | |
| 87 | |
| 88 // ------------------------------------------------------------------------- | |
| 89 // Timer inlines | |
| 90 | |
| 91 inline cyg_tick_count | |
| 92 Cyg_Timer::get_trigger() | |
| 93 { | |
| 94 return trigger; | |
| 95 } | |
| 96 | |
| 97 inline cyg_bool | |
| 98 Cyg_Timer::is_initialized() | |
| 99 { | |
| 100 return NULL != counter; | |
| 101 } | |
| 102 | |
| 103 inline cyg_bool | |
| 104 Cyg_Timer::is_enabled() | |
| 105 { | |
| 106 return enabled; | |
| 107 } | |
| 108 | |
| 109 inline CYG_ADDRWORD | |
| 110 Cyg_Timer::get_data() | |
| 111 { | |
| 112 return data; | |
| 113 } | |
| 114 | |
| 115 #endif // ifndef CYGONCE_KERNEL_TIMER_HXX | |
| 116 // EOF timer.hxx |
