This source file includes following definitions.
- get_usb_bit
- mykbd_task_proceed
- mykbd_task
- get_jogdial_counter
- get_jogdial_direction
- handle_jogdial
- jogdial_control
- my_kbd_read_keys
- kbd_fetch_data
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 _GetKbdState(long*);
11
12 int get_usb_bit() {
13 long usb_physw[3];
14 usb_physw[USB_IDX] = 0;
15 _kbd_read_keys_r2(usb_physw);
16 return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ;
17 }
18
19
20
21 KeyMap keymap[] = {
22
23 { 1, KEY_SHOOT_FULL ,0x00040001 },
24 { 1, KEY_SHOOT_FULL_ONLY ,0x00000001 },
25 { 1, KEY_SHOOT_HALF ,0x00040000 },
26 { 1, KEY_ZOOM_OUT ,0x00001000 },
27 { 1, KEY_ZOOM_IN ,0x00000800 },
28 { 1, KEY_VIDEO ,0x00000008 },
29 { 1, KEY_MENU ,0x00000010 },
30 { 1, KEY_DISPLAY ,0x00000400 },
31 { 1, KEY_UP ,0x00000020 },
32 { 1, KEY_DOWN ,0x00000040 },
33 { 1, KEY_RIGHT ,0x00000080 },
34 { 1, KEY_LEFT ,0x00000100 },
35 { 1, KEY_SET ,0x00000200 },
36 { 1, KEY_PRINT ,0x00002000 },
37
38
39
40
41
42 { 0, 0, 0 }
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86 static void __attribute__((noinline)) mykbd_task_proceed() {
87
88 extern void kbd_p2_f_my();
89 extern long wrap_kbd_p1_f();
90
91 while (physw_run) {
92 _SleepTask(physw_sleep_delay);
93 if ( wrap_kbd_p1_f() == 1) {
94
95 _kbd_p2_f();
96 }
97 }
98 }
99
100
101 void __attribute__((naked,noinline)) mykbd_task() {
102 mykbd_task_proceed();
103
104 _ExitTask();
105 }
106
107
108
109
110
111 int jogdial_stopped=0;
112
113 extern long jog_position[2];
114 extern long jog_hw_pos;
115
116 int get_jogdial_counter() {
117 int p;
118 p = jog_hw_pos & 0x7fffc;
119 if (p > 0x3fffc) {
120 p |= 0xfff80000;
121 }
122 return p;
123 }
124
125 long get_jogdial_direction(void) {
126 static int new_jogdial=0, old_jogdial=0;
127
128 old_jogdial=new_jogdial;
129 new_jogdial=get_jogdial_counter();
130 if (old_jogdial>new_jogdial) return JOGDIAL_LEFT;
131 else if (old_jogdial<new_jogdial) return JOGDIAL_RIGHT;
132 else return 0;
133 }
134
135 int handle_jogdial() {
136
137 if (jogdial_stopped) {
138
139 jog_position[0] = jog_position[1] = get_jogdial_counter();
140 return 0;
141 }
142 return 1;
143 }
144
145 void jogdial_control(int c) {
146 jogdial_stopped = c;
147 }
148
149 void my_kbd_read_keys() {
150 kbd_update_key_state();
151 kbd_update_physw_bits();
152 }
153
154 void kbd_fetch_data(long *dst)
155 {
156 _GetKbdState(dst);
157 _kbd_read_keys_r2(dst);
158 }
159
160