ConOpSys V2970  P004.07
ANVILEX control operating system
Watchdog_Timer_Base.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file Watchdog_Timer_Base.h
3 //! @brief Watchdog timer base class header file.
4 //! @attention No special attention requered.
5 //! @copyright (C) 2015-2020 ANVILEX LLC
6 //! $HeadURL: https://192.168.3.4:8443/svn/P004_07/ConOpSys/Engine/Watchdog_Timer_Base.h $
7 //! $Revision: 2076 $
8 //! $Date: 2020-09-12 20:30:44 +0500 (Sa, 12 Sep 2020) $
9 //! $Author: minch $
10 //------------------------------------------------------------------------------
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are met:
14 //
15 // 1. Redistributions of source code must retain the above copyright notice,
16 // this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright notice,
19 // this list of conditions and the following disclaimer in the documentation
20 // and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of ANVILEX nor the names of its contributors may be
23 // used to endorse or promote products derived from this software without
24 // specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 // POSSIBILITY OF SUCH DAMAGE.
37 //
38 //------------------------------------------------------------------------------
39 
40 //------------------------------------------------------------------------------
41 // Protecting header files from mutual, recursive inclusion.
42 //------------------------------------------------------------------------------
43 
44 #pragma once
45 
46 //------------------------------------------------------------------------------
47 // Include standard libraries header files
48 //------------------------------------------------------------------------------
49 
50 //------------------------------------------------------------------------------
51 // Include thrid party header files
52 //------------------------------------------------------------------------------
53 
54 //------------------------------------------------------------------------------
55 // Include ConOpSys header files
56 //------------------------------------------------------------------------------
57 
58 #include "Defines.h"
59 
60 //------------------------------------------------------------------------------
61 // Class definitions
62 //------------------------------------------------------------------------------
63 
64 //! @brief System watchdog timer base class
66 {
67 
68  //----------------------------------------------------------------------------
69  // Public defines, methods and variables
70  //----------------------------------------------------------------------------
71 
72  public:
73 
74  //!-------------------------------------------------------------------------
75  //! @brief Class constructor method.
76  //! @note None
77  //! \par Override
78  //! Not allowed
79  //! @attention Don't call this method directly.
80  //--------------------------------------------------------------------------
81 
83 
84  //!-------------------------------------------------------------------------
85  //! @brief Class destructor method.
86  //! @note None
87  //! \par Override
88  //! Not allowed
89  //! @attention Don't call this method directly.
90  //--------------------------------------------------------------------------
91 
92  virtual ~TWatchdog_Timer_Base();
93 
94  //!-------------------------------------------------------------------------
95  //! @brief Initialisation method description.
96  //! @note None
97  //! @return None
98  //! \par Override
99  //! Requered
100  //! @attention None
101  //--------------------------------------------------------------------------
102 
103  VOID Init();
104 
105  //!-------------------------------------------------------------------------
106  //! @brief Finalisation method description.
107  //! @note None
108  //! @return None
109  //! \par Override
110  //! Requered
111  //! @attention None
112  //--------------------------------------------------------------------------
113 
114  VOID Done();
115 
116  //!-------------------------------------------------------------------------
117  //! @brief Watchdog input clock frequency configuration method.
118  //! @note This methods configured input clock frequency of the watchdog timer.
119  //! @param [in] u32_Clock_Frequency - Input clock frequency in Hz
120  //! @return BOOL - Status
121  //! @retval false - Configuration failed
122  //! @retval true - Configuration successed
123  //! \par Override
124  //! Not allowed
125  //! @attention None
126  //--------------------------------------------------------------------------
127 
128  virtual BOOL Configure_Clock( U32 u32_Clock_Frequency );
129 
130  //!-------------------------------------------------------------------------
131  //! @brief Get watchdog timer counter resolution method.
132  //! @note This methods returns watchdog timer counter resolution in seconds.
133  //! @return F32 - Watchdog timer counter resolution in seconds
134  //! \par Override
135  //! Not allowed
136  //! @attention None
137  //--------------------------------------------------------------------------
138 
139  F32 Get_Resolution(); //!< Get timer counter resolution in seconds
140 
141  //!-------------------------------------------------------------------------
142  //! @brief Set watchdog timer period method.
143  //! @note This methods sets watchdog timer period in seconds.
144  //! @param [in] f32_Period - Watchdog timer period in seconds
145  //! @return BOOL - Operation status
146  //! @retval false - Operation failed
147  //! @retval true - Operation successed
148  //! \par Override
149  //! Not allowed
150  //! @attention None
151  //--------------------------------------------------------------------------
152 
154 
155  //!-------------------------------------------------------------------------
156  //! @brief Get watchdog timer period method.
157  //! @note This methods returns watchdog timer period in seconds.
158  //! @return F32 - Watchdog timer period in seconds
159  //! \par Override
160  //! Not allowed
161  //! @attention None
162  //--------------------------------------------------------------------------
163 
164  F32 Get_Period();
165 
166  //!-------------------------------------------------------------------------
167  //! @brief Start watchdog timer counter operation
168  //! @note None
169  //! @return None
170  //! \par Override
171  //! Requered
172  //! @attention None
173  //--------------------------------------------------------------------------
174 
175  virtual VOID Start() = 0;
176 
177  //!-------------------------------------------------------------------------
178  //! @brief Stop watchdog timer counter operation
179  //! @note None
180  //! @return None
181  //! \par Override
182  //! Requered
183  //! @attention None
184  //--------------------------------------------------------------------------
185 
186  virtual VOID Stop() = 0;
187 
188  //!-------------------------------------------------------------------------
189  //! @brief Reset watchdog timer counter
190  //! @note None
191  //! @return None
192  //! \par Override
193  //! Requered
194  //! @attention None
195  //--------------------------------------------------------------------------
196 
197  virtual VOID Reset() = 0;
198 
199  //----------------------------------------------------------------------------
200  // Protected defines, methods and variables
201  //----------------------------------------------------------------------------
202 
203  protected:
204 
205  //! @brief Watchdog timer input frequency in Hz
207 
208  //! @brief Watchdog timer resolution in seconds
210 
211  //! @brief Counts for watchdog timer register initialisation
213 
214  //! @brief Frequency in Hz
216 
217  //! @brief Period in seconds
219 
220  //! @brief Timer configured flag
222 
223  //----------------------------------------------------------------------------
224  // Private defines, methods and variables
225  //----------------------------------------------------------------------------
226 
227  private:
228 
229 };
230 
231 //------------------------------------------------------------------------------
232 // End Of File
233 //------------------------------------------------------------------------------
ConOpSys data type definitions header file.
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned long U32
Binary 32-Bit unsigned integer datatype defenition.
Definition: Defines.h:203
float F32
IEEE-754 32-Bit single presession floating point numbers datatype defenition.
Definition: Defines.h:324
System watchdog timer base class.
Definition: Watchdog_Timer_Base.h:66
virtual BOOL Configure_Clock(U32 u32_Clock_Frequency)
Watchdog input clock frequency configuration method.
Definition: Watchdog_Timer_Base.cpp:102
VOID Init()
Initialisation method description.
Definition: Watchdog_Timer_Base.cpp:86
VOID Done()
Finalisation method description.
Definition: Watchdog_Timer_Base.cpp:94
virtual ~TWatchdog_Timer_Base()
Class destructor method.
Definition: Watchdog_Timer_Base.cpp:78
virtual VOID Reset()=0
Reset watchdog timer counter.
virtual VOID Stop()=0
Stop watchdog timer counter operation.
F32 Get_Resolution()
Get watchdog timer counter resolution method.
Definition: Watchdog_Timer_Base.cpp:211
F32 f32_Resolution
Watchdog timer resolution in seconds.
Definition: Watchdog_Timer_Base.h:209
U32 u32_Timer_Counts
Counts for watchdog timer register initialisation.
Definition: Watchdog_Timer_Base.h:212
F32 f32_Input_Clock_Frequency
Watchdog timer input frequency in Hz.
Definition: Watchdog_Timer_Base.h:206
F32 f32_Frequency
Frequency in Hz.
Definition: Watchdog_Timer_Base.h:215
virtual VOID Start()=0
Start watchdog timer counter operation.
BOOL bool_Timer_Configured
Timer configured flag.
Definition: Watchdog_Timer_Base.h:221
F32 f32_Period
Period in seconds.
Definition: Watchdog_Timer_Base.h:218
F32 Get_Period()
Get watchdog timer period method.
Definition: Watchdog_Timer_Base.cpp:199
BOOL Set_Period(F32 f32_Period)
Set watchdog timer period method.
Definition: Watchdog_Timer_Base.cpp:153
TWatchdog_Timer_Base()
Class constructor method.
Definition: Watchdog_Timer_Base.cpp:62