You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

spi_bit.h 886B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef _GPXE_SPI_BIT_H
  2. #define _GPXE_SPI_BIT_H
  3. /** @file
  4. *
  5. * SPI bit-bashing interface
  6. *
  7. */
  8. #include <gpxe/spi.h>
  9. #include <gpxe/bitbash.h>
  10. /** A bit-bashing SPI bus */
  11. struct spi_bit_basher {
  12. /** SPI bus */
  13. struct spi_bus bus;
  14. /** Bit-bashing interface */
  15. struct bit_basher basher;
  16. };
  17. /** Bit indices used for SPI bit-bashing interface */
  18. enum {
  19. /** Serial clock */
  20. SPI_BIT_SCLK = 0,
  21. /** Master Out Slave In */
  22. SPI_BIT_MOSI,
  23. /** Master In Slave Out */
  24. SPI_BIT_MISO,
  25. /** Slave 0 select */
  26. SPI_BIT_SS0,
  27. };
  28. /**
  29. * Determine bit index for a particular slave
  30. *
  31. * @v slave Slave number
  32. * @ret index Bit index (i.e. SPI_BIT_SSN, where N=slave)
  33. */
  34. #define SPI_BIT_SS( slave ) ( SPI_BIT_SS0 + (slave) )
  35. /** Delay between SCLK transitions */
  36. #define SPI_BIT_UDELAY 1
  37. extern void init_spi_bit_basher ( struct spi_bit_basher *spibit );
  38. #endif /* _GPXE_SPI_BIT_H */