firmware/usbdefs_std_dsc.h
author root@rika
Thu, 23 Apr 2009 19:10:12 +0200
changeset 30 7fd00015f62f
parent 2 2f55e5dd591d
permissions -rw-r--r--
several changes..
     1 /*********************************************************************
     2  *
     3  *                Microchip USB C18 Firmware Version 1.0
     4  *
     5  *********************************************************************
     6  * FileName:        usbdefs_std_dsc.h
     7  * Dependencies:    See INCLUDES section below
     8  * Processor:       PIC18
     9  * Compiler:        C18 2.30.01+
    10  * Company:         Microchip Technology, Inc.
    11  *
    12  * Software License Agreement
    13  *
    14  * The software supplied herewith by Microchip Technology Incorporated
    15  * (the “Company”) for its PICmicro® Microcontroller is intended and
    16  * supplied to you, the Company’s customer, for use solely and
    17  * exclusively on Microchip PICmicro Microcontroller products. The
    18  * software is owned by the Company and/or its supplier, and is
    19  * protected under applicable copyright laws. All rights are reserved.
    20  * Any use in violation of the foregoing restrictions may subject the
    21  * user to criminal sanctions under applicable laws, as well as to
    22  * civil liability for the breach of the terms and conditions of this
    23  * license.
    24  *
    25  * THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
    26  * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
    27  * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
    28  * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
    29  * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
    30  * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
    31  *
    32  * Author               Date        Comment
    33  *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    34  * Rawin Rojvanit       11/19/04    Original.
    35  ********************************************************************/
    36 
    37 /******************************************************************************
    38  * USB Definitions: Standard Descriptors
    39  *****************************************************************************/
    40 #ifndef USBDEFS_STD_DSC_H
    41 #define USBDEFS_STD_DSC_H
    42 
    43 /** I N C L U D E S **********************************************************/
    44 #include "typedefs.h"
    45 
    46 /** D E F I N I T I O N S ****************************************************/
    47 
    48 /* Descriptor Types */
    49 #define DSC_DEV     0x01
    50 #define DSC_CFG     0x02
    51 #define DSC_STR     0x03
    52 #define DSC_INTF    0x04
    53 #define DSC_EP      0x05
    54 
    55 /******************************************************************************
    56  * USB Endpoint Definitions
    57  * USB Standard EP Address Format: DIR:X:X:X:EP3:EP2:EP1:EP0
    58  * This is used in the descriptors. See autofiles\usbdsc.c
    59  * 
    60  * NOTE: Do not use these values for checking against USTAT.
    61  * To check against USTAT, use values defined in "system\usb\usbdrv\usbdrv.h"
    62  *****************************************************************************/
    63 #define _EP01_OUT   0x01
    64 #define _EP01_IN    0x81
    65 #define _EP02_OUT   0x02
    66 #define _EP02_IN    0x82
    67 #define _EP03_OUT   0x03
    68 #define _EP03_IN    0x83
    69 #define _EP04_OUT   0x04
    70 #define _EP04_IN    0x84
    71 #define _EP05_OUT   0x05
    72 #define _EP05_IN    0x85
    73 #define _EP06_OUT   0x06
    74 #define _EP06_IN    0x86
    75 #define _EP07_OUT   0x07
    76 #define _EP07_IN    0x87
    77 #define _EP08_OUT   0x08
    78 #define _EP08_IN    0x88
    79 #define _EP09_OUT   0x09
    80 #define _EP09_IN    0x89
    81 #define _EP10_OUT   0x0A
    82 #define _EP10_IN    0x8A
    83 #define _EP11_OUT   0x0B
    84 #define _EP11_IN    0x8B
    85 #define _EP12_OUT   0x0C
    86 #define _EP12_IN    0x8C
    87 #define _EP13_OUT   0x0D
    88 #define _EP13_IN    0x8D
    89 #define _EP14_OUT   0x0E
    90 #define _EP14_IN    0x8E
    91 #define _EP15_OUT   0x0F
    92 #define _EP15_IN    0x8F
    93 
    94 /* Configuration Attributes */
    95 #define _DEFAULT    0x01<<7         //Default Value (Bit 7 is set)
    96 #define _SELF       0x01<<6         //Self-powered (Supports if set)
    97 #define _RWU        0x01<<5         //Remote Wakeup (Supports if set)
    98 
    99 /* Endpoint Transfer Type */
   100 #define _CTRL       0x00            //Control Transfer
   101 #define _ISO        0x01            //Isochronous Transfer
   102 #define _BULK       0x02            //Bulk Transfer
   103 #define _INT        0x03            //Interrupt Transfer
   104 
   105 /* Isochronous Endpoint Synchronization Type */
   106 #define _NS         0x00<<2         //No Synchronization
   107 #define _AS         0x01<<2         //Asynchronous
   108 #define _AD         0x02<<2         //Adaptive
   109 #define _SY         0x03<<2         //Synchronous
   110 
   111 /* Isochronous Endpoint Usage Type */
   112 #define _DE         0x00<<4         //Data endpoint
   113 #define _FE         0x01<<4         //Feedback endpoint
   114 #define _IE         0x02<<4         //Implicit feedback Data endpoint
   115 
   116 
   117 /** S T R U C T U R E ********************************************************/
   118 
   119 /******************************************************************************
   120  * USB Device Descriptor Structure
   121  *****************************************************************************/
   122 typedef struct _USB_DEV_DSC
   123 {
   124     byte bLength;       byte bDscType;      word bcdUSB;
   125     byte bDevCls;       byte bDevSubCls;    byte bDevProtocol;
   126     byte bMaxPktSize0;  word idVendor;      word idProduct;
   127     word bcdDevice;     byte iMFR;          byte iProduct;
   128     byte iSerialNum;    byte bNumCfg;
   129 } USB_DEV_DSC;
   130 
   131 /******************************************************************************
   132  * USB Configuration Descriptor Structure
   133  *****************************************************************************/
   134 typedef struct _USB_CFG_DSC
   135 {
   136     byte bLength;       byte bDscType;      word wTotalLength;
   137     byte bNumIntf;      byte bCfgValue;     byte iCfg;
   138     byte bmAttributes;  byte bMaxPower;
   139 } USB_CFG_DSC;
   140 
   141 /******************************************************************************
   142  * USB Interface Descriptor Structure
   143  *****************************************************************************/
   144 typedef struct _USB_INTF_DSC
   145 {
   146     byte bLength;       byte bDscType;      byte bIntfNum;
   147     byte bAltSetting;   byte bNumEPs;       byte bIntfCls;
   148     byte bIntfSubCls;   byte bIntfProtocol; byte iIntf;
   149 } USB_INTF_DSC;
   150 
   151 /******************************************************************************
   152  * USB Endpoint Descriptor Structure
   153  *****************************************************************************/
   154 typedef struct _USB_EP_DSC
   155 {
   156     byte bLength;       byte bDscType;      byte bEPAdr;
   157     byte bmAttributes;  word wMaxPktSize;   byte bInterval;
   158 } USB_EP_DSC;
   159 
   160 #endif //USBDEFS_STD_DSC_H