zmaee_gps.c
7.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
#ifdef __ZMAEE_APP__
#include "zmaee_priv.h"
#include "med_utility.h"
#include "zmaee_typedef.h"
#include "gdi_include.h"
#include "zmaee_idle_clock.h"
#include "gui.h"
typedef int S32;
#ifdef ZMAEE_USE_CACHE_MEMORY
extern void zmaee_cache_free_cb(void *mem_ptr);
#endif
int ZMAEE_IGps_New(ZM_AEECLSID clsId,void **ppobj)
{
*ppobj = NULL;
return E_ZM_AEE_CLASSNOTSUPPORT;
}
#if defined(__ZMAEE_IDLE_CLOCK_USE_MY_PIC__) || defined(__ZMAEE_IDLE_CALCULATOR_USE_MY_PIC__)
void* zmaee_gps_malloc(int size)
{
void* pBuf = NULL;
#ifdef __MED_IN_ASM__
if(applib_mem_ap_get_max_alloc_size() < size)
return NULL;
#ifdef ZMAEE_USE_CACHE_MEMORY
return applib_mem_ap_cache_alloc(size, zmaee_cache_free_cb);
#else
return applib_mem_ap_alloc_framebuffer(VAPP_ZMAEEPLAT, size);
#endif
#else
kal_prompt_trace(LAST_MOD_ID, "zmaee_gbhw_malloc.....size=%d, max=%d", size, ZMAEE_GetMaxAllocMedMem());
if( ZMAEE_GetMaxAllocMedMem() < size )
return NULL;
#ifdef ZMAEE_USE_CACHE_MEMORY
pBuf = med_alloc_ext_mem_cacheable(size);
#else
pBuf = med_alloc_ext_mem( size );
#endif
#endif
kal_prompt_trace(LAST_MOD_ID, "zmaee_gbhw_malloc.....buf=%x", pBuf);
return pBuf;
}
void zmaee_gps_free(void *ptr)
{
#ifdef __MED_IN_ASM__
#ifdef ZMAEE_USE_CACHE_MEMORY
applib_mem_ap_cache_free(ptr);
#else
applib_mem_ap_free(ptr);
#endif
#else
#ifdef ZMAEE_USE_CACHE_MEMORY
med_free_ext_mem(&ptr);
#else
med_free_ext_mem(&ptr);
#endif
#endif
}
void zmaee_measure_image_clock(unsigned char idx, int* nWidth, int* nHeight)
{
#if 1
if(idx == 'c')
{
*nWidth = 240;
*nHeight = 242;
}
else
{
*nWidth = 41;
*nHeight = 57;
}
#else
switch(idx)
{
case '0':
gui_measure_image((unsigned char*)sg_zmaee_pic_clock_num0, nWidth, nHeight);
break;
case '1':
gui_measure_image((unsigned char*)sg_zmaee_pic_clock_num1, nWidth, nHeight);
break;
case '2':
gui_measure_image((unsigned char*)sg_zmaee_pic_clock_num2, nWidth, nHeight);
break;
case '3':
gui_measure_image((unsigned char*)sg_zmaee_pic_clock_num3, nWidth, nHeight);
break;
case '4':
gui_measure_image((unsigned char*)sg_zmaee_pic_clock_num4, nWidth, nHeight);
break;
case '5':
gui_measure_image((unsigned char*)sg_zmaee_pic_clock_num5, nWidth, nHeight);
break;
case '6':
gui_measure_image((unsigned char*)sg_zmaee_pic_clock_num6, nWidth, nHeight);
break;
case '7':
gui_measure_image((unsigned char*)sg_zmaee_pic_clock_num7, nWidth, nHeight);
break;
case '8':
gui_measure_image((unsigned char*)sg_zmaee_pic_clock_num8, nWidth, nHeight);
break;
case '9':
gui_measure_image((unsigned char*)sg_zmaee_pic_clock_num9, nWidth, nHeight);
break;
case 'c'://计算器
gui_measure_image((unsigned char*)sg_zmaee_calc_bgimg_rom, nWidth, nHeight);
break;
default:
break;
}
#endif
}
void zmaee_draw_image_clock(unsigned char idx, int x, int y, int nWidth, int nHeight)
{
#if defined(__ZMAEE_IDLE_CALCULATOR_USE_MY_PIC__) || defined(__ZMAEE_IDLE_CLOCK_USE_MY_PIC__)
zm_extern int ZMAEE_IShell_CreateInstance(AEE_IShell * po, ZM_AEECLSID clsId, void** ppobj);
zm_extern AEE_IShell* ZMAEE_GetShell(void);
AEE_IDisplay* pDisplay = NULL;
AEE_IImage* pImage = NULL;
ZMAEE_IShell_CreateInstance(ZMAEE_GetShell(), ZM_AEE_CLSID_DISPLAY, (void**)&pDisplay);
ZMAEE_IDisplay_CreateImage(pDisplay, zmaee_gps_malloc, zmaee_gps_free, (void**)&pImage);
switch(idx)
{
#ifdef __ZMAEE_IDLE_CLOCK_USE_MY_PIC__
case '0':
ZMAEE_IImage_SetData(pImage, 1, sg_zmaee_pic_clock_num0, sizeof(sg_zmaee_pic_clock_num0));
break;
case '1':
ZMAEE_IImage_SetData(pImage, 1, sg_zmaee_pic_clock_num1, sizeof(sg_zmaee_pic_clock_num1));
break;
case '2':
ZMAEE_IImage_SetData(pImage, 1, sg_zmaee_pic_clock_num2, sizeof(sg_zmaee_pic_clock_num2));
break;
case '3':
ZMAEE_IImage_SetData(pImage, 1, sg_zmaee_pic_clock_num3, sizeof(sg_zmaee_pic_clock_num3));
break;
case '4':
ZMAEE_IImage_SetData(pImage, 1, sg_zmaee_pic_clock_num4, sizeof(sg_zmaee_pic_clock_num4));
break;
case '5':
ZMAEE_IImage_SetData(pImage, 1, sg_zmaee_pic_clock_num5, sizeof(sg_zmaee_pic_clock_num5));
break;
case '6':
ZMAEE_IImage_SetData(pImage, 1, sg_zmaee_pic_clock_num6, sizeof(sg_zmaee_pic_clock_num6));
break;
case '7':
ZMAEE_IImage_SetData(pImage, 1, sg_zmaee_pic_clock_num7, sizeof(sg_zmaee_pic_clock_num7));
break;
case '8':
ZMAEE_IImage_SetData(pImage, 1, sg_zmaee_pic_clock_num8, sizeof(sg_zmaee_pic_clock_num8));
break;
case '9':
ZMAEE_IImage_SetData(pImage, 1, sg_zmaee_pic_clock_num9, sizeof(sg_zmaee_pic_clock_num9));
break;
#endif
#ifdef __ZMAEE_IDLE_CALCULATOR_USE_MY_PIC__
case 'c'://计算器
ZMAEE_IImage_SetData(pImage, 1, sg_zmaee_calc_bgimg_rom, sizeof(sg_zmaee_calc_bgimg_rom));
break;
#endif
default:
break;
}
ZMAEE_IDisplay_DrawImage(pDisplay, x, y, pImage, 0);
ZMAEE_IImage_Release(pImage);
ZMAEE_IDisplay_Release(pDisplay);
#endif
}
#endif//__ZMAEE_IDLE_CLOCK_USE_MY_PIC__
#ifdef __MMI_TOUCH_SCREEN__
#if !defined(__MMI_GUOBI_HW__)
#if 0 //ndef __MMI_GUOBI_HANDWRITING__ // 当手写关闭时,已经有别处定义,此处关闭,后续看是否有问题, Fuzhong 修改 2015-5-7
int GBGetWinguoVerificationCode(void)
{
return 0;
}
#endif
#endif
#endif
#ifdef __MMI_GUOBI_HANDWRITING__
/**
* 精简版国笔
*/
const unsigned char zmaee_prv_hw_data[] = {
#include "zmaee_gb_hw.h"
};
void* zmaee_gbhw_malloc(int size)
{
void* pBuf = NULL;
#ifdef __MED_IN_ASM__
if(applib_mem_ap_get_max_alloc_size() < size)
return NULL;
#ifdef ZMAEE_USE_CACHE_MEMORY
return applib_mem_ap_cache_alloc(size, zmaee_cache_free_cb);
#else
return applib_mem_ap_alloc_framebuffer(VAPP_ZMAEEPLAT, size);
#endif
#else
kal_prompt_trace(LAST_MOD_ID, "zmaee_gbhw_malloc.....size=%d, max=%d", size, ZMAEE_GetMaxAllocMedMem());
if( ZMAEE_GetMaxAllocMedMem() < size )
return NULL;
#ifdef ZMAEE_USE_CACHE_MEMORY
pBuf = med_alloc_ext_mem_cacheable(size);
#else
pBuf = med_alloc_ext_mem( size );
#endif
#endif
kal_prompt_trace(LAST_MOD_ID, "zmaee_gbhw_malloc.....buf=%x", pBuf);
return pBuf;
}
void zmaee_gbhw_free(void *ptr)
{
#ifdef __MED_IN_ASM__
#ifdef ZMAEE_USE_CACHE_MEMORY
applib_mem_ap_cache_free(ptr);
#else
applib_mem_ap_free(ptr);
#endif
#else
#ifdef ZMAEE_USE_CACHE_MEMORY
med_free_ext_mem(&ptr);
#else
med_free_ext_mem(&ptr);
#endif
#endif
}
const unsigned char* zmaee_gbhw_get_data_ptr(void)
{
return zmaee_prv_hw_data;
}
const unsigned int zmaee_gbhw_get_data_size(void)
{
return sizeof(zmaee_prv_hw_data);
}
extern const void* zmaee_gbhw_data_create(void);
extern void zmaee_gbhw_data_destroy(const void *gbhw_data);
extern unsigned long *zmaee_prv_HWDataArray;
void zmaee_imc_connect(void)
{
int ret;
zmaee_prv_HWDataArray = (unsigned long *)zmaee_gbhw_data_create();
kal_prompt_trace(LAST_MOD_ID,"zmaee_imc_connect: ZMAEE_GetMaxAllocMedMem()=%d,zmaee_prv_HWDataArray=%d",ZMAEE_GetMaxAllocMedMem(),zmaee_prv_HWDataArray);
if(zmaee_prv_HWDataArray)
{
ret = GBHWNew((const void*)zmaee_prv_HWDataArray, 0);
}
}
void zmaee_imc_disconnect(void)
{
zmaee_gbhw_data_destroy((const void*)zmaee_prv_HWDataArray);
kal_prompt_trace(LAST_MOD_ID,"zmaee_imc_disconnect......ZMAEE_GetMaxAllocMedMem=%d",ZMAEE_GetMaxAllocMedMem());
}
#else
void* zmaee_gbhw_malloc(int size)
{
return NULL;
}
void zmaee_gbhw_free(void *ptr)
{
}
const unsigned char* zmaee_gbhw_get_data_ptr(void)
{
return NULL;
}
const unsigned int zmaee_gbhw_get_data_size(void)
{
return 0;
}
void zmaee_imc_connect(void)
{
}
void zmaee_imc_disconnect(void)
{
}
#endif
#endif // __ZMAEE_APP__