📄 usb_dscr.c
字号:
/******************************************************************************/
/* Copyright (C) 2001 Texas Instruments, Inc. All Rights Reserved. */
/* */
/* File Name : usb_dscr.c */
/* Project : TMS320VC5509 USB Module Support */
/* Author : C5000 H/W Applications */
/* */
/* Version : 0.1 */
/* Date : 30 Apr 2001 */
/* */
/* Description : USB descriptor example file. */
/* This file shows how to create USB descriptors using the */
/* resources supported by the USB driver. */
/* */
/* Users can add/modify the descriptors as required by their */
/* application */
/* */
/* Updates : */
/* */
/* 05/17/01 $MH$ */
/* */
/* Added endpoint 4 in and out, and endpoint 5 in for host dma mode and */
/* iso support */
/* */
/******************************************************************************/
#include "usb_const.h"
#include "csl_std.h"
#include "csl_usb.h"
// Descriptors are stored in little endian format, because that is the way
// USB sends data. The comments are listed by what goes out first on the bus
/******************************************************************************/
/* */
/* Device Descriptor */
/* */
/******************************************************************************/
const Uint16 device_descriptor[] =
{
0x0000, // field for xfer_byte_cnt - used by the data
// transfer API, not an integral part of descriptor
(USB_DESCRIPTOR_DEVICE<<8) | 18, // bLength, bDescriptorType
0x0101, // bcdUSB
0x0000, // bDeviceClass, bDeviceSubClass
0x4000, // bDeviceProtocol, bMaxPacketSize0 = 64
0x0451, // idVendor = Texas Instruments
0x9001, // idProduct = catalog DSP product
0x0000, // bcdDevice ID = prototype
0x0201, // iManufacturer, iProductName
0x0100 // iSerialNumber, bNumConfigurations
};
/******************************************************************************/
/* */
/* Configuration descriptor */
/* */
/******************************************************************************/
const Uint16 configuration_descriptor[] =
{
0x0000, // field for xfer_byte_cnt - used by the data
// transfer API, not an integral part of descriptor
(USB_DESCRIPTOR_CONFIG<<8) | 9, // bLength, bDescriptorType
104, // wTotalLength = 9+9+7+7+7+7+7+9+7+7+7+7+7+7
0x0101, // bNumInterfaces, bConfigurationValue
0xC003, // iConfiguration, bmAttributes = bus/self pwr, no rwu
0 // bMaxPower = none
};
/******************************************************************************/
/* */
/* Interface descriptor */
/* */
/******************************************************************************/
const Uint16 usb_demo_ifc0_alt0_descriptor[] = // interface 0 alt_set = 0
{
0x0000, // field for xfer_byte_cnt - used by the data
// transfer API, not an integral part of descriptor
(USB_DESCRIPTOR_INTRFC<<8) | 9, // bLength, bDescriptorType
0x0000, // bInterfaceNumber, bAlternateSetting
0x0005, // bNumEndpoints = 5, bInterfaceClass
0x0000, // bInterfaceSubClass, bInterfaceProtocol
0x04 // iInterface = index in string descriptor
};
const Uint16 usb_demo_ifc0_alt1_descriptor[] = // interface 0 alt_set = 1
{
0x0000, // field for xfer_byte_cnt - used by the data
// transfer API, not an integral part of descriptor
(USB_DESCRIPTOR_INTRFC<<8) | 9, // bLength, bDescriptorType
0x0100, // bInterfaceNumber, bAlternateSetting
0x0006, // bNumEndpoints = 6, bInterfaceClass
0x0000, // bInterfaceSubClass, bInterfaceProtocol
0x04 // iInterface = index in string descriptor
};
/******************************************************************************/
/* */
/* Endpoint descriptors */
/* */
/******************************************************************************/
// bulk endpoint descriptor - endpt2 OUT
const Uint16 usb_demo_ifc0_alt0_bulk_out_endpoint_descriptor[] =
{
0x0000, // field for xfer_byte_cnt - used by the data
// transfer API, not an integral part of descriptor
(USB_DESCRIPTOR_ENDPT<<8) | 7, // bLength, bDescriptorType
0x0202, // bEndpointAddress = 2 OUT, bmAttributes = bulk
0x0040, // wMaxPacketSize
0x00 // bInterval
};
// bulk endpoint descriptor - endpt2 IN
const Uint16 usb_demo_ifc0_alt0_bulk_in_endpoint_descriptor[] =
{
0x0000, // field for xfer_byte_cnt - used by the data
// transfer API, not an integral part of descriptor
(USB_DESCRIPTOR_ENDPT<<8) | 7, // bLength, bDescriptorType */
0x0282, // bEndpointAddress = 2 IN , bmAttributes
0x0040, // wMaxPacketSize
0x00 // bInterval
};
// interrupt endpoint descriptor - endpt3 IN
const Uint16 usb_demo_ifc0_alt0_intrpt_in_endpoint_descriptor[] =
{
0x0000, // field for xfer_byte_cnt - used by the data
// transfer API, not an integral part of descriptor
(USB_DESCRIPTOR_ENDPT<<8) | 7, // bLength, bDescriptorType
0x0383, // bEndpointAddress = 3 IN , bmAttributes = intrpt
0x0040, // wMaxPacketSize
0x01 // bInterval = once per mSec
};
// bulk endpoint descriptor - endpt4 OUT (for host dma mode )
const Uint16 usb_demo_ifc0_alt0_hostdma_out_endpoint_descriptor[] =
{
0x0000, // field for xfer_byte_cnt - used by the data
// transfer API, not an integral part of descriptor
(USB_DESCRIPTOR_ENDPT<<8) | 7, // bLength, bDescriptorType
0x0204, // bEndpointAddress = 4 OUT, bmAttributes = bulk
0x0040, // wMaxPacketSize
0x00 // bInterval
};
// bulk endpoint descriptor - endpt4 IN (for host dma mode )
const Uint16 usb_demo_ifc0_alt0_hostdma_in_endpoint_descriptor[] =
{
0x0000, // field for xfer_byte_cnt - used by the data
// transfer API, not an integral part of descriptor
(USB_DESCRIPTOR_ENDPT<<8) | 7, // bLength, bDescriptorType */
0x0284, // bEndpointAddress = 4 IN , bmAttributes
0x0040, // wMaxPacketSize
0x00 // bInterval
};
// bulk endpoint descriptor - endpt2 OUT
const Uint16 usb_demo_ifc0_alt1_bulk_out_endpoint_descriptor[] =
{
0x0000, // field for xfer_byte_cnt - used by the data
// transfer API, not an integral part of descriptor
(USB_DESCRIPTOR_ENDPT<<8) | 7, // bLength, bDescriptorType
0x0202, // bEndpointAddress = 2 OUT, bmAttributes = bulk
0x0040, // wMaxPacketSize
0x00 // bInterval
};
// bulk endpoint descriptor - endpt2 IN
const Uint16 usb_demo_ifc0_alt1_bulk_in_endpoint_descriptor[] =
{
0x0000, // field for xfer_byte_cnt - used by the data
// transfer API, not an integral part of descriptor
(USB_DESCRIPTOR_ENDPT<<8) | 7, // bLength, bDescriptorType */
0x0282, // bEndpointAddress = 2 IN , bmAttributes
0x0040, // wMaxPacketSize
0x00 // bInterval
};
// interrupt endpoint descriptor - endpt3 IN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -