Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 43 lines (35 sloc) 0.904 kB
4b00cb1 @dwelch67 Thanks to Martin Capitanio and the linux code at http://capitanio.org…
authored
1
2 void PUT32 ( unsigned int, unsigned int );
3 unsigned int GET32 ( unsigned int );
4
a1f60c9 @dwelch67 need to enable clocks to IO port C before using
authored
5 #define RCCBASE 0x40021000
4b00cb1 @dwelch67 Thanks to Martin Capitanio and the linux code at http://capitanio.org…
authored
6 #define GPIOCBASE 0x40011000
7
8 int notmain ( void )
9 {
10 volatile unsigned int ra;
11 unsigned int rb;
12 unsigned int rc;
f69f755 @dwelch67 Reprogram the flash using a program loaded and run from ram.
authored
13 unsigned int rd;
14 unsigned int rx;
4b00cb1 @dwelch67 Thanks to Martin Capitanio and the linux code at http://capitanio.org…
authored
15
a1f60c9 @dwelch67 need to enable clocks to IO port C before using
authored
16 ra=GET32(RCCBASE+0x18);
17 ra|=1<<4; //enable port C
18 PUT32(RCCBASE+0x18,ra);
19
4b00cb1 @dwelch67 Thanks to Martin Capitanio and the linux code at http://capitanio.org…
authored
20 //Blue LED on PORT C bit 8
21 //Green LED on PORT C bit 9
22
23 //output push-pull b0001
24 ra=GET32(GPIOCBASE+0x04);
a1f60c9 @dwelch67 need to enable clocks to IO port C before using
authored
25 ra&=(~(0xFF<<0));
26 ra|=0x11<<0;
4b00cb1 @dwelch67 Thanks to Martin Capitanio and the linux code at http://capitanio.org…
authored
27 PUT32(GPIOCBASE+0x04,ra);
28
29 rb=GET32(GPIOCBASE+0x0C);
30 rb&=(~(3<<8));
f69f755 @dwelch67 Reprogram the flash using a program loaded and run from ram.
authored
31 rc=rb|(1<<8);
32 rd=rb|(2<<8);
33 for(rx=0;;rx++)
4b00cb1 @dwelch67 Thanks to Martin Capitanio and the linux code at http://capitanio.org…
authored
34 {
f69f755 @dwelch67 Reprogram the flash using a program loaded and run from ram.
authored
35 if(rx&0xF) PUT32(GPIOCBASE+0x0C,rd);
36 else PUT32(GPIOCBASE+0x0C,rc);
37 for(ra=0;ra<100000;ra++) continue;
4b00cb1 @dwelch67 Thanks to Martin Capitanio and the linux code at http://capitanio.org…
authored
38 PUT32(GPIOCBASE+0x0C,rb);
f69f755 @dwelch67 Reprogram the flash using a program loaded and run from ram.
authored
39 for(ra=0;ra<100000;ra++) continue;
4b00cb1 @dwelch67 Thanks to Martin Capitanio and the linux code at http://capitanio.org…
authored
40 }
41 return(0);
42 }
Something went wrong with that request. Please try again.