This source file includes following definitions.
- vid_bitmap_refresh
- shutdown
- debug_led
- camera_set_led
- get_flash_params_count
- _GetBatteryTemperature
- load_chdk_palette
- vid_get_palette_type
- vid_get_palette_size
- vid_get_bitmap_active_palette
- vid_get_viewport_width_proper
- vid_get_viewport_height_proper
1 #include "platform.h"
2 #include "platform_palette.h"
3 #include "lolevel.h"
4
5 #define LED_DP 0xC02200CC
6 #define LED_FLASH 0xC02200D8
7 #define LED_AF 0xC02200DC
8
9 void vid_bitmap_refresh()
10 {
11 extern int enabled_refresh_physical_screen;
12 enabled_refresh_physical_screen=1;
13 _RefreshPhysicalScreen(1);
14 }
15
16
17 void shutdown()
18 {
19 volatile long *p = (void*)0xC022001C;
20
21 asm(
22 "MRS R1, CPSR\n"
23 "AND R0, R1, #0x80\n"
24 "ORR R1, R1, #0x80\n"
25 "MSR CPSR_cf, R1\n"
26 :::"r1","r0");
27
28 *p = 0x44;
29
30 while(1);
31 }
32
33
34 void debug_led(int state)
35 {
36 *(int*)LED_DP=state ? 0x46 : 0x44;
37 }
38
39 void camera_set_led(int led, int state, __attribute__ ((unused))int bright) {
40 static char led_table[]={7,9};
41 _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
42 }
43
44 int get_flash_params_count(void){
45 return 122;
46 }
47
48
49
50
51
52
53
54
55
56 int _GetBatteryTemperature()
57 {
58 return -99;
59 }
60
61
62 void load_chdk_palette() {
63
64 extern int active_palette_buffer;
65
66 if ((active_palette_buffer == 0) || (active_palette_buffer == 1))
67 {
68 int *pal = (int*)vid_get_bitmap_active_palette();
69 if (pal[CHDK_COLOR_BASE+0] != 0x33ADF62)
70 {
71 pal[CHDK_COLOR_BASE+0] = 0x33ADF62;
72 pal[CHDK_COLOR_BASE+1] = 0x326EA40;
73 pal[CHDK_COLOR_BASE+2] = 0x34CD57F;
74 pal[CHDK_COLOR_BASE+3] = 0x373BFAE;
75 pal[CHDK_COLOR_BASE+4] = 0x34BD6CA;
76 pal[CHDK_COLOR_BASE+5] = 0x395AB95;
77 pal[CHDK_COLOR_BASE+6] = 0x34766F0;
78 pal[CHDK_COLOR_BASE+7] = 0x31250F3;
79 pal[CHDK_COLOR_BASE+8] = 0x37F408F;
80 pal[CHDK_COLOR_BASE+9] = 0x3512D5B;
81 pal[CHDK_COLOR_BASE+10] = 0x3A9A917;
82 pal[CHDK_COLOR_BASE+11] = 0x3819137;
83 pal[CHDK_COLOR_BASE+12] = 0x3DED115;
84 pal[CHDK_COLOR_BASE+13] = 0x0090000;
85
86
87
88 vid_bitmap_refresh();
89 }
90 }
91 }
92
93
94 int vid_get_palette_type() { return 3; }
95 int vid_get_palette_size() { return 256 * 4; }
96
97 void *vid_get_bitmap_active_palette()
98 {
99 extern int active_palette_buffer;
100 extern char** palette_buffer_ptr;
101 return (palette_buffer_ptr[active_palette_buffer]+16);
102 }
103
104
105 extern int _GetVRAMHPixelsSize();
106 extern int _GetVRAMVPixelsSize();
107
108 int vid_get_viewport_width_proper() {
109 return ((mode_get()&MODE_MASK) == MODE_PLAY)?720:_GetVRAMHPixelsSize();
110 }
111 int vid_get_viewport_height_proper() {
112 return ((mode_get()&MODE_MASK) == MODE_PLAY)?240:_GetVRAMVPixelsSize();
113 }