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

View File

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

View File

@ -154,12 +154,6 @@ align 16
cmp [v86_irqhooks+ebp*8], 0 cmp [v86_irqhooks+ebp*8], 0
jnz v86_irq jnz v86_irq
cmp bp, 6
jnz @f
push ebp
call [fdc_irq_func]
pop ebp
@@:
bts [irq_active_set], ebp bts [irq_active_set], ebp
lea esi, [irqh_tab+ebp*8] ; esi= list head 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, ; 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 ; the better way would be to find the correct IRQ, but I don't know how to do
; this in that case. ; 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 push ebp
xor ebp, ebp xor ebp, ebp
.try_other_irqs: .try_other_irqs:
@ -215,6 +205,8 @@ align 16
jz .try_next_irq jz .try_next_irq
cmp ebp, 1 cmp ebp, 1
jz .try_next_irq jz .try_next_irq
cmp ebp, 6
jz .try_next_irq
cmp ebp, 12 cmp ebp, 12
jz .try_next_irq jz .try_next_irq
cmp ebp, 14 cmp ebp, 14

View File

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

View File

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