This source file includes following definitions.
- shutdown
- debug_led
- camera_set_led
- vid_get_viewport_width
- vid_get_viewport_height
- vid_get_viewport_fb
- vid_get_viewport_live_fb
- vid_bitmap_refresh
- vid_get_bitmap_active_palette
- load_chdk_palette
- vid_get_palette_type
- vid_get_palette_size
- vid_get_bitmap_active_buffer
1 #include "platform.h"
2 #include "platform_palette.h"
3 #include "lolevel.h"
4
5 #define LED_PR 0xC0220120
6
7 void shutdown()
8 {
9 volatile long *p = (void*)LED_PR;
10
11 asm(
12 "MRS R1, CPSR\n"
13 "AND R0, R1, #0x80\n"
14 "ORR R1, R1, #0x80\n"
15 "MSR CPSR_cf, R1\n"
16 :::"r1","r0");
17
18 *p = 0x44;
19
20 while(1);
21 }
22
23 void debug_led(int state)
24 {
25
26
27
28 *(int*)LED_PR=state ? 0x46 : 0x44;
29 }
30
31
32
33
34 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
35 static char led_table[2]={0,4};
36 if(state<=1) _LEDDrive(led_table[led%sizeof(led_table)], (!state)&1);
37 }
38
39 int vid_get_viewport_width()
40 {
41 return 360;
42 }
43
44 long vid_get_viewport_height()
45 {
46 return 240;
47 }
48
49
50 extern char active_viewport_buffer;
51 extern void* viewport_buffers[];
52
53 void *vid_get_viewport_fb()
54 {
55
56 return viewport_buffers[0];
57 }
58
59 void *vid_get_viewport_live_fb()
60 {
61 if (MODE_IS_VIDEO(mode_get()))
62 return viewport_buffers[0];
63
64
65 return viewport_buffers[(active_viewport_buffer-1)&3];
66 }
67
68
69 void vid_bitmap_refresh() {
70
71 extern int full_screen_refresh;
72 extern void _ScreenLock();
73 extern void _ScreenUnlock();
74
75 full_screen_refresh |= 3;
76 _ScreenLock();
77 _ScreenUnlock();
78 }
79
80 void *vid_get_bitmap_active_palette() {
81 extern int active_palette_buffer;
82 extern char* palette_buffer[];
83 void* p = palette_buffer[active_palette_buffer];
84
85 if (p) p += 4;
86 return p;
87 }
88
89
90 #ifdef CAM_LOAD_CUSTOM_COLORS
91
92
93 void load_chdk_palette() {
94
95 extern int active_palette_buffer;
96
97 if ((active_palette_buffer == 0) || (active_palette_buffer == 5))
98 {
99 int *pal = (int*)vid_get_bitmap_active_palette();
100 if (pal && pal[CHDK_COLOR_BASE+0] != 0x33ADF62)
101 {
102 pal[CHDK_COLOR_BASE+0] = 0x33ADF62;
103 pal[CHDK_COLOR_BASE+1] = 0x326EA40;
104 pal[CHDK_COLOR_BASE+2] = 0x34CD57F;
105 pal[CHDK_COLOR_BASE+3] = 0x373BFAE;
106 pal[CHDK_COLOR_BASE+4] = 0x34BD6CA;
107 pal[CHDK_COLOR_BASE+5] = 0x395AB95;
108 pal[CHDK_COLOR_BASE+6] = 0x34766F0;
109 pal[CHDK_COLOR_BASE+7] = 0x31250F3;
110 pal[CHDK_COLOR_BASE+8] = 0x37F408F;
111 pal[CHDK_COLOR_BASE+9] = 0x3512D5B;
112 pal[CHDK_COLOR_BASE+10] = 0x3A9A917;
113 pal[CHDK_COLOR_BASE+11] = 0x3819137;
114 pal[CHDK_COLOR_BASE+12] = 0x3DED115;
115
116 extern char palette_control;
117 palette_control = 1;
118 vid_bitmap_refresh();
119 }
120 }
121 }
122 #endif
123
124
125
126
127 int vid_get_palette_type() { return 3; }
128 int vid_get_palette_size() { return 256 * 4; }
129
130 void *vid_get_bitmap_active_buffer()
131 {
132 return (void*)(*(int*)(0x5470+0x18));
133 }