Contiki 2.6

usb_standard_request.h

Go to the documentation of this file.
00001 /* This file has been prepared for Doxygen automatic documentation generation.*/
00002 /*! \file usb_standard_request.h *************************************************
00003  *
00004  * \brief
00005  *      This file contains the USB endpoint 0 management routines corresponding to
00006  *      the standard enumeration process (refer to chapter 9 of the USB
00007  *      specification.
00008  *      This file calls routines of the usb_specific_request.c file for non-standard
00009  *      request management.
00010  *      The enumeration parameters (descriptor tables) are contained in the
00011  *      usb_descriptors.c file.
00012  *
00013  * \addtogroup usbdriver
00014  *
00015  * \author
00016  *      Atmel Corporation: http://www.atmel.com \n
00017  *      Support email: avr@atmel.com
00018  *
00019  ******************************************************************************/
00020 /* Copyright (c) 2008  ATMEL Corporation
00021    All rights reserved.
00022 
00023    Redistribution and use in source and binary forms, with or without
00024    modification, are permitted provided that the following conditions are met:
00025 
00026    * Redistributions of source code must retain the above copyright
00027      notice, this list of conditions and the following disclaimer.
00028    * Redistributions in binary form must reproduce the above copyright
00029      notice, this list of conditions and the following disclaimer in
00030      the documentation and/or other materials provided with the
00031      distribution.
00032    * Neither the name of the copyright holders nor the names of
00033      contributors may be used to endorse or promote products derived
00034      from this software without specific prior written permission.
00035 
00036   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00037   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00038   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00039   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00040   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00041   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00042   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00043   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00044   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00045   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00046   POSSIBILITY OF SUCH DAMAGE.
00047 */
00048 
00049 #ifndef _USB_ENUM_H_
00050 #define _USB_ENUM_H_
00051 
00052 //_____ I N C L U D E S ____________________________________________________
00053 
00054 #include "usb_task.h"
00055 #include "usb_descriptors.h"
00056 
00057 //_____ M A C R O S ________________________________________________________
00058 
00059 //_____ S T A N D A R D    D E F I N I T I O N S ___________________________
00060 
00061         // Device State
00062 #define ATTACHED                          0
00063 #define POWERED                           1
00064 #define DEFAULT                           2
00065 #define ADDRESSED                         3
00066 #define CONFIGURED                        4
00067 #define SUSPENDED                         5
00068 
00069 #define USB_CONFIG_ATTRIBUTES_RESERVED    0x80
00070 #define USB_CONFIG_BUSPOWERED            (USB_CONFIG_ATTRIBUTES_RESERVED | 0x00)
00071 #define USB_CONFIG_SELFPOWERED           (USB_CONFIG_ATTRIBUTES_RESERVED | 0x40)
00072 #define USB_CONFIG_REMOTEWAKEUP          (USB_CONFIG_ATTRIBUTES_RESERVED | 0x20)
00073 
00074 //_____ D E C L A R A T I O N ______________________________________________
00075 
00076    //! @brief Returns true when device connected and correctly enumerated with an host.
00077    //! The device high level application should tests this before performing any applicative requests
00078 #define Is_device_enumerated()            ((usb_configuration_nb!=0)   ? TRUE : FALSE)
00079 #define Is_device_not_enumerated()        ((usb_configuration_nb!=0)   ? FALSE : TRUE)
00080 
00081 
00082 void    usb_process_request( void);
00083 
00084 extern  U8   usb_configuration_nb;
00085 
00086 
00087 #endif  // _USB_ENUM_H_
00088