From cc92cb4cc1f80259236ddf86911c03c0365db5ea Mon Sep 17 00:00:00 2001 From: travisutk Date: Thu, 8 Jul 2010 14:06:51 +0000 Subject: [PATCH] EM260 extensions to SPI are almost ready. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@663 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- firmware/apps/spi/spi.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/firmware/apps/spi/spi.c b/firmware/apps/spi/spi.c index eed9553..47c42c5 100644 --- a/firmware/apps/spi/spi.c +++ b/firmware/apps/spi/spi.c @@ -239,6 +239,7 @@ void spihandle(unsigned char app, unsigned char verb, unsigned long len){ unsigned long i; + static int state=0; //Raise !SS to end transaction, just in case we forgot. SETSS; @@ -257,11 +258,19 @@ void spihandle(unsigned char app, case SPI_RW_EM260: //SPI exchange with an EM260 P4DIR=0; //TODO ASAP remove P4 references. - P4OUT=0; + P4OUT=0xFF; + P4REN=0xFF; //See GoodFETEM260.py for details. //The EM260 requires that the host wait for the client. + /* + if((~P4IN)&1) + debugstr("Detected HOST_INT."); + */ + + //if(!state++) + //if(state++&1) em260_wake(); SETMOSI; //Autodetected SPI mode. @@ -269,18 +278,27 @@ void spihandle(unsigned char app, //Host to slave. Ignore data. for(i=0;i