root/loader/g7x2/main.c

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

DEFINITIONS

This source file includes following definitions.
  1. 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 __attribute__((noreturn)) my_restart()
   7 {
   8 //    check_compat();
   9 
  10     long *dst = (long*)MEMISOSTART;
  11     const long *src = blob_chdk_core;
  12     long length = (blob_chdk_core_size + 3) >> 2;
  13 
  14     core_copy(src, dst, length);
  15 
  16     // GPIO base = 0xD2080000
  17     // 0xD20801E4   - SD led
  18     // 0xD20801E8   - AF led
  19 
  20     // light up green LED
  21     volatile int* p = (int*)0xD20801E4;
  22     *p = 0x24D0002;
  23 
  24 //    // blinker
  25 //    int i;
  26 //    while (1)
  27 //    {
  28 //        *p = 0x24D0002;
  29 //        for(i=0;i<10000000;i++) {
  30 //            asm volatile(
  31 //            "nop\n"
  32 //            );
  33 //        }
  34 //        *p = 0x24C0003;
  35 //        for(i=0;i<10000000;i++) {
  36 //            asm volatile(
  37 //            "nop\n"
  38 //            );
  39 //        }
  40 //    }
  41 
  42     asm volatile (
  43             "mov     r1, %1\n"
  44             "mov     r0, %0\n"
  45             "ldr     r2, =0xe042eb75\n" // address is OK for 101a
  46             "blx     r2\n"              // caching related routine called at fw startup
  47             "mov     r1, %1\n"
  48             "mov     r0, %0\n"
  49             "ldr     r2, =0xe042ec4d\n" // address is OK for 101a
  50             "blx     r2\n"              // caching related routine called at fw startup
  51             "mov     r0, %0\n"
  52             "add     r0, r0, #1\n"
  53             "bx      r0\n"
  54             : : "r"(MEMISOSTART), "r"(((blob_chdk_core_size+3)>>2)<<2) : "memory","r0","r1","r2","r3","r4"
  55     );
  56     while(1);
  57 }
  58 

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