00001 /*This file is prepared for Doxygen automatic documentation generation.*/ 00017 /* Copyright (c) 2009 Atmel Corporation. All rights reserved. 00018 * 00019 * Redistribution and use in source and binary forms, with or without 00020 * modification, are permitted provided that the following conditions are met: 00021 * 00022 * 1. Redistributions of source code must retain the above copyright notice, this 00023 * list of conditions and the following disclaimer. 00024 * 00025 * 2. Redistributions in binary form must reproduce the above copyright notice, 00026 * this list of conditions and the following disclaimer in the documentation 00027 * and/or other materials provided with the distribution. 00028 * 00029 * 3. The name of Atmel may not be used to endorse or promote products derived 00030 * from this software without specific prior written permission. 00031 * 00032 * 4. This software may only be redistributed and used in connection with an Atmel 00033 * AVR product. 00034 * 00035 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 00036 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00037 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00038 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 00039 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00040 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00041 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00042 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00043 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00044 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 00045 * 00046 */ 00047 00048 #ifndef _USB_DFU_H_ 00049 #define _USB_DFU_H_ 00050 00051 00052 //_____ I N C L U D E S ____________________________________________________ 00053 00054 #include "conf_usb.h" 00055 00056 #if USB_DEVICE_FEATURE == DISABLED 00057 #error usb_dfu.h is #included although USB_DEVICE_FEATURE is disabled 00058 #endif 00059 00060 00061 #include "compiler.h" 00062 00063 00064 //_____ M A C R O S ________________________________________________________ 00065 00066 // DFU status 00067 #define STATUS_OK 0x00 00068 #define STATUS_errTARGET 0x01 00069 #define STATUS_errFILE 0x02 00070 #define STATUS_errWRITE 0x03 00071 #define STATUS_errERASE 0x04 00072 #define STATUS_errCHECK_ERASED 0x05 00073 #define STATUS_errPROG 0x06 00074 #define STATUS_errVERIFY 0x07 00075 #define STATUS_errADDRESS 0x08 00076 #define STATUS_errNOTDONE 0x09 00077 #define STATUS_errFIRMWARE 0x0A 00078 #define STATUS_errVENDOR 0x0B 00079 #define STATUS_errUSBR 0x0C 00080 #define STATUS_errPOR 0x0D 00081 #define STATUS_errUNKNOWN 0x0E 00082 #define STATUS_errSTALLEDPKT 0x0F 00083 00084 // DFU state 00085 #define STATE_appIDLE 0x00 00086 #define STATE_appDETACH 0x01 00087 #define STATE_dfuIDLE 0x02 00088 #define STATE_dfuDNLOAD_SYNC 0x03 00089 #define STATE_dfuDNBUSY 0x04 00090 #define STATE_dfuDNLOAD_IDLE 0x05 00091 #define STATE_dfuMANIFEST_SYNC 0x06 00092 #define STATE_dfuMANIFEST 0x07 00093 #define STATE_dfuMANIFEST_WAIT_RESET 0x08 00094 #define STATE_dfuUPLOAD_IDLE 0x09 00095 #define STATE_dfuERROR 0x0A 00096 00097 00098 //_____ D E C L A R A T I O N S ____________________________________________ 00099 00100 extern U8 usb_dfu_status; 00101 extern U8 usb_dfu_state; 00102 00103 extern void usb_dfu_init(void); 00104 extern Bool usb_dfu_dnload(void); 00105 extern Bool usb_dfu_upload(void); 00106 00107 00108 #endif // _USB_DFU_H_