diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-12-21 01:10:29 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-12-21 01:10:29 +0000 |
commit | 664abdf0fcc8e3b16397014c5fa127a24b870bc5 (patch) | |
tree | 71b7ce44dbf2af0f8cd506aaa855bd3e4ecd276e /nuttx/drivers/usbhost/usbhost_storage.c | |
parent | 712c36e2070ad37dd4625e859209dc663976a5b2 (diff) | |
download | px4-nuttx-664abdf0fcc8e3b16397014c5fa127a24b870bc5.tar.gz px4-nuttx-664abdf0fcc8e3b16397014c5fa127a24b870bc5.tar.bz2 px4-nuttx-664abdf0fcc8e3b16397014c5fa127a24b870bc5.zip |
Final cleanup before testing
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3203 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/usbhost/usbhost_storage.c')
-rw-r--r-- | nuttx/drivers/usbhost/usbhost_storage.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/nuttx/drivers/usbhost/usbhost_storage.c b/nuttx/drivers/usbhost/usbhost_storage.c index 149a8a7af..f807da758 100644 --- a/nuttx/drivers/usbhost/usbhost_storage.c +++ b/nuttx/drivers/usbhost/usbhost_storage.c @@ -98,6 +98,7 @@ #define USBHOST_ALLFOUND 0x07 #define USBHOST_MAX_RETRIES 100 +#define USBHOST_MAX_CREFS 0x7fff /**************************************************************************** * Private Types @@ -1532,7 +1533,7 @@ static int usbhost_open(FAR struct inode *inode) { /* Otherwise, just increment the reference count on the driver */ - DEBUGASSERT(priv->crefs < MAX_CREFS); + DEBUGASSERT(priv->crefs > 0 && priv->crefs < USBHOST_MAX_CREFS); usbhost_takesem(&priv->exclsem); priv->crefs++; usbhost_givesem(&priv->exclsem); @@ -1559,7 +1560,7 @@ static int usbhost_close(FAR struct inode *inode) /* Decrement the reference count on the block driver */ - DEBUGASSERT(priv->crefs > 0); + DEBUGASSERT(priv->crefs > 1); usbhost_takesem(&priv->exclsem); priv->crefs--; @@ -1645,7 +1646,7 @@ static ssize_t usbhost_read(FAR struct inode *inode, unsigned char *buffer, if (result == OK) { /* Receive the user data */ -#warning "For lpc17xx, I think this buffer needs to lie in BANK1" + result = DRVR_TRANSFER(priv->drvr, &priv->bulkin, buffer, priv->blocksize * nsectors); if (result == OK) @@ -1737,7 +1738,7 @@ static ssize_t usbhost_write(FAR struct inode *inode, const unsigned char *buffe if (result == OK) { /* Send the user data */ -#warning "For lpc17xx, I think this buffer needs to lie in BANK1" + result = DRVR_TRANSFER(priv->drvr, &priv->bulkout, (uint8_t*)buffer, priv->blocksize * nsectors); if (result == OK) |