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)
27 #define SETMOSI SPIOUT|=MOSI
28 #define CLRMOSI SPIOUT&=~MOSI
29 #define SETCLK SPIOUT|=SCK
30 #define CLRCLK SPIOUT&=~SCK
31 #define READMISO (SPIIN&MISO?1:0)
33 //FIXME this should be defined by the platform.
34 #if (platform == donbfet)
35 # define SETTST PORTA|=(1 << PA4);
36 # define CLRTST PORTA&=~(1 << PA4);
37 # define SETRST PORTA|=(1 << PA5);
38 # define CLRRST PORTA&=~(1 << PA5);
40 # define SETTST P4OUT|=TST
41 # define CLRTST P4OUT&=~TST
42 # define SETRST P2OUT|=RST
43 # define CLRRST P2OUT&=~RST
46 //! Set up the pins for SPI mode.
49 //! Read and write an SPI byte.
50 unsigned char spitrans8(unsigned char byte);
52 //! Read a block to a buffer.
53 void spiflash_peekblock(unsigned long adr,
58 //! Write many blocks to the SPI Flash.
59 void spiflash_pokeblocks(unsigned long adr,
64 //! Enable SPI writing
65 void spiflash_wrten();
67 //! Read and write an SPI byte.
68 unsigned char spitrans8(unsigned char byte);
69 //! Grab the SPI flash status byte.
70 unsigned char spiflash_status();
72 void spiflash_erasesector(unsigned long adr);
74 extern app_t const spi_app;