Statistics
| Branch: | Tag: | Revision:

root / LUFA / Drivers / USB / Core / Host.h @ 978b99e5

History | View | Annotate | Download (7.28 KB)

1
/*
2
             LUFA Library
3
     Copyright (C) Dean Camera, 2011.
4

5
  dean [at] fourwalledcubicle [dot] com
6
           www.lufa-lib.org
7
*/
8

    
9
/*
10
  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
11

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.
20

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
28
  this software.
29
*/
30

    
31
/** \file
32
 *  \brief Common USB Host definitions for all architectures.
33
 *  \copydetails Group_Host
34
 *
35
 *  \note This file should not be included directly. It is automatically included as needed by the USB driver
36
 *        dispatch header located in LUFA/Drivers/USB/USB.h.
37
 */
38

    
39
/** \ingroup Group_USB
40
 *  \defgroup Group_Host Host Management
41
 *  \brief USB Host management definitions for USB host mode.
42
 *
43
 *  USB Host mode related macros and enums. This module contains macros and enums which are used when
44
 *  the USB controller is initialized in host mode.
45
 *
46
 *  @{
47
 */
48

    
49
#ifndef __USBHOST_H__
50
#define __USBHOST_H__
51

    
52
        /* Includes: */
53
                #include "../../../Common/Common.h"
54
                #include "USBMode.h"                
55

    
56
        /* Enable C linkage for C++ Compilers: */
57
                #if defined(__cplusplus)
58
                        extern "C" {
59
                #endif
60

    
61
        /* Preprocessor Checks: */
62
                #if !defined(__INCLUDE_FROM_USB_DRIVER)
63
                        #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
64
                #endif
65

    
66
        /* Public Interface - May be used in end-application: */
67
                /* Enums: */
68
                        /** Enum for the various states of the USB Host state machine.
69
                         *
70
                         *  For information on each possible USB host state, refer to the USB 2.0 specification.
71
                         *  Several of the USB host states are broken up further into multiple smaller sub-states,
72
                         *  so that they can be internally implemented inside the library in an efficient manner.
73
                         *
74
                         *  \see \ref USB_HostState, which stores the current host state machine state.
75
                         */
76
                        enum USB_Host_States_t
77
                        {
78
                                HOST_STATE_WaitForDevice                = 0,  /**< This state indicates that the stack is waiting for an interval
79
                                                                               *   to elapse before continuing with the next step of the device
80
                                                                               *   enumeration process.
81
                                                                               */
82
                                HOST_STATE_Unattached                   = 1,  /**< This state indicates that the host state machine is waiting for
83
                                                                               *   a device to be attached so that it can start the enumeration process.
84
                                                                               */
85
                                HOST_STATE_Powered                      = 2,  /**< This state indicates that a device has been attached, and the
86
                                                                               *   library's internals are being configured to begin the enumeration
87
                                                                               *   process.
88
                                                                               */
89
                                HOST_STATE_Powered_WaitForDeviceSettle  = 3,  /**< This state indicates that the stack is waiting for the initial
90
                                                                               *   settling period to elapse before beginning the enumeration process.
91
                                                                               */
92
                                HOST_STATE_Powered_WaitForConnect       = 4,  /**< This state indicates that the stack is waiting for a connection event
93
                                                                               *   from the USB controller to indicate a valid USB device has been attached
94
                                                                               *   to the bus and is ready to be enumerated.
95
                                                                               */
96
                                HOST_STATE_Powered_DoReset              = 5,  /**< This state indicates that a valid USB device has been attached, and that
97
                                                                               *   it will now be reset to ensure it is ready for enumeration.
98
                                                                               */
99
                                HOST_STATE_Powered_ConfigPipe           = 6,  /**< This state indicates that the attached device is currently powered and
100
                                                                               *   reset, and that the control pipe is now being configured by the stack.
101
                                                                               */
102
                                HOST_STATE_Default                      = 7,  /**< This state indicates that the stack is currently retrieving the control
103
                                                                               *   endpoint's size from the device, so that the control pipe can be altered
104
                                                                               *   to match.
105
                                                                               */
106
                                HOST_STATE_Default_PostReset            = 8,  /**< This state indicates that the control pipe is being reconfigured to match
107
                                                                               *   the retrieved control endpoint size from the device, and the device's USB
108
                                                                               *   bus address is being set.
109
                                                                               */
110
                                HOST_STATE_Default_PostAddressSet       = 9,  /**< This state indicates that the device's address has now been set, and the
111
                                                                               *   stack is has now completed the device enumeration process. This state causes 
112
                                                                               *   the stack to change the current USB device address to that set for the
113
                                                                               *   connected device, before progressing to the \ref HOST_STATE_Addressed state
114
                                                                               *   ready for use in the user application.
115
                                                                               */
116
                                HOST_STATE_Addressed                    = 10, /**< Indicates that the device has been enumerated and addressed, and is now waiting
117
                                                                               *   for the user application to configure the device ready for use.                                
118
                                                                               */
119
                                HOST_STATE_Configured                   = 11, /**< Indicates that the device has been configured into a valid device configuration,
120
                                                                               *   ready for general use by the user application.                                
121
                                                                               */
122
                        };
123

    
124
        /* Architecture Includes: */
125
                #if (ARCH == ARCH_AVR8)
126
                        #include "AVR8/Host_AVR8.h"
127
                #elif (ARCH == ARCH_UC3)
128
                        #include "UC3/Host_UC3.h"
129
                #endif
130

    
131
        /* Disable C linkage for C++ Compilers: */
132
                #if defined(__cplusplus)
133
                        }
134
                #endif
135

    
136
#endif
137

    
138
/** @} */
139