Revision 4ff658fb hw/usb.h

b/hw/usb.h
262 262
    uint8_t *data;
263 263
    int len;
264 264
    /* Internal use by the USB layer.  */
265
    USBDevice *owner;
265 266
    USBCallback *cancel_cb;
266 267
    void *cancel_opaque;
267 268
};
268 269

  
269 270
int usb_handle_packet(USBDevice *dev, USBPacket *p);
271
void usb_packet_complete(USBDevice *dev, USBPacket *p);
272
void usb_cancel_packet(USBPacket * p);
270 273

  
271 274
/* Defer completion of a USB packet.  The hadle_packet routine should then
272 275
   return USB_RET_ASYNC.  Packets that complete immediately (before
......
278 281
    p->cancel_opaque = opaque;
279 282
}
280 283

  
281
/* Notify the controller that an async packet is complete.  This should only
282
   be called for packets previously deferred with usb_defer_packet, and
283
   should never be called from within handle_packet.  */
284
static inline void usb_packet_complete(USBDevice *dev, USBPacket *p)
285
{
286
    dev->port->ops->complete(dev, p);
287
}
288

  
289
/* Cancel an active packet.  The packed must have been deferred with
290
   usb_defer_packet,  and not yet completed.  */
291
static inline void usb_cancel_packet(USBPacket * p)
292
{
293
    p->cancel_cb(p, p->cancel_opaque);
294
}
295

  
296 284
void usb_attach(USBPort *port, USBDevice *dev);
297 285
void usb_wakeup(USBDevice *dev);
298 286
int usb_generic_handle_packet(USBDevice *s, USBPacket *p);

Also available in: Unified diff