This source file includes following definitions.
- vid_bitmap_refresh
- shutdown
- debug_led
- camera_set_led
- get_flash_params_count
- JogDial_CW
- JogDial_CCW
- vid_get_viewport_live_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
- load_chdk_palette
1 #include "platform.h"
2 #include "platform_palette.h"
3 #include "lolevel.h"
4
5 void vid_bitmap_refresh()
6 {
7 extern int full_screen_refresh;
8 extern void _ScreenUnlock();
9 extern void _ScreenLock();
10
11 full_screen_refresh |= 3;
12 _ScreenLock();
13 _ScreenUnlock();
14 }
15
16 void shutdown()
17 {
18 volatile long *p = (void*)0xC022001C;
19
20 asm(
21 "MRS R1, CPSR\n"
22 "AND R0, R1, #0x80\n"
23 "ORR R1, R1, #0x80\n"
24 "MSR CPSR_cf, R1\n"
25 :::"r1","r0");
26
27 *p = 0x44;
28
29 while(1);
30 }
31
32 #define LED_PR 0xC022C30C
33
34 void debug_led(int state)
35 {
36 volatile long *p = (void*)LED_PR;
37 if (state)
38 *p = *p | 0x21;
39 else
40 *p = (*p & 0xFFFFFFDF) | 0x1;
41 }
42
43
44
45
46
47 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
48 static char led_table[2] = {4, 8};
49 _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
50 }
51
52 int get_flash_params_count(void) { return 0xa6; }
53
54 void JogDial_CW(void){
55 _PostLogicalEventForNotPowerType(0x871, 1);
56 }
57
58 void JogDial_CCW(void){
59 _PostLogicalEventForNotPowerType(0x872, 1);
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 void *vid_get_viewport_live_fb()
87 {
88 return vid_get_viewport_fb();
89 }
90
91
92 extern int active_bitmap_buffer;
93 extern char* bitmap_buffer[];
94
95
96 int vid_get_viewport_yscale() {
97 return 2;
98 }
99
100 int vid_get_viewport_width()
101 {
102 if ((mode_get() & MODE_MASK) == MODE_PLAY)
103 {
104 return 360;
105 }
106 extern int _GetVRAMHPixelsSize();
107 return _GetVRAMHPixelsSize() >> 1;
108 }
109
110
111
112 static long vp_xo[5] = { 0, 0, 0, 44, 72 };
113
114 int vid_get_viewport_xoffset()
115 {
116 if ((mode_get() & MODE_MASK) == MODE_PLAY)
117 {
118 return 0;
119 }
120 else if (shooting_get_prop(PROPCASE_SHOOTING_MODE) == MODE_STITCH)
121 {
122 return 0;
123 }
124 else
125 {
126 return vp_xo[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
127 }
128 }
129
130 int vid_get_viewport_display_xoffset()
131 {
132 if ((mode_get() & MODE_MASK) == MODE_PLAY)
133 {
134 return 0;
135 }
136 else if (shooting_get_prop(PROPCASE_SHOOTING_MODE) == MODE_STITCH)
137 {
138 if (shooting_get_prop(PROPCASE_STITCH_DIRECTION) == 0)
139 if (shooting_get_prop(PROPCASE_STITCH_SEQUENCE) == 0)
140 return 40;
141 else
142 return 140;
143 else
144 if (shooting_get_prop(PROPCASE_STITCH_SEQUENCE) == 0)
145 return 140;
146 else
147 return 40;
148 }
149 else
150 {
151 return vp_xo[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
152 }
153 }
154
155 long vid_get_viewport_height()
156 {
157 if ((mode_get() & MODE_MASK) == MODE_PLAY)
158 {
159 return 240;
160 }
161 extern int _GetVRAMVPixelsSize();
162 return _GetVRAMVPixelsSize() >> 1;
163 }
164
165 static int vp_yoffset(int stitch)
166 {
167
168
169 static long vp_yo[5] = { 0, 30, 13, 0, 0 };
170
171 int m = mode_get();
172 if ((m & MODE_MASK) == MODE_PLAY)
173 {
174 return 0;
175 }
176 else if (shooting_get_prop(PROPCASE_SHOOTING_MODE) == MODE_STITCH)
177 {
178 return stitch;
179 }
180 else if (mode_is_video(m) || get_movie_status() == VIDEO_RECORD_IN_PROGRESS)
181 {
182 return 30;
183 }
184 else
185 {
186 return vp_yo[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
187 }
188 }
189
190 int vid_get_viewport_yoffset()
191 {
192 return vp_yoffset(0);
193 }
194
195 int vid_get_viewport_display_yoffset()
196 {
197 return vp_yoffset(72);
198 }
199
200
201 int vid_get_viewport_display_xoffset_proper() { return vid_get_viewport_display_xoffset() * 2; }
202 int vid_get_viewport_display_yoffset_proper() { return vid_get_viewport_display_yoffset() * 2; }
203 int vid_get_viewport_height_proper() { return vid_get_viewport_height() * 2; }
204 int vid_get_viewport_fullscreen_height() { return 480; }
205 int vid_get_palette_type() { return 5; }
206 int vid_get_palette_size() { return 256 * 4; }
207
208 void *vid_get_bitmap_active_buffer()
209 {
210 return bitmap_buffer[active_bitmap_buffer];
211 }
212
213 void *vid_get_bitmap_active_palette()
214 {
215 extern int active_palette_buffer;
216 extern char* palette_buffer[];
217 void* p = palette_buffer[active_palette_buffer];
218
219 if (p) p += 4;
220 return p;
221 }
222
223
224 void load_chdk_palette()
225 {
226 extern int active_palette_buffer;
227
228 if ((active_palette_buffer == 0) || (active_palette_buffer == 5) || (active_palette_buffer == 6))
229 {
230 int *pal = (int*)vid_get_bitmap_active_palette();
231 if (pal && pal[CHDK_COLOR_BASE+0] != 0x3F3ADF62)
232 {
233 pal[CHDK_COLOR_BASE+0] = 0x3F3ADF62;
234 pal[CHDK_COLOR_BASE+1] = 0x3F26EA40;
235 pal[CHDK_COLOR_BASE+2] = 0x3F4CD57F;
236 pal[CHDK_COLOR_BASE+3] = 0x3F73BFAE;
237 pal[CHDK_COLOR_BASE+4] = 0x3F4BD6CA;
238 pal[CHDK_COLOR_BASE+5] = 0x3F95AB95;
239 pal[CHDK_COLOR_BASE+6] = 0x3F4766F0;
240 pal[CHDK_COLOR_BASE+7] = 0x3F1250F3;
241 pal[CHDK_COLOR_BASE+8] = 0x3F7F408F;
242 pal[CHDK_COLOR_BASE+9] = 0x3F512D5B;
243 pal[CHDK_COLOR_BASE+10] = 0x3FA9A917;
244 pal[CHDK_COLOR_BASE+11] = 0x3F819137;
245 pal[CHDK_COLOR_BASE+12] = 0x3FDED115;
246
247 extern char palette_control;
248 palette_control = 1;
249 vid_bitmap_refresh();
250 }
251 }
252 }
253