xref: /qemu/include/hw/i2c/ppc4xx_i2c.h (revision 3b09bb0fb9bc03f3897da4940ba2fb808c00c038)
1*3b09bb0fSBALATON Zoltan /*
2*3b09bb0fSBALATON Zoltan  * PPC4xx I2C controller emulation
3*3b09bb0fSBALATON Zoltan  *
4*3b09bb0fSBALATON Zoltan  * Copyright (c) 2007 Jocelyn Mayer
5*3b09bb0fSBALATON Zoltan  *
6*3b09bb0fSBALATON Zoltan  * Permission is hereby granted, free of charge, to any person obtaining a copy
7*3b09bb0fSBALATON Zoltan  * of this software and associated documentation files (the "Software"), to deal
8*3b09bb0fSBALATON Zoltan  * in the Software without restriction, including without limitation the rights
9*3b09bb0fSBALATON Zoltan  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10*3b09bb0fSBALATON Zoltan  * copies of the Software, and to permit persons to whom the Software is
11*3b09bb0fSBALATON Zoltan  * furnished to do so, subject to the following conditions:
12*3b09bb0fSBALATON Zoltan  *
13*3b09bb0fSBALATON Zoltan  * The above copyright notice and this permission notice shall be included in
14*3b09bb0fSBALATON Zoltan  * all copies or substantial portions of the Software.
15*3b09bb0fSBALATON Zoltan  *
16*3b09bb0fSBALATON Zoltan  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17*3b09bb0fSBALATON Zoltan  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18*3b09bb0fSBALATON Zoltan  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19*3b09bb0fSBALATON Zoltan  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20*3b09bb0fSBALATON Zoltan  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21*3b09bb0fSBALATON Zoltan  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22*3b09bb0fSBALATON Zoltan  * THE SOFTWARE.
23*3b09bb0fSBALATON Zoltan  */
24*3b09bb0fSBALATON Zoltan 
25*3b09bb0fSBALATON Zoltan #ifndef PPC4XX_I2C_H
26*3b09bb0fSBALATON Zoltan #define PPC4XX_I2C_H
27*3b09bb0fSBALATON Zoltan 
28*3b09bb0fSBALATON Zoltan #include "qemu/osdep.h"
29*3b09bb0fSBALATON Zoltan #include "qemu-common.h"
30*3b09bb0fSBALATON Zoltan #include "hw/sysbus.h"
31*3b09bb0fSBALATON Zoltan #include "hw/i2c/i2c.h"
32*3b09bb0fSBALATON Zoltan 
33*3b09bb0fSBALATON Zoltan #define TYPE_PPC4xx_I2C "ppc4xx-i2c"
34*3b09bb0fSBALATON Zoltan #define PPC4xx_I2C(obj) OBJECT_CHECK(PPC4xxI2CState, (obj), TYPE_PPC4xx_I2C)
35*3b09bb0fSBALATON Zoltan 
36*3b09bb0fSBALATON Zoltan typedef struct PPC4xxI2CState {
37*3b09bb0fSBALATON Zoltan     /*< private >*/
38*3b09bb0fSBALATON Zoltan     SysBusDevice parent_obj;
39*3b09bb0fSBALATON Zoltan 
40*3b09bb0fSBALATON Zoltan     /*< public >*/
41*3b09bb0fSBALATON Zoltan     I2CBus *bus;
42*3b09bb0fSBALATON Zoltan     qemu_irq irq;
43*3b09bb0fSBALATON Zoltan     MemoryRegion iomem;
44*3b09bb0fSBALATON Zoltan     uint8_t mdata;
45*3b09bb0fSBALATON Zoltan     uint8_t lmadr;
46*3b09bb0fSBALATON Zoltan     uint8_t hmadr;
47*3b09bb0fSBALATON Zoltan     uint8_t cntl;
48*3b09bb0fSBALATON Zoltan     uint8_t mdcntl;
49*3b09bb0fSBALATON Zoltan     uint8_t sts;
50*3b09bb0fSBALATON Zoltan     uint8_t extsts;
51*3b09bb0fSBALATON Zoltan     uint8_t sdata;
52*3b09bb0fSBALATON Zoltan     uint8_t lsadr;
53*3b09bb0fSBALATON Zoltan     uint8_t hsadr;
54*3b09bb0fSBALATON Zoltan     uint8_t clkdiv;
55*3b09bb0fSBALATON Zoltan     uint8_t intrmsk;
56*3b09bb0fSBALATON Zoltan     uint8_t xfrcnt;
57*3b09bb0fSBALATON Zoltan     uint8_t xtcntlss;
58*3b09bb0fSBALATON Zoltan     uint8_t directcntl;
59*3b09bb0fSBALATON Zoltan } PPC4xxI2CState;
60*3b09bb0fSBALATON Zoltan 
61*3b09bb0fSBALATON Zoltan #endif /* PPC4XX_I2C_H */
62