ConOpSys V2970  P004.07
ANVILEX control operating system
High_Precision_Timer_Base.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file High_Precision_Timer_Base.h
3 //! @brief High precision 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/System_Timer_Base.h $
7 //! $Revision: 2759 $
8 //! $Date: 2021-07-02 21:28:53 +0500 (Fr, 02 Jul 2021) $
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 "Timer_Base.h"
59 
60 //------------------------------------------------------------------------------
61 // Class definitions
62 //------------------------------------------------------------------------------
63 
64 //! @brief High precision timer base class
66 {
67 
68  //----------------------------------------------------------------------------
69  // Public defines, methods and variables
70  //----------------------------------------------------------------------------
71 
72  public:
73 /*
74  //!-------------------------------------------------------------------------
75  //! @brief Get actual system time in timer counts as U32.
76  //! @note None
77  //! @param None
78  //! @return U32 - Actual time in timer counts as U32.
79  //! \par Override
80  //! Requered
81  //! @attention None
82  //--------------------------------------------------------------------------
83 
84  virtual U32 Get_Actual_Time() = 0;
85 */
86  //!-------------------------------------------------------------------------
87  //! @brief Get actual system time in timer counts as U64.
88  //! @note None
89  //! @param None
90  //! @return U64 - Actual time in timer counts as U64.
91  //! \par Override
92  //! Requered
93  //! @attention None
94  //--------------------------------------------------------------------------
95 
96  virtual U64 Get_Actual_Time_U64() = 0;
97 
98  //!-------------------------------------------------------------------------
99  //! @brief Perform blocked delay given in s.
100  //! @note None
101  //! @param [in] f32_Delay_Value - Blocked delay time in seconds.
102  //! @return None
103  //! \par Override
104  //! Not allowed
105  //! @attention None
106  //--------------------------------------------------------------------------
107 
108  VOID Delay( F32 f32_Delay_Value );
109 
110  //!-------------------------------------------------------------------------
111  //! @brief Get delta time in seconds.
112  //! @note None
113  //! @param [in] u64_Start_Timestamp - Timer start timestamp.
114  //! @param [in] u64_End_Timestamp - Timer end timestamp.
115  //! @return F32 - Time span in seconds.
116  //! \par Override
117  //! Not allowed
118  //! @attention None
119  //--------------------------------------------------------------------------
120 
121  F32 Get_Delta_Time( U64 u64_Start_Timestamp, U64 u64_End_Timestamp );
122 
123  //!-------------------------------------------------------------------------
124  //! @brief Return statis of the timeout.
125  //! @note This function is not work correctly
126  //! @param [in] u64_Start_Timestamp - Timer start timestamp.
127  //! @param [in] f32_Timeout - Timeout value in seconds.
128  //! @return BOOL - Timeout status
129  //! @retval false - Timeout elapsed
130  //! @retval true - Timeout in progress
131  //! \par Override
132  //! Not allowed
133  //! @attention None
134  //--------------------------------------------------------------------------
135 
136  BOOL Is_Timeout( U64 u64_Start_Timestamp, F32 f32_Timeout );
137 
138  //!-------------------------------------------------------------------------
139  //! @brief High precision timer interrupt method.
140  //! @note None
141  //! @return None
142  //! \par Override
143  //! Not allowed
144  //! @attention None
145  //--------------------------------------------------------------------------
146 
147  VOID Interrupt();
148 
149  //----------------------------------------------------------------------------
150  // Protected defines, methods and variables
151  //----------------------------------------------------------------------------
152 
153  protected:
154 
155  //----------------------------------------------------------------------------
156  // Private defines, methods and variables
157  //----------------------------------------------------------------------------
158 
159  //! @brief Extended counter
161 
162  private:
163 
164  //--------------------------------------------------------------------------
165  // Private variables
166  //--------------------------------------------------------------------------
167 
168 };
169 
170 //------------------------------------------------------------------------------
171 // End of file
172 //------------------------------------------------------------------------------
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
unsigned long long U64
Binary 64-Bit unsigned integer datatype defenition.
Definition: Defines.h:213
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
Timer base class header file.
High precision timer base class.
Definition: High_Precision_Timer_Base.h:66
U32 u32_Extended_Counter
Extended counter.
Definition: High_Precision_Timer_Base.h:160
virtual U64 Get_Actual_Time_U64()=0
Get actual system time in timer counts as U64.
BOOL Is_Timeout(U64 u64_Start_Timestamp, F32 f32_Timeout)
Return statis of the timeout.
Definition: High_Precision_Timer_Base.cpp:121
VOID Delay(F32 f32_Delay_Value)
Perform blocked delay given in s.
Definition: High_Precision_Timer_Base.cpp:64
F32 Get_Delta_Time(U64 u64_Start_Timestamp, U64 u64_End_Timestamp)
Get delta time in seconds.
Definition: High_Precision_Timer_Base.cpp:82
VOID Interrupt()
High precision timer interrupt method.
Definition: High_Precision_Timer_Base.cpp:184
User timer base class.
Definition: Timer_Base.h:66