diff options
Diffstat (limited to 'hw/usb/dump.h')
-rw-r--r-- | hw/usb/dump.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/hw/usb/dump.h b/hw/usb/dump.h index 08134e82e3..1fb8389b60 100644 --- a/hw/usb/dump.h +++ b/hw/usb/dump.h @@ -31,7 +31,7 @@ typedef struct UsbDumpState UsbDumpState; /* * p->pid shows whether a packet is IN, OUT or SETUP. * - * handle_ctrl is called for: + * handle_control is called for: * - SETUP (setup dir IN): setup_buf provided, data ptr is data (setup_len > 0) * - IN: setup_len > 0 (data): callback for OUT * - (same code path: IN: setup_len == 0 (!data): Called iff dir is OUT @@ -52,6 +52,11 @@ typedef struct UsbDumpState UsbDumpState; * - setup(setup_len == 0, IN) / status^SC,(IN) - Same as above (with * status(IN)), but there is no data for both submission and callback. * - setup(setup_len == 0, OUT) / status(OUT) (BROKEN!) + * + * handle_data is called for all non-EP0 transfers. PID is either IN or OUT. + * Sequence for the PID cases: + * - IN: submit(); make data; complete(data); usb_packet_copy(data) + * - OUT: usb_packet_copy(data); submit(data); process data; complete() */ /* @@ -60,6 +65,8 @@ typedef struct UsbDumpState UsbDumpState; * data is of length setup_len. PID == OUT is not possible because handle_ctrl * is never called from that point. * + * submit (data): IN request (host wants data from dev), so no data attached. + * * If s is NULL or if no dump file is available, no action is performed. */ void usb_dump_submit(UsbDumpState *s, USBPacket *p); @@ -69,10 +76,29 @@ void usb_dump_submit(UsbDumpState *s, USBPacket *p); * inserted by the "device" in handle_ctrl. Length is actual_length. If PID == * IN, then data is empty. PID == OUT is again not possible (see submit). * + * complete (data): OUT status (device has received data), so no data attached. + * Also called for pid == IN if an error occured (p->status != USB_RET_SUCCESS) + * and no data is available. + * * If s is NULL or if no dump file is available, no action is performed. */ void usb_dump_complete(UsbDumpState *s, USBPacket *p); +/* + * submit (data): OUT request, host has data for device. + * + * If s is NULL or if no dump file is available, no action is performed. + */ +void usb_dump_submit_data(UsbDumpState *s, USBPacket *p, + uint8_t *data, size_t len); +/* + * complete (data): IN status, device has data for device. + * + * If s is NULL or if no dump file is available, no action is performed. + */ +void usb_dump_complete_data(UsbDumpState *s, USBPacket *p, + uint8_t *data, size_t len); + void usb_dump_cleanup(UsbDumpState *s); |