This source file includes following definitions.
- get_usb_bit
- 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 { 2, KEY_VIDEO , 0x00000010 },
15 { 2, KEY_PRINT , 0x00000040 },
16 { 2, KEY_PLAYBACK , 0x00000040 },
17 { 2, KEY_UP , 0x00000100 },
18 { 2, KEY_DOWN , 0x00000200 },
19 { 2, KEY_RIGHT , 0x00000400 },
20 { 2, KEY_LEFT , 0x00000800 },
21 { 2, KEY_SET , 0x00001000 },
22 { 2, KEY_MENU , 0x00002000 },
23 { 2, KEY_DISPLAY , 0x00004000 },
24 { 2, KEY_ERASE , 0x00008000 },
25 { 1, KEY_ZOOM_IN , 0x00004000 },
26 { 1, KEY_ZOOM_OUT , 0x00008000 },
27 { 1, KEY_SHOOT_FULL, 0x00003000 },
28 { 1, KEY_SHOOT_FULL_ONLY, 0x00002000 },
29 { 1, KEY_SHOOT_HALF, 0x00001000 },
30 { 0, 0, 0 }
31 };
32
33
34 int jogdial_stopped=0;
35
36 int get_usb_bit()
37 {
38 long usb_physw[3];
39 usb_physw[USB_IDX] = 0;
40 _kbd_read_keys_r2(usb_physw);
41 return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ;
42 }
43
44 extern void _GetKbdState(long* buffer);
45
46 long __attribute__((naked)) wrap_kbd_p1_f();
47
48 void __attribute__((noinline))
49 mykbd_task(long ua, long ub, long uc, long ud, long ue, long uf)
50 {
51 (void)ua; (void)ub; (void)uc; (void)ud; (void)ue; (void)uf;
52
53
54
55
56 kbd_new_state[0] = physw_status[0];
57 kbd_new_state[1] = physw_status[1];
58 kbd_new_state[2] = physw_status[2];
59
60 while (physw_run){
61 _SleepTask(10);
62
63 if (wrap_kbd_p1_f() == 1){
64 _kbd_p2_f();
65 }
66 }
67
68
69 _ExitTask();
70
71 }
72
73 long __attribute__((naked,noinline)) wrap_kbd_p1_f()
74 {
75
76 asm volatile(
77 "STMFD SP!, {R1-R7,LR}\n"
78 "MOV R5, #0\n"
79 "BL my_kbd_read_keys\n"
80 "B _kbd_p1_f_cont\n"
81 );
82
83 return 0;
84 }
85
86
87 void my_kbd_read_keys()
88 {
89 kbd_update_key_state();
90
91 _kbd_read_keys_r2(physw_status);
92
93 kbd_update_physw_bits();
94 }
95
96 void kbd_fetch_data(long *dst)
97 {
98 _GetKbdState(dst);
99 }
100
101
102 void jogdial_control(int n) {
103
104
105
106
107
108
109
110
111 jogdial_stopped = n;
112 }
113
114 int Get_JogDial(void) {
115 return (*(int*)0xC0240104)>>16;
116 }
117
118
119 long get_jogdial_direction(void) {
120 static int new_jogdial = 0;
121 int old_jogdial = 0;
122
123 old_jogdial = new_jogdial;
124 new_jogdial = Get_JogDial();
125
126 if (old_jogdial < new_jogdial)
127 return JOGDIAL_LEFT;
128 else if (old_jogdial > new_jogdial)
129 return JOGDIAL_RIGHT;
130 else
131 return 0;
132 }