From 4ba5fc781b54a01a7f08486e2f5d757906383167 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 21 Dec 2010 12:13:16 +0000 Subject: [PATCH] Need to init IO buffer free list git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3210 42af7a65-404d-4744-a932-0658087f49c3 --- arch/arm/src/lpc17xx/lpc17_usbhost.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/arch/arm/src/lpc17xx/lpc17_usbhost.c b/arch/arm/src/lpc17xx/lpc17_usbhost.c index 6e47753c6c..ed79e4e3cf 100755 --- a/arch/arm/src/lpc17xx/lpc17_usbhost.c +++ b/arch/arm/src/lpc17xx/lpc17_usbhost.c @@ -115,6 +115,7 @@ #define EDFREE ((struct lpc17_hced_s *)LPC17_EDFREE_BASE) #define TDFREE ((uint8_t *)LPC17_TDFREE_BASE) +#define IOFREE ((uint8_t *)LPC17_IOFREE_BASE) /* Descriptors *****************************************************************/ @@ -1575,7 +1576,7 @@ FAR struct usbhost_driver_s *usbhost_initialize(int controller) { struct lpc17_usbhost_s *priv = &g_usbhost; uint32_t regval; - uint8_t *tdfree; + uint8_t *buffer; irqstate_t flags; int i; @@ -1641,15 +1642,28 @@ FAR struct usbhost_driver_s *usbhost_initialize(int controller) /* Initialize user-configurable TD buffers */ - tdfree = TDFREE; + buffer = TDFREE; for (i = 0; i < CONFIG_USBHOST_NEDS; i++) { /* Put the TD buffer in a free list */ - lpc17_tdfree(priv, tdfree); - tdfree += CONFIG_USBHOST_TDBUFSIZE; + lpc17_tdfree(priv, buffer); + buffer += CONFIG_USBHOST_TDBUFSIZE; } +#ifdef CONFIG_UBHOST_AHBIOBUFFERS + /* Initialize user-configurable IO buffers */ + + buffer = IOFREE; + for (i = 0; i < LPC17_IOBUFFERS; i++) + { + /* Put the TD buffer in a free list */ + + lpc17_iofree(priv, buffer); + buffer += CONFIG_USBHOST_IOBUFSIZE; + } +#endif + /* Wait 50MS then perform hardware reset */ up_mdelay(50);