source: trunk/loader/ixus85_sd770/main.c @ 1375

Revision 1375, 1.2 KB checked in by philmoz, 19 months ago (diff)

Cleanup SVN properties using reyalp's platprops.bash script (part 2).

  • Property svn:eol-style set to native
Line 
1#include "../../platform/ixus85_sd770/leds.h"
2
3static void __attribute__((noreturn)) shutdown();
4static void __attribute__((noreturn)) panic(int cnt);
5
6extern long *blob_chdk_core;
7extern long *blob_copy_and_reset;
8extern long blob_chdk_core_size;
9extern long blob_copy_and_reset_size;
10
11void __attribute__((noreturn)) my_restart()
12{
13        void __attribute__((noreturn)) (*copy_and_restart)(char *dst, char *src, long length);
14        int i;
15
16        for (i=0; i<(blob_copy_and_reset_size/sizeof(long)); i++) {
17                ((long*)(RESTARTSTART))[i] = blob_copy_and_reset[i];
18        }
19
20        copy_and_restart = (void*)RESTARTSTART;
21        copy_and_restart((void*)MEMISOSTART, (char*)blob_chdk_core, blob_chdk_core_size);
22}
23
24static void __attribute__((noreturn)) shutdown()
25{
26        // @ FF829C24
27        volatile long *p = (void*)0xC022001C;
28
29        asm (
30                "MRS     R1, CPSR\n"
31                "AND     R0, R1, #0x80\n"
32                "ORR     R1, R1, #0x80\n"
33                "MSR     CPSR_cf, R1\n"
34                :::"r1","r0");
35
36        *p = 0x44; // led off
37
38        while(1);
39}
40
41static void __attribute__((noreturn)) panic(int cnt)
42{
43        volatile long *p=(void*)LED_PR;
44        int i;
45
46        for(;cnt>0;cnt--) {
47                p[0]=0x46;
48
49                for(i=0;i<0x200000;i++) {
50                        asm ("nop\n");
51                        asm ("nop\n");
52                }
53                p[0]=0x44;
54                for(i=0;i<0x200000;i++) {
55                        asm ("nop\n");
56                        asm ("nop\n");
57                }
58        }
59        shutdown();
60}
Note: See TracBrowser for help on using the repository browser.