Erase waits for competion to return.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Fri, 4 Sep 2009 00:45:38 +0000 (00:45 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Fri, 4 Sep 2009 00:45:38 +0000 (00:45 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@113 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

firmware/apps/spi/spi.c
firmware/include/command.h

index f4c6560..594e04f 100644 (file)
@@ -43,7 +43,7 @@ void spisetup(){
 }
 
 
-//! Read and write an SPI bit.
+//! Read and write an SPI byte.
 unsigned char spitrans8(unsigned char byte){
   unsigned int bit;
   //This function came from the SPI Wikipedia article.
@@ -187,6 +187,7 @@ void spihandle(unsigned char app,
       spitrans8(cmddata[i]);
     P5OUT|=SS;  //Raise !SS to end transaction.
     
+    
     while(spiflash_status()&0x01)//while busy
       P1OUT^=1;
     P1OUT&=~1;
@@ -200,10 +201,15 @@ void spihandle(unsigned char app,
     P5OUT&=~SS; //Drop !SS to begin transaction.
     spitrans8(0xC7);//Chip Erase
     P5OUT|=SS;  //Raise !SS to end transaction.
+    
+        
+    while(spiflash_status()&0x01)//while busy
+      P1OUT^=1;
+    P1OUT&=~1;
+    
     txdata(app,verb,0);
     break;
 
-
   case SETUP:
     spisetup();
     txdata(app,verb,0);
index d5e22e6..8cc3f4f 100644 (file)
@@ -55,6 +55,9 @@ extern unsigned char cmddata[256];
 #define SPI_JEDEC 0x80
 #define SPI_ERASE 0x81
 
+//OCT commands
+#define OCT_CMP 0x90
+
 //JTAG430 commands
 #define JTAG430_HALTCPU 0xA0
 #define JTAG430_RELEASECPU 0xA1