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

usbmmap.h

Go to the documentation of this file.
00001 /*********************************************************************
00002  *
00003  *                Microchip USB C18 Firmware Version 1.0
00004  *
00005  *********************************************************************
00006  * FileName:        usbmmap.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 #ifndef USBMMAP_H
00038 #define USBMMAP_H
00039 
00040 /** I N C L U D E S **********************************************************/
00041 #include "system\typedefs.h"
00042 
00043 /** D E F I N I T I O N S ****************************************************/
00044 
00045 /* Buffer Descriptor Status Register Initialization Parameters */
00046 #define _BSTALL     0x04                //Buffer Stall enable
00047 #define _DTSEN      0x08                //Data Toggle Synch enable
00048 #define _INCDIS     0x10                //Address increment disable
00049 #define _KEN        0x20                //SIE keeps buff descriptors enable
00050 #define _DAT0       0x00                //DATA0 packet expected next
00051 #define _DAT1       0x40                //DATA1 packet expected next
00052 #define _DTSMASK    0x40                //DTS Mask
00053 #define _USIE       0x80                //SIE owns buffer
00054 #define _UCPU       0x00                //CPU owns buffer
00055 
00056 /* USB Device States - To be used with [byte usb_device_state] */
00057 #define DETACHED_STATE          0
00058 #define ATTACHED_STATE          1
00059 #define POWERED_STATE           2
00060 #define DEFAULT_STATE           3
00061 #define ADR_PENDING_STATE       4
00062 #define ADDRESS_STATE           5
00063 #define CONFIGURED_STATE        6
00064 
00065 /* Memory Types for Control Transfer - used in USB_DEVICE_STATUS */
00066 #define _RAM 0
00067 #define _ROM 1
00068 
00069 /** T Y P E S ****************************************************************/
00070 typedef union _USB_DEVICE_STATUS
00071 {
00072     byte _byte;
00073     struct
00074     {
00075         unsigned RemoteWakeup:1;// [0]Disabled [1]Enabled: See usbdrv.c,usb9.c
00076         unsigned ctrl_trf_mem:1;// [0]RAM      [1]ROM
00077     };
00078 } USB_DEVICE_STATUS;
00079 
00080 typedef union _BD_STAT
00081 {
00082     byte _byte;
00083     struct{
00084         unsigned BC8:1;
00085         unsigned BC9:1;
00086         unsigned BSTALL:1;              //Buffer Stall Enable
00087         unsigned DTSEN:1;               //Data Toggle Synch Enable
00088         unsigned INCDIS:1;              //Address Increment Disable
00089         unsigned KEN:1;                 //BD Keep Enable
00090         unsigned DTS:1;                 //Data Toggle Synch Value
00091         unsigned UOWN:1;                //USB Ownership
00092     };
00093     struct{
00094         unsigned BC8:1;
00095         unsigned BC9:1;
00096         unsigned PID0:1;
00097         unsigned PID1:1;
00098         unsigned PID2:1;
00099         unsigned PID3:1;
00100         unsigned :1;
00101         unsigned UOWN:1;
00102     };
00103     struct{
00104         unsigned :2;
00105         unsigned PID:4;                 //Packet Identifier
00106         unsigned :2;
00107     };
00108 } BD_STAT;                              //Buffer Descriptor Status Register
00109 
00110 typedef union _BDT
00111 {
00112     struct
00113     {
00114         BD_STAT Stat;
00115         byte Cnt;
00116         byte ADRL;                      //Buffer Address Low
00117         byte ADRH;                      //Buffer Address High
00118     };
00119     struct
00120     {
00121         unsigned :8;
00122         unsigned :8;
00123         byte* ADR;                      //Buffer Address
00124     };
00125 } BDT;                                  //Buffer Descriptor Table
00126 
00127 /** E X T E R N S ************************************************************/
00128 extern byte usb_device_state;
00129 extern USB_DEVICE_STATUS usb_stat;
00130 extern byte usb_active_cfg;
00131 extern byte usb_alt_intf[MAX_NUM_INT];
00132 
00133 extern volatile far BDT ep0Bo;          //Endpoint #0 BD Out
00134 extern volatile far BDT ep0Bi;          //Endpoint #0 BD In
00135 extern volatile far BDT ep1Bo;          //Endpoint #1 BD Out
00136 extern volatile far BDT ep1Bi;          //Endpoint #1 BD In
00137 extern volatile far BDT ep2Bo;          //Endpoint #2 BD Out
00138 extern volatile far BDT ep2Bi;          //Endpoint #2 BD In
00139 extern volatile far BDT ep3Bo;          //Endpoint #3 BD Out
00140 extern volatile far BDT ep3Bi;          //Endpoint #3 BD In
00141 extern volatile far BDT ep4Bo;          //Endpoint #4 BD Out
00142 extern volatile far BDT ep4Bi;          //Endpoint #4 BD In
00143 extern volatile far BDT ep5Bo;          //Endpoint #5 BD Out
00144 extern volatile far BDT ep5Bi;          //Endpoint #5 BD In
00145 extern volatile far BDT ep6Bo;          //Endpoint #6 BD Out
00146 extern volatile far BDT ep6Bi;          //Endpoint #6 BD In
00147 extern volatile far BDT ep7Bo;          //Endpoint #7 BD Out
00148 extern volatile far BDT ep7Bi;          //Endpoint #7 BD In
00149 extern volatile far BDT ep8Bo;          //Endpoint #8 BD Out
00150 extern volatile far BDT ep8Bi;          //Endpoint #8 BD In
00151 extern volatile far BDT ep9Bo;          //Endpoint #9 BD Out
00152 extern volatile far BDT ep9Bi;          //Endpoint #9 BD In
00153 extern volatile far BDT ep10Bo;         //Endpoint #10 BD Out
00154 extern volatile far BDT ep10Bi;         //Endpoint #10 BD In
00155 extern volatile far BDT ep11Bo;         //Endpoint #11 BD Out
00156 extern volatile far BDT ep11Bi;         //Endpoint #11 BD In
00157 extern volatile far BDT ep12Bo;         //Endpoint #12 BD Out
00158 extern volatile far BDT ep12Bi;         //Endpoint #12 BD In
00159 extern volatile far BDT ep13Bo;         //Endpoint #13 BD Out
00160 extern volatile far BDT ep13Bi;         //Endpoint #13 BD In
00161 extern volatile far BDT ep14Bo;         //Endpoint #14 BD Out
00162 extern volatile far BDT ep14Bi;         //Endpoint #14 BD In
00163 extern volatile far BDT ep15Bo;         //Endpoint #15 BD Out
00164 extern volatile far BDT ep15Bi;         //Endpoint #15 BD In
00165 
00166 extern volatile far CTRL_TRF_SETUP SetupPkt;
00167 extern volatile far CTRL_TRF_DATA CtrlTrfData;
00168 
00169 #if defined(USB_USE_CDC)
00170 extern volatile far unsigned char cdc_notice[CDC_INT_EP_SIZE];
00171 extern volatile far unsigned char cdc_data_rx[CDC_BULK_OUT_EP_SIZE];
00172 extern volatile far unsigned char cdc_data_tx[CDC_BULK_IN_EP_SIZE];
00173 #endif
00174 
00175 #endif //USBMMAP_H

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