root/platform/a410/sub/100f/boot.c

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

DEFINITIONS

This source file includes following definitions.
  1. blink_blue
  2. blink_orange
  3. blink
  4. boot
  5. h_usrInit
  6. h_usrKernelInit
  7. h_usrRoot

   1 #include "lolevel.h"
   2 #include "platform.h"
   3 #include "core.h"
   4 
   5 const char * const new_sa = &_end;
   6 
   7 /* Ours stuff */
   8 extern long wrs_kernel_bss_start;
   9 extern long wrs_kernel_bss_end;
  10 extern void createHook (void *pNewTcb);
  11 extern void deleteHook (void *pTcb);
  12 
  13 
  14 void boot();
  15 
  16 /* "relocated" functions */
  17 void __attribute__((naked,noinline)) h_usrInit();
  18 void __attribute__((naked,noinline)) h_usrKernelInit();
  19 void __attribute__((naked,noinline)) h_usrRoot();
  20 
  21 
  22 #if 0
  23 void blink_blue(int duration)
  24 {
  25   int i;
  26 
  27   *((volatile long *) 0xc0220084) = 0x46; // Turn on LED   
  28   for (i=0; i<duration; i++) // Wait a while   
  29   {   
  30     asm volatile ( "nop\n" );   
  31   }   
  32    
  33   *((volatile long *) 0xc0220084) = 0x44; // Turn off LED   
  34   for (i=0; i<duration; i++) // Wait a while   
  35   {   
  36     asm volatile ( "nop\n" );   
  37   }
  38 }
  39 
  40 void blink_orange(int duration) //
  41 {
  42   int i;
  43 
  44   *((volatile long *) 0xc0220090) = 0x46; // Turn on LED   
  45   for (i=0; i<duration; i++) // Wait a while   
  46   {   
  47     asm volatile ( "nop\n" );   
  48   }   
  49    
  50   *((volatile long *) 0xc0220090) = 0x44; // Turn off LED   
  51   for (i=0; i<duration; i++) // Wait a while   
  52   {   
  53     asm volatile ( "nop\n" );   
  54   }
  55 }
  56 
  57 void blink()
  58 {
  59     blink_blue(10000000);
  60     blink_orange(10000000);
  61     blink_blue(10000000);
  62 }
  63 #endif
  64 
  65 void boot()
  66 {
  67     long *canon_data_src = (void*)0xFFE8A3C0; //
  68     long *canon_data_dst = (void*)MEMBASEADDR;
  69     long *canon_bss_start = (void*)0x11010; // just after data
  70     long canon_data_len = 0x11010 - MEMBASEADDR; //
  71     long canon_bss_len = MEMISOSTART - 0x11010; //
  72     long i;
  73 
  74     asm volatile (
  75         "MRC     p15, 0, R0,c1,c0\n"
  76         "ORR     R0, R0, #0x1000\n"
  77         "ORR     R0, R0, #4\n"
  78         "ORR     R0, R0, #1\n"
  79         "MCR     p15, 0, R0,c1,c0\n"
  80     :::"r0");
  81 
  82     for(i=0;i<canon_data_len/4;i++)
  83         canon_data_dst[i]=canon_data_src[i];
  84 
  85     for(i=0;i<canon_bss_len/4;i++)
  86         canon_bss_start[i]=0;
  87 
  88     asm volatile (
  89         "MRC     p15, 0, R0,c1,c0\n"
  90         "ORR     R0, R0, #0x1000\n"
  91         "BIC     R0, R0, #4\n"
  92         "ORR     R0, R0, #1\n"
  93         "MCR     p15, 0, R0,c1,c0\n"
  94     :::"r0");
  95 
  96     h_usrInit();
  97 }
  98 
  99 
 100 void h_usrInit()
 101 {
 102     asm volatile ( //@ffc019e0
 103         "STR     LR, [SP,#-4]!\n"
 104         "BL      sub_FFC019BC\n"
 105         "MOV     R0, #2\n"
 106         "MOV     R1, R0\n"
 107         "BL      sub_FFE6E024\n"     //unknown_libname_773 ; "Canon A-Series Firmware"
 108         "BL      sub_FFE5A6FC\n"     //excVecInit
 109         "BL      sub_FFC01218\n"
 110         "BL      sub_FFC0177C\n"
 111         "LDR     LR, [SP],#4\n"
 112         "B       h_usrKernelInit\n"
 113     );
 114 }//
 115 
 116 void  h_usrKernelInit()
 117 {
 118 //    blink();
 119     asm volatile ( //@ffc01798
 120         "STMFD   SP!, {R4,LR}\n"
 121         "SUB     SP, SP, #8\n"
 122         "BL      sub_FFE6E524\n"    //classLibInit
 123         "BL      sub_FFE83810\n"    //taskLibInit
 124         "LDR     R3, =0xFFA4\n"
 125         "LDR     R2, =0x9B540\n"
 126         "LDR     R1, [R3]\n"
 127         "LDR     R0, =0x9EE30\n"
 128         "MOV     R3, #0x100\n"
 129         "BL      sub_FFE7C660\n"   //qInit
 130         "LDR     R3, =0xFF64\n"
 131         "LDR     R0, =0x1082C\n"
 132         "LDR     R1, [R3]\n"
 133         "BL      sub_FFE7C660\n"   //qInit
 134         "LDR     R3, =0x10020\n"
 135         "LDR     R0, =0x9EE04\n"
 136         "LDR     R1, [R3]\n"
 137         "BL      sub_FFE7C660\n"   //qInit
 138         "BL      sub_FFE88390\n"   //workQInit
 139         "BL      sub_FFC01304\n"
 140         "MOV     R4, #0\n"
 141         "MOV     R3, R0\n"
 142         "MOV     R12, #0x800\n"
 143         "LDR     R0, =h_usrRoot\n"
 144         "MOV     R1, #0x4000\n"
 145     );
 146     asm volatile (
 147         "LDR     R2, =new_sa\n"
 148         "LDR     R2, [R2]\n"
 149     );
 150     asm volatile (
 151         "STR     R12, [SP]\n"
 152         "STR     R4, [SP,#4]\n"
 153         "BL      sub_FFE80A50\n"  //kernelInit
 154         "ADD     SP, SP, #8\n"
 155         "LDMFD   SP!, {R4,PC}\n"
 156     );
 157 }
 158 
 159 
 160 void  h_usrRoot()
 161 {
 162     asm volatile ( //@ffc01ac0
 163         "STMFD   SP!, {R4,R5,LR}\n"
 164         "MOV     R5, R0\n"
 165         "MOV     R4, R1\n"
 166         "BL      sub_FFC01A24\n"
 167         "MOV     R1, R4\n"
 168         "MOV     R0, R5\n"
 169         "BL      sub_FFE746A0\n"
 170         "MOV     R1, R4\n"
 171         "MOV     R0, R5\n"
 172         "BL      sub_FFE75118\n"
 173         "BL      sub_FFC0183C\n"
 174         "BL      sub_FFC01758\n"
 175         "MOV     R0, #50\n"
 176         "BL      sub_FFE770BC\n"
 177         "BL      sub_FFC01A68\n"
 178         "BL      sub_FFC01A48\n"
 179         "BL      sub_FFC01A94\n"
 180         "BL      sub_FFE7697C\n"
 181         "BL      sub_FFC01A18\n"
 182     );
 183 
 184     _taskCreateHookAdd(createHook);
 185     _taskDeleteHookAdd(deleteHook);
 186 
 187     drv_self_hide();
 188     asm volatile (
 189         "LDMFD   SP!, {R4,R5,LR}\n"
 190         "B       sub_FFC013C0\n"
 191     );
 192 }//

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