1/* 2 * Copyright (c) 2007-2013 ETH Zurich. 3 * All rights reserved. 4 * 5 * This file is distributed under the terms in the attached LICENSE file. 6 * If you do not find this file, copies can be found by writing to: 7 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. 8 */ 9 10#include <stdlib.h> 11#include <stdio.h> 12#include <barrelfish/barrelfish.h> 13 14#include "usb_ohci.h" 15#include "usb_ohci_queue.h" 16 17 18 19 20 21 22usb_ohci_ed_t *usb_ohci_remove_qh(usb_ohci_ed_t *ed, usb_ohci_ed_t *last) 23{ 24 if (ed->prev) { 25 ed->prev->next = ed->next; 26 ed->prev->ed_nextED = ed->ed_nextED; 27 28 // TODO: needs page cache flush ed->prev->page_cache 29 if (ed->next) { 30 ed->next->prev = ed->prev; 31 } 32 33 if (last == ed) { 34 last = ed->prev; 35 // TODO: needs page cache flush ed->next->page_cache 36 } 37 38 ed->prev = 0; 39 40 // TODO: needs page cache flush ed->page_cache 41 } 42 43 return last; 44} 45 46usb_ohci_ed_t *usb_ohci_append_qh(usb_ohci_ed_t *ed, usb_ohci_ed_t *last) 47{ 48 // check if the ED is not already linked 49 if (ed->prev != NULL) { 50 return last; 51 } 52 53 ed->next = last->next; 54 ed->ed_nextED = last->ed_nextED; 55 ed->ed_tailP = 0; 56 57 ed->prev = last; 58 59 // todo needs flush: ed->page_cache 60 61 last->next = ed; 62 last->ed_nextED = ed->ed_self; 63 64 // todo needs flush: last->page_cache 65 66 return ed; 67} 68