⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usb_descriptor.c

📁 IT projecotr reference design.
💻 C
📖 第 1 页 / 共 3 页
字号:
/****************************************************************************/
/*             TEXAS INSTRUMENTS PROPRIETARY INFORMATION                    */
/*                                                                          */
/*  (c) Copyright, Texas Instruments Incorporated, 2006.                    */
/*      All Rights Reserved.                                                */
/*                                                                          */
/*  Property of Texas Instruments Incorporated. Restricted Rights -         */
/*  Use, duplication, or disclosure is subject to restrictions set          */
/*  forth in TI's program license agreement and associated documentation.   */
/****************************************************************************/

/****************************************************************************/
/* usb_descriptor.c                                                         */
/****************************************************************************/

#include <string.h>

#include "common.h"
#include "usb.h"

#include "sysmon.h"
#include "usbIO.h"
#include "usb_descriptor.h"

extern USBMAIN_EP_DATA Ep_Data[3];
/*-------------------------------------------------------------------------------*/
/* USB String Descriptor Data: Contains Unicode strings for all configurations   */
/*-------------------------------------------------------------------------------*/


__align(4) const USB_STRING_DESC StringDescData_Index0 = 
            { /*Index 0: List of supported languages (LANGID codes) for the string descriptors*/
                0x04,
                USB_STRING_DESC_TYPE,   
                {USBDESC_LANGID_US_ENGLISH}        /* US English */
            };  
            
__align(4) const USB_STRING_DESC StringDescData_Index1 = 
           { /*Index 1: Manufacturer (device descriptor)*/
                0x2E,
                USB_STRING_DESC_TYPE,
                {0x0054, 0x0065, 0x0078, 0x0061,   /* "Texas Instruments Inc." */  
                 0x0073, 0x0020, 0x0049, 0x006E,   
                 0x0073, 0x0074, 0x0072, 0x0075,
                 0x006D, 0x0065, 0x006E, 0x0074,      
                 0x0073, 0x0020, 0x0049, 0x006E,
                 0x0063, 0x002E}  
            }; 
            
__align(4) const USB_STRING_DESC StringDescData_Index2 = 
            { /*Index 2: Product (device descriptor)*/
                0x10,
                USB_STRING_DESC_TYPE,
                {0x0044, 0x0044, 0x0050, 0x0032,    /* "DDP2230" */
                 0x0032, 0x0033, 0x0030} 
            }; 
            
__align(4) const USB_STRING_DESC StringDescData_USBMAIN_FACTORYMODEIndex3 = 
            { /*Index 3: Serial Number (device descriptor)*/
                0x0A,
                USB_STRING_DESC_TYPE,
                {0x0032, 0x0032, 0x0033, 0x0030}   /* "2230" */ 

            }; 
            
__align(4) const USB_STRING_DESC StringDescData_USBMAIN_USERMODEIndex3 = 
            { /*Index 3: Serial Number (device descriptor)*/
                0x0A,
                USB_STRING_DESC_TYPE,
 	            {0x0032, 0x0032, 0x0033, 0x0030}   /* "2230" */                 
            }; 
            
            
__align(4) const USB_STRING_DESC StringDescData_Index4 = 
            { /*Index 4: DDP2230 Mouse*/
                0x1C,
                USB_STRING_DESC_TYPE,
                {0x0044, 0x0044, 0x0050, 0x0032,    /* "DDP2230 Mouse" */
                 0x0032, 0x0033, 0x0030, 0x0020,
                 0x004D, 0x006F, 0x0075, 0x0073,
                 0x0065}
            }; 
            
__align(4) const USB_STRING_DESC StringDescData_Index5 = 
            { /*Index 5: Alternate Serial Number for HID (device descriptor)*/
                0x08,
                USB_STRING_DESC_TYPE,
                {0x0068, 0x0069, 0x0064}   /* "hid" */ 
                    
            };            
            
__align(4) const USB_STRING_DESC StringDescData_Index6 = 
            { /*Index 6: DDP2230 Keyboard*/
                0x22,
                USB_STRING_DESC_TYPE,
                {0x0044, 0x0044, 0x0050, 0x0032,    /* "DDP2230 Keyboard" */
                 0x0032, 0x0033, 0x0030, 0x0020,
                 0x004B, 0x0065, 0x0079, 0x0062,
                 0x006F, 0x0061, 0x0072, 0x0064}
            };            
            
                                                              
 
/*-------------------------------------------------------------------------------*/
/*   USB Descriptor Data: Usb_Mode = USBMAIN_FACTORYMODE                         */
/*   Bulk OUT EP1 and Interrupt IN EP1 to implement Projector Control interface. */
/*   Interrupt IN EP2 with HID class to implement Mouse pass-through interface.  */
/*   EP0 max packet size is 64 bytes.                                            */
/*-------------------------------------------------------------------------------*/

/*Device descriptor

   __align(4) is used here because this data structure will be sent to the host individually, and
  so must be aligned on a four byte boundary.*/
__align(4) const USB_DEVICE_DESC DevDescData_FactoryMode =
{
    USBDESC_DEV_LENGTH,
    USB_DEVICE_DESC_TYPE,
    USBDESC_SPEC_RELEASE_NUMBER,
    USBDESC_DEV_CLASS,
    USBDESC_DEV_SUBCLASS,
    USBDESC_DEV_PROTOCOL,
    USB_MAX_PACKET_64,
    USBDESC_DEV_VENDOR_ID,   /*OEM specific*/
    USBDESC_DEV_PRODUCT_ID,  /*OEM specific*/
    USBDESC_DEV_RELEASE_NUM, /*OEM specific*/ 
    USBDESC_STRING_MANUFACTURER_IDX,                    
    USBDESC_STRING_PRODUCT_IDX,                     
    USBDESC_STRING_SERIAL_NUM_IDX, 
    USB_NUM_CONFIGURATIONS  
};

/*Configuration descriptor*/
const USB_CONFIGURATION_DESC ConfigDescData_FactoryMode =
{
    USBDESC_CFG_LENGTH,
    USB_CONFIG_DESC_TYPE,
    USBDESC_CONFIG_DESC_TOTAL_LEN_FACTORYMODE,
    USBDESC_NUM_INTERFACES_FACTORYMODE, 
    USB_CONFIGURATION_1,
    0,                       /*no string descriptor*/  
    USBDESC_CFG_ATTRIBUTES,
    USBDESC_CFG_MAX_POWER
};


/*Interface 0 Descriptor for DLP Composer.EP1*/
const USB_INTERFACE_DESC InterfaceDescData_IF0_FactoryMode = 
{
    USBDESC_INTR_LENGTH,
    USB_INTERFACE_DESC_TYPE,
    USB_INTERFACE_0,
    USB_ALT_SETTING_0,
    4, //USBDESC_IF0_NUM_EPS_FACTORYMODE,
    USBDESC_IF0_CLASS_FACTORYMODE,     
    USBDESC_IF0_SUBCLASS_FACTORYMODE,
    USBDESC_IF0_PROTOCOL_FACTORYMODE,
    0                            /*no string descriptor*/
};


/*Endpoint Descriptor for DLP Composer. EP1 IN descriptor*/
const USB_ENDPOINT_DESC EndpointDescData_IF0_Ep1In_FactoryMode = 
{
    USBDESC_EP_LENGTH,
    USB_ENDPOINT_DESC_TYPE,
    USBDESC_EP1_IN_ADDR,
    USB_INTERRUPT_EP,
    USB_MAX_PACKET_64,
    2                          /* Polling interval in ms. */
};


/*Endpoint Descriptor for DLP Composer. EP1 OUT descriptor*/
const USB_ENDPOINT_DESC EndpointDescData_IF0_Ep1Out_FactoryMode = 
{
    USBDESC_EP_LENGTH,
    USB_ENDPOINT_DESC_TYPE,
    USBDESC_EP1_OUT_ADDR,
    USB_BULK_EP,
    USB_MAX_PACKET_64,
    0                          /*Polling interval. Unused for Bulk endpoints*/ 
};

/*****************************************************************/

/*Endpoint Descriptor for remote function call. EP2 IN descriptor*/

const USB_ENDPOINT_DESC EndpointDescData_IF0_Ep2In_FactoryMode = 
{
    USBDESC_EP_LENGTH,
    USB_ENDPOINT_DESC_TYPE,
    0x82,
    USB_INTERRUPT_EP,
    USB_MAX_PACKET_64,
    2                          /* Polling interval in ms. */
};


/*Endpoint Descriptor for remote function call. EP2 OUT descriptor*/

const USB_ENDPOINT_DESC EndpointDescData_IF0_Ep2Out_FactoryMode = 
{
    USBDESC_EP_LENGTH,
    USB_ENDPOINT_DESC_TYPE,
    0x02,
    USB_BULK_EP,
    USB_MAX_PACKET_64,
    0                          /*Polling interval. Unused for Bulk endpoints*/ 
};

/*****************************************************************/

/*Interface 1 Descriptor for Mouse. EP3 */

const USB_INTERFACE_DESC InterfaceDescData_IF1_FactoryMode = 
{
    USBDESC_INTR_LENGTH,
    USB_INTERFACE_DESC_TYPE,
    USB_INTERFACE_MOUSE_FACTORYMODE,
    USB_ALT_SETTING_0,
    USBDESC_IF1_NUM_EPS_USERMODE,
    USBDESC_IF1_CLASS_FACTORYMODE,     /*HID class*/
    USBDESC_IF1_SUBCLASS_FACTORYMODE,
    USBDESC_IF1_PROTOCOL_FACTORYMODE,
    USBDESC_STRING_MOUSE_IDX                         
};

/*Endpoint Descriptor for Mouse. IN descriptor only.*/

const USB_ENDPOINT_DESC EndpointDescData_IF1_Ep3In_FactoryMode = 
{
    USBDESC_EP_LENGTH,
    USB_ENDPOINT_DESC_TYPE,
    USBDESC_MOUSE_IN_FACTORYMODE,
    USB_INTERRUPT_EP,
    USB_MAX_PACKET_8,
    15                          /*Polling interval in milliseconds*/ 
};

/*Interface Descriptor for Keyboard. */

const USB_INTERFACE_DESC InterfaceDescData_IF2_FactoryMode = 
{
    USBDESC_INTR_LENGTH,
    USB_INTERFACE_DESC_TYPE,
    USB_INTERFACE_KEY_FACTORYMODE,
    USB_ALT_SETTING_0,
    USBDESC_IF1_NUM_EPS_USERMODE,
    USBDESC_IF1_CLASS_FACTORYMODE,     /*HID class*/
    USBDESC_IF1_SUBCLASS_FACTORYMODE,
    USBDESC_IF1_PROTOCOL_FACTORYMODE,
    USBDESC_STRING_KEYBOARD_IDX                         
};

/*Endpoint Descriptor for Keyboard. IN Descriptor only*/

const USB_ENDPOINT_DESC EndpointDescData_IF2_Ep4In_FactoryMode = 
{
    USBDESC_EP_LENGTH,
    USB_ENDPOINT_DESC_TYPE,
    USBDESC_KEY_IN_FACTORYMODE,
    USB_INTERRUPT_EP,
    USB_MAX_PACKET_8,
    20                          /*Polling interval in milliseconds*/ 
};


/*-------------------------------------------------------------------------------*/
/*   USB Descriptor Data: Usb_Mode = USBMAIN_USERMODE                               */
/*   Bulk OUT EP1 and Interrupt IN EP1 to implement Projector Control interface. */
/*   Interrupt IN EP2 with HID class to implement Mouse pass-through interface.  */
/*   EP0 max packet size is 64 bytes.                                            */
/*-------------------------------------------------------------------------------*/

/*Device descriptor

   __align(4) is used here because this data structure will be sent to the host individually, and
  so must be aligned on a four byte boundary.*/
__align(4) const USB_DEVICE_DESC DevDescData_UserMode =
{
    USBDESC_DEV_LENGTH,
    USB_DEVICE_DESC_TYPE,
    USBDESC_SPEC_RELEASE_NUMBER,
    USBDESC_DEV_CLASS,
    USBDESC_DEV_SUBCLASS,
    USBDESC_DEV_PROTOCOL,
    USB_MAX_PACKET_64,
    USBDESC_DEV_VENDOR_ID,   /*OEM specific*/
    USBDESC_DEV_PRODUCT_ID,  /*OEM specific*/
    USBDESC_DEV_RELEASE_NUM, /*OEM specific*/ 
    USBDESC_STRING_MANUFACTURER_IDX,                    
    USBDESC_STRING_PRODUCT_IDX,                     
    USBDESC_STRING_SERIAL_NUM_IDX, 
    USB_NUM_CONFIGURATIONS  
};

/*Configuration descriptor*/
const USB_CONFIGURATION_DESC ConfigDescData_UserMode =
{
    USBDESC_CFG_LENGTH,
    USB_CONFIG_DESC_TYPE,
    USBDESC_CONFIG_DESC_TOTAL_LEN_USERMODE,
    USBDESC_NUM_INTERFACES_USERMODE, 
    USB_CONFIGURATION_1,
    0,                       /*no string descriptor*/  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -