Contiki 2.5
usb_standard_request.h
Go to the documentation of this file.
1 /* This file has been prepared for Doxygen automatic documentation generation.*/
2 /*! \file usb_standard_request.h *************************************************
3  *
4  * \brief
5  * This file contains the USB endpoint 0 management routines corresponding to
6  * the standard enumeration process (refer to chapter 9 of the USB
7  * specification.
8  * This file calls routines of the usb_specific_request.c file for non-standard
9  * request management.
10  * The enumeration parameters (descriptor tables) are contained in the
11  * usb_descriptors.c file.
12  *
13  * \addtogroup usbdriver
14  *
15  * \author
16  * Atmel Corporation: http://www.atmel.com \n
17  * Support email: avr@atmel.com
18  *
19  ******************************************************************************/
20 /* Copyright (c) 2008 ATMEL Corporation
21  All rights reserved.
22 
23  Redistribution and use in source and binary forms, with or without
24  modification, are permitted provided that the following conditions are met:
25 
26  * Redistributions of source code must retain the above copyright
27  notice, this list of conditions and the following disclaimer.
28  * Redistributions in binary form must reproduce the above copyright
29  notice, this list of conditions and the following disclaimer in
30  the documentation and/or other materials provided with the
31  distribution.
32  * Neither the name of the copyright holders nor the names of
33  contributors may be used to endorse or promote products derived
34  from this software without specific prior written permission.
35 
36  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
40  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
41  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
42  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
44  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46  POSSIBILITY OF SUCH DAMAGE.
47 */
48 
49 #ifndef _USB_ENUM_H_
50 #define _USB_ENUM_H_
51 
52 //_____ I N C L U D E S ____________________________________________________
53 
54 #include "usb_task.h"
55 #include "usb_descriptors.h"
56 
57 //_____ M A C R O S ________________________________________________________
58 
59 //_____ S T A N D A R D D E F I N I T I O N S ___________________________
60 
61  // Device State
62 #define ATTACHED 0
63 #define POWERED 1
64 #define DEFAULT 2
65 #define ADDRESSED 3
66 #define CONFIGURED 4
67 #define SUSPENDED 5
68 
69 #define USB_CONFIG_ATTRIBUTES_RESERVED 0x80
70 #define USB_CONFIG_BUSPOWERED (USB_CONFIG_ATTRIBUTES_RESERVED | 0x00)
71 #define USB_CONFIG_SELFPOWERED (USB_CONFIG_ATTRIBUTES_RESERVED | 0x40)
72 #define USB_CONFIG_REMOTEWAKEUP (USB_CONFIG_ATTRIBUTES_RESERVED | 0x20)
73 
74 //_____ D E C L A R A T I O N ______________________________________________
75 
76  //! @brief Returns true when device connected and correctly enumerated with an host.
77  //! The device high level application should tests this before performing any applicative requests
78 #define Is_device_enumerated() ((usb_configuration_nb!=0) ? TRUE : FALSE)
79 #define Is_device_not_enumerated() ((usb_configuration_nb!=0) ? FALSE : TRUE)
80 
81 
82 void usb_process_request( void);
83 
84 extern U8 usb_configuration_nb;
85 
86 
87 #endif // _USB_ENUM_H_
88