ConOpSys V2970  P004.07
ANVILEX control operating system
CPU_STM32F429.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file CPU_STM32F429.h
3 //! @brief STM32F429 CPU 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/CPU_STM32F429.h $
7 //! $Revision: 2825 $
8 //! $Date: 2021-07-27 20:32:20 +0500 (Di, 27 Jul 2021) $
9 //! $Author: ggavrituhin $
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 #pragma once
41 
42 //------------------------------------------------------------------------------
43 // Include standard libraries header files
44 //------------------------------------------------------------------------------
45 
46 //------------------------------------------------------------------------------
47 // Include thrid party header files
48 //------------------------------------------------------------------------------
49 
50 //------------------------------------------------------------------------------
51 // Include ConOpSys header files
52 //------------------------------------------------------------------------------
53 
54 #include "CPU_Base.h"
55 
56 //------------------------------------------------------------------------------
57 // Include ConOpSys application header files
58 //------------------------------------------------------------------------------
59 
60 //! @todo ANVILEX KM: Cleanup code.
61 //#include "Application_Task_Base.h"
62 
63 //------------------------------------------------------------------------------
64 // Class definitions
65 //------------------------------------------------------------------------------
66 
67 //! @brief STM32F429 CPU hardware class
69 {
70 
71  //----------------------------------------------------------------------------
72  // Public defines, methods and variables
73  //----------------------------------------------------------------------------
74 
75  public:
76 
77  //!-------------------------------------------------------------------------
78  //! @brief STM32F429 CPU class constructor method.
79  //! @note None
80  //! \par Override
81  //! Not allowed
82  //! @attention Don't call this method directly.
83  //--------------------------------------------------------------------------
84 
86 
87  //!-------------------------------------------------------------------------
88  //! @brief STM32F429 CPU class destructor method.
89  //! @note None
90  //! \par Override
91  //! Not allowed
92  //! @attention Don't call this method directly.
93  //--------------------------------------------------------------------------
94 
95  virtual ~TCPU_STM32F429();
96 
97  //!-------------------------------------------------------------------------
98  //! @brief CPU object initialisation method.
99  //! @note None
100  //! @return None
101  //! \par Override
102  //! Not allowed
103  //! @attention None
104  //--------------------------------------------------------------------------
105 
106  virtual VOID Init();
107 
108  //!-------------------------------------------------------------------------
109  //! @brief CPU object finalisation method.
110  //! @note None
111  //! @return None
112  //! \par Override
113  //! Not allowed
114  //! @attention None
115  //--------------------------------------------------------------------------
116 
117  virtual VOID Done();
118 
119  //!-------------------------------------------------------------------------
120  //! @brief Return reset source of CPU method.
121  //! @note None
122  //! @return TReset_Source - Type og the CPU reset
123  //! \par Override
124  //! Not allowed
125  //! @attention None
126  //--------------------------------------------------------------------------
127 
129 
130  //!-------------------------------------------------------------------------
131  //! @brief Return CPU reset source register method.
132  //! @note None
133  //! @return U32 - Reset source register
134  //! \par Override
135  //! Not allowed
136  //! @attention None
137  //--------------------------------------------------------------------------
138 
140 
141  //!-------------------------------------------------------------------------
142  //! @brief Return CPU device ID method.
143  //! @note None
144  //! @return U32 - CPU device ID
145  //! \par Override
146  //! Not allowed
147  //! @attention None
148  //--------------------------------------------------------------------------
149 
151 
152  //!-------------------------------------------------------------------------
153  //! @brief Return CPU revision ID method.
154  //! @note None
155  //! @return U32 - CPU revision ID
156  //! \par Override
157  //! Not allowed
158  //! @attention None
159  //--------------------------------------------------------------------------
160 
162 
163  //!-------------------------------------------------------------------------
164  //! @brief Return unique CPU ID method.
165  //! @note None
166  //! @return U32 - Unique CPU ID
167  //! \par Override
168  //! Not allowed
169  //! @attention None
170  //--------------------------------------------------------------------------
171 
172  U32 Get_CPU_Unique_Device_ID( U32 u32_Index );
173 
174  //!-------------------------------------------------------------------------
175  //! @brief Return CPU FLASH memory size method.
176  //! @note None
177  //! @return U32 - CPU FLASH memory size in bytes
178  //! \par Override
179  //! Not allowed
180  //! @attention None
181  //--------------------------------------------------------------------------
182 
184 
185  //!-------------------------------------------------------------------------
186  //! @brief Return CPU RAM size method.
187  //! @note None
188  //! @return U32 - CPU RAM size in bytes
189  //! \par Override
190  //! Not allowed
191  //! @attention None
192  //--------------------------------------------------------------------------
193 
195 
196  //!-------------------------------------------------------------------------
197  //! @brief Return executable image base address method.
198  //! @note None
199  //! @return U32 - Executable image base address
200  //! \par Override
201  //! Not allowed
202  //! @attention None
203  //--------------------------------------------------------------------------
204 
206 
207  //!-------------------------------------------------------------------------
208  //! @brief Return executable image end address method.
209  //! @note None
210  //! @return U32 - Executable image end address
211  //! \par Override
212  //! Not allowed
213  //! @attention None
214  //--------------------------------------------------------------------------
215 
216  U32 Get_Image_End();
217 
218  //!-------------------------------------------------------------------------
219  //! @brief Return executable image size method.
220  //! @note None
221  //! @return U32 - Executable image size in byts
222  //! \par Override
223  //! Not allowed
224  //! @attention None
225  //--------------------------------------------------------------------------
226 
228 
229  //!-------------------------------------------------------------------------
230  //! @brief Return executable image hash method.
231  //! @note None
232  //! @return U32 - Executable image hash in byts
233  //! \par Override
234  //! Not allowed
235  //! @attention None
236  //--------------------------------------------------------------------------
237 
239 
240  //!-------------------------------------------------------------------------
241  //! @brief Calculate executable image hash method.
242  //! @note None
243  //! @return U32 - Executable image hash value
244  //! \par Override
245  //! Not allowed
246  //! @attention None
247  //--------------------------------------------------------------------------
248 
250 
251  //!-------------------------------------------------------------------------
252  //! @brief Return CPU heap base address method.
253  //! @note None
254  //! @return U32 - CPU heap base address
255  //! \par Override
256  //! Not allowed
257  //! @attention None
258  //--------------------------------------------------------------------------
259 
261 
262  //!-------------------------------------------------------------------------
263  //! @brief Return CPU heap size method.
264  //! @note None
265  //! @return U32 - CPU heap size in bytes
266  //! \par Override
267  //! Not allowed
268  //! @attention None
269  //--------------------------------------------------------------------------
270 
272 
273  //!-------------------------------------------------------------------------
274  //! @brief Update core clock value method.
275  //! @note None
276  //! @return U32 - CPU heap size
277  //! \par Override
278  //! Not allowed
279  //! @attention None
280  //--------------------------------------------------------------------------
281 
283 
284  //!-------------------------------------------------------------------------
285  //! @brief Return SYSCLK frequency method.
286  //! @note None
287  //! @return U32 - SYSCLK frequency
288  //! \par Override
289  //! Not allowed
290  //! @attention None
291  //--------------------------------------------------------------------------
292 
294 
295  //!-------------------------------------------------------------------------
296  //! @brief Return HCLK frequency method.
297  //! @note Each time HCLK changes, this function must be called to update the
298  // right HCLK value. Otherwise, any configuration based on this function will be incorrect.
299  //! @return U32 - HCLK frequency
300  //! \par Override
301  //! Not allowed
302  //! @attention None
303  //--------------------------------------------------------------------------
304 
306 
307  //!-------------------------------------------------------------------------
308  //! @brief Return PCLK1 frequency method.
309  //! @note Each time PCLK1 changes, this function must be called to update the
310  //! right PCLK1 value. Otherwise, any configuration based on this function will be incorrect.
311  //! @return U32 - PCLK1 frequency
312  //! \par Override
313  //! Not allowed
314  //! @attention None
315  //--------------------------------------------------------------------------
316 
318 
319  //!-------------------------------------------------------------------------
320  //! @brief Return PCLK2 frequency method.
321  //! @note Each time PCLK2 changes, this function must be called to update the
322  //! right PCLK2 value. Otherwise, any configuration based on this function will be incorrect.
323  //! @return U32 - PCLK2 frequency
324  //! \par Override
325  //! Not allowed
326  //! @attention None
327  //--------------------------------------------------------------------------
328 
330 
331  //!-------------------------------------------------------------------------
332  //! @brief Return TCLK1 frequency method.
333  //! @note Each time PCLK1 changes, this function must be called to update the
334  //! right TCLK1 value. Otherwise, any configuration based on this function will be incorrect.
335  //! @return U32 - TCLK1 frequency
336  //! \par Override
337  //! Not allowed
338  //! @attention None
339  //--------------------------------------------------------------------------
340 
342 
343  //!-------------------------------------------------------------------------
344  //! @brief Return TCLK2 frequency method.
345  //! @note None
346  //! @return U32 - TCLK2 frequency
347  //! \par Override
348  //! Not allowed
349  //! @attention None
350  //--------------------------------------------------------------------------
351 
353 
354  //!-------------------------------------------------------------------------
355  //! @brief Return IWDG frequency method.
356  //! @note Each time PCLK2 changes, this function must be called to update the
357  //! right TCLK2 value. Otherwise, any configuration based on this function will be incorrect.
358  //! @return U32 - IWDG frequency
359  //! \par Override
360  //! Not allowed
361  //! @attention None
362  //--------------------------------------------------------------------------
363 
365 
366  //----------------------------------------------------------------------------
367  // Protected defines, methods and variables
368  //----------------------------------------------------------------------------
369 
370  protected:
371 
372  //----------------------------------------------------------------------------
373  // Private defines, methods and variables
374  //----------------------------------------------------------------------------
375 
376  private:
377 
378  //--------------------------------------------------------------------------
379  // Private variables
380  //--------------------------------------------------------------------------
381 
382  //! @brief System CPU core clock frequency in Hz
383  U32 u32_SYSCLK = (U32)0x00000000;
384 
385  //! @brief System HCLK bus clock frequency in Hz
386  U32 u32_HCLK = (U32)0x00000000;
387 
388  //! @brief System PCLK1 bus clock frequency in Hz
389  U32 u32_PCLK1 = (U32)0x00000000;
390 
391  //! @brief System PCLK2 bus clock frequency in Hz
392  U32 u32_PCLK2 = (U32)0x00000000;
393 
394  //! @brief System TCLK1 bus clock frequency in Hz
395  U32 u32_TCLK1 = (U32)0x00000000;
396 
397  //! @brief System TCLK2 bus clock frequency in Hz
398  U32 u32_TCLK2 = (U32)0x00000000;
399 
400  //! @brief System IWDG bus clock frequency in Hz
401  U32 u32_IWDG = (U32)0x00000000;
402 
403  //! @brief Application executable image hash value
405 
406 };
407 
408 //------------------------------------------------------------------------------
409 // End of file
410 //------------------------------------------------------------------------------
CPU base class header file.
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned long U32
Binary 32-Bit unsigned integer datatype defenition.
Definition: Defines.h:203
CPU base class.
Definition: CPU_Base.h:74
TReset_Source
CPU reset sources enumeration.
Definition: CPU_Base.h:88
STM32F429 CPU hardware class.
Definition: CPU_STM32F429.h:69
virtual ~TCPU_STM32F429()
STM32F429 CPU class destructor method.
Definition: CPU_STM32F429.cpp:94
U32 Get_SYSCLK_Frequency()
Return SYSCLK frequency method.
Definition: CPU_STM32F429.cpp:302
U32 Get_TCLK2_Frequency()
Return TCLK2 frequency method.
Definition: CPU_STM32F429.cpp:362
U32 Get_PCLK2_Frequency()
Return PCLK2 frequency method.
Definition: CPU_STM32F429.cpp:338
VOID System_Core_Clock_Update()
Update core clock value method.
Definition: CPU_STM32F429.cpp:125
U32 Get_Image_Size()
Return executable image size method.
Definition: CPU_STM32F429.cpp:528
U32 Get_CPU_Flash_Size()
Return CPU FLASH memory size method.
Definition: CPU_STM32F429.cpp:463
U32 Get_Image_Hash()
Return executable image hash method.
Definition: CPU_STM32F429.cpp:557
TReset_Source Get_Reset_Source()
Return reset source of CPU method.
Definition: CPU_STM32F429.cpp:401
U32 Get_TCLK1_Frequency()
Return TCLK1 frequency method.
Definition: CPU_STM32F429.cpp:350
U32 u32_TCLK1
System TCLK1 bus clock frequency in Hz.
Definition: CPU_STM32F429.h:395
U32 Get_CPU_Heap_Size()
Return CPU heap size method.
U32 Get_CPU_Reset_Source()
Return CPU reset source register method.
Definition: CPU_STM32F429.cpp:386
virtual VOID Init()
CPU object initialisation method.
Definition: CPU_STM32F429.cpp:102
U32 u32_IWDG
System IWDG bus clock frequency in Hz.
Definition: CPU_STM32F429.h:401
U32 Get_IWDG_Frequency()
Return IWDG frequency method.
Definition: CPU_STM32F429.cpp:374
U32 u32_PCLK2
System PCLK2 bus clock frequency in Hz.
Definition: CPU_STM32F429.h:392
U32 u32_SYSCLK
System CPU core clock frequency in Hz.
Definition: CPU_STM32F429.h:383
U32 Get_CPU_Heap_Base()
Return CPU heap base address method.
U32 Get_PCLK1_Frequency()
Return PCLK1 frequency method.
Definition: CPU_STM32F429.cpp:326
U32 u32_HCLK
System HCLK bus clock frequency in Hz.
Definition: CPU_STM32F429.h:386
U32 Get_CPU_Device_ID()
Return CPU device ID method.
Definition: CPU_STM32F429.cpp:415
U32 Get_CPU_RAM_Size()
Return CPU RAM size method.
Definition: CPU_STM32F429.cpp:478
virtual VOID Done()
CPU object finalisation method.
Definition: CPU_STM32F429.cpp:117
U32 Get_Image_Base()
Return executable image base address method.
Definition: CPU_STM32F429.cpp:493
U32 u32_PCLK1
System PCLK1 bus clock frequency in Hz.
Definition: CPU_STM32F429.h:389
U32 Get_CPU_Unique_Device_ID(U32 u32_Index)
Return unique CPU ID method.
Definition: CPU_STM32F429.cpp:445
U32 Get_CPU_Revision()
Return CPU revision ID method.
Definition: CPU_STM32F429.cpp:430
U32 u32_Application_Image_Hash
Application executable image hash value.
Definition: CPU_STM32F429.h:404
TCPU_STM32F429()
STM32F429 CPU class constructor method.
Definition: CPU_STM32F429.cpp:82
U32 u32_TCLK2
System TCLK2 bus clock frequency in Hz.
Definition: CPU_STM32F429.h:398
U32 Calculate_Image_Hash()
Calculate executable image hash method.
Definition: CPU_STM32F429.cpp:569
U32 Get_Image_End()
Return executable image end address method.
Definition: CPU_STM32F429.cpp:509
U32 Get_HCLK_Frequency()
Return HCLK frequency method.
Definition: CPU_STM32F429.cpp:314