This source file includes following definitions.
- shutdown
- debug_led
- camera_set_led
- JogDial_CW
- JogDial_CCW
- get_flash_params_count
- vid_bitmap_refresh
- shutdown_soft
- hook_raw_image_addr
- hook_alt_raw_image_addr
- vid_get_viewport_fb
- vid_get_viewport_live_fb
- vid_get_viewport_fb_d
- vid_get_bitmap_fb
- vid_get_viewport_yscale
- vid_get_viewport_width
- vid_get_viewport_xoffset
- vid_get_viewport_display_xoffset
- vid_get_viewport_height
- vp_yoffset
- vid_get_viewport_yoffset
- vid_get_viewport_display_yoffset
- vid_get_viewport_display_xoffset_proper
- vid_get_viewport_display_yoffset_proper
- vid_get_viewport_height_proper
- vid_get_viewport_fullscreen_height
- vid_get_palette_type
- vid_get_palette_size
- vid_get_bitmap_active_buffer
- vid_get_bitmap_active_palette
- camera_jpeg_count_str
1 #include "platform.h"
2 #include "lolevel.h"
3
4
5 void shutdown()
6 {
7 volatile long *p = (void*)0xc022012C;
8
9 asm(
10 "MRS R1, CPSR\n"
11 "AND R0, R1, #0x80\n"
12 "ORR R1, R1, #0x80\n"
13 "MSR CPSR_cf, R1\n"
14 :::"r1","r0");
15
16 *p = 0x44;
17
18 while(1);
19 }
20
21
22 #define LED_GREEN 0xc0220130
23
24 void debug_led(int state)
25 {
26 if (state)
27 *((long*) LED_GREEN) = 0x46;
28 else
29 *((long*) LED_GREEN) = 0x44;
30 }
31
32
33
34
35
36
37
38 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
39 static char led_table[4]={0,1,9};
40
41 _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
42 }
43
44 void JogDial_CW(void){
45 _PostLogicalEventToUI(0x86E, 1);
46 }
47
48 void JogDial_CCW(void){
49 _PostLogicalEventToUI(0x86F, 1);
50 }
51
52 int get_flash_params_count(void){
53 return 0x9a;
54 }
55
56
57 void vid_bitmap_refresh()
58 {
59 extern int enabled_refresh_physical_screen;
60 extern void _ScreenUnlock();
61
62 _ScreenLock();
63 enabled_refresh_physical_screen=1;
64 _ScreenUnlock();
65 }
66
67
68 void shutdown_soft()
69 {
70 _PostLogicalEventForNotPowerType(0x1005,0);
71 }
72
73 extern int active_raw_buffer;
74 extern char* raw_buffers[];
75
76 char *hook_raw_image_addr()
77 {
78 return raw_buffers[active_raw_buffer*3];
79 }
80
81 char *hook_alt_raw_image_addr()
82 {
83 return raw_buffers[(active_raw_buffer^1)*3];
84 }
85
86
87
88
89
90 extern char active_viewport_buffer;
91 extern void* viewport_buffers[];
92
93 void *vid_get_viewport_fb()
94 {
95
96 return viewport_buffers[0];
97 }
98
99 void *vid_get_viewport_live_fb()
100 {
101 int b = (active_viewport_buffer-1)&3;
102 if ((b == 3) && camera_info.state.mode_video)
103 b = 2;
104
105
106 return viewport_buffers[b];
107 }
108
109 void *vid_get_viewport_fb_d()
110 {
111 extern char *viewport_fb_d;
112 return viewport_fb_d;
113 }
114
115
116 extern int active_bitmap_buffer;
117 extern char* bitmap_buffer[];
118
119 void *vid_get_bitmap_fb()
120 {
121
122 return bitmap_buffer[0];
123 }
124
125
126 int vid_get_viewport_yscale() {
127 return 2;
128 }
129
130 int vid_get_viewport_width()
131 {
132 if (camera_info.state.mode_play)
133 {
134 return 360;
135 }
136 extern int _GetVRAMHPixelsSize();
137 return _GetVRAMHPixelsSize() >> 1;
138 }
139
140
141
142 static long vp_xo[5] = { 0, 0, 0, 44, 72 };
143
144 int vid_get_viewport_xoffset()
145 {
146 if (camera_info.state.mode_play)
147 {
148 return 0;
149 }
150 else if (camera_info.state.mode_shooting == MODE_STITCH)
151 {
152 return 0;
153 }
154 else
155 {
156 return vp_xo[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
157 }
158 }
159
160 int vid_get_viewport_display_xoffset()
161 {
162 if (camera_info.state.mode_play)
163 {
164 return 0;
165 }
166 else if (camera_info.state.mode_shooting == MODE_STITCH)
167 {
168 if (shooting_get_prop(PROPCASE_STITCH_DIRECTION) == 0)
169 if (shooting_get_prop(PROPCASE_STITCH_SEQUENCE) == 0)
170 return 40;
171 else
172 return 140;
173 else
174 if (shooting_get_prop(PROPCASE_STITCH_SEQUENCE) == 0)
175 return 140;
176 else
177 return 40;
178 }
179 else
180 {
181 return vp_xo[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
182 }
183 }
184
185 long vid_get_viewport_height()
186 {
187 if (camera_info.state.mode_play)
188 {
189 return 240;
190 }
191 extern int _GetVRAMVPixelsSize();
192 return _GetVRAMVPixelsSize() >> 1;
193 }
194
195 static int vp_yoffset(int stitch)
196 {
197
198
199 static long vp_yo[5] = { 0, 30, 13, 0, 0 };
200
201 if (camera_info.state.mode_play)
202 {
203 return 0;
204 }
205 else if (camera_info.state.mode_shooting == MODE_STITCH)
206 {
207 return stitch;
208 }
209 else if (camera_info.state.mode_video)
210 {
211 return 30;
212 }
213 else
214 {
215 return vp_yo[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
216 }
217 }
218
219 int vid_get_viewport_yoffset()
220 {
221 return vp_yoffset(0);
222 }
223
224 int vid_get_viewport_display_yoffset()
225 {
226 return vp_yoffset(72);
227 }
228
229
230 int vid_get_viewport_display_xoffset_proper() { return vid_get_viewport_display_xoffset() * 2; }
231 int vid_get_viewport_display_yoffset_proper() { return vid_get_viewport_display_yoffset() * 2; }
232 int vid_get_viewport_height_proper() { return vid_get_viewport_height() * 2; }
233 int vid_get_viewport_fullscreen_height() { return 480; }
234 int vid_get_palette_type() { return 3; }
235 int vid_get_palette_size() { return 256 * 4; }
236
237 void *vid_get_bitmap_active_buffer()
238 {
239 return bitmap_buffer[active_bitmap_buffer];
240 }
241
242 void *vid_get_bitmap_active_palette()
243 {
244 extern int active_palette_buffer;
245 extern char* palette_buffer[];
246 void* p = palette_buffer[active_palette_buffer];
247
248 if (p) p += 8;
249 return p;
250 }
251
252 char *camera_jpeg_count_str()
253 {
254 extern char jpeg_count_str[];
255 return jpeg_count_str;
256 }