00001 /********************************************************************* 00002 * 00003 * Microchip USB C18 Firmware Version 1.0 00004 * 00005 ********************************************************************* 00006 * FileName: usbdefs_std_dsc.h 00007 * Dependencies: See INCLUDES section below 00008 * Processor: PIC18 00009 * Compiler: C18 2.30.01+ 00010 * Company: Microchip Technology, Inc. 00011 * 00012 * Software License Agreement 00013 * 00014 * The software supplied herewith by Microchip Technology Incorporated 00015 * (the “Company”) for its PICmicro® Microcontroller is intended and 00016 * supplied to you, the Company’s customer, for use solely and 00017 * exclusively on Microchip PICmicro Microcontroller products. The 00018 * software is owned by the Company and/or its supplier, and is 00019 * protected under applicable copyright laws. All rights are reserved. 00020 * Any use in violation of the foregoing restrictions may subject the 00021 * user to criminal sanctions under applicable laws, as well as to 00022 * civil liability for the breach of the terms and conditions of this 00023 * license. 00024 * 00025 * THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES, 00026 * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED 00027 * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00028 * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, 00029 * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR 00030 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. 00031 * 00032 * Author Date Comment 00033 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00034 * Rawin Rojvanit 11/19/04 Original. 00035 ********************************************************************/ 00036 00037 /****************************************************************************** 00038 * USB Definitions: Standard Descriptors 00039 *****************************************************************************/ 00040 #ifndef USBDEFS_STD_DSC_H 00041 #define USBDEFS_STD_DSC_H 00042 00043 /** I N C L U D E S **********************************************************/ 00044 #include "system\typedefs.h" 00045 00046 /** D E F I N I T I O N S ****************************************************/ 00047 00048 /* Descriptor Types */ 00049 #define DSC_DEV 0x01 00050 #define DSC_CFG 0x02 00051 #define DSC_STR 0x03 00052 #define DSC_INTF 0x04 00053 #define DSC_EP 0x05 00054 00055 /****************************************************************************** 00056 * USB Endpoint Definitions 00057 * USB Standard EP Address Format: DIR:X:X:X:EP3:EP2:EP1:EP0 00058 * This is used in the descriptors. See autofiles\usbdsc.c 00059 * 00060 * NOTE: Do not use these values for checking against USTAT. 00061 * To check against USTAT, use values defined in "system\usb\usbdrv\usbdrv.h" 00062 *****************************************************************************/ 00063 #define _EP01_OUT 0x01 00064 #define _EP01_IN 0x81 00065 #define _EP02_OUT 0x02 00066 #define _EP02_IN 0x82 00067 #define _EP03_OUT 0x03 00068 #define _EP03_IN 0x83 00069 #define _EP04_OUT 0x04 00070 #define _EP04_IN 0x84 00071 #define _EP05_OUT 0x05 00072 #define _EP05_IN 0x85 00073 #define _EP06_OUT 0x06 00074 #define _EP06_IN 0x86 00075 #define _EP07_OUT 0x07 00076 #define _EP07_IN 0x87 00077 #define _EP08_OUT 0x08 00078 #define _EP08_IN 0x88 00079 #define _EP09_OUT 0x09 00080 #define _EP09_IN 0x89 00081 #define _EP10_OUT 0x0A 00082 #define _EP10_IN 0x8A 00083 #define _EP11_OUT 0x0B 00084 #define _EP11_IN 0x8B 00085 #define _EP12_OUT 0x0C 00086 #define _EP12_IN 0x8C 00087 #define _EP13_OUT 0x0D 00088 #define _EP13_IN 0x8D 00089 #define _EP14_OUT 0x0E 00090 #define _EP14_IN 0x8E 00091 #define _EP15_OUT 0x0F 00092 #define _EP15_IN 0x8F 00093 00094 /* Configuration Attributes */ 00095 #define _DEFAULT 0x01<<7 //Default Value (Bit 7 is set) 00096 #define _SELF 0x01<<6 //Self-powered (Supports if set) 00097 #define _RWU 0x01<<5 //Remote Wakeup (Supports if set) 00098 00099 /* Endpoint Transfer Type */ 00100 #define _CTRL 0x00 //Control Transfer 00101 #define _ISO 0x01 //Isochronous Transfer 00102 #define _BULK 0x02 //Bulk Transfer 00103 #define _INT 0x03 //Interrupt Transfer 00104 00105 /* Isochronous Endpoint Synchronization Type */ 00106 #define _NS 0x00<<2 //No Synchronization 00107 #define _AS 0x01<<2 //Asynchronous 00108 #define _AD 0x02<<2 //Adaptive 00109 #define _SY 0x03<<2 //Synchronous 00110 00111 /* Isochronous Endpoint Usage Type */ 00112 #define _DE 0x00<<4 //Data endpoint 00113 #define _FE 0x01<<4 //Feedback endpoint 00114 #define _IE 0x02<<4 //Implicit feedback Data endpoint 00115 00116 00117 /** S T R U C T U R E ********************************************************/ 00118 00119 /****************************************************************************** 00120 * USB Device Descriptor Structure 00121 *****************************************************************************/ 00122 typedef struct _USB_DEV_DSC 00123 { 00124 byte bLength; byte bDscType; word bcdUSB; 00125 byte bDevCls; byte bDevSubCls; byte bDevProtocol; 00126 byte bMaxPktSize0; word idVendor; word idProduct; 00127 word bcdDevice; byte iMFR; byte iProduct; 00128 byte iSerialNum; byte bNumCfg; 00129 } USB_DEV_DSC; 00130 00131 /****************************************************************************** 00132 * USB Configuration Descriptor Structure 00133 *****************************************************************************/ 00134 typedef struct _USB_CFG_DSC 00135 { 00136 byte bLength; byte bDscType; word wTotalLength; 00137 byte bNumIntf; byte bCfgValue; byte iCfg; 00138 byte bmAttributes; byte bMaxPower; 00139 } USB_CFG_DSC; 00140 00141 /****************************************************************************** 00142 * USB Interface Descriptor Structure 00143 *****************************************************************************/ 00144 typedef struct _USB_INTF_DSC 00145 { 00146 byte bLength; byte bDscType; byte bIntfNum; 00147 byte bAltSetting; byte bNumEPs; byte bIntfCls; 00148 byte bIntfSubCls; byte bIntfProtocol; byte iIntf; 00149 } USB_INTF_DSC; 00150 00151 /****************************************************************************** 00152 * USB Endpoint Descriptor Structure 00153 *****************************************************************************/ 00154 typedef struct _USB_EP_DSC 00155 { 00156 byte bLength; byte bDscType; byte bEPAdr; 00157 byte bmAttributes; word wMaxPktSize; byte bInterval; 00158 } USB_EP_DSC; 00159 00160 #endif //USBDEFS_STD_DSC_H