Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


IoConnectInterrupt problem!

OSR_Community_UserOSR_Community_User Member Posts: 110,217
I have problem with IoConnectInterrupt function. It doesn't return
STATUS_SUCCESS. I presume the problem is in data that are previously gotten
from functions HalTranslateBusAddress and HalGetInterruptVector. I need
variables that would describe Isa bus, and COM2 port. I'm not sure for
values of bus number, and bus address. There is a code down that describes
things I'm doing. Can someone tell me, how can I get those values from
system or registry. (for i386, NT4)


addressSpace=0x0; // I/O space !!!! check to HalTranslateBusAddress
devExt->InterfaceType = SERIAL_INTERFACE_TYPE; // Isa
devExt->InterruptMode = SERIAL_INTERRUPT_MODE; // Latched
devExt->OriginalVector = // can that be the
same?
devExt->OriginalLevel = SERIAL_COM2_INTERRUPT; // = 0x3h
devExt->BusNumber = SERIAL_BUS_NUMBER; // = 0
devExt->Port.LowPart=devExt->PortList[0].u.Port.Start.LowPart =
SERIAL_COM2_PHYSICAL_BASE; // =
0x2F8

if
alTranslateBusAddress(
devExt->InterfaceType,
devExt->BusNumber,
devExt->PortList[0].u.Port.Start,
&addressSpace,
&cardAddress
)) {

LogError(DriverObject,NULL,L"HalTranslateBusAddress = FALSE.",2);
addressSpace = 1;
cardAddress.QuadPart = 0;
}

if (!addressSpace) {

devExt->UnmapRegistersRequired = TRUE;
//
// configuring port address port=DeviceRegisters[0]
// in memory !!!!

// devExt->PortList[1].u.Port.Length = ???????
// I don't know how many bytes I need
// for serial port???

devExt->DeviceRegisters[0] =
MmMapIoSpace(
cardAddress,
devExt->PortList[1].u.Port.Length,
FALSE
);

} else {

devExt->UnmapRegistersRequired = FALSE;
devExt->DeviceRegisters[0
] = (PVOID)cardAddress.LowPart;

}

devExt->InterruptVector = 0;
devExt->InterruptVector = HalGetInterruptVector(
devExt->InterfaceType, // Isa
devExt->BusNumber, //
Serial_bus_Number
devExt->OriginalLevel, // ?bus_int_level
devExt->OriginalVector, // ?bus_int_vect
<- br. int.
&devExt->InterruptLevel, // OUT
&devExt->InterruptAffinity // OUT
);
if (devExt->InterruptVector == 0)
{
LogError(devExt->deviceObject,NULL,L"HalGetInterruptVector failed with
error!!!",2);
Status = STATUS_INSUFFICIENT_RESOURCES;
MyUnload(DriverObject);

goto InitializeExit;
}

//
// Connect to interrupt from the device. After this call,
// interrupts from the device will result in calls to our
MyHandleInterrupt
// function.
//
Status = IoConnectInterrupt(&devExt->InterruptObject,
MyHandleInterrupt,
devExt, // ISR Context
NULL,
devExt->InterruptVector,
devExt->InterruptLevel, // Irql
devExt->InterruptLevel,
devExt->InterruptMode,
TRUE,
devExt->InterruptAffinity,
FALSE);
...
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 12 September 2022 Live, Online
Internals & Software Drivers 23 October 2022 Live, Online
Kernel Debugging 14 November 2022 Live, Online
Developing Minifilters 5 December 2022 Live, Online