Driver now stable. Added new requests (setrtshigh and setrtslow). All requests have some error, as a result status of usb request is 8

git-svn-id: svn://kolibrios.org@4984 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
gtament 2014-06-18 19:48:15 +00:00
parent 1974f465e8
commit c2d60da6d3
1 changed files with 55 additions and 12 deletions

View File

@ -1,10 +1,3 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; standard driver stuff ; standard driver stuff
format MS COFF format MS COFF
@ -178,7 +171,7 @@ proc AddDevice stdcall uses ebx, .config_pipe:DWORD, .config_descr:DWORD, .inter
cmp word[eax+usb_descr.idVendor], 0x0403 cmp word[eax+usb_descr.idVendor], 0x0403
jnz .notftdi jnz .notftdi
DEBUGF 1,'K : FTDI USB device detected\n' DEBUGF 1,'K : FTDI USB device detected\n'
mov eax, sizeof.ftdi_context movi eax, sizeof.ftdi_context
call Kmalloc call Kmalloc
test eax, eax test eax, eax
jnz @f jnz @f
@ -232,6 +225,10 @@ endl
jz .ftdi_get_list jz .ftdi_get_list
dec eax ;2 dec eax ;2
jz .ftdi_set_bitmode jz .ftdi_set_bitmode
dec eax ;3
jz .ftdi_setrtshigh
dec eax ;4
jz .ftdi_setrtslow
.version: .version:
.endswitch: .endswitch:
@ -246,10 +243,11 @@ endl
mov edi, [ioctl] mov edi, [ioctl]
mov [EventData], eax mov [EventData], eax
mov [EventData+4], edx mov [EventData+4], edx
mov dword[ConfPacket], (FTDI_DEVICE_IN_REQTYPE) + (SIO_SET_BITMODE_REQUEST shl 8) + (0x0000 shl 16) mov word[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_SET_BITMODE_REQUEST shl 8)
mov edi, [edi+input] mov edi, [edi+input]
mov dx, word[edi+4] mov dx, word[edi+4]
mov word[ConfPacket+4], dx mov word[ConfPacket+2], dx
mov dword[ConfPacket+4], 0
DEBUGF 1,'K : ConfPacket %x %x\n', [ConfPacket], [ConfPacket+4] DEBUGF 1,'K : ConfPacket %x %x\n', [ConfPacket], [ConfPacket+4]
mov ebx, [edi] mov ebx, [edi]
lea esi, [ConfPacket] lea esi, [ConfPacket]
@ -261,6 +259,50 @@ endl
call WaitEvent call WaitEvent
jmp .endswitch jmp .endswitch
.ftdi_setrtshigh:
DEBUGF 1,'K : FTDI Setting RTS pin HIGH\n'
xor ecx, ecx
xor esi, esi
call CreateEvent
mov edi, [ioctl]
mov [EventData], eax
mov [EventData+4], edx
mov dword[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_SET_MODEM_CTRL_REQUEST shl 8) + (SIO_SET_RTS_HIGH shl 16)
mov dword[ConfPacket+4], 0
DEBUGF 1,'K : ConfPacket %x %x\n', [ConfPacket], [ConfPacket+4]
mov edi, [edi+input]
mov ebx, [edi]
lea esi, [ConfPacket]
lea edi, [EventData]
stdcall USBControlTransferAsync, [ebx + ftdi_context.nullP], esi, 0, 0, control_callback, edi, 0
DEBUGF 1, 'K : Returned value is %d\n', eax
mov eax, [EventData]
mov ebx, [EventData+4]
call WaitEvent
jmp .endswitch
.ftdi_setrtslow:
DEBUGF 1,'K : FTDI Setting RTS pin HIGH\n'
xor ecx, ecx
xor esi, esi
call CreateEvent
mov edi, [ioctl]
mov [EventData], eax
mov [EventData+4], edx
mov dword[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_SET_MODEM_CTRL_REQUEST shl 8) + (SIO_SET_RTS_LOW shl 16)
mov dword[ConfPacket+4], 0
DEBUGF 1,'K : ConfPacket %x %x\n', [ConfPacket], [ConfPacket+4]
mov edi, [edi+input]
mov ebx, [edi]
lea esi, [ConfPacket]
lea edi, [EventData]
stdcall USBControlTransferAsync, [ebx + ftdi_context.nullP], esi, 0, 0, control_callback, edi, 0
DEBUGF 1, 'K : Returned value is %d\n', eax
mov eax, [EventData]
mov ebx, [EventData+4]
call WaitEvent
jmp .endswitch
.ftdi_read_pins: .ftdi_read_pins:
DEBUGF 1,'K : FTDI Reading pins\n' DEBUGF 1,'K : FTDI Reading pins\n'
call CreateEvent call CreateEvent
@ -288,14 +330,15 @@ restore out_size
align 4 align 4
proc control_callback stdcall uses ebx, edi, .pipe:DWORD, .status:DWORD, .buffer:DWORD, .length:DWORD, .calldata:DWORD proc control_callback stdcall uses ebx edi esi, .pipe:DWORD, .status:DWORD, .buffer:DWORD, .length:DWORD, .calldata:DWORD
DEBUGF 1, 'K : status is %d\n', [.status+24h]
mov ecx, [.calldata] mov ecx, [.calldata]
mov eax, [ecx] mov eax, [ecx]
mov ebx, [ecx+4] mov ebx, [ecx+4]
xor edx, edx xor edx, edx
call RaiseEvent call RaiseEvent
DEBUGF 1, 'K : status is %d\n', [.status+24h]
ret ret
endp endp