ds4510.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright 2008 Extreme Engineering Solutions, Inc.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0
  5. */
  6. #ifndef __DS4510_H_
  7. #define __DS4510_H_
  8. /* General defines */
  9. #define DS4510_NUM_IO 0x04
  10. #define DS4510_IO_MASK ((1 << DS4510_NUM_IO) - 1)
  11. #define DS4510_EEPROM_PAGE_WRITE_DELAY_MS 20
  12. /* EEPROM from 0x00 - 0x39 */
  13. #define DS4510_EEPROM 0x00
  14. #define DS4510_EEPROM_SIZE 0x40
  15. #define DS4510_EEPROM_PAGE_SIZE 0x08
  16. #define DS4510_EEPROM_PAGE_OFFSET(x) ((x) & (DS4510_EEPROM_PAGE_SIZE - 1))
  17. /* SEEPROM from 0xf0 - 0xf7 */
  18. #define DS4510_SEEPROM 0xf0
  19. #define DS4510_SEEPROM_SIZE 0x08
  20. /* Registers overlapping SEEPROM from 0xf0 - 0xf7 */
  21. #define DS4510_PULLUP 0xF0
  22. #define DS4510_PULLUP_DIS 0x00
  23. #define DS4510_PULLUP_EN 0x01
  24. #define DS4510_RSTDELAY 0xF1
  25. #define DS4510_RSTDELAY_MASK 0x03
  26. #define DS4510_RSTDELAY_125 0x00
  27. #define DS4510_RSTDELAY_250 0x01
  28. #define DS4510_RSTDELAY_500 0x02
  29. #define DS4510_RSTDELAY_1000 0x03
  30. #define DS4510_IO3 0xF4
  31. #define DS4510_IO2 0xF5
  32. #define DS4510_IO1 0xF6
  33. #define DS4510_IO0 0xF7
  34. /* Status configuration registers from 0xf8 - 0xf9*/
  35. #define DS4510_IO_STATUS 0xF8
  36. #define DS4510_CFG 0xF9
  37. #define DS4510_CFG_READY 0x80
  38. #define DS4510_CFG_TRIP_POINT 0x40
  39. #define DS4510_CFG_RESET 0x20
  40. #define DS4510_CFG_SEE 0x10
  41. #define DS4510_CFG_SWRST 0x08
  42. /* SRAM from 0xfa - 0xff */
  43. #define DS4510_SRAM 0xfa
  44. #define DS4510_SRAM_SIZE 0x06
  45. int ds4510_mem_write(uint8_t chip, int offset, uint8_t *buf, int count);
  46. int ds4510_mem_read(uint8_t chip, int offset, uint8_t *buf, int count);
  47. int ds4510_see_write(uint8_t chip, uint8_t nv);
  48. int ds4510_rstdelay_write(uint8_t chip, uint8_t delay);
  49. int ds4510_pullup_write(uint8_t chip, uint8_t val);
  50. int ds4510_pullup_read(uint8_t chip);
  51. int ds4510_gpio_write(uint8_t chip, uint8_t val);
  52. int ds4510_gpio_read(uint8_t chip);
  53. int ds4510_gpio_read_val(uint8_t chip);
  54. #endif /* __DS4510_H_ */