CHDK_DE Vorschauversion  Trunk Rev. 6014
 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)
 
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  (void)ua; (void)ub; (void)uc; (void)ud; (void)ue; (void)uf;
198 
199  //create semaphore, empty = not available
201  //lock until 2nd rtask frees it
202  //_TakeSemaphore(semBinary,WAIT_FOREVER);
203 
204  mykbd_task_proceed();
205 
206  _ExitTask();
207  }
long __attribute__ ( (naked, noinline)  )

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

!!

IS_ERROR( hSoundHandle )

IS_ERROR( RetCode )

IS_ERROR( RetCode )

IS_ERROR( RetCode )

IS_ERROR( RetCode )

Definiert in Zeile 211 der Datei kbd.c.

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

Definiert in Zeile 474 der Datei kbd.c.

475 {
476  while(1){
477  //try to get semaphore
478  //volatile long *p; p=(void*) 0xc02200E4; *p=0x46;
480  //*p=0x0;
481 
482  //process data & store result
483  kbd_data_process_request_data = kbd_process(); //kbd_process_copy();
484 
485  //give semaphore
486  //volatile long *p2; p2=(void*) 0xc02200E0; *p2=0x46;
488  //*p2=0x0;
489 
490  //sleep to allow other task to grab it
491  msleep(10);
492  }
493 }
long my_kbd_read_keys ( long  x)

Definiert in Zeile 337 der Datei kbd.c.

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

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.