This source file includes following definitions.
- get_usb_bit
- mykbd_task_proceed
- mykbd_task
- wrap_kbd_p1_f
- jogdial_control
- my_kbd_read_keys
- kbd_fetch_data
- 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 { 1, KEY_UP, 0x00100000 },
15 { 1, KEY_DOWN, 0x00080000 },
16 { 1, KEY_LEFT, 0x00010000 },
17 { 1, KEY_RIGHT, 0x00040000 },
18 { 1, KEY_SET, 0x00020000 },
19 { 0, KEY_SHOOT_FULL, 0xC0000000 },
20 { 0, KEY_SHOOT_FULL_ONLY, 0x80000000 },
21 { 0, KEY_SHOOT_HALF, 0x40000000 },
22 { 1, KEY_ZOOM_IN, 0x00000010 },
23 { 1, KEY_ZOOM_OUT, 0x00000008 },
24 { 1, KEY_MENU, 0x08000000 },
25 { 1, KEY_DISPLAY, 0x04000000 },
26 { 1, KEY_PRINT, 0x00001000 },
27 { 1, KEY_ERASE, 0x01000000 },
28 { 1, KEY_EXPO_CORR, 0x02000000 },
29 { 1, KEY_MICROPHONE, 0x10000000 },
30 { 0, 0, 0 }
31 };
32
33 static int new_jogdial=0, old_jogdial=0;
34
35 #define NEW_SS (0x2000)
36
37 int get_usb_bit()
38 {
39 long usb_physw[3];
40 usb_physw[USB_IDX] = 0;
41 _kbd_read_keys_r2(usb_physw);
42 return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ;
43 }
44
45 static char kbd_stack[NEW_SS];
46
47 extern void _platformsub_kbd_fetch_data(long*);
48 long __attribute__((naked)) wrap_kbd_p1_f();
49
50 static void __attribute__((noinline)) mykbd_task_proceed()
51 {
52 while (physw_run){
53 _SleepTask(10);
54
55 if (wrap_kbd_p1_f() == 1){
56 _kbd_p2_f();
57 }
58 }
59 }
60
61 void __attribute__((naked,noinline))
62 mykbd_task(long ua, long ub, long uc, long ud, long ue, long uf)
63 {
64 (void)ua; (void)ub; (void)uc; (void)ud; (void)ue; (void)uf;
65
66
67
68
69
70
71
72
73
74
75 register int i;
76 register long *newstack;
77
78 newstack = (void*)kbd_stack;
79
80 for (i=0;i<NEW_SS/4;i++)
81 newstack[i]=0xdededede;
82
83 asm volatile (
84 "MOV SP, %0"
85 :: "r"(((char*)newstack)+NEW_SS)
86 : "memory"
87 );
88
89 mykbd_task_proceed();
90
91
92
93
94 _ExitTask();
95 }
96
97
98 long __attribute__((naked,noinline)) wrap_kbd_p1_f()
99 {
100
101 asm volatile(
102 "STMFD SP!, {R4-R7,LR}\n"
103 "SUB SP, SP, #0xC\n"
104 "BL my_kbd_read_keys\n"
105 "B _kbd_p1_f_cont\n"
106 );
107 return 0;
108 }
109
110 static int handle_taskTouchW = 0;
111
112 int jogdial_stopped=0;
113
114 void jogdial_control(int n) {
115
116 if (handle_taskTouchW == 0) {
117 handle_taskTouchW = _taskNameToId("tJogDial");
118 }
119
120 if (jogdial_stopped) {
121 if(!n) {
122
123 _taskResume(handle_taskTouchW);
124 }
125 } else {
126 if(n) {
127
128 _taskSuspend(handle_taskTouchW);
129 }
130 }
131 jogdial_stopped = n;
132 }
133
134
135 void my_kbd_read_keys()
136 {
137
138
139
140 kbd_update_key_state();
141
142 _kbd_read_keys_r2(physw_status);
143
144 kbd_update_physw_bits();
145
146 _kbd_pwr_off();
147 }
148
149 void kbd_fetch_data(long *dst)
150 {
151 _platformsub_kbd_fetch_data(dst);
152 }
153
154
155
156 int Get_JogDial(void){
157 return (*(int*)0xC0240304)>>16;
158 }
159
160 long get_jogdial_direction(void) {
161 old_jogdial=new_jogdial;
162 new_jogdial=Get_JogDial();
163 if (old_jogdial<new_jogdial) return JOGDIAL_LEFT;
164 else if (old_jogdial>new_jogdial) return JOGDIAL_RIGHT;
165 else return 0;
166 }
167