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