Fixed incorrect HID interface class and subclass values in the Mouse and KeyboardMous...
[pub/lufa.git] / Demos / Device / MassStorage / MassStorage.c
index 92e3307..48ce5f3 100644 (file)
 #define  INCLUDE_FROM_MASSSTORAGE_C\r
 #include "MassStorage.h"\r
 \r
-/* Project Tags, for reading out using the ButtLoad project */\r
-BUTTLOADTAG(ProjName,    "LUFA MassStore App");\r
-BUTTLOADTAG(BuildTime,   __TIME__);\r
-BUTTLOADTAG(BuildDate,   __DATE__);\r
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);\r
-\r
 /* Scheduler Task List */\r
 TASK_LIST\r
 {\r
@@ -56,7 +50,7 @@ CommandBlockWrapper_t  CommandBlock;
 /** Structure to hold the latest Command Status Wrapper to return to the host, containing the status of the last issued command. */\r
 CommandStatusWrapper_t CommandStatus = { Signature: CSW_SIGNATURE };\r
 \r
-/** Flag to asyncronously abort any in-progress data transfers upon the reception of a mass storage reset command. */\r
+/** Flag to asynchronously abort any in-progress data transfers upon the reception of a mass storage reset command. */\r
 volatile bool          IsMassStoreReset = false;\r
 \r
 /** Main program entry point. This routine configures the hardware required by the application, then\r
@@ -159,30 +153,30 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                case REQ_MassStorageReset:\r
                        if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
                        {\r
-                               Endpoint_ClearSetupReceived();\r
+                               Endpoint_ClearControlSETUP();\r
 \r
                                /* Indicate that the current transfer should be aborted */\r
                                IsMassStoreReset = true;                        \r
 \r
                                /* Acknowledge status stage */\r
-                               while (!(Endpoint_IsSetupINReady()));\r
-                               Endpoint_ClearSetupIN();\r
+                               while (!(Endpoint_IsINReady()));\r
+                               Endpoint_ClearControlIN();\r
                        }\r
 \r
                        break;\r
                case REQ_GetMaxLUN:\r
                        if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))\r
                        {\r
-                               /* Indicate to the host the number of supported LUNs (virtual disks) on the device */\r
-                               Endpoint_ClearSetupReceived();\r
+                               Endpoint_ClearControlSETUP();\r
 \r
+                               /* Indicate to the host the number of supported LUNs (virtual disks) on the device */\r
                                Endpoint_Write_Byte(TOTAL_LUNS - 1);\r
                                \r
-                               Endpoint_ClearSetupIN();\r
+                               Endpoint_ClearControlIN();\r
                                \r
                                /* Acknowledge status stage */\r
-                               while (!(Endpoint_IsSetupOUTReceived()));\r
-                               Endpoint_ClearSetupOUT();\r
+                               while (!(Endpoint_IsOUTReceived()));\r
+                               Endpoint_ClearControlOUT();\r
                        }\r
                        \r
                        break;\r
@@ -234,7 +228,7 @@ TASK(USB_MassStorage)
                Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPNUM);\r
                \r
                /* Check to see if a command from the host has been issued */\r
-               if (Endpoint_ReadWriteAllowed())\r
+               if (Endpoint_IsReadWriteAllowed())\r
                {       \r
                        /* Indicate busy */\r
                        UpdateStatus(Status_ProcessingCommandBlock);\r
@@ -262,7 +256,7 @@ TASK(USB_MassStorage)
                                /* Return command status block to the host */\r
                                ReturnCommandStatus();\r
                                \r
-                               /* Check if a Mass Storage Reset ocurred */\r
+                               /* Check if a Mass Storage Reset occurred */\r
                                if (IsMassStoreReset)\r
                                {\r
                                        /* Reset the data endpoint banks */\r
@@ -326,7 +320,7 @@ static bool ReadInCommandBlock(void)
          return false;\r
 \r
        /* Finalize the stream transfer to send the last packet */\r
-       Endpoint_ClearCurrentBank();\r
+       Endpoint_ClearOUT();\r
        \r
        return true;\r
 }\r
@@ -367,7 +361,7 @@ static void ReturnCommandStatus(void)
          return;\r
 \r
        /* Finalize the stream transfer to send the last packet */\r
-       Endpoint_ClearCurrentBank();\r
+       Endpoint_ClearIN();\r
 }\r
 \r
 /** Stream callback function for the Endpoint stream read and write functions. This callback will abort the current stream transfer\r
@@ -386,7 +380,7 @@ STREAM_CALLBACK(AbortOnMassStoreReset)
 /** ISR for the general Pipe/Endpoint interrupt vector. This ISR fires when a control request has been issued to the control endpoint,\r
  *  so that the request can be processed. As several elements of the Mass Storage implementation require asynchronous control requests\r
  *  (such as endpoint stall clearing and Mass Storage Reset requests during data transfers) this is done via interrupts rather than\r
- *  polling.\r
+ *  polling so that they can be processed regardless of the rest of the application's state.\r
  */\r
 ISR(ENDPOINT_PIPE_vect, ISR_BLOCK)\r
 {\r