\doxysection{trace.\+h}
\hypertarget{trace_8h_source}{}\label{trace_8h_source}\index{E:/.WORK/STM32/STM\_Libs/STM32\_ExtendedLibs/MyLibs/Inc/trace.h@{E:/.WORK/STM32/STM\_Libs/STM32\_ExtendedLibs/MyLibs/Inc/trace.h}}
\mbox{\hyperlink{trace_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00001}00001\ \textcolor{comment}{/**\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00002}00002\ \textcolor{comment}{**************************************************************************}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00003}00003\ \textcolor{comment}{*\ @file\ trace.h}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00004}00004\ \textcolor{comment}{*\ @brief\ Заголочный\ файл\ для\ работы\ с\ трассировкой.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00005}00005\ \textcolor{comment}{**************************************************************************}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00006}00006\ \textcolor{comment}{*\ @addtogroup\ \ \ TRACE\ \ \ \ \ \ \ \ \ \ \ Trace\ defines}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00007}00007\ \textcolor{comment}{*\ @brief\ \ \ \ \ \ \ \ Дефайны\ для\ работы\ с\ трассировкой}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00008}00008\ \textcolor{comment}{*************************************************************************/}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00009}00009\ \textcolor{preprocessor}{\#ifndef\ \_\_TRACE\_H\_}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00010}00010\ \textcolor{preprocessor}{\#define\ \_\_TRACE\_H\_}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00011}00011\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{mylibs__defs_8h}{mylibs\_defs.h}}"{}}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00012}00012\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00013}00013\ \textcolor{preprocessor}{\#include\ <string.h>}\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00014}00014\ \textcolor{comment}{/**\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00015}00015\ \textcolor{comment}{\ \ *\ @addtogroup\ TRACE\_SERIAL\ \ \ \ Serial\ trace\ defines}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00016}00016\ \textcolor{comment}{\ \ *\ @ingroup\ \ \ \ TRACE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00017}00017\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ \ \ Дефайны\ для\ работы\ с\ serial\ трассировкой\ (SWO,\ RTT)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00018}00018\ \textcolor{comment}{\ \ *\ @details\ \ \ \ В\ зависимости\ от\ настроек\ определяется\ дефайн\ @ref\ my\_printf()\ и\ @ref\ log\_printf()\ для\ работы\ с\ трассировкой:}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00019}00019\ \textcolor{comment}{\ \ \ \ -\/\ @ref\ SERIAL\_TRACE\_ENABLE\ -\/\ Если\ трассировка\ \ отключена,\ то\ все\ дефайны\ определяются\ как\ 'ничего'\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00020}00020\ \textcolor{comment}{\ \ \ \ \ \ и\ на\ производительность\ кода\ не\ влияют}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00021}00021\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00022}00022\ \textcolor{comment}{\ \ \ \ -\/\ @ref\ RTT\_TRACE\_ENABLE\ -\/\ для\ RTT\ это\ будет\ вызов\ функции\ SEGGER\_RTT\_printf()}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00023}00023\ \textcolor{comment}{\ \ \ \ \ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00024}00024\ \textcolor{comment}{\ \ \ \ \ \ Предварительно\ надо\ подключить\ библиотеку\ SEGGER\ RTT\ (SEGGER\_RTT.h)\ и\ вызвать\ функцию\ SEGGER\_RTT\_Init()}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00025}00025\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00026}00026\ \textcolor{comment}{\ \ \ \ -\/\ @ref\ SWO\_TRACE\_ENABLE\ для\ SWO\ это\ будет\ просто\ printf()}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00027}00027\ \textcolor{comment}{\ \ \ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00028}00028\ \textcolor{comment}{\ \ \ \ \ \ Предварительно\ надо\ подключить\ библиотеку\ STDOUT\ и\ retarget\ под\ ITM:}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00029}00029\ \textcolor{comment}{\ \ \ \ \ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00030}00030\ \textcolor{comment}{\ \ \ \ \ \ @verbatim}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00031}00031\ \textcolor{comment}{\ \ \ \ \ \ \ \ Manage\ Run-\/Time\ Environment\ -\/>\ Compiler\ -\/>\ I/O\ -\/>\ STDOUT\ -\/>\ ITM}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00032}00032\ \textcolor{comment}{\ \ \ \ \ \ @endverbatim}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00033}00033\ \textcolor{comment}{\ \ \ \ \ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00034}00034\ \textcolor{comment}{\ \ \ \ \ \ Для\ SWO\ также\ надо\ включить\ трассировку:\ \ \ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00035}00035\ \textcolor{comment}{\ \ \ \ \ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00036}00036\ \textcolor{comment}{\ \ \ \ \ \ @verbatim}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00037}00037\ \textcolor{comment}{\ \ \ \ \ \ \ \ Options\ For\ Target\ -\/>\ Debug\ -\/>\ Debugger\ Settings}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00038}00038\ \textcolor{comment}{\ \ \ \ \ \ @endverbatim}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00039}00039\ \textcolor{comment}{\ \ \ \ \ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00040}00040\ \textcolor{comment}{\ \ \ \ \ \ В\ вкладке\ Debug:\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00041}00041\ \textcolor{comment}{\ \ \ \ \ \ \ \ -\/\ Port\ =\ SW}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00042}00042\ \textcolor{comment}{\ \ \ \ \ \ В\ вкладке\ Trace:\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00043}00043\ \textcolor{comment}{\ \ \ \ \ \ \ \ -\/\ Указать\ Core\ Clock}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00044}00044\ \textcolor{comment}{\ \ \ \ \ \ \ \ -\/\ Выставить\ Trace\ Port\ =\ SWO}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00045}00045\ \textcolor{comment}{\ \ \ \ \ \ \ \ -\/\ ITM\ -\/\ выбрать\ нужный\ порт\ (для\ Keil\ нулевой\ порт)\ \ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00046}00046\ \textcolor{comment}{\ \ \ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00047}00047\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00048}00048\ \textcolor{comment}{\ \ *\ @\{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00049}00049\ \textcolor{comment}{\ \ *}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00050}00050\ \textcolor{comment}{\ \ *\ @def\ my\_printf(...)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00051}00051\ \textcolor{comment}{\ \ *\ @brief\ Универсальный\ макрос\ для\ вывода\ трассировки}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00052}00052\ \textcolor{comment}{\ \ *\ @details\ Варианты\ реализации:}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00053}00053\ \textcolor{comment}{\ \ *\ \ -\/\ RTT\_TRACE\_ENABLE\ \ \ \ \`{}SEGGER\_RTT\_printf(0,\ ...)`}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00054}00054\ \textcolor{comment}{\ \ *\ \ -\/\ SWO\_TRACE\_ENABLE\ -\/\ \`{}printf(...)`}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00055}00055\ \textcolor{comment}{\ \ *\ \ -\/\ NO\_TRACE\ -\/\ пустой\ макрос}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00056}00056\ \textcolor{comment}{\ \ *}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00057}00057\ \textcolor{comment}{\ \ *\ @def\ log\_printf(TAG,\ fmt,\ ...)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00058}00058\ \textcolor{comment}{\ \ *\ @brief\ Макрос\ логирования\ с\ поддержкой\ уровней\ @ref\ LOG\_LEVEL}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00059}00059\ \textcolor{comment}{\ \ *\ @param\ TAG\ \ Тэг\ лога}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00060}00060\ \textcolor{comment}{\ \ *\ @param\ fmt,\ ...\ \ Форматируемая\ строка}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00061}00061\ \textcolor{comment}{\ \ *\ @details\ Варианты\ реализации:}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00062}00062\ \textcolor{comment}{\ \ *\ \ -\/\ @ref\ LOG\_LEVEL\ ==\ 0\ -\/\ логирование\ отключено\ (макрос\ пустой)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00063}00063\ \textcolor{comment}{\ \ *\ \ -\/\ @ref\ LOG\_LEVEL\ ==\ 1\ -\/\ выводится\ время\ @ref\ local\_time\ и\ TAG}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00064}00064\ \textcolor{comment}{\ \ *\ @code}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00065}00065\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ [123]\ [ADC]\ Measure\ Done}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00066}00066\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ [456]\ [ADC]\ Measure\ Err}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00067}00067\ \textcolor{comment}{\ \ *\ @endcode}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00068}00068\ \textcolor{comment}{\ \ *\ \ -\/\ @ref\ LOG\_LEVEL\ >=\ 2\ -\/\ выводится\ время,\ TAG,\ имя\ файла\ и\ номер\ строки}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00069}00069\ \textcolor{comment}{\ \ *\ @code}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00070}00070\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ [123]\ [ADC]\ (../Core/Src/adc.c:75)\ Measure\ Done}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00071}00071\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ [456]\ [ADC]\ (../Core/Src/adc.c:80)\ Measure\ Err}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00072}00072\ \textcolor{comment}{\ \ *\ @endcode}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00073}00073\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00074}00074\ \textcolor{preprocessor}{\#ifdef\ SERIAL\_TRACE\_ENABLE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00075}00075\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00076}00076\ \textcolor{preprocessor}{\ \ \#if\ defined(RTT\_TRACE\_ENABLE)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00077}00077\ \textcolor{preprocessor}{\ \ \ \ \#undef\ SWO\_TRACE\_ENABLE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00078}00078\ \textcolor{preprocessor}{\ \ \ \ \#include\ "{}SEGGER\_RTT.h"{}}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00079}\mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{00079}}\ \textcolor{preprocessor}{\ \ \ \ \#define\ my\_printf(...)\ \ \ \ \ \ \ \ SEGGER\_RTT\_printf(0,\ \_\_VA\_ARGS\_\_)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00080}00080\ \textcolor{preprocessor}{\ \ \#elif\ defined(SWO\_TRACE\_ENABLE)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00081}00081\ \textcolor{preprocessor}{\ \ \ \ \#undef\ RTT\_TRACE\_ENABLE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00082}00082\ \textcolor{preprocessor}{\ \ \ \ \#define\ my\_printf(...)\ \ \ \ \ \ \ \ printf(\_\_VA\_ARGS\_\_)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00083}00083\ \textcolor{preprocessor}{\ \ \#else\ }\textcolor{comment}{//\ NO\_TRACE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00084}00084\ \textcolor{preprocessor}{\ \ \ \ \#define\ my\_printf(...)\ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00085}00085\ \textcolor{preprocessor}{\ \ \ \ \#warning\ No\ trace\ is\ selected.\ Serial\ debug\ wont\ work.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00086}00086\ \textcolor{preprocessor}{\ \ \#endif\ }\textcolor{comment}{//\ RTT\_TRACE\_ENABLE/SWO\_TRACE\_ENABLE/NO\_TRACE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00087}00087\ \textcolor{preprocessor}{\#else\ }\textcolor{comment}{//SERIAL\_TRACE\_ENABLE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00088}00088\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00089}00089\ \textcolor{preprocessor}{\ \ \#define\ my\_printf(...)\ \ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00090}00090\ \textcolor{preprocessor}{\ \ \#undef\ RTT\_TRACE\_ENABLE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00091}00091\ \textcolor{preprocessor}{\ \ \#undef\ SWO\_TRACE\_ENABLE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00092}00092\ \ \ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00093}00093\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//SERIAL\_TRACE\_ENABLE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00094}00094\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00095}00095\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00096}00096\ \textcolor{preprocessor}{\#ifndef\ local\_time}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00097}\mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_ga9c853b02c22f26023c34d1d404b6d653}{00097}}\ \textcolor{preprocessor}{\#define\ local\_time()\ \ HAL\_GetTick()\ }\textcolor{comment}{///<\ Локальное\ время}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00098}00098\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00099}00099\ \textcolor{preprocessor}{\#ifndef\ LOG\_LEVEL}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00100}\mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_ga0b87e0d3bf5853bcbb0b66a7c48fdc05}{00100}}\ \textcolor{preprocessor}{\#define\ LOG\_LEVEL\ 1\ \ }\textcolor{comment}{///<\ @brief\ Уровень\ логирования\ (по\ умолчанию\ ==\ 1)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00101}00101\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00102}00102\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00103}00103\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00104}00104\ \textcolor{preprocessor}{\#if\ LOG\_LEVEL\ ==\ 0\ }\textcolor{comment}{//\ лог\ отключен}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00105}00105\ \textcolor{preprocessor}{\ \ \ \ \#define\ \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00106}\mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_ga730fb7b8d0bbb348dca73c15bd0e0b26}{00106}}\ \textcolor{preprocessor}{log\_printf(TAG,\ fmt,\ ...)\ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00107}00107\ \textcolor{preprocessor}{\#elif\ LOG\_LEVEL\ ==\ 1\ }\textcolor{comment}{//\ только\ тэг}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00108}00108\ \textcolor{preprocessor}{\ \ \ \ \#define\ log\_printf(TAG,\ fmt,\ ...)\ \ \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00109}00109\ \textcolor{preprocessor}{my\_printf("{}\(\backslash\)n[\%lu]\ [\%s]\ "{}\ fmt,\ \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00110}00110\ \textcolor{preprocessor}{(unsigned\ long)local\_time(),\ TAG,\ \#\#\_\_VA\_ARGS\_\_)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00111}00111\ \textcolor{preprocessor}{\#elif\ LOG\_LEVEL\ >=\ 2\ }\textcolor{comment}{//\ всё}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00112}00112\ \textcolor{preprocessor}{\ \ \ \ \#define\ log\_printf(TAG,\ fmt,\ ...)\ \ \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00113}00113\ \textcolor{preprocessor}{my\_printf("{}\(\backslash\)n[\%lu]\ [\%s]\ (\%s:\%d)\ "{}\ fmt,\ \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00114}00114\ \textcolor{preprocessor}{(unsigned\ long)local\_time(),\ TAG,\ \_\_FILE\_\_,\ \_\_LINE\_\_,\ \#\#\_\_VA\_ARGS\_\_)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00115}00115\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00116}00116\ \ \ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00117}00117\ \textcolor{comment}{/**\ TRACE\_SERIAL}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00118}00118\ \textcolor{comment}{\ \ *\ @\}}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00119}00119\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00120}00120\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00121}00121\ \textcolor{comment}{/**\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00122}00122\ \textcolor{comment}{\ \ *\ @addtogroup\ TRACE\_GPIO\ \ \ \ GPIO\ trace\ defines}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00123}00123\ \textcolor{comment}{\ \ *\ @ingroup\ \ \ \ TRACE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00124}00124\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ \ \ Дефайны\ для\ работы\ с\ GPIO\ трассировкой}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00125}00125\ \textcolor{comment}{\ \ *\ @details\ \ \ \ Определяется\ дефайны\ для\ работы\ с\ GPIO\ трассировкой:}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00126}00126\ \textcolor{comment}{\ \ \ \ -\/\ TRACE\_GPIO\_RESET()\ -\/\ для\ сброса\ ножки\ GPIO\ (через\ BSRR)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00127}00127\ \textcolor{comment}{\ \ \ \ -\/\ TRACE\_GPIO\_SET()\ -\/\ для\ выставления\ ножки\ GPIO\ (через\ BSRR)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00128}00128\ \textcolor{comment}{\ \ \ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00129}00129\ \textcolor{comment}{\ \ \ \ -\/\ Если\ трассировка\ @ref\ GPIO\_TRACE\_ENABLE\ отключена,\ то\ все\ дефайны\ определяются\ как\ 'ничего'\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00130}00130\ \textcolor{comment}{\ \ \ \ \ \ и\ на\ производительность\ кода\ не\ влияют}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00131}00131\ \textcolor{comment}{\ \ *\ @\{\ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00132}00132\ \textcolor{comment}{\ \ *}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00133}00133\ \textcolor{comment}{\ \ *\ @def\ TRACE\_GPIO\_RESET(\_gpio\_,\ \_pin\_)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00134}00134\ \textcolor{comment}{\ \ *\ @brief\ Сбросить\ указанную\ ножку\ GPIO}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00135}00135\ \textcolor{comment}{\ \ *\ @param\ \_gpio\_\ \ Указатель\ на\ структуру\ GPIO\ (напр.\ \ GPIOA)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00136}00136\ \textcolor{comment}{\ \ *\ @param\ \_pin\_\ \ \ Номер\ ножки\ (напр.\ GPIO\_PIN\_0)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00137}00137\ \textcolor{comment}{\ \ *\ @details\ Варианты\ реализации:}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00138}00138\ \textcolor{comment}{\ \ *\ \ -\/\ GPIO\_TRACE\_ENABLE\ не\ определён\ -\/\ макрос\ пустой}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00139}00139\ \textcolor{comment}{\ \ *\ \ -\/\ GPIO\_TRACE\_ENABLE\ определён\ -\/\ устанавливает\ бит\ сброса\ через\ BSRR\ ((\_pin\_)<<16)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00140}00140\ \textcolor{comment}{\ \ *}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00141}00141\ \textcolor{comment}{\ \ *\ @def\ TRACE\_GPIO\_SET(\_gpio\_,\ \_pin\_)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00142}00142\ \textcolor{comment}{\ \ *\ @brief\ Установить\ указанную\ ножку\ GPIO}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00143}00143\ \textcolor{comment}{\ \ *\ @param\ \_gpio\_\ \ Указатель\ на\ структуру\ GPIO\ (например\ GPIOA)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00144}00144\ \textcolor{comment}{\ \ *\ @param\ \_pin\_\ \ \ Номер\ ножки\ (напр.\ GPIO\_PIN\_0)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00145}00145\ \textcolor{comment}{\ \ *\ @details\ Варианты\ реализации:}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00146}00146\ \textcolor{comment}{\ \ *\ \ -\/\ GPIO\_TRACE\_ENABLE\ не\ определён\ -\/\ макрос\ пустой}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00147}00147\ \textcolor{comment}{\ \ *\ \ -\/\ GPIO\_TRACE\_ENABLE\ определён\ -\/\ устанавливает\ бит\ установки\ через\ BSRR\ (\_pin\_)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00148}00148\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00149}00149\ \textcolor{preprocessor}{\#ifndef\ GPIO\_TRACE\_ENABLE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00150}00150\ \textcolor{preprocessor}{\ \ \#define\ TRACE\_GPIO\_SET(\_gpio\_,\_pin\_)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00151}00151\ \textcolor{preprocessor}{\ \ \#define\ TRACE\_GPIO\_RESET(\_gpio\_,\_pin\_)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00152}00152\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00153}\mbox{\hyperlink{group___t_r_a_c_e___g_p_i_o_ga02a6a7b273766121db8ad4a1371373eb}{00153}}\ \textcolor{preprocessor}{\ \ \#define\ TRACE\_GPIO\_SET(\_gpio\_,\_pin\_)\ \ \ \ \ \ \ \ \ \ (\_gpio\_)-\/>BSRR\ =\ (((\_pin\_)))}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00154}\mbox{\hyperlink{group___t_r_a_c_e___g_p_i_o_ga69741d88c991112e99fe7a62e025108a}{00154}}\ \textcolor{preprocessor}{\ \ \#define\ TRACE\_GPIO\_RESET(\_gpio\_,\_pin\_)\ \ \ \ \ \ \ \ (\_gpio\_)-\/>BSRR\ =\ ((\_pin\_)<<16)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00155}00155\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//GPIO\_TRACE\_ENABLE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00156}00156\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00157}00157\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00158}00158\ \textcolor{comment}{/**\ TRACE\_GPIO}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00159}00159\ \textcolor{comment}{\ \ *\ @\}}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00160}00160\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00161}00161\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00162}00162\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00163}00163\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00164}00164\ \textcolor{preprocessor}{\#if\ defined(HAL\_MODULE\_ENABLED)\ \&\&\ defined(RTT\_TRACE\_ENABLE)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00165}00165\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00166}00166\ \textcolor{comment}{/**\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00167}00167\ \textcolor{comment}{\ \ *\ @addtogroup\ TRACE\_RTT\_FLASH\ \ \ \ Flash\ RTT\ Buffer}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00168}00168\ \textcolor{comment}{\ \ *\ @ingroup\ \ \ \ TRACE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00169}00169\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ \ \ Макросы\ и\ функции\ для\ сохранения/чтения\ RTT\ буфера\ в\ Flash}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00170}00170\ \textcolor{comment}{\ \ *\ @details\ \ \ \ Модуль\ позволяет\ сохранять\ данные\ RTT\ буфера\ во\ Flash\ и\ читать\ их\ обратно\ по\ тегам.\ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00171}00171\ \textcolor{comment}{\ \ *\ Теги\ работают\ следующим\ образом:\ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00172}00172\ \textcolor{comment}{\ \ *\ \ -\/\ Базовый\ тег\ (младший\ байт\ =\ 0):\ модуль\ сам\ выбирает\ первый\ свободный\ слот\ во\ Flash;\ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00173}00173\ \textcolor{comment}{\ \ *\ \ \ \ новые\ записи\ получают\ автоинкрементированный\ младший\ байт\ тега\ (от\ 0x00\ до\ 0xFF).\ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00174}00174\ \textcolor{comment}{\ \ *\ \ -\/\ Конкретный\ тег\ (младший\ байт\ !=\ 0):\ запись\ или\ чтение\ происходит\ строго\ с\ указанным\ тегом;\ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00175}00175\ \textcolor{comment}{\ \ *\ \ \ \ если\ слот\ с\ таким\ тегом\ уже\ занят,\ запись\ не\ выполняется.\ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00176}00176\ \textcolor{comment}{\ \ *\ \ -\/\ Автоинкремент\ позволяет\ хранить\ несколько\ последовательных\ записей\ в\ пределах\ одного\ базового\ тега,\ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00177}00177\ \textcolor{comment}{\ \ *\ \ \ \ без\ необходимости\ вручную\ отслеживать\ адреса\ Flash\ или\ позиции\ буферов.\ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00178}00178\ \textcolor{comment}{\ \ *\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00179}00179\ \textcolor{comment}{\ \ *\ Параметры:}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00180}00180\ \textcolor{comment}{\ \ *\ -\/\ @ref\ RTT\_FLASH\_BUFFER\_SIZE\ \ \ \ -\/\ Размер\ буфера\ RTT\ в\ Flash}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00181}00181\ \textcolor{comment}{\ \ *\ -\/\ @ref\ RTT\_FLASH\_SECTOR\ \ \ \ \ \ \ \ \ -\/\ Сектор\ FLASH\ куда\ положится\ RTT\ буфер}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00182}00182\ \textcolor{comment}{\ \ *\ -\/\ @ref\ RTT\_FLASH\_SECTOR\_START\ \ \ -\/\ Начало\ сектора\ RTT\_FLASH\_SECTOR}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00183}00183\ \textcolor{comment}{\ \ *\ -\/\ @ref\ RTT\_FLASH\_SECTOR\_END\ \ \ \ \ -\/\ Конец\ сектора\ RTT\_FLASH\_SECTOR}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00184}00184\ \textcolor{comment}{\ \ *\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00185}00185\ \textcolor{comment}{\ \ *\ @\{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00186}00186\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00187}00187\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00188}00188\ \ \ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00189}00189\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00190}00190\ \textcolor{comment}{\ \ *\ @brief\ Структура\ RTT,\ которая\ будет\ положена\ в\ Flash}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00191}00191\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00192}\mbox{\hyperlink{struct_r_t_t___flash_header__t}{00192}}\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00193}\mbox{\hyperlink{struct_r_t_t___flash_header__t_a844ee5470a323a749856cbb7a682dc57}{00193}}\ \ \ uint32\_t\ \mbox{\hyperlink{struct_r_t_t___flash_header__t_a844ee5470a323a749856cbb7a682dc57}{tag}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Уникальный\ идентификатор\ буфера}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00194}\mbox{\hyperlink{struct_r_t_t___flash_header__t_afd1a5c51af6f97d170c2ccbbe3e34699}{00194}}\ \ \ uint32\_t\ \mbox{\hyperlink{struct_r_t_t___flash_header__t_afd1a5c51af6f97d170c2ccbbe3e34699}{size}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Размер\ данных}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00195}\mbox{\hyperlink{struct_r_t_t___flash_header__t_a1100df39b0eccb835946f4c13de23b4e}{00195}}\ \ \ \textcolor{keywordtype}{char}\ \ \ \ \ \mbox{\hyperlink{struct_r_t_t___flash_header__t_a1100df39b0eccb835946f4c13de23b4e}{data}}[\mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_ga501312b24e322de4dd6755ad442f0ba3}{RTT\_FLASH\_BUFFER\_SIZE}}];\ \ \textcolor{comment}{///<\ Буфер\ RTT}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00196}00196\ \}\ \mbox{\hyperlink{struct_r_t_t___flash_header__t}{RTT\_FlashHeader\_t}};}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00197}00197\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00198}00198\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00199}00199\ \textcolor{comment}{\ \ *\ @brief\ Подготовка\ Flash\ к\ записи}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00200}00200\ \textcolor{comment}{\ \ *\ @details\ Сбрасывает\ ошибки\ Flash\ и\ ожидает\ готовности\ перед\ записью}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00201}00201\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00202}\mbox{\hyperlink{group___t_r_a_c_e___r_t_t___f_l_a_s_h_ga21353cb4f5af666237739e62ce019cd6}{00202}}\ \_\_STATIC\_FORCEINLINE\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___t_r_a_c_e___r_t_t___f_l_a_s_h_ga21353cb4f5af666237739e62ce019cd6}{RTT\_FlashPrepare}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00203}00203\ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00204}00204\ \ \ HAL\_FLASH\_Unlock();}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00205}00205\ \ \ \_\_HAL\_FLASH\_CLEAR\_FLAG(FLASH\_FLAG\_PGSERR\ |\ FLASH\_FLAG\_WRPERR\ |\ FLASH\_FLAG\_OPERR);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00206}00206\ \ \ \textcolor{keywordflow}{while}\ (\_\_HAL\_FLASH\_GET\_FLAG(FLASH\_FLAG\_BSY))\ \{\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00207}00207\ \ \ \_\_NOP();\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00208}00208\ \ \ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00209}00209\ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00210}00210\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00211}00211\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00212}00212\ \textcolor{comment}{\ \ *\ @brief\ Сохраняет\ последние\ символы\ RTT-\/буфера\ в\ Flash\ по\ тегу}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00213}00213\ \textcolor{comment}{\ \ *\ @param\ tag\ \ \ \ \ \ \ \ Базовый\ или\ конкретный\ идентификатор\ буфера.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00214}00214\ \textcolor{comment}{\ \ *\ @param\ tail\_size\ \ Количество\ последних\ символов\ RTT\ для\ копирования}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00215}00215\ \textcolor{comment}{\ \ *\ @param\ buf\_num\ \ \ \ Указатель\ на\ переменную\ в\ которую\ запишется\ номер\ буфера\ для\ конкретного\ тега}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00216}00216\ \textcolor{comment}{\ \ *\ @return\ >=0\ —\ номер\ буфера\ (тег)\ для\ записи,\ <0\ —\ ошибка\ (нет\ места,\ тег\ уже\ занят,\ ошибка\ записи\ в\ флеш)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00217}00217\ \textcolor{comment}{\ \ *}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00218}00218\ \textcolor{comment}{\ \ *\ @details\ \ Автоматически\ копирует\ последние\ tail\_size\ символов\ из\ RTT-\/буфера}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00219}00219\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ \ \ \ \ и\ записывает\ их\ во\ Flash.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00220}00220\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ \ \ \ \ Тег\ может\ быть\ базовым\ или\ конкретным:}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00221}00221\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ \ \ \ \ \ \ -\/\ Если\ базовый\ (младший\ байт\ ==\ 0)\ —\ будет\ выбран\ первый\ свободный\ слот\ с\ автоинкрементом.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00222}00222\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Автоинкремент\ формируется\ в\ пределах\ от\ 0x1\ до\ 0xFF}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00223}00223\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ \ \ \ \ \ \ -\/\ Если\ конкретный\ (младший\ байт\ !=\ 0)\ —\ запись\ выполняется\ только\ с\ этим\ тегом,\ иначе\ ошибка.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00224}00224\ \textcolor{comment}{\ \ *\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00225}00225\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00226}\mbox{\hyperlink{group___t_r_a_c_e___r_t_t___f_l_a_s_h_ga79f222c8ab644de4d47f07528d1edd63}{00226}}\ \_\_STATIC\_FORCEINLINE\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{group___t_r_a_c_e___r_t_t___f_l_a_s_h_ga79f222c8ab644de4d47f07528d1edd63}{RTT\_SaveToFlash}}(uint32\_t\ tag,\ uint32\_t\ tail\_size)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00227}00227\ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00228}00228\ \ \ \textcolor{keywordflow}{if}\ (tag\ ==\ 0xFFFFFFFF)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00229}00229\ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;\ \ \textcolor{comment}{//\ Неверный\ тег}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00230}00230\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00231}00231\ \ \ \mbox{\hyperlink{struct_s_e_g_g_e_r___r_t_t___b_u_f_f_e_r___u_p}{SEGGER\_RTT\_BUFFER\_UP}}\ *up\ =\ \&\_SEGGER\_RTT.aUp[0];}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00232}00232\ \ \ \textcolor{keywordtype}{unsigned}\ buf\_size\ =\ up-\/>SizeOfBuffer;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00233}00233\ \ \ \textcolor{keywordtype}{unsigned}\ wr\ =\ up-\/>WrOff;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00234}00234\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00235}00235\ \ \ \textcolor{comment}{//\ Ограничиваем\ по\ размеру\ буфера\ RTT\ и\ RTT\_FLASH\_BUFFER\_SIZE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00236}00236\ \ \ \textcolor{keywordtype}{unsigned}\ n\ =\ (tail\_size\ >\ buf\_size)\ ?\ buf\_size\ :\ tail\_size;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00237}00237\ \ \ \textcolor{keywordflow}{if}\ (n\ >\ \mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_ga501312b24e322de4dd6755ad442f0ba3}{RTT\_FLASH\_BUFFER\_SIZE}})}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00238}00238\ \ \ \ \ n\ =\ \mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_ga501312b24e322de4dd6755ad442f0ba3}{RTT\_FLASH\_BUFFER\_SIZE}};}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00239}00239\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00240}00240\ \ \ uint32\_t\ addr\ =\ \mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_ga8e56f75d3ab8a89ddde1404ae23c3297}{RTT\_FLASH\_SECTOR\_START}};}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00241}00241\ \ \ \mbox{\hyperlink{struct_r_t_t___flash_header__t}{RTT\_FlashHeader\_t}}\ *flash\_hdr\ =\ NULL;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00242}00242\ \ \ uint32\_t\ base\_tag\ =\ tag\ \&\ 0xFFFFFF00;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00243}00243\ \ \ uint32\_t\ next\_tag\ =\ (tag\ \&\ 0xFF)\ ==\ 0\ ?\ tag\ +\ 1\ :\ tag;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00244}00244\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00245}00245\ \ \ \textcolor{comment}{//\ Ищем\ первый\ свободный\ слот,\ параллельно\ автоинкрементируем\ тег}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00246}00246\ \ \ \textcolor{keywordflow}{while}\ ((addr\ +\ \textcolor{keyword}{sizeof}(\mbox{\hyperlink{struct_r_t_t___flash_header__t}{RTT\_FlashHeader\_t}}))\ <=\ \mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_gafeca0be3688dea07ff443f894668003d}{RTT\_FLASH\_SECTOR\_END}})}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00247}00247\ \ \ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00248}00248\ \ \ \ \ flash\_hdr\ =\ (\mbox{\hyperlink{struct_r_t_t___flash_header__t}{RTT\_FlashHeader\_t}}\ *)addr;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00249}00249\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00250}00250\ \ \ \ \ \textcolor{keywordflow}{if}\ (flash\_hdr-\/>\mbox{\hyperlink{struct_r_t_t___flash_header__t_a844ee5470a323a749856cbb7a682dc57}{tag}}\ ==\ 0xFFFFFFFF)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00251}00251\ \ \ \ \ \ \ \textcolor{keywordflow}{break};\ \ \textcolor{comment}{//\ Нашли\ свободное\ место}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00252}00252\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00253}00253\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00254}00254\ \ \ \ \ \textcolor{keywordflow}{if}((flash\_hdr-\/>\mbox{\hyperlink{struct_r_t_t___flash_header__t_a844ee5470a323a749856cbb7a682dc57}{tag}}\ \&\ 0xFFFFFF00)\ ==\ base\_tag)\ \textcolor{comment}{//\ выбраный\ тег}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00255}00255\ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00256}00256\ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ ((tag\ \&\ 0xFF)\ ==\ 0)\ \textcolor{comment}{//\ если\ он\ базовый\ -\/\ ищем\ последний}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00257}00257\ \ \ \ \ \ \ \ \ next\_tag\ =\ flash\_hdr-\/>\mbox{\hyperlink{struct_r_t_t___flash_header__t_a844ee5470a323a749856cbb7a682dc57}{tag}}\ +\ 1;\ \ \textcolor{comment}{//\ автоинкремент}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00258}00258\ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00259}00259\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(flash\_hdr-\/>\mbox{\hyperlink{struct_r_t_t___flash_header__t_a844ee5470a323a749856cbb7a682dc57}{tag}}\ ==\ tag)\ \textcolor{comment}{//\ если\ он\ конкретный\ и\ уже\ существует\ -\/\ то\ ошибка}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00260}00260\ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;\ \ \textcolor{comment}{//\ конкретный\ тег\ уже\ занят}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00261}00261\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00262}00262\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00263}00263\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00264}00264\ \ \ \ \ \textcolor{keywordflow}{if}(next\_tag\ -\/\ tag\ >\ 0xFF)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00265}00265\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;\ \textcolor{comment}{//\ автоинкремент\ слишком\ большой}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00266}00266\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00267}00267\ \ \ \ \ addr\ +=\ \textcolor{keyword}{sizeof}(\mbox{\hyperlink{struct_r_t_t___flash_header__t}{RTT\_FlashHeader\_t}});}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00268}00268\ \ \ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00269}00269\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00270}00270\ \ \ \textcolor{keywordflow}{if}\ ((addr\ +\ \textcolor{keyword}{sizeof}(\mbox{\hyperlink{struct_r_t_t___flash_header__t}{RTT\_FlashHeader\_t}}))\ >\ \mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_gafeca0be3688dea07ff443f894668003d}{RTT\_FLASH\_SECTOR\_END}})}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00271}00271\ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;\ \ \textcolor{comment}{//\ Нет\ свободного\ места}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00272}00272\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00273}00273\ \ \ \textcolor{comment}{//\ Копируем\ последние\ n\ символов\ из\ RTT}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00274}00274\ \ \ \textcolor{keywordtype}{char}\ temp[\mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_ga501312b24e322de4dd6755ad442f0ba3}{RTT\_FLASH\_BUFFER\_SIZE}}];}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00275}00275\ \ \ \textcolor{keywordtype}{unsigned}\ valid\_count\ =\ 0;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00276}00276\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00277}00277\ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{unsigned}\ i\ =\ 0;\ i\ <\ n;\ i++)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00278}00278\ \ \ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00279}00279\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ idx\ =\ (wr\ +\ buf\_size\ -\/\ n\ +\ i)\ \%\ buf\_size;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00280}00280\ \ \ \ \ \textcolor{keywordtype}{char}\ c\ =\ up-\/>pBuffer[idx];}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00281}00281\ \ \ \ \ \textcolor{keywordflow}{if}\ (c\ !=\ 0)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00282}00282\ \ \ \ \ \ \ temp[valid\_count++]\ =\ c;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00283}00283\ \ \ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00284}00284\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00285}00285\ \ \ \mbox{\hyperlink{group___t_r_a_c_e___r_t_t___f_l_a_s_h_ga21353cb4f5af666237739e62ce019cd6}{RTT\_FlashPrepare}}();}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00286}00286\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00287}00287\ \ \ \textcolor{comment}{//\ Формируем\ структуру\ в\ RAM}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00288}00288\ \ \ \mbox{\hyperlink{struct_r_t_t___flash_header__t}{RTT\_FlashHeader\_t}}\ flash\_data;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00289}00289\ \ \ flash\_data.\mbox{\hyperlink{struct_r_t_t___flash_header__t_a844ee5470a323a749856cbb7a682dc57}{tag}}\ \ =\ next\_tag;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00290}00290\ \ \ flash\_data.\mbox{\hyperlink{struct_r_t_t___flash_header__t_afd1a5c51af6f97d170c2ccbbe3e34699}{size}}\ =\ valid\_count;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00291}00291\ \ \ memcpy(flash\_data.\mbox{\hyperlink{struct_r_t_t___flash_header__t_a1100df39b0eccb835946f4c13de23b4e}{data}},\ temp,\ valid\_count);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00292}00292\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00293}00293\ \ \ \textcolor{comment}{//\ Записываем\ структуру\ во\ Flash\ (по\ 4\ байта)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00294}00294\ \ \ \textcolor{keyword}{const}\ uint32\_t\ *p\ =\ (\textcolor{keyword}{const}\ uint32\_t\ *)\&flash\_data;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00295}00295\ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{unsigned}\ i\ =\ 0;\ i\ <\ \textcolor{keyword}{sizeof}(\mbox{\hyperlink{struct_r_t_t___flash_header__t}{RTT\_FlashHeader\_t}})\ /\ 4;\ i++)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00296}00296\ \ \ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00297}00297\ \ \ \ \ \textcolor{keywordflow}{if}(HAL\_FLASH\_Program(FLASH\_TYPEPROGRAM\_WORD,\ addr\ +\ i\ *\ 4,\ p[i])\ !=\ HAL\_OK)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00298}00298\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00299}00299\ \ \ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00300}00300\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00301}00301\ \ \ HAL\_FLASH\_Lock();}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00302}00302\ \ \ \_\_DSB();}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00303}00303\ \ \ \_\_ISB();}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00304}00304\ \ \ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00305}00305\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00306}00306\ \ \ \textcolor{keywordflow}{return}\ (\textcolor{keywordtype}{int})(next\_tag\&0xFF);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00307}00307\ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00308}00308\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00309}00309\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00310}00310\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00311}00311\ \textcolor{comment}{\ \ *\ @brief\ Читает\ последние\ символы\ RTT-\/буфера\ из\ Flash\ по\ тегу}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00312}00312\ \textcolor{comment}{\ \ *\ @param\ tag\ \ \ \ \ \ \ \ Базовый\ или\ конкретный\ идентификатор\ буфера.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00313}00313\ \textcolor{comment}{\ \ *\ @param\ Buffer\ \ \ \ \ Буфер\ назначения\ для\ копирования\ данных}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00314}00314\ \textcolor{comment}{\ \ *\ @param\ tail\_size\ \ Количество\ последних\ символов,\ которые\ нужно\ прочитать}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00315}00315\ \textcolor{comment}{\ \ *\ @param\ read\_size\ \ Количество\ считанных\ символов}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00316}00316\ \textcolor{comment}{\ \ *\ @return\ >=0\ —\ номер\ буфера\ (тег)\ для\ записи,\ <0\ —\ ошибка\ (тег\ не\ найден\ или\ структура\ повреждена)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00317}00317\ \textcolor{comment}{\ \ *}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00318}00318\ \textcolor{comment}{\ \ *\ @details\ \ Копирует\ последние\ tail\_size\ символов\ из\ найденной\ записи\ Flash\ в\ Buffer.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00319}00319\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ \ \ \ \ Тег\ может\ быть\ базовым\ или\ конкретным:}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00320}00320\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ \ \ \ \ \ \ -\/\ Если\ базовый\ (младший\ байт\ ==\ 0)\ —\ будет\ прочитана\ последняя\ запись\ из\ группы.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00321}00321\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ \ \ \ \ \ \ -\/\ Если\ конкретный\ (младший\ байт\ !=\ 0)\ —\ прочитывается\ именно\ эта\ запись.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00322}00322\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00323}\mbox{\hyperlink{group___t_r_a_c_e___r_t_t___f_l_a_s_h_ga734b2ebbf0c77699b739013878cfd146}{00323}}\ \_\_STATIC\_FORCEINLINE\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{group___t_r_a_c_e___r_t_t___f_l_a_s_h_ga734b2ebbf0c77699b739013878cfd146}{RTT\_ReadFromFlash}}(uint32\_t\ tag,\ \textcolor{keywordtype}{char}\ *Buffer,\ uint32\_t\ tail\_size,\ uint32\_t\ *read\_size)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00324}00324\ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00325}00325\ \ \ \textcolor{keywordflow}{if}\ (!Buffer\ ||\ tail\_size\ ==\ 0)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00326}00326\ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;\ \ \textcolor{comment}{//\ Неверные\ параметры}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00327}00327\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00328}00328\ \ \ \textcolor{keywordflow}{if}\ (tag\ ==\ 0xFFFFFFFF)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00329}00329\ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;\ \ \textcolor{comment}{//\ Недопустимый\ тег}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00330}00330\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00331}00331\ \ \ uint32\_t\ addr\ =\ \mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_ga8e56f75d3ab8a89ddde1404ae23c3297}{RTT\_FLASH\_SECTOR\_START}};}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00332}00332\ \ \ \mbox{\hyperlink{struct_r_t_t___flash_header__t}{RTT\_FlashHeader\_t}}\ *flash\_hdr\ =\ NULL;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00333}00333\ \ \ \mbox{\hyperlink{struct_r_t_t___flash_header__t}{RTT\_FlashHeader\_t}}\ *target\_hdr\ =\ NULL;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00334}00334\ \ \ uint32\_t\ base\_tag\ =\ tag\ \&\ 0xFFFFFF00;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00335}00335\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00336}00336\ \ \ \textcolor{comment}{//\ Поиск\ записи\ по\ тегу}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00337}00337\ \ \ \textcolor{keywordflow}{while}\ ((addr\ +\ \textcolor{keyword}{sizeof}(\mbox{\hyperlink{struct_r_t_t___flash_header__t}{RTT\_FlashHeader\_t}}))\ <=\ \mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_gafeca0be3688dea07ff443f894668003d}{RTT\_FLASH\_SECTOR\_END}})}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00338}00338\ \ \ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00339}00339\ \ \ \ \ flash\_hdr\ =\ (\mbox{\hyperlink{struct_r_t_t___flash_header__t}{RTT\_FlashHeader\_t}}\ *)addr;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00340}00340\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00341}00341\ \ \ \ \ \textcolor{keywordflow}{if}\ (flash\_hdr-\/>\mbox{\hyperlink{struct_r_t_t___flash_header__t_a844ee5470a323a749856cbb7a682dc57}{tag}}\ ==\ 0xFFFFFFFF)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00342}00342\ \ \ \ \ \ \ \textcolor{keywordflow}{break};\ \ \textcolor{comment}{//\ Достигнут\ конец\ записанных\ структур}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00343}00343\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00344}00344\ \ \ \ \ \textcolor{comment}{//\ выбраный\ тег}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00345}00345\ \ \ \ \ \textcolor{keywordflow}{if}((flash\_hdr-\/>\mbox{\hyperlink{struct_r_t_t___flash_header__t_a844ee5470a323a749856cbb7a682dc57}{tag}}\ \&\ 0xFFFFFF00)\ ==\ base\_tag)\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00346}00346\ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00347}00347\ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ ((tag\ \&\ 0xFF)\ ==\ 0)\ \textcolor{comment}{//\ если\ он\ базовый\ -\/\ ищем\ последний\ \ \ \ \ \ \ \ \ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00348}00348\ \ \ \ \ \ \ \ \ target\_hdr\ =\ flash\_hdr;\ \ \textcolor{comment}{//\ сохраняем\ последний\ в\ группе}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00349}00349\ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00350}00350\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(flash\_hdr-\/>\mbox{\hyperlink{struct_r_t_t___flash_header__t_a844ee5470a323a749856cbb7a682dc57}{tag}}\ ==\ tag)\ \textcolor{comment}{//\ если\ он\ конкретный\ и\ найден\ -\/\ берем\ его}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00351}00351\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00352}00352\ \ \ \ \ \ \ \ \ \ \ target\_hdr\ =\ flash\_hdr;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00353}00353\ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};\ \ \textcolor{comment}{//\ конкретный\ тег\ найден}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00354}00354\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00355}00355\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00356}00356\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00357}00357\ \ \ \ \ addr\ +=\ \textcolor{keyword}{sizeof}(\mbox{\hyperlink{struct_r_t_t___flash_header__t}{RTT\_FlashHeader\_t}});}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00358}00358\ \ \ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00359}00359\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00360}00360\ \ \ \textcolor{keywordflow}{if}\ (!target\_hdr)\ \textcolor{keywordflow}{return}\ -\/1;\ \textcolor{comment}{//\ Тег\ не\ найден}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00361}00361\ \ \ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00362}00362\ \ \ \textcolor{comment}{//\ Проверка\ корректности\ размера}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00363}00363\ \ \ \textcolor{keywordflow}{if}\ (target\_hdr-\/>\mbox{\hyperlink{struct_r_t_t___flash_header__t_afd1a5c51af6f97d170c2ccbbe3e34699}{size}}\ >\ \mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_ga501312b24e322de4dd6755ad442f0ba3}{RTT\_FLASH\_BUFFER\_SIZE}})}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00364}00364\ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;\ \ \textcolor{comment}{//\ Повреждённая\ запись\ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00365}00365\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00366}00366\ \ \ \textcolor{comment}{//\ Определяем\ количество\ читаемых\ символов}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00367}00367\ \ \ uint32\_t\ n\ =\ (tail\_size\ >\ target\_hdr-\/>\mbox{\hyperlink{struct_r_t_t___flash_header__t_afd1a5c51af6f97d170c2ccbbe3e34699}{size}})\ ?\ target\_hdr-\/>\mbox{\hyperlink{struct_r_t_t___flash_header__t_afd1a5c51af6f97d170c2ccbbe3e34699}{size}}\ :\ tail\_size;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00368}00368\ \ \ \textcolor{comment}{//\ Начальная\ позиция\ для\ чтения\ последних\ tail\_size\ символов}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00369}00369\ \ \ uint32\_t\ start\ =\ target\_hdr-\/>\mbox{\hyperlink{struct_r_t_t___flash_header__t_afd1a5c51af6f97d170c2ccbbe3e34699}{size}}\ -\/\ n;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00370}00370\ \ \ \textcolor{comment}{//\ Копируем\ данные\ из\ Flash\ в\ RAM}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00371}00371\ \ \ memcpy(Buffer,\ \&target\_hdr-\/>\mbox{\hyperlink{struct_r_t_t___flash_header__t_a1100df39b0eccb835946f4c13de23b4e}{data}}[start],\ n);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00372}00372\ \ \ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00373}00373\ \ \ \textcolor{keywordflow}{if}(read\_size\ !=\ NULL)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00374}00374\ \ \ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00375}00375\ \ \ \ \ *read\_size\ =\ n;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00376}00376\ \ \ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00377}00377\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00378}00378\ \ \ \_\_DSB();}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00379}00379\ \ \ \_\_ISB();}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00380}00380\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00381}00381\ \ \ \textcolor{keywordflow}{return}\ (\textcolor{keywordtype}{int})(target\_hdr-\/>\mbox{\hyperlink{struct_r_t_t___flash_header__t_a844ee5470a323a749856cbb7a682dc57}{tag}}\ \&\ 0xFF);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00382}00382\ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00383}00383\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00384}00384\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00385}00385\ \textcolor{comment}{\ \ *\ @brief\ Стирание\ сектора\ Flash\ с\ RTT-\/буфером}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00386}00386\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00387}\mbox{\hyperlink{group___t_r_a_c_e___r_t_t___f_l_a_s_h_ga8d8c6850e32b42871faefce3352012d1}{00387}}\ \_\_STATIC\_FORCEINLINE\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{group___t_r_a_c_e___r_t_t___f_l_a_s_h_ga8d8c6850e32b42871faefce3352012d1}{RTT\_EraseFlash}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00388}00388\ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00389}00389\ \ \ FLASH\_EraseInitTypeDef\ eraseInit;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00390}00390\ \ \ uint32\_t\ pageError\ =\ 0;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00391}00391\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00392}00392\ \ \ \mbox{\hyperlink{group___t_r_a_c_e___r_t_t___f_l_a_s_h_ga21353cb4f5af666237739e62ce019cd6}{RTT\_FlashPrepare}}();}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00393}00393\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00394}00394\ \ \ eraseInit.TypeErase\ \ \ =\ FLASH\_TYPEERASE\_SECTORS;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00395}00395\ \ \ eraseInit.Sector\ \ \ \ \ \ =\ \mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_ga3bc1b76864e1d32cbdd174d4caae7724}{RTT\_FLASH\_SECTOR}};}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00396}00396\ \ \ eraseInit.NbSectors\ \ \ =\ 1;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00397}00397\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00398}00398\ \ \ \textcolor{keywordflow}{if}\ (HAL\_FLASHEx\_Erase(\&eraseInit,\ \&pageError)\ !=\ HAL\_OK)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00399}00399\ \ \ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00400}00400\ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00401}00401\ \ \ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00402}00402\ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00403}00403\ \ \ HAL\_FLASH\_Lock();}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00404}00404\ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00405}00405\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00406}00406\ \textcolor{comment}{/**\ TRACE\_RTT\_FLASH}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00407}00407\ \textcolor{comment}{\ \ *\ @\}}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00408}00408\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00409}00409\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00410}00410\ \textcolor{preprocessor}{\#else\ }\textcolor{comment}{//\ HAL\_MODULE\_ENABLED\ \&\&\ RTT\_TRACE\_ENABLE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00411}00411\ \textcolor{preprocessor}{\#define\ RTT\_FlashPrepare(...)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00412}00412\ \textcolor{preprocessor}{\#define\ RTT\_EraseFlash(...)\ \ \ \ 0}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00413}00413\ \textcolor{preprocessor}{\#define\ RTT\_SaveToFlash(...)\ \ \ 0}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00414}00414\ \textcolor{preprocessor}{\#define\ RTT\_ReadFromFlash(...)\ 0}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00415}00415\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ HAL\_MODULE\_ENABLED\ \&\&\ RTT\_TRACE\_ENABLE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00416}00416\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00417}00417\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00418}00418\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00419}00419\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00420}00420\ \textcolor{comment}{/**\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00421}00421\ \textcolor{comment}{\ \ *\ @addtogroup\ \ TRACE\_HARDFAULT\ \ \ \ Hardfault\ trace\ defines}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00422}00422\ \textcolor{comment}{\ \ *\ @ingroup\ \ \ \ \ TRACE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00423}00423\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ \ \ \ Модуль\ трассировки\ HardFault\ с\ возможностью\ сохранения\ RTT\ буфера\ во\ Flash}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00424}00424\ \textcolor{comment}{\ \ *\ @details}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00425}00425\ \textcolor{comment}{\ \ *\ Этот\ модуль\ позволяет\ сохранять\ контекст\ процессора\ и\ последние\ символы\ RTT\ буфера\ при\ возникновении\ HardFault.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00426}00426\ \textcolor{comment}{\ \ *}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00427}00427\ \textcolor{comment}{\ \ *\ Механизм\ работы:}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00428}00428\ \textcolor{comment}{\ \ *\ \ \ -\/\ При\ срабатывании\ HardFault\ вызывается\ HF\_HandleFault(),\ который:}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00429}00429\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ 1.\ Получает\ указатель\ на\ стек,\ где\ произошёл\ HardFault\ (MSP\ или\ PSP).}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00430}00430\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ 2.\ Выводит\ значения\ регистров\ R0-\/R3,\ R12,\ LR,\ PC,\ PSR\ и\ системных\ регистров\ SCB.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00431}00431\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ 3.\ Формирует\ строку\ с\ регистрами\ и\ копирует\ последние\ символы\ RTT\ буфера.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00432}00432\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ 4.\ Сохраняет\ данные\ во\ Flash\ с\ базовым\ тегом\ HF\_RTT\_TAG\_BASE.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00433}00433\ \textcolor{comment}{\ \ *\ \ \ -\/\ Для\ восстановления\ последнего\ HardFault\ используется\ HF\_CheckRecovered(),\ который:}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00434}00434\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ 1.\ Читает\ запись\ во\ Flash\ по\ базовому\ тегу.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00435}00435\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ 2.\ Выводит\ сохранённый\ RTT\ буфер\ и\ контекст\ регистров.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00436}00436\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ 3.\ Опционально\ стирает\ Flash\ после\ восстановления.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00437}00437\ \textcolor{comment}{\ \ *\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00438}00438\ \textcolor{comment}{\ \ *\ Параметры:}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00439}00439\ \textcolor{comment}{\ \ *\ -\/\ @ref\ HARDFAULT\_SERIAL\_TRACE\ \ \ -\/\ Включить\ обработку\ и\ serial\ трассировку\ Hardfault}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00440}00440\ \textcolor{comment}{\ \ *\ \ \ Если\ отключена\ то\ вставляются\ заглушки,\ никак\ не\ влияющие\ на\ параметры\ и\ остальную\ программу}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00441}00441\ \textcolor{comment}{\ \ *\ -\/\ @ref\ HF\_RTT\_TAG\_BASE\ \ \ \ \ \ \ \ \ \ -\/\ Базовый\ тег\ RTT\ Flash\ для\ HardFault\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00442}00442\ \textcolor{comment}{\ \ *\ -\/\ @ref\ HF\_RTT\_TAIL\_SIZE\ \ \ \ \ \ \ \ \ -\/\ Размер\ буфера\ RTT,\ который\ сохранится\ при\ Hardfault}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00443}00443\ \textcolor{comment}{\ \ *\ -\/\ @ref\ HF\_STACK\_DUMP\_WORDS\ \ \ \ \ \ -\/\ Сколько\ слов\ стека\ будет\ проанализировано\ во\ время\ Hardfault}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00444}00444\ \textcolor{comment}{\ \ *\ -\/\ @ref\ HF\_FLASH\_ADDR\ \ \ \ \ \ \ \ \ \ \ \ -\/\ Адрес\ FLASH\ куда\ положится\ RTT\ буфер}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00445}00445\ \textcolor{comment}{\ \ *\ -\/\ @ref\ HF\_RAM\_END\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -\/\ Конец\ RAM\ памяти\ (чтобы\ во\ время\ анализа\ стека\ не\ выйти\ за\ пределы)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00446}00446\ \textcolor{comment}{\ \ *\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00447}00447\ \textcolor{comment}{\ \ @code}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00448}00448\ \textcolor{comment}{\ \ void\ Hardfault()}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00449}00449\ \textcolor{comment}{\ \ \{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00450}00450\ \textcolor{comment}{\ \ \ \ HF\_HandleFault();}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00451}00451\ \textcolor{comment}{\ \ \ \ NVIC\_SystemReset();}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00452}00452\ \textcolor{comment}{\ \ \}}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00453}00453\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00454}00454\ \textcolor{comment}{\ \ int\ main()}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00455}00455\ \textcolor{comment}{\ \ \{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00456}00456\ \textcolor{comment}{\ \ \ \ if(HF\_CheckRecovered(0))}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00457}00457\ \textcolor{comment}{\ \ \ \ \{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00458}00458\ \textcolor{comment}{\ \ \ \ \ \ //set\ hardfault\ error}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00459}00459\ \textcolor{comment}{\ \ \ \ \ \ RTT\_EraseFlash();\ //\ erase\ rtt\ flash\ after\ message\ readed}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00460}00460\ \textcolor{comment}{\ \ \ \ \}}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00461}00461\ \textcolor{comment}{\ \ \}\ \ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00462}00462\ \textcolor{comment}{\ \ @endcode}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00463}00463\ \textcolor{comment}{\ \ *\ @\{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00464}00464\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00465}00465\ \textcolor{preprocessor}{\#if\ defined(HAL\_MODULE\_ENABLED)\ \&\&\ defined(HARDFAULT\_SERIAL\_TRACE)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00466}00466\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00467}00467\ \textcolor{preprocessor}{\#ifndef\ HF\_RTT\_TAIL\_SIZE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00468}00468\ \textcolor{preprocessor}{\#define\ HF\_RTT\_TAIL\_SIZE\ \ RTT\_FLASH\_BUFFER\_SIZE\ }\textcolor{comment}{///<\ Размер\ буфера\ RTT,\ который\ сохранится\ при\ Hardfault}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00469}00469\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00470}00470\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00471}00471\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00472}00472\ \textcolor{comment}{\ \ *\ @brief\ Контекст\ стек-\/фрейма\ процессора\ при\ HardFault}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00473}00473\ \textcolor{comment}{\ \ *\ @details\ Сохраняет\ регистры\ R0-\/R3,\ R12,\ LR,\ PC,\ PSR\ для\ последующего\ анализа.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00474}00474\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00475}00475\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00476}00476\ \ \ uint32\_t\ r0;\ \ \ \textcolor{comment}{///<\ Регистр\ R0}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00477}00477\ \ \ uint32\_t\ r1;\ \ \ \textcolor{comment}{///<\ Регистр\ R1}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00478}00478\ \ \ uint32\_t\ r2;\ \ \ \textcolor{comment}{///<\ Регистр\ R2}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00479}00479\ \ \ uint32\_t\ r3;\ \ \ \textcolor{comment}{///<\ Регистр\ R3}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00480}00480\ \ \ uint32\_t\ r12;\ \ \textcolor{comment}{///<\ Регистр\ R12}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00481}00481\ \ \ uint32\_t\ lr;\ \ \ \textcolor{comment}{///<\ Link\ Register}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00482}00482\ \ \ uint32\_t\ pc;\ \ \ \textcolor{comment}{///<\ Program\ Counter}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00483}00483\ \ \ uint32\_t\ psr;\ \ \textcolor{comment}{///<\ Program\ Status\ Register}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00484}00484\ \}\ HF\_StackFrame\_t;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00485}00485\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00486}00486\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00487}00487\ \textcolor{comment}{\ \ *\ @brief\ Проверка\ и\ вывод\ последнего\ HardFault-\/трейса\ из\ Flash}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00488}00488\ \textcolor{comment}{\ \ *\ @details}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00489}00489\ \textcolor{comment}{\ \ *\ Функция\ ищет\ последнюю\ запись\ HardFault\ по\ базовому\ тегу\ HF\_RTT\_TAG\_BASE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00490}00490\ \textcolor{comment}{\ \ *\ и\ выводит\ её\ содержимое\ в\ консоль.\ После\ успешного\ вывода\ Flash\ можно\ опционально\ очистить.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00491}00491\ \textcolor{comment}{\ \ *}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00492}00492\ \textcolor{comment}{\ \ *\ @return\ int}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00493}00493\ \textcolor{comment}{\ \ *\ \ \ -\/\ 1\ —\ данные\ HardFault\ найдены\ и\ выведены}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00494}00494\ \textcolor{comment}{\ \ *\ \ \ -\/\ 0\ —\ данные\ отсутствуют\ или\ тег\ не\ найден}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00495}00495\ \textcolor{comment}{\ \ *\ }}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00496}00496\ \textcolor{comment}{\ \ *\ @note\ Вызов\ рекомендуется\ при\ инициализации\ приложения\ для\ анализа\ предыдущего\ сбоя.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00497}00497\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00498}00498\ \_\_STATIC\_FORCEINLINE\ \textcolor{keywordtype}{int}\ HF\_CheckRecovered(\textcolor{keywordtype}{int}\ erase)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00499}00499\ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00500}00500\ \ \ \textcolor{keywordtype}{char}\ buffer[\mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_ga501312b24e322de4dd6755ad442f0ba3}{RTT\_FLASH\_BUFFER\_SIZE}}];}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00501}00501\ \ \ uint32\_t\ read\_size\ =\ 0;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00502}00502\ \ \ \textcolor{keywordtype}{int}\ n\_hardfault\ =\ \mbox{\hyperlink{group___t_r_a_c_e___r_t_t___f_l_a_s_h_ga734b2ebbf0c77699b739013878cfd146}{RTT\_ReadFromFlash}}(\mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_gadc960255719c7eff4bdfaa850be9b313}{HF\_RTT\_TAG\_BASE}},\ buffer,\ \mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_gafcc7ea03d4df8f1909e580b519a7f3ca}{HF\_RTT\_TAIL\_SIZE}},\ \&read\_size);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00503}00503\ \ \ \textcolor{keywordflow}{if}\ (n\_hardfault\ >\ 0)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00504}00504\ \ \ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00505}00505\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}\(\backslash\)n-\/-\/-\/\ Recovered\ HardFault\ RTT\ buffer\ \#\%u\ -\/-\/-\/\(\backslash\)n"{}},\ n\_hardfault);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00506}00506\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ read\_size;\ i++)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00507}00507\ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00508}00508\ \ \ \ \ \ \ \textcolor{keywordtype}{char}\ c\ =\ buffer[i];}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00509}00509\ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (c\ ==\ 0\ ||\ c\ ==\ (\textcolor{keywordtype}{char})0xFF)\ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00510}00510\ \ \ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}\%c"{}},\ c);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00511}00511\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00512}00512\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00513}00513\ \ \ \ \ \textcolor{keywordflow}{if}(erase)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00514}00514\ \ \ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___r_t_t___f_l_a_s_h_ga8d8c6850e32b42871faefce3352012d1}{RTT\_EraseFlash}}();}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00515}00515\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}\(\backslash\)n-\/-\/-\/-\/-\/-\/-\/-\/-\/\ HardFault\ Dump\ End\ -\/-\/-\/-\/-\/-\/-\/-\/-\/\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00516}00516\ \ \ \ \ \textcolor{keywordflow}{return}\ 1;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00517}00517\ \ \ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00518}00518\ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00519}00519\ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00520}00520\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00521}00521\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00522}00522\ \textcolor{keyword}{static}\ HF\_StackFrame\_t\ *stack\_frame;}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00523}00523\ \textcolor{keyword}{static}\ uint32\_t\ stack\_dump[\mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_gaa31234688b333a505aaa57b8ecdedf5b}{HF\_STACK\_DUMP\_WORDS}}];}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00524}00524\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}\ *ret\_adr[10]\ =\ \{0\};\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00525}00525\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00526}00526\ \textcolor{comment}{\ \ *\ @brief\ Обработчик\ HardFault}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00527}00527\ \textcolor{comment}{\ \ *\ @details}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00528}00528\ \textcolor{comment}{\ \ *\ Вызывается\ из\ прерывания\ HardFault\ или\ в\ любом\ месте\ где\ понятно\ что\ ошибка\ критическая.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00529}00529\ \textcolor{comment}{\ \ *\ Последовательно\ выполняет:}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00530}00530\ \textcolor{comment}{\ \ *\ \ \ 1.\ Определяет\ активный\ стек\ (MSP\ или\ PSP)\ на\ момент\ сбоя.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00531}00531\ \textcolor{comment}{\ \ *\ \ \ 2.\ Сохраняет\ значения\ регистров\ R0-\/R3,\ R12,\ LR,\ PC,\ PSR.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00532}00532\ \textcolor{comment}{\ \ *\ \ \ 3.\ Выводит\ системные\ регистры\ CFSR,\ HFSR,\ DFSR,\ AFSR,\ MMFAR,\ BFAR.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00533}00533\ \textcolor{comment}{\ \ *\ \ \ 4.\ Формирует\ stack\ trace\ с\ 3\ уровнями\ возврата.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00534}00534\ \textcolor{comment}{\ \ *\ \ \ 5.\ Копирует\ последние\ символы\ RTT\ буфера.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00535}00535\ \textcolor{comment}{\ \ *\ \ \ 6.\ Сохраняет\ все\ данные\ во\ Flash\ через\ RTT\_SaveToFlash\ с\ базовым\ тегом\ HF\_RTT\_TAG\_BASE.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00536}00536\ \textcolor{comment}{\ \ *}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00537}00537\ \textcolor{comment}{\ \ *\ @note\ Функция\ защищена,\ так\ как\ вызывается\ в\ контексте\ сбоя\ —\ минимизирует\ использование\ вызовов\ HAL.}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00538}00538\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00539}00539\ \_\_STATIC\_FORCEINLINE\ \textcolor{keywordtype}{void}\ HF\_HandleFault(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00540}00540\ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00541}00541\ \ \ \ \ \textcolor{comment}{//\ Получаем\ указатель\ на\ стек,\ где\ произошёл\ HardFault}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00542}00542\ \ \ \ \ \_\_ASM\ \textcolor{keyword}{volatile}(}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00543}00543\ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}TST\ lr,\ \#4\ \ \ \ \ \ \ \(\backslash\)n"{}}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00544}00544\ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}ITE\ EQ\ \ \ \ \ \ \ \ \ \ \ \(\backslash\)n"{}}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00545}00545\ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}MRSEQ\ \%[ptr],\ MSP\(\backslash\)n"{}}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00546}00546\ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}MRSNE\ \%[ptr],\ PSP\(\backslash\)n"{}}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00547}00547\ \ \ \ \ \ \ \ \ :\ [ptr]\ \textcolor{stringliteral}{"{}=r"{}}(stack\_frame)}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00548}00548\ \ \ \ \ );}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00549}00549\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00550}00550\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}\(\backslash\)n=====\ HardFault\ occurred!\ =====\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00551}00551\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}R0\ \ =\ 0x\%08X\(\backslash\)n"{}},\ stack\_frame-\/>r0);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00552}00552\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}R1\ \ =\ 0x\%08X\(\backslash\)n"{}},\ stack\_frame-\/>r1);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00553}00553\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}R2\ \ =\ 0x\%08X\(\backslash\)n"{}},\ stack\_frame-\/>r2);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00554}00554\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}R3\ \ =\ 0x\%08X\(\backslash\)n"{}},\ stack\_frame-\/>r3);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00555}00555\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}R12\ =\ 0x\%08X\(\backslash\)n"{}},\ stack\_frame-\/>r12);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00556}00556\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}LR\ \ =\ 0x\%08X\(\backslash\)n"{}},\ stack\_frame-\/>lr);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00557}00557\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}PC\ \ =\ 0x\%08X\(\backslash\)n"{}},\ stack\_frame-\/>pc);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00558}00558\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}PSR\ =\ 0x\%08X\(\backslash\)n"{}},\ stack\_frame-\/>psr);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00559}00559\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00560}00560\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}CFSR\ \ =\ 0x\%08X\(\backslash\)n"{}},\ SCB-\/>CFSR);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00561}00561\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}HFSR\ \ =\ 0x\%08X\(\backslash\)n"{}},\ SCB-\/>HFSR);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00562}00562\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}DFSR\ \ =\ 0x\%08X\(\backslash\)n"{}},\ SCB-\/>DFSR);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00563}00563\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}AFSR\ \ =\ 0x\%08X\(\backslash\)n"{}},\ SCB-\/>AFSR);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00564}00564\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}MMFAR\ =\ 0x\%08X\(\backslash\)n"{}},\ SCB-\/>MMFAR);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00565}00565\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}BFAR\ \ =\ 0x\%08X\(\backslash\)n"{}},\ SCB-\/>BFAR);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00566}00566\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00567}00567\ \ \ \ \ \textcolor{comment}{//\ -\/-\/-\/\ Stack\ trace\ -\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00568}00568\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}-\/-\/-\/\ Stack\ trace\ -\/-\/-\/\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00569}00569\ \ \ \ \ ret\_adr[0]\ =\ \_\_builtin\_return\_address(0);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00570}00570\ \ \ \ \ ret\_adr[1]\ =\ \_\_builtin\_return\_address(1);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00571}00571\ \ \ \ \ ret\_adr[2]\ =\ \_\_builtin\_return\_address(2);}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00572}00572\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00573}00573\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ 3;\ i++)\ \ \textcolor{comment}{//\ развернуть\ n\ уровней}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00574}00574\ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00575}00575\ \ \ \ \ \ \ \textcolor{keywordflow}{if}(ret\_adr[i])}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00576}00576\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___s_e_r_i_a_l_gae9b9b8a611e291a2f2aa5abf99f3ebaa}{my\_printf}}(\textcolor{stringliteral}{"{}\ \ \#\%d:\ 0x\%08lX\(\backslash\)r\(\backslash\)n"{}},\ i,\ ret\_adr[i]);\ \textcolor{comment}{//\ -\/1\ для\ Thumb}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00577}00577\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00578}00578\ \ \ \ \ \mbox{\hyperlink{group___t_r_a_c_e___r_t_t___f_l_a_s_h_ga79f222c8ab644de4d47f07528d1edd63}{RTT\_SaveToFlash}}(\mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_gadc960255719c7eff4bdfaa850be9b313}{HF\_RTT\_TAG\_BASE}},\ \mbox{\hyperlink{group___t_r_a_c_e___c_o_n_f_i_g_gafcc7ea03d4df8f1909e580b519a7f3ca}{HF\_RTT\_TAIL\_SIZE}});}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00579}00579\ \}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00580}00580\ \textcolor{preprocessor}{\#else\ }\textcolor{comment}{//\ HAL\_MODULE\_ENABLED\ \&\&\ HARDFAULT\_SERIAL\_TRACE}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00581}00581\ \textcolor{preprocessor}{\#define\ HF\_CheckRecovered(...)\ 0}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00582}00582\ \textcolor{preprocessor}{\#define\ HF\_HandleFault(...)}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00583}00583\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ HAL\_MODULE\_ENABLED\ \&\&\ HARDFAULT\_SERIAL\_TRACE}\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00584}00584\ \textcolor{comment}{/**\ TRACE\_HARDFAULT}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00585}00585\ \textcolor{comment}{\ \ *\ @\}}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00586}00586\ \textcolor{comment}{\ \ */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00587}00587\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00588}00588\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00589}00589\ }
\DoxyCodeLine{\Hypertarget{trace_8h_source_l00590}00590\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\_\_TRACE\_H\_}}

\end{DoxyCode}
