Changeset 34 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm
- Timestamp:
- Aug 23, 2010, 6:57:51 PM (15 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm
r33 r34 10 10 11 11 ;-------------------------------------------------------------------- 12 ; Wait for IRQ. 13 ; 14 ; HIRQ_WaitIRQ 12 ; HIRQ_WaitForIRQ 15 13 ; Parameters: 16 14 ; DS: RAMVARS segment 17 ; Returns:18 ; AH: BIOS Error code19 ; CF: Cleared if wait succesfull20 ; Set if any error21 ; Corrupts registers:22 ; AL23 ;--------------------------------------------------------------------24 ALIGN JUMP_ALIGN25 HIRQ_WaitIRQ:26 push es27 28 LOAD_BDA_SEGMENT_TO es, ax29 %ifdef USE_AT ; OS hook only available on AT+ machines30 call .NotifyOperatingSystemAboutWaitingForIRQ31 cmc32 jnc SHORT .TaskFlagPollingComplete33 %endif34 call .WaitUntilTaskFlagIsSet ; Process errors35 36 ALIGN JUMP_ALIGN37 .TaskFlagPollingComplete:38 pop es39 jmp HError_ProcessErrorsAfterPollingTaskFlag40 41 42 ;--------------------------------------------------------------------43 ; .NotifyOperatingSystemAboutWaitingForIRQ44 ; Parameters:45 ; ES: BDA segment (zero)46 15 ; Returns: 47 16 ; CF: Set if wait done by operating system … … 50 19 ; AX 51 20 ;-------------------------------------------------------------------- 52 %ifdef USE_AT 21 ALIGN JUMP_ALIGN 22 HIRQ_WaitForIRQ: 23 test BYTE [bx+DPT.bDrvCtrl], FLG_IDE_CTRL_nIEN ; Clears CF 24 jz SHORT .NotifyOperatingSystemAboutWaitingForIRQ 25 ret ; Go to poll status register 26 27 ;-------------------------------------------------------------------- 28 ; .NotifyOperatingSystemAboutWaitingForIRQ 29 ; Parameters: 30 ; Nothing 31 ; Returns: 32 ; CF: Set if wait done by operating system 33 ; Cleared if BIOS must perform task flag polling 34 ; Corrupts registers: 35 ; AX 36 ;-------------------------------------------------------------------- 53 37 ALIGN JUMP_ALIGN 54 38 .NotifyOperatingSystemAboutWaitingForIRQ: 39 push ds 40 41 LOAD_BDA_SEGMENT_TO ds, ax ; Zero AX 55 42 cli ; Disable interrupts 56 xor ax, ax 57 cmp al, [es:BDA.bHDTaskFlg] ; Task flag already set? 43 cmp al, [ds:BDA.bHDTaskFlg] ; Task flag already set? 58 44 jc SHORT .ReturnFromWaitNotify ; If so, skip OS notification 59 45 … … 67 53 stc ; Set CF since wait done by OS 68 54 .ReturnFromWaitNotify: 55 pop ds 69 56 sti ; Enable interrupts 70 ret71 %endif72 73 ;--------------------------------------------------------------------74 ; Polls IRQ Task Flag until it has been set or timeout.75 ;76 ; .WaitUntilTaskFlagIsSet77 ; Parameters:78 ; DS: RAMVARS segment79 ; ES: BDA segment80 ; Returns:81 ; CF: Set if timeout82 ; Cleared if Task Flag set83 ; Corrupts registers:84 ; AX85 ;--------------------------------------------------------------------86 ALIGN JUMP_ALIGN87 .WaitUntilTaskFlagIsSet:88 push cx89 90 mov cl, B_TIMEOUT_DRQ ; Load timeout ticks91 call SoftDelay_InitTimeout ; Initialize timeout counter92 xor ax, ax ; Zero AX93 ALIGN JUMP_ALIGN94 .PollIrqFlag:95 cli ; Disable interrupt until next HLT96 cmp [es:BDA.bHDTaskFlg], al ; Task flag set? (clears CF)97 jne SHORT .Return98 call SoftDelay_UpdTimeout ; Update timeout99 jc SHORT .Return ; Return if timeout100 sti ; Enable interrupts (STI has delay so HLT will catch all interrupts)101 hlt ; Sleep until any interrupt102 jmp SHORT .PollIrqFlag ; Jump to check if IDE interrupt103 ALIGN JUMP_ALIGN104 .Return:105 pop cx106 sti107 57 ret 108 58 … … 158 108 out WPORT_8259MA_COMMAND, al ; Acknowledge Master 8259 159 109 160 %ifdef USE_AT ; OS hook only available on AT+ machines161 110 ; Issue Int 15h, function AX=9100h (Interrupt ready) 162 111 mov ax, 9100h ; Interrupt ready, device 0 (HD) 163 112 int INTV_SYSTEM_SERVICES 164 %endif165 113 166 114 pop ax ; Restore AX … … 187 135 188 136 ; Reading Status Register acknowledges IDE interrupt 189 ;call RamVars_GetSegmentToDS 190 ;call HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA 191 LOAD_BDA_SEGMENT_TO ds, ax 137 call RamVars_GetSegmentToDS 138 call HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA 192 139 mov BYTE [BDA.bHDTaskFlg], 0FFh ; Set task flag 193 140
Note:
See TracChangeset
for help on using the changeset viewer.