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
62 int jogdial_stopped=0;
63
64 long __attribute__((naked,noinline)) wrap_kbd_p1_f() {
65
66 asm volatile(
67 "STMFD SP!, {R1-R7,LR}\n"
68 "MOV R5, #0\n"
69 "BL my_kbd_read_keys\n"
70 "B _kbd_p1_f_cont\n"
71 );
72
73 return 0;
74 }
75
76
77 void __attribute__((noinline)) mykbd_task() {
78 while (physw_run) {
79 _SleepTask(physw_sleep_delay);
80
81 if (wrap_kbd_p1_f() == 1) {
82 _kbd_p2_f();
83 }
84 }
85
86 _ExitTask();
87 }
88
89
90
91
92
93 extern short* jog_position;
94
95 void jogdial_control(int n) {
96 if (jogdial_stopped && !n) {
97
98
99 jog_position[0] = jog_position[2] = (*(short*)0xC0240106);
100 }
101 jogdial_stopped = n;
102 }
103
104 void my_kbd_read_keys() {
105 kbd_update_key_state();
106 kbd_update_physw_bits();
107 }
108
109 void kbd_fetch_data(long *dst)
110 {
111 _GetKbdState(dst);
112 _kbd_read_keys_r2(dst);
113 }
114
115
116 int Get_JogDial(void) {
117 return (*(int*)0xC0240104)>>16;
118 }
119
120 static int new_jogdial = 0, old_jogdial = 0;
121
122 long get_jogdial_direction(void) {
123 old_jogdial=new_jogdial;
124 new_jogdial=Get_JogDial();
125
126 if (old_jogdial<new_jogdial) {
127 return JOGDIAL_LEFT;
128 } else if (old_jogdial>new_jogdial) {
129 return JOGDIAL_RIGHT;
130 } else {
131 return 0;
132 }
133 }