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)
28 //Apimotev2 SET/CLRRST needs to be on pin 21, so 2.1 -- just redefine RST to BIT0
30 #define SETMOSI SPIOUT|=MOSI
31 #define CLRMOSI SPIOUT&=~MOSI
32 #define SETCLK SPIOUT|=SCK
33 #define CLRCLK SPIOUT&=~SCK
34 #define READMISO (SPIIN&MISO?1:0)
36 //FIXME this should be defined by the platform.
37 #if (platform == donbfet)
38 # define SETTST PORTA|=(1 << PA4);
39 # define CLRTST PORTA&=~(1 << PA4);
40 # define SETRST PORTA|=(1 << PA5);
41 # define CLRRST PORTA&=~(1 << PA5);
43 # define SETTST P4OUT|=TST
44 # define CLRTST P4OUT&=~TST
45 # define SETRST P2OUT|=RST
46 # define CLRRST P2OUT&=~RST
49 //! Set up the pins for SPI mode.
52 //! Read and write an SPI byte.
53 unsigned char spitrans8(unsigned char byte);
55 //! Read a block to a buffer.
56 void spiflash_peekblock(unsigned long adr,
61 //! Write many blocks to the SPI Flash.
62 void spiflash_pokeblocks(unsigned long adr,
67 //! Enable SPI writing
68 void spiflash_wrten();
70 //! Read and write an SPI byte.
71 unsigned char spitrans8(unsigned char byte);
72 //! Grab the SPI flash status byte.
73 unsigned char spiflash_status();
75 void spiflash_erasesector(unsigned long adr);
77 extern app_t const spi_app;