w_bingjian
驱动牛犊
驱动牛犊
  • 注册日期2004-05-11
  • 最后登录2005-04-13
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1410回复:1

再问failed to open driver?sos

楼主#
更多 发布于:2004-12-08 22:55
前面遇到过这样的问题,修改了固件程序后,恢复正常。现在又出现了这样的问题,估计没有找到问题的根源。现在的现象是:自己做的电路板,没有eeprom,驱动程序是cypress 68013的通用驱动程序,应用程序和固件程序是我自己写的。上电后,刚开机时能够工作10分钟左右,出现faile to open driver,或者read ioctl failed.
应用程序轮流从ep8和ep6以bulk方式读取数据。此时,重新下载固件程序不成功。我在软件中对设备名进行检测,程序开始用的设备名为Ezusb-0,出现faile to open driver,或者read ioctl failed后,Ezusb-0无法打开,导致fail to open driver 的提示。此时可以打开的设备为Ezusb-1。不知道这是固件程序的问题还是驱动的问题。
我的固件程序如下,请大侠多多指点:
$NOMOD51                        ; disable predefined 8051 registers
$nolist
$include (fx2regs.inc)          ; EZ-USB register assignments
$list
;
public in_count, out_count ;The PUBLIC directive makes the specified symbols available in the generated object module.
TPM_DATA SEGMENT DATA ;data class: data space(address 0 to 7fh & sfr registers)
    RSEG TPM_DATA   ;rseg: selects a generic segment that was previously declared using the SEGMENT directive.
in_count: ds 1      ;The DS directive reserves a specified number of bytes in a memory space.
out_count: ds 1
;
NAME    ezbulk_4;The NAME directive specifies the name to use for the object module generated for the current program.
;
        ISEG AT 60H             ; stack (this app doesn't use it),defines an absolute IDATA segment.
;is an optional absolute base address at which the segment begins.
stack:  ds 20                    
;
        CSEG AT 0               ;defines an absolute CODE segment.
        ljmp  start
; -------------------------------------------------
    org  200h    
; -------------------------------------------------
start:
       mov   SP,#STACK-1       ; set stack
        mov   in_count,#0       ; count the IN transfers
        mov   out_count,#0      ; count the OUT transfers

nop
mov   dptr,#CPUCS       ; set cpuspd to 48MHz,enable clkout output
        mov   a,#10H
        movx  @dptr,a

nop
        mov   dptr,#IFCONFIG    ; set interface slave fifo,enable ifclk output
        mov   a,#0CBH
        movx  @dptr,a

nop
mov   dptr,#PORTACFG ;set slcs
mov   a,#40h
movx  @dptr,a

nop
mov dptr,#REVCTL
MOV A,#03H
MOVX @DPTR,A

nop
MOV DPTR, #EP2CFG
MOV A,#0a2H
MOVX @DPTR,A

nop
MOV DPTR, #EP6CFG  ;EP6 IS BULK TRANSFER
MOV A,#0E2H
MOVX @DPTR, A

nop
mov dptr,#FIFOPINPOLAR
MOV A,#3
MOVX @DPTR,A

NOP
MOV DPTR,#PINFLAGSAB
MOV A,#0eah
MOVx @DPTR,A

;ep2 reset
nop                     ; just a SYNCDELAY reminder
        mov   dptr,#FIFORESET        
        mov   a,#80H
        movx  @dptr,a

nop                     ; just a SYNCDELAY reminder
        mov   dptr,#FIFORESET        
        mov   a,#02H
        movx  @dptr,a

nop                     ; just a SYNCDELAY reminder
        mov   dptr,#FIFORESET        
        mov   a,#00H
        movx  @dptr,a


nop                     ; just a SYNCDELAY reminder
        mov   dptr,#FIFORESET        
        mov   a,#06H
        movx  @dptr,a

nop                     ; just a SYNCDELAY reminder
        mov   dptr,#FIFORESET        
        mov   a,#00H
        movx  @dptr,a

nop                     ; just a SYNCDELAY reminder
        mov   dptr,#FIFORESET        
        mov   a,#08H
        movx  @dptr,a

nop                     ; just a SYNCDELAY reminder
        mov   dptr,#FIFORESET        
        mov   a,#00H
        movx  @dptr,a

;configure ep2 is 8 bit wide
nop
MOV DPTR, #EP2FIFOCFG  ; ep2 is 8bit wide
MOV A,#01H
MOVX @DPTR,A

NOP
MOV DPTR,#EP6FIFOCFG;ep6 is 8 bit wide
MOV A,#00H
MOVX @DPTR,A

NOP
mov dptr,#EP8FIFOCFG;EP8 IS 8BIT WIDE
MOV A,#00H
MOVX @DPTR,A

;skip uncommitted out packet
nop
mov dptr,#OUTPKTEND
mov a,#82h
movx @dptr,a

nop
mov dptr,#OUTPKTEND
mov a,#82h
movx @dptr,a

;skip uncommitted in packet
nop
mov dptr,#INPKTEND
mov a,#86h
movx @dptr,a

nop
mov dptr,#INPKTEND
mov a,#86h
movx @dptr,a
nop

mov dptr,#INPKTEND
mov a,#88h
movx @dptr,a

nop
mov dptr,#INPKTEND
mov a,#88h
movx @dptr,a

;BEGIN READ DATA FROM EP8

TD_CHECK:
NOP
     MOV DPTR,#EP8FIFOFLGS
MOVX A,@DPTR
JB ACC.0,TD_READ ;written 12 bytes data to ep8fifo

MOV DPTR,#EP6FIFOFLGS;
MOVX A,@DPTR
JB ACC.0,TD_READEP6;

MOV DPTR,#EP2FIFOFLGS
MOVX A,@DPTR
JB ACC.0,TD_Write
SJMP TD_CHECK

;read data from ep8 and write to ep2,use autopointers(1,2)
;autopointers1 refer to ep2(f000),autopointers2 refer2 to ep8(fc00)
;configure autopointers(1,2) address and autoptrsetup register
TD_Write:
nop
mov dptr,#OUTPKTEND
mov a,#02h
movx @dptr,a
sjmp TD_CHECK  ;check loop

TD_READ:
  nop
mov dptr,#INPKTEND
mov a,#08h
movx @dptr,a
sjmp TD_CHECK


TD_READEP6:
NOP
MOV DPTR,#INPKTEND
MOV A,#06H
MOVX @DPTR,A
SJMP TD_CHECK
      
        END
w_bingjian
驱动牛犊
驱动牛犊
  • 注册日期2004-05-11
  • 最后登录2005-04-13
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2004-12-09 21:48
大家都没遇到过此类问题。自己顶一下。
游客

返回顶部