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.

threewire.h 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef _GPXE_THREEWIRE_H
  2. #define _GPXE_THREEWIRE_H
  3. /** @file
  4. *
  5. * Three-wire serial interface
  6. *
  7. * The Atmel three-wire interface is a subset of the (newer) SPI
  8. * interface, and is implemented here as a layer on top of the SPI
  9. * support.
  10. */
  11. #include <gpxe/spi.h>
  12. /**
  13. * @defgroup tcmds Three-wire commands
  14. * @{
  15. */
  16. /** Read data from memory array */
  17. #define THREEWIRE_READ 0x6
  18. /** @} */
  19. /**
  20. * @defgroup spidevs SPI device types
  21. * @{
  22. */
  23. /** Atmel AT93C46 serial EEPROM
  24. *
  25. * @v org Word size (8 or 16)
  26. */
  27. #define AT93C46( org ) { \
  28. .word_len = (org), \
  29. .size = ( 1024 / (org) ), \
  30. .block_size = 1, \
  31. .command_len = 3, \
  32. .address_len = ( ( (org) == 8 ) ? 7 : 6 ), \
  33. .read = threewire_read, \
  34. }
  35. /** Atmel AT93C56 serial EEPROM
  36. *
  37. * @v org Word size (8 or 16)
  38. */
  39. #define AT93C56( org ) { \
  40. .word_len = (org), \
  41. .size = ( 2048 / (org) ), \
  42. .block_size = 1, \
  43. .command_len = 3, \
  44. .address_len = ( ( (org) == 8 ) ? 9 : 8 ), \
  45. .read = threewire_read, \
  46. }
  47. /** @} */
  48. extern int threewire_read ( struct spi_device *device, unsigned int address,
  49. void *data, size_t len );
  50. #endif /* _GPXE_THREEWIRE_H */