4 * Copyright (C)2014 : GreenSocs Ltd
5 * http://www.greensocs.com/ , email: info@greensocs.com
8 * Frederic Konrad <fred.konrad@greensocs.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 2 of the License, or
13 * (at your option)any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, see <http://www.gnu.org/licenses/>.
30 typedef struct AUXBus AUXBus
;
31 typedef struct AUXSlave AUXSlave
;
32 typedef enum AUXCommand AUXCommand
;
33 typedef enum AUXReply AUXReply
;
34 typedef struct AUXTOI2CState AUXTOI2CState
;
54 #define TYPE_AUX_BUS "aux-bus"
55 #define AUX_BUS(obj) OBJECT_CHECK(AUXBus, (obj), TYPE_AUX_BUS)
62 AUXSlave
*current_dev
;
64 uint32_t last_i2c_address
;
65 AUXCommand last_transaction
;
67 AUXTOI2CState
*bridge
;
70 AddressSpace aux_addr_space
;
73 #define TYPE_AUX_SLAVE "aux-slave"
74 #define AUX_SLAVE(obj) \
75 OBJECT_CHECK(AUXSlave, (obj), TYPE_AUX_SLAVE)
79 DeviceState parent_obj
;
86 * aux_init_bus: Initialize an AUX bus.
88 * Returns the new AUX bus created.
90 * @parent The device where this bus is located.
91 * @name The name of the bus.
93 AUXBus
*aux_init_bus(DeviceState
*parent
, const char *name
);
96 * aux_request: Make a request on the bus.
98 * Returns the reply of the request.
100 * @bus Ths bus where the request happen.
101 * @cmd The command requested.
102 * @address The 20bits address of the slave.
103 * @len The length of the read or write.
104 * @data The data array which will be filled or read during transfer.
106 AUXReply
aux_request(AUXBus
*bus
, AUXCommand cmd
, uint32_t address
,
107 uint8_t len
, uint8_t *data
);
110 * aux_get_i2c_bus: Get the i2c bus for I2C over AUX command.
112 * Returns the i2c bus associated to this AUX bus.
116 I2CBus
*aux_get_i2c_bus(AUXBus
*bus
);
119 * aux_init_mmio: Init an mmio for an AUX slave.
121 * @aux_slave The AUX slave.
122 * @mmio The mmio to be registered.
124 void aux_init_mmio(AUXSlave
*aux_slave
, MemoryRegion
*mmio
);
126 DeviceState
*aux_create_slave(AUXBus
*bus
, const char *name
, uint32_t addr
);
128 #endif /* !QEMU_AUX_H */