WebRadioApp  0.1
ew_bsp_clock.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * E M B E D D E D W I Z A R D P R O J E C T
4  *
5  * Copyright (c) TARA Systems
6  *GmbH written by Paul Banach and Manfred Schweyer
7  *
8  ********************************************************************************
9  *
10  * This software is delivered "as is" and shows the usage of other software
11  * components. It is provided as an example software which is intended to be
12  * modified and extended according to particular requirements.
13  *
14  * TARA Systems hereby disclaims all warranties and conditions with regard to
15  *the software, including all implied warranties and conditions of
16  *merchantability and non-infringement of any third party IPR or other rights
17  *which may result from the use or the inability to use the software.
18  *
19  ********************************************************************************
20  *
21  * DESCRIPTION:
22  * This file is part of the interface (glue layer) between an Embedded Wizard
23  * generated UI application and the board support package (BSP) of a dedicated
24  * target.
25  * This template is responsible to initialize the system clock of the
26  *hardware, to provide a timer tick for the Embedded Wizard UI application and
27  *to get access to the realtime clock (RTC). Additionally, this file contains
28  *some performance measurements to analyse the CPU usage of the UI application.
29  *
30  *******************************************************************************/
31 
44 #ifndef EW_BSP_CLOCK_H
45 #define EW_BSP_CLOCK_H
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 #if EW_CPU_LOAD_MEASURING == 1
52 #define CPU_LOAD_SET_IDLE() EwBspClockCpuLoadSetIdle()
53 #define CPU_LOAD_SET_ACTIVE() EwBspClockCpuLoadSetActive()
54 #else
55 #define CPU_LOAD_SET_IDLE()
56 #define CPU_LOAD_SET_ACTIVE()
57 #endif
58 
59 /*******************************************************************************
60  * FUNCTION:
61  * EwBspClockInit
62  *
63  * DESCRIPTION:
64  * Initialises the system clock and the real time clock.
65  *
66  * ARGUMENTS:
67  * None
68  *
69  * RETURN VALUE:
70  * None
71  *
72  *******************************************************************************/
73 void EwBspClockInit(void);
74 
75 /*******************************************************************************
76  * FUNCTION:
77  * EwBspClockTickIncrement
78  *
79  * DESCRIPTION:
80  * The function EwBspClockTickIncrement increments the millisecond counter,
81  * which is used by the Runtime Environmet (RTE) to trigger timer events.
82  *
83  * ARGUMENTS:
84  * None
85  *
86  * RETURN VALUE:
87  * None
88  *
89  *******************************************************************************/
90 void EwBspClockTickIncrement(void);
91 
92 /*******************************************************************************
93  * FUNCTION:
94  * EwBspClockGetTicks
95  *
96  * DESCRIPTION:
97  * The function EwBspClockGetTicks returns the current ticks counter value.
98  *
99  * ARGUMENTS:
100  * None
101  *
102  * RETURN VALUE:
103  * The current ticks counter value.
104  *
105  *******************************************************************************/
106 unsigned long EwBspClockGetTicks(void);
107 
108 /*******************************************************************************
109  * FUNCTION:
110  * EwBspClockGetTime
111  *
112  * DESCRIPTION:
113  * Returns the current time in seconds since 01.01.1970.
114  *
115  * ARGUMENTS:
116  * None
117  *
118  * RETURN VALUE:
119  * The current time in seconds since 01.01.1970.
120  *
121  *******************************************************************************/
122 unsigned long EwBspClockGetTime(void);
123 
124 /*******************************************************************************
125  * FUNCTION:
126  * EwBspClockSetTime
127  *
128  * DESCRIPTION:
129  * Sets the given time in seconds since 01.01.1970 at real time clock (RTC).
130  *
131  * ARGUMENTS:
132  * aTime - the time in seconds since 01.01.1970 to set in real time clock.
133  *
134  * RETURN VALUE:
135  * None.
136  *
137  *******************************************************************************/
138 void EwBspClockSetTime(unsigned long aTime);
139 
140 /*******************************************************************************
141  * FUNCTION:
142  * EwBspClockGetCpuLoad
143  *
144  * DESCRIPTION:
145  * Returns the current CPU load as percent value.
146  *
147  * ARGUMENTS:
148  * None
149  *
150  * RETURN VALUE:
151  * The current CPU load.
152  *
153  *******************************************************************************/
154 int EwBspClockGetCpuLoad(void);
155 
156 /*******************************************************************************
157  * FUNCTION:
158  * EwBspClockCpuLoadSetActive
159  *
160  * DESCRIPTION:
161  * Starts the CPU load counting. Call this function whenever CPU processing
162  * is needed.
163  *
164  * ARGUMENTS:
165  *
166  * RETURN VALUE:
167  * None
168  *
169  *******************************************************************************/
170 void EwBspClockCpuLoadSetActive(void);
171 
172 /*******************************************************************************
173  * FUNCTION:
174  * EwBspClockCpuLoadSetIdle
175  *
176  * DESCRIPTION:
177  * Stops the CPU load counting. Call this function whenever CPU processing is
178  * currently not needed since the program execution is waiting for some system
179  * event.
180  *
181  * ARGUMENTS:
182  * None
183  *
184  * RETURN VALUE:
185  * None
186  *
187  *******************************************************************************/
188 void EwBspClockCpuLoadSetIdle(void);
189 
190 #ifdef __cplusplus
191 }
192 #endif
193 
194 #endif /* EW_BSP_CLOCK_H */
195 
196 /* msy */
197 
RtcTicksPerDay
#define RtcTicksPerDay
Definition: ew_bsp_clock.c:62
DaysToMonthInLeapYear
const unsigned long DaysToMonthInLeapYear[]
Definition: ew_bsp_clock.c:67
RtcHandle
static RTC_HandleTypeDef RtcHandle
Definition: ew_bsp_clock.c:74
RtcTicksPerHour
#define RtcTicksPerHour
Definition: ew_bsp_clock.c:61
EwBspClockSetTime
void EwBspClockSetTime(unsigned long aTime)
Sets the given time in seconds since 01.01.1970 at real time clock (RTC).
Definition: ew_bsp_clock.c:303
EwBspClockGetTicks
unsigned long EwBspClockGetTicks(void)
The function EwBspClockGetTicks returns the current ticks counter value.
Definition: ew_bsp_clock.c:245
DaysToMonth
const unsigned long DaysToMonth[]
Definition: ew_bsp_clock.c:64
XTAL_Min
volatile int XTAL_Min
Definition: main.cpp:48
HAL_RTC_MspInit
void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)
RTC MSP Initialization This function configures the hardware resources used in this example.
Definition: ew_bsp_clock.c:153
EwBspClockInit
void EwBspClockInit(void)
Initialises the system clock and the real time clock.
Definition: ew_bsp_clock.c:200
RTC_ASYNCH_PREDIV
#define RTC_ASYNCH_PREDIV
Definition: ew_bsp_clock.c:50
EwBspClockGetCpuLoad
int EwBspClockGetCpuLoad(void)
Returns the current CPU load as percent value.
Definition: ew_bsp_clock.c:395
XTAL_Sec
volatile int XTAL_Sec
Definition: ew_bsp_clock.c:76
SystemCoreClock
uint32_t SystemCoreClock
Definition: system_stm32h7xx.c:119
XTAL_Day
volatile int XTAL_Day
Definition: ew_bsp_clock.c:76
ew_bsp_clock.h
EwBspClockGetTime
unsigned long EwBspClockGetTime(void)
Returns the current time in seconds since 01.01.1970.
Definition: ew_bsp_clock.c:257
PeriphClkInitStruct
static RCC_PeriphCLKInitTypeDef PeriphClkInitStruct
Definition: ew_bsp_display.c:94
HAL_RTC_MspDeInit
void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc)
RTC MSP De-Initialization This function frees the hardware resources used in this example:
Definition: ew_bsp_clock.c:188
ewconfig.h
This file contains general configuration settings for the target system, like memory ranges and displ...
EmWiSystemTicks
static volatile unsigned long EmWiSystemTicks
Definition: ew_bsp_clock.c:71
EwBspClockCpuLoadSetActive
void EwBspClockCpuLoadSetActive(void)
Starts the CPU load counting. Call this function whenever CPU processing is needed.
Definition: ew_bsp_clock.c:422
EwBspClockTickIncrement
void EwBspClockTickIncrement(void)
The function EwBspClockTickIncrement increments the millisecond counter, which is used by the Runtime...
Definition: ew_bsp_clock.c:232
XTAL_Month
volatile int XTAL_Month
Definition: ew_bsp_clock.c:76
EwBspClockCpuLoadSetIdle
void EwBspClockCpuLoadSetIdle(void)
Stops the CPU load counting. Call this function whenever CPU processing is currently not needed since...
Definition: ew_bsp_clock.c:445
XTAL_Hour
volatile int XTAL_Hour
Definition: ew_bsp_clock.c:76
RTC_SYNCH_PREDIV
#define RTC_SYNCH_PREDIV
Definition: ew_bsp_clock.c:51
XTAL_Year
volatile int XTAL_Year
Definition: ew_bsp_clock.c:77
RtcTicksPerMinute
#define RtcTicksPerMinute
Definition: ew_bsp_clock.c:60