- Main Page
- Data Structures
- Files

- File List
- Globals

# descriptors.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: descriptors.h, v1.19 2009/11/18                                    |
    00072 |  Author: RSTO                                                               |
    00073 |                                                                             |
    00074 |  WHO          WHEN         WHAT                                             |
    00075 |  ---          ----------   ------------------------------------------------ |
    00076 |  RSTO         2008/09/03   born                                             |
    00077 |  RSTO         2008/11/29   Added global USB constants                       |
    00078 |  RSTO         2008/12/23   enhancements of CDC API                          |
    00079 |  RSTO         2009/05/25   put all config constants into this file          |
    00080 |  RSTO         2009/07/17   Added comment for MCLK                           |
    00081 |  RSTO         2009/11/18   Changed FW version to 1.19                                       |
    00082 +----------------------------------------------------------------------------*/
    00083
    00084
    00085 /*----------------------------------------------------------------------------+
    00086 | Include files                                                               |
    00087 +----------------------------------------------------------------------------*/
    00088 #include "..\Common\types.h"
    00089
    00090 //***********************************************************************************************
    00091 // CDC or HID
    00092 //***********************************************************************************************
    00093 #define _CDC_          // Needed for CDC inteface
    00094
    00095
    00096 //***********************************************************************************************
    00097 // CONFIGURATION CONSTANTS
    00098 //***********************************************************************************************
    00099
    00100 // These constants configure the API stack and help define the USB descriptors.
    00101 // Refer to Sec. 6 of the MSP430 USB CDC API Programmer's Guide for descriptions of these constants.
    00102
    00103 #define USB_VID 0x2047         // Vendor ID, 0x2047 for Texas Instruments Incorporated (MSP430 Group)
    00104
    00105 #ifdef _CDC_
    00106     #define USB_PID                         0x0300 // Product ID (PID), 0xF400 for CDC stack
    00107     #define SIZEOF_CONFIGURATION_DESCRIPTOR     53 // wTotalLength, CDC
    00108     #define INTERFACE_NUMBER_CDC                0
    00109     #define CDC_INTEP_ADDR                      0x82
    00110     #define CDC_OUTEP_ADDR                      0x03
    00111     #define CDC_INEP_ADDR                       0x83
    00112
    00113     #ifdef _HID_
    00114       #error Only ONE of interfaces should be defined: _HID_ or _CDC_!
    00115     #endif
    00116 #else
    00117     #ifdef _HID_
    00118         #define USB_PID                     0x0301 // Product ID (PID), 0xF401 for HID stack
    00119         #define SIZEOF_CONFIGURATION_DESCRIPTOR 41 // wTotalLength, HID
    00120         #define START_HID_DESCRIPTOR            18
    00121         #define INTERFACE_NUMBER_HID            0
    00122         #define HID_OUTEP_ADDR                0x01
    00123         #define HID_INEP_ADDR                 0x81
    00124     #else
    00125         #error No interface HID or CDC defined! Define it.
    00126     #endif
    00127 #endif
    00128
    00129 /*----------------------------------------------------------------------------+
    00130 | Firmware Version                                                            |
    00131 | How to detect version number of the FW running on MSP430?                   |
    00132 | on Windows Open ControlPanel->Systems->Hardware->DeviceManager->Ports->     |
    00133 |         Msp430->ApplicationUART->Details                                    |
    00134 +----------------------------------------------------------------------------*/
    00135 #define VER_FW_H 0x01                       // Device release number -- high and low bytes, in binary-coded decimal
    00136 #define VER_FW_L 0x19                       // This is reported in the bcdDevice field of the device descriptor
    00137
    00138 // MCLK frequency of MCU, in Hz
    00139 // For running higher frequencies the Vcore voltage adjustment may required.
    00140 // Please refer to Data Sheet of the MSP430 device you use
    00141 #define USB_MCLK_FREQ 8000000               // MCLK frequency of MCU, in Hz
    00142
    00143 #define MAX_PACKET_SIZE   0x40              // Max size of the USB packets.
    00144
    00145
    00146 // If a serial number is to be reported, set this to the index within the string descriptor
    00147 // of the dummy serial number string.  It will then be automatically handled by the API.
    00148 // If no serial number is to be reported, set this to 0.
    00149 #define USB_STR_INDEX_SERNUM 3
    00150
    00151
    00152 #define USB_PLL_XT        2                 // Defines which XT is used by the PLL (1=XT1, 2=XT2)
    00153 #define USB_XT_FREQ       USBPLL_SETCLK_4_0 // Indicates the freq of the crystal on the oscillator indicated by USB_PLL_XT
    00154 #define USB_DISABLE_XT_SUSPEND 1            // If non-zero, then USB_suspend() will disable the oscillator
    00155                                             // that is designated by USB_PLL_XT; if zero, USB_suspend won't
    00156                                             // affect the oscillator
    00157
    00158 #define USB_SUPPORT_REM_WAKE     0x20       // If remote wakeup is to be supported, set this to 0x20.  If not, set to 0x00.
    00159                                             // All other values are prohibited.
    00160
    00161 // Controls whether the device reports itself to be self-powered to any degree.  If so, set to 0x40.  If the
    00162 // device is fully supplied by the bus, set to 0x00.  All other values are prohibited.
    00163 #define USB_SUPPORT_SELF_POWERED 0x40
    00164
    00165
    00166 // Controls how much power the device reports it will draw from VBUS.  Expressed in 2mA units; that is, the
    00167 // number of mA communicated is twice the value of this field.
    00168 #define USB_MAX_POWER 0x32
    00169
    00170
    00171 #define USB_DMA_TX   0x1    // Set to 0xFF if no DMA channel will be used 0..7 for selected DMA channel
    00172 #define USB_DMA_RX   0x1    // Set to 0xFF if no DMA channel will be used 0..7 for selected DMA channel
    00173
    00174 #define USB_NUM_CONFIGURATIONS          1  // Number of implemented interfaces.  This is fixed to 1.
    00175
    00176
    00177 //***********************************************************************************************
    00178 // DESCRIPTOR CONSTANTS
    00179 //***********************************************************************************************
    00180 #define SIZEOF_DEVICE_DESCRIPTOR  0x12
    00181 #define SIZEOF_REPORT_DESCRIPTOR  36
    00182 #define USBHID_REPORT_LENGTH      64  // length of whole HID report (including Report ID)
    00183 #define SIZEOF_INTERFACE_DESCRIPTOR 0x09
    00184
    00185 #define CONFIG_STRING_INDEX       4
    00186 #define INTF_STRING_INDEX         5
    00187
    00188 //***********************************************************************************************
    00189 // OUTWARD DECLARATIONS
    00190 //***********************************************************************************************
    00191
    00192 //Calculates the endpoint descriptor block number from given address
    00193 #define EDB(addr) ((addr&0x07)-1)
    00194
    00195 extern BYTE const abromDeviceDescriptor[SIZEOF_DEVICE_DESCRIPTOR];
    00196 extern BYTE const abromConfigurationDescriptorGroup[SIZEOF_CONFIGURATION_DESCRIPTOR];
    00197 extern BYTE const abromReportDescriptor[SIZEOF_REPORT_DESCRIPTOR];
    00198 extern BYTE const abromStringDescriptor[];
    00199
    00200 /*------------------------ Nothing Below This Line --------------------------*/
    00201