This source file includes following definitions.
- get_usb_bit
- mykbd_task
- wrap_kbd_p1_f
- my_kbd_read_keys
- jogdial_control
- 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
11
12 KeyMap keymap[] = {
13
14
15
16 { 0, KEY_SET ,0x00000004 },
17 { 0, KEY_DISPLAY ,0x00000008 },
18 { 2, KEY_MENU ,0x00000001 },
19 { 2, KEY_PRINT ,0x00000002 },
20 { 2, KEY_ZOOM_IN ,0x00000004 },
21 { 2, KEY_ZOOM_OUT ,0x00000008 },
22 { 2, KEY_LEFT ,0x00000010 },
23 { 2, KEY_RIGHT ,0x00000020 },
24 { 2, KEY_DOWN ,0x00000040 },
25 { 2, KEY_UP ,0x00000080 },
26 { 2, KEY_SHOOT_FULL ,0x00000300 },
27 { 2, KEY_SHOOT_FULL_ONLY ,0x00000200 },
28 { 2, KEY_SHOOT_HALF ,0x00000100 },
29
30 { 2, KEY_PLAYBACK ,0x00000800 },
31 { 0, 0, 0 }
32 };
33
34 int get_usb_bit()
35 {
36 long usb_physw[3];
37 usb_physw[USB_IDX] = 0;
38 _kbd_read_keys_r2(usb_physw);
39 return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ;
40 }
41
42 int jogdial_stopped=0;
43
44 void kbd_fetch_data(long*);
45
46 long __attribute__((naked)) wrap_kbd_p1_f();
47
48
49 void __attribute__((noinline))
50 mykbd_task()
51 {
52 while (physw_run){
53 _SleepTask(10);
54
55 if (wrap_kbd_p1_f() == 1){
56 _kbd_p2_f();
57 }
58 }
59 _ExitTask();
60 }
61
62 long __attribute__((naked,noinline)) wrap_kbd_p1_f()
63 {
64
65 asm volatile(
66 "STMFD SP!, {R1-R5,LR}\n"
67 "MOV R4, #0\n"
68 "BL my_kbd_read_keys\n"
69 "B _kbd_p1_f_cont\n"
70 );
71 return 0;
72 }
73
74 void my_kbd_read_keys()
75 {
76 kbd_update_key_state();
77
78 _kbd_read_keys_r2(physw_status);
79
80 kbd_update_physw_bits();
81 }
82
83 extern short rear_dial_position;
84
85 void jogdial_control(int n) {
86 jogdial_stopped = n;
87 }
88
89 void kbd_fetch_data(long *dst)
90 {
91
92 volatile long *mmio0 = (void*)0xc0220200;
93 volatile long *mmio1 = (void*)0xc0220204;
94 volatile long *mmio2 = (void*)0xc0220208;
95
96 dst[0] = *mmio0;
97 dst[1] = *mmio1;
98 dst[2] = *mmio2 & 0xffff;
99 }
100
101 static short new_jogdial = 0, old_jogdial = 0;
102
103 int Get_JogDial(void){
104 return (*(int*)0xC0240104)>>16;
105 }
106
107 long get_jogdial_direction(void) {
108 old_jogdial=new_jogdial;
109 new_jogdial=Get_JogDial();
110 if (old_jogdial<new_jogdial) return JOGDIAL_LEFT;
111 else if (old_jogdial>new_jogdial) return JOGDIAL_RIGHT;
112 else return 0;
113 }
114
115