LPC17 OHCI: Fix an error in ED list removal
This commit is contained in:
parent
6d41087491
commit
08a4ae6b64
@ -888,18 +888,19 @@ static inline int lpc17_remctrled(struct lpc17_usbhost_s *priv,
|
|||||||
{
|
{
|
||||||
struct lpc17_ed_s *curr;
|
struct lpc17_ed_s *curr;
|
||||||
struct lpc17_ed_s *prev;
|
struct lpc17_ed_s *prev;
|
||||||
|
struct lpc17_ed_s *head;
|
||||||
uint32_t regval;
|
uint32_t regval;
|
||||||
|
|
||||||
/* Find the ED in the control list. NOTE: We really should never be mucking
|
/* Find the ED in the control list. NOTE: We really should never be mucking
|
||||||
* with the control list while CLE is set.
|
* with the control list while CLE is set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (curr = (struct lpc17_ed_s *)lpc17_getreg(LPC17_USBHOST_CTRLHEADED),
|
head = (struct lpc17_ed_s *)lpc17_getreg(LPC17_USBHOST_CTRLHEADED);
|
||||||
prev = NULL;
|
for (prev = NULL, curr = head;
|
||||||
curr && curr != ed;
|
curr && curr != ed;
|
||||||
prev = curr, curr = (struct lpc17_ed_s *)curr->hw.nexted);
|
prev = curr, curr = (struct lpc17_ed_s *)curr->hw.nexted);
|
||||||
|
|
||||||
/* Hmmm.. It would be a bug if we do not find the ED in the control list. */
|
/* It would be a bug if we do not find the ED in the control list. */
|
||||||
|
|
||||||
DEBUGASSERT(curr != NULL);
|
DEBUGASSERT(curr != NULL);
|
||||||
|
|
||||||
@ -913,16 +914,20 @@ static inline int lpc17_remctrled(struct lpc17_usbhost_s *priv,
|
|||||||
{
|
{
|
||||||
/* Yes... set the head of the control list to skip over this ED */
|
/* Yes... set the head of the control list to skip over this ED */
|
||||||
|
|
||||||
lpc17_putreg(ed->hw.nexted, LPC17_USBHOST_CTRLHEADED);
|
head = (struct lpc17_ed_s *)ed->hw.nexted;
|
||||||
|
lpc17_putreg((uint32_t)head, LPC17_USBHOST_CTRLHEADED);
|
||||||
|
|
||||||
/* If the control list is now empty, then disable it.
|
/* If the control list is now empty, then disable it.
|
||||||
* This should never happen!
|
* This should never happen!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (head == NULL)
|
||||||
|
{
|
||||||
regval = lpc17_getreg(LPC17_USBHOST_CTRL);
|
regval = lpc17_getreg(LPC17_USBHOST_CTRL);
|
||||||
regval &= ~OHCI_CTRL_CLE;
|
regval &= ~OHCI_CTRL_CLE;
|
||||||
lpc17_putreg(regval, LPC17_USBHOST_CTRL);
|
lpc17_putreg(regval, LPC17_USBHOST_CTRL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* No.. set the forward link of the previous ED in the list
|
/* No.. set the forward link of the previous ED in the list
|
||||||
@ -989,14 +994,15 @@ static inline int lpc17_rembulked(struct lpc17_usbhost_s *priv,
|
|||||||
#ifndef CONFIG_USBHOST_BULK_DISABLE
|
#ifndef CONFIG_USBHOST_BULK_DISABLE
|
||||||
struct lpc17_ed_s *curr;
|
struct lpc17_ed_s *curr;
|
||||||
struct lpc17_ed_s *prev;
|
struct lpc17_ed_s *prev;
|
||||||
|
struct lpc17_ed_s *head;
|
||||||
uint32_t regval;
|
uint32_t regval;
|
||||||
|
|
||||||
/* Find the ED in the bulk list. NOTE: We really should never be mucking
|
/* Find the ED in the bulk list. NOTE: We really should never be mucking
|
||||||
* with the bulk list while BLE is set.
|
* with the bulk list while BLE is set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (curr = (struct lpc17_ed_s *)lpc17_getreg(LPC17_USBHOST_BULKHEADED),
|
head = (struct lpc17_ed_s *)lpc17_getreg(LPC17_USBHOST_BULKHEADED)
|
||||||
prev = NULL;
|
for (prev = NULL, curr = head;
|
||||||
curr && curr != ed;
|
curr && curr != ed;
|
||||||
prev = curr, curr = (struct lpc17_ed_s *)curr->hw.nexted);
|
prev = curr, curr = (struct lpc17_ed_s *)curr->hw.nexted);
|
||||||
|
|
||||||
@ -1014,14 +1020,18 @@ static inline int lpc17_rembulked(struct lpc17_usbhost_s *priv,
|
|||||||
{
|
{
|
||||||
/* Yes... set the head of the bulk list to skip over this ED */
|
/* Yes... set the head of the bulk list to skip over this ED */
|
||||||
|
|
||||||
lpc17_putreg(ed->hw.nexted, LPC17_USBHOST_BULKHEADED);
|
head = (struct lpc17_ed_s *)ed->hw.nexted;
|
||||||
|
lpc17_putreg((uint32_t)head, LPC17_USBHOST_BULKHEADED);
|
||||||
|
|
||||||
/* If the bulk list is now empty, then disable it */
|
/* If the bulk list is now empty, then disable it */
|
||||||
|
|
||||||
|
if (head == NULL);
|
||||||
|
{
|
||||||
regval = lpc17_getreg(LPC17_USBHOST_CTRL);
|
regval = lpc17_getreg(LPC17_USBHOST_CTRL);
|
||||||
regval &= ~OHCI_CTRL_BLE;
|
regval &= ~OHCI_CTRL_BLE;
|
||||||
lpc17_putreg(regval, LPC17_USBHOST_CTRL);
|
lpc17_putreg(regval, LPC17_USBHOST_CTRL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* No.. set the forward link of the previous ED in the list
|
/* No.. set the forward link of the previous ED in the list
|
||||||
@ -1297,6 +1307,7 @@ static inline int lpc17_reminted(struct lpc17_usbhost_s *priv,
|
|||||||
|
|
||||||
prev->hw.nexted = ed->hw.nexted;
|
prev->hw.nexted = ed->hw.nexted;
|
||||||
}
|
}
|
||||||
|
|
||||||
uvdbg("ed: %08x head: %08x next: %08x\n",
|
uvdbg("ed: %08x head: %08x next: %08x\n",
|
||||||
ed, head, head ? head->hw.nexted : 0);
|
ed, head, head ? head->hw.nexted : 0);
|
||||||
|
|
||||||
@ -1310,6 +1321,7 @@ static inline int lpc17_reminted(struct lpc17_usbhost_s *priv,
|
|||||||
interval = curr->interval;
|
interval = curr->interval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uvdbg("min interval: %d offset: %d\n", interval, offset);
|
uvdbg("min interval: %d offset: %d\n", interval, offset);
|
||||||
|
|
||||||
/* Save the new minimum interval */
|
/* Save the new minimum interval */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user