Main Page | Data Structures | Directories | File List | Data Fields | Globals

usbdefs_ep0_buff.h

Go to the documentation of this file.
00001 /*********************************************************************
00002  *
00003  *                Microchip USB C18 Firmware Version 1.0
00004  *
00005  *********************************************************************
00006  * FileName:        usbdefs_ep0_buff.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: Endpoint 0 Buffer
00039  *****************************************************************************/
00040 #ifndef USBDEFS_EP0_BUFF_H
00041 #define USBDEFS_EP0_BUFF_H
00042 
00043 /** I N C L U D E S **********************************************************/
00044 #include "system\typedefs.h"
00045 #include "autofiles\usbcfg.h"       // usbcfg.h contains required definitions
00046 
00047 /******************************************************************************
00048  * CTRL_TRF_SETUP:
00049  *
00050  * Every setup packet has 8 bytes.
00051  * However, the buffer size has to equal the EP0_BUFF_SIZE value specified
00052  * in autofiles\usbcfg.h
00053  * The value of EP0_BUFF_SIZE can be 8, 16, 32, or 64.
00054  *
00055  * First 8 bytes are defined to be directly addressable to improve speed
00056  * and reduce code size.
00057  * Bytes beyond the 8th byte have to be accessed using indirect addressing.
00058  *****************************************************************************/
00059 typedef union _CTRL_TRF_SETUP
00060 {
00061     /** Array for indirect addressing ****************************************/
00062     struct
00063     {
00064         byte _byte[EP0_BUFF_SIZE];
00065     };
00066     
00067     /** Standard Device Requests *********************************************/
00068     struct
00069     {
00070         byte bmRequestType;
00071         byte bRequest;    
00072         word wValue;
00073         word wIndex;
00074         word wLength;
00075     };
00076     struct
00077     {
00078         unsigned :8;
00079         unsigned :8;
00080         WORD W_Value;
00081         WORD W_Index;
00082         WORD W_Length;
00083     };
00084     struct
00085     {
00086         unsigned Recipient:5;           //Device,Interface,Endpoint,Other
00087         unsigned RequestType:2;         //Standard,Class,Vendor,Reserved
00088         unsigned DataDir:1;             //Host-to-device,Device-to-host
00089         unsigned :8;
00090         byte bFeature;                  //DEVICE_REMOTE_WAKEUP,ENDPOINT_HALT
00091         unsigned :8;
00092         unsigned :8;
00093         unsigned :8;
00094         unsigned :8;
00095         unsigned :8;
00096     };
00097     struct
00098     {
00099         unsigned :8;
00100         unsigned :8;
00101         byte bDscIndex;                 //For Configuration and String DSC Only
00102         byte bDscType;                  //Device,Configuration,String
00103         word wLangID;                   //Language ID
00104         unsigned :8;
00105         unsigned :8;
00106     };
00107     struct
00108     {
00109         unsigned :8;
00110         unsigned :8;
00111         BYTE bDevADR;                   //Device Address 0-127
00112         byte bDevADRH;                  //Must equal zero
00113         unsigned :8;
00114         unsigned :8;
00115         unsigned :8;
00116         unsigned :8;
00117     };
00118     struct
00119     {
00120         unsigned :8;
00121         unsigned :8;
00122         byte bCfgValue;                 //Configuration Value 0-255
00123         byte bCfgRSD;                   //Must equal zero (Reserved)
00124         unsigned :8;
00125         unsigned :8;
00126         unsigned :8;
00127         unsigned :8;
00128     };
00129     struct
00130     {
00131         unsigned :8;
00132         unsigned :8;
00133         byte bAltID;                    //Alternate Setting Value 0-255
00134         byte bAltID_H;                  //Must equal zero
00135         byte bIntfID;                   //Interface Number Value 0-255
00136         byte bIntfID_H;                 //Must equal zero
00137         unsigned :8;
00138         unsigned :8;
00139     };
00140     struct
00141     {
00142         unsigned :8;
00143         unsigned :8;
00144         unsigned :8;
00145         unsigned :8;
00146         byte bEPID;                     //Endpoint ID (Number & Direction)
00147         byte bEPID_H;                   //Must equal zero
00148         unsigned :8;
00149         unsigned :8;
00150     };
00151     struct
00152     {
00153         unsigned :8;
00154         unsigned :8;
00155         unsigned :8;
00156         unsigned :8;
00157         unsigned EPNum:4;               //Endpoint Number 0-15
00158         unsigned :3;
00159         unsigned EPDir:1;               //Endpoint Direction: 0-OUT, 1-IN
00160         unsigned :8;
00161         unsigned :8;
00162         unsigned :8;
00163     };
00164     /** End: Standard Device Requests ****************************************/
00165     
00166 } CTRL_TRF_SETUP;
00167 
00168 /******************************************************************************
00169  * CTRL_TRF_DATA:
00170  *
00171  * Buffer size has to equal the EP0_BUFF_SIZE value specified
00172  * in autofiles\usbcfg.h
00173  * The value of EP0_BUFF_SIZE can be 8, 16, 32, or 64.
00174  *
00175  * First 8 bytes are defined to be directly addressable to improve speed
00176  * and reduce code size.
00177  * Bytes beyond the 8th byte have to be accessed using indirect addressing.
00178  *****************************************************************************/
00179 typedef union _CTRL_TRF_DATA
00180 {
00181     /** Array for indirect addressing ****************************************/
00182     struct
00183     {
00184         byte _byte[EP0_BUFF_SIZE];
00185     };
00186     
00187     /** First 8-byte direct addressing ***************************************/
00188     struct
00189     {
00190         byte _byte0;
00191         byte _byte1;
00192         byte _byte2;
00193         byte _byte3;
00194         byte _byte4;
00195         byte _byte5;
00196         byte _byte6;
00197         byte _byte7;
00198     };
00199     struct
00200     {
00201         word _word0;
00202         word _word1;
00203         word _word2;
00204         word _word3;
00205     };
00206 
00207 } CTRL_TRF_DATA;
00208 
00209 #endif //USBDEFS_EP0_BUFF_H

Generated on Wed Jun 8 03:49:39 2005 for cdc by  doxygen 1.4.2