some display testing (doesn't work by now!)
[my-code/arm.git] / betty / flash.c
index 8d9c02a..f4be416 100644 (file)
@@ -10,7 +10,8 @@
 /*
  * sector addresses
  */
-static unsigned long sector_address[19]={
+
+unsigned long sector_address[20]={
        0x00000,0x02000,0x03000,0x04000,0x08000,
        0x10000,0x18000,
        0x20000,0x28000,
@@ -18,7 +19,8 @@ static unsigned long sector_address[19]={
        0x40000,0x48000,
        0x50000,0x58000,
        0x60000,0x68000,
-       0x70000,0x78000
+       0x70000,0x78000,
+       0x80000                 // not a sector, end of flash!
 };
 
 /*
@@ -96,6 +98,24 @@ void flash_sector_erase(u8 bank,u8 sector) {
        return;
 }
 
+int flash_sec_erase(u32 addr) {
+
+       u32 a18_12;
+       u32 base;
+
+       a18_12=addr&0x00000fffff;
+       base=addr&0xff000000;
+       
+       *((volatile u16 *)(base|(0x555<<1)))=0xaa;
+       *((volatile u16 *)(base|(0x2aa<<1)))=0x55;
+       *((volatile u16 *)(base|(0x555<<1)))=0x80;
+       *((volatile u16 *)(base|(0x555<<1)))=0xaa;
+       *((volatile u16 *)(base|(0x2aa<<1)))=0x55;
+       *((volatile u16 *)(base|(a18_12<<1)))=0x30;
+
+       return 0;
+}
+
 void flash_chip_erase(u8 bank) {
 
        u8 status;