CHDK_DE Vorschauversion  Trunk Rev. 5163
 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

Funktionen

void __attribute__ ((noreturn))
 

Variablen

long * blob_chdk_core
 
long blob_chdk_core_size
 

Dokumentation der Funktionen

void __attribute__ ( (noreturn)  )

Definiert in Zeile 11 der Datei main.c.

11  {
12 
13  // DEBUG LED STUFF
14  //#define DEBUG_LED 0xC0220130 // Greed Led at the Backside
15  //#define DEBUG_LED_DELAY 10000000
16  //volatile long *pDebugLed = (void*)DEBUG_LED;
17  //int DebugLedCounter;
18 
19  // DEBUG: blink led
20  //DebugLedCounter = DEBUG_LED_DELAY; *pDebugLed = 0x46; while (DebugLedCounter--) { asm("nop\n nop\n"); };
21  //DebugLedCounter = DEBUG_LED_DELAY; *pDebugLed = 0x44; while (DebugLedCounter--) { asm("nop\n nop\n"); };
22 
23  {
24  // char *dst = dst_void;
25  // const char *src = src_void;
26  long *dst = (long*)MEMISOSTART;
27  const long *src = blob_chdk_core;
28  long length = (blob_chdk_core_size + 3) >> 2;
29 
30  if (src < dst && dst < src + length) {
31  // Have to copy backwards
32  src += length;
33  dst += length;
34  while (length--) {
35  *--dst = *--src;
36  }
37  } else {
38  while (length--) {
39  *dst++ = *src++;
40  }
41  }
42  }
43 
44  // DEBUG: blink again
45  //DebugLedCounter = DEBUG_LED_DELAY; *pDebugLed = 0x46; while (DebugLedCounter--) { asm("nop\n nop\n"); };
46  //DebugLedCounter = DEBUG_LED_DELAY; *pDebugLed = 0x44; while (DebugLedCounter--) { asm("nop\n nop\n"); };
47 
48  // DEBUG: jump to canon firmware (causing a boot loop)
49  //dst_void = (void*) 0xFF810000;
50 
51  // ROM:FF83BBFC
52  // search for "0x12345678"
53  // same as G11
54  asm volatile (
55  "MRS R0, CPSR\n"
56  "BIC R0, R0, #0x3F\n"
57  "ORR R0, R0, #0xD3\n"
58  "MSR CPSR, R0\n"
59  "LDR R1, =0xC0200000\n"
60  "MOV R0, #0xFFFFFFFF\n"
61  "STR R0, [R1,#0x10C]\n"
62  "STR R0, [R1,#0xC]\n"
63  "STR R0, [R1,#0x1C]\n"
64  "STR R0, [R1,#0x2C]\n"
65  "STR R0, [R1,#0x3C]\n"
66  "STR R0, [R1,#0x4C]\n"
67  "STR R0, [R1,#0x5C]\n"
68  "STR R0, [R1,#0x6C]\n"
69  "STR R0, [R1,#0x7C]\n"
70  "STR R0, [R1,#0x8C]\n"
71  "STR R0, [R1,#0x9C]\n"
72  "STR R0, [R1,#0xAC]\n"
73  "STR R0, [R1,#0xBC]\n"
74  "STR R0, [R1,#0xCC]\n"
75  "STR R0, [R1,#0xDC]\n"
76  "STR R0, [R1,#0xEC]\n"
77  "CMP R4, #7\n"
78  "STR R0, [R1,#0xFC]\n"
79  "LDMEQFD SP!, {R4,PC}\n"
80  "MOV R0, #0x78\n"
81  "MCR p15, 0, R0,c1,c0\n"
82  "MOV R0, #0\n"
83  "MCR p15, 0, R0,c7,c10, 4\n"
84  "MCR p15, 0, R0,c7,c5\n"
85  "MCR p15, 0, R0,c7,c6\n"
86  "MOV R0, #0x80000006\n"
87  "MCR p15, 0, R0,c9,c1\n"
88  "MCR p15, 0, R0,c9,c1, 1\n"
89  "MRC p15, 0, R0,c1,c0\n"
90  "ORR R0, R0, #0x50000\n"
91  "MCR p15, 0, R0,c1,c0\n"
92  "LDR R0, =0x12345678\n"
93  "MOV R1, #0x80000000\n"
94  "STR R0, [R1,#0xFFC]\n"
95  //"LDR R0, =0xFF810000\n" // canon jump-vector (causing a boot loop too)
96  "MOV R0, %0\n" // + new jump-vector
97  "LDMFD SP!, {R4,LR}\n"
98  "BX R0\n"
99  : : "r"(MEMISOSTART) : "memory","r0","r1","r2","r3","r4"
100  );
101 
102  while(1);
103 
104 }

Variablen-Dokumentation

long* blob_chdk_core

Definiert in Zeile 1 der Datei blobs.S.

long blob_chdk_core_size