xref: /qemu/include/hw/gpio/pca9552.h (revision 6328d8ffa6cb9d750e4bfcfd73ac25d3a39ceb63)
15141d415SCédric Le Goater /*
25141d415SCédric Le Goater  * PCA9552 I2C LED blinker
35141d415SCédric Le Goater  *
45141d415SCédric Le Goater  * Copyright (c) 2017-2018, IBM Corporation.
55141d415SCédric Le Goater  *
65141d415SCédric Le Goater  * This work is licensed under the terms of the GNU GPL, version 2 or
75141d415SCédric Le Goater  * later. See the COPYING file in the top-level directory.
85141d415SCédric Le Goater  */
95141d415SCédric Le Goater #ifndef PCA9552_H
105141d415SCédric Le Goater #define PCA9552_H
115141d415SCédric Le Goater 
125141d415SCédric Le Goater #include "hw/i2c/i2c.h"
13db1015e9SEduardo Habkost #include "qom/object.h"
145141d415SCédric Le Goater 
155141d415SCédric Le Goater #define TYPE_PCA9552 "pca9552"
16736132e4SPhilippe Mathieu-Daudé #define TYPE_PCA955X "pca955x"
17db1015e9SEduardo Habkost typedef struct PCA955xState PCA955xState;
188110fa1dSEduardo Habkost DECLARE_INSTANCE_CHECKER(PCA955xState, PCA955X,
198110fa1dSEduardo Habkost                          TYPE_PCA955X)
205141d415SCédric Le Goater 
21ec17228aSPhilippe Mathieu-Daudé #define PCA955X_NR_REGS 10
22736132e4SPhilippe Mathieu-Daudé #define PCA955X_PIN_COUNT_MAX 16
235141d415SCédric Le Goater 
24db1015e9SEduardo Habkost struct PCA955xState {
255141d415SCédric Le Goater     /*< private >*/
265141d415SCédric Le Goater     I2CSlave i2c;
275141d415SCédric Le Goater     /*< public >*/
285141d415SCédric Le Goater 
295141d415SCédric Le Goater     uint8_t len;
305141d415SCédric Le Goater     uint8_t pointer;
315141d415SCédric Le Goater 
32ec17228aSPhilippe Mathieu-Daudé     uint8_t regs[PCA955X_NR_REGS];
33*ff557c27SGlenn Miles     qemu_irq gpio_out[PCA955X_PIN_COUNT_MAX];
34*ff557c27SGlenn Miles     uint8_t ext_state[PCA955X_PIN_COUNT_MAX];
352df252d8SPhilippe Mathieu-Daudé     char *description; /* For debugging purpose only */
36db1015e9SEduardo Habkost };
375141d415SCédric Le Goater 
385141d415SCédric Le Goater #endif
39