iPXE
spi_bit.h
Go to the documentation of this file.
1 #ifndef _IPXE_SPI_BIT_H
2 #define _IPXE_SPI_BIT_H
3 
4 /** @file
5  *
6  * SPI bit-bashing interface
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <ipxe/spi.h>
13 #include <ipxe/bitbash.h>
14 
15 /** A bit-bashing SPI bus */
17  /** SPI bus */
18  struct spi_bus bus;
19  /** Bit-bashing interface */
21  /** Endianness of data
22  *
23  * SPI commands and addresses are always big-endian (i.e. MSB
24  * transmitted first on the wire), but some cards
25  * (e.g. natsemi) choose to regard the data stored in the
26  * EEPROM as little-endian (i.e. LSB transmitted first on the
27  * wire).
28  */
30 };
31 
32 /** Bit indices used for SPI bit-bashing interface */
33 enum {
34  /** Serial clock */
36  /** Master Out Slave In */
38  /** Master In Slave Out */
40  /** Slave 0 select */
42 };
43 
44 /**
45  * Determine bit index for a particular slave
46  *
47  * @v slave Slave number
48  * @ret index Bit index (i.e. SPI_BIT_SSN, where N=slave)
49  */
50 #define SPI_BIT_SS( slave ) ( SPI_BIT_SS0 + (slave) )
51 
52 /** Delay between SCLK transitions */
53 #define SPI_BIT_UDELAY 1
54 
55 /** SPI bit basher treats data as big-endian */
56 #define SPI_BIT_BIG_ENDIAN 0
57 
58 /** SPI bit basher treats data as little-endian */
59 #define SPI_BIT_LITTLE_ENDIAN 1
60 
61 extern void init_spi_bit_basher ( struct spi_bit_basher *spibit );
62 
63 #endif /* _IPXE_SPI_BIT_H */
struct bit_basher basher
Bit-bashing interface.
Definition: spi_bit.h:20
An SPI bus.
Definition: spi.h:126
Slave 0 select.
Definition: spi_bit.h:41
Master In Slave Out.
Definition: spi_bit.h:39
SPI interface.
Bit-bashing interfaces.
Master Out Slave In.
Definition: spi_bit.h:37
A bit-bashing SPI bus.
Definition: spi_bit.h:16
A bit-bashing interface.
Definition: bitbash.h:55
Serial clock.
Definition: spi_bit.h:35
struct spi_bus bus
SPI bus.
Definition: spi_bit.h:18
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
void init_spi_bit_basher(struct spi_bit_basher *spibit)
Initialise SPI bit-bashing interface.
Definition: spi_bit.c:235
int endianness
Endianness of data.
Definition: spi_bit.h:29