Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5035 → Rev 5034

/drivers/usb/usbftdi/usbftdi.asm
3,13 → 3,6
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; FTDI chips driver for KolibriOS ;;
;; ;;
;; Written by gtament@gmail.com ;;
;; ;;
;; GNU GENERAL PUBLIC LICENSE ;;
;; Version 2, June 1991 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
format MS COFF
22,10 → 15,10
node equ ftdi_context
node.next equ ftdi_context.next_context
 
include '../proc32.inc'
include '../imports.inc'
include '../fdo.inc'
include '../struct.inc'
include '../../proc32.inc'
include '../../imports.inc'
include '../../fdo.inc'
include '../../struct.inc'
 
public START
public version
318,8 → 311,6
mov ebx, [esi+4]
mov ecx, [ebx + ftdi_context.lockPID]
cmp dword[esi], 0
jz .error
cmp ecx, [esi]
jz .pid_ok
mov esi, [edi+output]
399,7 → 390,6
mov esi, [edi+output]
mov [esi], dword 'ERR0'
or [esi], eax
ret
.endswitch:
xor eax, eax
ret
440,27 → 430,27
jmp .endswitch
.ftdi_setrtshigh:
;DEBUGF 1,'K : FTDI Setting RTS pin HIGH\n'
DEBUGF 1,'K : FTDI Setting RTS pin HIGH\n'
mov dword[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_SET_MODEM_CTRL_REQUEST shl 8) + (SIO_SET_RTS_HIGH shl 16)
jmp .ftdi_out_control_transfer_noinp
 
.ftdi_setrtslow:
;DEBUGF 1,'K : FTDI Setting RTS pin LOW\n'
DEBUGF 1,'K : FTDI Setting RTS pin LOW\n'
mov dword[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_SET_MODEM_CTRL_REQUEST shl 8) + (SIO_SET_RTS_LOW shl 16)
jmp .ftdi_out_control_transfer_noinp
.ftdi_setdtrhigh:
;DEBUGF 1,'K : FTDI Setting DTR pin HIGH\n'
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)
jmp .ftdi_out_control_transfer_noinp
 
.ftdi_setdtrlow:
;DEBUGF 1,'K : FTDI Setting DTR pin LOW\n'
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)
jmp .ftdi_out_control_transfer_noinp
.ftdi_usb_reset:
;DEBUGF 1,'K : FTDI Reseting\n'
DEBUGF 1,'K : FTDI Reseting\n'
mov dword[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_RESET_REQUEST shl 8) + (SIO_RESET_SIO shl 16)
jmp .ftdi_out_control_transfer_noinp
473,6 → 463,7
jmp .ftdi_out_control_transfer_noinp
.ftdi_set_bitmode:
DEBUGF 1,'K : FTDI Seting bitmode\n'
mov word[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_SET_BITMODE_REQUEST shl 8)
jmp .ftdi_out_control_transfer_withinp
611,7 → 602,7
jmp .eventdestroy
@@:
mov edi, eax
mov dword[ConfPacket], eax ; Store in ConfPAcket ptr to allocated memory
mov dword[ConfPacket], eax
;---Dirty hack end
xor ecx, ecx
.read_loop:
637,7 → 628,6
cmp [EventData+8], -1
jz .error
add ecx, [EventData+8]
DEBUGF 1, 'K : In buffer %x\n', [edi]
jmp .read_loop
;---Dirty hack begin
.read_end:
715,12 → 705,13
jmp .endswitch
.ftdi_lock:
DEBUGF 1, 'K : FTDI lock attempt\n'
mov esi, [edi+input]
mov ebx, [esi+4]
mov eax, [ebx + ftdi_context.lockPID]
DEBUGF 1, 'K : to PID %x from PID %x\n', [esi], eax
test eax, eax
jnz .lockedby
DEBUGF 1, 'K : Lock success\n'
mov eax, [esi]
mov [ebx + ftdi_context.lockPID], eax
.lockedby:
733,7 → 724,6
mov edi, [edi+output]
mov ebx, [esi+4]
mov eax, [ebx + ftdi_context.lockPID]
DEBUGF 1, 'K : to PID %x from PID %x\n', [esi], eax
cmp eax, [esi]
jnz .unlockimp
mov [ebx + ftdi_context.lockPID], 0
853,11 → 843,12
mov edx, eax ; edx - encoded_divisor
shr edx, 3
and eax, 0x7
push esp
push 7 6 5 1 4 2 3 0
mov eax, [esp+eax*4]
shl eax, 14
or edx, eax
add esp, 32
mov esp, [esp+36]
.calcend:
mov eax, edx ; eax - *value