2 * QEMU USB OHCI Emulation
3 * Copyright (c) 2004 Gianni Tedesco
4 * Copyright (c) 2006 CodeSourcery
5 * Copyright (c) 2006 Openedhand Ltd.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
24 #include "hw/sysbus.h"
25 #include "sysemu/dma.h"
27 #include "qom/object.h"
29 /* Number of Downstream Ports on the root hub: */
30 #define OHCI_MAX_PORTS 15
32 typedef struct OHCIPort
{
37 typedef struct OHCIState OHCIState
;
51 /* Control partition */
56 /* memory pointer partition */
58 uint32_t ctrl_head
, ctrl_cur
;
59 uint32_t bulk_head
, bulk_cur
;
64 /* Frame counter partition */
69 uint16_t frame_number
;
74 /* Root Hub partition */
75 uint32_t rhdesc_a
, rhdesc_b
;
77 OHCIPort rhport
[OHCI_MAX_PORTS
];
79 /* PXA27x Non-OHCI events */
85 /* SM501 local memory offset */
86 dma_addr_t localmem_base
;
91 uint8_t usb_buf
[8192];
95 void (*ohci_die
)(OHCIState
*ohci
);
98 #define TYPE_SYSBUS_OHCI "sysbus-ohci"
99 OBJECT_DECLARE_SIMPLE_TYPE(OHCISysBusState
, SYSBUS_OHCI
)
101 struct OHCISysBusState
{
103 SysBusDevice parent_obj
;
110 dma_addr_t dma_offset
;
113 extern const VMStateDescription vmstate_ohci_state
;
115 void usb_ohci_init(OHCIState
*ohci
, DeviceState
*dev
, uint32_t num_ports
,
116 dma_addr_t localmem_base
, char *masterbus
,
117 uint32_t firstport
, AddressSpace
*as
,
118 void (*ohci_die_fn
)(OHCIState
*), Error
**errp
);
119 void ohci_bus_stop(OHCIState
*ohci
);
120 void ohci_stop_endpoints(OHCIState
*ohci
);
121 void ohci_hard_reset(OHCIState
*ohci
);
122 void ohci_sysbus_die(struct OHCIState
*ohci
);