contiki/cpu/avr/dev/usb/usb_standard_request.h

89 lines
3.7 KiB
C

/* This file has been prepared for Doxygen automatic documentation generation.*/
/*! \file usb_standard_request.h *************************************************
*
* \brief
* This file contains the USB endpoint 0 management routines corresponding to
* the standard enumeration process (refer to chapter 9 of the USB
* specification.
* This file calls routines of the usb_specific_request.c file for non-standard
* request management.
* The enumeration parameters (descriptor tables) are contained in the
* usb_descriptors.c file.
*
* \addtogroup usbdriver
*
* \author
* Atmel Corporation: http://www.atmel.com \n
* Support email: avr@atmel.com
*
******************************************************************************/
/* Copyright (c) 2008 ATMEL Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef USB_ENUM_H_
#define USB_ENUM_H_
//_____ I N C L U D E S ____________________________________________________
#include "usb_task.h"
#include "usb_descriptors.h"
//_____ M A C R O S ________________________________________________________
//_____ S T A N D A R D D E F I N I T I O N S ___________________________
// Device State
#define ATTACHED 0
#define POWERED 1
#define DEFAULT 2
#define ADDRESSED 3
#define CONFIGURED 4
#define SUSPENDED 5
#define USB_CONFIG_ATTRIBUTES_RESERVED 0x80
#define USB_CONFIG_BUSPOWERED (USB_CONFIG_ATTRIBUTES_RESERVED | 0x00)
#define USB_CONFIG_SELFPOWERED (USB_CONFIG_ATTRIBUTES_RESERVED | 0x40)
#define USB_CONFIG_REMOTEWAKEUP (USB_CONFIG_ATTRIBUTES_RESERVED | 0x20)
//_____ D E C L A R A T I O N ______________________________________________
//! @brief Returns true when device connected and correctly enumerated with an host.
//! The device high level application should tests this before performing any applicative requests
#define Is_device_enumerated() ((usb_configuration_nb!=0) ? TRUE : FALSE)
#define Is_device_not_enumerated() ((usb_configuration_nb!=0) ? FALSE : TRUE)
void usb_process_request( void);
extern U8 usb_configuration_nb;
#endif //USB_ENUM_H_