ConOpSys V2970  P004.07
ANVILEX control operating system
RTC_STM32F429.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file RTC_STM32F429.h
3 //! @brief STM32F429 on-chip RTC module 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/Targets/STM32F429/RTC_STM32F429.h $
7 //! $Revision: 2944 $
8 //! $Date: 2022-02-26 10:45:42 +0500 (Sa, 26 Feb 2022) $
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 "System_Date.h"
59 #include "Protocol_Base.h"
60 
61 //------------------------------------------------------------------------------
62 // Include ConOpSys application header files
63 //------------------------------------------------------------------------------
64 
65 //------------------------------------------------------------------------------
66 // Class definitions
67 //------------------------------------------------------------------------------
68 
69 //! @brief STM32F429 RTC class
71 {
72 
73  //----------------------------------------------------------------------------
74  // Public defines, methods and variables
75  //----------------------------------------------------------------------------
76 
77  public:
78 
79  //!-------------------------------------------------------------------------
80  //! @brief Class constructor method.
81  //! @note None
82  //! \par Override
83  //! Not allowed
84  //! @attention Don't call this method directly.
85  //--------------------------------------------------------------------------
86 
88 
89  //!-------------------------------------------------------------------------
90  //! @brief Class destructor method.
91  //! @note None
92  //! \par Override
93  //! Not allowed
94  //! @attention Don't call this method directly.
95  //--------------------------------------------------------------------------
96 
98 
99  //!-------------------------------------------------------------------------
100  //! @brief RTC initialisation method.
101  //! @note None
102  //! @return None
103  //! \par Override
104  //! Not allowed
105  //! @attention None
106  //--------------------------------------------------------------------------
107 
108  VOID Init();
109 
110  //!-------------------------------------------------------------------------
111  //! @brief RTC finalisation method.
112  //! @note None
113  //! @return None
114  //! \par Override
115  //! Not allowed
116  //! @attention None
117  //--------------------------------------------------------------------------
118 
119  VOID Done();
120 
121  //!-------------------------------------------------------------------------
122  //! @brief RTC 1ms cyclic processing method.
123  //! @note None
124  //! @return None
125  //! \par Override
126  //! Not allowed
127  //! @attention None
128  //--------------------------------------------------------------------------
129 
130  VOID Execute_1ms();
131 
132  //!-------------------------------------------------------------------------
133  //! @brief RTC background cyclic processing method.
134  //! @note None
135  //! @return None
136  //! \par Override
137  //! Not allowed
138  //! @attention None
139  //--------------------------------------------------------------------------
140 
142 
143  //!-------------------------------------------------------------------------
144  //! @brief Set date time method.
145  //! @note None
146  //! @param [in] object_DateTime - object date struct
147  //! @return None
148  //! \par Override
149  //! Not allowed
150  //! @attention None
151  //--------------------------------------------------------------------------
152 
154 
155  //!-------------------------------------------------------------------------
156  //! @brief Get date time method.
157  //! @note None
158  //! @param [out] object_DateTime - object date struct
159  //! @return None
160  //! \par Override
161  //! Not allowed
162  //! @attention None
163  //--------------------------------------------------------------------------
164 
166 
167  //!-------------------------------------------------------------------------
168  //! @brief Set Hardware RTC method.
169  //! @note None
170  //! @param [in] object_DateTime - object date struct
171  //! @return None
172  //! \par Override
173  //! Not allowed
174  //! @attention None
175  //--------------------------------------------------------------------------
176 
178 
179  //!-------------------------------------------------------------------------
180  //! @brief Get Hardware RTC method.
181  //! @note None
182  //! @param [out] object_DateTime - object date struct
183  //! @return None
184  //! \par Override
185  //! Not allowed
186  //! @attention None
187  //--------------------------------------------------------------------------
188 
190 
191  //!-------------------------------------------------------------------------
192  //! @brief Get Hardware RTC method.
193  //! @note None
194  //! @param [out] object_DateTime - object date struct
195  //! @return None
196  //! \par Override
197  //! Not allowed
198  //! @attention None
199  //--------------------------------------------------------------------------
200 
201  BOOL Get_Hardware_RTC( TDate_Time *object_DateTime );
202 
203  //!-------------------------------------------------------------------------
204  //! @brief Set Software RTC method.
205  //! @note None
206  //! @param [in] object_DateTime - object date struct
207  //! @return None
208  //! \par Override
209  //! Not allowed
210  //! @attention None
211  //--------------------------------------------------------------------------
212 
214 
215  //!-------------------------------------------------------------------------
216  //! @brief Get Software RTC method.
217  //! @note None
218  //! @param [out] object_DateTime - object date struct
219  //! @return None
220  //! \par Override
221  //! Not allowed
222  //! @attention None
223  //--------------------------------------------------------------------------
224 
226 
227  //!-------------------------------------------------------------------------
228  //! @brief Get last system shootdown duration time in miliseconds method.
229  //! @note None
230  //! @return U64 - Last system shootdown duration time in miliseconds
231  //! \par Override
232  //! Not allowed
233  //! @attention None
234  //--------------------------------------------------------------------------
235 
237 
238  //!-------------------------------------------------------------------------
239  //! @brief Get last system shootdown duration time in seconds method.
240  //! @note None
241  //! @return U64 - Last system shootdown duration time in seconds
242  //! \par Override
243  //! Not allowed
244  //! @attention None
245  //--------------------------------------------------------------------------
246 
248 
249  //!-------------------------------------------------------------------------
250  //! @brief Get actual system runtime duration time in miliseconds method.
251  //! @note None
252  //! @return U64 - Actual system runtime duration time in miliseconds
253  //! \par Override
254  //! Not allowed
255  //! @attention None
256  //--------------------------------------------------------------------------
257 
259 
260  //!-------------------------------------------------------------------------
261  //! @brief Method for calculating the amount of time elapsed since the beginning of time (01.01.0001)
262  //! @note None
263  //! @return U64 - Elapsed time since the beginning of time in miliseconds
264  //! \par Override
265  //! Not allowed
266  //! @attention None
267  //--------------------------------------------------------------------------
268 
269  U64 RND( TDate_Time::TDate_Time_Structure *object_DateTime );
270 
271  //!-------------------------------------------------------------------------
272  //! @brief Method for calculating the amount of time elapsed since the beginning of time (01.01.0001)
273  //! @note None
274  //! @return U64 - Elapsed time since the beginning of time in miliseconds
275  //! \par Override
276  //! Not allowed
277  //! @attention None
278  //--------------------------------------------------------------------------
279 
280  U64 RND( U32 y, U32 m, U32 d );
281 
282  //!-------------------------------------------------------------------------
283  //! @brief Synchronise virtual RTC method.
284  //! @note None
285  //! @return None
286  //! \par Override
287  //! Not allowed
288  //! @attention None
289  //--------------------------------------------------------------------------
290 
292 
293  //!-------------------------------------------------------------------------
294  //! @brief Send information about RTC hardware driver over communication link protocol
295  //! @note This method sends information about RTC hardware driver over specified communication link protocol.
296  //! @param [in] *object_Protocol - Pointer to the communication link protocol
297  //! @return None
298  //! \par Override
299  //! Not allowed
300  //! @attention None
301  //--------------------------------------------------------------------------
302 
303  VOID Send_Information( TProtocol_Base *object_Protocol );
304 
305  //----------------------------------------------------------------------------
306  // Protected defines, methods and variables
307  //----------------------------------------------------------------------------
308 
309  protected:
310 
311  //----------------------------------------------------------------------------
312  // Private defines, methods and variables
313  //----------------------------------------------------------------------------
314 
315  private:
316 
317  //!-------------------------------------------------------------------------
318  //! @brief Increment hardware RTC read data ready error counter method.
319  //! @note None
320  //! @return None
321  //! \par Override
322  //! Not allowed
323  //! @attention None
324  //--------------------------------------------------------------------------
325 
327 
328  //!-------------------------------------------------------------------------
329  //! @brief Take runtime date ant time snapshoot method.
330  //! @note None
331  //! @return None
332  //! \par Override
333  //! Not allowed
334  //! @attention None
335  //--------------------------------------------------------------------------
336 
338 
339  //!-------------------------------------------------------------------------
340  //! @brief Recall last runtime date and time snapshoot method.
341  //! @note None
342  //! @return None
343  //! \par Override
344  //! Not allowed
345  //! @attention None
346  //--------------------------------------------------------------------------
347 
349 
350  //!-------------------------------------------------------------------------
351  //! @brief Take system startup date and time snapshoot method.
352  //! @note None
353  //! @return None
354  //! \par Override
355  //! Not allowed
356  //! @attention None
357  //--------------------------------------------------------------------------
358 
360 
361  //!-------------------------------------------------------------------------
362  //! @brief Debug method.
363  //! @note None
364  //! @return None
365  //! \par Override
366  //! Not allowed
367  //! @attention None
368  //--------------------------------------------------------------------------
369 
370  U64 RND();
371 
372  //--------------------------------------------------------------------------
373  // Private variables
374  //--------------------------------------------------------------------------
375 
376  //! @brief Virtual software RTC
378 
379  //! @brief System startup data and time snapshoot
381 
382  //! @brief Last runtime data and time snapshoot
384 
385  //! @brief Actual runtime data and time snapshoot
387 
388  //! @brief Virtual RTC synchronisation request
390 
391  //! @brief Software RTC update locked
393 
394  //! @brief RTC initialisation error flag
396 
397  //! @brief Hardware RTC data lost error flag
399 
400  //! @brief RTC data read ready error counter
402 
403 };
404 
405 //------------------------------------------------------------------------------
406 // End Of File
407 //------------------------------------------------------------------------------
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
Communication protocol base class header file.
System date and time calss implementation.
System date and time class.
Definition: System_Date.h:74
Definition: Protocol_Base.h:57
STM32F429 RTC class.
Definition: RTC_STM32F429.h:71
U64 Get_Last_System_Shootdown_Duration_in_ms()
Get last system shootdown duration time in miliseconds method.
Definition: RTC_STM32F429.cpp:528
TRTC_STM32F429()
Class constructor method.
Definition: RTC_STM32F429.cpp:68
~TRTC_STM32F429()
Class destructor method.
Definition: RTC_STM32F429.cpp:83
BOOL bool_Vitrual_RTC_Sync_Request
Virtual RTC synchronisation request.
Definition: RTC_STM32F429.h:389
VOID Sync_Virtual_RTC()
Synchronise virtual RTC method.
Definition: RTC_STM32F429.cpp:588
U64 Get_Actual_System_Runtime_Duration_in_ms()
Get actual system runtime duration time in miliseconds method.
Definition: RTC_STM32F429.cpp:566
BOOL bool_Software_RTC_Update_Locked
Software RTC update locked.
Definition: RTC_STM32F429.h:392
VOID Take_Startup_Snapshoot()
Take system startup date and time snapshoot method.
Definition: RTC_STM32F429.cpp:849
VOID Get_DateTime(TDate_Time::TDate_Time_Structure *object_DateTime)
Get date time method.
Definition: RTC_STM32F429.cpp:216
BOOL bool_Initialisation_Error
RTC initialisation error flag.
Definition: RTC_STM32F429.h:395
VOID Get_Software_RTC(TDate_Time::TDate_Time_Structure *object_DateTime)
Get Software RTC method.
Definition: RTC_STM32F429.cpp:510
U64 RND()
Debug method.
U64 u64_Actual_Runtime_Snapshoot
Actual runtime data and time snapshoot.
Definition: RTC_STM32F429.h:386
U64 RND(U32 y, U32 m, U32 d)
Method for calculating the amount of time elapsed since the beginning of time (01....
VOID Send_Information(TProtocol_Base *object_Protocol)
Send information about RTC hardware driver over communication link protocol.
Definition: RTC_STM32F429.cpp:666
VOID Execute_Background()
RTC background cyclic processing method.
Definition: RTC_STM32F429.cpp:645
BOOL bool_Hardware_RTC_Data_Lost_Error
Hardware RTC data lost error flag.
Definition: RTC_STM32F429.h:398
BOOL Get_Hardware_RTC(TDate_Time::TDate_Time_Structure *object_DateTime)
Get Hardware RTC method.
Definition: RTC_STM32F429.cpp:309
TDate_Time object_Software_RTC_DateTime
Virtual software RTC.
Definition: RTC_STM32F429.h:377
VOID Recall_Runtime_Snapshoot()
Recall last runtime date and time snapshoot method.
Definition: RTC_STM32F429.cpp:817
VOID Set_Hardware_RTC(TDate_Time::TDate_Time_Structure *object_DateTime)
Set Hardware RTC method.
Definition: RTC_STM32F429.cpp:238
U32 u32_RTC_Data_Read_Ready_Error_Counter
RTC data read ready error counter.
Definition: RTC_STM32F429.h:401
VOID Set_DateTime(TDate_Time::TDate_Time_Structure *object_DateTime)
Set date time method.
Definition: RTC_STM32F429.cpp:201
VOID Increment_RTC_Data_Read_Ready_Error_Counter()
Increment hardware RTC read data ready error counter method.
Definition: RTC_STM32F429.cpp:744
VOID Set_Software_RTC(TDate_Time::TDate_Time_Structure *object_DateTime)
Set Software RTC method.
Definition: RTC_STM32F429.cpp:492
VOID Done()
RTC finalisation method.
Definition: RTC_STM32F429.cpp:190
VOID Take_Runtime_Snapshoot()
Take runtime date ant time snapshoot method.
Definition: RTC_STM32F429.cpp:765
U64 u64_Last_Runtime_Snapshoot
Last runtime data and time snapshoot.
Definition: RTC_STM32F429.h:383
U64 Get_Last_System_Shootdown_Duration_in_s()
Get last system shootdown duration time in seconds method.
Definition: RTC_STM32F429.cpp:551
U64 u64_Startup_Snapshoot
System startup data and time snapshoot.
Definition: RTC_STM32F429.h:380
VOID Init()
RTC initialisation method.
Definition: RTC_STM32F429.cpp:91
VOID Execute_1ms()
RTC 1ms cyclic processing method.
Definition: RTC_STM32F429.cpp:615
Date and time structure.
Definition: System_Date.h:88