From e858c51543d928d837578d3e03dd5686e888220e Mon Sep 17 00:00:00 2001 From: travisutk Date: Sat, 18 Jul 2009 15:35:30 +0000 Subject: [PATCH] SPI Flash Erase command. Still need native POKE. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@66 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- firmware/apps/spi/spi.c | 17 +++++++++++++++++ firmware/include/command.h | 1 - 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/firmware/apps/spi/spi.c b/firmware/apps/spi/spi.c index 93a41b9..785c476 100644 --- a/firmware/apps/spi/spi.c +++ b/firmware/apps/spi/spi.c @@ -66,6 +66,13 @@ unsigned char spitrans8(unsigned char byte){ return byte; } +//! Enable SPI writing +void spiflash_wrten(){ + P5OUT&=~SS; //Drop !SS to begin transaction. + spitrans8(0x06);//Chip Erase + P5OUT|=SS; //Raise !SS to end transaction. +} + //! Handles a monitor command. void spihandle(unsigned char app, unsigned char verb, @@ -102,6 +109,16 @@ void spihandle(unsigned char app, txdata(app,verb,len); P5OUT|=SS; //Raise !SS to end transaction. break; + case POKE://Poke up bytes from an SPI Flash ROM. + + break; + case SPI_ERASE://Erase the SPI Flash ROM. + spiflash_wrten(); + P5OUT&=~SS; //Drop !SS to begin transaction. + spitrans8(0xC7);//Chip Erase + P5OUT|=SS; //Raise !SS to end transaction. + 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 7eb1f61..ece0ad1 100644 --- a/firmware/include/command.h +++ b/firmware/include/command.h @@ -52,7 +52,6 @@ extern unsigned char cmddata[256]; //SPI commands #define SPI_JEDEC 0x80 #define SPI_ERASE 0x81 -#define SPI_WRITE 0x82 //JTAG430 commands #define JTAG430_HALTCPU 0xA0 -- 2.20.1