3 Copyright (C) Dean Camera, 2010.
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
10 Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
31 #ifndef __HOSTCHAPTER9_H__
32 #define __HOSTCHAPTER9_H__
39 #include "../HighLevel/USBMode.h"
40 #include "../HighLevel/StdRequestType.h"
42 /* Enable C linkage for C++ Compilers: */
43 #if defined(__cplusplus)
47 /* Preprocessor Checks: */
48 #if !defined(__INCLUDE_FROM_USB_DRIVER)
49 #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
52 /* Public Interface - May be used in end-application: */
54 /** Enum for the \ref USB_Host_SendControlRequest() return code, indicating the reason for the error
55 * if the transfer of the request is unsuccessful.
57 * \ingroup Group_PipeControlReq
59 enum USB_Host_SendControlErrorCodes_t
61 HOST_SENDCONTROL_Successful
= 0, /**< No error occurred in the request transfer. */
62 HOST_SENDCONTROL_DeviceDisconnected
= 1, /**< The attached device was disconnected during the
65 HOST_SENDCONTROL_PipeError
= 2, /**< An error occurred in the pipe while sending the request. */
66 HOST_SENDCONTROL_SetupStalled
= 3, /**< The attached device stalled the request, usually
67 * indicating that the request is unsupported on the device.
69 HOST_SENDCONTROL_SoftwareTimeOut
= 4, /**< The request or data transfer timed out. */
72 /* Function Prototypes: */
73 /** Sends the request stored in the \ref USB_ControlRequest global structure to the attached device,
74 * and transfers the data stored in the buffer to the device, or from the device to the buffer
75 * as requested. The transfer is made on the currently selected pipe.
77 * \ingroup Group_PipeControlReq
79 * \param[in] BufferPtr Pointer to the start of the data buffer if the request has a data stage, or
80 * NULL if the request transfers no data to or from the device.
82 * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
84 uint8_t USB_Host_SendControlRequest(void* BufferPtr
);
86 /* Private Interface - For use in library only: */
87 #if !defined(__DOXYGEN__)
89 enum USB_WaitForTypes_t
91 USB_HOST_WAITFOR_SetupSent
,
92 USB_HOST_WAITFOR_InReceived
,
93 USB_HOST_WAITFOR_OutReady
,
96 /* Function Prototypes: */
97 #if defined(__INCLUDE_FROM_HOSTCHAPTER9_C)
98 static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType
);
102 /* Disable C linkage for C++ Compilers: */
103 #if defined(__cplusplus)