pca9554.h 725 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * PCA9554 I/O port
  3. *
  4. * Copyright (c) 2023, IBM Corporation.
  5. *
  6. * SPDX-License-Identifier: GPL-2.0-or-later
  7. */
  8. #ifndef PCA9554_H
  9. #define PCA9554_H
  10. #include "hw/i2c/i2c.h"
  11. #include "qom/object.h"
  12. #define TYPE_PCA9554 "pca9554"
  13. typedef struct PCA9554State PCA9554State;
  14. DECLARE_INSTANCE_CHECKER(PCA9554State, PCA9554,
  15. TYPE_PCA9554)
  16. #define PCA9554_NR_REGS 4
  17. #define PCA9554_PIN_COUNT 8
  18. struct PCA9554State {
  19. /*< private >*/
  20. I2CSlave i2c;
  21. /*< public >*/
  22. uint8_t len;
  23. uint8_t pointer;
  24. uint8_t regs[PCA9554_NR_REGS];
  25. qemu_irq gpio_out[PCA9554_PIN_COUNT];
  26. uint8_t ext_state[PCA9554_PIN_COUNT];
  27. char *description; /* For debugging purpose only */
  28. };
  29. #endif