w1.h 893 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* SPDX-License-Identifier: GPL-2.0+
  2. *
  3. * Copyright (c) 2015 Free Electrons
  4. * Copyright (c) 2015 NextThing Co
  5. *
  6. */
  7. #ifndef __W1_H
  8. #define __W1_H
  9. #include <dm.h>
  10. #define W1_FAMILY_DS24B33 0x23
  11. #define W1_FAMILY_DS2431 0x2d
  12. #define W1_FAMILY_DS2502 0x09
  13. #define W1_FAMILY_EEP_SANDBOX 0xfe
  14. struct w1_device {
  15. u64 id;
  16. };
  17. struct w1_ops {
  18. u8 (*read_byte)(struct udevice *dev);
  19. bool (*reset)(struct udevice *dev);
  20. u8 (*triplet)(struct udevice *dev, bool bdir);
  21. void (*write_byte)(struct udevice *dev, u8 byte);
  22. };
  23. int w1_get_bus(int busnum, struct udevice **busp);
  24. u8 w1_get_device_family(struct udevice *dev);
  25. int w1_read_buf(struct udevice *dev, u8 *buf, unsigned int count);
  26. int w1_read_byte(struct udevice *dev);
  27. int w1_reset_select(struct udevice *dev);
  28. int w1_write_buf(struct udevice *dev, u8 *buf, unsigned int count);
  29. int w1_write_byte(struct udevice *dev, u8 byte);
  30. #endif