summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown2007-07-01 16:22:12 +0200
committerMichael Brown2007-07-01 16:22:12 +0200
commit95cb7aaacf734cff2bd8580475732de80d52d327 (patch)
tree8892b1a5d0aeb0d09053d70c45d97e2e628af31b /src/include
parentCan't use strncpy() to copy strings that aren't NUL-terminated to (diff)
downloadipxe-95cb7aaacf734cff2bd8580475732de80d52d327.tar.gz
ipxe-95cb7aaacf734cff2bd8580475732de80d52d327.tar.xz
ipxe-95cb7aaacf734cff2bd8580475732de80d52d327.zip
Support cards such as natsemi which treat the data as little-endian
(i.e. LSB transmitted first on the wire), even though SPI commands and addresses always have to be big-endian.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gpxe/spi_bit.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/include/gpxe/spi_bit.h b/src/include/gpxe/spi_bit.h
index 04af9136c..ced85ceba 100644
--- a/src/include/gpxe/spi_bit.h
+++ b/src/include/gpxe/spi_bit.h
@@ -16,6 +16,15 @@ struct spi_bit_basher {
struct spi_bus bus;
/** Bit-bashing interface */
struct bit_basher basher;
+ /** Endianness of data
+ *
+ * SPI commands and addresses are always big-endian (i.e. MSB
+ * transmitted first on the wire), but some cards
+ * (e.g. natsemi) choose to regard the data stored in the
+ * EEPROM as little-endian (i.e. LSB transmitted first on the
+ * wire).
+ */
+ int endianness;
};
/** Bit indices used for SPI bit-bashing interface */
@@ -41,6 +50,12 @@ enum {
/** Delay between SCLK transitions */
#define SPI_BIT_UDELAY 1
+/** SPI bit basher treats data as big-endian */
+#define SPI_BIT_BIG_ENDIAN 0
+
+/** SPI bit basher treats data as little-endian */
+#define SPI_BIT_LITTLE_ENDIAN 1
+
extern void init_spi_bit_basher ( struct spi_bit_basher *spibit );
#endif /* _GPXE_SPI_BIT_H */