CHDK_DE Vorschauversion  Trunk Rev. 5272
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
main.c-Dateireferenz
+ Include-Abhängigkeitsdiagramm für main.c:

gehe zum Quellcode dieser Datei

Makrodefinitionen

#define LED_ISO   (void*) 0xC02200D0
 
#define LED_DP   (void*) 0xC02200D4
 
#define LED_ECL   (void*) 0xC02200D8
 
#define LED_PWR   (void*) 0xC02200DC
 
#define DELAY   5000000
 

Funktionen

static void __attribute__ ((noreturn))
 

Makro-Dokumentation

#define DELAY   5000000
#define LED_DP   (void*) 0xC02200D4
#define LED_ECL   (void*) 0xC02200D8
#define LED_ISO   (void*) 0xC02200D0
#define LED_PWR   (void*) 0xC02200DC

Dokumentation der Funktionen

static void __attribute__ ( (noreturn)  )
static

Definiert in Zeile 5 der Datei main.c.

20 {
21  volatile long *p1 = (void*)LED_DP;
22  int counter;
23  // DEBUG: blink led
24  counter = DELAY; *p1 = 0x46; while (counter--) { asm("nop\n nop\n"); };
25  counter = DELAY; *p1 = 0x44; while (counter--) { asm("nop\n nop\n"); };
26 
27  {
28  long *dst = (long*)MEMISOSTART;
29  const long *src = blob_chdk_core;
30  long length = (blob_chdk_core_size + 3) >> 2;
31 
32  core_copy(src, dst, length);
33 
34  }
35 
36  //DEBUG: blink another
37  //counter = DELAY; *p2 = 0x46; while (counter--) { asm("nop\n nop\n"); };
38  //counter = DELAY; *p2 = 0x44; while (counter--) { asm("nop\n nop\n"); };
39 
40  // DEBUG: jump to regular firmware-boot (causing a boot loop)
41  // dst_void = (void*) 0xFF810000;
42 
43  // resetcode here:
44  asm volatile (
45  "MRS R0, CPSR\n"
46  "BIC R0, R0, #0x3F\n"
47  "ORR R0, R0, #0xD3\n"
48  "MSR CPSR, R0\n"
49  "LDR R1, =0xC0200000\n"
50  "MOV R0, #0xFFFFFFFF\n"
51  "STR R0, [R1,#0x10C]\n"
52  "STR R0, [R1,#0xC]\n"
53  "STR R0, [R1,#0x1C]\n"
54  "STR R0, [R1,#0x2C]\n"
55  "STR R0, [R1,#0x3C]\n"
56  "STR R0, [R1,#0x4C]\n"
57  "STR R0, [R1,#0x5C]\n"
58  "STR R0, [R1,#0x6C]\n"
59  "STR R0, [R1,#0x7C]\n"
60  "STR R0, [R1,#0x8C]\n"
61  "STR R0, [R1,#0x9C]\n"
62  "STR R0, [R1,#0xAC]\n"
63  "STR R0, [R1,#0xBC]\n"
64  "STR R0, [R1,#0xCC]\n"
65  "STR R0, [R1,#0xDC]\n"
66  "STR R0, [R1,#0xEC]\n"
67  "CMP R4, #7\n"
68  "STR R0, [R1,#0xFC]\n"
69  "LDMEQFD SP!, {R4,PC}\n"
70  "MOV R0, #0x78\n"
71  "MCR p15, 0, R0,c1,c0\n"
72  "MOV R0, #0\n"
73  "MCR p15, 0, R0,c7,c10, 4\n"
74  "MCR p15, 0, R0,c7,c5\n"
75  "MCR p15, 0, R0,c7,c6\n"
76  "MOV R0, #0x80000006\n"
77  "MCR p15, 0, R0,c9,c1\n"
78  "MCR p15, 0, R0,c9,c1, 1\n"
79  "MRC p15, 0, R0,c1,c0\n"
80  "ORR R0, R0, #0x50000\n"
81  "MCR p15, 0, R0,c1,c0\n"
82  "LDR R0, =0x12345678\n"
83  "MOV R1, #0x80000000\n"
84  "STR R0, [R1,#0xFFC]\n"
85  //"LDR R0, =0xFF810000\n" // original jump-vector
86  "MOV R0, %0\n" // new jump-vector
87  "LDMFD SP!, {R4,LR}\n"
88  "BX R0\n"
89  : : "r"(MEMISOSTART) : "memory","r0","r1","r2","r3","r4");
90  while(1);
91 }