1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/firmware/usbdefs_ep0_buff.h Tue Jan 29 22:31:52 2008 +0100
1.3 @@ -0,0 +1,209 @@
1.4 +/*********************************************************************
1.5 + *
1.6 + * Microchip USB C18 Firmware Version 1.0
1.7 + *
1.8 + *********************************************************************
1.9 + * FileName: usbdefs_ep0_buff.h
1.10 + * Dependencies: See INCLUDES section below
1.11 + * Processor: PIC18
1.12 + * Compiler: C18 2.30.01+
1.13 + * Company: Microchip Technology, Inc.
1.14 + *
1.15 + * Software License Agreement
1.16 + *
1.17 + * The software supplied herewith by Microchip Technology Incorporated
1.18 + * (the “Company”) for its PICmicro® Microcontroller is intended and
1.19 + * supplied to you, the Company’s customer, for use solely and
1.20 + * exclusively on Microchip PICmicro Microcontroller products. The
1.21 + * software is owned by the Company and/or its supplier, and is
1.22 + * protected under applicable copyright laws. All rights are reserved.
1.23 + * Any use in violation of the foregoing restrictions may subject the
1.24 + * user to criminal sanctions under applicable laws, as well as to
1.25 + * civil liability for the breach of the terms and conditions of this
1.26 + * license.
1.27 + *
1.28 + * THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
1.29 + * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
1.30 + * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
1.31 + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
1.32 + * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
1.33 + * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
1.34 + *
1.35 + * Author Date Comment
1.36 + *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.37 + * Rawin Rojvanit 11/19/04 Original.
1.38 + ********************************************************************/
1.39 +
1.40 +/******************************************************************************
1.41 + * USB Definitions: Endpoint 0 Buffer
1.42 + *****************************************************************************/
1.43 +#ifndef USBDEFS_EP0_BUFF_H
1.44 +#define USBDEFS_EP0_BUFF_H
1.45 +
1.46 +/** I N C L U D E S **********************************************************/
1.47 +#include "typedefs.h"
1.48 +#include "usbcfg.h" // usbcfg.h contains required definitions
1.49 +
1.50 +/******************************************************************************
1.51 + * CTRL_TRF_SETUP:
1.52 + *
1.53 + * Every setup packet has 8 bytes.
1.54 + * However, the buffer size has to equal the EP0_BUFF_SIZE value specified
1.55 + * in autofiles\usbcfg.h
1.56 + * The value of EP0_BUFF_SIZE can be 8, 16, 32, or 64.
1.57 + *
1.58 + * First 8 bytes are defined to be directly addressable to improve speed
1.59 + * and reduce code size.
1.60 + * Bytes beyond the 8th byte have to be accessed using indirect addressing.
1.61 + *****************************************************************************/
1.62 +typedef union _CTRL_TRF_SETUP
1.63 +{
1.64 + /** Array for indirect addressing ****************************************/
1.65 + struct
1.66 + {
1.67 + byte _byte[EP0_BUFF_SIZE];
1.68 + };
1.69 +
1.70 + /** Standard Device Requests *********************************************/
1.71 + struct
1.72 + {
1.73 + byte bmRequestType;
1.74 + byte bRequest;
1.75 + word wValue;
1.76 + word wIndex;
1.77 + word wLength;
1.78 + };
1.79 + struct
1.80 + {
1.81 + unsigned :8;
1.82 + unsigned :8;
1.83 + WORD W_Value;
1.84 + WORD W_Index;
1.85 + WORD W_Length;
1.86 + };
1.87 + struct
1.88 + {
1.89 + unsigned Recipient:5; //Device,Interface,Endpoint,Other
1.90 + unsigned RequestType:2; //Standard,Class,Vendor,Reserved
1.91 + unsigned DataDir:1; //Host-to-device,Device-to-host
1.92 + unsigned :8;
1.93 + byte bFeature; //DEVICE_REMOTE_WAKEUP,ENDPOINT_HALT
1.94 + unsigned :8;
1.95 + unsigned :8;
1.96 + unsigned :8;
1.97 + unsigned :8;
1.98 + unsigned :8;
1.99 + };
1.100 + struct
1.101 + {
1.102 + unsigned :8;
1.103 + unsigned :8;
1.104 + byte bDscIndex; //For Configuration and String DSC Only
1.105 + byte bDscType; //Device,Configuration,String
1.106 + word wLangID; //Language ID
1.107 + unsigned :8;
1.108 + unsigned :8;
1.109 + };
1.110 + struct
1.111 + {
1.112 + unsigned :8;
1.113 + unsigned :8;
1.114 + BYTE bDevADR; //Device Address 0-127
1.115 + byte bDevADRH; //Must equal zero
1.116 + unsigned :8;
1.117 + unsigned :8;
1.118 + unsigned :8;
1.119 + unsigned :8;
1.120 + };
1.121 + struct
1.122 + {
1.123 + unsigned :8;
1.124 + unsigned :8;
1.125 + byte bCfgValue; //Configuration Value 0-255
1.126 + byte bCfgRSD; //Must equal zero (Reserved)
1.127 + unsigned :8;
1.128 + unsigned :8;
1.129 + unsigned :8;
1.130 + unsigned :8;
1.131 + };
1.132 + struct
1.133 + {
1.134 + unsigned :8;
1.135 + unsigned :8;
1.136 + byte bAltID; //Alternate Setting Value 0-255
1.137 + byte bAltID_H; //Must equal zero
1.138 + byte bIntfID; //Interface Number Value 0-255
1.139 + byte bIntfID_H; //Must equal zero
1.140 + unsigned :8;
1.141 + unsigned :8;
1.142 + };
1.143 + struct
1.144 + {
1.145 + unsigned :8;
1.146 + unsigned :8;
1.147 + unsigned :8;
1.148 + unsigned :8;
1.149 + byte bEPID; //Endpoint ID (Number & Direction)
1.150 + byte bEPID_H; //Must equal zero
1.151 + unsigned :8;
1.152 + unsigned :8;
1.153 + };
1.154 + struct
1.155 + {
1.156 + unsigned :8;
1.157 + unsigned :8;
1.158 + unsigned :8;
1.159 + unsigned :8;
1.160 + unsigned EPNum:4; //Endpoint Number 0-15
1.161 + unsigned :3;
1.162 + unsigned EPDir:1; //Endpoint Direction: 0-OUT, 1-IN
1.163 + unsigned :8;
1.164 + unsigned :8;
1.165 + unsigned :8;
1.166 + };
1.167 + /** End: Standard Device Requests ****************************************/
1.168 +
1.169 +} CTRL_TRF_SETUP;
1.170 +
1.171 +/******************************************************************************
1.172 + * CTRL_TRF_DATA:
1.173 + *
1.174 + * Buffer size has to equal the EP0_BUFF_SIZE value specified
1.175 + * in autofiles\usbcfg.h
1.176 + * The value of EP0_BUFF_SIZE can be 8, 16, 32, or 64.
1.177 + *
1.178 + * First 8 bytes are defined to be directly addressable to improve speed
1.179 + * and reduce code size.
1.180 + * Bytes beyond the 8th byte have to be accessed using indirect addressing.
1.181 + *****************************************************************************/
1.182 +typedef union _CTRL_TRF_DATA
1.183 +{
1.184 + /** Array for indirect addressing ****************************************/
1.185 + struct
1.186 + {
1.187 + byte _byte[EP0_BUFF_SIZE];
1.188 + };
1.189 +
1.190 + /** First 8-byte direct addressing ***************************************/
1.191 + struct
1.192 + {
1.193 + byte _byte0;
1.194 + byte _byte1;
1.195 + byte _byte2;
1.196 + byte _byte3;
1.197 + byte _byte4;
1.198 + byte _byte5;
1.199 + byte _byte6;
1.200 + byte _byte7;
1.201 + };
1.202 + struct
1.203 + {
1.204 + word _word0;
1.205 + word _word1;
1.206 + word _word2;
1.207 + word _word3;
1.208 + };
1.209 +
1.210 +} CTRL_TRF_DATA;
1.211 +
1.212 +#endif //USBDEFS_EP0_BUFF_H