Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
13a9a0d3
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
13a9a0d3
编写于
12月 16, 2010
作者:
G
Gerd Hoffmann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
usb: move complete callback to port ops
上级
5dc1672b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
34 addition
and
34 deletion
+34
-34
hw/usb-hub.c
hw/usb-hub.c
+14
-0
hw/usb-msd.c
hw/usb-msd.c
+2
-2
hw/usb-musb.c
hw/usb-musb.c
+9
-18
hw/usb-ohci.c
hw/usb-ohci.c
+2
-5
hw/usb-uhci.c
hw/usb-uhci.c
+3
-4
hw/usb.h
hw/usb.h
+3
-4
usb-linux.c
usb-linux.c
+1
-1
未找到文件。
hw/usb-hub.c
浏览文件 @
13a9a0d3
...
...
@@ -256,6 +256,19 @@ static void usb_hub_wakeup(USBDevice *dev)
}
}
static
void
usb_hub_complete
(
USBDevice
*
dev
,
USBPacket
*
packet
)
{
USBHubState
*
s
=
dev
->
port
->
opaque
;
/*
* Just pass it along upstream for now.
*
* If we ever inplement usb 2.0 split transactions this will
* become a little more complicated ...
*/
usb_packet_complete
(
&
s
->
dev
,
packet
);
}
static
void
usb_hub_handle_attach
(
USBDevice
*
dev
)
{
USBHubState
*
s
=
DO_UPCAST
(
USBHubState
,
dev
,
dev
);
...
...
@@ -524,6 +537,7 @@ static USBPortOps usb_hub_port_ops = {
.
attach
=
usb_hub_attach
,
.
detach
=
usb_hub_detach
,
.
wakeup
=
usb_hub_wakeup
,
.
complete
=
usb_hub_complete
,
};
static
int
usb_hub_initfn
(
USBDevice
*
dev
)
...
...
hw/usb-msd.c
浏览文件 @
13a9a0d3
...
...
@@ -241,7 +241,7 @@ static void usb_msd_command_complete(SCSIBus *bus, int reason, uint32_t tag,
s
->
mode
=
USB_MSDM_CSW
;
}
s
->
packet
=
NULL
;
usb_packet_complete
(
p
);
usb_packet_complete
(
&
s
->
dev
,
p
);
}
else
if
(
s
->
data_len
==
0
)
{
s
->
mode
=
USB_MSDM_CSW
;
}
...
...
@@ -257,7 +257,7 @@ static void usb_msd_command_complete(SCSIBus *bus, int reason, uint32_t tag,
usb_packet_complete returns. */
DPRINTF
(
"Packet complete %p
\n
"
,
p
);
s
->
packet
=
NULL
;
usb_packet_complete
(
p
);
usb_packet_complete
(
&
s
->
dev
,
p
);
}
}
}
...
...
hw/usb-musb.c
浏览文件 @
13a9a0d3
...
...
@@ -261,10 +261,12 @@
static
void
musb_attach
(
USBPort
*
port
);
static
void
musb_detach
(
USBPort
*
port
);
static
void
musb_schedule_cb
(
USBDevice
*
dev
,
USBPacket
*
p
);
static
USBPortOps
musb_port_ops
=
{
.
attach
=
musb_attach
,
.
detach
=
musb_detach
,
.
complete
=
musb_schedule_cb
,
};
typedef
struct
MUSBPacket
MUSBPacket
;
...
...
@@ -511,9 +513,11 @@ static inline void musb_cb_tick1(void *opaque)
#define musb_cb_tick (dir ? musb_cb_tick1 : musb_cb_tick0)
static
inline
void
musb_schedule_cb
(
USB
Packet
*
packey
,
void
*
opaque
,
int
dir
)
static
inline
void
musb_schedule_cb
(
USB
Device
*
dev
,
USBPacket
*
packey
)
{
MUSBEndPoint
*
ep
=
(
MUSBEndPoint
*
)
opaque
;
MUSBPacket
*
p
=
container_of
(
packey
,
MUSBPacket
,
p
);
MUSBEndPoint
*
ep
=
p
->
ep
;
int
dir
=
p
->
dir
;
int
timeout
=
0
;
if
(
ep
->
status
[
dir
]
==
USB_RET_NAK
)
...
...
@@ -521,25 +525,15 @@ static inline void musb_schedule_cb(USBPacket *packey, void *opaque, int dir)
else
if
(
ep
->
interrupt
[
dir
])
timeout
=
8
;
else
return
musb_cb_tick
(
opaque
);
return
musb_cb_tick
(
ep
);
if
(
!
ep
->
intv_timer
[
dir
])
ep
->
intv_timer
[
dir
]
=
qemu_new_timer_ns
(
vm_clock
,
musb_cb_tick
,
opaque
);
ep
->
intv_timer
[
dir
]
=
qemu_new_timer_ns
(
vm_clock
,
musb_cb_tick
,
ep
);
qemu_mod_timer
(
ep
->
intv_timer
[
dir
],
qemu_get_clock_ns
(
vm_clock
)
+
muldiv64
(
timeout
,
get_ticks_per_sec
(),
8000
));
}
static
void
musb_schedule0_cb
(
USBPacket
*
packey
,
void
*
opaque
)
{
return
musb_schedule_cb
(
packey
,
opaque
,
0
);
}
static
void
musb_schedule1_cb
(
USBPacket
*
packey
,
void
*
opaque
)
{
return
musb_schedule_cb
(
packey
,
opaque
,
1
);
}
static
int
musb_timeout
(
int
ttype
,
int
speed
,
int
val
)
{
#if 1
...
...
@@ -596,7 +590,6 @@ static inline void musb_packet(MUSBState *s, MUSBEndPoint *ep,
ep
->
type
[
idx
]
>>
6
,
ep
->
interval
[
idx
]);
ep
->
interrupt
[
dir
]
=
ttype
==
USB_ENDPOINT_XFER_INT
;
ep
->
delayed_cb
[
dir
]
=
cb
;
cb
=
dir
?
musb_schedule1_cb
:
musb_schedule0_cb
;
ep
->
packey
[
dir
].
p
.
pid
=
pid
;
/* A wild guess on the FADDR semantics... */
...
...
@@ -604,8 +597,6 @@ static inline void musb_packet(MUSBState *s, MUSBEndPoint *ep,
ep
->
packey
[
dir
].
p
.
devep
=
ep
->
type
[
idx
]
&
0xf
;
ep
->
packey
[
dir
].
p
.
data
=
(
void
*
)
ep
->
buf
[
idx
];
ep
->
packey
[
dir
].
p
.
len
=
len
;
ep
->
packey
[
dir
].
p
.
complete_cb
=
cb
;
ep
->
packey
[
dir
].
p
.
complete_opaque
=
ep
;
ep
->
packey
[
dir
].
ep
=
ep
;
ep
->
packey
[
dir
].
dir
=
dir
;
...
...
@@ -620,7 +611,7 @@ static inline void musb_packet(MUSBState *s, MUSBEndPoint *ep,
}
ep
->
status
[
dir
]
=
ret
;
usb_packet_complete
(
&
ep
->
packey
[
dir
].
p
);
usb_packet_complete
(
s
->
port
.
dev
,
&
ep
->
packey
[
dir
].
p
);
}
static
void
musb_tx_packet_complete
(
USBPacket
*
packey
,
void
*
opaque
)
...
...
hw/usb-ohci.c
浏览文件 @
13a9a0d3
...
...
@@ -575,7 +575,7 @@ static void ohci_copy_iso_td(OHCIState *ohci,
static
void
ohci_process_lists
(
OHCIState
*
ohci
,
int
completion
);
static
void
ohci_async_complete_packet
(
USB
Packet
*
packet
,
void
*
opaque
)
static
void
ohci_async_complete_packet
(
USB
Device
*
dev
,
USBPacket
*
packet
)
{
OHCIState
*
ohci
=
container_of
(
packet
,
OHCIState
,
usb_packet
);
#ifdef DEBUG_PACKET
...
...
@@ -748,8 +748,6 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed,
ohci
->
usb_packet
.
devep
=
OHCI_BM
(
ed
->
flags
,
ED_EN
);
ohci
->
usb_packet
.
data
=
ohci
->
usb_buf
;
ohci
->
usb_packet
.
len
=
len
;
ohci
->
usb_packet
.
complete_cb
=
ohci_async_complete_packet
;
ohci
->
usb_packet
.
complete_opaque
=
ohci
;
ret
=
dev
->
info
->
handle_packet
(
dev
,
&
ohci
->
usb_packet
);
if
(
ret
!=
USB_RET_NODEV
)
break
;
...
...
@@ -946,8 +944,6 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed)
ohci
->
usb_packet
.
devep
=
OHCI_BM
(
ed
->
flags
,
ED_EN
);
ohci
->
usb_packet
.
data
=
ohci
->
usb_buf
;
ohci
->
usb_packet
.
len
=
len
;
ohci
->
usb_packet
.
complete_cb
=
ohci_async_complete_packet
;
ohci
->
usb_packet
.
complete_opaque
=
ohci
;
ret
=
dev
->
info
->
handle_packet
(
dev
,
&
ohci
->
usb_packet
);
if
(
ret
!=
USB_RET_NODEV
)
break
;
...
...
@@ -1665,6 +1661,7 @@ static CPUWriteMemoryFunc * const ohci_writefn[3]={
static
USBPortOps
ohci_port_ops
=
{
.
attach
=
ohci_attach
,
.
detach
=
ohci_detach
,
.
complete
=
ohci_async_complete_packet
,
};
static
void
usb_ohci_init
(
OHCIState
*
ohci
,
DeviceState
*
dev
,
...
...
hw/usb-uhci.c
浏览文件 @
13a9a0d3
...
...
@@ -642,7 +642,7 @@ static int uhci_broadcast_packet(UHCIState *s, USBPacket *p)
return
ret
;
}
static
void
uhci_async_complete
(
USB
Packet
*
packet
,
void
*
opaque
);
static
void
uhci_async_complete
(
USB
Device
*
dev
,
USBPacket
*
packet
);
static
void
uhci_process_frame
(
UHCIState
*
s
);
/* return -1 if fatal error (frame must be stopped)
...
...
@@ -795,8 +795,6 @@ static int uhci_handle_td(UHCIState *s, uint32_t addr, UHCI_TD *td, uint32_t *in
async
->
packet
.
devep
=
(
td
->
token
>>
15
)
&
0xf
;
async
->
packet
.
data
=
async
->
buffer
;
async
->
packet
.
len
=
max_len
;
async
->
packet
.
complete_cb
=
uhci_async_complete
;
async
->
packet
.
complete_opaque
=
s
;
switch
(
pid
)
{
case
USB_TOKEN_OUT
:
...
...
@@ -832,7 +830,7 @@ done:
return
len
;
}
static
void
uhci_async_complete
(
USB
Packet
*
packet
,
void
*
opaque
)
static
void
uhci_async_complete
(
USB
Device
*
dev
,
USBPacket
*
packet
)
{
UHCIAsync
*
async
=
container_of
(
packet
,
UHCIAsync
,
packet
);
UHCIState
*
s
=
async
->
uhci
;
...
...
@@ -1083,6 +1081,7 @@ static USBPortOps uhci_port_ops = {
.
attach
=
uhci_attach
,
.
detach
=
uhci_detach
,
.
wakeup
=
uhci_wakeup
,
.
complete
=
uhci_async_complete
,
};
static
int
usb_uhci_common_initfn
(
UHCIState
*
s
)
...
...
hw/usb.h
浏览文件 @
13a9a0d3
...
...
@@ -235,6 +235,7 @@ typedef struct USBPortOps {
void
(
*
attach
)(
USBPort
*
port
);
void
(
*
detach
)(
USBPort
*
port
);
void
(
*
wakeup
)(
USBDevice
*
dev
);
void
(
*
complete
)(
USBDevice
*
dev
,
USBPacket
*
p
);
}
USBPortOps
;
/* USB port on which a device can be connected */
...
...
@@ -259,8 +260,6 @@ struct USBPacket {
uint8_t
*
data
;
int
len
;
/* Internal use by the USB layer. */
USBCallback
*
complete_cb
;
void
*
complete_opaque
;
USBCallback
*
cancel_cb
;
void
*
cancel_opaque
;
};
...
...
@@ -278,9 +277,9 @@ static inline void usb_defer_packet(USBPacket *p, USBCallback *cancel,
/* Notify the controller that an async packet is complete. This should only
be called for packets previously deferred with usb_defer_packet, and
should never be called from within handle_packet. */
static
inline
void
usb_packet_complete
(
USBPacket
*
p
)
static
inline
void
usb_packet_complete
(
USB
Device
*
dev
,
USB
Packet
*
p
)
{
p
->
complete_cb
(
p
,
p
->
complete_opaque
);
dev
->
port
->
ops
->
complete
(
dev
,
p
);
}
/* Cancel an active packet. The packed must have been deferred with
...
...
usb-linux.c
浏览文件 @
13a9a0d3
...
...
@@ -348,7 +348,7 @@ static void async_complete(void *opaque)
break
;
}
usb_packet_complete
(
p
);
usb_packet_complete
(
&
s
->
dev
,
p
);
}
async_free
(
aurb
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录