This source file includes following definitions.
- get_usb_bit
- my_blinkk
- wrap_kbd_p1_f
- mykbd_task
- 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 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
20 KeyMap keymap[] = {
21 { 1, KEY_PLAYBACK ,0x00800000 },
22 { 1, KEY_SHOOT_FULL ,0x03000000 },
23 { 1, KEY_SHOOT_FULL_ONLY ,0x02000000 },
24 { 1, KEY_SHOOT_HALF ,0x01000000 },
25 { 1, KEY_ZOOM_OUT ,0x0C000000 },
26 { 1, KEY_ZOOM_OUT ,0x04000000 },
27 { 1, KEY_ZOOM_OUT ,0x08000000 },
28 { 1, KEY_ZOOM_IN ,0x30000000 },
29 { 1, KEY_ZOOM_IN ,0x10000000 },
30 { 1, KEY_ZOOM_IN ,0x20000000 },
31 { 2, KEY_VIDEO ,0x00000020 },
32 { 2, KEY_MENU ,0x00000040 },
33 { 2, KEY_DISPLAY ,0x00000080 },
34 { 2, KEY_UP ,0x00000100 },
35 { 2, KEY_DOWN ,0x00000200 },
36 { 2, KEY_RIGHT ,0x00000400 },
37 { 2, KEY_LEFT ,0x00000800 },
38 { 2, KEY_SET ,0x00001000 },
39 { 0, 0, 0 }
40 };
41
42
43 #if 0
44 void my_blinkk(void) {
45 int i;
46 while(1) {
47 *((volatile int *) 0xC0220130) = 0x46;
48 for (i=0; i<0x200000; i++) { asm volatile ( "nop\n" ); }
49
50 *((volatile int *) 0xC0220130) = 0x44;
51 for (i=0; i<0x200000; i++) { asm volatile ( "nop\n" ); }
52
53 *((volatile int *) 0xC0220130) = 0x46;
54 for (i=0; i<0x200000; i++) { asm volatile ( "nop\n" ); }
55
56 *((volatile int *) 0xC0220130) = 0x44;
57 for (i=0; i<0x900000; i++) { asm volatile ( "nop\n" ); }
58 }
59 }
60 #endif
61 int jogdial_stopped=0;
62
63 long __attribute__((naked,noinline)) wrap_kbd_p1_f() {
64
65 asm volatile(
66 "STMFD SP!, {R1-R7,LR}\n"
67 "MOV R5, #0\n"
68 "BL my_kbd_read_keys\n"
69 "B _kbd_p1_f_cont\n"
70 );
71
72 return 0;
73 }
74
75
76 void __attribute__((noinline)) mykbd_task() {
77 while (physw_run) {
78 _SleepTask(physw_sleep_delay);
79
80 if (wrap_kbd_p1_f() == 1) {
81 _kbd_p2_f();
82 }
83 }
84
85 _ExitTask();
86 }
87
88
89
90
91
92 extern short* jog_position;
93
94 void jogdial_control(int n) {
95 if (jogdial_stopped && !n) {
96
97
98 jog_position[0] = jog_position[2] = (*(short*)0xC0240106);
99 }
100 jogdial_stopped = n;
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 int Get_JogDial(void) {
116 return (*(int*)0xC0240104)>>16;
117 }
118
119 static int new_jogdial = 0, old_jogdial = 0;
120
121 long get_jogdial_direction(void) {
122 old_jogdial=new_jogdial;
123 new_jogdial=Get_JogDial();
124
125 if (old_jogdial<new_jogdial) {
126 return JOGDIAL_LEFT;
127 } else if (old_jogdial>new_jogdial) {
128 return JOGDIAL_RIGHT;
129 } else {
130 return 0;
131 }
132 }