This source file includes following definitions.
- get_usb_bit
- mykbd_task_proceed
- mykbd_task
- wrap_kbd_p1_f
- my_kbd_read_keys
1 #include "lolevel.h"
2 #include "platform.h"
3 #include "core.h"
4 #include "conf.h"
5 #include "keyboard.h"
6 #include "kbd_common.h"
7
8 long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
9 long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
10 long kbd_mod_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
11
12 int get_usb_bit()
13 {
14 long usb_physw[3];
15 usb_physw[USB_IDX] = 0;
16 _kbd_read_keys_r2(usb_physw);
17 return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ;
18 }
19
20 KeyMap keymap[] = {
21
22
23
24
25 { 0, KEY_PLAYBACK ,0x00020000 },
26 { 2, KEY_MENU ,0x01000000 },
27 { 2, KEY_MODE ,0x00800000 },
28 { 2, KEY_LEFT ,0x00400000 },
29 { 2, KEY_DOWN ,0x00200000 },
30 { 2, KEY_UP ,0x00100000 },
31 { 2, KEY_SET ,0x00000100 },
32 { 2, KEY_ZOOM_IN ,0x00000080 },
33 { 2, KEY_ZOOM_OUT ,0x00000040 },
34 { 2, KEY_SHOOT_FULL ,0x00000030 },
35 { 2, KEY_SHOOT_FULL_ONLY ,0x00000020 },
36 { 2, KEY_SHOOT_HALF ,0x00000010 },
37 { 2, KEY_RIGHT ,0x00000004 },
38 { 0, 0, 0 }
39 };
40
41
42 long __attribute__((naked)) wrap_kbd_p1_f() ;
43
44
45 static void __attribute__((noinline)) mykbd_task_proceed()
46 {
47
48
49
50 kbd_new_state[0] = physw_status[0];
51 kbd_new_state[1] = physw_status[1];
52 kbd_new_state[2] = physw_status[2] ^ KEYS_INV2;
53 while (physw_run){
54 _SleepTask(physw_sleep_delay);
55
56 if (wrap_kbd_p1_f() == 1){
57 _kbd_p2_f();
58 }
59 }
60 }
61
62
63 void __attribute__((naked,noinline)) mykbd_task()
64 {
65 mykbd_task_proceed();
66 _ExitTask();
67 }
68
69
70 long __attribute__((naked,noinline)) wrap_kbd_p1_f()
71 {
72 asm volatile(
73 "STMFD SP!, {R1-R5,LR}\n"
74 "MOV R4, #0\n"
75
76 "BL my_kbd_read_keys\n"
77 "B _kbd_p1_f_cont\n"
78 );
79 return 0;
80 }
81
82 void my_kbd_read_keys()
83 {
84
85 kbd_prev_state[0] = kbd_new_state[0];
86 kbd_prev_state[1] = kbd_new_state[1];
87 kbd_prev_state[2] = kbd_new_state[2];
88
89 extern void _kbd_read_keys(void);
90 _kbd_read_keys();
91
92
93 kbd_new_state[0] = physw_status[0];
94 kbd_new_state[1] = physw_status[1];
95 kbd_new_state[2] = physw_status[2] ^ KEYS_INV2;
96
97 if (kbd_process() == 0){
98
99 } else {
100
101 physw_status[0] = (kbd_new_state[0] | KEYS_MASK0) & (~KEYS_MASK0 | kbd_mod_state[0]);
102 physw_status[1] = (kbd_new_state[1] | KEYS_MASK1) & (~KEYS_MASK1 | kbd_mod_state[1]);
103 physw_status[2] = ((kbd_new_state[2] | KEYS_MASK2) & (~KEYS_MASK2 | kbd_mod_state[2])) ^ KEYS_INV2;
104 }
105
106
107 kbd_update_physw_bits();
108 }