summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-12-21 12:05:25 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-12-21 12:05:25 +0000
commitec31cad010f368e728491ade3315e2778dbf3bae (patch)
treebad522b54bf4c7ddc7d0987b34527214bec5af35
parentab9b589790ef288009ca0b6c16f8a341e42b1c30 (diff)
downloadnuttx-ec31cad010f368e728491ade3315e2778dbf3bae.tar.gz
nuttx-ec31cad010f368e728491ade3315e2778dbf3bae.tar.bz2
nuttx-ec31cad010f368e728491ade3315e2778dbf3bae.zip
Add some range checking
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3209 42af7a65-404d-4744-a932-0658087f49c3
-rwxr-xr-xnuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h b/nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h
index eb159785d..477a57a2b 100755
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h
@@ -209,9 +209,17 @@
#define LPC17_TDFREE_BASE (LPC17_EDFREE_BASE + LPC17_EDFREE_SIZE)
#define LPC17_IOFREE_BASE (LPC17_TDFREE_BASE + LPC17_TDFREE_SIZE)
+#if LPC17_IOFREE_BASE > LPC17_OHCIRAM_END
+# error "Insufficient OHCI RAM allocated"
+#endif
+
/* Finally, use the remainder of the allocated OHCI for IO buffers */
-#define LPC17_IOBUFFERS ((LPC17_OHCIRAM_END - LPC17_IOBUFFER_BASE) / CONFIG_USBHOST_IOBUFSIZE)
+#define LPC17_IOBUFFERS ((LPC17_OHCIRAM_END - LPC17_IOFREE_BASE) / CONFIG_USBHOST_IOBUFSIZE)
+
+#if LPC17_IOBUFFERS < 1
+# warning "No IO buffers allocated"
+#endif
/************************************************************************************
* Public Types