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