forked from KolibriOS/kolibrios
Small bugfixes. Fixed stack problem in ftdi_set_baudrate. Updated license header
git-svn-id: svn://kolibrios.org@5035 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
69c37e86f7
commit
21cbeaec75
@ -3,6 +3,13 @@
|
|||||||
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; 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
|
format MS COFF
|
||||||
@ -15,10 +22,10 @@ __DEBUG_LEVEL__ = 1
|
|||||||
node equ ftdi_context
|
node equ ftdi_context
|
||||||
node.next equ ftdi_context.next_context
|
node.next equ ftdi_context.next_context
|
||||||
|
|
||||||
include '../../proc32.inc'
|
include '../proc32.inc'
|
||||||
include '../../imports.inc'
|
include '../imports.inc'
|
||||||
include '../../fdo.inc'
|
include '../fdo.inc'
|
||||||
include '../../struct.inc'
|
include '../struct.inc'
|
||||||
|
|
||||||
public START
|
public START
|
||||||
public version
|
public version
|
||||||
@ -311,6 +318,8 @@ endl
|
|||||||
|
|
||||||
mov ebx, [esi+4]
|
mov ebx, [esi+4]
|
||||||
mov ecx, [ebx + ftdi_context.lockPID]
|
mov ecx, [ebx + ftdi_context.lockPID]
|
||||||
|
cmp dword[esi], 0
|
||||||
|
jz .error
|
||||||
cmp ecx, [esi]
|
cmp ecx, [esi]
|
||||||
jz .pid_ok
|
jz .pid_ok
|
||||||
mov esi, [edi+output]
|
mov esi, [edi+output]
|
||||||
@ -390,6 +399,7 @@ endl
|
|||||||
mov esi, [edi+output]
|
mov esi, [edi+output]
|
||||||
mov [esi], dword 'ERR0'
|
mov [esi], dword 'ERR0'
|
||||||
or [esi], eax
|
or [esi], eax
|
||||||
|
ret
|
||||||
.endswitch:
|
.endswitch:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
@ -430,27 +440,27 @@ endl
|
|||||||
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'
|
||||||
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)
|
||||||
jmp .ftdi_out_control_transfer_noinp
|
jmp .ftdi_out_control_transfer_noinp
|
||||||
|
|
||||||
.ftdi_setrtslow:
|
.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)
|
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
|
jmp .ftdi_out_control_transfer_noinp
|
||||||
|
|
||||||
.ftdi_setdtrhigh:
|
.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)
|
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
|
jmp .ftdi_out_control_transfer_noinp
|
||||||
|
|
||||||
.ftdi_setdtrlow:
|
.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)
|
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
|
jmp .ftdi_out_control_transfer_noinp
|
||||||
|
|
||||||
.ftdi_usb_reset:
|
.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)
|
mov dword[ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) + (SIO_RESET_REQUEST shl 8) + (SIO_RESET_SIO shl 16)
|
||||||
jmp .ftdi_out_control_transfer_noinp
|
jmp .ftdi_out_control_transfer_noinp
|
||||||
|
|
||||||
@ -463,7 +473,6 @@ endl
|
|||||||
jmp .ftdi_out_control_transfer_noinp
|
jmp .ftdi_out_control_transfer_noinp
|
||||||
|
|
||||||
.ftdi_set_bitmode:
|
.ftdi_set_bitmode:
|
||||||
DEBUGF 1,'K : FTDI Seting bitmode\n'
|
|
||||||
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)
|
||||||
jmp .ftdi_out_control_transfer_withinp
|
jmp .ftdi_out_control_transfer_withinp
|
||||||
|
|
||||||
@ -602,7 +611,7 @@ endl
|
|||||||
jmp .eventdestroy
|
jmp .eventdestroy
|
||||||
@@:
|
@@:
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
mov dword[ConfPacket], eax
|
mov dword[ConfPacket], eax ; Store in ConfPAcket ptr to allocated memory
|
||||||
;---Dirty hack end
|
;---Dirty hack end
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
.read_loop:
|
.read_loop:
|
||||||
@ -628,6 +637,7 @@ endl
|
|||||||
cmp [EventData+8], -1
|
cmp [EventData+8], -1
|
||||||
jz .error
|
jz .error
|
||||||
add ecx, [EventData+8]
|
add ecx, [EventData+8]
|
||||||
|
DEBUGF 1, 'K : In buffer %x\n', [edi]
|
||||||
jmp .read_loop
|
jmp .read_loop
|
||||||
;---Dirty hack begin
|
;---Dirty hack begin
|
||||||
.read_end:
|
.read_end:
|
||||||
@ -705,13 +715,12 @@ endl
|
|||||||
jmp .endswitch
|
jmp .endswitch
|
||||||
|
|
||||||
.ftdi_lock:
|
.ftdi_lock:
|
||||||
DEBUGF 1, 'K : FTDI lock attempt\n'
|
|
||||||
mov esi, [edi+input]
|
mov esi, [edi+input]
|
||||||
mov ebx, [esi+4]
|
mov ebx, [esi+4]
|
||||||
mov eax, [ebx + ftdi_context.lockPID]
|
mov eax, [ebx + ftdi_context.lockPID]
|
||||||
|
DEBUGF 1, 'K : to PID %x from PID %x\n', [esi], eax
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .lockedby
|
jnz .lockedby
|
||||||
DEBUGF 1, 'K : Lock success\n'
|
|
||||||
mov eax, [esi]
|
mov eax, [esi]
|
||||||
mov [ebx + ftdi_context.lockPID], eax
|
mov [ebx + ftdi_context.lockPID], eax
|
||||||
.lockedby:
|
.lockedby:
|
||||||
@ -724,6 +733,7 @@ endl
|
|||||||
mov edi, [edi+output]
|
mov edi, [edi+output]
|
||||||
mov ebx, [esi+4]
|
mov ebx, [esi+4]
|
||||||
mov eax, [ebx + ftdi_context.lockPID]
|
mov eax, [ebx + ftdi_context.lockPID]
|
||||||
|
DEBUGF 1, 'K : to PID %x from PID %x\n', [esi], eax
|
||||||
cmp eax, [esi]
|
cmp eax, [esi]
|
||||||
jnz .unlockimp
|
jnz .unlockimp
|
||||||
mov [ebx + ftdi_context.lockPID], 0
|
mov [ebx + ftdi_context.lockPID], 0
|
||||||
@ -843,12 +853,11 @@ C_CLK = 48000000
|
|||||||
mov edx, eax ; edx - encoded_divisor
|
mov edx, eax ; edx - encoded_divisor
|
||||||
shr edx, 3
|
shr edx, 3
|
||||||
and eax, 0x7
|
and eax, 0x7
|
||||||
push esp
|
|
||||||
push 7 6 5 1 4 2 3 0
|
push 7 6 5 1 4 2 3 0
|
||||||
mov eax, [esp+eax*4]
|
mov eax, [esp+eax*4]
|
||||||
shl eax, 14
|
shl eax, 14
|
||||||
or edx, eax
|
or edx, eax
|
||||||
mov esp, [esp+36]
|
add esp, 32
|
||||||
|
|
||||||
.calcend:
|
.calcend:
|
||||||
mov eax, edx ; eax - *value
|
mov eax, edx ; eax - *value
|
||||||
|
Loading…
Reference in New Issue
Block a user