Select one of the symbols to view example projects that use it.
 
Outline
...
...
...
...
#define FX_SOURCE_CODE
#include "fx_api.h"
#include "fx_system.h"
...
...
_fx_system_timer_entry(ULONG)
Files
loading...
CodeScopeSTM32 Libraries and Samplesfilexcommon/src/fx_system_timer_entry.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/**************************************************************************/ /* */ /* Copyright (c) Microsoft Corporation. All rights reserved. */ /* */ /* This software is licensed under the Microsoft Software License */ /* Terms for Microsoft Azure RTOS. Full text of the license can be */ /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ /* and in the root directory of this software. */ /* */... /**************************************************************************/ ... /**************************************************************************/ /**************************************************************************/ /** */ /** FileX Component */ /** */ /** System */ /** */... /**************************************************************************/ /**************************************************************************/ #define FX_SOURCE_CODE /* Include necessary system files. */ #include "fx_api.h" #include "fx_system.h" ... /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _fx_system_timer_entry PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function is FileX system timer function. It is called at the */ /* rate specified by FX_UPDATE_RATE_IN_SECONDS and is responsible for */ /* maintaining both the system date and time. */ /* */ /* INPUT */ /* */ /* id Not used */ /* */ /* OUTPUT */ /* */ /* None */ /* */ /* CALLS */ /* */ /* None */ /* */ /* CALLED BY */ /* */ /* Application Initialization */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ /* */... /**************************************************************************/ VOID _fx_system_timer_entry(ULONG id) { UINT second; UINT minute; UINT hour; UINT day; UINT month; UINT year; /* Determine if the ID is valid. */ if (id == FX_TIMER_ID) { /* Break the current date time into separate fields for easier work! */ second = (_fx_system_time & FX_SECOND_MASK) * 2; minute = (_fx_system_time >> FX_MINUTE_SHIFT) & FX_MINUTE_MASK; hour = (_fx_system_time >> FX_HOUR_SHIFT) & FX_HOUR_MASK; day = _fx_system_date & FX_DAY_MASK; month = (_fx_system_date >> FX_MONTH_SHIFT) & FX_MONTH_MASK; year = ((_fx_system_date >> FX_YEAR_SHIFT) & FX_YEAR_MASK) + FX_BASE_YEAR; /* Now apply the "second" update. */ second = second + FX_UPDATE_RATE_IN_SECONDS; /* Determine if we need to adjust the minute field. */ if (second > FX_MAXIMUM_SECOND) { /* Yes, we need to adjust the minute field. */ minute = minute + second / 60; second = second % 60; /* Determine if we need to adjust the hour field. */ if (minute > FX_MAXIMUM_MINUTE) { /* Yes, we need to adjust the hour field. */ hour = hour + minute / 60; minute = minute % 60; /* Determine if we need to adjust the day field. */ if (hour > FX_MAXIMUM_HOUR) { /* Yes, we need to adjust the day field. */ hour = 0; day++; /* Determine if we need to adjust the month field. */ switch (month) { case 1: /* January */ { /* Check for end of the month. */ if (day > 31) { /* Move to next month. */ day = 1; month++; }if (day > 31) { ... } break; ...} case 1: case 2: /* February */ { /* Check for leap year. We don't need to check for leap century her (century years divisible by 400) since 2000 is and this FAT format only supports years to 2107. *//* ... */ if ((year % 4) == 0) { /* Leap year in February... check for 29 days instead of 28. *//* ... */ if (day > 29) { /* Adjust the month. */ day = 1; month++; }if (day > 29) { ... } }if ((year % 4) == 0) { ... } else { if (day > 28) { /* Adjust the month. */ day = 1; month++; }if (day > 28) { ... } }else { ... } break; ...} case 2: case 3: /* March */ { /* Check for end of the month. */ if (day > 31) { /* Move to next month. */ day = 1; month++; }if (day > 31) { ... } break; ...} case 3: case 4: /* April */ { /* Check for end of the month. */ if (day > 30) { /* Move to next month. */ day = 1; month++; }if (day > 30) { ... } break; ...} case 4: case 5: /* May */ { /* Check for end of the month. */ if (day > 31) { /* Move to next month. */ day = 1; month++; }if (day > 31) { ... } break; ...} case 5: case 6: /* June */ { /* Check for end of the month. */ if (day > 30) { /* Move to next month. */ day = 1; month++; }if (day > 30) { ... } break; ...} case 6: case 7: /* July */ { /* Check for end of the month. */ if (day > 31) { /* Move to next month. */ day = 1; month++; }if (day > 31) { ... } break; ...} case 7: case 8: /* August */ { /* Check for end of the month. */ if (day > 31) { /* Move to next month. */ day = 1; month++; }if (day > 31) { ... } break; ...} case 8: case 9: /* September */ { /* Check for end of the month. */ if (day > 30) { /* Move to next month. */ day = 1; month++; }if (day > 30) { ... } break; ...} case 9: case 10: /* October */ { /* Check for end of the month. */ if (day > 31) { /* Move to next month. */ day = 1; month++; }if (day > 31) { ... } break; ...} case 10: case 11: /* November */ { /* Check for end of the month. */ if (day > 30) { /* Move to next month. */ day = 1; month++; }if (day > 30) { ... } break; ...} case 11: case 12: /* December */ { /* Check for end of the month. */ if (day > 31) { /* Move to next month. */ day = 1; month = 1; /* Also move to next year. */ year++; /* Check for a year that exceeds the representation in this format. *//* ... */ if (year > FX_MAXIMUM_YEAR) { return; }if (year > FX_MAXIMUM_YEAR) { ... } }if (day > 31) { ... } break; ...} case 12: default: /* Invalid month! */ return; /* Skip updating date/time! */default }switch (month) { ... } }if (hour > FX_MAXIMUM_HOUR) { ... } }if (minute > FX_MAXIMUM_MINUTE) { ... } }if (second > FX_MAXIMUM_SECOND) { ... } /* Now apply the new setting to the internal representation. */ /* Set the system date. */ _fx_system_date = ((year - FX_BASE_YEAR) << FX_YEAR_SHIFT) | (month << FX_MONTH_SHIFT) | day; /* Set the new system time. */ _fx_system_time = (hour << FX_HOUR_SHIFT) | (minute << FX_MINUTE_SHIFT) | (second / 2); }if (id == FX_TIMER_ID) { ... } }{ ... }