2 \author Travis Goodspeed
3 \brief Definitions for the SPI application.
14 #if (platform == donbfet)
15 # define MOSI (1 << PA2)
16 # define MISO (1 << PA1)
17 # define SCK (1 << PA0)
18 # define SS (1 << PA3)
19 # define TST (1 << PA4)
20 # define XRST (1 << PA5)
29 #define SETMOSI SPIOUT|=MOSI
30 #define CLRMOSI SPIOUT&=~MOSI
31 #define SETCLK SPIOUT|=SCK
32 #define CLRCLK SPIOUT&=~SCK
33 #define READMISO (SPIIN&MISO?1:0)
35 //FIXME this should be defined by the platform.
36 #if (platform == donbfet)
37 # define SETTST PORTA|=(1 << PA4);
38 # define CLRTST PORTA&=~(1 << PA4);
39 # define SETRST PORTA|=(1 << PA5);
40 # define CLRRST PORTA&=~(1 << PA5);
42 # define SETTST P4OUT|=TST
43 # define CLRTST P4OUT&=~TST
44 # define SETRST P2OUT|=RST
45 # define CLRRST P2OUT&=~RST
48 //! Set up the pins for SPI mode.
51 //! Read and write an SPI byte.
52 unsigned char spitrans8(unsigned char byte);
54 //! Read a block to a buffer.
55 void spiflash_peekblock(unsigned long adr,
60 //! Write many blocks to the SPI Flash.
61 void spiflash_pokeblocks(unsigned long adr,
66 //! Enable SPI writing
67 void spiflash_wrten();
69 //! Read and write an SPI byte.
70 unsigned char spitrans8(unsigned char byte);
71 //! Grab the SPI flash status byte.
72 unsigned char spiflash_status();
74 void spiflash_erasesector(unsigned long adr);
76 extern app_t const spi_app;