mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-17 15:12:07 -06:00
ehci: Add an ehci_get_pid helper function
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
e3fdfd488c
commit
51e0c5d029
1 changed files with 16 additions and 16 deletions
|
@ -481,6 +481,21 @@ static inline int put_dwords(EHCIState *ehci, uint32_t addr,
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ehci_get_pid(EHCIqtd *qtd)
|
||||||
|
{
|
||||||
|
switch (get_field(qtd->token, QTD_TOKEN_PID)) {
|
||||||
|
case 0:
|
||||||
|
return USB_TOKEN_OUT;
|
||||||
|
case 1:
|
||||||
|
return USB_TOKEN_IN;
|
||||||
|
case 2:
|
||||||
|
return USB_TOKEN_SETUP;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "bad token\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bool ehci_verify_qh(EHCIQueue *q, EHCIqh *qh)
|
static bool ehci_verify_qh(EHCIQueue *q, EHCIqh *qh)
|
||||||
{
|
{
|
||||||
uint32_t devaddr = get_field(qh->epchar, QH_EPCHAR_DEVADDR);
|
uint32_t devaddr = get_field(qh->epchar, QH_EPCHAR_DEVADDR);
|
||||||
|
@ -1352,22 +1367,7 @@ static int ehci_execute(EHCIPacket *p, const char *action)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->pid = (p->qtd.token & QTD_TOKEN_PID_MASK) >> QTD_TOKEN_PID_SH;
|
p->pid = ehci_get_pid(&p->qtd);
|
||||||
switch (p->pid) {
|
|
||||||
case 0:
|
|
||||||
p->pid = USB_TOKEN_OUT;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
p->pid = USB_TOKEN_IN;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
p->pid = USB_TOKEN_SETUP;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr, "bad token\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
endp = get_field(p->queue->qh.epchar, QH_EPCHAR_EP);
|
endp = get_field(p->queue->qh.epchar, QH_EPCHAR_EP);
|
||||||
ep = usb_ep_get(p->queue->dev, p->pid, endp);
|
ep = usb_ep_get(p->queue->dev, p->pid, endp);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue