DevHelp SetIRQ
This service sets a hardware interrupt vector to the physical device driver interrupt handler.
Contents
Syntax
C
USHORT APIENTRY DevHelp_SetIRQ (NPFN IRQHandler, USHORT IRQLevel, USHORT SharedFlag)
Assembler
MOV AX,Offset CS:handler ; Interrupt handler offset MOV BX,IRQnum ; Interrupt level number (0 - Fh) MOV DH,Shared_Int ; Interrupt sharing (0 = not shared, 1 = shared) MOV DL,DevHlp_SetIRQ CALL [Device_Help]
Parameters
C
- IRQHandler (NPFN)
- input - Pointer to the Interrupt handler
- IRQLevel (USHORT)
- input - Interrupt level number (0-FH)
- SharedFlag (USHORT)
- input - Interrupt sharing (0=not shared, 1=shared)
Assembler
MOV AX,Offset CS:handler ; Interrupt handler offset MOV BX,IRQnum ; Interrupt level number (0 - Fh) MOV DH,Shared_Int ; Interrupt sharing (0 = not shared, 1 = shared)
Return Code
C
Success Indicator: 0
Possible errors: IRQ is not available.
- If the IRQ is already owned by another device driver as not-shared
- If the IRQ is the IRQ used to cascade the slave 8259 interrupt controller (IRQ 2).
Assembler
'C' Clear if successful. 'C' Set if error. AX = Error code. Possible errors: IRQ is not available if carry flag is set.
Remarks
The physical device driver should use the DevHlp_RegisterStackUsage for each DevHlp_IRQ call. See Limiting the Number of Nested Interrupts.
The attempt to register an interrupt handler for an IRQ to be shared will fail under any of the following circumstances:
- If the IRQ is already owned by another device driver as not-shared
- If the IRQ is the IRQ used to cascade the slave 8259 interrupt controller (IRQ 2).
The attempt to register an interrupt handler for an IRQ to be not-shared will fail under any of the following circumstances:
- If the IRQ is already owned by another device driver as shared or not-shared
- If the IRQ is the IRQ used to cascade the slave 8259 interrupt controller.
DS should be set to the physical device driver's data segment. If the physical device driver has issued a call to PhysToVirt referencing the DS register, it should restore DS to its original value.
The IRQnum value is range checked and C (the carry flag) is set if IRQnum is not in the range of 0-0Fh.
Hardware interrupt sharing is not supported on all systems. A SetIRQ request to share an interrupt level on a system where sharing is not supported returns an error. See Hardware Interrupt Management for a discussion of the limitations on hardware interrupt sharing and the systems supported.
Example Code
C
#include "dhcalls.h" USHORT APIENTRY DevHelp_SetIRQ (NPFN IRQHandler, USHORT IRQLevel, USHORT SharedFlag)