xref: /qemu/include/hw/gpio/pca9552.h (revision ec17228a25e7fd46287842322f8dc4923eccca92)
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"
135141d415SCédric Le Goater 
145141d415SCédric Le Goater #define TYPE_PCA9552 "pca9552"
15*ec17228aSPhilippe Mathieu-Daudé #define PCA955X(obj) OBJECT_CHECK(PCA955xState, (obj), TYPE_PCA9552)
165141d415SCédric Le Goater 
17*ec17228aSPhilippe Mathieu-Daudé #define PCA955X_NR_REGS 10
185141d415SCédric Le Goater 
19*ec17228aSPhilippe Mathieu-Daudé typedef struct PCA955xState {
205141d415SCédric Le Goater     /*< private >*/
215141d415SCédric Le Goater     I2CSlave i2c;
225141d415SCédric Le Goater     /*< public >*/
235141d415SCédric Le Goater 
245141d415SCédric Le Goater     uint8_t len;
255141d415SCédric Le Goater     uint8_t pointer;
265141d415SCédric Le Goater 
27*ec17228aSPhilippe Mathieu-Daudé     uint8_t regs[PCA955X_NR_REGS];
285141d415SCédric Le Goater     uint8_t max_reg;
298208335bSPhilippe Mathieu-Daudé     uint8_t pin_count;
30*ec17228aSPhilippe Mathieu-Daudé } PCA955xState;
315141d415SCédric Le Goater 
325141d415SCédric Le Goater #endif
33