root/loader/sx530hs/main.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. debug_pisca_led
  2. my_restart

   1 #include "../generic/check_compat.c"
   2 
   3 extern long *blob_chdk_core;
   4 extern long blob_chdk_core_size;
   5 
   6 void debug_pisca_led(int n)
   7 {
   8         volatile long *p = (void*)0xC022D1FC;
   9 
  10         int cnt=0, i=0;
  11         for(;cnt<n;cnt++)
  12         {
  13                 *p = 0x93d800;
  14  
  15                 for(i=0; i<0x100000; i++)
  16                 {
  17                         asm ("nop\n");
  18                         asm ("nop\n");
  19                 }
  20                 *p = 0x83dc00;
  21 
  22                 for(i=0; i<0x100000; i++)
  23                 {
  24                         asm ("nop\n");
  25                         asm ("nop\n");
  26                 }
  27         }       
  28 }
  29 
  30 void __attribute__((noreturn)) my_restart() 
  31 {
  32         {
  33         long *dst = (long*)MEMISOSTART;
  34         const long *src = blob_chdk_core;
  35         long length = (blob_chdk_core_size + 3) >> 2;
  36 
  37   core_copy(src, dst, length);
  38 
  39 }
  40 
  41     // restart function
  42     // from sub_FF83846C via 0x12345678    
  43         asm volatile (
  44                 "    MOV     R0, #0x78 \n"
  45                 "    MCR     p15, 0, R0,c1,c0 \n"
  46                 "    MOV     R0, #0 \n"
  47                 "    MCR     p15, 0, R0,c7,c10, 4 \n"
  48                 "    MCR     p15, 0, R0,c7,c5 \n"
  49                 "    MCR     p15, 0, R0,c7,c6 \n"
  50                 "    MOV     R0, #0x80000006 \n"
  51                 "    MCR     p15, 0, R0,c9,c1 \n"
  52                 "    MCR     p15, 0, R0,c9,c1, 1 \n"
  53                 "    MRC     p15, 0, R0,c1,c0 \n"
  54                 "    ORR     R0, R0, #0x50000 \n"
  55                 "    MCR     p15, 0, R0,c1,c0 \n"
  56                 "    LDR     R0, =0x12345678 \n"
  57                 "    MOV     R1, #0x80000000 \n"
  58                 "    STR     R0, [R1,#0xFFC] \n"
  59 //              "    LDR     R0, =0xFF020000 \n"
  60                 "MOV     R0, %0\n"              // new jump-vector                              
  61                 "    LDMFD   SP!, {R4,LR} \n" 
  62                 "    BX    R0 \n" 
  63                 : : "r"(MEMISOSTART) : "memory","r0","r1","r2","r3","r4"
  64         );
  65         while(1);
  66 }
  67 

/* [<][>][^][v][top][bottom][index][help] */