/* Flush all transmitted packets from BDs This routine is called when disabling the USB port to flush all transmissions that are allready scheduled in the BDs  */
void fhci_flush_all_transmissions(struct fhci_usb *usb)
/* Flush all transmitted packets from BDs This routine is called when disabling the USB port to flush all transmissions that are allready scheduled in the BDs  */
void fhci_flush_all_transmissions(struct fhci_usb *usb)
{
	u8 mode;
	struct td *td;
	mode = in_8(&usb->fhci->regs->usb_mod);
	clrbits8(&usb->fhci->regs->usb_mod, USB_MODE_EN);
	fhci_flush_bds(usb);
	while ((td = fhci_peek_td_from_frame(usb->actual_frame)) != NULL) {
		struct packet *pkt = td->pkt;
		pkt->status = USB_TD_TX_ER_TIMEOUT;
		fhci_transaction_confirm(usb, pkt);
	}
	usb->actual_frame->frame_status = FRAME_END_TRANSMISSION;
	out_be16(&usb->fhci->regs->usb_event, 0xffff);
	out_8(&usb->fhci->regs->usb_mod, mode | USB_MODE_EN);
}