This source file includes following definitions.
- debug_led
- debug_wait
- debug_blink
- debug_blink_red
- vid_bitmap_refresh
- shutdown
- camera_set_led
- get_flash_params_count
- JogDial_CW
- JogDial_CCW
- vid_get_palette_type
- vid_get_palette_size
- vid_get_bitmap_active_buffer
- vid_get_bitmap_active_palette
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #define LED_AF 0xC022000C
16 #define LED_ORANGE 0xC0220010
17 #define LED_GREEN 0xC0220014
18
19 #define DELAY 300000
20
21 #define LED_ON *((long*) LED_GREEN) = 0x46
22 #define LED_OFF *((long*) LED_GREEN) = 0x44
23
24 #define LED_ON_RED *((long*) LED_ORANGE) = 0x46
25 #define LED_OFF_RED *((long*) LED_ORANGE) = 0x44
26
27 #define LED_ON_AF *((long*) LED_AF) = 0x46
28 #define LED_OFF_AF *((long*) LED_AF) = 0x44
29
30 void debug_led(int state)
31 {
32 if (state)
33 LED_ON;
34 else
35 LED_OFF;
36 }
37
38 void debug_wait()
39 {
40 int counter;
41
42 counter = DELAY;
43 while (counter--) { asm("nop\n nop\n"); };
44 }
45
46
47 void debug_blink()
48 {
49
50 LED_ON;
51 debug_wait();
52
53
54 LED_OFF;
55 debug_wait();
56 }
57
58 void debug_blink_red()
59 {
60
61 LED_ON_RED;
62 debug_wait();
63
64
65 LED_OFF_RED;
66 debug_wait();
67 }
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92 #include "platform.h"
93 #include "lolevel.h"
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111 void vid_bitmap_refresh()
112 {
113 extern int enabled_refresh_physical_screen;
114 extern int full_screen_refresh;
115
116
117
118
119 extern void _LockAndRefresh();
120 extern void _UnlockAndRefresh();
121
122 _LockAndRefresh();
123
124 enabled_refresh_physical_screen=1;
125 full_screen_refresh |= 3;
126
127 _UnlockAndRefresh();
128 }
129
130 void shutdown()
131 {
132 volatile long *p = (void*)0xC022001C;
133
134 asm(
135 "MRS R1, CPSR\n"
136 "AND R0, R1, #0x80\n"
137 "ORR R1, R1, #0x80\n"
138 "MSR CPSR_cf, R1\n"
139 :::"r1","r0");
140
141 *p = 0x44;
142
143 while(1);
144 }
145
146
147 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
148 static char led_table[3]={0,1,9};
149 _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
150 }
151
152 int get_flash_params_count(void){
153 return 0x9a;
154 }
155
156 void JogDial_CW(void){
157 _PostLogicalEventForNotPowerType(0x874, 1);
158 }
159
160 void JogDial_CCW(void){
161 _PostLogicalEventForNotPowerType(0x875, 1);
162 }
163
164
165 #if defined(CAM_CHDK_PTP_LIVE_VIEW)
166
167
168 int vid_get_palette_type() { return 3; }
169 int vid_get_palette_size() { return 256 * 4; }
170
171 void *vid_get_bitmap_active_buffer()
172 {
173 extern int active_bitmap_buffer;
174 extern char* bitmap_buffer[];
175 return bitmap_buffer[active_bitmap_buffer];
176 }
177
178 void *vid_get_bitmap_active_palette()
179 {
180 extern int active_palette_buffer;
181 extern char* palette_buffer[];
182 void* p = palette_buffer[active_palette_buffer];
183
184 if (p) p += 8;
185 return p;
186 }
187 #endif