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