📄 usb.h
字号:
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* usb.h
*
* Project:
* --------
* Maui_Software
*
* Description:
* ------------
* This file intends for usb1.1 definitions.
*
* Author:
* -------
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#ifndef USB_H
#define USB_H
#include "usb_custom.h"
#include "usb_drv.h"
/***********************************************
standard command definition
************************************************/
/* Standard Request Codes */
#define USB_GET_STATUS 0x00
#define USB_CLEAR_FEATURE 0x01
#define USB_SET_FEATURE 0x03
#define USB_SET_ADDRESS 0x05
#define USB_GET_DESCRIPTOR 0x06
#define USB_SET_DESCRIPTOR 0x07
#define USB_GET_CONFIGURATION 0x08
#define USB_SET_CONFIGURATION 0x09
#define USB_GET_INTERFACE 0x0A
#define USB_SET_INTERFACE 0x0B
#define USB_SYNCH_FRAME 0x0C
/* Command bit fields */
#define USB_CMD_DATADIR 0x80
/* Request Type Field */
#define USB_CMD_TYPEMASK 0x60
#define USB_CMD_STDREQ 0x00
#define USB_CMD_CLASSREQ 0x20
#define USB_CMD_VENDREQ 0x40
#define USB_CMD_STDDEVIN 0x80
#define USB_CMD_STDDEVOUT 0x00
#define USB_CMD_STDIFIN 0x81
#define USB_CMD_STDIFOUT 0x01
#define USB_CMD_STDEPIN 0x82
#define USB_CMD_STDEPOUT 0x02
#define USB_CMD_CLASSIFIN 0xa1
#define USB_CMD_CLASSIFOUT 0x21
/* Standard command descriptor type*/
#define USB_DEVICE 0x01
#define USB_CONFIG 0x02
#define USB_STRING 0x03
#define USB_INTERFACE 0x04
#define USB_ENDPOINT 0x05
#ifdef USB20
#define USB_DEVQUAL 0x06
#define USB_OTHERSPEED 0x07
#define USB_POWER_20 0x08
#endif
#define USB_OTG_DESC 0x09
#define USB_INTERFACE_ASSOCIATION 0x0b
#define USB_CMD_DESCMASK 0xFF00
#define USB_CMD_DEVICE (USB_DEVICE<<8)
#define USB_CMD_CONFIG (USB_CONFIG<<8)
#define USB_CMD_STRING (USB_STRING<<8)
#define USB_CMD_INTERFACE (USB_INTERFACE<<8)
#define USB_CMD_ENDPOINT (USB_ENDPOINT<<8)
#ifdef USB20
#define USB_CMD_DEVQUAL (USB_DEVQUAL<<8)
#define USB_CMD_OTHERSPEED (USB_OTHERSPEED<<8)
#endif
/* Standard Device Feature Selectors */
#define USB_FTR_DEVREMWAKE 0x0001
#define USB_FTR_EPHALT 0x0000
#define USB_FTR_B_HNP_ENB 0x0003
#define USB_FTR_A_HNP_SUPPORT 0x0004
#define USB_FTR_A_ALT_HNP_SUPPORT 0x0005
/***********************************************
standard descriptor definition
************************************************/
/*Scriptor length*/
#define USB_DEVDSC_LENGTH 18
#define USB_CFGDSC_LENGTH 9
#define USB_IFDSC_LENGTH 9
//#define USB_MAX_IFDSC_LENGTH 28 /* this will change depend on different class interface */
#define USB_MAX_IFDSC_LENGTH 258 /* this will change depend on different class interface */
/*descriptor requirment*/
/* 28 is for CDC ACM communication class interface */
/* 258 is for video streaming class interface */
#define USB_EPDSC_LENGTH 7
#define USB_OTGDSC_LENGTH 3
#define USB_MAX_CLASS_EPDESC_LENGTH 12 /* this will change depend on different class interface */
/*descriptor requirment*/
/* 12 is for video control interrupt ep */
#define USB_IAD_LENGTH 8
/* Endpoint direction */
#define USB_EP_DIR 0x80
#define USB_EP_DIR_IN 0x80
#define USB_EP_DIR_OUT 0x00
/* Endpoint transfer types */
#define USB_EP_TFMASK 0x03
#define USB_EP_CONTROL 0x00
#define USB_EP_ISO 0x01
#define USB_EP_BULK 0x02
#define USB_EP_INTR 0x03
/*****Descriptor Element*****/
/* Define values for Standard Device Descriptor */
/*For Device descriptor*/
#define USB_DEVDSC_PRODUCT_COMPOSITE 0x0004 /* Product ID */
#define USB_DEVDSC_MAXPKTSIZE 0x08 /* Packet Size */
#define USB_DEVDSC_BCDDEVICE 0x0100 /*Release number of Device*/
#ifdef __USB_MULTI_CHARGE_CURRENT__
#if ( defined(MT6305) || defined(MT6318) )
#define USB_DEVDSC_CONFIGS USB_GetChargeCurrentTableSize()
#else
#define USB_DEVDSC_CONFIGS 1
#endif
#else
#define USB_DEVDSC_CONFIGS 1 /* Number of possible configurations */
#endif
/*For Configuration descriptor*/
#define USB_CFGDSC_ATTR_NATURE 0x80
#define USB_CFGDSC_ATTR_SELFPOWER (USB_CFGDSC_ATTR_NATURE|0x40)
#define USB_CFGDSC_ATTR_REMOTEWAKEUP (USB_CFGDSC_ATTR_NATURE|0x20)
#define USB_CFGDSC_MAXPOWER (500/2)
#define USB_OTG_HNP_SUPPORT 0x02
#define USB_OTG_SRP_SUPPORT 0x01
/***********************************************
implement definition
************************************************/
/* define configuration,interface, ep number */
#define USB_MAX_CONFIG 8 /* configuration number */
#define USB_MAX_IAD 1
#define USB_MAX_INTERFACE 2 /* interface number */
#define USB_MAX_EP_BULK_IN 1 /* max bulk in ep number */
#define USB_MAX_EP_BULK_OUT 1 /* max bulk in ep number */
#define USB_MAX_EP_INTR 1 /* max interrupt ep number */
#define USB_MAX_STRING 10 /* string number */
#define USB_MAX_EP_PER_IF 2
/* serial string array size for that unique Serial number*/
#define USB_SERIAL_STRING_LEN 16
/* define endpoint data parameters */
#define USB_EP_NODATA -1 /* no more data for endpoint to send */
/***********************************************
standard command structure
************************************************/
/* usb standard command structure */
typedef struct
{
kal_uint8 bmRequestType;
kal_uint8 bRequest;
kal_uint16 wValue;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -