This source file includes following definitions.
- taskHook
- boot
- sub_FF8101A0_my
- sub_FF810FC4_my
- sub_FF814D38_my
- taskcreate_Startup_my
- task_Startup_my
- taskcreatePhySw_my
- CreateTask_spytask
- init_file_modules_task
- sub_FF86FEBC_my
- sub_FF853244_my
- sub_FF852FE4_my
- sub_FF852D74_my
- task_JogDial_my
- task_blinker
- CreateTask_blinker
1 #include "lolevel.h"
2 #include "platform.h"
3 #include "core.h"
4 #include "dryos31.h"
5
6 #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
7
8 const char * const new_sa = &_end;
9
10
11 extern long wrs_kernel_bss_start;
12 extern long wrs_kernel_bss_end;
13
14
15 void CreateTask_spytask();
16 void boot();
17 void capt_seq_task();
18
19 extern void task_CaptSeq();
20 extern void task_InitFileModules();
21 extern void task_MovieRecord();
22 extern void task_ExpDrv();
23 extern void task_RotaryEncoder();
24 extern void task_FileWrite();
25 void task_JogDial_my();
26
27 void taskHook(context_t **context) {
28 task_t *tcb=(task_t*)((char*)context-offsetof(task_t, context));
29
30
31
32 if(tcb->entry == task_CaptSeq) tcb->entry = (void*)capt_seq_task;
33 if(tcb->entry == task_InitFileModules) tcb->entry = (void*)init_file_modules_task;
34 if(tcb->entry == task_MovieRecord) tcb->entry = (void*)movie_record_task;
35 if(tcb->entry == task_ExpDrv) tcb->entry = (void*)exp_drv_task;
36 if(tcb->entry == task_RotaryEncoder) tcb->entry = (void*)task_JogDial_my;
37 if(tcb->entry == task_FileWrite) tcb->entry = (void*)filewritetask;
38 }
39
40 #define DEBUG_LED ((unsigned volatile *)0xC0220130)
41 #define GREEN_LED ((unsigned volatile *)0xC0220134)
42
43
44 void boot() {
45 asm volatile(
46 " LDR R1, =0xC0410000 \n"
47 " MOV R0, #0 \n"
48 " STR R0, [R1] \n"
49 " MOV R1, #0x78 \n"
50 " MCR p15, 0, R1, c1, c0 \n"
51 " MOV R1, #0 \n"
52 " MCR p15, 0, R1, c7, c10, 4 \n"
53 " MCR p15, 0, R1, c7, c5 \n"
54 " MCR p15, 0, R1, c7, c6 \n"
55 " MOV R0, #0x3D \n"
56 " MCR p15, 0, R0, c6, c0 \n"
57 " MOV R0, #0xC000002F \n"
58 " MCR p15, 0, R0, c6, c1 \n"
59 " MOV R0, #0x33 \n"
60 " MCR p15, 0, R0, c6, c2 \n"
61 " MOV R0, #0x40000033 \n"
62 " MCR p15, 0, R0, c6, c3 \n"
63 " MOV R0, #0x80000017 \n"
64 " MCR p15, 0, R0, c6, c4 \n"
65 " LDR R0, =0xFF80002D \n"
66 " MCR p15, 0, R0, c6, c5 \n"
67 " MOV R0, #0x34 \n"
68 " MCR p15, 0, R0, c2, c0 \n"
69 " MOV R0, #0x34 \n"
70 " MCR p15, 0, R0, c2, c0, 1 \n"
71 " MOV R0, #0x34 \n"
72 " MCR p15, 0, R0, c3, c0 \n"
73 " LDR R0, =0x3333330 \n"
74 " MCR p15, 0, R0, c5, c0, 2 \n"
75 " LDR R0, =0x3333330 \n"
76 " MCR p15, 0, R0, c5, c0, 3 \n"
77 " MRC p15, 0, R0, c1, c0 \n"
78 " ORR R0, R0, #0x1000 \n"
79 " ORR R0, R0, #4 \n"
80 " ORR R0, R0, #1 \n"
81 " MCR p15, 0, R0, c1, c0 \n"
82 " MOV R1, #0x80000006 \n"
83 " MCR p15, 0, R1, c9, c1 \n"
84 " MOV R1, #6 \n"
85 " MCR p15, 0, R1, c9, c1, 1 \n"
86 " MRC p15, 0, R1, c1, c0 \n"
87 " ORR R1, R1, #0x50000 \n"
88 " MCR p15, 0, R1, c1, c0 \n"
89 " LDR R2, =0xC0200000 \n"
90 " MOV R1, #1 \n"
91 " STR R1, [R2, #0x10C] \n"
92 " MOV R1, #0xFF \n"
93 " STR R1, [R2, #0xC] \n"
94 " STR R1, [R2, #0x1C] \n"
95 " STR R1, [R2, #0x2C] \n"
96 " STR R1, [R2, #0x3C] \n"
97 " STR R1, [R2, #0x4C] \n"
98 " STR R1, [R2, #0x5C] \n"
99 " STR R1, [R2, #0x6C] \n"
100 " STR R1, [R2, #0x7C] \n"
101 " STR R1, [R2, #0x8C] \n"
102 " STR R1, [R2, #0x9C] \n"
103 " STR R1, [R2, #0xAC] \n"
104 " STR R1, [R2, #0xBC] \n"
105 " STR R1, [R2, #0xCC] \n"
106 " STR R1, [R2, #0xDC] \n"
107 " STR R1, [R2, #0xEC] \n"
108 " STR R1, [R2, #0xFC] \n"
109 " LDR R1, =0xC0400008 \n"
110 " LDR R2, =0x430005 \n"
111 " STR R2, [R1] \n"
112 " MOV R1, #1 \n"
113 " LDR R2, =0xC0243100 \n"
114 " STR R2, [R1] \n"
115 " LDR R2, =0xC0242010 \n"
116 " LDR R1, [R2] \n"
117 " ORR R1, R1, #1 \n"
118 " STR R1, [R2] \n"
119 " LDR R0, =0xFFB7E0D4 \n"
120 " LDR R1, =0x1900 \n"
121 " LDR R3, =0xD7EC \n"
122 "loc_FF81013C:\n"
123 " CMP R1, R3 \n"
124 " LDRCC R2, [R0], #4 \n"
125 " STRCC R2, [R1], #4 \n"
126 " BCC loc_FF81013C \n"
127 " LDR R1, =0x148428 \n"
128 " MOV R2, #0 \n"
129 "loc_FF810154:\n"
130 " CMP R3, R1 \n"
131 " STRCC R2, [R3], #4 \n"
132 " BCC loc_FF810154 \n"
133 );
134
135 *(int*)0x1934=(int)taskHook;
136
137
138 *(int*)(0x22CC)= (*(int*)0xC0220080)&1 ? 0x400000 : 0x200000;
139
140
141 asm volatile ("B sub_FF8101A0_my\n");
142 }
143
144 void __attribute__((naked,noinline)) sub_FF8101A0_my() {
145 asm volatile (
146 " LDR R0, =0xFF810218\n"
147 " MOV R1, #0\n"
148 " LDR R3, =0xFF810250\n"
149 "loc_FF8101AC:\n"
150 " CMP R0, R3\n"
151 " LDRCC R2, [R0],#4\n"
152 " STRCC R2, [R1],#4\n"
153 " BCC loc_FF8101AC\n"
154 " LDR R0, =0xFF810250\n"
155 " MOV R1, #0x4B0\n"
156 " LDR R3, =0xFF810464\n"
157 "loc_FF8101C8:\n"
158 " CMP R0, R3\n"
159 " LDRCC R2, [R0],#4\n"
160 " STRCC R2, [R1],#4\n"
161 " BCC loc_FF8101C8\n"
162 " MOV R0, #0xD2\n"
163 " MSR CPSR_cxsf, R0\n"
164 " MOV SP, #0x1000\n"
165 " MOV R0, #0xD3\n"
166 " MSR CPSR_cxsf, R0\n"
167 " MOV SP, #0x1000\n"
168 " LDR R0, =0x6C4\n"
169 " LDR R2, =0xEEEEEEEE\n"
170 " MOV R3, #0x1000\n"
171 "loc_FF8101FC:\n"
172 " CMP R0, R3\n"
173 " STRCC R2, [R0],#4\n"
174 " BCC loc_FF8101FC\n"
175 " BL sub_FF810FC4_my\n"
176 );
177 }
178
179
180 void __attribute__((naked,noinline)) sub_FF810FC4_my( ) {
181 asm volatile (
182 " STR LR, [SP, #-4]! \n"
183 " SUB SP, SP, #0x74 \n"
184 " MOV R0, SP \n"
185 " MOV R1, #0x74 \n"
186 " BL sub_FFAE95E0 \n"
187 " MOV R0, #0x53000 \n"
188 " STR R0, [SP, #4] \n"
189 #ifdef CHDK_NOT_IN_CANON_HEAP
190 " LDR R0, =0x148428 \n"
191 #else
192 "LDR R0, =new_sa\n"
193 "LDR R0, [R0]\n"
194 #endif
195 " LDR R2, =0x2F9C00 \n"
196 " LDR R1, =0x2F24A8 \n"
197 " STR R0, [SP, #8] \n"
198 " SUB R0, R1, R0 \n"
199 " ADD R3, SP, #0xC \n"
200 " STR R2, [SP] \n"
201 " STMIA R3, {R0-R2} \n"
202 " MOV R0, #0x22 \n"
203 " STR R0, [SP, #0x18] \n"
204 " MOV R0, #0x68 \n"
205 " STR R0, [SP, #0x1C] \n"
206 " LDR R0, =0x19B \n"
207 " LDR R1, =sub_FF814D38_my \n"
208 "LDR PC, =0xFF811018\n"
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232 );
233 }
234
235 void __attribute__((naked,noinline)) sub_FF814D38_my() {
236 asm volatile (
237 " STMFD SP!, {R4,LR}\n"
238 " BL sub_FF810954\n"
239 " BL sub_FF8190B4\n"
240 " CMP R0, #0\n"
241 " LDRLT R0, =0xFF814E4C\n"
242 " BLLT sub_FF814E2C\n"
243 " BL sub_FF814974\n"
244 " CMP R0, #0\n"
245 " LDRLT R0,=0xFF814E54\n"
246 " BLLT sub_FF814E2C\n"
247 " LDR R0, =0xFF814E64\n"
248 " BL sub_FF814A5C\n"
249 " CMP R0, #0\n"
250 " LDRLT R0, =0xFF814E6C\n"
251 " BLLT sub_FF814E2C\n"
252 " LDR R0, =0xFF814E64\n"
253 " BL sub_FF813578\n"
254 " CMP R0, #0\n"
255 " LDRLT R0, =0xFF814E80\n"
256 " BLLT sub_FF814E2C\n"
257 " BL sub_FF818BCC\n"
258 " CMP R0, #0\n"
259 " LDRLT R0, =0xFF814E8C\n"
260 " BLLT sub_FF814E2C\n"
261 " BL sub_FF8114A8\n"
262 " CMP R0, #0\n"
263 " LDRLT R0, =0xFF814E98\n"
264 " BLLT sub_FF814E2C\n"
265 " LDMFD SP!, {R4,LR}\n"
266 " B taskcreate_Startup_my\n"
267 );
268 }
269
270 void __attribute__((naked,noinline)) taskcreate_Startup_my() {
271 asm volatile (
272 " STMFD SP!, {R3,LR} \n"
273
274 " BL sub_FF828D20 \n"
275 " CMP R0, #0 \n"
276 " BNE loc_FF81C298 \n"
277 " BL sub_FF821BA0 \n"
278 " CMP R0, #0 \n"
279 " BNE loc_FF81C298 \n"
280 " BL sub_FF821248 \n"
281 " LDR R1, =0xC0220000 \n"
282 " MOV R0, #0x44 \n"
283 " STR R0, [R1, #0x1C] \n"
284 " BL sub_FF821438 \n"
285 "loc_FF81C294:\n"
286 " B loc_FF81C294 \n"
287 "loc_FF81C298:\n"
288
289
290 " BL sub_FF826FD8 \n"
291 " LDR R1, =0x34E000 \n"
292 " MOV R0, #0 \n"
293 " BL sub_FF827420 \n"
294 " BL sub_FF8271CC \n"
295 " MOV R3, #0 \n"
296 " STR R3, [SP] \n"
297 " LDR R3, =task_Startup_my\n"
298 " MOV R2, #0 \n"
299 " MOV R1, #0x19 \n"
300 " LDR R0, =0xFF81C2E0 \n"
301 " BL sub_FF81AFAC \n"
302 " MOV R0, #0 \n"
303 " LDMFD SP!, {R12,PC} \n"
304 );
305 }
306
307 void CreateTask_blinker();
308
309 void __attribute__((naked,noinline)) task_Startup_my( ) {
310 asm volatile (
311 " STMFD SP!, {R4,LR} \n"
312 " BL sub_FF815394 \n"
313 " BL sub_FF822C88 \n"
314 " BL sub_FF820F04 \n"
315
316 " BL sub_FF828F44 \n"
317
318 " BL CreateTask_spytask\n"
319 " BL sub_FF8290EC \n"
320 " BL sub_FF81FB90 \n"
321 " BL sub_FF828F74 \n"
322 " BL sub_FF8265D8 \n"
323 " BL sub_FF8290F0 \n"
324 " BL taskcreatePhySw_my\n"
325 " LDR PC, =0xff81c230\n"
326
327
328
329
330
331
332
333
334
335
336
337
338 );
339 }
340
341 void __attribute__((naked,noinline)) taskcreatePhySw_my() {
342 asm volatile (
343 " STMFD SP!, {R3-R5,LR} \n"
344 " LDR R4, =0x1C28 \n"
345 " LDR R0, [R4, #0x10] \n"
346 " CMP R0, #0 \n"
347 " BNE loc_FF821AC8 \n"
348 " MOV R3, #0 \n"
349 " STR R3, [SP] \n"
350 " LDR R3, =mykbd_task\n"
351
352 " MOV R2, #0x2000 \n"
353 " MOV R1, #0x17 \n"
354 " LDR R0, =0xFF821C98 \n"
355 " BL sub_FF827220 \n"
356 " STR R0, [R4, #0x10] \n"
357 "loc_FF821AC8:\n"
358 " BL sub_FF84431C \n"
359 " BL sub_FF86DA80 \n"
360 " BL sub_FF847864 \n"
361 " CMP R0, #0 \n"
362 " LDREQ R1, =0xEC84 \n"
363 " LDMEQFD SP!, {R3-R5,LR} \n"
364 " BEQ sub_FF86DA08 \n"
365 " LDMFD SP!, {R3-R5,PC} \n"
366 );
367 }
368
369 void CreateTask_spytask() {
370 _CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
371 }
372
373 void __attribute__((naked,noinline)) init_file_modules_task() {
374 asm volatile (
375 " STMFD SP!, {R4-R6,LR} \n"
376 " BL sub_FF86FE90 \n"
377 " LDR R5, =0x5006 \n"
378 " MOVS R4, R0 \n"
379 " MOVNE R1, #0 \n"
380 " MOVNE R0, R5 \n"
381 " BLNE sub_FF874D2C \n"
382 " BL sub_FF86FEBC_my \n"
383 " BL core_spytask_can_start\n"
384 " CMP R4, #0 \n"
385 " MOVEQ R0, R5 \n"
386 " LDMEQFD SP!, {R4-R6,LR} \n"
387 " MOVEQ R1, #0 \n"
388 " BEQ sub_FF874D2C \n"
389 " LDMFD SP!, {R4-R6,PC} \n"
390 );
391 }
392
393 void __attribute__((naked,noinline)) sub_FF86FEBC_my( ) {
394 asm volatile (
395 " STMFD SP!, {R4,LR} \n"
396 " MOV R0, #3 \n"
397 " BL sub_FF853244_my \n"
398 " LDR PC, =0xff86fecc\n"
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414 );
415 }
416
417
418 void __attribute__((naked,noinline)) sub_FF853244_my( ) {
419 asm volatile (
420 " STMFD SP!, {R4-R8,LR} \n"
421 " MOV R6, R0 \n"
422 " BL sub_FF8531AC \n"
423 " LDR R1, =0x113DC \n"
424 " MOV R5, R0 \n"
425 " ADD R4, R1, R0, LSL #7 \n"
426 " LDR R0, [R4, #0x70] \n"
427 " CMP R0, #4 \n"
428 " LDREQ R1, =0x6D8 \n"
429 " LDREQ R0, =0xFF852CD0 \n"
430 " BLEQ sub_FF81B284 \n"
431 " MOV R1, R6 \n"
432 " MOV R0, R5 \n"
433 " BL sub_FF852C18 \n"
434 " LDR R0, [R4, #0x38] \n"
435 " BL sub_FF853770 \n"
436 " CMP R0, #0 \n"
437 " STREQ R0, [R4, #0x70] \n"
438 " MOV R0, R5 \n"
439 " BL sub_FF852CF0 \n"
440 " MOV R0, R5 \n"
441 " BL sub_FF852FE4_my \n"
442 " LDR PC, =0xff85329c\n"
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474 );
475 }
476
477 void __attribute__((naked,noinline)) sub_FF852FE4_my( ) {
478 asm volatile (
479 " STMFD SP!, {R4-R6,LR} \n"
480 " MOV R5, R0 \n"
481 " LDR R0, =0x113DC \n"
482 " ADD R4, R0, R5, LSL #7 \n"
483 " LDR R0, [R4, #0x70] \n"
484 " TST R0, #2 \n"
485 " MOVNE R0, #1 \n"
486 " LDMNEFD SP!, {R4-R6,PC} \n"
487 " LDR R0, [R4, #0x38] \n"
488 " MOV R1, R5 \n"
489 " BL sub_FF852D74_my \n"
490 " LDR PC, =0xff853010\n"
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505 );
506 }
507
508
509 void __attribute__((naked,noinline)) sub_FF852D74_my( ) {
510 asm volatile (
511 " STMFD SP!, {R4-R8,LR} \n"
512 " MOV R8, R0 \n"
513 " LDR R0, =0x113DC \n"
514 " MOV R7, #0 \n"
515 " ADD R5, R0, R1, LSL #7 \n"
516 " LDR R0, [R5, #0x3C] \n"
517 " MOV R6, #0 \n"
518 " CMP R0, #7 \n"
519 " ADDLS PC, PC, R0, LSL #2 \n"
520 " B loc_FF852EC4 \n"
521 " B loc_FF852DD4 \n"
522 " B loc_FF852DBC \n"
523 " B loc_FF852DBC \n"
524 " B loc_FF852DBC \n"
525 " B loc_FF852DBC \n"
526 " B loc_FF852EBC \n"
527 " B loc_FF852DBC \n"
528 " B loc_FF852DBC \n"
529 "loc_FF852DBC:\n"
530 " MOV R2, #0 \n"
531 " MOV R1, #0x200 \n"
532 " MOV R0, #2 \n"
533 " BL sub_FF869F88 \n"
534 " MOVS R4, R0 \n"
535 " BNE loc_FF852DDC \n"
536 "loc_FF852DD4:\n"
537 " MOV R0, #0 \n"
538 " LDMFD SP!, {R4-R8,PC} \n"
539 "loc_FF852DDC:\n"
540 " LDR R12, [R5, #0x4C] \n"
541 " MOV R3, R4 \n"
542 " MOV R2, #1 \n"
543 " MOV R1, #0 \n"
544 " MOV R0, R8 \n"
545 " BLX R12 \n"
546 " CMP R0, #1 \n"
547 " BNE loc_FF852E08 \n"
548 " MOV R0, #2 \n"
549 " BL sub_FF86A0D4 \n"
550 " B loc_FF852DD4 \n"
551 "loc_FF852E08:\n"
552 " LDR R1, [R5, #0x68] \n"
553 " MOV R0, R8 \n"
554 " BLX R1 \n"
555 "MOV R1, R4\n"
556 "BL mbr_read_dryos\n"
557
558
559
560
561
562
563 "MOV R12, R4\n"
564 "MOV LR, R4\n"
565 "MOV R1, #1\n"
566 "B dg_sd_fat32_enter\n"
567 "dg_sd_fat32:\n"
568 "CMP R1, #4\n"
569 "BEQ dg_sd_fat32_end\n"
570 "ADD R12, R12, #0x10\n"
571 "ADD R1, R1, #1\n"
572 "dg_sd_fat32_enter:\n"
573 "LDRB R2, [R12, #0x1BE]\n"
574 "LDRB R3, [R12, #0x1C2]\n"
575 "CMP R3, #0xB\n"
576 "CMPNE R3, #0xC\n"
577 "BNE dg_sd_fat32\n"
578 "CMP R2, #0x00\n"
579 "CMPNE R2, #0x80\n"
580 "BNE dg_sd_fat32\n"
581
582 "MOV R4, R12\n"
583
584 "dg_sd_fat32_end:\n"
585
586 " LDRB R1, [R4, #0x1C9] \n"
587 " LDRB R3, [R4, #0x1C8] \n"
588 " LDRB R12, [R4, #0x1CC] \n"
589 " MOV R1, R1, LSL #0x18 \n"
590 " ORR R1, R1, R3, LSL #0x10 \n"
591 " LDRB R3, [R4, #0x1C7] \n"
592 " LDRB R2, [R4, #0x1BE] \n"
593
594 " ORR R1, R1, R3, LSL #8 \n"
595 " LDRB R3, [R4, #0x1C6] \n"
596 " CMP R2, #0 \n"
597 " CMPNE R2, #0x80 \n"
598 " ORR R1, R1, R3 \n"
599 " LDRB R3, [R4, #0x1CD] \n"
600 " MOV R3, R3, LSL #0x18 \n"
601 " ORR R3, R3, R12, LSL #0x10 \n"
602 " LDRB R12, [R4, #0x1CB] \n"
603 " ORR R3, R3, R12, LSL #8 \n"
604 " LDRB R12, [R4, #0x1CA] \n"
605 " ORR R3, R3, R12 \n"
606
607 " LDRB R12, [LR,#0x1FE]\n"
608 " LDRB LR, [LR,#0x1FF]\n"
609 " MOV R4, #0 \n"
610 " BNE loc_FF852E94 \n"
611 " CMP R0, R1 \n"
612 " BCC loc_FF852E94 \n"
613 " ADD R2, R1, R3 \n"
614 " CMP R2, R0 \n"
615 " CMPLS R12, #0x55 \n"
616 " CMPEQ LR, #0xAA \n"
617 " MOVEQ R7, R1 \n"
618 " MOVEQ R6, R3 \n"
619 " MOVEQ R4, #1 \n"
620 "loc_FF852E94:\n"
621 " MOV R0, #2 \n"
622 " BL sub_FF86A0D4 \n"
623 " CMP R4, #0 \n"
624 " BNE loc_FF852ED0 \n"
625 " LDR R1, [R5, #0x68] \n"
626 " MOV R7, #0 \n"
627 " MOV R0, R8 \n"
628 " BLX R1 \n"
629 " MOV R6, R0 \n"
630 " B loc_FF852ED0 \n"
631 "loc_FF852EBC:\n"
632 " MOV R6, #0x40 \n"
633 " B loc_FF852ED0 \n"
634 "loc_FF852EC4:\n"
635 " LDR R1, =0x5C9 \n"
636 " LDR R0, =0xFF852CD0 \n"
637 " BL sub_FF81B284 \n"
638 "loc_FF852ED0:\n"
639 " STR R7, [R5, #0x44]! \n"
640 " MOV R0, #1 \n"
641 " STR R6, [R5, #4] \n"
642 " LDMFD SP!, {R4-R8,PC} \n"
643 );
644 }
645
646
647 void __attribute__((naked,noinline)) task_JogDial_my( ) {
648 asm volatile (
649 " STMFD SP!, {R3-R11,LR} \n"
650 " BL sub_FF8443D0 \n"
651 " LDR R11, =0x80000B01 \n"
652 " LDR R8, =0xFFAEED08 \n"
653 " LDR R7, =0xC0240000 \n"
654 " LDR R6, =0x22DC \n"
655 " MOV R9, #1 \n"
656 " MOV R10, #0 \n"
657 "loc_FF844240:\n"
658 " LDR R3, =0x1BB \n"
659 " LDR R0, [R6, #0xC] \n"
660 " LDR R2, =0xFF844478 \n"
661 " MOV R1, #0 \n"
662 " BL sub_FF827308 \n"
663 " MOV R0, #0x28 \n"
664 " BL _SleepTask \n"
665
666 "labelA:\n"
667 "LDR R0, =jogdial_stopped\n"
668 "LDR R0, [R0]\n"
669 "CMP R0, #1\n"
670 "BNE labelB\n"
671 "MOV R0, #40\n"
672 "BL _SleepTask\n"
673 "B labelA\n"
674 "labelB:\n"
675
676 " LDR R0, [R7, #0x104] \n"
677 " MOV R0, R0, ASR #0x10 \n"
678 " STRH R0, [R6] \n"
679 " LDRSH R2, [R6, #2] \n"
680 " SUB R1, R0, R2 \n"
681 " CMP R1, #0 \n"
682 " BEQ loc_FF844304 \n"
683 " MOV R5, R1 \n"
684 " RSBLT R5, R5, #0 \n"
685 " MOVLE R4, #0 \n"
686 " MOVGT R4, #1 \n"
687 " CMP R5, #0xFF \n"
688 " BLS loc_FF8442B8 \n"
689 " CMP R1, #0 \n"
690 " RSBLE R1, R2, #0xFF \n"
691 " ADDLE R1, R1, #0x7F00 \n"
692 " ADDLE R0, R1, R0 \n"
693 " RSBGT R0, R0, #0xFF \n"
694 " ADDGT R0, R0, #0x7F00 \n"
695 " ADDGT R0, R0, R2 \n"
696 " ADD R5, R0, #0x8000 \n"
697 " ADD R5, R5, #1 \n"
698 " EOR R4, R4, #1 \n"
699 "loc_FF8442B8:\n"
700 " LDR R0, [R6, #0x14] \n"
701 " CMP R0, #0 \n"
702 " BEQ loc_FF8442FC \n"
703 " LDR R0, [R6, #0x1C] \n"
704 " CMP R0, #0 \n"
705 " BEQ loc_FF8442E4 \n"
706 " LDR R1, [R8, R4, LSL #2] \n"
707 " CMP R1, R0 \n"
708 " BEQ loc_FF8442EC \n"
709 " LDR R0, =0xB01 \n"
710 " BL sub_FF876C58 \n"
711 "loc_FF8442E4:\n"
712 " MOV R0, R11 \n"
713 " BL sub_FF876C58 \n"
714 "loc_FF8442EC:\n"
715 " LDR R0, [R8, R4, LSL #2] \n"
716 " MOV R1, R5 \n"
717 " STR R0, [R6, #0x1C] \n"
718 " BL sub_FF876B88 \n"
719 "loc_FF8442FC:\n"
720 " LDRH R0, [R6] \n"
721 " STRH R0, [R6, #2] \n"
722 "loc_FF844304:\n"
723 " STR R10, [R7, #0x100] \n"
724 " STR R9, [R7, #0x108] \n"
725 " LDR R0, [R6, #0x10] \n"
726 " CMP R0, #0 \n"
727 " BLNE _SleepTask \n"
728 " B loc_FF844240 \n"
729 );
730 }
731
732 #if 0
733 const unsigned ledlist[]={
734 0xC0220130,
735 0xC0220134,
736 };
737
738 extern void msleep(int x);
739 void __attribute__((noinline)) task_blinker() {
740 int ledstate;
741
742 int counter = 0;
743
744 int *led = (void*) ledlist[0];
745 int i_led = 0;
746
747 int *anypointer;
748 int v1, v2, v3, v4;
749
750 ledstate = 0;
751 *led = 0x46;
752
753 while (1) {
754
755 if (ledstate == 1) {
756 ledstate = 0;
757 *led = 0x44;
758 led=(void *)ledlist[(++i_led)%2];
759
760 } else {
761 ledstate = 1;
762 *led = 0x46;
763
764 }
765
766 if (counter == 2) {
767
768
769
770
771 }
772
773 if (counter == 10) {
774
775 }
776
777 msleep(500);
778 counter++;
779 }
780 };
781
782 void CreateTask_blinker() {
783 _CreateTask("Blinker", 0x1, 0x200, task_blinker, 0);
784 };
785 #endif
786