?? gfd_usb_hl.c
字號:
/**************************************************************************************
*
* (c) 2004 ASIC,all rights reserved
*
*
* This source code and any compilation or derivative thereof
*is proprietary information and is confidential in nature.
* Under no circumstance is this software to be exposed or placed
*under an open source License of any type without expressed
*written permission of ASIC.
*
*filename: gfd_usb_hl.c
*history:
*
* Version Date Author Comments
*------------------------------------------------------------------------------------
* 1.0 2004.9.24 lmq Initial Creation
* 1.1 2005.3.24 xl make all the global var in a USBDevice struct
**************************************************************************************/
#include "hardware_reg.h"
#include "Gfd_usb_irq.h"
#include "HA_TypeDef.h"
#include "hardware.h"
#include "Gfd_usb_protocol.h"
#include "Gfd_usb_common.h"
#include "Gfd_dmac.h"
#include "debug.h"
/*-------------------------------------------------------------------*
* local function declerations
*-------------------------------------------------------------------*/
static void usb_irq_setup(void);
static U8 *get_irq_request_cmd(void);
static U32 pdc_bus_ctrl_pipe_notificaion(unsigned long notif_type, unsigned char *cmd);
static void pdc_bus_get_descriptor(U8 *command);
ER HA_GFDUSB_INTHANDLE(void); //usb 中斷服務程序
static ER OUTINTR(void);
static void pdc_bus_SET_CONFIGURATION(void);
static void bulk_commmand(void);
U32 usb_bulk_cbw(void);
static void bulk_commmand(void);
void usb_bulk_csw(void);
U32 usb_bulk(void);
static U32 transcl(unsigned char *head);
U32 transbulk(unsigned char *head);
/*-------------------------------------------------------------------*
* 全局變量定義
*-------------------------------------------------------------------*/
struct USBDevice MSDevice;//海量存儲器類別
struct USBDevice *pMSDevice = &(MSDevice);
/*
* descriptors,描述符請參看USB1.1協議
*/
#ifdef READCARD
U32 device_desc[] = {
0x01100112, /* 描述符長度, 設備描述符, 版本號 (BCD)*/
0x08000000, /* 設備類,設備子類,設備協議,包的最大長度 */
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x66800ed1, /* 設備商ID , 廠商ID */
0x02010100, /* gfd's revision ID,制造商索引. 字符串索引*/
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000103 /* 字符串索引, 配置數目. */
};
U32 conf_desc[] = {
0x00200209, /* 描述符長度,配置描述符, 返回的總長度 */
0xc0000101, /* 接口數目,配置數目,配置索引,字符串索引,屬性.: 自供電 */
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00040901, /* 不使用總線供電,描述符長度,接口描述符,接口數目*/
0x06080200, /* 可選設置,非0端點,接口類 (Mass Storage),接口子類 (SCSI Transparent) */
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x05070050, /* 接口協議(BOT Protocol),索引值. 字符串描述符長度,端點描述符 */
0x00400282, /* 地址(IN),屬性(BULK),包的最大尺寸*/
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x01050700, /* 輪詢時間 (ms),端點描述符長度,地址(OUT) */
0x00004002 /* 屬性 (BULK),包的最大尺寸,輪詢時間 (ms), */
};
#endif
#ifdef UDISK
U32 device_desc[] = {
0x01100112, /* 描述符長度, 設備描述符, 版本號 (BCD)*/
0x08000000, /* 設備類,設備子類,設備協議,包的最大長度 */
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x9382058f, /* 設備商ID , 廠商ID */
0x02010100, /* gfd's revision ID,制造商索引. 字符串索引*/
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000100 /* 字符串索引, 配置數目. */
};
U32 conf_desc[] = {
0x00200209, /* 描述符長度,配置描述符, 返回的總長度 */
0x80000101, /* 接口數目,配置數目,配置索引,字符串索引,屬性.: 自供電 */
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00040932, /* 不使用總線供電,描述符長度,接口描述符,接口數目*/
0x06080200, /* 可選設置,非0端點,接口類 (Mass Storage),接口子類 (SCSI Transparent) */
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x05070050, /* 接口協議(BOT Protocol),索引值. 字符串描述符長度,端點描述符 */
0x00400282, /* 地址(IN),屬性(BULK),包的最大尺寸*/
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x00000000, //idle
0x01050700, /* 輪詢時間 (ms),端點描述符長度,地址(OUT) */
0x00004002 /* 屬性 (BULK),包的最大尺寸,輪詢時間 (ms), */
};
#endif
/* Unicode描述符 */
unsigned char unicode_string[]= {
0x04,0x03,
0x09,0x04 /* 0409, US English */
};
unsigned char mfg_string[]= {
26,3, 'P',0, 'h',0, 'ti',0, 'l',0, 'ti',0, 'p',0, 's',0,
'-',0, 'A',0, 'P',0, 'ti',0, 'C',0
};
unsigned char product_string[]=
#if 1
gfd_product_string
#else
{
60,3, '1',0, '3',0, '6',0, '2',0, '-',0, 'O',0, 'T',0, 'G',0, ' ',0,
'M',0, 'A',0, 'S',0, 'S',0, ' ',0,
'S',0, 't',0, 'o',0, 'r',0, 'a',0, 'g',0, 'e',0, ' ',0,
#ifdef CONFIG_gfd_PCI
'P',0, 'C',0, 'ti',0,
#else
'ti',0, 'S',0, 'A',0,
#endif /* CONFIG_gfd_PCI */
' ',0, 'K',0, 'ti',0, 't',0
}
#endif
;
unsigned char serial_string[]= {
0x0A, 0x03, '1', 0x00, '.',0x00, '0', 0x00, '0', 0x00
};
unsigned char empty[] = {0x00};
/*******************************UFI command descriptions*******************/
U32 UInquiry[]= {
0x00008000, 0x0000001f,'fraG', 'deli',
' VED', 'ssaM','otS ', 'egar','01.1'
};
/*32M*/
#if 0
U32 URead_capacity[]= {
0xffff0000,0x00020000
};
#endif
/*16M*/
#if 0
U32 URead_capacity[]= {
0xff7f0000,0x00020000
};
#endif
/*4M*/
#if 0
U32 URead_capacity[]= {
0xff1f0000,0x00020000
};
#endif
/*5M*/
#if 0
U32 URead_capacity[]= {
0xff270000,0x00020000
};
#endif
/*64M*/ /*added by xl on 5.6*/
#ifdef USBNANDFLASH
U32 URead_capacity[]= {
0xffff0100,0x00020000
};
#endif
/*128M*/
#if 1//USBMMC
U32 URead_capacity[]= {
0xffff0300,0x00020000
};
#endif
/*32M*/
#if 0
U32 URead_format_capacity[]= {
0x10000000, 0x00001000, 0x00020002,
0x00000100, 0x00020000,
};
#endif
/*16M*/
#if 0
U32 URead_format_capacity[]= {
0x10000000, 0x00800000, 0x00020002,
0x00800000, 0x00020000,
};
#endif
/*4M*/
#if 0
U32 URead_format_capacity[]= {
0x10000000, 0x00200000, 0x00020002,
0x00200000,0x00020000,
};
#endif
/*5M*/
#if 0
U32 URead_format_capacity[]= {
0x10000000, 0x00280000, 0x00020002,
0x00280000,0x00020000,
};
#endif
/*64M*/
#ifdef USBNANDFLASH
U32 URead_format_capacity[]= {
0x10000000, 0x00000200, 0x00020002,
0x00000200,0x00020000,
};
#endif
/*128M*/
#if 1
U32 URead_format_capacity[]= {
0x10000000, 0x0000040, 0x00020002,
0x0000040,0x00020000,
};
#endif
U32 URequest_sense[]= {
0X000600f0, 0X0a000000, 0X00000000, 0X00000028,
0x00000000
};
unsigned char Ucode_15[]= {
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x00, 0x1c, 0x0a, 0x80, 0x04,
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -