FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/g23m-glue/gdi/rtc.c @ 932:79657f9c5772
compal-flash-boot-for-fc created
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sat, 31 Oct 2015 03:04:03 +0000 |
parents | 60a08fe672d8 |
children |
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 |
840 | 29 #include "config.h" |
30 #include "fixedconf.h" | |
31 #include "condat-features.h" | |
32 | |
831
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 #include <string.h> |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 #include "typedefs.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 #include "vsi.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 #include "custom.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 #include "prim.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 #include "gsm.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 #include "tok.h" |
840 | 40 #include "../cst/cst.h" |
831
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 #include "gdi.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 #include "rtc.h" |
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 #ifdef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 #define _WINDOWS |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 #endif |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 |
840 | 48 #include "../../riviera/rvf/rvf_api.h" |
831
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 #ifndef _SIMULATION_ |
840 | 51 #include "../../bsp/rtc/rtc_api.h" |
831
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 #endif |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 #include "rtcdrv.h" |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 /*==== EXPORT =====================================================*/ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 /*==== VARIABLES ==================================================*/ |
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 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 |
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 | 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
|
62 | 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
|
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 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
|
66 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 BOOL rtc_clock_cleared() |
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 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 return RTC_RtcReset(); |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 #endif /* _SIMULATION_ */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 } |
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 | 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
|
78 | 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
|
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 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
|
82 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 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
|
86 { |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 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
|
89 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 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
|
91 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
|
92 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
|
93 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
|
94 else |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 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
|
96 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
|
97 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
|
98 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
|
99 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
|
100 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
|
101 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
|
102 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
|
103 else |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 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
|
105 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 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
|
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 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
|
110 #endif /* _SIMULATION_ */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 } |
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 | 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
|
116 | 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
|
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 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
|
120 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 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
|
124 { |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
125 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 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
|
127 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 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
|
129 DRV_INTERNAL_ERROR; /*error*/ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 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
|
131 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
|
132 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
|
133 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 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
|
135 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
|
136 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
|
137 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
|
138 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
|
139 else |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 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
|
141 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
|
142 return DRV_OK; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 #endif /* _SIMULATION_ */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
144 } |
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 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
|
147 { |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
148 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
|
149 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 } |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
151 |
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 | 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
|
155 | 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
|
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 PURPOSE : set the alarm |
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 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
161 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
162 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
|
163 { |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
164 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
165 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
|
166 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
|
167 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
168 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
|
169 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
170 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
171 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
|
172 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
|
173 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
|
174 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
|
175 else |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
176 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
|
177 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
|
178 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
|
179 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
|
180 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
|
181 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
|
182 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
|
183 else |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
184 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
|
185 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
186 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
|
187 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
|
188 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
|
189 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
|
190 #endif /* _SIMULATION_ */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
191 } |
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 | 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
|
195 | 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
|
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 PURPOSE : retrieve alarm setting |
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 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
201 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
202 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
|
203 { |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
204 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
205 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
|
206 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
207 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
|
208 DRV_INTERNAL_ERROR; /*ERROR*/ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
209 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
|
210 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
|
211 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
|
212 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
213 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
|
214 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
|
215 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
|
216 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
|
217 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
|
218 else |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
219 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
|
220 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
|
221 return DRV_OK; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
222 #endif /* _SIMULATION_ */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
223 } |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
224 |
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 | 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
|
228 | 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
|
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 PURPOSE : 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 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
234 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
235 UBYTE rtc_unset_alarm() |
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 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
238 return RTC_UnsetAlarm(); |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
239 #endif /* _SIMULATION_ */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
240 } |
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 | 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
|
244 | 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
|
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 PURPOSE : unset alarm |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
248 |
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 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
251 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
|
252 { BOOL twelve_hour; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
253 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
254 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
255 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
|
256 twelve_hour = TRUE; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
257 else |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
258 twelve_hour = FALSE; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
259 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
260 RTC_Set12HourMode(twelve_hour); |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
261 #endif /* _SIMULATION_ */ |
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 return DRV_OK; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
264 } |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
265 |
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 | 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
|
269 | 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
|
270 +--------------------------------------------------------------------+ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
271 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
272 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
|
273 and is backawrd compatible |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
274 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
|
275 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
|
276 */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
277 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
278 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
|
279 { |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
280 #ifndef _SIMULATION_ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
281 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
|
282 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
|
283 return ( FALSE ); |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
284 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
285 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
286 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
287 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
|
288 return FALSE; |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
289 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
|
290 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
|
291 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
|
292 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
293 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
|
294 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
|
295 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
|
296 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
297 #endif /* _SIMULATION_ */ |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
298 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
299 return ( TRUE ); |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
300 } |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
301 |
549b7ac60300
gsm-fw/g23m-glue/gdi/*.c: import from Leonardo source
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
302 #endif /* #ifndef DRV_RTC_C */ |