- Main Page
- Data Structures
- Files

- File List
- Globals

# defMSP430USB.h

Go to the documentation of this file.

    00001 //******************************************************************************
    00002 //THIS PROGRAM IS PROVIDED "AS IS". TI MAKES NO WARRANTIES OR
    00003 //REPRESENTATIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
    00004 //INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
    00005 //FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR
    00006 //COMPLETENESS OF RESPONSES, RESULTS AND LACK OF NEGLIGENCE.
    00007 //TI DISCLAIMS ANY WARRANTY OF TITLE, QUIET ENJOYMENT, QUIET
    00008 //POSSESSION, AND NON-INFRINGEMENT OF ANY THIRD PARTY
    00009 //INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE PROGRAM OR
    00010 //YOUR USE OF THE PROGRAM.
    00011 //
    00012 //IN NO EVENT SHALL TI BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
    00013 //CONSEQUENTIAL OR INDIRECT DAMAGES, HOWEVER CAUSED, ON ANY
    00014 //THEORY OF LIABILITY AND WHETHER OR NOT TI HAS BEEN ADVISED
    00015 //OF THE POSSIBILITY OF SUCH DAMAGES, ARISING IN ANY WAY OUT
    00016 //OF THIS AGREEMENT, THE PROGRAM, OR YOUR USE OF THE PROGRAM.
    00017 //EXCLUDED DAMAGES INCLUDE, BUT ARE NOT LIMITED TO, COST OF
    00018 //REMOVAL OR REINSTALLATION, COMPUTER TIME, LABOR COSTS, LOSS
    00019 //OF GOODWILL, LOSS OF PROFITS, LOSS OF SAVINGS, OR LOSS OF
    00020 //USE OR INTERRUPTION OF BUSINESS. IN NO EVENT WILL TI'S
    00021 //AGGREGATE LIABILITY UNDER THIS AGREEMENT OR ARISING OUT OF
    00022 //YOUR USE OF THE PROGRAM EXCEED FIVE HUNDRED DOLLARS
    00023 //(U.S.$500).
    00024 //
    00025 //Unless otherwise stated, the Program written and copyrighted
    00026 //by Texas Instruments is distributed as "freeware".  You may,
    00027 //only under TI's copyright in the Program, use and modify the
    00028 //Program without any charge or restriction.  You may
    00029 //distribute to third parties, provided that you transfer a
    00030 //copy of this license to the third party and the third party
    00031 //agrees to these terms by its first use of the Program. You
    00032 //must reproduce the copyright notice and any other legend of
    00033 //ownership on each copy or partial copy, of the Program.
    00034 //
    00035 //You acknowledge and agree that the Program contains
    00036 //copyrighted material, trade secrets and other TI proprietary
    00037 //information and is protected by copyright laws,
    00038 //international copyright treaties, and trade secret laws, as
    00039 //well as other intellectual property laws.  To protect TI's
    00040 //rights in the Program, you agree not to decompile, reverse
    00041 //engineer, disassemble or otherwise translate any object code
    00042 //versions of the Program to a human-readable form.  You agree
    00043 //that in no event will you alter, remove or destroy any
    00044 //copyright notice included in the Program.  TI reserves all
    00045 //rights not specifically granted under this license. Except
    00046 //as specifically provided herein, nothing in this agreement
    00047 //shall be construed as conferring by implication, estoppel,
    00048 //or otherwise, upon you, any license or other right under any
    00049 //TI patents, copyrights or trade secrets.
    00050 //
    00051 //You may not use the Program in non-TI devices.
    00063 // (c)2009 by Texas Instruments Incorporated, All Rights Reserved.
    00064 /*----------------------------------------------------------------------------+
    00065 |                                                                             |
    00066 |                              Texas Instruments                              |
    00067 |                                                                             |
    00068 |                          MSP430 USB-Example (CDC/HID Driver)                |
    00069 |                                                                             |
    00070 +-----------------------------------------------------------------------------+
    00071 |  Source: defMSP430USB.h, v1.18 2009/06/11                                   |
    00072 |  Author: RSTO                                                               |
    00073 |                                                                             |
    00074 |  Description:                                                               |
    00075 |  Contains USB Constants, Type Definitions & Macros                          |
    00076 |                                                                             |
    00077 |  WHO          WHEN         WHAT                                             |
    00078 |  ---          ----------   ------------------------------------------------ |
    00079 |  RSTO         2008/09/03   born                                             |
    00080 +----------------------------------------------------------------------------*/
    00081
    00082 #ifndef _defMSP430USB_H
    00083 #define _defMSP430USB_H
    00084
    00085 /*----------------------------------------------------------------------------+
    00086 | Constant Definitions                                                        |
    00087 +----------------------------------------------------------------------------*/
    00088 #define YES         1
    00089 #define NO          0
    00090
    00091 #define TRUE        1
    00092 #define FALSE       0
    00093
    00094 #define NOERR       0
    00095 #define ERR         1
    00096
    00097 #define NO_ERROR    0
    00098 #define ERROR       1
    00099
    00100 #define DISABLE     0
    00101 #define ENABLE      1
    00102
    00103
    00104 /*----------------------------------------------------------------------------+
    00105 | USB Constants, Type Definition & Macro                                      |
    00106 +----------------------------------------------------------------------------*/
    00107
    00108 // USB related Constant
    00109 #define MAX_ENDPOINT_NUMBER     0x07    // A maximum of 7 endpoints is available
    00110 #define EP0_MAX_PACKET_SIZE     0x08
    00111 #define EP0_PACKET_SIZE         0x08
    00112 #define EP_MAX_PACKET_SIZE      0x40
    00113
    00114 // Base addresses of transmit and receive buffers
    00115 #define OEP1_X_BUFFER_ADDRESS   0x1C00  // Input  Endpoint 1 X Buffer Base-address
    00116 #define OEP1_Y_BUFFER_ADDRESS   0x1C40  // Input  Endpoint 1 Y Buffer Base-address
    00117 #define IEP1_X_BUFFER_ADDRESS   0x1C80  // Output Endpoint 1 X Buffer Base-address
    00118 #define IEP1_Y_BUFFER_ADDRESS   0x1CC0  // Output Endpoint 1 Y Buffer Base-address
    00119
    00120 #define OEP2_X_BUFFER_ADDRESS   0x1D00  // Input  Endpoint 2 X Buffer Base-address
    00121 #define OEP2_Y_BUFFER_ADDRESS   0x1D40  // Input  Endpoint 2 Y Buffer Base-address
    00122 #define IEP2_X_BUFFER_ADDRESS   0x1D80  // Output Endpoint 2 X Buffer Base-address
    00123 #define IEP2_Y_BUFFER_ADDRESS   0x1DC0  // Output Endpoint 2 Y Buffer Base-address
    00124
    00125 #define OEP3_X_BUFFER_ADDRESS   0x1E00  // Input  Endpoint 2 X Buffer Base-address
    00126 #define OEP3_Y_BUFFER_ADDRESS   0x1E40  // Input  Endpoint 2 Y Buffer Base-address
    00127 #define IEP3_X_BUFFER_ADDRESS   0x1E80  // Output Endpoint 2 X Buffer Base-address
    00128 #define IEP3_Y_BUFFER_ADDRESS   0x1EC0  // Output Endpoint 2 Y Buffer Base-address
    00129
    00130 #define OEP4_X_BUFFER_ADDRESS   0x1F00  // Input  Endpoint 2 X Buffer Base-address
    00131 #define OEP4_Y_BUFFER_ADDRESS   0x1F40  // Input  Endpoint 2 Y Buffer Base-address
    00132 #define IEP4_X_BUFFER_ADDRESS   0x1F80  // Output Endpoint 2 X Buffer Base-address
    00133 #define IEP4_Y_BUFFER_ADDRESS   0x1FC0  // Output Endpoint 2 Y Buffer Base-address
    00134
    00135 #define OEP5_X_BUFFER_ADDRESS   0x2000  // Input  Endpoint 2 X Buffer Base-address
    00136 #define OEP5_Y_BUFFER_ADDRESS   0x2040  // Input  Endpoint 2 Y Buffer Base-address
    00137 #define IEP5_X_BUFFER_ADDRESS   0x2080  // Output Endpoint 2 X Buffer Base-address
    00138 #define IEP5_Y_BUFFER_ADDRESS   0x20C0  // Output Endpoint 2 Y Buffer Base-address
    00139
    00140 #define OEP6_X_BUFFER_ADDRESS   0x2100  // Input  Endpoint 2 X Buffer Base-address
    00141 #define OEP6_Y_BUFFER_ADDRESS   0x2140  // Input  Endpoint 2 Y Buffer Base-address
    00142 #define IEP6_X_BUFFER_ADDRESS   0x2180  // Output Endpoint 2 X Buffer Base-address
    00143 #define IEP6_Y_BUFFER_ADDRESS   0x21C0  // Output Endpoint 2 Y Buffer Base-address
    00144
    00145 #define OEP7_X_BUFFER_ADDRESS   0x2200  // Input  Endpoint 2 X Buffer Base-address
    00146 #define OEP7_Y_BUFFER_ADDRESS   0x2240  // Input  Endpoint 2 Y Buffer Base-address
    00147 #define IEP7_X_BUFFER_ADDRESS   0x2280  // Output Endpoint 2 X Buffer Base-address
    00148 #define IEP7_Y_BUFFER_ADDRESS   0x22C0  // Output Endpoint 2 Y Buffer Base-address
    00149
    00150 #define X_BUFFER 0
    00151 #define Y_BUFFER 1
    00152
    00153 // addresses of pipes for endpoints
    00154 #define EP1_ADDR          0x01    //address for endpoint 1
    00155 #define EP2_ADDR          0x02    //address for endpoint 2
    00156 #define EP3_ADDR          0x03    //address for endpoint 3
    00157 #define EP4_ADDR          0x04    //address for endpoint 4
    00158 #define EP5_ADDR          0x05    //address for endpoint 5
    00159 #define EP6_ADDR          0x06    //address for endpoint 6
    00160 #define EP7_ADDR          0x07    //address for endpoint 7
    00161
    00162 // EDB Data Structure
    00163 typedef struct _tEDB
    00164 {
    00165     BYTE    bEPCNF;             // Endpoint Configuration
    00166     BYTE    bEPBBAX;            // Endpoint X Buffer Base Address
    00167     BYTE    bEPBCTX;            // Endpoint X Buffer byte Count
    00168     BYTE    bSPARE0;            // no used
    00169     BYTE    bSPARE1;            // no used
    00170     BYTE    bEPBBAY;            // Endpoint Y Buffer Base Address
    00171     BYTE    bEPBCTY;            // Endpoint Y Buffer byte Count
    00172     BYTE    bEPSIZXY;           // Endpoint XY Buffer Size
    00173 } tEDB, *tpEDB;
    00174
    00175 typedef struct _tEDB0
    00176 {
    00177     BYTE    bIEPCNFG;           // Input Endpoint 0 Configuration Register
    00178     BYTE    bIEPBCNT;           // Input Endpoint 0 Buffer Byte Count
    00179     BYTE    bOEPCNFG;           // Output Endpoint 0 Configuration Register
    00180     BYTE    bOEPBCNT;           // Output Endpoint 0 Buffer Byte Count
    00181 } tEDB0, *tpEDB0;
    00182
    00183 // EndPoint Desciptor Block Bits
    00184 #define EPCNF_USBIE     0x04    // USB Interrupt on Transaction Completion. Set By MCU
    00185                                 // 0:No Interrupt, 1:Interrupt on completion
    00186 #define EPCNF_STALL     0x08    // USB Stall Condition Indication. Set by UBM
    00187                                 // 0: No Stall, 1:USB Install Condition
    00188 #define EPCNF_DBUF      0x10    // Double Buffer Enable. Set by MCU
    00189                                 // 0: Primary Buffer Only(x-buffer only), 1:Toggle Bit Selects Buffer
    00190
    00191 #define EPCNF_TOGGLE     0x20   // USB Toggle bit. This bit reflects the toggle sequence bit of DATA0 and DATA1.
    00192
    00193 #define EPCNF_UBME      0x80    // UBM Enable or Disable bit. Set or Clear by MCU.
    00194                                 // 0:UBM can't use this endpoint
    00195                                 // 1:UBM can use this endpoint
    00196 #define EPBCNT_BYTECNT_MASK 0x7F // MASK for Buffer Byte Count
    00197 #define EPBCNT_NAK       0x80    // NAK, 0:No Valid in buffer, 1:Valid packet in buffer
    00198
    00199 //definitions for MSP430 USB-module
    00200 #define START_OF_USB_BUFFER   0x1C00
    00201
    00202 // input and output buffers for EP0
    00203 #define USBIEP0BUF 0x2378
    00204 #define USBOEP0BUF 0x2370
    00205
    00206
    00207 #endif    /*_defMSP430USB_H    */