comparison g23m-glue/cst/cst_csf.c @ 0:75a11d740a02

initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 09 Jun 2016 00:02:41 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:75a11d740a02
1 /*
2 +-------------------------------------------------------------------+
3 | PROJECT: GSM-F&D (8411) $Workfile:: cst_csf.c $|
4 | $Author:: Be $ CONDAT GmbH $Revision:: 7 $|
5 | CREATED: 01.02.99 $Modtime:: 1.12.99 13:16 $|
6 | STATE : code |
7 +--------------------------------------------------------------------+
8
9
10 MODULE : CST_CSF
11
12 PURPOSE : This Modul defines the custom specific functionalitys
13 for the entity CST.
14 */
15
16 #ifndef CST_CSF_C
17 #define CST_CSF_C
18 #endif
19
20 #include "config.h"
21 #include "fixedconf.h"
22 #include "condat-features.h"
23
24 #define ENTITY_CST
25
26 /*==== INCLUDES ===================================================*/
27
28 #include <string.h>
29 #include "typedefs.h"
30 #include "vsi.h"
31 #include "gsm.h"
32 #include "p_cst.h"
33 #include "cst.h"
34
35 /*==== CONSTANTS ==================================================*/
36
37 /*==== TYPES ======================================================*/
38
39 /*==== EXPORT =====================================================*/
40
41 /*==== VARIABLES ==================================================*/
42
43 LOCAL USHORT ADC_CONVERSIONS[9];
44
45 /*==== FUNCTIONS ==================================================*/
46
47 #ifdef ALR
48 extern void madc_hex_2_physical (USHORT *adc_hex, USHORT *adc_phy);
49 #endif
50
51 #if (BOARD==34)
52 extern inline unsigned char GC_GetAdcInfo(void);
53 #endif
54
55 /*
56 +--------------------------------------------------------------------+
57 | PROJECT : XXX MODULE : CST_CSF |
58 | STATE : code ROUTINE : csf_adc_start |
59 +--------------------------------------------------------------------+
60
61 PURPOSE : This function sends a primitive to L1A to activate the ADC */
62
63
64 GLOBAL void csf_adc_start (UBYTE tx_flag, UBYTE traffic_period, UBYTE idle_period)
65 {
66
67 // This structure and the #define have to be implemented in the MMI.
68 // This is a temporary location for test !!!!!!!
69 // TO BE REMOVED BY USER
70 typedef struct
71 {
72 UBYTE tx_flag;
73 UBYTE traffic_period;
74 UBYTE idle_period;
75 }
76 T_MMI_ADC_REQ;
77
78 #define MMI_ADC_REQ (111)
79
80
81 PALLOC(adc_req, MMI_ADC_REQ);
82
83 adc_req->tx_flag = tx_flag;
84 adc_req->traffic_period = traffic_period;
85 adc_req->idle_period = idle_period;
86
87 PSENDX (L1, adc_req);
88
89 }
90
91
92 /*
93 +--------------------------------------------------------------------+
94 | PROJECT : XXX MODULE : CST_CSF |
95 | STATE : code ROUTINE : csf_adc_process |
96 +--------------------------------------------------------------------+
97
98 PURPOSE : This function processes ADC results. It stores 10 consecutive
99 results in an array.
100 */
101
102
103 GLOBAL void csf_adc_process (T_CST_ADC_IND *adc_results)
104 {
105 #ifdef ALR
106 volatile USHORT adc_converted[9];
107 #endif
108
109 #ifdef ALR
110 /* convert adc value into physical values */
111 madc_hex_2_physical (adc_results->adc_values, (USHORT*) adc_converted);
112
113 ADC_CONVERSIONS[0] = adc_converted[0]; /* Battery Voltage */
114 ADC_CONVERSIONS[1] = adc_converted[1]; /* Charger Voltage */
115 ADC_CONVERSIONS[2] = adc_converted[2]; /* I Charger */
116 ADC_CONVERSIONS[3] = adc_converted[3]; /* I Charger */
117 ADC_CONVERSIONS[4] = adc_converted[4]; /* Battery Type */
118 ADC_CONVERSIONS[5] = adc_converted[5]; /* Battery Temperature */
119 ADC_CONVERSIONS[6] = adc_converted[6]; /* RF temperature */
120 ADC_CONVERSIONS[7] = adc_converted[7]; /* Touch Screen X */
121 ADC_CONVERSIONS[8] = adc_converted[8]; /* Touch Screen Y */
122 #else
123 ADC_CONVERSIONS[0] = adc_results->adc_values[0];
124 ADC_CONVERSIONS[1] = adc_results->adc_values[1];
125 ADC_CONVERSIONS[2] = adc_results->adc_values[2];
126 ADC_CONVERSIONS[3] = adc_results->adc_values[3];
127 ADC_CONVERSIONS[4] = adc_results->adc_values[4];
128 #endif
129
130 // WCS Patch :Avenger 2 uses adc index 5 to store battery informations bit field
131 #if (BOARD == 34)
132 ADC_CONVERSIONS[5] = GC_GetAdcInfo();
133 #endif
134
135 PFREE (adc_results);
136 }
137
138
139 /*
140 +--------------------------------------------------------------------+
141 | PROJECT : XXX MODULE : CST_CSF |
142 | STATE : code ROUTINE : csf_aec_enable |
143 +--------------------------------------------------------------------+
144
145 PURPOSE : This function sends a primitive to L1A to activate the AEC */
146
147
148 GLOBAL void csf_aec_enable (USHORT aec_ctrl_reg)
149 {
150
151 // This structure and the #define have to be implemented in the MMI.
152 // This is a temporary location for test !!!!!!!
153 // TO BE REMOVED BY USER
154 typedef struct
155 {
156 USHORT aec_control;
157 }
158 T_MMI_AEC_REQ;
159
160 #define MMI_AEC_REQ ( ( ( 0x18 ) << 8 ) | 40 )
161
162 PALLOC(aec_req, MMI_AEC_REQ);
163
164 aec_req->aec_control = aec_ctrl_reg;
165
166 PSENDX (L1, aec_req);
167 }
168
169
170 /*
171 Returns the ADC conversions results array
172 */
173
174 GLOBAL USHORT * csf_return_adc (void)
175 {
176 return &(ADC_CONVERSIONS[0]);
177 }
178
179
180
181 #ifdef ALR
182 /*
183 +--------------------------------------------------------------------+
184 | PROJECT : GSM-PS (8403) MODULE : CST_CSF |
185 | STATE : code ROUTINE : csf_vm_record |
186 +--------------------------------------------------------------------+
187
188 PURPOSE : activate the Voice Memo recording process for a ten seconds duration
189
190 */
191
192 GLOBAL void csf_vm_record (CHAR *output, UBYTE vm_flash_index)
193 {
194 // Dummy function
195 }
196
197
198
199
200 /*
201 +--------------------------------------------------------------------+
202 | PROJECT : GSM-PS (8403) MODULE : CST_CSF |
203 | STATE : code ROUTINE : csf_vm_play |
204 +--------------------------------------------------------------------+
205
206 PURPOSE : activate the Voice Memo playing process
207
208 */
209
210 GLOBAL void csf_vm_play (CHAR *output, UBYTE vm_flash_index)
211 {
212 // Dummy function
213 }
214 #endif