X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Fapps%2Fspi%2Fspi.c;h=6e503f230f41f9def34edcb494ba3fdecbf67294;hp=18236ee27e6019301153a3585f9ce3a65caf0973;hb=e3e1bb605963def746b50f62277180e567d3b615;hpb=ef8b3dcd43ed26a82df672e64396bf8c024bb09c diff --git a/firmware/apps/spi/spi.c b/firmware/apps/spi/spi.c index 18236ee..6e503f2 100644 --- a/firmware/apps/spi/spi.c +++ b/firmware/apps/spi/spi.c @@ -1,5 +1,7 @@ -//GoodFET SPI Application -//Handles basic I/O +/*! \file spi.c + \author Travis Goodspeed + \brief SPI Master +*/ //Higher level left to client application. @@ -64,9 +66,11 @@ unsigned char spitrans8(unsigned char byte){ //! Enable SPI writing void spiflash_wrten(){ SETSS; + /* P5OUT&=~SS; //Drop !SS to begin transaction. spitrans8(0x04);//Write Disable P5OUT|=SS; //Raise !SS to end transaction. + */ P5OUT&=~SS; //Drop !SS to begin transaction. spitrans8(0x06);//Write Enable P5OUT|=SS; //Raise !SS to end transaction. @@ -140,7 +144,7 @@ void spiflash_pokeblock(unsigned long adr, spitrans8(buf[i]); SETSS; //Raise !SS to end transaction. - //while(spiflash_status()&0x01); + while(spiflash_status()&0x01); return; } @@ -203,7 +207,7 @@ void spihandle(unsigned char app, case SPI_JEDEC://Grab 3-byte JEDEC ID. P5OUT&=~SS; //Drop !SS to begin transaction. spitrans8(0x9f); - len=3; + len=3; //Length is variable in some chips, 3 minimum. for(i=0;i