Dynamic setting interrupts for Floppy controller

git-svn-id: svn://kolibrios.org@3771 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2013-07-06 11:33:30 +00:00
parent edb28b33f3
commit c67e638d08
6 changed files with 14 additions and 47 deletions

View File

@ -8,11 +8,6 @@
$Revision$
iglobal
;function pointers.
fdc_irq_func dd fdc_null
endg
uglobal
dmasize db 0x0
dmamode db 0x0
@ -25,11 +20,6 @@ fdc_init: ;start with clean tracks.
rep stosb
ret
fdc_irq:
call [fdc_irq_func]
fdc_null:
ret
save_image:
call reserve_flp
call restorefatchain
@ -64,7 +54,6 @@ save_image_1:
cmp [FDD_Track], 80
jne save_image_1
unnecessary_save_image:
mov [fdc_irq_func], fdc_null
popa
mov [flp_status], 0
ret

View File

@ -185,17 +185,9 @@ FDCDataInput:
;* ОБРАБОТЧИК ПРЕРЫВАНИЯ ОТ КОНТРОЛЛЕРА НГМД *
;*********************************************
FDCInterrupt:
; Установить флаг прерывани
; Установить флаг прерывания
mov [FDD_IntFlag], 1
ret
;******************************************
;* УСТАНОВИТЬ НОВЫЙ ОБРАБОТЧИК ПРЕРЫВАНИЙ *
;* НГМД *
;******************************************
SetUserInterrupts:
mov [fdc_irq_func], FDCInterrupt
mov al, 1
ret
;*******************************************
@ -212,9 +204,9 @@ WaitFDCInterrupt:
mov [TickCounter], eax
; Ожидать установки флага прерывания НГМД
@@TestRS_2:
call change_task
cmp [FDD_IntFlag], 0
jnz @@End_7 ;прерывание произошло
call change_task
mov eax, [timer_ticks]
sub eax, [TickCounter]
cmp eax, 50 ;25 ;5 ;ожидать 5 тиков

View File

@ -154,12 +154,6 @@ align 16
cmp [v86_irqhooks+ebp*8], 0
jnz v86_irq
cmp bp, 6
jnz @f
push ebp
call [fdc_irq_func]
pop ebp
@@:
bts [irq_active_set], ebp
lea esi, [irqh_tab+ebp*8] ; esi= list head
@ -204,10 +198,6 @@ align 16
; Note: this still isn't 100% correct, because two IRQs can fire simultaneously,
; the better way would be to find the correct IRQ, but I don't know how to do
; this in that case.
; Also, [fdc_irq_func], [irq14_func], [irq15_func] could process interrupt
; but do not return whether they did it, so just ignore IRQs 6, 14, 15.
cmp ebp, 6
jz .fail
push ebp
xor ebp, ebp
.try_other_irqs:
@ -215,6 +205,8 @@ align 16
jz .try_next_irq
cmp ebp, 1
jz .try_next_irq
cmp ebp, 6
jz .try_next_irq
cmp ebp, 12
jz .try_next_irq
cmp ebp, 14

View File

@ -30,8 +30,9 @@ wait_cmos:
mov [DRIVE_DATA], al
test al, al
jz @f
in al, 0x21
and al, 10111111b ; Enable IRQ6
out 0x21, al
stdcall attach_int_handler, 6, FDCInterrupt, 0
DEBUGF 1, "K : Set IDE IRQ6 return code %x\n", eax
stdcall enable_irq, 6 ; FDD
@@:

View File

@ -221,7 +221,7 @@ read_chs_sector:
frnoread2_1:
cmp [esp+16], dword 0; eof without read ?
je frnoread_1
mov [fdc_irq_func], fdc_null
pop edi esi edx ecx
add esp, 4
pop ebx; ebx <- eax : size of file
@ -354,7 +354,6 @@ check_label:
mov [FDD_Track], 0; Цилиндр
mov [FDD_Head], 0; Сторона
mov [FDD_Sector], 1; Сектор
call SetUserInterrupts
call FDDMotorON
call RecalibrateFDD
cmp [FDC_Status], 0
@ -409,7 +408,6 @@ save_flp_root_1:
cmp [FDD_Sector], 16
jne save_flp_root_1
unnecessary_root_save:
mov [fdc_irq_func], fdc_null
popa
ret
@ -445,7 +443,6 @@ save_flp_fat_1:
jne unnecessary_flp_fat_save
mov [root_read], 0
unnecessary_flp_fat_save:
mov [fdc_irq_func], fdc_null
popa
ret
@ -1703,7 +1700,7 @@ fs_FloppyWrite:
; now ebx=start pos, ecx=end pos, both lie inside file
sub ecx, ebx
jz .ret
call SetUserInterrupts
.write_loop:
; skip unmodified sectors
cmp dword [esp], 0x200
@ -1794,7 +1791,6 @@ fs_FloppyWrite:
and dword [esp], 0
jmp .write_loop
.done:
mov [fdc_irq_func], fdc_null
jmp .ret
floppy_extend_file.zero_size:
@ -1948,7 +1944,6 @@ fs_FloppySetFileEnd:
mov al, 11
@@:
.doret:
mov [fdc_irq_func], fdc_null
ret
.expand:
push ecx
@ -1981,7 +1976,6 @@ fs_FloppySetFileEnd:
call save_flp_fat
cmp [FDC_Status], 0
jnz .device_err
call SetUserInterrupts
; now zero new data
; edi = current cluster, [esp+12]=new size, [esp+4]=old size, [esp]=return code
.zero_loop:
@ -2074,7 +2068,7 @@ fs_FloppySetFileEnd:
add eax, 31
and edi, 0x1FF
jz .truncate_done
call SetUserInterrupts
pusha
call read_chs_sector
popa

View File

@ -717,7 +717,6 @@ no_mode_0x12:
; they are used: when partitions are scanned, hd_read relies on timer
call unmask_timer
stdcall enable_irq, 2 ; @#$%! PIC
stdcall enable_irq, 6 ; FDD
stdcall enable_irq, 13 ; co-processor
mov esi, boot_disabling_ide
@ -1252,8 +1251,8 @@ proc osloop_has_work?
jnz .yes
call stack_handler_has_work?
jnz .yes
call check_fdd_motor_status_has_work?
jnz .yes
; call check_fdd_motor_status_has_work?
; jnz .yes
call check_ATAPI_device_event_has_work?
jnz .yes
call check_lights_state_has_work?