This source file includes following definitions.
- vid_bitmap_refresh
- shutdown
- debug_led
- get_flash_params_count
- camera_set_led
- JogDial_CW
- JogDial_CCW
- load_chdk_palette
- vid_get_viewport_width_proper
- vid_get_viewport_height_proper
- vid_get_viewport_width
- vid_get_viewport_height
- vid_get_viewport_fullscreen_width
- vid_get_viewport_fullscreen_height
- vid_get_palette_type
- vid_get_palette_size
- vid_get_bitmap_active_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 0xC0220134
29
30 void debug_led(int state)
31 {
32 volatile long *p=(void*)LED_PR;
33 if (state)
34 p[0]=0x46;
35 else
36 p[0]=0x44;
37 }
38
39 int get_flash_params_count(void) { return 0x7a; }
40
41
42 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
43 static char led_table[]={0,
44 1,
45 2,
46
47 8,
48 9
49 };
50 if((unsigned)led < sizeof(led_table))
51 _LEDDrive(led_table[led], state<=1 ? !state : state);
52
53 }
54
55
56
57 void JogDial_CW(void){
58 _PostLogicalEventForNotPowerType(0x874, 1);
59 }
60 void JogDial_CCW(void){
61 _PostLogicalEventForNotPowerType(0x875, 1);
62 }
63
64
65
66 void load_chdk_palette()
67 {
68 extern int active_palette_buffer;
69
70 if ((active_palette_buffer == 0) || (active_palette_buffer == 1))
71 {
72 int *pal = (int*)vid_get_bitmap_active_palette();
73 if (pal[CHDK_COLOR_BASE+0] != 0x33ADF62)
74 {
75 pal[CHDK_COLOR_BASE+0] = 0x33ADF62;
76 pal[CHDK_COLOR_BASE+1] = 0x326EA40;
77 pal[CHDK_COLOR_BASE+2] = 0x34CD57F;
78 pal[CHDK_COLOR_BASE+3] = 0x373BFAE;
79 pal[CHDK_COLOR_BASE+4] = 0x34BD6CA;
80 pal[CHDK_COLOR_BASE+5] = 0x395AB95;
81 pal[CHDK_COLOR_BASE+6] = 0x34766F0;
82 pal[CHDK_COLOR_BASE+7] = 0x31250F3;
83 pal[CHDK_COLOR_BASE+8] = 0x37F408F;
84 pal[CHDK_COLOR_BASE+9] = 0x3512D5B;
85 pal[CHDK_COLOR_BASE+10] = 0x3A9A917;
86 pal[CHDK_COLOR_BASE+11] = 0x3819137;
87 pal[CHDK_COLOR_BASE+12] = 0x3DED115;
88 pal[CHDK_COLOR_BASE+13] = 0x0090000;
89
90 vid_bitmap_refresh();
91 }
92 }
93 }
94
95
96
97 extern int _GetVRAMHPixelsSize();
98 extern int _GetVRAMVPixelsSize();
99
100
101 int vid_get_viewport_width_proper() {
102 return ((mode_get()&MODE_MASK) == MODE_PLAY)?720:_GetVRAMHPixelsSize();
103 }
104 int vid_get_viewport_height_proper() {
105 return ((mode_get()&MODE_MASK) == MODE_PLAY)?480:_GetVRAMVPixelsSize();
106 }
107
108 int vid_get_viewport_width() { return vid_get_viewport_width_proper(); }
109 long vid_get_viewport_height() { return vid_get_viewport_height_proper(); }
110
111 int vid_get_viewport_fullscreen_width() { return vid_get_viewport_width_proper(); }
112 int vid_get_viewport_fullscreen_height() { return vid_get_viewport_height_proper(); }
113
114
115
116 int vid_get_palette_type() { return 3; }
117 int vid_get_palette_size() { return 256 * 4; }
118
119 void *vid_get_bitmap_active_palette()
120 {
121 extern int active_palette_buffer;
122 extern char** palette_buffer_ptr;
123 return palette_buffer_ptr[active_palette_buffer]+12;
124 }