Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
    lpc17:  Removed duplicate configuration variable definitions from Kconfig:  CONFIG_USBHOST_BULK_DISABLE, CONFIG_USBHOST_INT_DISABLE, and USBHOST_ISOC_DISABLE.  These are global USBHOST configurations and are all defined in drivers/usbhost/Kconfig.
    lpc17:  Correct scope of naming of configuration variables:  CONFIG_USBHOST_TDBUFFERS->CONFIG_LPC17_USBHOST_TDBUFFERS, CONFIG_USBHOST_TDBUFSIZE->CONFIG_LPC17_USBHOST_TDBUFSIZE, and CONFIG_USBHOST_IOBUFSIZE->CONFIG_LPC17_USBHOST_IOBUFSIZE
    lpc17:  Correct scope of naming of configuration variables:  CONFIG_USBHOST_NEDS->CONFIG_LPC17_USBHOST_NEDS and CONFIG_USBHOST_NTDS->CONFIG_LPC17_USBHOST_NTDS
    lpc17:  Correct scope of naming of configuration variable:  CONFIG_USBHOST_OHCIRAM_SIZE->CONFIG_LPC17_OHCIRAM_SIZE
  • Loading branch information
gregory-nutt committed Jul 1, 2018
1 parent e59b263 commit 824f1dd
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 187 deletions.
30 changes: 6 additions & 24 deletions arch/arm/src/lpc17xx/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -929,37 +929,37 @@ endmenu
menu "USB host driver options"
depends on LPC17_USBHOST

config USBHOST_OHCIRAM_SIZE
config LPC17_OHCIRAM_SIZE
int "OHCI RAM Size"
default 16384
---help---
Total size of OHCI RAM (in AHB SRAM Bank 1). Default: 16384

config USBHOST_NEDS
config LPC17_USBHOST_NEDS
int "Number of Endpoint Descriptors"
default 2
---help---
Number of endpoint descriptors. Default: 2

config USBHOST_NTDS
config LPC17_USBHOST_NTDS
int "Number of transfer descriptors"
default 3
---help---
Number of transfer descriptors. Default: 3

config USBHOST_TDBUFFERS
config LPC17_USBHOST_TDBUFFERS
int "Number of descriptor buffers"
default 2
---help---
Number of transfer descriptor buffers. Default: 2

config USBHOST_TDBUFSIZE
config LPC17_USBHOST_TDBUFSIZE
int "Descriptor buffer size"
default 128
---help---
Size of one transfer descriptor buffer. Default 128

config USBHOST_IOBUFSIZE
config LPC17_USBHOST_IOBUFSIZE
int "I/O buffer size"
default 512
---help---
Expand All @@ -975,24 +975,6 @@ config LPC17_USBHOST_NPREALLOC
concurrent data transfers. This number limits that number of concurrent
asynchronous IN endpoint transfer that can be supported.

config USBHOST_BULK_DISABLE
bool "Disable bulk EPs"
default n
---help---
Disable support for bulk endpoints.

config USBHOST_INT_DISABLE
bool "Disable interrupt EPs"
default n
---help---
Disable support for interrupt endpoints.

config USBHOST_ISOC_DISABLE
bool "Disable isochronous EPs"
default n
---help---
Disable support for isochronous endpoints.

config LPC17_USBHOST_REGDEBUG
bool "Register level debug"
depends on DEBUG_USB_INFO
Expand Down
62 changes: 31 additions & 31 deletions arch/arm/src/lpc17xx/lpc17_ohciram.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,23 @@
* bytes.
*/

#ifndef CONFIG_USBHOST_OHCIRAM_SIZE
# define CONFIG_USBHOST_OHCIRAM_SIZE LPC17_BANK1_SIZE
#ifndef CONFIG_LPC17_OHCIRAM_SIZE
# define CONFIG_LPC17_OHCIRAM_SIZE LPC17_BANK1_SIZE
#endif

#if CONFIG_USBHOST_OHCIRAM_SIZE > LPC17_BANK1_SIZE
#if CONFIG_LPC17_OHCIRAM_SIZE > LPC17_BANK1_SIZE
# error "OHCI RAM size cannot exceed the size of AHB SRAM Bank 1"
#endif

#if (CONFIG_USBHOST_OHCIRAM_SIZE & 0xff) != 0
#if (CONFIG_LPC17_OHCIRAM_SIZE & 0xff) != 0
# error "OHCI RAM size must be in multiples of 256 bytes"
#endif

/* Then position the OHCI RAM at the end of AHB SRAM Bank 1 */

#define LPC17_OHCIRAM_END (LPC17_SRAM_BANK1 + LPC17_BANK1_SIZE)
#define LPC17_OHCIRAM_BASE (LPC17_OHCIRAM_END - CONFIG_USBHOST_OHCIRAM_SIZE)
#define LPC17_OHCIRAM_SIZE CONFIG_USBHOST_OHCIRAM_SIZE
#define LPC17_OHCIRAM_BASE (LPC17_OHCIRAM_END - CONFIG_LPC17_OHCIRAM_SIZE)
#define LPC17_OHCIRAM_SIZE CONFIG_LPC17_OHCIRAM_SIZE

/* Determine is there is any meaningful space left at the beginning of AHB Bank 1
* that could be added to the heap.
Expand Down Expand Up @@ -124,13 +124,13 @@
* the control endpoint that is always allocated.
*/

#ifndef CONFIG_USBHOST_NEDS
# define CONFIG_USBHOST_NEDS 2
#ifndef CONFIG_LP17_USBHOST_NEDS
# define CONFIG_LP17_USBHOST_NEDS 2
#endif

/* Derived size of user endpoint descriptor (ED) memory. */

#define LPC17_EDFREE_SIZE (CONFIG_USBHOST_NEDS * LPC17_ED_SIZE)
#define LPC17_EDFREE_SIZE (CONFIG_LP17_USBHOST_NEDS * LPC17_ED_SIZE)

/* Fixed transfer descriptor size. The actual size required by the hardware is only
* 16 bytes, however, we set aside an additional 16 bytes for for internal use by
Expand All @@ -142,49 +142,49 @@

/* Configurable number of user transfer descriptors (TDs). */

#ifndef CONFIG_USBHOST_NTDS
# define CONFIG_USBHOST_NTDS 3
#ifndef CONFIG_LP17_USBHOST_NTDS
# define CONFIG_LP17_USBHOST_NTDS 3
#endif

#if CONFIG_USBHOST_NTDS < 2
#if CONFIG_LP17_USBHOST_NTDS < 2
# error "Insufficent TDs"
#endif

/* Derived size of user trasnfer descriptor (TD) memory. */

#define LPC17_TDFREE_SIZE (CONFIG_USBHOST_NTDS * LPC17_TD_SIZE)
#define LPC17_TDFREE_SIZE (CONFIG_LP17_USBHOST_NTDS * LPC17_TD_SIZE)

/* Configurable number of request/descriptor buffers (TDBUFFER) */

#ifndef CONFIG_USBHOST_TDBUFFERS
# define CONFIG_USBHOST_TDBUFFERS 2
#ifndef CONFIG_LPC17_USBHOST_TDBUFFERS
# define CONFIG_LPC17_USBHOST_TDBUFFERS 2
#endif

#if CONFIG_USBHOST_TDBUFFERS < 2
#if CONFIG_LPC17_USBHOST_TDBUFFERS < 2
# error "At least two TD buffers are required"
#endif

/* Configurable size of a TD buffer */

#if CONFIG_USBHOST_TDBUFFERS > 0 && !defined(CONFIG_USBHOST_TDBUFSIZE)
# define CONFIG_USBHOST_TDBUFSIZE 128
#if CONFIG_LPC17_USBHOST_TDBUFFERS > 0 && !defined(CONFIG_LPC17_USBHOST_TDBUFSIZE)
# define CONFIG_LPC17_USBHOST_TDBUFSIZE 128
#endif

#if (CONFIG_USBHOST_TDBUFSIZE & 3) != 0
#if (CONFIG_LPC17_USBHOST_TDBUFSIZE & 3) != 0
# error "TD buffer size must be an even number of 32-bit words"
#endif

#define LPC17_TBFREE_SIZE (CONFIG_USBHOST_TDBUFFERS * CONFIG_USBHOST_TDBUFSIZE)
#define LPC17_TBFREE_SIZE (CONFIG_LPC17_USBHOST_TDBUFFERS * CONFIG_LPC17_USBHOST_TDBUFSIZE)

/* Configurable size of an IO buffer. The number of IO buffers will be determined
* by what is left at the end of the BANK1 memory setup aside of OHCI RAM.
*/

#ifndef CONFIG_USBHOST_IOBUFSIZE
# define CONFIG_USBHOST_IOBUFSIZE 512
#ifndef CONFIG_LPC17_USBHOST_IOBUFSIZE
# define CONFIG_LPC17_USBHOST_IOBUFSIZE 512
#endif

#if (CONFIG_USBHOST_IOBUFSIZE & 3) != 0
#if (CONFIG_LPC17_USBHOST_IOBUFSIZE & 3) != 0
# error "IO buffer size must be an even number of 32-bit words"
#endif

Expand All @@ -195,12 +195,12 @@
* LPC17_BANK1_SIZE 16384
*
* Configuration:
* CONFIG_USBHOST_OHCIRAM_SIZE 1536
* CONFIG_USBHOST_NEDS 2
* CONFIG_USBHOST_NTDS 3
* CONFIG_USBHOST_TDBUFFERS 3
* CONFIG_USBHOST_TDBUFSIZE 128
* CONFIG_USBHOST_IOBUFSIZE 512
* CONFIG_LPC17_OHCIRAM_SIZE 1536
* CONFIG_LP17_USBHOST_NEDS 2
* CONFIG_LP17_USBHOST_NTDS 3
* CONFIG_LPC17_USBHOST_TDBUFFERS 3
* CONFIG_LPC17_USBHOST_TDBUFSIZE 128
* CONFIG_LPC17_USBHOST_IOBUFSIZE 512
*
* Sizes of things
* LPC17_EDFREE_SIZE 64 0x00000040
Expand Down Expand Up @@ -241,8 +241,8 @@

/* Finally, use the remainder of the allocated OHCI for IO buffers */

#if CONFIG_USBHOST_IOBUFSIZE > 0
# define LPC17_IOBUFFERS ((LPC17_OHCIRAM_END - LPC17_IOFREE_BASE) / CONFIG_USBHOST_IOBUFSIZE)
#if CONFIG_LPC17_USBHOST_IOBUFSIZE > 0
# define LPC17_IOBUFFERS ((LPC17_OHCIRAM_END - LPC17_IOFREE_BASE) / CONFIG_LPC17_USBHOST_IOBUFSIZE)
#else
# define LPC17_IOBUFFERS 0
#endif
Expand Down
22 changes: 11 additions & 11 deletions arch/arm/src/lpc17xx/lpc17_usbhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -1812,7 +1812,7 @@ static int lpc17_usbinterrupt(int irq, void *context, FAR void *arg)
*/

if ((uintptr_t)td < LPC17_TDFREE_BASE ||
(uintptr_t)td >= (LPC17_TDFREE_BASE + LPC17_TD_SIZE*CONFIG_USBHOST_NTDS))
(uintptr_t)td >= (LPC17_TDFREE_BASE + LPC17_TD_SIZE*CONFIG_LP17_USBHOST_NTDS))
{
break;
}
Expand Down Expand Up @@ -2446,7 +2446,7 @@ static int lpc17_alloc(struct usbhost_driver_s *drvr,
*buffer = lpc17_tballoc();
if (*buffer)
{
*maxlen = CONFIG_USBHOST_TDBUFSIZE;
*maxlen = CONFIG_LPC17_USBHOST_TDBUFSIZE;
ret = OK;
}

Expand Down Expand Up @@ -2523,7 +2523,7 @@ static int lpc17_ioalloc(struct usbhost_driver_s *drvr,
DEBUGASSERT(drvr && buffer);

#if LPC17_IOBUFFERS > 0
if (buflen <= CONFIG_USBHOST_IOBUFSIZE)
if (buflen <= CONFIG_LPC17_USBHOST_IOBUFSIZE)
{
uint8_t *alloc = lpc17_allocio();
if (alloc)
Expand Down Expand Up @@ -2801,10 +2801,10 @@ static int lpc17_dma_alloc(struct lpc17_usbhost_s *priv,
{
/* Will the transfer fit in an IO buffer? */

if (buflen > CONFIG_USBHOST_IOBUFSIZE)
if (buflen > CONFIG_LPC17_USBHOST_IOBUFSIZE)
{
uinfo("buflen (%d) > IO buffer size (%d)\n",
buflen, CONFIG_USBHOST_IOBUFSIZE);
buflen, CONFIG_LPC17_USBHOST_IOBUFSIZE);
return -ENOMEM;
}

Expand Down Expand Up @@ -3728,7 +3728,7 @@ struct usbhost_connection_s *lpc17_usbhost_initialize(int controller)
uinfo(" EDFREE: %08x %d\n", LPC17_EDFREE_BASE, LPC17_ED_SIZE);
uinfo(" TDFREE: %08x %d\n", LPC17_TDFREE_BASE, LPC17_EDFREE_SIZE);
uinfo(" TBFREE: %08x %d\n", LPC17_TBFREE_BASE, LPC17_TBFREE_SIZE);
uinfo(" IOFREE: %08x %d\n", LPC17_IOFREE_BASE, LPC17_IOBUFFERS * CONFIG_USBHOST_IOBUFSIZE);
uinfo(" IOFREE: %08x %d\n", LPC17_IOFREE_BASE, LPC17_IOBUFFERS * CONFIG_LPC17_USBHOST_IOBUFSIZE);
#endif

/* Initialize all the TDs, EDs and HCCA to 0 */
Expand All @@ -3747,7 +3747,7 @@ struct usbhost_connection_s *lpc17_usbhost_initialize(int controller)
/* Initialize user-configurable EDs */

buffer = (uint8_t *)LPC17_EDFREE_BASE;
for (i = 0; i < CONFIG_USBHOST_NEDS; i++)
for (i = 0; i < CONFIG_LP17_USBHOST_NEDS; i++)
{
/* Put the ED in a free list */

Expand All @@ -3758,7 +3758,7 @@ struct usbhost_connection_s *lpc17_usbhost_initialize(int controller)
/* Initialize user-configurable TDs */

buffer = (uint8_t *)LPC17_TDFREE_BASE;
for (i = 0; i < CONFIG_USBHOST_NTDS; i++)
for (i = 0; i < CONFIG_LP17_USBHOST_NTDS; i++)
{
/* Put the TD in a free list */

Expand All @@ -3769,12 +3769,12 @@ struct usbhost_connection_s *lpc17_usbhost_initialize(int controller)
/* Initialize user-configurable request/descriptor transfer buffers */

buffer = (uint8_t *)LPC17_TBFREE_BASE;
for (i = 0; i < CONFIG_USBHOST_TDBUFFERS; i++)
for (i = 0; i < CONFIG_LPC17_USBHOST_TDBUFFERS; i++)
{
/* Put the TD buffer in a free list */

lpc17_tbfree(buffer);
buffer += CONFIG_USBHOST_TDBUFSIZE;
buffer += CONFIG_LPC17_USBHOST_TDBUFSIZE;
}

#if LPC17_IOBUFFERS > 0
Expand All @@ -3786,7 +3786,7 @@ struct usbhost_connection_s *lpc17_usbhost_initialize(int controller)
/* Put the IO buffer in a free list */

lpc17_freeio(buffer);
buffer += CONFIG_USBHOST_IOBUFSIZE;
buffer += CONFIG_LPC17_USBHOST_IOBUFSIZE;
}
#endif

Expand Down
17 changes: 0 additions & 17 deletions configs/bambino-200e/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -340,23 +340,6 @@ Bambino-200e Configuration Options
CONFIG_LPC43_USBDEV_NOLED
Define if the hardware implementation does not support the LED output

LPC43xx USB Host Configuration

CONFIG_USBHOST_OHCIRAM_SIZE
Total size of OHCI RAM (in AHB SRAM Bank 1)
CONFIG_USBHOST_NEDS
Number of endpoint descriptors
CONFIG_USBHOST_NTDS
Number of transfer descriptors
CONFIG_USBHOST_TDBUFFERS
Number of transfer descriptor buffers
CONFIG_USBHOST_TDBUFSIZE
Size of one transfer descriptor buffer
CONFIG_USBHOST_IOBUFSIZE
Size of one end-user I/O buffer. This can be zero if the
application can guarantee that all end-user I/O buffers
reside in AHB SRAM.

Configurations
==============

Expand Down
12 changes: 6 additions & 6 deletions configs/lincoln60/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,17 @@ Lincoln 60 Configuration Options

LPC17xx USB Host Configuration

CONFIG_USBHOST_OHCIRAM_SIZE
CONFIG_LPC17_OHCIRAM_SIZE
Total size of OHCI RAM (in AHB SRAM Bank 1)
CONFIG_USBHOST_NEDS
CONFIG_LP17_USBHOST_NEDS
Number of endpoint descriptors
CONFIG_USBHOST_NTDS
CONFIG_LP17_USBHOST_NTDS
Number of transfer descriptors
CONFIG_USBHOST_TDBUFFERS
CONFIG_LPC17_USBHOST_TDBUFFERS
Number of transfer descriptor buffers
CONFIG_USBHOST_TDBUFSIZE
CONFIG_LPC17_USBHOST_TDBUFSIZE
Size of one transfer descriptor buffer
CONFIG_USBHOST_IOBUFSIZE
CONFIG_LPC17_USBHOST_IOBUFSIZE
Size of one end-user I/O buffer. This can be zero if the
application can guarantee that all end-user I/O buffers
reside in AHB SRAM.
Expand Down
17 changes: 0 additions & 17 deletions configs/lpc4330-xplorer/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -592,23 +592,6 @@ LPC4330-Xplorer Configuration Options
CONFIG_LPC43_USBDEV_NOLED
Define if the hardware implementation does not support the LED output

LPC43xx USB Host Configuration

CONFIG_USBHOST_OHCIRAM_SIZE
Total size of OHCI RAM (in AHB SRAM Bank 1)
CONFIG_USBHOST_NEDS
Number of endpoint descriptors
CONFIG_USBHOST_NTDS
Number of transfer descriptors
CONFIG_USBHOST_TDBUFFERS
Number of transfer descriptor buffers
CONFIG_USBHOST_TDBUFSIZE
Size of one transfer descriptor buffer
CONFIG_USBHOST_IOBUFSIZE
Size of one end-user I/O buffer. This can be zero if the
application can guarantee that all end-user I/O buffers
reside in AHB SRAM.

Configurations
==============

Expand Down
17 changes: 0 additions & 17 deletions configs/lpc4337-ws/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -631,23 +631,6 @@ LPC4337-ws Configuration Options
CONFIG_LPC43_USBDEV_NOLED
Define if the hardware implementation does not support the LED output

LPC43xx USB Host Configuration

CONFIG_USBHOST_OHCIRAM_SIZE
Total size of OHCI RAM (in AHB SRAM Bank 1)
CONFIG_USBHOST_NEDS
Number of endpoint descriptors
CONFIG_USBHOST_NTDS
Number of transfer descriptors
CONFIG_USBHOST_TDBUFFERS
Number of transfer descriptor buffers
CONFIG_USBHOST_TDBUFSIZE
Size of one transfer descriptor buffer
CONFIG_USBHOST_IOBUFSIZE
Size of one end-user I/O buffer. This can be zero if the
application can guarantee that all end-user I/O buffers
reside in AHB SRAM.

Configurations
==============

Expand Down
Loading

0 comments on commit 824f1dd

Please sign in to comment.