bestwang
驱动牛犊
驱动牛犊
  • 注册日期2003-07-16
  • 最后登录2003-08-17
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1128回复:0

EzUSB ReNumeration的例子

楼主#
更多 发布于:2003-07-19 12:26
实现了ReNumeration
1. 采用Ez-USB FrameWork架构,主要程序修改如下:


void TD_Init(void) // Called once at startup
{
Rwuen = TRUE; // Enable remote-wakeup

// Initialize the Port Cfg:

PORTBCFG=0x00;
OEB=0xFF;
OUTB=0x00; //

// Here, Do ReNumeration
USBCS=0x0A; // DISCON
_nop_();
_nop_();
_nop_();
USBCS=0x06; // Connect.
}

void TD_Poll(void) // Called repeatedly while the device is idle
{
OUTB=OUTB^0xFF;
}
============================================================================================
2. 修改dscr.a51:

DeviceDscr:
db deviceDscrEnd-DeviceDscr ;; Descriptor length
db DSCR_DEVICE ;; Decriptor type
dw 0001H ;; Specification Version (BCD)
db 00H   ;; Device class
db 00H ;; Device sub-class
db 00H ;; Device sub-sub-class
db 64 ;; Maximum packet size
dw 3412H ;; Vendor ID ;===NEW
dw 7856H ;; Product ID (Sample Device) ;===NEW
dw 0100H ;; Product version ID
db 1 ;; Manufacturer string index
db 2 ;; Product string index
db 0 ;; Serial number string index
db 1 ;; Number of configurations
deviceDscrEnd:
StringDscr1:
db StringDscr1End-StringDscr1 ;; String descriptor length
db DSCR_STRING
db \'J\',00
db \'u\',00
db \'d\',00
db \'a\',00
db \'s\',00
db \'+\',00
db \' \',00
db \'C\',00
db \'h\',00
db \'i\',00
db \'p\',00
db \'s\',00
StringDscr1End:

StringDscr2:
db StringDscr2End-StringDscr2 ;; Descriptor length
db DSCR_STRING
db \'E\',00
db \'Z\',00
db \'-\',00
db \'G\',00
db \'o\',00
db \'d\',00
db \' \',00
db \'D\',00
db \'e\',00
db \'v\',00
db \'i\',00
db \'c\',00
db \'e\',00
StringDscr2End:
===============================================================================
3. 配置Ez_GOD.inf文件(由ezusbw2k.inf得到)

[Version]
Signature=\"$CHICAGO$\"
Class=USB
provider=%Cypress%
LayoutFile=layout.inf

[Manufacturer]
%Cypress%=Cypress

[Cypress]

;
; This VID/PID is used by several of the EZ-USB development kit
; samples.  This device is bound to the general purpose driver.
; ===========NEW
%USB\\VID_1234&PID_5678.DeviceDesc%=EZUSB.Dev, USB\\VID_1234&PID_5678


[PreCopySection]
HKR,,NoSetupUI,,1

[DestinationDirs]
EZUSB.Files.Ext = 10,System32\\Drivers
EZUSB.Files.Inf = 10,INF

[EZUSB.Dev]
CopyFiles=EZUSB.Files.Ext, EZUSB.Files.Inf
AddReg=EZUSB.AddReg

[EZUSB.Dev.NT]
; copyfiles commented out for Win2K to avoid user intervention during install
; CopyFiles=EZUSB.Files.Ext, EZUSB.Files.Inf
AddReg=EZUSB.AddReg

[EZUSB.Dev.NT.Services]
Addservice = EZUSB, 0x00000002, EZUSB.AddService

[EZUSB.AddService]
DisplayName    = %EZUSB.SvcDesc%
ServiceType    = 1                  ; SERVICE_KERNEL_DRIVER
StartType      = 2                  ; SERVICE_AUTO_START
ErrorControl   = 1                  ; SERVICE_ERROR_NORMAL
ServiceBinary  = %10%\\System32\\Drivers\\ezusb.sys
LoadOrderGroup = Base

[EZUSB.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,ezusb.sys

[EZUSB.Files.Ext]
ezusb.sys

;===========NEW
[EZUSB.Files.Inf]
Ez_GOD.inf

;---------------------------------------------------------------;

[Strings]
Cypress=\"Cypress Semiconductor\"
USB\\VID_1234&PID_5678.DeviceDesc=\"Judas Inc. Ez-God Demo Devices\"
EZUSB.SvcDesc=\"Cypress General Purpose USB Driver (ezusb.sys)\"

====================================================================
4. 打开EzMr
5. Download Firmware
6. 程序立即执行,EzUSB进行ReNumeration,Win2000报告发现新的设备\"Ez-GOD Devices\"
7. 指定Ez_GOD.inf,进行设备的按装(ezusb.sys)。
8. 驱动按装完毕后,查看设备管理器,原来的Cypress Ez-USB no EEPROM变为“Judas Inc. Ez-GOD Demo Devices”
9. EzMr.里执行Get Dev,Get Strings可以发现新设备的VID/PID已经变为1234/5678。

10. 第一次Download(步骤5)后,片上的程序(在PortB输出方波)处于连续工作状态。

[编辑 -  7/19/03 by  bestwang]

最新喜欢:

sunmaculasunmac...
游客

返回顶部