This source file includes following definitions.
- get_usb_bit
- get_hdmi_hpd_bit
- get_analog_av_bit
- wrap_kbd_p1_f
- mykbd_task
- get_dial_hw_position
- 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 #if CAM_REMOTE_HDMI_HPD
20 int get_hdmi_hpd_bit() {
21 long hpd_physw[3];
22 hpd_physw[HDMI_HPD_IDX] = 0;
23 _GetKbdState(hpd_physw);
24 return( ((hpd_physw[HDMI_HPD_IDX] & HDMI_HPD_FLAG)==HDMI_HPD_FLAG)?0:1) ;
25 }
26 #endif
27
28 #if CAM_REMOTE_ANALOG_AV
29 int get_analog_av_bit() {
30 long av_physw[3];
31 av_physw[ANALOG_AV_IDX] = 0;
32 _GetKbdState(av_physw);
33 return( ((av_physw[ANALOG_AV_IDX] & ANALOG_AV_FLAG)==ANALOG_AV_FLAG)?0:1) ;
34 }
35 #endif
36
37
38 KeyMap keymap[] = {
39 { 0, KEY_MENU ,0x00000020 },
40 { 0, KEY_UP ,0x00000040 },
41 { 0, KEY_DOWN ,0x00000080 },
42 { 0, KEY_RIGHT ,0x00000100 },
43 { 0, KEY_SET ,0x00000200 },
44 { 0, KEY_LEFT ,0x00000400 },
45 { 0, KEY_PLAYBACK ,0x00000800 },
46 { 0, KEY_ERASE ,0x00001000 },
47 { 0, KEY_VIDEO ,0x00002000 },
48 { 0, KEY_WIFI ,0x00010000 },
49 { 0, KEY_ZOOM_OUT ,0x00000004 },
50 { 0, KEY_ZOOM_OUT ,0x00000002 },
51 { 0, KEY_ZOOM_IN ,0x00000010 },
52 { 0, KEY_ZOOM_IN ,0x00000008 },
53
54 { 1, KEY_SHOOT_FULL ,0x00000c00 },
55 { 1, KEY_SHOOT_FULL_ONLY ,0x00000800 },
56 { 1, KEY_SHOOT_HALF ,0x00000400 },
57
58 { 0, 0, 0 }
59 };
60
61
62
63
64 long __attribute__((naked,noinline)) wrap_kbd_p1_f() {
65
66 asm volatile(
67 "push {r1-r7, lr}\n"
68 "movs r4, #0\n"
69 "bl my_kbd_read_keys\n"
70 "b kbd_p1_f_cont_my\n"
71
72 );
73
74 return 0;
75 }
76
77
78 void __attribute__((noinline)) mykbd_task() {
79 extern void kbd_p2_f_my();
80
81 while (physw_run) {
82 _SleepTask(physw_sleep_delay);
83
84 int r = wrap_kbd_p1_f();
85 if (r == 1) {
86 #ifdef CAM_HAS_JOGDIAL
87 kbd_p2_f_my();
88 #else
89 _kbd_p2_f();
90 #endif
91 }
92 }
93
94 _ExitTask();
95 }
96
97
98
99
100
101
102 #ifdef CAM_HAS_JOGDIAL
103 extern int _get_dial_hw_position(int dial);
104 #define DIAL_HW_REAR 4
105 int get_dial_hw_position(int dial)
106 {
107
108 return _get_dial_hw_position(dial)&~3;
109 }
110 int jogdial_stopped=0;
111
112 extern long dial_positions[2];
113
114 long get_jogdial_direction(void) {
115 static int new_jogdial=0, old_jogdial=0;
116
117 old_jogdial=new_jogdial;
118 new_jogdial=get_dial_hw_position(DIAL_HW_REAR);
119
120 if (old_jogdial<new_jogdial) return JOGDIAL_RIGHT;
121 else if (old_jogdial>new_jogdial) return JOGDIAL_LEFT;
122 else return 0;
123 }
124
125 int handle_jogdial() {
126
127 if (jogdial_stopped) {
128
129 dial_positions[0] = dial_positions[1] = get_dial_hw_position(DIAL_HW_REAR);
130 return 0;
131 }
132 return 1;
133 }
134
135 void jogdial_control(int c) {
136 jogdial_stopped = c;
137 }
138 #endif
139
140 int physw_override;
141
142 void my_kbd_read_keys() {
143 if(kbd_update_key_state()) {
144 physw_override = 0;
145 } else {
146
147
148 physw_override = -1;
149 }
150 kbd_update_physw_bits();
151 }
152
153 void kbd_fetch_data(long *dst)
154 {
155 _GetKbdState(dst);
156 _kbd_read_keys_r2(dst);
157 }