1 |
|
|
/**************************************************************************/ |
2 |
|
|
/* */ |
3 |
|
|
/* Copyright (c) Microsoft Corporation. All rights reserved. */ |
4 |
|
|
/* */ |
5 |
|
|
/* This software is licensed under the Microsoft Software License */ |
6 |
|
|
/* Terms for Microsoft Azure RTOS. Full text of the license can be */ |
7 |
|
|
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ |
8 |
|
|
/* and in the root directory of this software. */ |
9 |
|
|
/* */ |
10 |
|
|
/**************************************************************************/ |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/**************************************************************************/ |
15 |
|
|
/** */ |
16 |
|
|
/** FileX Component */ |
17 |
|
|
/** */ |
18 |
|
|
/** System */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
/**************************************************************************/ |
22 |
|
|
|
23 |
|
|
#define FX_SOURCE_CODE |
24 |
|
|
|
25 |
|
|
|
26 |
|
|
/* Include necessary system files. */ |
27 |
|
|
|
28 |
|
|
#include "fx_api.h" |
29 |
|
|
#include "fx_system.h" |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _fx_system_time_get PORTABLE C */ |
37 |
|
|
/* 6.1.7 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* William E. Lamie, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This function returns the current contents of the system time in */ |
45 |
|
|
/* the fields specified by the caller. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* hour Pointer to hour */ |
50 |
|
|
/* minute Pointer to minute */ |
51 |
|
|
/* second Pointer to second */ |
52 |
|
|
/* */ |
53 |
|
|
/* OUTPUT */ |
54 |
|
|
/* */ |
55 |
|
|
/* FX_SUCCESS */ |
56 |
|
|
/* */ |
57 |
|
|
/* CALLS */ |
58 |
|
|
/* */ |
59 |
|
|
/* None */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLED BY */ |
62 |
|
|
/* */ |
63 |
|
|
/* Application Code */ |
64 |
|
|
/* */ |
65 |
|
|
/* RELEASE HISTORY */ |
66 |
|
|
/* */ |
67 |
|
|
/* DATE NAME DESCRIPTION */ |
68 |
|
|
/* */ |
69 |
|
|
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ |
70 |
|
|
/* 09-30-2020 William E. Lamie Modified comment(s), */ |
71 |
|
|
/* resulting in version 6.1 */ |
72 |
|
|
/* 06-02-2021 William E. Lamie Modified comment(s), */ |
73 |
|
|
/* checked null pointer, */ |
74 |
|
|
/* resulting in version 6.1.7 */ |
75 |
|
|
/* */ |
76 |
|
|
/**************************************************************************/ |
77 |
|
2 |
UINT _fx_system_time_get(UINT *hour, UINT *minute, UINT *second) |
78 |
|
|
{ |
79 |
|
|
|
80 |
|
|
UINT time; |
81 |
|
|
|
82 |
|
|
|
83 |
|
|
/* Get a copy of the current system time. */ |
84 |
|
2 |
time = _fx_system_time; |
85 |
|
|
|
86 |
|
|
/* Check to see if the hour is required. */ |
87 |
✓✓ |
2 |
if (hour) |
88 |
|
|
{ |
89 |
|
|
|
90 |
|
|
/* Pickup the hour. */ |
91 |
|
1 |
*hour = (time >> FX_HOUR_SHIFT) & FX_HOUR_MASK; |
92 |
|
|
} |
93 |
|
|
|
94 |
|
|
/* Check to see if the minute is required. */ |
95 |
✓✓ |
2 |
if (minute) |
96 |
|
|
{ |
97 |
|
|
|
98 |
|
|
/* Pickup the minute. */ |
99 |
|
1 |
*minute = (time >> FX_MINUTE_SHIFT) & FX_MINUTE_MASK; |
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
/* Check to see if the second is required. */ |
103 |
✓✓ |
2 |
if (second) |
104 |
|
|
{ |
105 |
|
|
|
106 |
|
|
/* Pickup the second. */ |
107 |
|
1 |
*second = (time & FX_SECOND_MASK) * 2; |
108 |
|
|
} |
109 |
|
|
|
110 |
|
|
/* If trace is enabled, insert this event into the trace buffer. */ |
111 |
|
|
if (hour && minute && second) |
112 |
|
|
{ |
113 |
|
|
FX_TRACE_IN_LINE_INSERT(FX_TRACE_SYSTEM_TIME_GET, *hour, *minute, *second, 0, FX_TRACE_INTERNAL_EVENTS, 0, 0) |
114 |
|
|
} |
115 |
|
|
|
116 |
|
|
/* Return successful status. */ |
117 |
|
2 |
return(FX_SUCCESS); |
118 |
|
|
} |
119 |
|
|
|