CHDK_DE Vorschauversion  Trunk Rev. 5429
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
kbd.c-Dateireferenz
#include "lolevel.h"
#include "platform.h"
#include "core.h"
#include "conf.h"
#include "keyboard.h"
#include "kbd_common.h"
+ Include-Abhängigkeitsdiagramm für kbd.c:

gehe zum Quellcode dieser Datei

Makrodefinitionen

#define STATUS   int
 
#define BOOL   int
 
#define OK   0
 
#define ERROR   (-1)
 
#define SEM_Q_FIFO   0x0
 
#define SEM_Q_PRIORITY   0x1
 
#define SEM_DELETE_SAFE   0x4
 
#define SEM_INVERSION_SAFE   0x8
 
#define SEM_OPTION_MASK   (SEM_Q_FIFO|SEM_Q_PRIORITY|SEM_DELETE_SAFE|SEM_INVERSION_SAFE)
 
#define NO_WAIT   0
 
#define WAIT_FOREVER   (-1)
 

Typdefinitionen

typedef int SEM_ID
 

Aufzählungen

enum  SEM_B_STATE { SEM_EMPTY =0, SEM_FULL =1, SEM_EMPTY =0, SEM_FULL =1 }
 

Funktionen

SEM_ID _semBCreate (int options, SEM_B_STATE initialState)
 
long __attribute__ ((naked))
 
void __attribute__ ((noinline))
 
long __attribute__ ((naked, noinline))
 *-------------------------------------------------------------------— Mehr ...
 
long my_kbd_read_keys (long x)
 
int usb_power_status_override (int status)
 
void kbd_process_task ()
 

Variablen

long kbd_new_state [3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }
 
long kbd_prev_state [3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }
 
long kbd_mod_state [3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }
 
KeyMap keymap []
 
SEM_ID semBinary
 
static int kbd_data_process_request_data =0
 

Makro-Dokumentation

#define BOOL   int

Definiert in Zeile 34 der Datei kbd.c.

#define ERROR   (-1)

Definiert in Zeile 36 der Datei kbd.c.

#define NO_WAIT   0

Definiert in Zeile 44 der Datei kbd.c.

#define OK   0

Definiert in Zeile 35 der Datei kbd.c.

#define SEM_DELETE_SAFE   0x4

Definiert in Zeile 40 der Datei kbd.c.

#define SEM_INVERSION_SAFE   0x8

Definiert in Zeile 41 der Datei kbd.c.

Definiert in Zeile 42 der Datei kbd.c.

#define SEM_Q_FIFO   0x0

Definiert in Zeile 38 der Datei kbd.c.

#define SEM_Q_PRIORITY   0x1

Definiert in Zeile 39 der Datei kbd.c.

#define STATUS   int

Definiert in Zeile 33 der Datei kbd.c.

#define WAIT_FOREVER   (-1)

Definiert in Zeile 45 der Datei kbd.c.

Dokumentation der benutzerdefinierten Typen

typedef int SEM_ID

Definiert in Zeile 54 der Datei kbd.c.

Dokumentation der Aufzählungstypen

Aufzählungswerte
SEM_EMPTY 
SEM_FULL 
SEM_EMPTY 
SEM_FULL 

Definiert in Zeile 47 der Datei kbd.c.

47  {
48 
49  SEM_EMPTY =0,
50  SEM_FULL =1
51 
52 } SEM_B_STATE;

Dokumentation der Funktionen

long __attribute__ ( (naked)  )

Definiert in Zeile 63 der Datei kbd.c.

79  {
80  asm volatile
81  (
82  "STMFD SP!, {R4-R8,LR}\n"
83  "LDR R3, =0x20F8\n"
84  "SUB SP, SP, #8\n"
85  "LDR R2, [R3]\n"
86  "CMP R2, #2\n"
87  "BNE loc_FF830870\n"
88  "LDR R6, =0x11A48\n"
89  "MOV R8, SP\n"
90  "ADD R7, SP, #0x20-0x1C\n"
91 
92  "loc_FF83075C:\n"
93  "MOV R0, R8\n"
94  "BL _GetSystemTime\n"
95  "LDR R1, =wrap_kbd_p1_f\n" // (0xff8308e8)Replaced call to my own function...
96  "LDR R0, [SP,#0x20-0x20]\n"
97  "MOV R3, R7\n"
98  "ADD R0, R0, #0xA\n"
99  "MOV R2, R1\n"
100  "BL _SetTimerWhen\n"
101  "CMP R0, #0x15\n"
102  "MVN R3, R0\n"
103  "ANDNE R0, R3, #1\n"
104  "MOVEQ R0, #1\n"
105  "CMP R0, #0\n"
106  "BNE loc_FF8307A8\n"
107  "MOV R2, #0x1F0\n"
108  "LDR R0, =0xFF8306F4\n" //aError_tHtimer1
109  "LDR R1, =0xFF830000\n" //=aPhyswmngr_c
110  "ADD R2, R2, #2\n"
111  "BL sub_FF814C10\n"
112 
113  "loc_FF8307A8:\n"
114  "LDR R3, =0x11AA0\n"
115  "LDR R4, =0x11728\n"
116  "LDR R5, =0x11A60\n"
117  "LDR R0, [R3]\n"
118  "MOV R1, #0\n"
119  "BL _TakeSemaphore\n"
120  "LDR R2, [R4,#8]\n"
121  "LDR R3, [R5,#0x2C]\n"
122  "TST R2, R3\n"
123  "BEQ loc_FF8307E0\n"
124  "LDR R0, =0x119A8\n"
125  "LDR R1, [R6,#0xC]\n"
126  "BL sub_FF830C5C\n"
127  "LDR R2, [R4,#8]\n"
128 
129  "loc_FF8307E0:\n"
130  "LDR R3, [R5,#0x20]\n"
131  "TST R2, R3\n"
132  "BEQ loc_FF8307F8\n"
133  "LDR R0, =0x11958\n"
134  "LDR R1, [R6,#8]\n"
135  "BL sub_FF830C5C\n"
136 
137  "loc_FF8307F8:\n"
138  "LDR R0, [R4,#4]\n"
139  "LDR R3, [R5,#0x10]\n"
140  "TST R0, R3\n"
141  "BEQ loc_FF830818\n"
142  "LDR R0, =0x11908\n"
143  "LDR R1, [R6,#4]\n"
144  "BL sub_FF830D10\n"
145  "LDR R0, [R4,#4]\n"
146 
147  "loc_FF830818:\n"
148  "LDR R1, [R5,#4]\n"
149  "LDR R2, [R4,#8]\n"
150  "LDR R3, [R5,#8]\n"
151  "AND R1, R0, R1\n"
152  "AND R2, R2, R3\n"
153  "ORRS R1, R1, R2\n"
154  "BEQ loc_FF830844\n"
155  "LDR R0, =0x118b8\n"
156  "LDR R1, [R6]\n"
157  "BL sub_FF830C5C\n"
158  "LDR R0, [R4,#4]\n"
159 
160  "loc_FF830844:\n"
161  "LDR R3, [R5,#0x34]\n"
162  "TST R0, R3\n"
163  "BEQ loc_FF83085C\n"
164  "LDR R0, =0x119f8\n"
165  "LDR R1, [R6,#0x10]\n"
166  "BL sub_FF830C5C\n"
167 
168  "loc_FF83085C:\n"
169  "BL sub_FF8310C8\n"
170  "LDR R3, =0x20F8\n"
171  "LDR R2, [R3]\n"
172  "CMP R2, #2\n"
173  "BEQ loc_FF83075C\n"
174 
175  "loc_FF830870:\n"
176  "LDR R3, =0x11A9C\n"
177  "LDR R1, =0x20F8\n"
178  "MOV R2, #3\n"
179  "LDR R0, [R3]\n"
180  "STR R2, [R1]\n"
181  "BL sub_FF823144\n"
182  "BL _ExitTask\n"
183  "ADD SP, SP, #8\n"
184  "LDMFD SP!, {R4-R8,PC}\n"
185  );
186  }//ixus30 ok
void __attribute__ ( (noinline)  )

Definiert in Zeile 189 der Datei kbd.c.

191  {
192 
193  //create semaphore, empty = not available
195  //lock until 2nd rtask frees it
196  //_TakeSemaphore(semBinary,WAIT_FOREVER);
197 
198  mykbd_task_proceed();
199 
200  _ExitTask();
201  }
long __attribute__ ( (naked, noinline)  )

*-------------------------------------------------------------------—

!!

Definiert in Zeile 205 der Datei kbd.c.

206  {
207  // kbd_prev_state[0] = kbd_new_state[0];
209  // kbd_prev_state[2] = kbd_new_state[2];
210 
211  asm volatile
212  (
213  "STMFD SP!, {R4,R5,LR}\n" //@ff8308e8
214  "LDR R3, =0x20F4\n"
215  "SUB SP, SP, #8\n"
216  "LDR R2, [R3]\n"
217  "CMP R2, #1\n"
218  "BEQ loc_FF830914\n"
219  "MOV R2, #0x210\n"
220  "LDR R0, =0xFF8308D0\n"
221  "LDR R1, =0xFF830000\n"
222  "ADD R2, R2, #3\n"
223  "BL sub_FF814C10\n"
224 
225  "loc_FF830914:\n"
226  "LDR R1, =0x2108\n"
227  "LDR R2, [R1]\n"
228  "ADD R3, R2, #0x32\n"
229  "BIC R4, R3, #0xFF000000\n"
230  "BIC R4, R4, #0xF00000\n"
231  "CMP R2, R4\n"
232  "BCS loc_FF830954\n"
233  "MOV R5, R1\n"
234 
235  "loc_FF830934:\n"
236  "BL _GetCurrentMachineTime\n"
237  "CMP R0, R4\n"
238  "BCS loc_FF830984\n"
239  "BL _GetCurrentMachineTime\n"
240  "LDR R3, [R5]\n"
241  "CMP R3, R0\n"
242  "BCC loc_FF830934\n"
243  "B loc_FF830984\n"
244 
245  "loc_FF830954:\n"
246  "LDR R2, =0x2108\n"
247  "LDR R3, [R2]\n"
248  "CMP R3, R4\n"
249  "BLS loc_FF830984\n"
250  "MOV R5, R2\n"
251 
252  "loc_FF830968:\n"
253  "BL _GetCurrentMachineTime\n"
254  "CMP R0, R4\n"
255  "BCC loc_FF830968\n"
256  "BL _GetCurrentMachineTime\n"
257  "LDR R3, [R5]\n"
258  "CMP R3, R0\n"
259  "BCC loc_FF830968\n"
260 
261  "loc_FF830984:\n"
262  "LDR R4, =0x11728\n"
263  "MOV R0, R4\n"
264  "BL platformsub_kbd_fetch_data_my\n" // (sub_ff830e90) Replaced to a call to my own function..
265  "BL sub_FF830AB4\n"
266  "BL sub_FF830B1C\n"
267  "LDR R3, =0x20F4\n"
268  "MOV R2, #0\n"
269  "STR R2, [R3]\n"
270  "BL sub_FF83103C\n"
271  "LDR R3, [R4]\n"
272  "CMP R3, #0\n"
273  "BNE loc_FF8309CC\n"
274  "LDR R3, [R4,#4]\n"
275  "CMP R3, #0\n"
276  "BNE loc_FF8309CC\n"
277  "LDR R3, [R4,#8]\n"
278  "CMP R3, #0\n"
279  "BEQ loc_FF830A0C\n"
280 
281  "loc_FF8309CC:\n"
282  "LDR R3, =0x11728\n" // Address of key structure physw_status[]
283  "ADD R1, R3, #0xC\n"
284  "LDMIA R1, {R1,R12}\n"
285  "LDR R2, [R3,#0x14]\n"
286  "LDMIA R3, {R0,LR}\n"
287  "LDR R4, [R3,#8]\n"
288  "LDR R5, =0x11AA0\n"
289  "EOR R1, R1, R0\n"
290  "EOR R12, R12, LR\n"
291  "EOR R2, R2, R4\n"
292  "LDR R0, [R5]\n"
293  "STR R2, [R3,#0x14]\n"
294  "STR R1, [R3,#0xC]\n"
295  "STR R12, [R3,#0x10]\n"
296  "BL sub_FF823144\n"
297  "B loc_FF830A54\n"
298 
299  "loc_FF830A0C:\n"
300  "CMP R0, #1\n"
301  "BEQ loc_FF830A24\n"
302  "LDR R3, =0x20F8\n"
303  "LDR R2, [R3]\n"
304  "CMP R2, #2\n"
305  "BEQ loc_FF830A34\n"
306 
307  "loc_FF830A24:\n"
308  "LDR R3, =0x11AA0\n"
309  "LDR R0, [R3]\n"
310  "BL sub_FF823144\n"
311  "B loc_FF830A54\n"
312 
313  "loc_FF830A34:\n"
314  "MOV R0, SP\n"
315  "BL _GetSystemTime\n"
316  "LDR R1, =wrap_kbd_p1_f\n" // Replaced with a call to my own function ---------------------------------------------------------------------
317  "LDR R0, [SP,#0x14-0x14]\n"
318  "MOV R2, R1\n"
319  "ADD R0, R0, #0xA\n"
320  "ADD R3, SP, #0x14-0x10\n"
321  "BL _SetTimerWhen\n"
322 
323  "loc_FF830A54:\n"
324  "ADD SP, SP, #8\n"
325  "LDMFD SP!, {R4,R5,PC}\n"
326  );
327  return 0; // shut up the compiler
328 }
SEM_ID _semBCreate ( int  options,
SEM_B_STATE  initialState 
)
void kbd_process_task ( )

Definiert in Zeile 463 der Datei kbd.c.

464 {
465  while(1){
466  //try to get semaphore
467  //volatile long *p; p=(void*) 0xc02200E4; *p=0x46;
469  //*p=0x0;
470 
471  //process data & store result
472  kbd_data_process_request_data = kbd_process(); //kbd_process_copy();
473 
474  //give semaphore
475  //volatile long *p2; p2=(void*) 0xc02200E0; *p2=0x46;
477  //*p2=0x0;
478 
479  //sleep to allow other task to grab it
480  msleep(10);
481  }
482 }
long my_kbd_read_keys ( long  x)

Definiert in Zeile 331 der Datei kbd.c.

331  {
332  kbd_new_state[1]=x & 0xFFFF;
333 
334  //give semaphore away
336  //this should allow other tasks to grab it: (maybe not necessary)
337  msleep(0);
338 
339  //take semaphore again
341  //*p2=0;
342 
343  //data is now in kbd_data_process_request_data :)
344 
345  //if (kbd_process_copy() == 0)
347  return x;
348  }else{
349  return (kbd_new_state[1]&~KEYS_MASK1) | (kbd_mod_state[1] & KEYS_MASK1);
350  }
351 
352 }
int usb_power_status_override ( int  status)

Definiert in Zeile 453 der Datei kbd.c.

453  {
454  if (conf.remote_enable) {
455  return status &~USB_MASK;
456  }
457  return status;
458 }

Variablen-Dokumentation

int kbd_data_process_request_data =0
static

Definiert in Zeile 60 der Datei kbd.c.

long kbd_mod_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }

Definiert in Zeile 10 der Datei kbd.c.

long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }

Definiert in Zeile 8 der Datei kbd.c.

long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }

Definiert in Zeile 9 der Datei kbd.c.

KeyMap keymap[]
Initialisierung:
= {
{1, KEY_UP , 0x00000020 },
{1, KEY_DOWN , 0x00000040 },
{1, KEY_LEFT , 0x00000080 },
{1, KEY_RIGHT , 0x00000100 },
{1, KEY_SET , 0x00000200 },
{1, KEY_SHOOT_FULL , 0x00000006 },
{1, KEY_SHOOT_FULL_ONLY , 0x00000004 },
{1, KEY_SHOOT_HALF , 0x00000002 },
{1, KEY_ZOOM_IN , 0x00000008 },
{1, KEY_ZOOM_OUT , 0x00000010 },
{1, KEY_MENU , 0x00000400 },
{1, KEY_DISPLAY , 0x00000800 },
{1, KEY_PRINT , 0x00002000 },
{0, 0, 0 }
}

Definiert in Zeile 12 der Datei kbd.c.

SEM_ID semBinary

Definiert in Zeile 58 der Datei kbd.c.