X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/b9b03aadb219d06fbad9d110e508db93e45461af..8a55d80e7e1214b8625b413fa0123a8b6ce9c825:/Demos/Device/LowLevel/MassStorage/MassStorage.h diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.h b/Demos/Device/LowLevel/MassStorage/MassStorage.h index cbd3cd931..05dbe75bc 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.h +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.h @@ -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);