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