X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Finclude%2Fspi.h;h=d940605657b9961a89031e9d31dd826cc4160ce7;hp=0f272daeabb6f0357083ea99b781a404efc39c58;hb=f3480afd0970eb232b17070d8596e5d09aef2c7e;hpb=854dba571fe62948dfb23a396be3299225fcbb05 diff --git a/firmware/include/spi.h b/firmware/include/spi.h index 0f272da..d940605 100644 --- a/firmware/include/spi.h +++ b/firmware/include/spi.h @@ -11,9 +11,20 @@ #define SPI 0x01 //Pins and I/O -#define MOSI BIT1 -#define MISO BIT2 -#define SCK BIT3 +#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 @@ -22,10 +33,17 @@ #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 +#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();