FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/g23m-glue/gdi/rtc.c @ 839:5ab66dadefdd
gdi: power.c compiles
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Sat, 25 Apr 2015 19:29:38 +0000 |
parents | 549b7ac60300 |
children | 60a08fe672d8 |
rev | line source |
---|---|
831
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 +----------------------------------------------------------------------------- |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 | Project : GSM-PS |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 | Modul : DRV_RTC |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 +----------------------------------------------------------------------------- |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 | Copyright 2002 Texas Instruments Berlin, AG |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 | All rights reserved. |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 | This file is confidential and a trade secret of Texas |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 | Instruments Berlin, AG |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 | The receipt of or possession of this file does not convey |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 | any rights to reproduce or disclose its contents or to |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 | manufacture, use, or sell anything it may describe, in |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 | whole, or in part, without the specific written consent of |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 | Texas Instruments Berlin, AG. |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 +----------------------------------------------------------------------------- |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 | Purpose : This Module defines the real time clock |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 | driver interface for the G23 protocol stack. |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 MC SPR 1725, re-wrote for new driver |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 +----------------------------------------------------------------------------- |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 #ifndef DRV_RTC_C |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 #define DRV_RTC_C |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 #define ENTITY_CST |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 /*==== INCLUDES ===================================================*/ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 #include <string.h> |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 #include "typedefs.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 #include "vsi.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 #include "custom.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 #include "prim.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 #include "gsm.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 #include "tok.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 #include "cst/cst.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 #include "gdi.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 #include "rtc.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 #ifdef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 #define _WINDOWS |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 #endif |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 #include "rvf/rvf_api.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 #include "rtc/rtc_api.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 #endif |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 #include "rtcdrv.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 /*==== EXPORT =====================================================*/ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 /*==== VARIABLES ==================================================*/ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 /* |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 | PROJECT : GSM-PS (6103) MODULE : DRV_RTC | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 | STATE : code ROUTINE : rtc_clock_cleared | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 PURPOSE : returns true if clcok has been reset |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 BOOL rtc_clock_cleared() |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 { |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 return RTC_RtcReset(); |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 #endif /* _SIMULATION_ */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 } |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 /* |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 | PROJECT : GSM-PS (6103) MODULE : DRV_RTC | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 | STATE : code ROUTINE : rtc_set_time_date | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 PURPOSE : set the time and date |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 UBYTE rtc_set_time_date(T_RTC_DATE* date, T_RTC_TIME* time ) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 { |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 T_RTC_DATE_TIME time_and_date; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 time_and_date.second = 0; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 time_and_date.minute = time->minute; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 if (time->format== RTC_TIME_FORMAT_12HOUR) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 time_and_date.hour = (time->hour)% 12; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 else |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 time_and_date.hour = time->hour; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 time_and_date.second= time->second; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 time_and_date.day = date->day; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 time_and_date.month = date->month; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 time_and_date.wday = 3; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 time_and_date.year = (date->year - 2000) %100; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 if (time->format== RTC_TIME_FORMAT_12HOUR) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 time_and_date.mode_12_hour = TRUE; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 else |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 time_and_date.mode_12_hour = FALSE; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 time_and_date.PM_flag = time->PM_flag % 2; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 return RTC_SetDateTime(time_and_date); |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 #endif /* _SIMULATION_ */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 } |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 /* |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 | PROJECT : GSM-PS (6103) MODULE : DRV_RTC | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 | STATE : code ROUTINE : rtc_get_time_date | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 PURPOSE : get the time and date |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 UBYTE rtc_get_time_date(T_RTC_DATE* date , T_RTC_TIME* time) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 { |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 T_RTC_DATE_TIME time_and_date; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
124 if (RTC_GetDateTime(&time_and_date) != RVF_OK) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
125 DRV_INTERNAL_ERROR; /*error*/ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 date->year = 2000+ time_and_date.year; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 date->month = time_and_date.month; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 date->day = time_and_date.day; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 time->minute = time_and_date.minute; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 time->hour = time_and_date.hour; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
132 time->second = time_and_date.second; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 if ( time_and_date.mode_12_hour == TRUE) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 time->format = RTC_TIME_FORMAT_12HOUR; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
135 else |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
136 time->format = RTC_TIME_FORMAT_24HOUR; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 time->PM_flag = time_and_date.PM_flag; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 return DRV_OK; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 #endif /* _SIMULATION_ */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 } |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 void empty_callback_func(void* data) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 { |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
144 TRACE_EVENT("empty_callback_func"); |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
145 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
146 } |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
147 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
148 /* |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
149 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 | PROJECT : GSM-PS (6103) MODULE : DRV_RTC | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
151 | STATE : code ROUTINE : rtc_set_alarm | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
152 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
153 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
154 PURPOSE : set the alarm |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
155 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
156 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
157 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
158 UBYTE rtc_set_alarm(T_RTC_DATE* date , T_RTC_TIME* time, RtcCallback callback_func ) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
159 { |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
160 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
161 T_RTC_DATE_TIME time_and_date; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
162 T_RV_RETURN return_path; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
163 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
164 memset(&return_path, 0, sizeof(T_RV_RETURN)); |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
165 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
166 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
167 time_and_date.second = time->second; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
168 time_and_date.minute = time->minute; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
169 if (time->format== RTC_TIME_FORMAT_12HOUR) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
170 time_and_date.hour = (time->hour)% 12; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
171 else |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
172 time_and_date.hour = time->hour; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
173 time_and_date.day = date->day; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
174 time_and_date.month = date->month; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
175 time_and_date.wday = 3; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
176 time_and_date.year = (date->year - 2000) %100; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
177 if (time->format== RTC_TIME_FORMAT_12HOUR) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
178 time_and_date.mode_12_hour = TRUE; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
179 else |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
180 time_and_date.mode_12_hour = FALSE; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
181 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
182 time_and_date.PM_flag = time->PM_flag % 2; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
183 return_path.addr_id = RVF_INVALID_ADDR_ID; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
184 return_path.callback_func = (RtcCallback)callback_func; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
185 return RTC_SetAlarm(time_and_date, return_path); |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
186 #endif /* _SIMULATION_ */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
187 } |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
188 /* |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
189 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
190 | PROJECT : GSM-PS (6103) MODULE : DRV_RTC | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
191 | STATE : code ROUTINE : rtc_get_alarm | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
192 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
193 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
194 PURPOSE : retrieve alarm setting |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
195 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
196 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
197 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
198 UBYTE rtc_get_alarm(T_RTC_DATE* date, T_RTC_TIME* time ) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
199 { |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
200 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
201 T_RTC_DATE_TIME time_and_date; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
202 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
203 if (RTC_GetAlarm(&time_and_date) != RVF_OK) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
204 DRV_INTERNAL_ERROR; /*ERROR*/ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
205 date->year = 2000+ time_and_date.year; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
206 date->month = time_and_date.month; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
207 date->day = time_and_date.day; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
208 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
209 time->second = time_and_date.second; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
210 time->minute = time_and_date.minute; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
211 time->hour = time_and_date.hour; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
212 if ( time_and_date.PM_flag == TRUE) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
213 time->format = RTC_TIME_FORMAT_12HOUR; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
214 else |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
215 time->format = RTC_TIME_FORMAT_24HOUR; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
216 time->PM_flag = time_and_date.PM_flag; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
217 return DRV_OK; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
218 #endif /* _SIMULATION_ */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
219 } |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
220 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
221 /* |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
222 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
223 | PROJECT : GSM-PS (6103) MODULE : DRV_RTC | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
224 | STATE : code ROUTINE : rtc_unset_alarm | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
225 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
226 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
227 PURPOSE : unset alarm |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
228 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
229 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
230 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
231 UBYTE rtc_unset_alarm() |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
232 { |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
233 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
234 return RTC_UnsetAlarm(); |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
235 #endif /* _SIMULATION_ */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
236 } |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
237 /* |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
238 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
239 | PROJECT : GSM-PS (6103) MODULE : DRV_RTC | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
240 | STATE : code ROUTINE : rtc_set_time_format | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
241 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
242 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
243 PURPOSE : unset alarm |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
244 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
245 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
246 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
247 UBYTE rtc_set_time_format(T_RTC_TIME_FORMAT format) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
248 { BOOL twelve_hour; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
249 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
250 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
251 if (format == RTC_TIME_FORMAT_12HOUR) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
252 twelve_hour = TRUE; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
253 else |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
254 twelve_hour = FALSE; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
255 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
256 RTC_Set12HourMode(twelve_hour); |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
257 #endif /* _SIMULATION_ */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
258 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
259 return DRV_OK; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
260 } |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
261 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
262 /* |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
263 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
264 | PROJECT : GSM-PS (6103) MODULE : DRV_RTC | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
265 | STATE : code ROUTINE : vmd_primitive | |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
266 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
267 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
268 PURPOSE : This function get the date and time. |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
269 and is backawrd compatible |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
270 if year >= 70 then 19year |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
271 if year < 70 then 20year |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
272 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
273 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
274 GLOBAL UBYTE rtc_read_time ( rtc_time_type *rtc_time ) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
275 { |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
276 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
277 T_RTC_DATE_TIME time_and_date; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
278 if ( rtc_time EQ NULL ) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
279 return ( FALSE ); |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
280 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
281 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
282 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
283 if (RTC_GetDateTime(&time_and_date) != RVF_OK) |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
284 return FALSE; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
285 rtc_time->year = time_and_date.year; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
286 rtc_time->month = time_and_date.month; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
287 rtc_time->day = time_and_date.day; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
288 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
289 rtc_time->minute = time_and_date.minute; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
290 rtc_time->hour = time_and_date.hour; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
291 rtc_time->second = time_and_date.second; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
292 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
293 #endif /* _SIMULATION_ */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
294 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
295 return ( TRUE ); |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
296 } |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
297 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
298 #endif /* #ifndef DRV_RTC_C */ |