comparison packages/devs/watchdog/current/src/mn10300.cxx @ 32:5af43b635655 ecos-sw-1999-08-18

Merge from eCos master repository on 1999-08-18-15:20:01-BST
author jlarmour
date Wed, 18 Aug 1999 15:33:44 +0000
parents 306eee292492
children 29bc183297e1
comparison
equal deleted inserted replaced
31:e8319549378c 32:5af43b635655
41 //========================================================================== 41 //==========================================================================
42 42
43 #include <pkgconf/system.h> // system configuration file 43 #include <pkgconf/system.h> // system configuration file
44 #include <pkgconf/watchdog.h> // configuration for this package 44 #include <pkgconf/watchdog.h> // configuration for this package
45 45
46 #if defined(CYG_HAL_MN10300_MN103002) && !defined(CYGIMP_WATCHDOG_EMULATE) 46 #if defined(CYGPKG_HAL_MN10300) && !defined(CYGIMP_WATCHDOG_EMULATE)
47 47
48 #include <pkgconf/kernel.h> // Kernel config 48 #include <pkgconf/kernel.h> // Kernel config
49 49
50 #include <cyg/kernel/ktypes.h> // base kernel types 50 #include <cyg/kernel/ktypes.h> // base kernel types
51 #include <cyg/infra/cyg_trac.h> // tracing macros 51 #include <cyg/infra/cyg_trac.h> // tracing macros
62 #include <cyg/devs/watchdog.hxx> // my header 62 #include <cyg/devs/watchdog.hxx> // my header
63 63
64 // ------------------------------------------------------------------------- 64 // -------------------------------------------------------------------------
65 // MN10300 watchdog timer registers 65 // MN10300 watchdog timer registers
66 66
67 #if defined(CYGPKG_HAL_MN10300_AM31)
68
67 #define WATCHDOG_BASE 0x34004000 69 #define WATCHDOG_BASE 0x34004000
68 #define WATCHDOG_COUNTER (WATCHDOG_BASE) 70 #define WATCHDOG_COUNTER (WATCHDOG_BASE)
69 #define WATCHDOG_CONTROL (WATCHDOG_BASE+2) 71 #define WATCHDOG_CONTROL (WATCHDOG_BASE+2)
70 #define WATCHDOG_RESET (WATCHDOG_BASE+4) 72 #define WATCHDOG_RESET (WATCHDOG_BASE+4)
71 73
72 #define WATCHDOG_WDCK0 0x07 74 #define WATCHDOG_WDCK0 0x07
73 #define WATCHDOG_WDCK0_DEFAULT 0x04 // 1016.801ms cycle 75 #define WATCHDOG_WDCK0_DEFAULT 0x04 // 1016.801ms cycle
74 #define WATCHDOG_WDRST 0x40 76 #define WATCHDOG_WDRST 0x40
75 #define WATCHDOG_WDCNE 0x80 77 #define WATCHDOG_WDCNE 0x80
78
79 #define WATCHDOG_RESOLUTION 1016801000 // cycle time in nanoseconds
80
81 #else
82
83 #error Unsupported MN10300 variant
84
85 #endif
76 86
77 // ------------------------------------------------------------------------- 87 // -------------------------------------------------------------------------
78 // Forward definitions 88 // Forward definitions
79 89
80 static cyg_ISR watchdog_isr; 90 static cyg_ISR watchdog_isr;
96 ); 106 );
97 107
98 // ------------------------------------------------------------------------- 108 // -------------------------------------------------------------------------
99 // Constructor 109 // Constructor
100 110
111
101 Cyg_Watchdog::Cyg_Watchdog() 112 Cyg_Watchdog::Cyg_Watchdog()
102 { 113 {
103 CYG_REPORT_FUNCTION(); 114 CYG_REPORT_FUNCTION();
104 115
105 action_list = 0; 116 action_list = 0;
106 117
107 CYG_REPORT_RETURN(); 118 resolution = WATCHDOG_RESOLUTION;
108 } 119
120 CYG_REPORT_RETURN();
121 }
122
123 // -------------------------------------------------------------------------
124 // Return reset resolution
125
126 cyg_uint64 Cyg_Watchdog::get_resolution()
127 {
128 return resolution;
129 }
130
109 131
110 // ------------------------------------------------------------------------- 132 // -------------------------------------------------------------------------
111 // Start the watchdog running. 133 // Start the watchdog running.
112 134
113 void 135 void
241 void 263 void
242 watchdog_dsr(cyg_vector vector, cyg_ucount32 count, CYG_ADDRWORD data) 264 watchdog_dsr(cyg_vector vector, cyg_ucount32 count, CYG_ADDRWORD data)
243 { 265 {
244 } 266 }
245 267
246 #endif // defined(CYG_HAL_MN10300_MN103002) && 268 #endif // defined(CYGPKG_HAL_MN10300) &&
247 // !defined(CYGIMP_WATCHDOG_EMULATE) 269 // !defined(CYGIMP_WATCHDOG_EMULATE)
248 // ------------------------------------------------------------------------- 270 // -------------------------------------------------------------------------
249 // EOF watchdog/mn10300.cxx 271 // EOF watchdog/mn10300.cxx