This source file includes following definitions.
- gui_bench_init
- gui_bench_draw_results_screen
- gui_bench_draw_results_memory
- gui_bench_draw_results
- gui_bench_draw_results_cpu
- gui_bench_draw_results_text
- write_log
- add_to_log
- add_log_head
- bench_draw_control_txt
- bench_draw_checkbox
- draw_controls
- gui_bench_draw
- getcurrentmachinetime
- get_usec_diff
- bench_screen_write
- bench_screen_read
- bench_mem_write
- bench_mem_read
- bench_measure_text_write
- busyloop_thumb
- bench_measure_cpuspeed
- run_test
- gui_bench_kbd_process
- basic_module_init
1 #include "camera_info.h"
2 #include "keyboard.h"
3 #include "viewport.h"
4 #include "clock.h"
5 #include "raw_buffer.h"
6 #include "lang.h"
7 #include "gui.h"
8 #include "gui_lang.h"
9 #include "gui_draw.h"
10 #include "cachebit.h"
11
12 #include "module_def.h"
13
14
15 #define draw_txt_string(x,y,s,c) draw_string((x)*FONT_WIDTH,(y)*FONT_HEIGHT,s,c)
16 #define draw_txt_stringnonalign(x,y,s,c) draw_string((x)*FONT_WIDTH+1,(y)*FONT_HEIGHT,s,c)
17
18 void gui_bench_draw();
19 void gui_module_menu_kbd_process();
20 int gui_bench_kbd_process();
21
22 gui_handler GUI_MODE_BENCH =
23 { GUI_MODE_MODULE, gui_bench_draw, gui_bench_kbd_process, gui_module_menu_kbd_process, 0, 0 };
24
25
26 static struct {
27 int screen_input_bps;
28 unsigned int screen_input_size;
29 int screen_output_bps;
30 int memory_read_bps;
31 int memory_read_uc_bps;
32 int memory_write_bps;
33 int memory_write_uc_bps;
34 int disk_read_buf_kbps;
35 int disk_write_buf_kbps;
36 int disk_write_raw_kbps;
37 int disk_write_mem_kbps;
38 int cpu_ips;
39 int text_cps;
40 int textnonalign_cps;
41 } bench;
42
43 static char buf[48];
44
45 #define LOGBUFSIZE 1024
46 #define BENCHLOGFILE "A/BENCH.LOG"
47
48 static char txtbuf[LOGBUFSIZE];
49 static int txtbufptr = 0;
50 static int *benchbuf = NULL;
51 static char clearline[48];
52 static int bench_to_run = 0;
53 static int bench_to_draw = 0;
54 static int bench_mode = 0;
55 static int bench_log = 0;
56
57 #define BENCH_ALL 1
58 #define BENCH_NOCARD 2
59
60 #define BENCHTMP "A/BENCH.TMP"
61
62 #define BENCH_CTL_START 0
63 #define BENCH_CTL_LOG 1
64 #define BENCH_CTL_SD 2
65 #define BENCH_CTL_MAX BENCH_CTL_SD
66 static int bench_cur_ctl = BENCH_CTL_START;
67 static int bench_mode_next = BENCH_ALL;
68
69
70 void gui_bench_init() {
71 bench.screen_input_bps=-1;
72 bench.screen_input_size=0;
73 bench.screen_output_bps=-1;
74 bench.memory_read_bps=-1;
75 bench.memory_read_uc_bps=-1;
76 bench.memory_write_bps=-1;
77 bench.memory_write_uc_bps=-1;
78 bench.disk_read_buf_kbps=-1;
79 bench.disk_write_buf_kbps=-1;
80 bench.disk_write_raw_kbps=-1;
81 bench.disk_write_mem_kbps=-1;
82 bench.cpu_ips=-1;
83 bench.text_cps=-1;
84 bench.textnonalign_cps=-1;
85 bench_to_run = 0;
86 bench_mode = 0;
87 bench_to_draw = 1;
88 }
89
90
91 static void gui_bench_draw_results_screen(int pos, int value, int ss) {
92 if (value!=-1) {
93 if (value)
94 sprintf(buf, "%7d Kb/s %3d FPS", value/1024, (ss==0)?0:value/ss);
95 else
96 strcpy(buf, clearline);
97 draw_txt_string(17, pos, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
98 }
99 }
100
101
102 static void gui_bench_draw_results_memory(int pos, int value, int value_uc) {
103 if (value!=-1) {
104 if (value)
105 sprintf(buf, "%7d C, %6d UC Kb/s ", value/1024, value_uc/1024);
106 else
107 strcpy(buf, clearline);
108 draw_txt_string(17, pos, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
109 }
110 }
111
112
113 static void gui_bench_draw_results(int pos, int value) {
114 if (value!=-1) {
115 if (value)
116 sprintf(buf, "%7d Kb/s ", value);
117 else
118 strcpy(buf, clearline);
119 draw_txt_string(17, pos, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
120 }
121 }
122
123
124
125 static void gui_bench_draw_results_cpu(int pos, int value) {
126 if (value!=-1) {
127 if (value)
128 sprintf(buf, "%7d MIPS ", value);
129 else
130 strcpy(buf, clearline);
131 draw_txt_string(17, pos, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
132 }
133 }
134
135
136
137 static void gui_bench_draw_results_text(int pos, int value, int valuen, int ss) {
138 if (value!=-1) {
139 if (value) {
140 int s=(ss==0)?0:FONT_WIDTH*FONT_HEIGHT*value/ss;
141 int sn=(ss==0)?0:FONT_WIDTH*FONT_HEIGHT*valuen/ss;
142 sprintf(buf, " %d, %d c/s %d, %d FPS", value, valuen, s, sn);
143 }
144 else
145 strcpy(buf, clearline);
146 draw_txt_string(17, pos, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
147 }
148 }
149
150
151
152 static void write_log(int really) {
153 if (!really)
154 return;
155 int fd = open(BENCHLOGFILE, O_WRONLY|O_CREAT|O_APPEND, 0777);
156 if (fd >= 0)
157 {
158 lseek(fd, 0, SEEK_END);
159 write(fd, txtbuf, txtbufptr);
160 close(fd);
161 }
162 }
163
164 static void add_to_log(int really, char *title, char *txt) {
165 if ((txtbufptr >= LOGBUFSIZE-48) || !really)
166 return;
167 txtbufptr+=sprintf(txtbuf+txtbufptr,"%s %s\n",title, txt);
168 }
169
170 static void add_log_head(int really) {
171 if ((txtbufptr >= LOGBUFSIZE-200) || !really)
172 return;
173 txtbufptr+=sprintf(txtbuf+txtbufptr,"***\n%s %s r%s\n",camera_info.chdk_ver,camera_info.build_number,camera_info.build_svnrev);
174 txtbufptr+=sprintf(txtbuf+txtbufptr,"Build date: %s %s\n",camera_info.build_date,camera_info.build_time);
175 txtbufptr+=sprintf(txtbuf+txtbufptr,"Camera : %s %s\n",camera_info.platform,camera_info.platformsub);
176 txtbufptr+=sprintf(txtbuf+txtbufptr,"Mode : 0x%x\n\n",camera_info.state.mode);
177 }
178
179 static int bench_draw_control_txt(int pos, const char *s, int active) {
180 twoColors cl;
181 if(active) {
182 cl = user_color(conf.menu_cursor_color);
183 } else {
184 cl = user_color(conf.menu_color);
185 }
186 draw_txt_string(pos, 0, s, cl);
187 return pos+strlen(s);
188 }
189 static int bench_draw_checkbox(int pos, const char *title, int active, int checked) {
190 pos = bench_draw_control_txt(pos,title,active);
191 pos = bench_draw_control_txt(pos," [",active);
192 pos = bench_draw_control_txt(pos,(checked)?"\x95":" ",active);
193 pos = bench_draw_control_txt(pos,"]",active);
194 return pos;
195 }
196 static void draw_controls(void) {
197 int pos = bench_draw_control_txt(1,lang_str(LANG_BENCH_START),bench_cur_ctl == BENCH_CTL_START);
198 pos = bench_draw_checkbox(pos+1,lang_str(LANG_BENCH_LOG),bench_cur_ctl == BENCH_CTL_LOG,bench_log);
199 bench_draw_checkbox(pos+1,lang_str(LANG_BENCH_SDTEST),bench_cur_ctl == BENCH_CTL_SD,bench_mode_next == BENCH_ALL);
200 }
201
202
203
204 static void run_test(int num);
205
206 void gui_bench_draw() {
207 int log_run = 0;
208 switch (bench_to_run) {
209 case 0:
210 break;
211 case 1:
212 benchbuf = malloc(0x10000);
213 txtbufptr = 0;
214
215 case 2:
216 case 3:
217 case 4:
218 case 5:
219 case 7:
220 case 8:
221 case 9:
222 run_test(bench_to_run);
223 bench_to_run++;
224 break;
225 case 6:
226 if (bench_mode!=BENCH_NOCARD) {
227 run_test(bench_to_run);
228 bench_to_run++;
229 break;
230 }
231
232 case 10:
233 run_test(bench_to_run);
234 if (bench_mode!=BENCH_NOCARD) {
235 remove(BENCHTMP);
236 }
237 bench_to_run = 0;
238 bench_mode = 0;
239 bench_to_draw = 1;
240 log_run = 1;
241 if (benchbuf)
242 free(benchbuf);
243 break;
244 }
245 switch (bench_to_draw) {
246 case 1:
247 draw_rectangle(camera_screen.disp_left, 0, camera_screen.disp_right, camera_screen.height-1, MAKE_COLOR(COLOR_BLACK, COLOR_BLACK), RECT_BORDER0|DRAW_FILLED);
248 draw_controls();
249
250 draw_txt_string(1, 2, lang_str(LANG_BENCH_CPU), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
251
252 draw_txt_string(1, 3, lang_str(LANG_BENCH_SCREEN), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
253 draw_txt_string(3, 4, lang_str(LANG_BENCH_WRITE), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
254 draw_txt_string(3, 5, lang_str(LANG_BENCH_READ), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
255
256 draw_txt_string(1, 6, lang_str(LANG_BENCH_MEMORY), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
257 draw_txt_string(3, 7, lang_str(LANG_BENCH_WRITE), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
258 draw_txt_string(3, 8, lang_str(LANG_BENCH_READ), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
259
260 draw_txt_string(1, 9, lang_str(LANG_BENCH_TEXTOUT), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
261
262 draw_txt_string(1, 10, lang_str(LANG_BENCH_FLASH_CARD), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
263 draw_txt_string(3, 11, lang_str(LANG_BENCH_WRITE_RAW), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
264 draw_txt_string(3, 12, lang_str(LANG_BENCH_WRITE_MEM), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
265 draw_txt_string(3, 13, lang_str(LANG_BENCH_WRITE_64K), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
266 draw_txt_string(3, 14, lang_str(LANG_BENCH_READ_64K), MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
267
268
269 case 2:
270 add_log_head(log_run);
271 gui_bench_draw_results_cpu(2, bench.cpu_ips);
272 add_to_log(log_run,"CPU :",buf);
273
274 gui_bench_draw_results_screen(4, bench.screen_output_bps, camera_screen.buffer_size);
275 add_to_log(log_run,"Screen write :",buf);
276 gui_bench_draw_results_screen(5, bench.screen_input_bps, bench.screen_input_size);
277 add_to_log(log_run,"Viewport read :",buf);
278
279 gui_bench_draw_results_memory(7, bench.memory_write_bps, bench.memory_write_uc_bps);
280 add_to_log(log_run,"Memory write :",buf);
281 gui_bench_draw_results_memory(8, bench.memory_read_bps, bench.memory_read_uc_bps);
282 add_to_log(log_run,"Memory read :",buf);
283
284 gui_bench_draw_results_text(9, bench.text_cps, bench.textnonalign_cps, camera_screen.width * camera_screen.height);
285 add_to_log(log_run,"Text drawing :",buf);
286 buf[0] = 0;
287
288 gui_bench_draw_results(11, bench.disk_write_raw_kbps);
289 add_to_log(log_run,"Card write (RAW):",buf);
290 gui_bench_draw_results(12, bench.disk_write_mem_kbps);
291 add_to_log(log_run,"Card write (MEM):",buf);
292 gui_bench_draw_results(13, bench.disk_write_buf_kbps);
293 add_to_log(log_run,"Card write (64k):",buf);
294 gui_bench_draw_results(14, bench.disk_read_buf_kbps);
295 add_to_log(log_run,"Card read (64k):",buf);
296
297 write_log(log_run);
298
299 bench_to_draw = 0;
300 break;
301 default:
302 bench_to_draw = 0;
303 break;
304 }
305 }
306
307
308
309 static unsigned int getcurrentmachinetime() {
310 return *(unsigned int*)0xc0242014;
311 }
312
313 static unsigned int get_usec_diff(unsigned int t) {
314 unsigned int v = *(unsigned int*)0xc0242014;
315 if (v<t)
316 return 0x100000+v-t;
317 return v-t;
318 }
319
320
321
322
323 static void bench_screen_write() {
324 long t;
325 register unsigned int s;
326 register char c;
327 register char *scr;
328
329 scr = vid_get_bitmap_fb();
330 s = camera_screen.buffer_size;
331 t = get_tick_count();
332
333 for (c=0; c<64; ++c) {
334 asm volatile (
335 "mov r0, %0\n"
336 "mov r1, %1\n"
337 "bsw_loop:\n"
338 "strb r0, [r1]\n"
339 "add r1, r1, #1\n"
340 "cmp r1, %2\n"
341 "bne bsw_loop\n"
342 :: "r" (c), "r" (scr), "r" (scr+s) : "r0", "r1"
343 );
344 };
345 t = get_tick_count() - t;
346 bench.screen_output_bps = (t==0)?0:s*64*100 / (t/10);
347 msleep(10);
348 }
349
350
351
352
353 static void bench_screen_read() {
354 long t;
355 register unsigned int n, s;
356 register char *scr;
357
358 scr = vid_get_viewport_active_buffer();
359 if (!scr) return;
360 s = vid_get_viewport_byte_width() * vid_get_viewport_height_proper();
361
362 if ((s < 1) || (s > 360*240*3)) s = 360*240*3;
363 bench.screen_input_size = s;
364 t = get_tick_count();
365 for (n=0; n<32; ++n) {
366 asm volatile (
367 "mov r1, %0\n"
368 "bsr_loop:\n"
369 "ldrb r0, [r1]\n"
370 "add r1, r1, #1\n"
371 "cmp r1, %1\n"
372 "bne bsr_loop\n"
373 :: "r" (scr), "r" (scr+s) : "r0", "r1"
374 );
375 };
376 t = get_tick_count() - t;
377 bench.screen_input_bps = (t==0)?0:s*32*100 / (t/10);
378 msleep(10);
379 }
380
381
382
383
384 static void bench_mem_write(int *buff) {
385 long t, m;
386 register unsigned int n;
387 register char *buf = (char *)buff;
388 int *result[2];
389 result[0]=&bench.memory_write_bps;
390 result[1]=&bench.memory_write_uc_bps;
391 for (m=0; m<2; m++) {
392 if (m==1) {
393 buf=ADR_TO_UNCACHED(buf);
394 }
395 t = get_tick_count();
396 for (n=0; n<1024; ++n) {
397 asm volatile (
398 "mov r0, %0\n"
399 "mov r1, %2\n"
400 "bmw_loop:\n"
401 "str r1, [r0]\n"
402 "add r0, r0, #4\n"
403 "cmp r0, %1\n"
404 "bne bmw_loop\n"
405 :: "r" (buf), "r" (buf+0x10000), "r" (n) : "r0", "r1"
406 );
407 };
408 t = get_tick_count() - t;
409 *result[m] = (t==0)?0:0x10000*100 / (t/10) * 1024;
410 msleep(10);
411 }
412 }
413
414
415
416
417 static void bench_mem_read(int *buff) {
418 long t, m;
419 register unsigned int n;
420 register char *buf = (char *)buff;
421 int *result[2];
422 result[0]=&bench.memory_read_bps;
423 result[1]=&bench.memory_read_uc_bps;
424 for (m=0; m<2; m++) {
425 if (m==1) {
426 buf=ADR_TO_UNCACHED(buf);
427 }
428 t = get_tick_count();
429 for (n=0; n<1024; ++n) {
430 asm volatile (
431 "mov r0, %0\n"
432 "mov r1, %2\n"
433 "bmr_loop:\n"
434 "ldr r1, [r0]\n"
435 "add r0, r0, #4\n"
436 "cmp r0, %1\n"
437 "bne bmr_loop\n"
438 :: "r" (buf), "r" (buf+0x10000), "r" (n) : "r0", "r1"
439 );
440 };
441 t = get_tick_count() - t;
442 *result[m] = (t==0)?0:0x10000*100 / (t/10) * 1024;
443 msleep(10);
444 }
445 }
446
447
448
449
450 static void bench_measure_text_write() {
451 unsigned int t, best, d;
452 register int c;
453
454
455 best = 0xffffffff;
456 for (d=0; d<4; d++) {
457 t = getcurrentmachinetime();
458 for (c=0; c<16; c++) {
459
460 draw_txt_string(1, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_+", MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
461 draw_txt_string(1, 1, "abcdefghijklmnopqrstuvwxyz0123456789.-_+", MAKE_COLOR(COLOR_GREEN, COLOR_RED));
462 };
463 t = get_usec_diff(t);
464 msleep(10);
465 if (t < best) best = t;
466 }
467 bench.text_cps = (best==0)?0:16*80*1000000/best;
468 best = 0xffffffff;
469 for (d=0; d<4; d++) {
470 t = getcurrentmachinetime();
471 for (c=0; c<16; c++) {
472
473 draw_txt_stringnonalign(1, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_+", MAKE_COLOR(COLOR_BLACK, COLOR_WHITE));
474 draw_txt_stringnonalign(1, 1, "abcdefghijklmnopqrstuvwxyz0123456789.-_+", MAKE_COLOR(COLOR_GREEN, COLOR_RED));
475 };
476 t = get_usec_diff(t);
477 msleep(10);
478 if (t < best) best = t;
479 }
480 bench.textnonalign_cps = (best==0)?0:16*80*1000000/best;
481 }
482
483
484
485
486
487
488
489 void __attribute__((naked,noinline)) busyloop_thumb(int loops) {
490 (void)loops;
491 asm volatile (
492 #if defined(__thumb__)
493 ".code 16\n"
494 "bx pc\n"
495 ".code 32\n"
496 #endif
497 ".align 4\n"
498 "z1:\n"
499 "subs r0, r0, #1\n"
500 "bhi z1\n"
501 "bx lr\n"
502 );
503 }
504
505 #define CYCLES 100000
506 #define INSTPERCYCLE 2
507
508 static void bench_measure_cpuspeed() {
509 unsigned int t, best, c;
510
511
512 best = 0xffffffff;
513 for (c=0; c<4; c++) {
514 t = getcurrentmachinetime();
515 busyloop_thumb(CYCLES);
516 t = get_usec_diff(t);
517 msleep(10);
518 if (t < best) best = t;
519 }
520 bench.cpu_ips = (best==0)?0:INSTPERCYCLE*CYCLES/best;
521 }
522
523
524
525 static void run_test(int num) {
526 long t;
527 int x;
528 unsigned int n, s;
529 switch (num) {
530 case 1:
531 bench.cpu_ips = 0;
532 bench_measure_cpuspeed();
533 bench.screen_output_bps = 0;
534 bench_to_draw = 2;
535 break;
536 case 2:
537 bench_screen_write();
538 bench.screen_input_bps = 0;
539 bench_to_draw = 1;
540 break;
541 case 3:
542 bench_screen_read();
543 bench.memory_write_bps = 0;
544 bench_to_draw = 2;
545 break;
546 case 4:
547 if (benchbuf) {
548 bench_mem_write(benchbuf);
549 }
550 bench.memory_read_bps = 0;
551 bench_to_draw = 2;
552 break;
553 case 5:
554 if (benchbuf) {
555 bench_mem_read(benchbuf);
556 }
557 bench.text_cps = 0;
558 bench_to_draw = 2;
559 break;
560 case 6:
561 bench_measure_text_write();
562 if (bench_mode!=BENCH_NOCARD) {
563 bench.disk_write_raw_kbps = 0;
564 }
565 bench_to_draw = 1;
566 break;
567 case 7:
568 x = open(BENCHTMP, O_WRONLY|O_CREAT, 0777);
569 if (x>=0) {
570 t = get_tick_count();
571 s=write(x, hook_raw_image_addr(), camera_sensor.raw_size)/1024;
572 t = get_tick_count() - t;
573 close(x);
574 bench.disk_write_raw_kbps = (t==0)?0:s*100 / (t/10);
575 }
576 bench.disk_write_mem_kbps = 0;
577 bench_to_draw = 2;
578 break;
579 case 8:
580 x = open(BENCHTMP, O_WRONLY|O_CREAT, 0777);
581 if (x>=0) {
582 t = get_tick_count();
583 s=write(x, (void*)0x10000, 0xC00000)/1024;
584 t = get_tick_count() - t;
585 close(x);
586 bench.disk_write_mem_kbps = (t==0)?0:s*100 / (t/10);
587 }
588 bench.disk_write_buf_kbps = 0;
589 bench_to_draw = 2;
590 break;
591 case 9:
592 if (benchbuf) {
593 x = open(BENCHTMP, O_WRONLY|O_CREAT, 0777);
594 if (x>=0) {
595 s = 0;
596 t = get_tick_count();
597 for (n=0; n<256; ++n)
598 s+=write(x, benchbuf, 0x10000);
599 t = get_tick_count() - t;
600 s = s / 1024;
601 close(x);
602 bench.disk_write_buf_kbps = (t==0)?0:s*100 / (t/10);
603 }
604 }
605 bench.disk_read_buf_kbps = 0;
606 bench_to_draw = 2;
607 break;
608 case 10:
609 if (benchbuf) {
610 x = open(BENCHTMP, O_RDONLY, 0777);
611 if (x>=0) {
612 s = 0;
613 t = get_tick_count();
614 for (n=0; n<256; ++n)
615 s+=read(x, benchbuf, 0x10000);
616 t = get_tick_count() - t;
617 s = s / 1024;
618 close(x);
619 bench.disk_read_buf_kbps = (t==0)?0:s*100 / (t/10);
620 }
621 }
622 bench_to_draw = 2;
623 break;
624 }
625 }
626
627
628
629 int gui_bench_kbd_process()
630 {
631 if (bench_to_run) return 0;
632 switch (kbd_get_autoclicked_key()) {
633 case KEY_SET:
634 switch(bench_cur_ctl) {
635 case BENCH_CTL_START:
636 gui_bench_init();
637 bench_mode = bench_mode_next;
638 bench_to_run = 1;
639 break;
640 case BENCH_CTL_LOG:
641 bench_log = !bench_log;
642 bench_to_draw = 1;
643 break;
644 case BENCH_CTL_SD:
645 bench_mode_next = (bench_mode_next == BENCH_ALL)?BENCH_NOCARD:BENCH_ALL;
646 bench_to_draw = 1;
647 break;
648 }
649 break;
650
651 case KEY_LEFT:
652 bench_cur_ctl = (bench_cur_ctl>0)?bench_cur_ctl-1:BENCH_CTL_MAX;
653 bench_to_draw = 1;
654 break;
655 case KEY_RIGHT:
656 bench_cur_ctl = (bench_cur_ctl<BENCH_CTL_MAX)?bench_cur_ctl+1:0;
657 bench_to_draw = 1;
658 break;
659 }
660 return 0;
661 }
662
663
664
665 int basic_module_init()
666 {
667 int cl = strlen(lang_str(LANG_BENCH_CALCULATING));
668 strncpy(clearline, lang_str(LANG_BENCH_CALCULATING), 27);
669 if (cl < 27)
670 {
671 strncpy(clearline+cl, " ", 27-cl);
672 }
673
674 gui_bench_init();
675 gui_set_mode(&GUI_MODE_BENCH);
676 return 1;
677 }
678
679 #include "simple_module.c"
680
681
682
683 ModuleInfo _module_info =
684 {
685 MODULEINFO_V1_MAGICNUM,
686 sizeof(ModuleInfo),
687 SIMPLE_MODULE_VERSION,
688
689 ANY_CHDK_BRANCH, 0, OPT_ARCHITECTURE,
690 ANY_PLATFORM_ALLOWED,
691
692 -LANG_MENU_DEBUG_BENCHMARK,
693 MTYPE_TOOL,
694
695 &_librun.base,
696
697 ANY_VERSION,
698 CAM_SCREEN_VERSION,
699 CAM_SENSOR_VERSION,
700 ANY_VERSION,
701
702 0x2a,
703 };