This source file includes following definitions.
- get_usb_bit
- get_hdmi_hpd_bit
- mykbd_task
- wrap_kbd_p1_f
- 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
7 long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
8 long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
9 long kbd_mod_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
10
11
12 extern void _GetKbdState(long*);
13
14 int get_usb_bit()
15 {
16 long usb_physw[3];
17 usb_physw[USB_IDX] = 0;
18 _kbd_read_keys_r2(usb_physw);
19 return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ;
20 }
21
22 int get_hdmi_hpd_bit() {
23 long hpd_physw[3];
24 hpd_physw[HDMI_HPD_IDX] = 0;
25 _GetKbdState(hpd_physw);
26 return( ((hpd_physw[HDMI_HPD_IDX] & HDMI_HPD_FLAG)==HDMI_HPD_FLAG)?0:1) ;
27 }
28
29 KeyMap keymap[] = {
30
31
32
33 { 0, KEY_PLAYBACK ,0x00000001 },
34 { 1, KEY_MENU ,0x01000000 },
35 { 1, KEY_SET ,0x04000000 },
36 { 1, KEY_ZOOM_OUT ,0x10000000 },
37 { 1, KEY_ZOOM_IN ,0x20000000 },
38 { 1, KEY_VIDEO ,0x80000000 },
39 { 2, KEY_UP ,0x00000001 },
40 { 2, KEY_DOWN ,0x00000002 },
41 { 2, KEY_LEFT ,0x00000004 },
42 { 2, KEY_RIGHT ,0x00000008 },
43 { 2, KEY_SHOOT_FULL ,0x00000030 },
44 { 2, KEY_SHOOT_FULL_ONLY ,0x00000020 },
45 { 2, KEY_SHOOT_HALF ,0x00000010 },
46 { 0, 0, 0 }
47 };
48
49
50 long __attribute__((naked)) wrap_kbd_p1_f();
51
52
53 void __attribute__((noinline)) mykbd_task() {
54
55 while (physw_run) {
56 _SleepTask(physw_sleep_delay);
57
58 if (wrap_kbd_p1_f() == 1) {
59 _kbd_p2_f();
60 }
61 }
62
63 _ExitTask();
64 }
65
66
67 long __attribute__((naked,noinline)) wrap_kbd_p1_f() {
68 asm volatile(
69 "STMFD SP!, {R1-R7,LR}\n"
70 "MOV R5, #0\n"
71 "BL my_kbd_read_keys\n"
72 "B _kbd_p1_f_cont\n"
73 );
74
75 return 0;
76 }
77
78
79 void my_kbd_read_keys() {
80 kbd_update_key_state();
81 kbd_update_physw_bits();
82
83 extern void state_check_for_movie_af();
84 state_check_for_movie_af();
85 }
86
87 void kbd_fetch_data(long *dst)
88 {
89 _GetKbdState(dst);
90 _kbd_read_keys_r2(dst);
91 }