diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-03-18 20:39:18 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-03-18 20:39:18 +0000 |
commit | d1aa52f99c7510c1f515a4cac81bf4fac3083c83 (patch) | |
tree | 7fcf92024b569edcf9b161076c787631b0805928 /nuttx/drivers/usbdev | |
parent | d1f32b1902a26052536f15e9f446dec1dc0f0cb8 (diff) | |
download | px4-nuttx-d1aa52f99c7510c1f515a4cac81bf4fac3083c83.tar.gz px4-nuttx-d1aa52f99c7510c1f515a4cac81bf4fac3083c83.tar.bz2 px4-nuttx-d1aa52f99c7510c1f515a4cac81bf4fac3083c83.zip |
The PIC32 USB driver (finally) works the the Mass Storage Class
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4496 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/usbdev')
-rw-r--r-- | nuttx/drivers/usbdev/usbmsc_scsi.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/nuttx/drivers/usbdev/usbmsc_scsi.c b/nuttx/drivers/usbdev/usbmsc_scsi.c index 54fc22795..fa443497f 100644 --- a/nuttx/drivers/usbdev/usbmsc_scsi.c +++ b/nuttx/drivers/usbdev/usbmsc_scsi.c @@ -2172,25 +2172,25 @@ static int usbmsc_cmdwritestate(FAR struct usbmsc_dev_s *priv) * to the block driver OR all of the request data has been transferred. */ - while (priv->nreqbytes > 0 && priv->u.xfrlen > 0) - { - /* Copy the data received in the read request into the sector I/O buffer */ + while (priv->nreqbytes > 0 && priv->u.xfrlen > 0) + { + /* Copy the data received in the read request into the sector I/O buffer */ - src = &req->buf[xfrd - priv->nreqbytes]; - dest = &priv->iobuffer[priv->nsectbytes]; + src = &req->buf[xfrd - priv->nreqbytes]; + dest = &priv->iobuffer[priv->nsectbytes]; - nbytes = MIN(lun->sectorsize - priv->nsectbytes, priv->nreqbytes); + nbytes = MIN(lun->sectorsize - priv->nsectbytes, priv->nreqbytes); - /* Copy the data from the sector buffer to the USB request and update counts */ + /* Copy the data from the sector buffer to the USB request and update counts */ - memcpy(dest, src, nbytes); - priv->nsectbytes += nbytes; - priv->nreqbytes -= nbytes; + memcpy(dest, src, nbytes); + priv->nsectbytes += nbytes; + priv->nreqbytes -= nbytes; - /* Is the I/O buffer full? */ + /* Is the I/O buffer full? */ - if (priv->nsectbytes >= lun->sectorsize) - { + if (priv->nsectbytes >= lun->sectorsize) + { /* Yes.. Write the next sector */ nwritten = USBMSC_DRVR_WRITE(lun, priv->iobuffer, priv->sector, 1); @@ -2202,17 +2202,17 @@ static int usbmsc_cmdwritestate(FAR struct usbmsc_dev_s *priv) goto errout; } - priv->nsectbytes = 0; - priv->residue -= lun->sectorsize; - priv->u.xfrlen--; - priv->sector++; - } - } + priv->nsectbytes = 0; + priv->residue -= lun->sectorsize; + priv->u.xfrlen--; + priv->sector++; + } + } - /* In either case, we are finished with this read request and can return it - * to the endpoint. Then we will go back to the top of the top and attempt - * to get the next read request. - */ + /* In either case, we are finished with this read request and can return it + * to the endpoint. Then we will go back to the top of the top and attempt + * to get the next read request. + */ req->len = CONFIG_USBMSC_BULKOUTREQLEN; req->priv = privreq; |