CHDK_DE Vorschauversion  Trunk Rev. 5549
 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)
 
#define SD_READONLY_FLAG   (0x20000)
 

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 35 der Datei kbd.c.

#define ERROR   (-1)

Definiert in Zeile 37 der Datei kbd.c.

#define NO_WAIT   0

Definiert in Zeile 45 der Datei kbd.c.

#define OK   0

Definiert in Zeile 36 der Datei kbd.c.

#define SD_READONLY_FLAG   (0x20000)

Definiert in Zeile 63 der Datei kbd.c.

#define SEM_DELETE_SAFE   0x4

Definiert in Zeile 41 der Datei kbd.c.

#define SEM_INVERSION_SAFE   0x8

Definiert in Zeile 42 der Datei kbd.c.

Definiert in Zeile 43 der Datei kbd.c.

#define SEM_Q_FIFO   0x0

Definiert in Zeile 39 der Datei kbd.c.

#define SEM_Q_PRIORITY   0x1

Definiert in Zeile 40 der Datei kbd.c.

#define STATUS   int

Definiert in Zeile 34 der Datei kbd.c.

#define WAIT_FOREVER   (-1)

Definiert in Zeile 46 der Datei kbd.c.

Dokumentation der benutzerdefinierten Typen

typedef int SEM_ID

Definiert in Zeile 55 der Datei kbd.c.

Dokumentation der Aufzählungstypen

Aufzählungswerte
SEM_EMPTY 
SEM_FULL 
SEM_EMPTY 
SEM_FULL 

Definiert in Zeile 48 der Datei kbd.c.

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

Dokumentation der Funktionen

long __attribute__ ( (naked)  )

Definiert in Zeile 67 der Datei kbd.c.

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

Definiert in Zeile 194 der Datei kbd.c.

196  {
197 
198  //create semaphore, empty = not available
200  //lock until 2nd rtask frees it
201  //_TakeSemaphore(semBinary,WAIT_FOREVER);
202 
203  mykbd_task_proceed();
204 
205  _ExitTask();
206  }
long __attribute__ ( (naked, noinline)  )

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

!!

IS_ERROR( hSoundHandle )

IS_ERROR( RetCode )

IS_ERROR( RetCode )

IS_ERROR( RetCode )

IS_ERROR( RetCode )

Definiert in Zeile 210 der Datei kbd.c.

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

Definiert in Zeile 482 der Datei kbd.c.

483 {
484  while(1){
485  //try to get semaphore
486  //volatile long *p; p=(void*) 0xc02200E4; *p=0x46;
488  //*p=0x0;
489 
490  //process data & store result
491  kbd_data_process_request_data = kbd_process(); //kbd_process_copy();
492 
493  //give semaphore
494  //volatile long *p2; p2=(void*) 0xc02200E0; *p2=0x46;
496  //*p2=0x0;
497 
498  //sleep to allow other task to grab it
499  msleep(10);
500  }
501 }
long my_kbd_read_keys ( long  x)

Definiert in Zeile 336 der Datei kbd.c.

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

Definiert in Zeile 472 der Datei kbd.c.

472  {
473  if (conf.remote_enable) {
474  return status &~USB_MASK;
475  }
476  return status;
477 }

Variablen-Dokumentation

int kbd_data_process_request_data =0
static

Definiert in Zeile 61 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 59 der Datei kbd.c.