usb.h
来自「Usb Host/Periphel Control TD1120 codes」· C头文件 代码 · 共 183 行
H
183 行
/*-----------------------------------------------------------------------------
$File: //tdi_sw/tdi/source/usb/common/usb.h $
$DateTime: 2004/12/20 19:06:16 $
$Revision: #6 $
Purpose: Common USB definitions.
CONFIDENTIAL AND PROPRIETARY INFORMATION OF TRANSDIMENSION, INC.
AND/OR ITS WHOLLY OWNED SUBSIDIARY SOFTCONNEX TECHNOLOGIES, INC.
THIS NOTICE IS NOT TO BE DELETED, MODIFIED, MOVED OR CHANGED IN ANY WAY.
(TransDimension, Inc. and SoftConnex Technologies, Inc. are referred to
collectively below as TransDimension, Inc.)
Copyright (c) 1999 - 2004 by TransDimension, Inc.
This software is protected by copyright laws and international copyright
treaties, as well as other intellectual property laws and treaties. This
software is a CONFIDENTIAL, unpublished work of authorship, and with portions
constituting TRADE SECRETS of TransDimension, Inc.. Any unauthorized use,
disclosure, and/or reproduction of this software, or any part of this software;
or distribution of this software in any form or by any means; or storage
of this software in any database or retrieval system, without the express
written consent of, and license from, TransDimension, Inc. is strictly prohibited.
This software is protected under the copyright and/or trade secret laws in other
countries in addition to USA. All Rights Reserved. Failure to abide by the use,
disclosure and/or reproduction restrictions may result in civil and /or criminal
penalties, and will be prosecuted to the maximum extent of the law.
-----------------------------------------------------------------------------*/
#ifndef _SOFTCONNEX_USB_H_
#define _SOFTCONNEX_USB_H_
/******************************************************************************
Include Files
******************************************************************************/
/******************************************************************************
Public Definitions
******************************************************************************/
/*------------------------------------------------------------------------------
USB IOCTL FUNCTIONS
------------------------------------------------------------------------------*/
#define USB_GET_DEVICE_DESCRIPTOR 1
#define USB_GET_CONFIGURATION_DESCRIPTOR 2
#define USB_GET_INTERFACE_DESCRIPTOR 3
#define USB_GET_ENDPOINT_DESCRIPTOR 4
#define USB_SELECT_CONFIGURATION 5
#define USB_SELECT_INTERFACE 6
#define USB_TRANSFER 8
#define USB_ABORT_TRANSFER 9
#define USB_CLEAR_STALLED_ENDPOINT 10
#define USB_GET_STRING 11
/*------------------------------------------------------------------------------
USB COMMANDS FUNCTIONS
------------------------------------------------------------------------------*/
#define USB_GET_STATUS 0
#define USB_CLEAR_FEATURE 1
#define USB_SET_FEATURE 3
#define USB_SET_ADDRESS 5
#define USB_GET_DESCRIPTOR 6
#define USB_SET_DESCRIPTOR 7
#define USB_GET_CONFIGURATION 8
#define USB_SET_CONFIGURATION 9
#define USB_GET_INTERFACE 10
#define USB_SET_INTERFACE 11
#define USB_SYNCH_FRAME 12
#define USB_TYPE_INPUT 1
#define USB_TYPE_OUTPUT 2
#define USB_TYPE_FEATURE 3
#define USB_DEVICE_DESCRIPTOR 1
#define USB_CONFIG_DESCRIPTOR 2
#define USB_STRING_DESCRIPTOR 3
#define USB_INTERFACE_DESCRIPTOR 4
#define USB_ENDPOINT_DESCRIPTOR 5
#define USB_DEVICE_QUALIFIER_DESCRIPTOR 6
#define USB_OTHER_SPEED_CONFIG_DESCRIPTOR 7
#define USB_INTERFACE_POWER 8
#define USB_OTG_DESCRIPTOR 9
/*------------------------------------------------------------------------------
Valid Device Features
------------------------------------------------------------------------------*/
#define USB_FEATURE_ENDPOINT_HALT 0x00
#define USB_FEATURE_DEVICE_REMOTE_WAKEUP 0x01
#define USB_FEATURE_TEST_MODE 0x02
/*------------------------------------------------------------------------------
GENERIC DEFAULT PIPE DESTINATION EQUIVALENCES
------------------------------------------------------------------------------*/
#define USB_REQUEST_TYPE(request) ((request & USB_MASK_REQUEST_TYPE) >> 5)
#define USB_CONTROL_ENDPOINT_SIZE ((U16) 8)
#define USB_SIZE_SETUP_REQUEST (8)
#define USB_SEND 1
#define USB_RECV 0
#define USB_CLASS_DEVICE 0
#define USB_CLASS_INTERFACE 1
#define USB_CLASS_ENDPOINT 2
#define USB_CLASS_OTHER 3
#define USB_RECIPIENT_DEVICE 0
#define USB_RECIPIENT_INTERFACE 1
#define USB_RECIPIENT_ENDPOINT 2
#define USB_RECIPIENT_OTHER 3
#define USB_IsRecipient(request, type) ((request & 0x1F) == type)
#define USB_REQUEST_TYPE_STANDARD 0
#define USB_REQUEST_TYPE_CLASS 1
#define USB_REQUEST_TYPE_VENDOR 2
#define USB_REQUEST_TYPE_RESERVED 3
#define USB_IsType(request, type) ((request & 0x60) == ((type) << 5))
#define USB_CLASS 0x20
#define USB_VENDOR 0x40
#define USB_OUT_ENDPOINT ((U8) 0x00)
#define USB_IN_ENDPOINT ((U8) 0x80)
#define USB_IsDirectionIn(val) (((val) & 0x80)?SCC_TRUE:SCC_FALSE)
#define USB_CONTROL_ENDPOINT ((U8) 0x00)
#define USB_ISOCH_ENDPOINT ((U8) 0x01)
#define USB_BULK_ENDPOINT ((U8) 0x02)
#define USB_INT_ENDPOINT ((U8) 0x03)
#define USB_MASK_PERIODIC_ENDPOINT ((U8) 0x01)
#define USB_TransferTypeGet(val) ((val) & 0x03)
#define USB_MASK_RECIPIENT 0x0F
#define USB_MASK_REQUEST_TYPE 0x60
#define USB_MASK_REQUEST_DIRECTION 0x80
#define USB_REQUEST_DIRECTION_IN 0x80
#define USB_MASK_ENDPOINT_ADDRESS 0xF
/******************************************************************************
Public Data Types
******************************************************************************/
/*------------------------------------------------------------------------------
URB SETUP REQUEST TYPE
------------------------------------------------------------------------------*/
typedef struct _SetupRequest
{
U8 bmRequestType;
U8 bRequest;
U8 bDescriptorIndex;
U8 bDescriptorType;
U16 wIndex;
U16 wLength;
}
SetupRequest;
#define USB_SETUP_REQUESTTYPE 0
#define USB_SETUP_REQUEST 1
#define USB_SETUP_DESCRIPTORINDEX 2
#define USB_SETUP_DESCRIPTORTYPE 3
#define USB_SETUP_INDEX 4
#define USB_SETUP_LENGTH 6
#define USB_SETUP_REQUEST_SIZE 8
/******************************************************************************
Public Functions
******************************************************************************/
#endif /* _SOFTCONNEX_USB_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?