This source file includes following definitions.
- vid_bitmap_refresh
- shutdown
- debug_led
- camera_set_led
- get_flash_params_count
- vid_get_viewport_width
- vid_get_viewport_xoffset
- vid_get_viewport_height
- vid_get_viewport_yoffset
- vid_get_palette_type
- vid_get_palette_size
- vid_get_bitmap_active_palette
- vid_get_viewport_fb
- vid_get_viewport_live_fb
- load_chdk_palette
- _MakeAFScan
- state_check_for_movie_af
1 #include "platform.h"
2 #include "platform_palette.h"
3 #include "lolevel.h"
4
5
6 void vid_bitmap_refresh()
7 {
8 extern int full_screen_refresh;
9 extern void _LockAndRefresh();
10 extern void _UnlockAndRefresh();
11
12 full_screen_refresh |= 3;
13 _LockAndRefresh();
14 _UnlockAndRefresh();
15 }
16
17
18 void shutdown()
19 {
20 volatile long *p = (void*)0xC022001C;
21
22 asm(
23 "MRS R1, CPSR\n"
24 "AND R0, R1, #0x80\n"
25 "ORR R1, R1, #0x80\n"
26 "MSR CPSR_cf, R1\n"
27 :::"r1","r0");
28
29 *p = 0x44;
30
31 while(1);
32 }
33
34 #define LED_PR 0xC0220130
35
36
37 void debug_led(int state)
38 {
39 *(int*)LED_PR=state ? 0x46 : 0x44;
40 }
41
42 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
43 static char led_table[2]={0,9};
44 _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
45 }
46
47 int get_flash_params_count(void){
48 return 0xa0;
49 }
50
51
52
53
54
55 int vid_get_viewport_width()
56 {
57
58
59 static long vp_w[4] = { 360, 360, 360, 270 };
60 return vp_w[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
61 }
62
63 int vid_get_viewport_xoffset()
64 {
65
66
67 static long vp_w[4] = {0, 0, 0, 44};
68 return vp_w[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
69 }
70
71 long vid_get_viewport_height()
72 {
73
74
75 static long vp_h[4] = { 240, 180, 214, 240};
76 return vp_h[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
77 }
78
79 int vid_get_viewport_yoffset()
80 {
81
82
83 static long vp_h[4] = { 0, 30, 13, 0 };
84 return vp_h[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
85 }
86
87
88
89 int vid_get_palette_type() { return 3; }
90 int vid_get_palette_size() { return 256 * 4; }
91
92 void *vid_get_bitmap_active_palette() {
93 extern int active_palette_buffer;
94 extern char* palette_buffer[];
95 void* p = palette_buffer[active_palette_buffer];
96
97 if (p) p += 8;
98 return p;
99 }
100
101 extern char active_viewport_buffer;
102 extern void* viewport_buffers[];
103
104 void *vid_get_viewport_fb()
105 {
106
107 return viewport_buffers[0];
108 }
109
110 void *vid_get_viewport_live_fb()
111 {
112 int b = (active_viewport_buffer-1)&3;
113 if ((b == 3) && (camera_info.state.mode_video || is_video_recording()))
114 b = 2;
115
116
117 return viewport_buffers[b];
118 }
119
120
121 #ifdef CAM_LOAD_CUSTOM_COLORS
122
123
124 void load_chdk_palette() {
125
126 extern int active_palette_buffer;
127
128 if ((active_palette_buffer == 0) || (active_palette_buffer == 4))
129 {
130 int *pal = (int*)vid_get_bitmap_active_palette();
131 if (pal && pal[CHDK_COLOR_BASE+0] != 0x33ADF62)
132 {
133 pal[CHDK_COLOR_BASE+0] = 0x33ADF62;
134 pal[CHDK_COLOR_BASE+1] = 0x326EA40;
135 pal[CHDK_COLOR_BASE+2] = 0x34CD57F;
136 pal[CHDK_COLOR_BASE+3] = 0x373BFAE;
137 pal[CHDK_COLOR_BASE+4] = 0x34BD6CA;
138 pal[CHDK_COLOR_BASE+5] = 0x395AB95;
139 pal[CHDK_COLOR_BASE+6] = 0x34766F0;
140 pal[CHDK_COLOR_BASE+7] = 0x31250F3;
141 pal[CHDK_COLOR_BASE+8] = 0x37F408F;
142 pal[CHDK_COLOR_BASE+9] = 0x3512D5B;
143 pal[CHDK_COLOR_BASE+10] = 0x3A9A917;
144 pal[CHDK_COLOR_BASE+11] = 0x3819137;
145 pal[CHDK_COLOR_BASE+12] = 0x3DED115;
146
147 extern char palette_control;
148 palette_control = 1;
149 vid_bitmap_refresh();
150 }
151
152
153
154
155
156
157
158
159
160
161
162
163 }
164 }
165 #endif
166
167
168
169 static int af_locked_in_movierec = 0;
170
171 void _MakeAFScan(__attribute__ ((unused))int *a, __attribute__ ((unused))int b) {
172 _DoAFLock();
173 af_locked_in_movierec = 1;
174 }
175
176 void state_check_for_movie_af() {
177 if ((get_movie_status() != VIDEO_RECORD_IN_PROGRESS) && af_locked_in_movierec) {
178 af_locked_in_movierec = 0;
179 _UnlockAF();
180 }
181 }