X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/c49bdcb7c930f2d0e0cf6887b3326f9e8f7f37b3..8154331da60ac08b0e2b09ca67008ec4a8c7698b:/LUFA/Drivers/USB/Class/Host/MassStorage.h diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.h b/LUFA/Drivers/USB/Class/Host/MassStorage.h index 584172fe8..502e9021d 100644 --- a/LUFA/Drivers/USB/Class/Host/MassStorage.h +++ b/LUFA/Drivers/USB/Class/Host/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) + Copyright 2010 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 + 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 @@ -53,6 +53,11 @@ extern "C" { #endif + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_MS_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/Class/MassStorage.h instead. + #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 */ @@ -113,14 +118,6 @@ }; /* Function Prototypes: */ - /** General management task for a given Mass Storage host class interface, required for the correct operation of - * the interface. This should be called frequently in the main program loop, before the master USB management task - * \ref USB_USBTask(). - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing an MS Class host configuration and state - */ - void MS_Host_USBTask(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - /** 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 * Storage Host instance's state values and configures the pipes required to communicate with the interface if it @@ -164,6 +161,9 @@ /** Retrieves the Mass Storage device's inquiry data for the specified LUN, indicating the device characteristics and * properties. * + * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the + * call will fail. + * * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state * \param[in] LUNIndex LUN index within the device the command is being issued to * \param[out] InquiryData Location where the read inquiry data should be stored @@ -186,6 +186,9 @@ /** Retrieves the total capacity of the attached USB Mass Storage device, in blocks, and block size. * + * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the + * call will fail. + * * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state * \param[in] LUNIndex LUN index within the device the command is being issued to * \param[out] DeviceCapacity Pointer to the location where the capacity information should be stored @@ -199,6 +202,9 @@ /** Retrieves the device sense data, indicating the current device state and error codes for the previously * issued command. * + * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the + * call will fail. + * * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state * \param[in] LUNIndex LUN index within the device the command is being issued to * \param[out] SenseData Pointer to the location where the sense information should be stored @@ -212,6 +218,9 @@ /** 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. * + * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the + * call will fail. + * * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state * \param[in] LUNIndex LUN index within the device the command is being issued to * \param[in] PreventRemoval Boolean true if the device should be locked from removal, false otherwise @@ -223,6 +232,9 @@ /** Reads blocks of data from the attached Mass Storage device's medium. * + * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the + * call will fail. + * * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state * \param[in] LUNIndex LUN index within the device the command is being issued to * \param[in] BlockAddress Starting block address within the device to read from @@ -238,6 +250,9 @@ /** Writes blocks of data to the attached Mass Storage device's medium. * + * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the + * call will fail. + * * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state * \param[in] LUNIndex LUN index within the device the command is being issued to * \param[in] BlockAddress Starting block address within the device to write to @@ -251,6 +266,19 @@ const uint32_t BlockAddress, const uint8_t Blocks, const uint16_t BlockSize, void* BlockBuffer) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(6); + /* Inline Functions: */ + /** General management task for a given Mass Storage host class interface, required for the correct operation of + * the interface. This should be called frequently in the main program loop, before the master USB management task + * \ref USB_USBTask(). + * + * \param[in,out] MSInterfaceInfo Pointer to a structure containing an MS Class host configuration and state + */ + static inline void MS_Host_USBTask(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo); + static inline void MS_Host_USBTask(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) + { + (void)MSInterfaceInfo; + } + /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) /* Macros: */ @@ -267,13 +295,13 @@ #define COMMAND_DIRECTION_DATA_OUT (0 << 7) #define COMMAND_DIRECTION_DATA_IN (1 << 7) - #define COMMAND_DATA_TIMEOUT_MS 2000 + #define COMMAND_DATA_TIMEOUT_MS 10000 #define MS_FOUND_DATAPIPE_IN (1 << 0) #define MS_FOUND_DATAPIPE_OUT (1 << 1) /* Function Prototypes: */ - #if defined(INCLUDE_FROM_MS_CLASS_HOST_C) + #if defined(__INCLUDE_FROM_MS_CLASS_HOST_C) static uint8_t DComp_NextMSInterface(void* const CurrentDescriptor); static uint8_t DComp_NextMSInterfaceEndpoint(void* const CurrentDescriptor);