This source file includes following definitions.
- startup
- get_effective_focal_length
- get_focal_length
- get_zoom_x
- get_vbatt_min
- get_vbatt_max
1 #include "lolevel.h"
2 #include "platform.h"
3 #include "core.h"
4 #include "keyboard.h"
5
6 extern long link_bss_start;
7 extern long link_bss_end;
8 extern void boot();
9
10 void startup()
11 {
12
13 long *bss = &link_bss_start;
14
15
16 if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)) {
17
18 #define LED_PR 0xd20b0994
19 #define LED_PWR 0xd20b0884
20 #define LED_ORANGE 0xd20b0888
21 #define XDELAY 4000000
22 int j = 1000 ;
23 while(j-- > 0) {
24 int i;
25 *(volatile int*)LED_PR = 0x4d0002;
26 *(volatile int*)LED_PWR = 0x4d0002;
27 *(volatile int*)LED_ORANGE = 0x4d0002;
28 for(i=0;i<XDELAY/10;i++) {
29 asm volatile(
30 "nop\n"
31 );
32 }
33 *(volatile int*)LED_PR = 0x4c0003;
34 *(volatile int*)LED_PWR = 0x4c0003;
35 *(volatile int*)LED_ORANGE = 0x4c0003;
36 for(i=0;i<XDELAY;i++) {
37 asm volatile(
38 "nop\n"
39 );
40 }
41 }
42 shutdown();
43 }
44
45
46 while (bss<&link_bss_end)
47 *bss++ = 0;
48 boot();
49 }
50
51
52
53
54
55
56
57 #define CF_EFL 280
58 #define CF_EFL_DIV 61
59 #define NUM_FL 122
60 #define NUM_DATA 2
61
62 extern int focus_len_table[NUM_FL*NUM_DATA];
63 const int zoom_points = NUM_FL;
64
65 int get_effective_focal_length(int zp)
66 {
67 return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV;
68 }
69
70 int get_focal_length(int zp)
71 {
72 if (zp < 0) zp = 0;
73 else if (zp >= NUM_FL) zp = NUM_FL-1;
74 return focus_len_table[zp*NUM_DATA];
75 }
76
77 int get_zoom_x(int zp)
78 {
79 return get_focal_length(zp)*10/focus_len_table[0];
80 }
81
82
83
84 long get_vbatt_min() { return 6450; }
85 long get_vbatt_max() { return 8250; }