root/loader/ixus65_sd630/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 // for DEBUG
   4 /*
   5 #define LED_AF   0xc0220080
   6 #define LED_PR   0xc0220084
   7 #define LED_RED  0xc0220088
   8 
   9 void port_on(int port)
  10 {
  11     volatile long *p=(void*)port;
  12     *p=0x46;
  13 }
  14 
  15 void port_off(int port)
  16 {
  17     volatile long *p=(void*)port;
  18     *p=0x44;
  19 }
  20 */
  21 
  22 // static void __attribute__((noreturn)) shutdown();
  23 // static void __attribute__((noreturn)) panic(int cnt);
  24 
  25 extern long *blob_chdk_core;
  26 // extern long *blob_copy_and_reset;
  27 extern long blob_chdk_core_size;
  28 // extern long blob_copy_and_reset_size;
  29 
  30 
  31 
  32 void __attribute__((noreturn)) my_restart() 
  33 {
  34   {
  35   // char *dst = dst_void;
  36   // const char *src = src_void;
  37   long *dst = (long*)MEMISOSTART;
  38   const long *src = blob_chdk_core;
  39   long length = (blob_chdk_core_size + 3) >> 2;
  40 
  41   core_copy(src, dst, length);
  42 
  43 }
  44 
  45     asm volatile(
  46         "MRS     R1, CPSR\n"
  47         "BIC     R1, R1, #0x3F\n"
  48         "ORR     R1, R1, #0xD3\n"
  49         "MSR     CPSR_cf, R1\n"
  50 
  51         "LDR     R2, =0xC0200000\n"
  52         "MOV     R1, #0xFFFFFFFF\n"
  53         "STR     R1, [R2,#0x10C]\n"
  54         "STR     R1, [R2,#0xC]\n"
  55         "STR     R1, [R2,#0x1C]\n"
  56         "STR     R1, [R2,#0x2C]\n"
  57         "STR     R1, [R2,#0x3C]\n"
  58         "STR     R1, [R2,#0x4C]\n"
  59         "STR     R1, [R2,#0x5C]\n"
  60         "STR     R1, [R2,#0x6C]\n"
  61         "STR     R1, [R2,#0x7C]\n"
  62         "STR     R1, [R2,#0x8C]\n"
  63         "STR     R1, [R2,#0x9C]\n"
  64         "STR     R1, [R2,#0xAC]\n"
  65         "STR     R1, [R2,#0xBC]\n"
  66         "STR     R1, [R2,#0xCC]\n"
  67         "STR     R1, [R2,#0xDC]\n"
  68         "STR     R1, [R2,#0xEC]\n"
  69         "STR     R1, [R2,#0xFC]\n"
  70 
  71         "MOV     R1, #0x78\n"
  72         "MCR     p15, 0, R1,c1,c0\n"
  73         "MOV     R1, #0\n"
  74         "MCR     p15, 0, R1,c7,c10, 4\n"
  75         "MCR     p15, 0, R1,c7,c5\n"
  76         "MCR     p15, 0, R1,c7,c6\n"
  77         "MOV     R2, #0x40000000\n"
  78         "ORR     R1, R2, #6\n"
  79         "MCR     p15, 0, R1,c9,c1\n"
  80         "ORR     R1, R1, #6\n"
  81         "MCR     p15, 0, R1,c9,c1, 1\n"
  82         "MRC     p15, 0, R1,c1,c0\n"
  83         "ORR     R1, R1, #0x50000\n"
  84         "MCR     p15, 0, R1,c1,c0\n"
  85 
  86         "MOV     R3, #0xFF0\n"
  87         "LDR     R1, =0x12345678\n"
  88         "ADD     R3, R3, #0x4000000C\n"
  89         "STR     R1, [R3]\n"
  90 
  91         "MOV     SP, #0x1900\n"
  92         "MOV     LR, PC\n"
  93         "MOV     PC, %0\n"
  94     : : "r"(MEMISOSTART) : "memory","r1","r2","r3");
  95 
  96     while(1);
  97 }
  98 
  99 
 100 // static void __attribute__((noreturn)) shutdown()
 101 // {
 102 //     volatile long *p = (void*)0xc02200a0;
 103 //         
 104 //     asm(
 105 //          "MRS     R1, CPSR\n"
 106 //          "AND     R0, R1, #0x80\n"
 107 //          "ORR     R1, R1, #0x80\n"
 108 //          "MSR     CPSR_cf, R1\n"
 109 //          :::"r1","r0");
 110 //         
 111 //     *p = 0x44;
 112 // 
 113 //     while(1);
 114 // }
 115 // 
 116 // 
 117 // static void __attribute__((noreturn)) panic(int cnt)
 118 // {
 119 //      int i;
 120 // 
 121 //      for(;cnt>0;cnt--){
 122 //              
 123 //              port_on(LED_PR);
 124 // 
 125 //              for(i=0;i<0x200000;i++){
 126 //                      asm ("nop\n");
 127 //                      asm ("nop\n");
 128 //              }
 129 //              
 130 //              port_off(LED_PR);
 131 // 
 132 //              for(i=0;i<0x200000;i++){
 133 //                      asm ("nop\n");
 134 //                      asm ("nop\n");
 135 //              }
 136 //      }
 137 //      shutdown();
 138 // }

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