This source file includes following definitions.
- get_usb_bit
- mykbd_task_proceed
- mykbd_task
- wrap_kbd_p1_f
- my_kbd_read_keys
- kbd_fetch_data
- jogdial_control
- Get_JogDial
- get_jogdial_direction
1 #include "lolevel.h"
2 #include "platform.h"
3 #include "keyboard.h"
4 #include "kbd_common.h"
5
6 long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
7 long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
8 long kbd_mod_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
9
10 KeyMap keymap[] = {
11
12
13
14
15
16 { 0, KEY_SHOOT_FULL , 0x00002002 },
17 { 0, KEY_SHOOT_FULL_ONLY , 0x00000002 },
18 { 0, KEY_SHOOT_HALF , 0x00002000 },
19 { 0, KEY_UP , 0x00000080 },
20 { 0, KEY_DOWN , 0x00000100 },
21 { 0, KEY_PLAYBACK , 0x00800000 },
22
23
24
25
26 { 1, KEY_LEFT , 0x00008000 },
27 { 1, KEY_RIGHT , 0x00004000 },
28
29
30
31
32 { 1, KEY_SET , 0x00010000 },
33
34
35 { 1, KEY_ZOOM_IN , 0x00000004 },
36 { 1, KEY_ZOOM_OUT , 0x00000001 },
37 { 1, KEY_MENU , 0x00040000 },
38 { 1, KEY_DISPLAY , 0x00020000 },
39 { 1, KEY_PRINT , 0x00080000 },
40 { 1, KEY_VIDEO , 0x00080000 },
41 { 0, 0, 0 }
42 };
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71 #define NEW_SS (0x2000)
72
73 static char kbd_stack[NEW_SS];
74
75 int get_usb_bit()
76 {
77 long usb_physw[3];
78 usb_physw[USB_IDX] = 0;
79 _kbd_read_keys_r2(usb_physw);
80 return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ;
81 }
82
83
84 int jogdial_stopped=0;
85
86 long __attribute__((naked)) wrap_kbd_p1_f();
87
88 static void __attribute__((noinline)) mykbd_task_proceed() {
89 while (physw_run) {
90 _SleepTask(10);
91
92 if (wrap_kbd_p1_f() == 1) {
93 _kbd_p2_f();
94 }
95 }
96 }
97
98 void __attribute__((naked,noinline)) mykbd_task() {
99
100
101
102
103
104
105
106
107
108
109 register int i;
110 register long *newstack;
111
112 newstack = (void*)kbd_stack;
113
114 for (i=0;i<NEW_SS/4;i++)
115 newstack[i]=0xdededede;
116
117 asm volatile (
118 "MOV SP, %0"
119 :: "r"(((char*)newstack)+NEW_SS)
120 : "memory"
121 );
122
123
124
125 mykbd_task_proceed();
126
127
128
129
130 _ExitTask();
131 }
132
133
134 long __attribute__((naked,noinline)) wrap_kbd_p1_f() {
135 asm volatile(
136 "STMFD SP!, {R1-R5,LR}\n"
137 "MOV R4, #0\n"
138
139 "BL my_kbd_read_keys\n"
140 "B _kbd_p1_f_cont\n"
141 );
142 return 0;
143 }
144
145 extern void _GetKbdState(long *dst);
146
147 void my_kbd_read_keys() {
148 kbd_update_key_state();
149 kbd_update_physw_bits();
150 }
151
152 void kbd_fetch_data(long *dst)
153 {
154 _GetKbdState(dst);
155 _kbd_read_keys_r2(dst);
156 }
157
158 void jogdial_control(int n) {
159
160
161
162
163
164
165
166
167 jogdial_stopped = n;
168 }
169
170 int Get_JogDial(void) {
171 return (*(int*)0xC0240104)>>16;
172 }
173
174 static int new_jogdial=0, old_jogdial=0;
175
176 long get_jogdial_direction(void) {
177 old_jogdial=new_jogdial;
178 new_jogdial=Get_JogDial();
179
180 if (old_jogdial<new_jogdial) {
181
182 return JOGDIAL_RIGHT;
183 } else if (old_jogdial>new_jogdial) {
184 return JOGDIAL_LEFT;
185
186 } else {
187 return 0;
188 }
189 }
190