From: travisutk Date: Fri, 4 Sep 2009 00:45:38 +0000 (+0000) Subject: Erase waits for competion to return. X-Git-Url: http://git.rot13.org/?p=goodfet;a=commitdiff_plain;h=a28d1a252666fe5077057b8598d638fc8504e29a;ds=sidebyside Erase waits for competion to return. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@113 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- diff --git a/firmware/apps/spi/spi.c b/firmware/apps/spi/spi.c index f4c6560..594e04f 100644 --- a/firmware/apps/spi/spi.c +++ b/firmware/apps/spi/spi.c @@ -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); diff --git a/firmware/include/command.h b/firmware/include/command.h index d5e22e6..8cc3f4f 100644 --- a/firmware/include/command.h +++ b/firmware/include/command.h @@ -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