comparison chipsetsw/services/cst/cst_csf.c @ 0:509db1a7b7b8

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