This source file includes following definitions.
- get_usb_bit
- my_blinkk
- mykbd_task
- wrap_kbd_p1_f
- jogdial_control
- my_kbd_read_keys
- kbd_fetch_data
- 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 extern void _GetKbdState(long*);
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_ZOOM_OUT , 0x00000003 },
26 { 0, KEY_ZOOM_OUT , 0x00000001 },
27 { 0, KEY_ZOOM_OUT , 0x00000002 },
28 { 0, KEY_ZOOM_IN , 0x0000000C },
29 { 0, KEY_ZOOM_IN , 0x00000004 },
30 { 0, KEY_ZOOM_IN , 0x00000008 },
31 { 0, KEY_DISPLAY , 0x00000800 },
32 { 0, KEY_UP , 0x00001000 },
33 { 0, KEY_RIGHT , 0x00006000 },
34 { 0, KEY_SET , 0x00010000 },
35 { 0, KEY_DOWN , 0x00020000 },
36 { 0, KEY_MENU , 0x00040000 },
37 { 0, KEY_VIDEO , 0x00080000 },
38
39
40
41
42 { 1, KEY_PRINT , 0x00200000 },
43 { 1, KEY_PLAYBACK , 0x00200000 },
44
45
46 { 2, KEY_LEFT , 0x00000100 },
47 { 2, KEY_SHOOT_FULL , 0x00002002 },
48 { 2, KEY_SHOOT_FULL_ONLY , 0x00000002 },
49 { 2, KEY_SHOOT_HALF , 0x00002000 },
50
51 { 0, 0, 0 }
52 };
53
54
55 #if 0
56 void my_blinkk(void) {
57 int i;
58 while(1) {
59 *((volatile int *) 0xC0220130) = 0x46;
60 for (i=0; i<0x200000; i++) { asm volatile ( "nop\n" ); }
61
62 *((volatile int *) 0xC0220130) = 0x44;
63 for (i=0; i<0x200000; i++) { asm volatile ( "nop\n" ); }
64
65 *((volatile int *) 0xC0220130) = 0x46;
66 for (i=0; i<0x200000; i++) { asm volatile ( "nop\n" ); }
67
68 *((volatile int *) 0xC0220130) = 0x44;
69 for (i=0; i<0x900000; i++) { asm volatile ( "nop\n" ); }
70 }
71 }
72 #endif
73
74
75 int jogdial_stopped=0;
76
77 long __attribute__((naked)) wrap_kbd_p1_f();
78
79
80 void __attribute__((noinline)) mykbd_task() {
81 while (physw_run) {
82 _SleepTask(physw_sleep_delay);
83
84 if (wrap_kbd_p1_f() == 1) {
85 _kbd_p2_f();
86 }
87 }
88
89 _ExitTask();
90 }
91
92
93 long __attribute__((naked,noinline)) wrap_kbd_p1_f() {
94 asm volatile(
95 "STMFD SP!, {R1-R7,LR}\n"
96 "MOV R5, #0\n"
97
98 "BL my_kbd_read_keys\n"
99 "B _kbd_p1_f_cont\n"
100 );
101
102 return 0;
103 }
104
105
106
107
108 extern short* jog_position;
109
110 void jogdial_control(int n)
111 {
112 if (jogdial_stopped && !n)
113 {
114
115
116 jog_position[0] = jog_position[2] = (*(short*)0xC0240106);
117 }
118 jogdial_stopped = n;
119 }
120
121
122 void my_kbd_read_keys() {
123 kbd_update_key_state();
124 kbd_update_physw_bits();
125 }
126
127 void kbd_fetch_data(long *dst)
128 {
129 _GetKbdState(dst);
130 _kbd_read_keys_r2(dst);
131 }
132
133 int Get_JogDial(void) {
134 return (*(int*)0xC0240104)>>16;
135 }
136
137 static int new_jogdial=0, old_jogdial=0;
138
139 long get_jogdial_direction(void) {
140 old_jogdial=new_jogdial;
141 new_jogdial=Get_JogDial();
142
143 if (old_jogdial<new_jogdial) {
144 return JOGDIAL_RIGHT;
145 } else if (old_jogdial>new_jogdial) {
146 return JOGDIAL_LEFT;
147 } else {
148 return 0;
149 }
150 }