This source file includes following definitions.
- get_usb_bit
- mykbd_task_proceed
- 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 { 2, KEY_SHOOT_FULL ,0x00002002 },
12 { 2, KEY_SHOOT_HALF ,0x00002000 },
13 { 2, KEY_SHOOT_FULL_ONLY ,0x00000002 },
14 { 2, KEY_POWER ,0x00000008 },
15 { 2, KEY_PLAYBACK ,0x00000100 },
16
17 { 1, KEY_VIDEO ,0x00000080 },
18 { 1, KEY_UP ,0x00000400 },
19 { 1, KEY_RIGHT ,0x00000800 },
20 { 1, KEY_SET ,0x00001000 },
21 { 1, KEY_UP_SOFT ,0x00002000 },
22 { 1, KEY_RIGHT_SOFT ,0x00004000 },
23 { 1, KEY_LEFT ,0x00008000 },
24 { 1, KEY_MENU ,0x00010000 },
25 { 1, KEY_DOWN ,0x00020000 },
26 { 1, KEY_LEFT_SOFT ,0x00040000 },
27 { 1, KEY_DOWN_SOFT ,0x00080000 },
28
29
30 { 1, KEY_ZOOM_IN , 0x00000004 },
31 { 1, KEY_ZOOM_IN , 0x00000008 },
32 { 1, KEY_ZOOM_OUT , 0x00000001 },
33 { 1, KEY_ZOOM_OUT , 0x00000002 },
34
35 { 0, 0, 0 }
36 };
37
38 #define NEW_SS (0x2000)
39
40 int get_usb_bit()
41 {
42 long usb_physw[3];
43 usb_physw[USB_IDX] = 0;
44 _kbd_read_keys_r2(usb_physw);
45 return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ;
46 }
47
48 static char kbd_stack[NEW_SS];
49
50 extern void _GetKbdState(long *dst);
51
52 int jogdial_stopped=0;
53
54 long __attribute__((naked)) wrap_kbd_p1_f();
55
56 static void __attribute__((noinline)) mykbd_task_proceed() {
57 while (physw_run) {
58 _SleepTask(physw_sleep_delay);
59
60 if (wrap_kbd_p1_f() == 1) {
61 _kbd_p2_f();
62 }
63 }
64 }
65
66 void __attribute__((naked,noinline)) mykbd_task() {
67 register int i;
68 register long *newstack;
69
70 newstack = (void*)kbd_stack;
71
72 for (i=0;i<NEW_SS/4;i++)
73 newstack[i]=0xdededede;
74
75 asm volatile (
76 "MOV SP, %0"
77 :: "r"(((char*)newstack)+NEW_SS)
78 : "memory"
79 );
80
81
82
83 mykbd_task_proceed();
84
85
86
87
88 _ExitTask();
89 }
90
91
92 long __attribute__((naked,noinline)) wrap_kbd_p1_f() {
93 asm volatile(
94 "STMFD SP!, {R1-R5,LR}\n"
95 "MOV R4, #0\n"
96
97 "BL my_kbd_read_keys\n"
98 "B _kbd_p1_f_cont\n"
99 );
100 return 0;
101 }
102
103 void my_kbd_read_keys() {
104 kbd_update_key_state();
105 kbd_update_physw_bits();
106 }
107
108 void kbd_fetch_data(long *dst)
109 {
110 _GetKbdState(dst);
111 _kbd_read_keys_r2(dst);
112 }
113
114
115
116 void jogdial_control(int n) {
117
118
119
120
121
122
123
124
125 jogdial_stopped = n;
126 }
127
128 int Get_JogDial(void) {
129 return (*(int*)0xC0240104)>>16;
130 }
131
132 static int new_jogdial=0, old_jogdial=0;
133
134 long get_jogdial_direction(void) {
135 old_jogdial=new_jogdial;
136 new_jogdial=Get_JogDial();
137
138 if (old_jogdial<new_jogdial) {
139 return JOGDIAL_LEFT;
140 } else if (old_jogdial>new_jogdial) {
141 return JOGDIAL_RIGHT;
142 } else {
143 return 0;
144 }
145 }