Added new requsts. Moved repeated code lines. Returned GPL header

git-svn-id: svn://kolibrios.org@4985 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
gtament 2014-06-20 15:53:55 +00:00
parent c2d60da6d3
commit 244ddbdfc7

View File

@ -1,3 +1,10 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; 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
@ -223,6 +230,15 @@ endl
jz .version jz .version
dec eax ;1 dec eax ;1
jz .ftdi_get_list jz .ftdi_get_list
push eax edi
xor ecx, ecx
xor esi, esi
call CreateEvent
mov [EventData], eax
mov [EventData+4], edx
pop edi eax
dec eax ;2 dec eax ;2
jz .ftdi_set_bitmode jz .ftdi_set_bitmode
dec eax ;3 dec eax ;3
@ -235,82 +251,137 @@ endl
xor eax, eax xor eax, eax
ret ret
.ftdi_out_control_transfer:
DEBUGF 1,'K : ConfPacket %x %x\n', [ConfPacket], [ConfPacket+4]
mov ecx, [edi+input]
mov ebx, [ecx]
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_set_bitmode: .ftdi_set_bitmode:
DEBUGF 1,'K : FTDI Seting bitmode\n' DEBUGF 1,'K : FTDI Seting bitmode\n'
xor ecx, ecx
xor esi, esi
call CreateEvent
mov edi, [ioctl]
mov [EventData], eax
mov [EventData+4], edx
mov word[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_SET_BITMODE_REQUEST shl 8) 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+2], dx mov word[ConfPacket+2], dx
mov dword[ConfPacket+4], 0 mov dword[ConfPacket+4], 0
DEBUGF 1,'K : ConfPacket %x %x\n', [ConfPacket], [ConfPacket+4] jmp .ftdi_out_control_transfer
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 jmp .endswitch
.ftdi_setrtshigh: .ftdi_setrtshigh:
DEBUGF 1,'K : FTDI Setting RTS pin HIGH\n' 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], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_SET_MODEM_CTRL_REQUEST shl 8) + (SIO_SET_RTS_HIGH shl 16)
mov dword[ConfPacket+4], 0 mov dword[ConfPacket+4], 0
DEBUGF 1,'K : ConfPacket %x %x\n', [ConfPacket], [ConfPacket+4] jmp .ftdi_out_control_transfer
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 jmp .endswitch
.ftdi_setrtslow: .ftdi_setrtslow:
DEBUGF 1,'K : FTDI Setting RTS pin HIGH\n' DEBUGF 1,'K : FTDI Setting RTS pin LOW\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], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_SET_MODEM_CTRL_REQUEST shl 8) + (SIO_SET_RTS_LOW shl 16)
mov dword[ConfPacket+4], 0 mov dword[ConfPacket+4], 0
DEBUGF 1,'K : ConfPacket %x %x\n', [ConfPacket], [ConfPacket+4] jmp .ftdi_out_control_transfer
jmp .endswitch
.ftdi_setdtrhigh:
DEBUGF 1,'K : FTDI Setting DTR pin HIGH\n'
mov dword[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_SET_MODEM_CTRL_REQUEST shl 8) + (SIO_SET_DTR_HIGH shl 16)
mov dword[ConfPacket+4], 0
jmp .ftdi_out_control_transfer
jmp .endswitch
.ftdi_setdtrlow:
DEBUGF 1,'K : FTDI Setting DTR pin LOW\n'
mov dword[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_SET_MODEM_CTRL_REQUEST shl 8) + (SIO_SET_DTR_LOW shl 16)
mov dword[ConfPacket+4], 0
jmp .ftdi_out_control_transfer
jmp .endswitch
.ftdi_usb_reset:
DEBUGF 1,'K : FTDI Reseting\n'
mov dword[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_RESET_REQUEST shl 8) + (SIO_RESET_SIO shl 16)
mov dword[ConfPacket+4], 0
jmp .ftdi_out_control_transfer
jmp .endswitch
.ftdi_purge_rx_buf:
mov dword[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_RESET_REQUEST shl 8) + (SIO_RESET_PURGE_RX shl 16)
mov dword[ConfPacket+4], 0
jmp .ftdi_out_control_transfer
jmp .endswitch
.ftdi_purge_tx_buf:
mov dword[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_RESET_REQUEST shl 8) + (SIO_RESET_PURGE_TX shl 16)
mov dword[ConfPacket+4], 0
jmp .ftdi_out_control_transfer
jmp .endswitch
.ftdi_set_baudrate:
;!!!!!!!!!!!!!!!!!!!!
;jmp .ftdi_out_control_transfer
jmp .endswitch
.ftdi_set_line_property:
mov dword[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_SET_DATA_REQUEST shl 8)
mov edi, [edi+input]
mov dx, word[edi+4]
mov word[ConfPacket+2], dx
mov dword[ConfPacket+4], 0
jmp .ftdi_out_control_transfer
jmp .endswitch
.ftdi_set_latency_timer:
mov dword[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_SET_LATENCY_TIMER_REQUEST shl 8)
mov edi, [edi+input]
mov dx, word[edi+4]
mov word[ConfPacket+2], dx
mov dword[ConfPacket+4], 0
jmp .ftdi_out_control_transfer
jmp .endswitch
.ftdi_set_event_char:
mov dword[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_SET_EVENT_CHAR_REQUEST shl 8)
mov edi, [edi+input]
mov dx, word[edi+4]
mov word[ConfPacket+2], dx
mov dword[ConfPacket+4], 0
jmp .ftdi_out_control_transfer
jmp .endswitch
.ftdi_set_error_char:
mov dword[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_SET_ERROR_CHAR_REQUEST shl 8)
mov edi, [edi+input]
mov dx, word[edi+4]
mov word[ConfPacket+2], dx
mov dword[ConfPacket+4], 0
jmp .ftdi_out_control_transfer
jmp .endswitch
.ftdi_read_pins:
DEBUGF 1,'K : FTDI Reading pins\n'
mov dword[ConfPacket], FTDI_DEVICE_IN_REQTYPE + (SIO_READ_PINS_REQUEST shl 8) + (0 shl 16)
mov dword[ConfPacket+4], 0x00000001
mov edi, [edi+input] mov edi, [edi+input]
mov ebx, [edi] mov ebx, [edi]
lea esi, [ConfPacket] lea esi, [ConfPacket]
lea edi, [EventData] lea edi, [EventData]
stdcall USBControlTransferAsync, [ebx + ftdi_context.nullP], esi, 0, 0, control_callback, edi, 0 mov ecx, [ioctl]
mov ecx, [ecx+output]
stdcall USBControlTransferAsync, [ebx + ftdi_context.nullP], esi, ecx, 1, control_callback, edi, 0
DEBUGF 1, 'K : Returned value is %d\n', eax DEBUGF 1, 'K : Returned value is %d\n', eax
mov eax, [EventData] mov eax, [EventData]
mov ebx, [EventData+4] mov ebx, [EventData+4]
call WaitEvent call WaitEvent
jmp .endswitch jmp .endswitch
.ftdi_read_pins: .ftdi_read_data:
DEBUGF 1,'K : FTDI Reading pins\n' ;stdcall USBNormalTransferAsync, [ebx + ftdi_context.inEP], [ebx + ftdi_context.readBufPtr], [ebx + 1]
call CreateEvent
mov [EventData], eax
mov [EventData+4], edx
mov eax, FTDI_DEVICE_IN_REQTYPE + (SIO_READ_PINS_REQUEST shl 8)
mov dword[ConfPacket], eax
jmp .endswitch
.ftdi_get_list: .ftdi_get_list:
call linkedlist.gethead call linkedlist.gethead
@ -320,6 +391,7 @@ endl
mov eax, 4 mov eax, 4
mov [edi+out_size], eax mov [edi+out_size], eax
jmp .endswitch jmp .endswitch
endp endp
restore handle restore handle
restore io_code restore io_code
@ -332,7 +404,7 @@ restore out_size
align 4 align 4
proc control_callback stdcall uses ebx edi esi, .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] DEBUGF 1, 'K : status is %d\n', [.status]
mov ecx, [.calldata] mov ecx, [.calldata]
mov eax, [ecx] mov eax, [ecx]
mov ebx, [ecx+4] mov ebx, [ecx+4]