summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe/spi_bit.h
diff options
context:
space:
mode:
authorMichael Brown2006-12-04 16:36:51 +0100
committerMichael Brown2006-12-04 16:36:51 +0100
commit931f94dca30b04f8303acdcfd08436e61a491a92 (patch)
treeb478b672436d696ce8d0a4d91c804d29a65db6a9 /src/include/gpxe/spi_bit.h
parentForce syntax-checking on assertions even in non-asserting builds. (diff)
downloadipxe-931f94dca30b04f8303acdcfd08436e61a491a92.tar.gz
ipxe-931f94dca30b04f8303acdcfd08436e61a491a92.tar.xz
ipxe-931f94dca30b04f8303acdcfd08436e61a491a92.zip
Generalised the SPI abstraction layer to also be able to handle interfaces
that don't provide the full flexibility of a bit-bashing interface. Temporarily hacked rtl8139.c to use the new interface.
Diffstat (limited to 'src/include/gpxe/spi_bit.h')
-rw-r--r--src/include/gpxe/spi_bit.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/include/gpxe/spi_bit.h b/src/include/gpxe/spi_bit.h
new file mode 100644
index 00000000..46f6af76
--- /dev/null
+++ b/src/include/gpxe/spi_bit.h
@@ -0,0 +1,45 @@
+#ifndef _GPXE_SPI_BIT_H
+#define _GPXE_SPI_BIT_H
+
+/** @file
+ *
+ * SPI bit-bashing interface
+ *
+ */
+
+#include <gpxe/spi.h>
+
+/** A bit-bashing SPI bus */
+struct spi_bit_basher {
+ /** SPI bus */
+ struct spi_bus bus;
+ /** Bit-bashing interface */
+ struct bit_basher basher;
+};
+
+/** Bit indices used for SPI bit-bashing interface */
+enum {
+ /** Serial clock */
+ SPI_BIT_SCLK = 0,
+ /** Master Out Slave In */
+ SPI_BIT_MOSI,
+ /** Master In Slave Out */
+ SPI_BIT_MISO,
+ /** Slave 0 select */
+ SPI_BIT_SS0,
+};
+
+/**
+ * Determine bit index for a particular slave
+ *
+ * @v slave Slave number
+ * @ret index Bit index (i.e. SPI_BIT_SSN, where N=slave)
+ */
+#define SPI_BIT_SS( slave ) ( SPI_BIT_SS0 + (slave) )
+
+/** Delay between SCLK transitions */
+#define SPI_BIT_UDELAY 1
+
+extern void init_spi_bit_basher ( struct spi_bit_basher *spibit );
+
+#endif /* _GPXE_SPI_BIT_H */