X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Finclude%2Fspi.h;h=0f272daeabb6f0357083ea99b781a404efc39c58;hp=590db0e40e1b1f9c7f048bdf4210ebda6a5d1b08;hb=a031b4a563978102c664466d1e91a9c3ab0553dd;hpb=496a0185c0bc88e6ccb768b7ff73055edc3cf4c3 diff --git a/firmware/include/spi.h b/firmware/include/spi.h index 590db0e..0f272da 100644 --- a/firmware/include/spi.h +++ b/firmware/include/spi.h @@ -3,25 +3,30 @@ \brief Definitions for the SPI application. */ +#ifndef SPI_H +#define SPI_H + +#include "app.h" + +#define SPI 0x01 //Pins and I/O -//#define SS BIT0 #define MOSI BIT1 #define MISO BIT2 #define SCK BIT3 -#define SETMOSI P5OUT|=MOSI -#define CLRMOSI P5OUT&=~MOSI -#define SETCLK P5OUT|=SCK -#define CLRCLK P5OUT&=~SCK -#define READMISO (P5IN&MISO?1:0) +#define SETMOSI SPIOUT|=MOSI +#define CLRMOSI SPIOUT&=~MOSI +#define SETCLK SPIOUT|=SCK +#define CLRCLK SPIOUT&=~SCK +#define READMISO (SPIIN&MISO?1:0) +//FIXME this should be defined by the platform. #define SETTST P4OUT|=TST #define CLRTST P4OUT&=~TST #define SETRST P2OUT|=RST #define CLRRST P2OUT&=~RST - //! Set up the pins for SPI mode. void spisetup(); @@ -49,3 +54,7 @@ unsigned char spitrans8(unsigned char byte); unsigned char spiflash_status(); //! Erase a sector. void spiflash_erasesector(unsigned long adr); + +extern app_t const spi_app; + +#endif