Move RNDISConstants.h into the RNDIS class driver common definition header.
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Host / MassStorage.h
index 4feac0e..bef26fd 100644 (file)
@@ -1,21 +1,21 @@
 /*
              LUFA Library
      Copyright (C) Dean Camera, 2010.
-              
+
   dean [at] fourwalledcubicle [dot] com
-      www.fourwalledcubicle.com
+           www.lufa-lib.org
 */
 
 /*
   Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
-  Permission to use, copy, modify, distribute, and sell this 
+  Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
-  without fee, provided that the above copyright notice appear in 
+  without fee, provided that the above copyright notice appear in
   all copies and that both that the copyright notice and this
-  permission notice and warranty disclaimer appear in supporting 
-  documentation, and that the name of the author not be used in 
-  advertising or publicity pertaining to distribution of the 
+  permission notice and warranty disclaimer appear in supporting
+  documentation, and that the name of the author not be used in
+  advertising or publicity pertaining to distribution of the
   software without specific, written prior permission.
 
   The author disclaim all warranties with regard to this
@@ -33,8 +33,8 @@
  *
  *  Host mode driver for the library USB Mass Storage Class driver.
  *
- *  \note This file should not be included directly. It is automatically included as needed by the class driver
- *        dispatch header located in LUFA/Drivers/USB/Class/MassStorage.h.
+ *  \note This file should not be included directly. It is automatically included as needed by the USB module driver
+ *        dispatch header located in LUFA/Drivers/USB.h.
  */
 
 /** \ingroup Group_USBClassMS
@@ -56,7 +56,7 @@
        /* Includes: */
                #include "../../USB.h"
                #include "../Common/MassStorage.h"
-               
+
        /* Enable C linkage for C++ Compilers: */
                #if defined(__cplusplus)
                        extern "C" {
 
        /* Preprocessor Checks: */
                #if !defined(__INCLUDE_FROM_MS_DRIVER)
-                       #error Do not include this file directly. Include LUFA/Drivers/Class/MassStorage.h instead.
+                       #error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
+               #endif
+
+               #if defined(__INCLUDE_FROM_MASSSTORAGE_HOST_C) && defined(NO_STREAM_CALLBACKS)
+                       #error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
                #endif
 
        /* Public Interface - May be used in end-application: */
                /* Macros: */
                        /** Error code for some Mass Storage Host functions, indicating a logical (and not hardware) error. */
                        #define MS_ERROR_LOGICAL_CMD_FAILED              0x80
-       
+
                /* Type Defines: */
                        /** \brief Mass Storage Class Host Mode Configuration and State Structure.
                         *
 
                                        uint16_t DataINPipeSize; /**< Size in bytes of the Mass Storage interface's IN data pipe. */
                                        uint16_t DataOUTPipeSize;  /**< Size in bytes of the Mass Storage interface's OUT data pipe. */
-                                       
+
                                        uint32_t TransactionTag; /**< Current transaction tag for data synchronizing of packets. */
                                } State; /**< State data for the USB class interface within the device. All elements in this section
                                                  *   <b>may</b> be set to initial values, but may also be ignored to default to sane values when
                                                  *   the interface is enumerated.
                                                  */
                        } USB_ClassInfo_MS_Host_t;
-                       
+
                        /** \brief SCSI Device LUN Capacity Structure.
                         *
                         *  SCSI capacity structure, to hold the total capacity of the device in both the number
                                MS_ENUMERROR_InvalidConfigDescriptor    = 1, /**< The device returned an invalid Configuration Descriptor. */
                                MS_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Mass Storage interface was not found in the device's Configuration Descriptor. */
                        };
-       
+
                /* Function Prototypes: */
                        /** Host interface configuration routine, to configure a given Mass Storage host interface instance using the
                         *  Configuration Descriptor read from an attached USB device. This function automatically updates the given Mass
                                                           const uint8_t LUNIndex,
                                                           SCSI_Capacity_t* const DeviceCapacity) ATTR_NON_NULL_PTR_ARG(1)
                                                           ATTR_NON_NULL_PTR_ARG(3);
-               
+
                        /** Retrieves the device sense data, indicating the current device state and error codes for the previously
                         *  issued command.
                         *
                                                     const uint8_t LUNIndex,
                                                     SCSI_Request_Sense_Response_t* const SenseData) ATTR_NON_NULL_PTR_ARG(1)
                                                     ATTR_NON_NULL_PTR_ARG(3);
-               
+
                        /** Issues a PREVENT MEDIUM REMOVAL command, to logically (or, depending on the type of device, physically) lock
                         *  the device from removal so that blocks of data on the medium can be read or altered.
                         *
                        uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
                                                                  const uint8_t LUNIndex,
                                                                  const bool PreventRemoval) ATTR_NON_NULL_PTR_ARG(1);
-                       
+
                        /** Reads blocks of data from the attached Mass Storage device's medium.
                         *
                         *  \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
                                                         const uint8_t Blocks,
                                                         const uint16_t BlockSize,
                                                         void* BlockBuffer) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(6);
-               
+
                        /** Writes blocks of data to the attached Mass Storage device's medium.
                         *
                         *  \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
        /* Private Interface - For use in library only: */
        #if !defined(__DOXYGEN__)
                /* Macros: */
-                       #define MASS_STORE_CLASS               0x08
-                       #define MASS_STORE_SUBCLASS            0x06
-                       #define MASS_STORE_PROTOCOL            0x50
-
-                       #define REQ_MassStorageReset           0xFF
-                       #define REQ_GetMaxLUN                  0xFE
-
-                       #define CBW_SIGNATURE                  0x43425355UL
-                       #define CSW_SIGNATURE                  0x53425355UL
-                       
-                       #define COMMAND_DIRECTION_DATA_OUT     (0 << 7)
-                       #define COMMAND_DIRECTION_DATA_IN      (1 << 7)
-                       
-                       #define COMMAND_DATA_TIMEOUT_MS        10000
-                       
+                       #define MS_COMMAND_DATA_TIMEOUT_MS        10000
+
                /* Function Prototypes: */
-                       #if defined(__INCLUDE_FROM_MS_CLASS_HOST_C)             
+                       #if defined(__INCLUDE_FROM_MASSSTORAGE_HOST_C)
                                static uint8_t DCOMP_MS_Host_NextMSInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
                                static uint8_t DCOMP_MS_Host_NextMSInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
-                               
+
                                static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
                                                                   MS_CommandBlockWrapper_t* const SCSICommandBlock,
                                                                   const void* const BufferPtr) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
                                static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-                               static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, 
+                               static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
                                                                       MS_CommandBlockWrapper_t* const SCSICommandBlock,
                                                                       void* BufferPtr) ATTR_NON_NULL_PTR_ARG(1)  ATTR_NON_NULL_PTR_ARG(2);
                                static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
                                                                         ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
                        #endif
        #endif
-       
+
        /* Disable C linkage for C++ Compilers: */
                #if defined(__cplusplus)
                        }
 #endif
 
 /** @} */
+