forked from KolibriOS/kolibrios
Reorganization interrupts handlers part 2.
(I hope, I didn't something stupid.) Fixed bug in get_pid function. Added copyright in com mouse driver. Fixed incorrect comment inscription in boot\ru.inc . git-svn-id: svn://kolibrios.org@774 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
b38aa8a9e9
commit
66658538e4
@ -4,12 +4,12 @@ include '../../../proc32.inc'
|
|||||||
include '../../../imports.inc'
|
include '../../../imports.inc'
|
||||||
|
|
||||||
struc IOCTL
|
struc IOCTL
|
||||||
{ .handle dd ?
|
{ .handle dd ?
|
||||||
.io_code dd ?
|
.io_code dd ?
|
||||||
.input dd ?
|
.input dd ?
|
||||||
.inp_size dd ?
|
.inp_size dd ?
|
||||||
.output dd ?
|
.output dd ?
|
||||||
.out_size dd ?
|
.out_size dd ?
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual at 0
|
virtual at 0
|
||||||
@ -22,7 +22,7 @@ public version
|
|||||||
DRV_ENTRY equ 1
|
DRV_ENTRY equ 1
|
||||||
DRV_EXIT equ -1
|
DRV_EXIT equ -1
|
||||||
|
|
||||||
MT_3B equ 0
|
MT_3B equ 0
|
||||||
MT_3BScroll equ 3
|
MT_3BScroll equ 3
|
||||||
MT_5BScroll equ 4
|
MT_5BScroll equ 4
|
||||||
|
|
||||||
@ -33,85 +33,85 @@ section '.flat' code readable align 16
|
|||||||
|
|
||||||
proc START stdcall, state:dword
|
proc START stdcall, state:dword
|
||||||
|
|
||||||
cmp [state], DRV_ENTRY
|
cmp [state], DRV_ENTRY
|
||||||
jne .fin
|
jne .fin
|
||||||
.init:
|
.init:
|
||||||
|
|
||||||
call detect_mouse
|
call detect_mouse
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jnz .exit
|
jnz .exit
|
||||||
|
|
||||||
mov [MouseType],MT_3B
|
mov [MouseType],MT_3B
|
||||||
|
|
||||||
call try_mode_ID3
|
call try_mode_ID3
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jnz .stop_try
|
jnz .stop_try
|
||||||
mov [MouseType],MT_3BScroll
|
mov [MouseType],MT_3BScroll
|
||||||
|
|
||||||
call try_mode_ID4
|
call try_mode_ID4
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jnz .stop_try
|
jnz .stop_try
|
||||||
mov [MouseType],MT_5BScroll
|
mov [MouseType],MT_5BScroll
|
||||||
|
|
||||||
.stop_try:
|
.stop_try:
|
||||||
|
|
||||||
mov bl, 0x20 ; read command byte
|
mov bl, 0x20 ; read command byte
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
cmp ah,1
|
cmp ah,1
|
||||||
je .exit
|
je .exit
|
||||||
|
|
||||||
call kbd_read
|
call kbd_read
|
||||||
cmp ah,1
|
cmp ah,1
|
||||||
je .exit
|
je .exit
|
||||||
|
|
||||||
or al, 10b
|
or al, 10b
|
||||||
push eax
|
push eax
|
||||||
mov bl, 0x60 ; write command byte
|
mov bl, 0x60 ; write command byte
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
cmp ah,1
|
cmp ah,1
|
||||||
je .exit
|
je .exit
|
||||||
|
|
||||||
pop eax
|
pop eax
|
||||||
call kbd_write
|
call kbd_write
|
||||||
cmp ah,1
|
cmp ah,1
|
||||||
je .exit
|
je .exit
|
||||||
|
|
||||||
mov al, 0xF4 ; enable data reporting
|
mov al, 0xF4 ; enable data reporting
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
|
|
||||||
mov bl, 0xAE ; enable keyboard interface
|
mov bl, 0xAE ; enable keyboard interface
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
|
|
||||||
stdcall AttachIntHandler, 12, irq_handler
|
stdcall AttachIntHandler, 12, irq_handler, dword 0
|
||||||
stdcall RegService, my_service, service_proc
|
stdcall RegService, my_service, service_proc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.fin:
|
.fin:
|
||||||
;stdcall DetachIntHandler, 12, irq_handler
|
;stdcall DetachIntHandler, 12, irq_handler
|
||||||
mov bl, 0xA7 ; disable mouse interface
|
mov bl, 0xA7 ; disable mouse interface
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.exit:
|
.exit:
|
||||||
mov bl, 0xA7 ; disable mouse interface
|
mov bl, 0xA7 ; disable mouse interface
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
mov bl, 0xAE ; enable keyboard interface
|
mov bl, 0xAE ; enable keyboard interface
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
proc service_proc stdcall, ioctl:dword
|
proc service_proc stdcall, ioctl:dword
|
||||||
mov edi, [ioctl]
|
mov edi, [ioctl]
|
||||||
mov eax, [edi+IOCTL.io_code]
|
mov eax, [edi+IOCTL.io_code]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .getversion
|
jz .getversion
|
||||||
cmp eax,1
|
cmp eax,1
|
||||||
jz .gettype
|
jz .gettype
|
||||||
|
|
||||||
.err:
|
.err:
|
||||||
or eax, -1
|
or eax, -1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.ok:
|
.ok:
|
||||||
@ -120,13 +120,13 @@ proc service_proc stdcall, ioctl:dword
|
|||||||
|
|
||||||
.getversion:
|
.getversion:
|
||||||
cmp [edi+IOCTL.out_size], 4
|
cmp [edi+IOCTL.out_size], 4
|
||||||
jb .err
|
jb .err
|
||||||
mov edi, [edi+IOCTL.output]
|
mov edi, [edi+IOCTL.output]
|
||||||
mov dword [edi], PS2_DRV_VER ; version of driver
|
mov dword [edi], PS2_DRV_VER ; version of driver
|
||||||
jmp .ok
|
jmp .ok
|
||||||
.gettype:
|
.gettype:
|
||||||
cmp [edi+IOCTL.out_size], 4
|
cmp [edi+IOCTL.out_size], 4
|
||||||
jb .err
|
jb .err
|
||||||
mov edi, [edi+IOCTL.output]
|
mov edi, [edi+IOCTL.output]
|
||||||
mov eax,[MouseType]
|
mov eax,[MouseType]
|
||||||
mov dword [edi], eax ; mouse type
|
mov dword [edi], eax ; mouse type
|
||||||
@ -138,95 +138,95 @@ detect_mouse:
|
|||||||
mov bl, 0xAD ; disable keyboard interface
|
mov bl, 0xAD ; disable keyboard interface
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
cmp ah,1
|
cmp ah,1
|
||||||
je .fail
|
je .fail
|
||||||
|
|
||||||
mov bl, 0xA8 ; enable mouse interface
|
mov bl, 0xA8 ; enable mouse interface
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
cmp ah,1
|
cmp ah,1
|
||||||
je .fail
|
je .fail
|
||||||
|
|
||||||
mov al, 0xFF ; reset
|
mov al, 0xFF ; reset
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
|
|
||||||
call mouse_read
|
call mouse_read
|
||||||
jc .fail
|
jc .fail
|
||||||
cmp al, 0xAA
|
cmp al, 0xAA
|
||||||
jne .fail ; dead mouse
|
jne .fail ; dead mouse
|
||||||
|
|
||||||
; get device ID
|
; get device ID
|
||||||
call mouse_read
|
call mouse_read
|
||||||
jc .fail
|
jc .fail
|
||||||
cmp al, 0x00
|
cmp al, 0x00
|
||||||
jne .fail ; unknown device
|
jne .fail ; unknown device
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
or eax,-1
|
or eax,-1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
try_mode_ID3:
|
try_mode_ID3:
|
||||||
mov al, 0xF3 ;Set Sample Rate
|
mov al, 0xF3 ;Set Sample Rate
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0xC8 ;200d
|
mov al, 0xC8 ;200d
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0xF3 ;Set Sample Rate
|
mov al, 0xF3 ;Set Sample Rate
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0x64 ;100d
|
mov al, 0x64 ;100d
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0xF3 ;Set Sample Rate
|
mov al, 0xF3 ;Set Sample Rate
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0x50 ;80d
|
mov al, 0x50 ;80d
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
|
|
||||||
mov al, 0xF2 ;Get device id
|
mov al, 0xF2 ;Get device id
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
|
|
||||||
call mouse_read
|
call mouse_read
|
||||||
jc .fail
|
jc .fail
|
||||||
cmp al, 0x03
|
cmp al, 0x03
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
ret
|
ret
|
||||||
.fail:
|
.fail:
|
||||||
or eax,-1
|
or eax,-1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
try_mode_ID4:
|
try_mode_ID4:
|
||||||
mov al, 0xF3 ;Set Sample Rate
|
mov al, 0xF3 ;Set Sample Rate
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0xC8 ;200d
|
mov al, 0xC8 ;200d
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0xF3 ;Set Sample Rate
|
mov al, 0xF3 ;Set Sample Rate
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0xC8 ;100d
|
mov al, 0xC8 ;100d
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0xF3 ;Set Sample Rate
|
mov al, 0xF3 ;Set Sample Rate
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0x50 ;80d
|
mov al, 0x50 ;80d
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
|
|
||||||
mov al, 0xF2 ;Get device id
|
mov al, 0xF2 ;Get device id
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
|
|
||||||
call mouse_read
|
call mouse_read
|
||||||
jc .fail
|
jc .fail
|
||||||
cmp al, 0x04
|
cmp al, 0x04
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ try_mode_ID4:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
or eax,-1
|
or eax,-1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
include 'ps2m_iofuncs.inc'
|
include 'ps2m_iofuncs.inc'
|
||||||
@ -242,12 +242,12 @@ include 'ps2m_irqh.inc'
|
|||||||
|
|
||||||
section '.data' data readable writable align 16
|
section '.data' data readable writable align 16
|
||||||
|
|
||||||
version dd 0x00050005
|
version dd 0x00050005
|
||||||
my_service db 'ps2mouse',0
|
my_service db 'ps2mouse',0
|
||||||
|
|
||||||
;iofuncs data
|
;iofuncs data
|
||||||
mouse_cmd_byte db 0
|
mouse_cmd_byte db 0
|
||||||
mouse_nr_tries db 0
|
mouse_nr_tries db 0
|
||||||
mouse_nr_resends db 0
|
mouse_nr_resends db 0
|
||||||
|
|
||||||
;hid data
|
;hid data
|
||||||
@ -259,10 +259,10 @@ third_byte db 0
|
|||||||
fourth_byte db 0
|
fourth_byte db 0
|
||||||
|
|
||||||
;main data
|
;main data
|
||||||
MouseType dd 0
|
MouseType dd 0
|
||||||
|
|
||||||
XMoving dd 0
|
XMoving dd 0
|
||||||
YMoving dd 0
|
YMoving dd 0
|
||||||
ZMoving dd 0
|
ZMoving dd 0
|
||||||
ButtonState dd 0
|
ButtonState dd 0
|
||||||
;timerTicks dd 0
|
;timerTicks dd 0
|
||||||
|
@ -349,7 +349,7 @@ proc START stdcall, state:dword
|
|||||||
bt eax, ebx
|
bt eax, ebx
|
||||||
jnc .fail_msg
|
jnc .fail_msg
|
||||||
|
|
||||||
stdcall AttachIntHandler, ebx, ac97_irq
|
stdcall AttachIntHandler, ebx, ac97_irq, dword 0
|
||||||
.reg:
|
.reg:
|
||||||
|
|
||||||
stdcall RegService, sz_sound_srv, service_proc
|
stdcall RegService, sz_sound_srv, service_proc
|
||||||
|
@ -13,7 +13,7 @@ $Revision$
|
|||||||
; Modifyed by BadBugsKiller 12.01.2004 17:45
|
; Modifyed by BadBugsKiller 12.01.2004 17:45
|
||||||
; Шрифт уменьшен в размере и теперь состоит из 2-ух частей,
|
; Шрифт уменьшен в размере и теперь состоит из 2-ух частей,
|
||||||
; содержащих только символы русского алфавита.
|
; содержащих только символы русского алфавита.
|
||||||
; символы в кодировке ASCII (ДОС'овская), кодовая станица 866.
|
; символы в кодировке ASCII (ДОС'овская), кодовая страница 866.
|
||||||
RU_FNT1:
|
RU_FNT1:
|
||||||
db 0x00, 0x00, 0x1E, 0x36, 0x66, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
db 0x00, 0x00, 0x1E, 0x36, 0x66, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||||
db 0x00, 0x00, 0xFE, 0x62, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00
|
db 0x00, 0x00, 0xFE, 0x62, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00
|
||||||
|
@ -14,7 +14,7 @@ DRV_CURRENT equ 5 ;current drivers model version
|
|||||||
DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT
|
DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc attach_int_handler stdcall, irq:dword, handler:dword
|
proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword
|
||||||
|
|
||||||
mov ebx, [irq] ;irq num
|
mov ebx, [irq] ;irq num
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
@ -25,13 +25,23 @@ proc attach_int_handler stdcall, irq:dword, handler:dword
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .err
|
jz .err
|
||||||
cmp [irq_owner + 4 * ebx], 0
|
cmp [irq_owner + 4 * ebx], 0
|
||||||
jne .err
|
je @f
|
||||||
|
|
||||||
|
mov ecx, [irq_rights + 4 * ebx] ; Rights : 0 - full access, 1 - read only, 2 - forbidden
|
||||||
|
test ecx, ecx
|
||||||
|
jnz .err
|
||||||
|
|
||||||
|
@@:
|
||||||
mov [irq_tab+ebx*4], eax
|
mov [irq_tab+ebx*4], eax
|
||||||
|
|
||||||
|
mov eax, [access_rights]
|
||||||
|
mov [irq_rights + 4 * ebx], eax
|
||||||
;push eax
|
;push eax
|
||||||
;mov eax, [TASK_BASE]
|
;mov eax, [TASK_BASE]
|
||||||
;mov eax, [eax + TASKDATA.pid]
|
;mov eax, [eax + TASKDATA.pid] ; faster or smaller? :)
|
||||||
mov [irq_owner + 4 * ebx], 1
|
call get_pid
|
||||||
|
|
||||||
|
mov [irq_owner + 4 * ebx], eax
|
||||||
;pop eax
|
;pop eax
|
||||||
|
|
||||||
stdcall enable_irq, [irq]
|
stdcall enable_irq, [irq]
|
||||||
@ -41,6 +51,28 @@ proc attach_int_handler stdcall, irq:dword, handler:dword
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
uglobal
|
||||||
|
|
||||||
|
irq_rights rd 16
|
||||||
|
|
||||||
|
endg
|
||||||
|
|
||||||
|
proc get_int_handler stdcall, irq:dword
|
||||||
|
|
||||||
|
mov eax, [irq]
|
||||||
|
|
||||||
|
cmp [irq_rights + 4 * eax], dword 1
|
||||||
|
ja .err
|
||||||
|
|
||||||
|
mov eax, [irq_tab + 4 * eax]
|
||||||
|
ret
|
||||||
|
|
||||||
|
.err:
|
||||||
|
xor eax, eax
|
||||||
|
ret
|
||||||
|
|
||||||
|
endp
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc detach_int_handler
|
proc detach_int_handler
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ iglobal
|
|||||||
szGetService db 'GetService',0
|
szGetService db 'GetService',0
|
||||||
szServiceHandler db 'ServiceHandler',0
|
szServiceHandler db 'ServiceHandler',0
|
||||||
szAttachIntHandler db 'AttachIntHandler',0
|
szAttachIntHandler db 'AttachIntHandler',0
|
||||||
|
szGetIntHandler db 'GetIntHandler', 0
|
||||||
szFpuSave db 'FpuSave',0
|
szFpuSave db 'FpuSave',0
|
||||||
szFpuRestore db 'FpuRestore',0
|
szFpuRestore db 'FpuRestore',0
|
||||||
szReservePortArea db 'ReservePortArea',0
|
szReservePortArea db 'ReservePortArea',0
|
||||||
@ -88,6 +89,7 @@ kernel_export:
|
|||||||
dd szGetService , get_service
|
dd szGetService , get_service
|
||||||
dd szServiceHandler , srv_handler
|
dd szServiceHandler , srv_handler
|
||||||
dd szAttachIntHandler, attach_int_handler
|
dd szAttachIntHandler, attach_int_handler
|
||||||
|
dd szGetIntHandler , get_int_handler
|
||||||
dd szFpuSave , fpu_save
|
dd szFpuSave , fpu_save
|
||||||
dd szFpuRestore , fpu_restore
|
dd szFpuRestore , fpu_restore
|
||||||
dd szReservePortArea , r_f_port_area
|
dd szReservePortArea , r_f_port_area
|
||||||
|
@ -668,13 +668,18 @@ term9:
|
|||||||
shl eax, 5
|
shl eax, 5
|
||||||
mov eax,[eax+CURRENT_TASK+TASKDATA.pid]
|
mov eax,[eax+CURRENT_TASK+TASKDATA.pid]
|
||||||
mov edi,irq_owner
|
mov edi,irq_owner
|
||||||
mov ecx,16
|
xor ebx, ebx
|
||||||
|
xor edx, edx
|
||||||
newirqfree:
|
newirqfree:
|
||||||
scasd
|
cmp [edi + 4 * ebx], eax
|
||||||
jne nofreeirq
|
jne nofreeirq
|
||||||
mov [edi-4],dword 0
|
mov [edi + 4 * ebx], edx ; remove irq reservation
|
||||||
|
mov [irq_tab + 4 * ebx], edx ; remove irq handler
|
||||||
|
mov [irq_rights + 4 * ebx], edx ; set access rights to full access
|
||||||
nofreeirq:
|
nofreeirq:
|
||||||
loop newirqfree
|
inc ebx
|
||||||
|
cmp ebx, 16
|
||||||
|
jb newirqfree
|
||||||
popa
|
popa
|
||||||
|
|
||||||
pusha ; remove all port reservations
|
pusha ; remove all port reservations
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,8 @@
|
|||||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
|
;; Includes source code by Kulakov Vladimir Gennadievich. ;;
|
||||||
|
;; Modified by Mario79 and Rus. ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;driver sceletone
|
;driver sceletone
|
||||||
@ -66,7 +68,7 @@ end if
|
|||||||
mov al, 1
|
mov al, 1
|
||||||
out dx, al
|
out dx, al
|
||||||
|
|
||||||
stdcall AttachIntHandler, 4, irq4_handler
|
stdcall AttachIntHandler, 4, irq4_handler, dword 0
|
||||||
if DEBUG
|
if DEBUG
|
||||||
cmp eax, 0
|
cmp eax, 0
|
||||||
jne .label1
|
jne .label1
|
||||||
@ -99,7 +101,7 @@ end if
|
|||||||
;mov [com2_mouse_detected],1
|
;mov [com2_mouse_detected],1
|
||||||
;mov [irq_owner+3*4], 1 ; IRQ3 owner is System
|
;mov [irq_owner+3*4], 1 ; IRQ3 owner is System
|
||||||
|
|
||||||
stdcall AttachIntHandler, 3, irq3_handler
|
stdcall AttachIntHandler, 3, irq3_handler, dword 0
|
||||||
|
|
||||||
mov eax, 0
|
mov eax, 0
|
||||||
mov ebx, 0x2F8
|
mov ebx, 0x2F8
|
||||||
@ -358,7 +360,7 @@ COMPortBaseAddr dw 3F8h
|
|||||||
|
|
||||||
version dd (5 shl 16) or (API_VERSION and 0xFFFF)
|
version dd (5 shl 16) or (API_VERSION and 0xFFFF)
|
||||||
|
|
||||||
my_service db 'MY_SERVICE',0 ;max 16 chars include zero
|
my_service db 'COM_Mouse',0 ;max 16 chars include zero
|
||||||
|
|
||||||
if DEBUG
|
if DEBUG
|
||||||
msgInit db 'Preved bugoga!',13,10,0
|
msgInit db 'Preved bugoga!',13,10,0
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -4,12 +4,12 @@ include 'proc32.inc'
|
|||||||
include 'imports.inc'
|
include 'imports.inc'
|
||||||
|
|
||||||
struc IOCTL
|
struc IOCTL
|
||||||
{ .handle dd ?
|
{ .handle dd ?
|
||||||
.io_code dd ?
|
.io_code dd ?
|
||||||
.input dd ?
|
.input dd ?
|
||||||
.inp_size dd ?
|
.inp_size dd ?
|
||||||
.output dd ?
|
.output dd ?
|
||||||
.out_size dd ?
|
.out_size dd ?
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual at 0
|
virtual at 0
|
||||||
@ -22,7 +22,7 @@ public version
|
|||||||
DRV_ENTRY equ 1
|
DRV_ENTRY equ 1
|
||||||
DRV_EXIT equ -1
|
DRV_EXIT equ -1
|
||||||
|
|
||||||
MT_3B equ 0
|
MT_3B equ 0
|
||||||
MT_3BScroll equ 1
|
MT_3BScroll equ 1
|
||||||
MT_5BScroll equ 2
|
MT_5BScroll equ 2
|
||||||
|
|
||||||
@ -33,85 +33,85 @@ section '.flat' code readable align 16
|
|||||||
|
|
||||||
proc START stdcall, state:dword
|
proc START stdcall, state:dword
|
||||||
|
|
||||||
cmp [state], DRV_ENTRY
|
cmp [state], DRV_ENTRY
|
||||||
jne .fin
|
jne .fin
|
||||||
.init:
|
.init:
|
||||||
|
|
||||||
call detect_mouse
|
call detect_mouse
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jnz .exit
|
jnz .exit
|
||||||
|
|
||||||
mov [MouseType],MT_3B
|
mov [MouseType],MT_3B
|
||||||
|
|
||||||
call try_mode_ID3
|
call try_mode_ID3
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jnz .stop_try
|
jnz .stop_try
|
||||||
mov [MouseType],MT_3BScroll
|
mov [MouseType],MT_3BScroll
|
||||||
|
|
||||||
call try_mode_ID4
|
call try_mode_ID4
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jnz .stop_try
|
jnz .stop_try
|
||||||
mov [MouseType],MT_5BScroll
|
mov [MouseType],MT_5BScroll
|
||||||
|
|
||||||
.stop_try:
|
.stop_try:
|
||||||
|
|
||||||
mov bl, 0x20 ; read command byte
|
mov bl, 0x20 ; read command byte
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
cmp ah,1
|
cmp ah,1
|
||||||
je .exit
|
je .exit
|
||||||
|
|
||||||
call kbd_read
|
call kbd_read
|
||||||
cmp ah,1
|
cmp ah,1
|
||||||
je .exit
|
je .exit
|
||||||
|
|
||||||
or al, 10b
|
or al, 10b
|
||||||
push eax
|
push eax
|
||||||
mov bl, 0x60 ; write command byte
|
mov bl, 0x60 ; write command byte
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
cmp ah,1
|
cmp ah,1
|
||||||
je .exit
|
je .exit
|
||||||
|
|
||||||
pop eax
|
pop eax
|
||||||
call kbd_write
|
call kbd_write
|
||||||
cmp ah,1
|
cmp ah,1
|
||||||
je .exit
|
je .exit
|
||||||
|
|
||||||
mov al, 0xF4 ; enable data reporting
|
mov al, 0xF4 ; enable data reporting
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
|
|
||||||
mov bl, 0xAE ; enable keyboard interface
|
mov bl, 0xAE ; enable keyboard interface
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
|
|
||||||
stdcall AttachIntHandler, 12, irq_handler
|
stdcall AttachIntHandler, 12, irq_handler, dword 0
|
||||||
stdcall RegService, my_service, service_proc
|
stdcall RegService, my_service, service_proc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.fin:
|
.fin:
|
||||||
;stdcall DetachIntHandler, 12, irq_handler
|
;stdcall DetachIntHandler, 12, irq_handler
|
||||||
mov bl, 0xA7 ; disable mouse interface
|
mov bl, 0xA7 ; disable mouse interface
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.exit:
|
.exit:
|
||||||
mov bl, 0xA7 ; disable mouse interface
|
mov bl, 0xA7 ; disable mouse interface
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
mov bl, 0xAE ; enable keyboard interface
|
mov bl, 0xAE ; enable keyboard interface
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
proc service_proc stdcall, ioctl:dword
|
proc service_proc stdcall, ioctl:dword
|
||||||
mov edi, [ioctl]
|
mov edi, [ioctl]
|
||||||
mov eax, [edi+IOCTL.io_code]
|
mov eax, [edi+IOCTL.io_code]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .getversion
|
jz .getversion
|
||||||
cmp eax,1
|
cmp eax,1
|
||||||
jz .gettype
|
jz .gettype
|
||||||
|
|
||||||
.err:
|
.err:
|
||||||
or eax, -1
|
or eax, -1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.ok:
|
.ok:
|
||||||
@ -120,13 +120,13 @@ proc service_proc stdcall, ioctl:dword
|
|||||||
|
|
||||||
.getversion:
|
.getversion:
|
||||||
cmp [edi+IOCTL.out_size], 4
|
cmp [edi+IOCTL.out_size], 4
|
||||||
jb .err
|
jb .err
|
||||||
mov edi, [edi+IOCTL.output]
|
mov edi, [edi+IOCTL.output]
|
||||||
mov dword [edi], PS2_DRV_VER ; version of driver
|
mov dword [edi], PS2_DRV_VER ; version of driver
|
||||||
jmp .ok
|
jmp .ok
|
||||||
.gettype:
|
.gettype:
|
||||||
cmp [edi+IOCTL.out_size], 4
|
cmp [edi+IOCTL.out_size], 4
|
||||||
jb .err
|
jb .err
|
||||||
mov edi, [edi+IOCTL.output]
|
mov edi, [edi+IOCTL.output]
|
||||||
mov eax,[MouseType]
|
mov eax,[MouseType]
|
||||||
mov dword [edi], eax ; mouse type
|
mov dword [edi], eax ; mouse type
|
||||||
@ -138,95 +138,95 @@ detect_mouse:
|
|||||||
mov bl, 0xAD ; disable keyboard interface
|
mov bl, 0xAD ; disable keyboard interface
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
cmp ah,1
|
cmp ah,1
|
||||||
je .fail
|
je .fail
|
||||||
|
|
||||||
mov bl, 0xA8 ; enable mouse interface
|
mov bl, 0xA8 ; enable mouse interface
|
||||||
call kbd_cmd
|
call kbd_cmd
|
||||||
cmp ah,1
|
cmp ah,1
|
||||||
je .fail
|
je .fail
|
||||||
|
|
||||||
mov al, 0xFF ; reset
|
mov al, 0xFF ; reset
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
|
|
||||||
call mouse_read
|
call mouse_read
|
||||||
jc .fail
|
jc .fail
|
||||||
cmp al, 0xAA
|
cmp al, 0xAA
|
||||||
jne .fail ; dead mouse
|
jne .fail ; dead mouse
|
||||||
|
|
||||||
; get device ID
|
; get device ID
|
||||||
call mouse_read
|
call mouse_read
|
||||||
jc .fail
|
jc .fail
|
||||||
cmp al, 0x00
|
cmp al, 0x00
|
||||||
jne .fail ; unknown device
|
jne .fail ; unknown device
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
or eax,-1
|
or eax,-1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
try_mode_ID3:
|
try_mode_ID3:
|
||||||
mov al, 0xF3 ;Set Sample Rate
|
mov al, 0xF3 ;Set Sample Rate
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0xC8 ;200d
|
mov al, 0xC8 ;200d
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0xF3 ;Set Sample Rate
|
mov al, 0xF3 ;Set Sample Rate
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0x64 ;100d
|
mov al, 0x64 ;100d
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0xF3 ;Set Sample Rate
|
mov al, 0xF3 ;Set Sample Rate
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0x50 ;80d
|
mov al, 0x50 ;80d
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
|
|
||||||
mov al, 0xF2 ;Get device id
|
mov al, 0xF2 ;Get device id
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
|
|
||||||
call mouse_read
|
call mouse_read
|
||||||
jc .fail
|
jc .fail
|
||||||
cmp al, 0x03
|
cmp al, 0x03
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
ret
|
ret
|
||||||
.fail:
|
.fail:
|
||||||
or eax,-1
|
or eax,-1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
try_mode_ID4:
|
try_mode_ID4:
|
||||||
mov al, 0xF3 ;Set Sample Rate
|
mov al, 0xF3 ;Set Sample Rate
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0xC8 ;200d
|
mov al, 0xC8 ;200d
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0xF3 ;Set Sample Rate
|
mov al, 0xF3 ;Set Sample Rate
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0xC8 ;100d
|
mov al, 0xC8 ;100d
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0xF3 ;Set Sample Rate
|
mov al, 0xF3 ;Set Sample Rate
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
mov al, 0x50 ;80d
|
mov al, 0x50 ;80d
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
|
|
||||||
mov al, 0xF2 ;Get device id
|
mov al, 0xF2 ;Get device id
|
||||||
call mouse_cmd
|
call mouse_cmd
|
||||||
jc .fail
|
jc .fail
|
||||||
|
|
||||||
call mouse_read
|
call mouse_read
|
||||||
jc .fail
|
jc .fail
|
||||||
cmp al, 0x04
|
cmp al, 0x04
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ try_mode_ID4:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
or eax,-1
|
or eax,-1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
include 'ps2m_iofuncs.inc'
|
include 'ps2m_iofuncs.inc'
|
||||||
@ -242,12 +242,12 @@ include 'ps2m_irqh.inc'
|
|||||||
|
|
||||||
section '.data' data readable writable align 16
|
section '.data' data readable writable align 16
|
||||||
|
|
||||||
version dd 0x00050005
|
version dd 0x00050005
|
||||||
my_service db 'ps2mouse',0
|
my_service db 'ps2mouse',0
|
||||||
|
|
||||||
;iofuncs data
|
;iofuncs data
|
||||||
mouse_cmd_byte db 0
|
mouse_cmd_byte db 0
|
||||||
mouse_nr_tries db 0
|
mouse_nr_tries db 0
|
||||||
mouse_nr_resends db 0
|
mouse_nr_resends db 0
|
||||||
|
|
||||||
;hid data
|
;hid data
|
||||||
@ -259,10 +259,10 @@ third_byte db 0
|
|||||||
fourth_byte db 0
|
fourth_byte db 0
|
||||||
|
|
||||||
;main data
|
;main data
|
||||||
MouseType dd 0
|
MouseType dd 0
|
||||||
|
|
||||||
XMoving dd 0
|
XMoving dd 0
|
||||||
YMoving dd 0
|
YMoving dd 0
|
||||||
ZMoving dd 0
|
ZMoving dd 0
|
||||||
ButtonState dd 0
|
ButtonState dd 0
|
||||||
;timerTicks dd 0
|
;timerTicks dd 0
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -638,16 +638,6 @@ no_lib_load:
|
|||||||
|
|
||||||
mov [pci_access_enabled],1
|
mov [pci_access_enabled],1
|
||||||
|
|
||||||
;call detect_devices
|
|
||||||
stdcall load_driver, szPS2MDriver
|
|
||||||
stdcall load_driver, szCOM_MDriver
|
|
||||||
|
|
||||||
; SET MOUSE
|
|
||||||
|
|
||||||
mov esi,boot_setmouse
|
|
||||||
call boot_log
|
|
||||||
call setmouse
|
|
||||||
|
|
||||||
|
|
||||||
; SET PRELIMINARY WINDOW STACK AND POSITIONS
|
; SET PRELIMINARY WINDOW STACK AND POSITIONS
|
||||||
|
|
||||||
@ -748,6 +738,17 @@ no_lib_load:
|
|||||||
|
|
||||||
call set_variables
|
call set_variables
|
||||||
|
|
||||||
|
; SET MOUSE
|
||||||
|
|
||||||
|
;call detect_devices
|
||||||
|
stdcall load_driver, szPS2MDriver
|
||||||
|
stdcall load_driver, szCOM_MDriver
|
||||||
|
|
||||||
|
mov esi,boot_setmouse
|
||||||
|
call boot_log
|
||||||
|
call setmouse
|
||||||
|
|
||||||
|
|
||||||
; STACK AND FDC
|
; STACK AND FDC
|
||||||
|
|
||||||
call stack_init
|
call stack_init
|
||||||
@ -884,7 +885,7 @@ end if
|
|||||||
|
|
||||||
loop ready_for_irqs ; flush the queue
|
loop ready_for_irqs ; flush the queue
|
||||||
|
|
||||||
stdcall attach_int_handler, dword 1, irq1
|
stdcall attach_int_handler, dword 1, irq1, dword 0
|
||||||
|
|
||||||
; mov [dma_hdd],1
|
; mov [dma_hdd],1
|
||||||
cmp [IDEContrRegsBaseAddr], 0
|
cmp [IDEContrRegsBaseAddr], 0
|
||||||
@ -4205,7 +4206,7 @@ reserve_free_irq:
|
|||||||
|
|
||||||
mov ebx, [f_irqs + 4 * eax]
|
mov ebx, [f_irqs + 4 * eax]
|
||||||
|
|
||||||
stdcall attach_int_handler, eax, ebx
|
stdcall attach_int_handler, eax, ebx, dword 0
|
||||||
|
|
||||||
mov [ecx], edi
|
mov [ecx], edi
|
||||||
|
|
||||||
@ -5034,6 +5035,9 @@ syscall_getirqowner: ; GetIrqOwner
|
|||||||
cmp ebx,16
|
cmp ebx,16
|
||||||
jae .err
|
jae .err
|
||||||
|
|
||||||
|
cmp [irq_rights + 4 * ebx], dword 2
|
||||||
|
je .err
|
||||||
|
|
||||||
mov eax,[4 * ebx + irq_owner]
|
mov eax,[4 * ebx + irq_owner]
|
||||||
mov [esp+32],eax
|
mov [esp+32],eax
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user