1 #ifndef _GPXE_SPI_BIT_H
2 #define _GPXE_SPI_BIT_H
6 * SPI bit-bashing interface
11 #include <gpxe/bitbash.h>
13 /** A bit-bashing SPI bus */
14 struct spi_bit_basher
{
17 /** Bit-bashing interface */
18 struct bit_basher basher
;
19 /** Endianness of data
21 * SPI commands and addresses are always big-endian (i.e. MSB
22 * transmitted first on the wire), but some cards
23 * (e.g. natsemi) choose to regard the data stored in the
24 * EEPROM as little-endian (i.e. LSB transmitted first on the
30 /** Bit indices used for SPI bit-bashing interface */
34 /** Master Out Slave In */
36 /** Master In Slave Out */
43 * Determine bit index for a particular slave
45 * @v slave Slave number
46 * @ret index Bit index (i.e. SPI_BIT_SSN, where N=slave)
48 #define SPI_BIT_SS( slave ) ( SPI_BIT_SS0 + (slave) )
50 /** Delay between SCLK transitions */
51 #define SPI_BIT_UDELAY 1
53 /** SPI bit basher treats data as big-endian */
54 #define SPI_BIT_BIG_ENDIAN 0
56 /** SPI bit basher treats data as little-endian */
57 #define SPI_BIT_LITTLE_ENDIAN 1
59 extern void init_spi_bit_basher ( struct spi_bit_basher
*spibit
);
61 #endif /* _GPXE_SPI_BIT_H */