X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Finclude%2Fspi.h;h=d940605657b9961a89031e9d31dd826cc4160ce7;hp=dfbb28ab4a20b117a590ae2c69b11bd5633c74b7;hb=f3480afd0970eb232b17070d8596e5d09aef2c7e;hpb=5fb0341d348e101b30794945a6c91546e25e8e7b diff --git a/firmware/include/spi.h b/firmware/include/spi.h index dfbb28a..d940605 100644 --- a/firmware/include/spi.h +++ b/firmware/include/spi.h @@ -11,21 +11,39 @@ #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 SETTST P4OUT|=TST -#define CLRTST P4OUT&=~TST -#define SETRST P2OUT|=RST -#define CLRRST P2OUT&=~RST +#if (platform == donbfet) +# define MOSI (1 << PA2) +# define MISO (1 << PA1) +# define SCK (1 << PA0) +# define SS (1 << PA3) +# define TST (1 << PA4) +# define XRST (1 << PA5) +#else +# define MOSI BIT1 +# define MISO BIT2 +# define SCK BIT3 +# define TST BIT0 +# define RST BIT6 +#endif + +#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. +#if (platform == donbfet) +# define SETTST PORTA|=(1 << PA4); +# define CLRTST PORTA&=~(1 << PA4); +# define SETRST PORTA|=(1 << PA5); +# define CLRRST PORTA&=~(1 << PA5); +#else +# define SETTST P4OUT|=TST +# define CLRTST P4OUT&=~TST +# define SETRST P2OUT|=RST +# define CLRRST P2OUT&=~RST +#endif //! Set up the pins for SPI mode. void spisetup();