X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/0fcbe22c9eb68f5769bf57469e1bcf9b340d0ae3..03ee87b35abdb8b92e8b55ec040fa943f9a6786c:/LUFA/Drivers/USB/LowLevel/Host.h diff --git a/LUFA/Drivers/USB/LowLevel/Host.h b/LUFA/Drivers/USB/LowLevel/Host.h index d91c1d82d..07ff0fce7 100644 --- a/LUFA/Drivers/USB/LowLevel/Host.h +++ b/LUFA/Drivers/USB/LowLevel/Host.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 @@ -186,7 +186,7 @@ * * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. */ - uint8_t USB_Host_SetDeviceConfiguration(uint8_t ConfigNumber); + uint8_t USB_Host_SetDeviceConfiguration(const uint8_t ConfigNumber); /** Convenience function. This routine sends a GetDescriptor standard request to the attached * device, requesting the device descriptor. This can be used to easily retrieve information @@ -199,7 +199,23 @@ * * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. */ - uint8_t USB_Host_GetDeviceDescriptor(void* DeviceDescriptorPtr); + uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr); + + /** Convenience function. This routine sends a GetDescriptor standard request to the attached + * device, requesting the string descriptor of the specified index. This can be used to easily + * retrieve string descriptors from the device by index, after the index is obtained from the + * Device or Configuration descriptors. + * + * \note After this routine returns, the control pipe will be selected. + * + * \param[in] Index Index of the string index to retrieve + * \param[out] Buffer Pointer to the destination buffer where the retrieved string decriptor is + * to be stored + * \param[in] BufferLength Maximum size of the string descriptor which can be stored into the buffer + * + * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. + */ + uint8_t USB_Host_GetDeviceStringDescriptor(uint8_t Index, void* const Buffer, uint8_t BufferLength); /** Clears a stall condition on the given pipe, via a ClearFeature request to the attached device. * @@ -241,32 +257,32 @@ * * \note Do not manually change to this state in the user code. */ - HOST_STATE_Attached = 3, /**< Internally implemented by the library. This state indicates + HOST_STATE_Powered = 3, /**< Internally implemented by the library. This state indicates * that a device has been attached, and the library's internals * are being configured to begin the enumeration process. * * \note Do not manually change to this state in the user code. */ - HOST_STATE_Attached_WaitForDeviceSettle = 4, /**< Internally implemented by the library. This state indicates + HOST_STATE_Powered_WaitForDeviceSettle = 4, /**< Internally implemented by the library. This state indicates * that the stack is waiting for the initial settling period to * elapse before beginning the enumeration process. * * \note Do not manually change to this state in the user code. */ - HOST_STATE_Attached_WaitForConnect = 5, /**< Internally implemented by the library. This state indicates + HOST_STATE_Powered_WaitForConnect = 5, /**< Internally implemented by the library. This state indicates * that the stack is waiting for a connection event from the USB * controller to indicate a valid USB device has been attached to * the bus and is ready to be enumerated. * * \note Do not manually change to this state in the user code. */ - HOST_STATE_Attached_DoReset = 6, /**< Internally implemented by the library. This state indicates + HOST_STATE_Powered_DoReset = 6, /**< Internally implemented by the library. This state indicates * that a valid USB device has been attached, and that it is * will now be reset to ensure it is ready for enumeration. * * \note Do not manually change to this state in the user code. */ - HOST_STATE_Powered = 7, /**< Internally implemented by the library. This state indicates + HOST_STATE_Powered_ConfigPipe = 7, /**< Internally implemented by the library. This state indicates * that the attached device is currently powered and reset, and * that the control pipe is now being configured by the stack. * @@ -301,26 +317,18 @@ * retrieval and processing of the device descriptor) should also * be placed in this state. */ - HOST_STATE_Configured = 12, /**< May be implemented by the user project. This state should - * implement any extra device configuration (such as the setting of - * class-specific parameters) before normal communication is begun - * in the HOST_STATE_Ready state. - */ - HOST_STATE_Ready = 13, /**< May be implemented by the user project. This state should - * contain the main communications with the attached device. From this - * this state the host state machine should be changed to either - * HOST_STATE_Suspended (after the bus is manually suspended using the - * USB_Host_SuspendBus() macro) or HOST_STATE_WaitForDeviceRemoval as - * needed. + HOST_STATE_Configured = 12, /**< May be implemented by the user project. This state should implement the + * actual work performed on the attached device and changed to the + * HOST_STATE_Suspended or HOST_STATE_WaitForDeviceRemoval states as needed. */ HOST_STATE_Suspended = 15, /**< May be implemented by the user project. This state should be maintained - * while the bus is suspended, and changed to either the HOST_STATE_Ready + * while the bus is suspended, and changed to either the HOST_STATE_Configured * (after resuming the bus with the USB_Host_ResumeBus() macro) or the * HOST_STATE_WaitForDeviceRemoval states as needed. */ }; - /** Enum for the error codes for the \ref EVENT_USB_HostError() event. + /** Enum for the error codes for the \ref EVENT_USB_Host_HostError() event. * * \see \ref Group_Events for more information on this event. */ @@ -334,14 +342,14 @@ */ }; - /** Enum for the error codes for the \ref EVENT_USB_DeviceEnumerationFailed() event. + /** Enum for the error codes for the \ref EVENT_USB_Host_DeviceEnumerationFailed() event. * * \see \ref Group_Events for more information on this event. */ enum USB_Host_EnumerationErrorCodes_t { HOST_ENUMERROR_NoError = 0, /**< No error occurred. Used internally, this is not a valid - * ErrorCode parameter value for the \ref EVENT_USB_DeviceEnumerationFailed() + * ErrorCode parameter value for the \ref EVENT_USB_Host_DeviceEnumerationFailed() * event. */ HOST_ENUMERROR_WaitStage = 1, /**< One of the delays between enumeration steps failed @@ -374,7 +382,7 @@ #define USB_Host_VBUS_Auto_Off() MACROS{ OTGCON |= (1 << VBUSRQC); }MACROE #define USB_Host_VBUS_Manual_Off() MACROS{ PORTE &= ~(1 << 7); }MACROE - #define USB_Host_SetDeviceAddress(addr) MACROS{ UHADDR = (addr & 0x7F); }MACROE + #define USB_Host_SetDeviceAddress(addr) MACROS{ UHADDR = ((addr) & 0x7F); }MACROE /* Enums: */ enum USB_Host_WaitMSErrorCodes_t