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_byte_width
- vid_get_viewport_yscale
- vid_get_viewport_width
- vid_get_viewport_display_xoffset
- vid_get_viewport_height
- vid_get_viewport_height_proper
- vid_get_viewport_buffer_width_proper
- vid_get_viewport_fullscreen_height
- vid_get_palette_type
- vid_get_palette_size
- vid_get_aspect_ratio
- 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
6 void vid_bitmap_refresh()
7 {
8 extern int full_screen_refresh;
9
10 extern void _LockAndRefresh();
11 extern void _UnlockAndRefresh();
12
13 full_screen_refresh |= 3;
14 _LockAndRefresh();
15 _UnlockAndRefresh();
16 }
17
18
19 void shutdown()
20 {
21 volatile long *p = (void*)0xC022001C;
22
23 asm(
24 "MRS R1, CPSR\n"
25 "AND R0, R1, #0x80\n"
26 "ORR R1, R1, #0x80\n"
27 "MSR CPSR_cf, R1\n"
28 :::"r1","r0");
29
30 *p = 0x44;
31
32 while(1);
33 }
34
35 #define LED_PR 0xC0220130
36
37
38 void debug_led(int state)
39 {
40 *(int*)LED_PR=state ? 0x46 : 0x44;
41 }
42
43 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
44 static char led_table[2]={0,9};
45 _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
46 }
47
48 int get_flash_params_count(void){
49 return 0xA0;
50 }
51
52 void JogDial_CW(void){
53 _PostLogicalEventToUI(0x86E, 1);
54 }
55
56 void JogDial_CCW(void){
57 _PostLogicalEventToUI(0x86F, 1);
58 }
59
60
61
62
63
64
65 extern int active_bitmap_buffer;
66 extern char* bitmap_buffer[];
67
68
69 int vid_get_viewport_byte_width() {
70 return 960 * 6 / 4;
71 }
72
73
74 int vid_get_viewport_yscale() {
75 return 2;
76 }
77
78
79 int vid_get_viewport_width()
80 {
81
82
83 static long vp_w[4] = { 360, 480, 408, 272 };
84 return vp_w[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
85 }
86
87 int vid_get_viewport_display_xoffset()
88 {
89
90
91 static long vp_w[4] = { 60, 0, 36, 104 };
92 return vp_w[shooting_get_prop(PROPCASE_ASPECT_RATIO)];
93 }
94
95 long vid_get_viewport_height(){ return 240; }
96
97
98 int vid_get_viewport_height_proper() { return 480; }
99 int vid_get_viewport_buffer_width_proper() { return 960; }
100 int vid_get_viewport_fullscreen_height() { return 480; }
101 int vid_get_palette_type() { return 3; }
102 int vid_get_palette_size() { return 256 * 4; }
103 int vid_get_aspect_ratio() { return 1; }
104
105 void *vid_get_bitmap_active_buffer()
106 {
107 return bitmap_buffer[active_bitmap_buffer];
108 }
109
110 void *vid_get_bitmap_active_palette()
111 {
112 extern int active_palette_buffer;
113 extern char* palette_buffer[];
114 void* p = palette_buffer[active_palette_buffer];
115
116 if (p) p += 8;
117 return p;
118 }
119
120
121 void load_chdk_palette()
122 {
123 extern int active_palette_buffer;
124
125 if ((active_palette_buffer == 0) || (active_palette_buffer == 4))
126 {
127 int *pal = (int*)vid_get_bitmap_active_palette();
128 if (pal && pal[CHDK_COLOR_BASE+0] != 0x33ADF62)
129 {
130 pal[CHDK_COLOR_BASE+0] = 0x33ADF62;
131 pal[CHDK_COLOR_BASE+1] = 0x326EA40;
132 pal[CHDK_COLOR_BASE+2] = 0x34CD57F;
133 pal[CHDK_COLOR_BASE+3] = 0x373BFAE;
134 pal[CHDK_COLOR_BASE+4] = 0x34BD6CA;
135 pal[CHDK_COLOR_BASE+5] = 0x395AB95;
136 pal[CHDK_COLOR_BASE+6] = 0x34766F0;
137 pal[CHDK_COLOR_BASE+7] = 0x31250F3;
138 pal[CHDK_COLOR_BASE+8] = 0x37F408F;
139 pal[CHDK_COLOR_BASE+9] = 0x3512D5B;
140 pal[CHDK_COLOR_BASE+10] = 0x3A9A917;
141 pal[CHDK_COLOR_BASE+11] = 0x3819137;
142 pal[CHDK_COLOR_BASE+12] = 0x3DED115;
143 pal[CHDK_COLOR_BASE+13] = 0x0090000;
144
145 extern char palette_control;
146 palette_control = 1;
147 vid_bitmap_refresh();
148 }
149 }
150 }