2008-10-25 00:42:28 +02:00
|
|
|
/****************************************************************************
|
2012-01-26 15:24:15 +01:00
|
|
|
* drivers/usbdev/usbmsc.h
|
2008-10-25 00:42:28 +02:00
|
|
|
*
|
2020-04-01 18:13:52 +02:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2008-10-25 00:42:28 +02:00
|
|
|
*
|
2020-04-01 18:13:52 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2008-10-25 00:42:28 +02:00
|
|
|
*
|
2020-04-01 18:13:52 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2008-10-25 00:42:28 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-03-04 07:10:42 +01:00
|
|
|
/* Mass storage class device. Bulk-only with SCSI subclass. */
|
|
|
|
|
2012-01-26 15:24:15 +01:00
|
|
|
#ifndef __DRIVERS_USBDEV_USBMSC_H
|
|
|
|
#define __DRIVERS_USBDEV_USBMSC_H
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
2023-02-01 14:41:12 +01:00
|
|
|
#include <sys/param.h>
|
2009-12-15 15:25:14 +01:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2012-03-21 19:01:07 +01:00
|
|
|
#include <nuttx/fs/fs.h>
|
2022-09-25 17:08:38 +02:00
|
|
|
#include <nuttx/queue.h>
|
2022-09-06 08:18:45 +02:00
|
|
|
#include <nuttx/mutex.h>
|
2020-02-01 08:17:32 +01:00
|
|
|
#include <nuttx/semaphore.h>
|
2011-01-12 03:12:41 +01:00
|
|
|
#include <nuttx/usb/storage.h>
|
2010-12-14 04:33:39 +01:00
|
|
|
#include <nuttx/usb/usbdev.h>
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2012-01-24 22:51:26 +01:00
|
|
|
* Pre-processor Definitions
|
2008-10-25 00:42:28 +02:00
|
|
|
****************************************************************************/
|
2017-07-16 16:43:17 +02:00
|
|
|
|
2008-10-25 00:42:28 +02:00
|
|
|
/* Configuration ************************************************************/
|
2020-01-10 16:06:36 +01:00
|
|
|
|
2012-01-24 22:51:26 +01:00
|
|
|
/* If the USB mass storage device is configured as part of a composite device
|
2012-01-25 21:17:59 +01:00
|
|
|
* then both CONFIG_USBDEV_COMPOSITE and CONFIG_USBMSC_COMPOSITE must be
|
2012-01-24 22:51:26 +01:00
|
|
|
* defined.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CONFIG_USBDEV_COMPOSITE
|
2012-01-25 21:17:59 +01:00
|
|
|
# undef CONFIG_USBMSC_COMPOSITE
|
2012-01-24 22:51:26 +01:00
|
|
|
#endif
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#if defined(CONFIG_USBMSC_COMPOSITE) && !defined(CONFIG_USBMSC_STRBASE)
|
2020-01-10 16:06:36 +01:00
|
|
|
# define CONFIG_USBMSC_STRBASE (0)
|
2012-01-24 22:51:26 +01:00
|
|
|
#endif
|
|
|
|
|
2014-04-13 22:32:20 +02:00
|
|
|
/* Interface IDs. If the mass storage driver is built as a component of a
|
2012-01-25 20:27:20 +01:00
|
|
|
* composite device, then the interface IDs may need to be offset.
|
|
|
|
*/
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#ifndef CONFIG_USBMSC_COMPOSITE
|
|
|
|
# undef CONFIG_USBMSC_IFNOBASE
|
|
|
|
# define CONFIG_USBMSC_IFNOBASE 0
|
2012-01-25 20:27:20 +01:00
|
|
|
#endif
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#ifndef CONFIG_USBMSC_IFNOBASE
|
|
|
|
# define CONFIG_USBMSC_IFNOBASE 0
|
2012-01-25 20:27:20 +01:00
|
|
|
#endif
|
|
|
|
|
2008-10-25 00:42:28 +02:00
|
|
|
/* Number of requests in the write queue */
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#ifndef CONFIG_USBMSC_NWRREQS
|
|
|
|
# define CONFIG_USBMSC_NWRREQS 4
|
2008-10-25 00:42:28 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Number of requests in the read queue */
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#ifndef CONFIG_USBMSC_NRDREQS
|
|
|
|
# define CONFIG_USBMSC_NRDREQS 4
|
2008-10-25 00:42:28 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Logical endpoint numbers / max packet sizes */
|
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
#ifndef CONFIG_USBMSC_COMPOSITE
|
|
|
|
# ifndef CONFIG_USBMSC_EPBULKOUT
|
|
|
|
# warning "EPBULKOUT not defined in the configuration"
|
|
|
|
# define CONFIG_USBMSC_EPBULKOUT 2
|
|
|
|
# endif
|
2008-10-25 00:42:28 +02:00
|
|
|
#endif
|
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
#ifndef CONFIG_USBMSC_COMPOSITE
|
|
|
|
# ifndef CONFIG_USBMSC_EPBULKIN
|
|
|
|
# warning "EPBULKIN not defined in the configuration"
|
|
|
|
# define CONFIG_USBMSC_EPBULKIN 3
|
|
|
|
# endif
|
2008-10-25 00:42:28 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Packet and request buffer sizes */
|
|
|
|
|
2012-01-26 00:04:17 +01:00
|
|
|
#ifndef CONFIG_USBMSC_COMPOSITE
|
2012-01-25 21:17:59 +01:00
|
|
|
# ifndef CONFIG_USBMSC_EP0MAXPACKET
|
|
|
|
# define CONFIG_USBMSC_EP0MAXPACKET 64
|
2012-01-24 22:51:26 +01:00
|
|
|
# endif
|
2008-10-25 00:42:28 +02:00
|
|
|
#endif
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#ifndef CONFIG_USBMSC_BULKINREQLEN
|
2008-10-25 00:42:28 +02:00
|
|
|
# ifdef CONFIG_USBDEV_DUALSPEED
|
2012-01-25 21:17:59 +01:00
|
|
|
# define CONFIG_USBMSC_BULKINREQLEN 512
|
2008-10-25 00:42:28 +02:00
|
|
|
# else
|
2012-01-25 21:17:59 +01:00
|
|
|
# define CONFIG_USBMSC_BULKINREQLEN 64
|
2008-10-25 00:42:28 +02:00
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# ifdef CONFIG_USBDEV_DUALSPEED
|
2012-01-25 21:17:59 +01:00
|
|
|
# if CONFIG_USBMSC_BULKINREQLEN < 512
|
2008-10-25 00:42:28 +02:00
|
|
|
# warning "Bulk in buffer size smaller than max packet"
|
2012-01-25 21:17:59 +01:00
|
|
|
# undef CONFIG_USBMSC_BULKINREQLEN
|
|
|
|
# define CONFIG_USBMSC_BULKINREQLEN 512
|
2008-10-25 00:42:28 +02:00
|
|
|
# endif
|
|
|
|
# else
|
2012-01-25 21:17:59 +01:00
|
|
|
# if CONFIG_USBMSC_BULKINREQLEN < 64
|
2008-10-25 00:42:28 +02:00
|
|
|
# warning "Bulk in buffer size smaller than max packet"
|
2012-01-25 21:17:59 +01:00
|
|
|
# undef CONFIG_USBMSC_BULKINREQLEN
|
|
|
|
# define CONFIG_USBMSC_BULKINREQLEN 64
|
2008-10-25 00:42:28 +02:00
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#ifndef CONFIG_USBMSC_BULKOUTREQLEN
|
2008-10-25 00:42:28 +02:00
|
|
|
# ifdef CONFIG_USBDEV_DUALSPEED
|
2012-01-25 21:17:59 +01:00
|
|
|
# define CONFIG_USBMSC_BULKOUTREQLEN 512
|
2008-10-25 00:42:28 +02:00
|
|
|
# else
|
2012-01-25 21:17:59 +01:00
|
|
|
# define CONFIG_USBMSC_BULKOUTREQLEN 64
|
2008-10-25 00:42:28 +02:00
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# ifdef CONFIG_USBDEV_DUALSPEED
|
2012-01-25 21:17:59 +01:00
|
|
|
# if CONFIG_USBMSC_BULKOUTREQLEN < 512
|
2008-10-25 00:42:28 +02:00
|
|
|
# warning "Bulk in buffer size smaller than max packet"
|
2012-01-25 21:17:59 +01:00
|
|
|
# undef CONFIG_USBMSC_BULKOUTREQLEN
|
|
|
|
# define CONFIG_USBMSC_BULKOUTREQLEN 512
|
2008-10-25 00:42:28 +02:00
|
|
|
# endif
|
|
|
|
# else
|
2012-01-25 21:17:59 +01:00
|
|
|
# if CONFIG_USBMSC_BULKOUTREQLEN < 64
|
2008-10-25 00:42:28 +02:00
|
|
|
# warning "Bulk in buffer size smaller than max packet"
|
2012-01-25 21:17:59 +01:00
|
|
|
# undef CONFIG_USBMSC_BULKOUTREQLEN
|
|
|
|
# define CONFIG_USBMSC_BULKOUTREQLEN 64
|
2008-10-25 00:42:28 +02:00
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Vendor and product IDs and strings */
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#ifndef CONFIG_USBMSC_COMPOSITE
|
|
|
|
# ifndef CONFIG_USBMSC_VENDORID
|
|
|
|
# warning "CONFIG_USBMSC_VENDORID not defined"
|
|
|
|
# define CONFIG_USBMSC_VENDORID 0x584e
|
2012-01-24 22:51:26 +01:00
|
|
|
# endif
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
# ifndef CONFIG_USBMSC_PRODUCTID
|
|
|
|
# warning "CONFIG_USBMSC_PRODUCTID not defined"
|
|
|
|
# define CONFIG_USBMSC_PRODUCTID 0x5342
|
2012-01-24 22:51:26 +01:00
|
|
|
# endif
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
# ifndef CONFIG_USBMSC_VERSIONNO
|
|
|
|
# define CONFIG_USBMSC_VERSIONNO (0x0399)
|
2012-01-24 22:51:26 +01:00
|
|
|
# endif
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
# ifndef CONFIG_USBMSC_VENDORSTR
|
2012-01-24 22:51:26 +01:00
|
|
|
# warning "No Vendor string specified"
|
2012-01-25 21:17:59 +01:00
|
|
|
# define CONFIG_USBMSC_VENDORSTR "NuttX"
|
2023-05-20 00:32:34 +02:00
|
|
|
# endif
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
# ifndef CONFIG_USBMSC_PRODUCTSTR
|
2012-01-24 22:51:26 +01:00
|
|
|
# warning "No Product string specified"
|
2012-01-25 21:17:59 +01:00
|
|
|
# define CONFIG_USBMSC_PRODUCTSTR "USBdev Storage"
|
2012-01-24 22:51:26 +01:00
|
|
|
# endif
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
# undef CONFIG_USBMSC_SERIALSTR
|
|
|
|
# define CONFIG_USBMSC_SERIALSTR "0101"
|
2012-01-24 22:51:26 +01:00
|
|
|
#endif
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#undef CONFIG_USBMSC_CONFIGSTR
|
|
|
|
#define CONFIG_USBMSC_CONFIGSTR "Bulk"
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2014-03-25 21:19:27 +01:00
|
|
|
/* SCSI daemon */
|
|
|
|
|
|
|
|
#ifndef CONFIG_USBMSC_SCSI_PRIO
|
|
|
|
# define CONFIG_USBMSC_SCSI_PRIO 128
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CONFIG_USBMSC_SCSI_STACKSIZE
|
|
|
|
# define CONFIG_USBMSC_SCSI_STACKSIZE 2048
|
|
|
|
#endif
|
|
|
|
|
2008-10-25 00:42:28 +02:00
|
|
|
/* USB Controller */
|
|
|
|
|
2013-09-20 18:00:30 +02:00
|
|
|
#ifdef CONFIG_USBDEV_SELFPOWERED
|
|
|
|
# define USBMSC_SELFPOWERED USB_CONFIG_ATTR_SELFPOWER
|
2008-10-25 00:42:28 +02:00
|
|
|
#else
|
2013-09-20 18:00:30 +02:00
|
|
|
# define USBMSC_SELFPOWERED (0)
|
2008-10-25 00:42:28 +02:00
|
|
|
#endif
|
|
|
|
|
2020-01-31 19:07:39 +01:00
|
|
|
#ifdef CONFIG_USBDEV_REMOTEWAKEUP
|
2013-09-20 18:00:30 +02:00
|
|
|
# define USBMSC_REMOTEWAKEUP USB_CONFIG_ATTR_WAKEUP
|
2008-10-25 00:42:28 +02:00
|
|
|
#else
|
2013-09-20 18:00:30 +02:00
|
|
|
# define USBMSC_REMOTEWAKEUP (0)
|
2008-10-25 00:42:28 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CONFIG_USBDEV_MAXPOWER
|
|
|
|
# define CONFIG_USBDEV_MAXPOWER 100
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Current state of the worker thread */
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#define USBMSC_STATE_NOTSTARTED (0) /* Thread has not yet been started */
|
|
|
|
#define USBMSC_STATE_STARTED (1) /* Started, but is not yet initialized */
|
|
|
|
#define USBMSC_STATE_IDLE (2) /* Started and waiting for commands */
|
|
|
|
#define USBMSC_STATE_CMDPARSE (3) /* Processing a received command */
|
|
|
|
#define USBMSC_STATE_CMDREAD (4) /* Processing a SCSI read command */
|
|
|
|
#define USBMSC_STATE_CMDWRITE (5) /* Processing a SCSI write command */
|
|
|
|
#define USBMSC_STATE_CMDFINISH (6) /* Finish command processing */
|
|
|
|
#define USBMSC_STATE_CMDSTATUS (7) /* Processing the final status of the command */
|
|
|
|
#define USBMSC_STATE_TERMINATED (8) /* Thread has exitted */
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/* Event communicated to worker thread */
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#define USBMSC_EVENT_NOEVENTS (0) /* There are no outstanding events */
|
|
|
|
#define USBMSC_EVENT_READY (1 << 0) /* Initialization is complete */
|
|
|
|
#define USBMSC_EVENT_RDCOMPLETE (1 << 1) /* A read has completed there is data to be processed */
|
|
|
|
#define USBMSC_EVENT_WRCOMPLETE (1 << 2) /* A write has completed and a request is available */
|
|
|
|
#define USBMSC_EVENT_TERMINATEREQUEST (1 << 3) /* Shutdown requested */
|
|
|
|
#define USBMSC_EVENT_DISCONNECT (1 << 4) /* USB disconnect received */
|
|
|
|
#define USBMSC_EVENT_RESET (1 << 5) /* USB storage setup reset received */
|
|
|
|
#define USBMSC_EVENT_CFGCHANGE (1 << 6) /* USB setup configuration change received */
|
|
|
|
#define USBMSC_EVENT_IFCHANGE (1 << 7) /* USB setup interface change received */
|
|
|
|
#define USBMSC_EVENT_ABORTBULKOUT (1 << 8) /* SCSI receive failure */
|
|
|
|
|
|
|
|
/* SCSI command flags (passed to usbmsc_setupcmd()) */
|
|
|
|
|
|
|
|
#define USBMSC_FLAGS_DIRMASK (0x03) /* Bits 0-1: Data direction */
|
|
|
|
#define USBMSC_FLAGS_DIRNONE (0x00) /* No data to send */
|
|
|
|
#define USBMSC_FLAGS_DIRHOST2DEVICE (0x01) /* Host-to-device */
|
|
|
|
#define USBMSC_FLAGS_DIRDEVICE2HOST (0x02) /* Device-to-host */
|
|
|
|
#define USBMSC_FLAGS_BLOCKXFR (0x04) /* Bit 2: Command is a block transfer request */
|
|
|
|
#define USBMSC_FLAGS_LUNNOTNEEDED (0x08) /* Bit 3: Command does not require a valid LUN */
|
|
|
|
#define USBMSC_FLAGS_UACOKAY (0x10) /* Bit 4: Command OK if unit attention condition */
|
|
|
|
#define USBMSC_FLAGS_RETAINSENSEDATA (0x20) /* Bit 5: Do not clear sense data */
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/* Descriptors **************************************************************/
|
|
|
|
|
|
|
|
/* Big enough to hold our biggest descriptor */
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#define USBMSC_MXDESCLEN (64)
|
2015-05-13 14:33:17 +02:00
|
|
|
#define USBMSC_MAXSTRLEN (USBMSC_MXDESCLEN-2)
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/* String language */
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#define USBMSC_STR_LANGUAGE (0x0409) /* en-us */
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/* Descriptor strings */
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#ifndef CONFIG_USBMSC_COMPOSITE
|
|
|
|
# define USBMSC_MANUFACTURERSTRID (1)
|
|
|
|
# define USBMSC_PRODUCTSTRID (2)
|
|
|
|
# define USBMSC_SERIALSTRID (3)
|
|
|
|
# define USBMSC_CONFIGSTRID (4)
|
|
|
|
# define USBMSC_INTERFACESTRID USBMSC_CONFIGSTRID
|
2012-01-24 22:51:26 +01:00
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
# undef CONFIG_USBMSC_STRBASE
|
2012-01-27 22:03:20 +01:00
|
|
|
# define CONFIG_USBMSC_STRBASE (0)
|
2012-01-24 22:51:26 +01:00
|
|
|
#else
|
2019-09-09 22:47:47 +02:00
|
|
|
# define USBMSC_INTERFACESTRID (CONFIG_USBMSC_STRBASE + 1)
|
2012-01-24 22:51:26 +01:00
|
|
|
#endif
|
2012-01-27 22:03:20 +01:00
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#define USBMSC_LASTSTRID USBMSC_INTERFACESTRID
|
2012-01-27 22:03:20 +01:00
|
|
|
#define USBMSC_NSTRIDS (USBMSC_LASTSTRID - CONFIG_USBMSC_STRBASE)
|
2012-01-24 22:51:26 +01:00
|
|
|
|
2008-10-25 00:42:28 +02:00
|
|
|
/* Configuration Descriptor */
|
|
|
|
|
2019-09-09 22:47:47 +02:00
|
|
|
#define USBMSC_INTERFACEID (CONFIG_USBMSC_IFNOBASE + 0)
|
2012-04-11 19:13:04 +02:00
|
|
|
#define USBMSC_ALTINTERFACEID (0)
|
2012-01-25 20:27:20 +01:00
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#define USBMSC_CONFIGIDNONE (0) /* Config ID means to return to address mode */
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/* Endpoint configuration */
|
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
#define USBMSC_MKEPBULKOUT(devDesc) ((devDesc)->epno[USBMSC_EP_BULKOUT_IDX])
|
2012-01-25 21:17:59 +01:00
|
|
|
#define USBMSC_EPOUTBULK_ATTR (USB_EP_ATTR_XFER_BULK)
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2018-08-13 15:39:38 +02:00
|
|
|
#define USBMSC_MKEPBULKIN(devDesc) (USB_DIR_IN | (devDesc)->epno[USBMSC_EP_BULKIN_IDX])
|
2012-01-25 21:17:59 +01:00
|
|
|
#define USBMSC_EPINBULK_ATTR (USB_EP_ATTR_XFER_BULK)
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2024-07-03 09:21:39 +02:00
|
|
|
#define USBMSC_SSBULKMAXSTREAM (0)
|
|
|
|
#define USBMSC_SSBULKMAXBURST (0)
|
2024-07-02 08:36:49 +02:00
|
|
|
#define USBMSC_SSBULKMAXPACKET (1024)
|
|
|
|
#define USBMSC_SSBULKMXPKTSHIFT (10)
|
|
|
|
#define USBMSC_SSBULKMXPKTMASK (0x000003ff)
|
2012-01-25 21:17:59 +01:00
|
|
|
#define USBMSC_HSBULKMAXPACKET (512)
|
|
|
|
#define USBMSC_HSBULKMXPKTSHIFT (9)
|
|
|
|
#define USBMSC_HSBULKMXPKTMASK (0x000001ff)
|
|
|
|
#define USBMSC_FSBULKMAXPACKET (64)
|
|
|
|
#define USBMSC_FSBULKMXPKTSHIFT (6)
|
|
|
|
#define USBMSC_FSBULKMXPKTMASK (0x0000003f)
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2012-01-24 22:51:26 +01:00
|
|
|
/* Configuration descriptor size */
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#ifndef CONFIG_USBMSC_COMPOSITE
|
2012-01-24 22:51:26 +01:00
|
|
|
|
|
|
|
/* The size of the config descriptor: (9 + 9 + 2*7) = 32 */
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
# define SIZEOF_USBMSC_CFGDESC \
|
2012-01-27 17:25:57 +01:00
|
|
|
(USB_SIZEOF_CFGDESC + USB_SIZEOF_IFDESC + USBMSC_NENDPOINTS * USB_SIZEOF_EPDESC)
|
|
|
|
|
2012-01-24 22:51:26 +01:00
|
|
|
#else
|
|
|
|
|
|
|
|
/* The size of the config descriptor: (9 + 2*7) = 23 */
|
|
|
|
|
2012-01-27 17:25:57 +01:00
|
|
|
# define SIZEOF_USBMSC_CFGDESC \
|
|
|
|
(USB_SIZEOF_IFDESC + USBMSC_NENDPOINTS * USB_SIZEOF_EPDESC)
|
|
|
|
|
2012-01-24 22:51:26 +01:00
|
|
|
#endif
|
|
|
|
|
2008-10-25 00:42:28 +02:00
|
|
|
/* Block driver helpers *****************************************************/
|
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
#define USBMSC_DRVR_READ(l,b,s,n) \
|
|
|
|
((l)->inode->u.i_bops->read((l)->inode,b,s,n))
|
|
|
|
#define USBMSC_DRVR_WRITE(l,b,s,n) \
|
|
|
|
((l)->inode->u.i_bops->write((l)->inode,b,s,n))
|
|
|
|
#define USBMSC_DRVR_GEOMETRY(l,g) \
|
|
|
|
((l)->inode->u.i_bops->geometry((l)->inode,g))
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
2020-01-10 16:06:36 +01:00
|
|
|
|
2011-09-28 00:04:03 +02:00
|
|
|
/* Endpoint descriptors */
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
enum usbmsc_epdesc_e
|
2011-09-28 00:04:03 +02:00
|
|
|
{
|
2017-07-16 16:43:17 +02:00
|
|
|
USBMSC_EPBULKOUT = 0, /* Bulk OUT endpoint descriptor */
|
|
|
|
USBMSC_EPBULKIN /* Bulk IN endpoint descriptor */
|
2011-09-28 00:04:03 +02:00
|
|
|
};
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/* Container to support a list of requests */
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
struct usbmsc_req_s
|
2008-10-25 00:42:28 +02:00
|
|
|
{
|
2012-03-21 19:01:07 +01:00
|
|
|
FAR struct usbmsc_req_s *flink; /* Implements a singly linked list */
|
2008-10-25 00:42:28 +02:00
|
|
|
FAR struct usbdev_req_s *req; /* The contained request */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* This structure describes one LUN: */
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
struct usbmsc_lun_s
|
2008-10-25 00:42:28 +02:00
|
|
|
{
|
2017-07-16 16:43:17 +02:00
|
|
|
FAR struct inode *inode; /* Inode structure of open'ed block driver */
|
2009-12-15 15:25:14 +01:00
|
|
|
uint8_t readonly:1; /* Media is read-only */
|
|
|
|
uint8_t locked:1; /* Media removal is prevented */
|
|
|
|
uint16_t sectorsize; /* The size of one sector */
|
|
|
|
uint32_t sd; /* Sense data */
|
|
|
|
uint32_t sdinfo; /* Sense data information */
|
|
|
|
uint32_t uad; /* Unit needs attention data */
|
2008-10-25 00:42:28 +02:00
|
|
|
off_t startsector; /* Sector offset to start of partition */
|
|
|
|
size_t nsectors; /* Number of sectors in the partition */
|
|
|
|
};
|
|
|
|
|
2014-03-25 21:19:27 +01:00
|
|
|
/* Describes the overall state of one instance of the driver */
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
struct usbmsc_dev_s
|
2008-10-25 00:42:28 +02:00
|
|
|
{
|
2010-12-04 18:35:19 +01:00
|
|
|
FAR struct usbdev_s *usbdev; /* usbdev driver pointer (Non-null if registered) */
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2014-03-25 21:19:27 +01:00
|
|
|
/* SCSI worker kernel thread interface */
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2014-03-25 21:19:27 +01:00
|
|
|
pid_t thpid; /* The worker thread task ID */
|
|
|
|
sem_t thsynch; /* Used to synchronizer terminal events */
|
2022-09-06 08:18:45 +02:00
|
|
|
mutex_t thlock; /* Used to get exclusive access to the state data */
|
2014-03-25 21:19:27 +01:00
|
|
|
sem_t thwaitsem; /* Used to signal worker thread */
|
|
|
|
volatile bool thwaiting; /* True: worker thread is waiting for an event */
|
2009-12-15 15:25:14 +01:00
|
|
|
volatile uint8_t thstate; /* State of the worker thread */
|
|
|
|
volatile uint16_t theventset; /* Set of pending events signaled to worker thread */
|
|
|
|
volatile uint8_t thvalue; /* Value passed with the event (must persist) */
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/* Storage class configuration and state */
|
|
|
|
|
2010-12-04 18:35:19 +01:00
|
|
|
uint8_t nluns:4; /* Number of LUNs */
|
|
|
|
uint8_t config; /* Configuration number */
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/* Endpoints */
|
|
|
|
|
|
|
|
FAR struct usbdev_ep_s *epbulkin; /* Bulk IN endpoint structure */
|
|
|
|
FAR struct usbdev_ep_s *epbulkout; /* Bulk OUT endpoint structure */
|
|
|
|
FAR struct usbdev_req_s *ctrlreq; /* Control request (for ep0 setup responses) */
|
|
|
|
|
2008-10-25 16:40:55 +02:00
|
|
|
/* SCSI command processing */
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
struct usbmsc_lun_s *lun; /* Currently selected LUN */
|
|
|
|
struct usbmsc_lun_s *luntab; /* Allocated table of all LUNs */
|
2020-04-01 18:13:52 +02:00
|
|
|
uint8_t cdb[USBMSC_MAXCDBLEN]; /* Command data (cdb[]) from CBW */
|
2010-12-04 18:35:19 +01:00
|
|
|
uint8_t phaseerror:1; /* Need to send phase sensing status */
|
|
|
|
uint8_t shortpacket:1; /* Host transmission stopped unexpectedly */
|
2012-01-25 21:17:59 +01:00
|
|
|
uint8_t cbwdir:2; /* Direction from CBW. See USBMSC_FLAGS_DIR* definitions */
|
2010-12-04 18:35:19 +01:00
|
|
|
uint8_t cdblen; /* Length of cdb[] from CBW */
|
|
|
|
uint8_t cbwlun; /* LUN from the CBW */
|
|
|
|
uint16_t nsectbytes; /* Bytes buffered in iobuffer[] */
|
|
|
|
uint16_t nreqbytes; /* Bytes buffered in head write requests */
|
|
|
|
uint16_t iosize; /* Size of iobuffer[] */
|
|
|
|
uint32_t cbwlen; /* Length of data from CBW */
|
|
|
|
uint32_t cbwtag; /* Tag from the CBW */
|
2008-10-25 00:42:28 +02:00
|
|
|
union
|
|
|
|
{
|
2010-12-04 18:35:19 +01:00
|
|
|
uint32_t xfrlen; /* Read/Write: Sectors remaining to be transferred */
|
|
|
|
uint32_t alloclen; /* Other device-to-host: Host allocation length */
|
2008-10-25 00:42:28 +02:00
|
|
|
} u;
|
2010-12-04 18:35:19 +01:00
|
|
|
uint32_t sector; /* Current sector (relative to lun->startsector) */
|
|
|
|
uint32_t residue; /* Untransferred amount reported in the CSW */
|
|
|
|
uint8_t *iobuffer; /* Buffer for data transfers */
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/* Write request list */
|
|
|
|
|
2010-12-04 18:35:19 +01:00
|
|
|
struct sq_queue_s wrreqlist; /* List of empty write request containers */
|
|
|
|
struct sq_queue_s rdreqlist; /* List of filled read request containers */
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2017-07-20 17:34:48 +02:00
|
|
|
struct usbdev_devinfo_s devinfo;
|
2017-07-16 16:43:17 +02:00
|
|
|
|
2008-10-25 00:42:28 +02:00
|
|
|
/* Pre-allocated write request containers. The write requests will
|
|
|
|
* be linked in a free list (wrreqlist), and used to send requests to
|
|
|
|
* EPBULKIN; Read requests will be queued in the EBULKOUT.
|
|
|
|
*/
|
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
struct usbmsc_req_s wrreqs[CONFIG_USBMSC_NWRREQS];
|
|
|
|
struct usbmsc_req_s rdreqs[CONFIG_USBMSC_NRDREQS];
|
2008-10-25 00:42:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
# define EXTERN extern "C"
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#else
|
|
|
|
# define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* String *******************************************************************/
|
|
|
|
|
2012-01-25 20:27:20 +01:00
|
|
|
/* Mass storage class vendor/product/serial number strings */
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#ifndef CONFIG_USBMSC_COMPOSITE
|
2012-01-25 20:27:20 +01:00
|
|
|
EXTERN const char g_mscvendorstr[];
|
|
|
|
EXTERN const char g_mscproductstr[];
|
2023-08-25 08:49:45 +02:00
|
|
|
#ifndef CONFIG_BOARD_USBDEV_SERIALSTR
|
2012-01-25 20:27:20 +01:00
|
|
|
EXTERN const char g_mscserialstr[];
|
2022-01-18 02:36:37 +01:00
|
|
|
#endif
|
2012-01-25 20:27:20 +01:00
|
|
|
|
2020-04-01 18:13:52 +02:00
|
|
|
/* If we are using a composite device, then vendor/product/serial number
|
|
|
|
* strings are provided by the composite device logic.
|
2012-01-25 20:27:20 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#else
|
|
|
|
EXTERN const char g_compvendorstr[];
|
|
|
|
EXTERN const char g_compproductstr[];
|
2023-08-25 08:49:45 +02:00
|
|
|
#ifndef CONFIG_BOARD_USBDEV_SERIALSTR
|
2012-01-25 20:27:20 +01:00
|
|
|
EXTERN const char g_compserialstr[];
|
2022-01-18 02:36:37 +01:00
|
|
|
#endif
|
2012-01-25 20:27:20 +01:00
|
|
|
|
|
|
|
#define g_mscvendorstr g_compvendorstr
|
|
|
|
#define g_mscproductstr g_compproductstr
|
2023-08-25 08:49:45 +02:00
|
|
|
#ifndef CONFIG_BOARD_USBDEV_SERIALSTR
|
2012-01-25 20:27:20 +01:00
|
|
|
#define g_mscserialstr g_compserialstr
|
|
|
|
#endif
|
2022-01-18 02:36:37 +01:00
|
|
|
#endif
|
2014-03-25 21:19:27 +01:00
|
|
|
|
2021-03-04 08:02:21 +01:00
|
|
|
/* Used to hand-off the state structure when the SCSI worker thread is
|
|
|
|
* started
|
|
|
|
*/
|
2014-03-25 21:19:27 +01:00
|
|
|
|
|
|
|
EXTERN FAR struct usbmsc_dev_s *g_usbmsc_handoff;
|
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
/****************************************************************************
|
2008-10-25 00:42:28 +02:00
|
|
|
* Public Function Prototypes
|
2017-07-16 16:43:17 +02:00
|
|
|
****************************************************************************/
|
2008-10-25 00:42:28 +02:00
|
|
|
|
2020-04-01 18:13:52 +02:00
|
|
|
/****************************************************************************
|
2014-03-25 21:19:27 +01:00
|
|
|
* Name: usbmsc_scsi_signal
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Signal the SCSI worker thread that SCSI events need service.
|
|
|
|
*
|
2017-07-16 16:43:17 +02:00
|
|
|
****************************************************************************/
|
2014-03-25 21:19:27 +01:00
|
|
|
|
|
|
|
void usbmsc_scsi_signal(FAR struct usbmsc_dev_s *priv);
|
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
/****************************************************************************
|
2014-03-25 21:19:27 +01:00
|
|
|
* Name: usbmsc_synch_signal
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* ACK controlling tasks request for synchronization.
|
|
|
|
*
|
2017-07-16 16:43:17 +02:00
|
|
|
****************************************************************************/
|
2014-03-25 21:19:27 +01:00
|
|
|
|
2017-10-03 23:35:24 +02:00
|
|
|
#define usbmsc_synch_signal(priv) nxsem_post(&priv->thsynch)
|
2014-03-25 21:19:27 +01:00
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
/****************************************************************************
|
2012-01-25 21:17:59 +01:00
|
|
|
* Name: usbmsc_mkstrdesc
|
2011-09-28 00:04:03 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Construct a string descriptor
|
|
|
|
*
|
2017-07-16 16:43:17 +02:00
|
|
|
****************************************************************************/
|
2011-09-28 00:04:03 +02:00
|
|
|
|
|
|
|
struct usb_strdesc_s;
|
2012-01-25 21:17:59 +01:00
|
|
|
int usbmsc_mkstrdesc(uint8_t id, struct usb_strdesc_s *strdesc);
|
2011-09-28 00:04:03 +02:00
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
/****************************************************************************
|
2017-05-30 20:04:48 +02:00
|
|
|
* Name: usbmsc_getdevdesc
|
2011-09-28 00:04:03 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Return a pointer to the raw device descriptor
|
|
|
|
*
|
2017-07-16 16:43:17 +02:00
|
|
|
****************************************************************************/
|
2011-09-28 00:04:03 +02:00
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#ifndef CONFIG_USBMSC_COMPOSITE
|
|
|
|
FAR const struct usb_devdesc_s *usbmsc_getdevdesc(void);
|
2012-01-24 22:51:26 +01:00
|
|
|
#endif
|
2011-09-28 00:04:03 +02:00
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: usbmsc_copy_epdesc
|
2011-09-28 00:04:03 +02:00
|
|
|
*
|
|
|
|
* Description:
|
2017-07-16 16:43:17 +02:00
|
|
|
* Copies the requested Endpoint Description into the buffer given.
|
|
|
|
* Returns the number of Bytes filled in ( sizeof(struct usb_epdesc_s) ).
|
2011-09-28 00:04:03 +02:00
|
|
|
*
|
2017-07-16 16:43:17 +02:00
|
|
|
****************************************************************************/
|
2011-09-28 00:04:03 +02:00
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
int usbmsc_copy_epdesc(enum usbmsc_epdesc_e epid,
|
|
|
|
FAR struct usb_epdesc_s *epdesc,
|
2017-07-20 17:34:48 +02:00
|
|
|
FAR struct usbdev_devinfo_s *devinfo,
|
2024-07-02 08:36:49 +02:00
|
|
|
uint8_t speed);
|
2011-09-28 00:04:03 +02:00
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
/****************************************************************************
|
2012-01-25 21:17:59 +01:00
|
|
|
* Name: usbmsc_mkcfgdesc
|
2011-09-28 00:04:03 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Construct the configuration descriptor
|
|
|
|
*
|
2017-07-16 16:43:17 +02:00
|
|
|
****************************************************************************/
|
2011-09-28 00:04:03 +02:00
|
|
|
|
2020-04-01 18:13:52 +02:00
|
|
|
int16_t usbmsc_mkcfgdesc(FAR uint8_t *buf,
|
|
|
|
FAR struct usbdev_devinfo_s *devinfo,
|
2017-07-16 16:43:17 +02:00
|
|
|
uint8_t speed, uint8_t type);
|
2011-09-28 00:04:03 +02:00
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
/****************************************************************************
|
2012-01-25 21:17:59 +01:00
|
|
|
* Name: usbmsc_getqualdesc
|
2011-09-28 00:04:03 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Return a pointer to the raw qual descriptor
|
|
|
|
*
|
2017-07-16 16:43:17 +02:00
|
|
|
****************************************************************************/
|
2011-09-28 00:04:03 +02:00
|
|
|
|
2012-01-25 21:17:59 +01:00
|
|
|
#if !defined(CONFIG_USBMSC_COMPOSITE) && defined(CONFIG_USBDEV_DUALSPEED)
|
|
|
|
FAR const struct usb_qualdesc_s *usbmsc_getqualdesc(void);
|
2011-09-28 00:04:03 +02:00
|
|
|
#endif
|
|
|
|
|
2008-10-25 00:42:28 +02:00
|
|
|
/****************************************************************************
|
2014-03-25 21:19:27 +01:00
|
|
|
* Name: usbmsc_scsi_main
|
2008-10-25 00:42:28 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* This is the main function of the USB storage worker thread. It loops
|
|
|
|
* until USB-related events occur, then processes those events accordingly
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2024-08-25 01:21:12 +02:00
|
|
|
int usbmsc_scsi_main(int argc, FAR char *argv[]);
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2012-01-25 21:17:59 +01:00
|
|
|
* Name: usbmsc_setconfig
|
2008-10-25 00:42:28 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Set the device configuration by allocating and configuring endpoints and
|
|
|
|
* by allocating and queue read and write requests.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-03-25 21:19:27 +01:00
|
|
|
int usbmsc_setconfig(FAR struct usbmsc_dev_s *priv, uint8_t config);
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2012-01-25 21:17:59 +01:00
|
|
|
* Name: usbmsc_resetconfig
|
2008-10-25 00:42:28 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Mark the device as not configured and disable all endpoints.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-03-25 21:19:27 +01:00
|
|
|
void usbmsc_resetconfig(FAR struct usbmsc_dev_s *priv);
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2012-01-25 21:17:59 +01:00
|
|
|
* Name: usbmsc_wrcomplete
|
2008-10-25 00:42:28 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Handle completion of write request. This function probably executes
|
|
|
|
* in the context of an interrupt handler.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-03-25 21:19:27 +01:00
|
|
|
void usbmsc_wrcomplete(FAR struct usbdev_ep_s *ep,
|
|
|
|
FAR struct usbdev_req_s *req);
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2012-01-25 21:17:59 +01:00
|
|
|
* Name: usbmsc_rdcomplete
|
2008-10-25 00:42:28 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Handle completion of read request on the bulk OUT endpoint. This
|
|
|
|
* is handled like the receipt of serial data on the "UART"
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-03-25 21:19:27 +01:00
|
|
|
void usbmsc_rdcomplete(FAR struct usbdev_ep_s *ep,
|
|
|
|
FAR struct usbdev_req_s *req);
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2012-01-25 21:17:59 +01:00
|
|
|
* Name: usbmsc_deferredresponse
|
2008-10-25 00:42:28 +02:00
|
|
|
*
|
|
|
|
* Description:
|
2019-09-11 16:56:56 +02:00
|
|
|
* Some EP0 setup request cannot be responded to immediately because they
|
2008-10-25 00:42:28 +02:00
|
|
|
* require some asynchronous action from the SCSI worker thread. This
|
|
|
|
* function is provided for the SCSI thread to make that deferred response.
|
|
|
|
* The specific requests that require this deferred response are:
|
|
|
|
*
|
|
|
|
* 1. USB_REQ_SETCONFIGURATION,
|
|
|
|
* 2. USB_REQ_SETINTERFACE, or
|
2012-01-25 21:17:59 +01:00
|
|
|
* 3. USBMSC_REQ_MSRESET
|
2008-10-25 00:42:28 +02:00
|
|
|
*
|
2020-02-22 19:31:14 +01:00
|
|
|
* In all cases, the success response is a zero-length packet; the failure
|
2008-10-25 00:42:28 +02:00
|
|
|
* response is an EP0 stall.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2008-10-25 00:42:28 +02:00
|
|
|
* priv - Private state structure for this USB storage instance
|
2009-12-15 15:25:14 +01:00
|
|
|
* stall - true is the action failed and a stall is required
|
2008-10-25 00:42:28 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-03-25 21:19:27 +01:00
|
|
|
void usbmsc_deferredresponse(FAR struct usbmsc_dev_s *priv, bool failed);
|
2008-10-25 00:42:28 +02:00
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
#endif /* __DRIVERS_USBDEV_USBMSC_H */
|