X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/b9b03aadb219d06fbad9d110e508db93e45461af..d11ed10c5314c44dc01c06954d1d73d4894cbff8:/Demos/Device/LowLevel/MassStorage/MassStorage.h diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.h b/Demos/Device/LowLevel/MassStorage/MassStorage.h index cbd3cd931..7ebb06dc0 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.h +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.h @@ -1,21 +1,21 @@ /* LUFA Library - Copyright (C) Dean Camera, 2009. + Copyright (C) Dean Camera, 2010. dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ /* - Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, and distribute this software - and its documentation for any purpose and without fee is hereby - granted, 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 + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + 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 + 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 software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -46,11 +46,10 @@ #include "Lib/SCSI.h" #include "Lib/DataflashManager.h" - #include // Library Version Information - #include // USB Functionality - #include // LEDs driver - #include // Dataflash chip driver - #include // Simple scheduler for task management + #include + #include + #include + #include /* Macros: */ /** Mass Storage Class specific request to reset the Mass Storage interface, ready for the next command. */ @@ -65,7 +64,7 @@ /** Total number of Logical Units (drives) in the device. The total device capacity is shared equally between * each drive - this can be set to any positive non-zero amount. */ - #define TOTAL_LUNS 2 + #define TOTAL_LUNS 1 /** Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device. */ #define LUN_MEDIA_BLOCKS (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS) @@ -82,6 +81,21 @@ /** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from device-to-host. */ #define COMMAND_DIRECTION_DATA_IN (1 << 7) + /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ + #define LEDMASK_USB_NOTREADY LEDS_LED1 + + /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */ + #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) + + /** LED mask for the library LED driver, to indicate that the USB interface is ready. */ + #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) + + /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ + #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) + + /** LED mask for the library LED driver, to indicate that the USB interface is busy. */ + #define LEDMASK_USB_BUSY LEDS_LED2 + /* Type defines: */ /** Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */ typedef struct @@ -112,32 +126,20 @@ Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a SCSI REQUEST SENSE command */ Phase_Error = 2 /**< Command failed due to being invalid in the current phase */ }; - - /** Enum for the possible status codes for passing to the UpdateStatus() function. */ - enum MassStorage_StatusCodes_t - { - Status_USBNotReady = 0, /**< USB is not ready (disconnected from a USB host) */ - Status_USBEnumerating = 1, /**< USB interface is enumerating */ - Status_USBReady = 2, /**< USB interface is connected and ready */ - Status_CommandBlockError = 3, /**< Processing a SCSI command block from the host */ - Status_ProcessingCommandBlock = 4, /**< Error during the processing of a SCSI command block from the host */ - }; /* Global Variables: */ extern CommandBlockWrapper_t CommandBlock; extern CommandStatusWrapper_t CommandStatus; extern volatile bool IsMassStoreReset; - - /* Task Definitions: */ - TASK(USB_MassStorage); /* Function Prototypes: */ - void EVENT_USB_Connect(void); - void EVENT_USB_Disconnect(void); - void EVENT_USB_ConfigurationChanged(void); - void EVENT_USB_UnhandledControlPacket(void); - - void UpdateStatus(uint8_t CurrentStatus); + void SetupHardware(void); + void MassStorage_Task(void); + + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); #if defined(INCLUDE_FROM_MASSSTORAGE_C) static bool ReadInCommandBlock(void);