X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Fapps%2Fspi%2Fspi.c;h=fc310389e2f0f1fbf551e59d81cfa619528ea83b;hp=0985340ad19ef70bcd2a0ca1e170f7825c00d1a9;hb=0351243d52f70e34790269e600c65413ddb4bc7c;hpb=6dc88d2f1713d2bf9f2fabb5fbfb9f235a679b2f diff --git a/firmware/apps/spi/spi.c b/firmware/apps/spi/spi.c index 0985340..fc31038 100644 --- a/firmware/apps/spi/spi.c +++ b/firmware/apps/spi/spi.c @@ -123,7 +123,13 @@ void spiflash_pokeblock(unsigned long adr, SETSS; - //while(spiflash_status()&0x01);//minor performance impact + //if(len!=0x100) + // debugstr("Non-standard block size."); + + while(spiflash_status()&0x01);//minor performance impact + + spiflash_setstatus(0x02); + spiflash_wrten(); //Are these necessary? //spiflash_setstatus(0x02); @@ -153,8 +159,6 @@ void spiflash_pokeblocks(unsigned long adr, long off=0;//offset of this block int blen;//length of this block SETSS; - spiflash_setstatus(0x02); - spiflash_wrten(); while(off>16); + spitrans8((adr&0xFF00)>>8); + spitrans8(adr&0xFF); + + SETSS; + while(spiflash_status()&0x01);//while busy + //debugstr("Erased."); +} + + //! Handles a monitor command. void spihandle(unsigned char app, unsigned char verb, @@ -234,7 +262,7 @@ void spihandle(unsigned char app, cmddata+4,//buf len-4);//len - txdata(app,verb,len); + txdata(app,verb,0); break; @@ -246,8 +274,8 @@ void spihandle(unsigned char app, while(spiflash_status()&0x01)//while busy - P1OUT^=1; - P1OUT&=~1; + PLEDOUT^=PLEDPIN; + PLEDOUT&=~PLEDPIN; txdata(app,verb,0); break;