mirror of
https://github.com/gdsports/USBHost_t36
synced 2024-11-30 20:52:15 -05:00
Free transfers and pipe when deleting from periodic schedule
This commit is contained in:
parent
fe5cf3e4cd
commit
430e24ba54
46
ehci.cpp
46
ehci.cpp
@ -907,7 +907,6 @@ void USBHost::add_qh_to_periodic_schedule(Pipe_t *pipe)
|
|||||||
|
|
||||||
void USBHost::delete_Pipe(Pipe_t *pipe)
|
void USBHost::delete_Pipe(Pipe_t *pipe)
|
||||||
{
|
{
|
||||||
// TODO: a *LOT* of work here.....
|
|
||||||
println("delete_Pipe ", (uint32_t)pipe, HEX);
|
println("delete_Pipe ", (uint32_t)pipe, HEX);
|
||||||
|
|
||||||
// halt pipe, find and free all Transfer_t
|
// halt pipe, find and free all Transfer_t
|
||||||
@ -967,17 +966,6 @@ void USBHost::delete_Pipe(Pipe_t *pipe)
|
|||||||
}
|
}
|
||||||
t = next;
|
t = next;
|
||||||
}
|
}
|
||||||
// TODO: do we need to look at pipe->qh.current ??
|
|
||||||
//
|
|
||||||
// free all the transfers still attached to the QH
|
|
||||||
t = (Transfer_t *)(pipe->qh.next);
|
|
||||||
while ((uint32_t)t & 0xFFFFFFE0) {
|
|
||||||
Transfer_t *next = (Transfer_t *)(t->qtd.next);
|
|
||||||
free_Transfer(t);
|
|
||||||
t = next;
|
|
||||||
}
|
|
||||||
// hopefully we found everything...
|
|
||||||
free_Pipe(pipe);
|
|
||||||
} else {
|
} else {
|
||||||
// remove from the periodic schedule
|
// remove from the periodic schedule
|
||||||
for (uint32_t i=0; i < PERIODIC_LIST_SIZE; i++) {
|
for (uint32_t i=0; i < PERIODIC_LIST_SIZE; i++) {
|
||||||
@ -1000,17 +988,31 @@ void USBHost::delete_Pipe(Pipe_t *pipe)
|
|||||||
prev = node;
|
prev = node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: find & free all the transfers which completed
|
// TODO: subtract bandwidth from uframe_bandwidth array
|
||||||
// TODO: do we need to look at pipe->qh.current ??
|
|
||||||
// TODO: free all the transfers still attached to the QH
|
// find & free all the transfers which completed
|
||||||
// TODO: free_Pipe(pipe);
|
Transfer_t *t = periodic_followup_first;
|
||||||
return;
|
while (t) {
|
||||||
|
Transfer_t *next = t->next_followup;
|
||||||
|
if (t->pipe == pipe) {
|
||||||
|
remove_from_periodic_followup_list(t);
|
||||||
|
free_Transfer(t);
|
||||||
}
|
}
|
||||||
|
t = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
// can't free the pipe until the ECHI and all qTD referencing are done
|
//
|
||||||
// free_Pipe(pipe);
|
// TODO: do we need to look at pipe->qh.current ??
|
||||||
|
//
|
||||||
|
// free all the transfers still attached to the QH
|
||||||
|
Transfer_t *tr = (Transfer_t *)(pipe->qh.next);
|
||||||
|
while ((uint32_t)tr & 0xFFFFFFE0) {
|
||||||
|
Transfer_t *next = (Transfer_t *)(tr->qtd.next);
|
||||||
|
free_Transfer(tr);
|
||||||
|
tr = next;
|
||||||
|
}
|
||||||
|
// hopefully we found everything...
|
||||||
|
free_Pipe(pipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user