RE: Serial Port int. fails...(found the solution !!!)

I latched onto “Device Manager” and uninstalled COM1 Device.
And after that my driver loaded successfully with IoConnectInterrupt()
finally suceeding.
So the problem is solved.

I think there some way to do this programatically.
Can experts please help the novice.

Further I purchased Walter Oney’s Device Driver Book two days back.
And I hit upon the IoGetDeviceObjectPointer API mentioned in that book.
I used this API to get the handle to \Device\Serial0 and then called
DeviceObject->DriverObject->DriverUnload(DeviceObject->DriverObject);
I was hoping that DriverUnload function of the already loaded driver
would call IoDisconnectInterrupt()

But my purpose was not served. Is there anything wrong with this logic.

Thanx
Kiran

-----Original Message-----
From: Kiran Bacche
Sent: Thursday, August 21, 2003 5:19 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] Serial Port int. fails…(please help)

The IoConnectInterrupt() succeeded repeatedly for Parallel port(irq7)
and COM2 (irq3)
But for COM1 port (irq4)

I get “invalid parameters” as return value.

FYI, the call I am making is

status = IoConnectInterrupt( &InterruptObject, //
InterruptObject
(PKSERVICE_ROUTINE)
InterruptIsr, // ServiceRoutine
DeviceObject,
// ServiceContext
NULL,
// SpinLock
MappedVector,
// Vector
Irql,
// Irql
Irql,
// SynchronizeIrql
LevelSensitive,
// InterruptMode
TRUE, //
ShareVector
Aff,
// ProcessorEnableMask
FALSE);
// FloatingSave

I am getting the Irql, MappedVector and Aff values from
HalGetInterruptVector() call.

The same code works fine for COM2. (I get the irql, aff, mappedvector
values from HalGetInterruptvector() by passing a value of 3 (the irq for
com2) )

And this same code works also for Parallel port (irq 7). I have to jusr
replace irq number to 7 in the HalGet… Call.

Please note that I’m writing a non-WDM driver and hence I have to rely
on HalGet… Calls.

So I am wondering what is so different about COM1 ???

Thanx in advance
Kiran

-----Original Message-----
From: Kiran Bacche
Sent: Thursday, August 21, 2003 12:38 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] RE: IoInterruptConnect parameters…

Thanx for this info. I am now able to register ISR for parallel port
(IRQ
7).
But there is another problem.
If i load the driver the second time, then IoConnectInterrupt fails.
That is becoz, I do not do IoDisconnectInterrupt while unloading.

My question is “If some driver does IoConnectInterrupt and then is
unloaded, then no driver can be loaded that can successfulyy fo
IoInterrutpConnect() ???”

Is restarting, the only way out?

I tried giving “TRUE” value to ShareInterrupt parameter of
IoConnectInterrupt.

But it did not work.

Can anyone help me,plesae?

Thanx
Kiran

Sorry - haven’t really read your question, focused only on
IoConnectInterrupt itself.

IoQueryDeviceDescription() and not HalAssignSlotResources() on NT4
(look at initunlo.c in /src/serial/ sample in NT4 DDK).
In W2K DDK look at pnp.c in /src/kernel/serial/

-----Original Message-----
From: Alexander Krol [mailto:xxxxx@creo.com]
Sent: Wednesday, August 20, 2003 4:15 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] RE: IoInterruptConnect parameters…

If you are on NT4, use HalAssignSlotResources() and
HalGetInterruptVector().
If it’s W2K and later - these parameters are passed by PnP Manager
with IRP_MN_START_DEVICE
(Irp->Parameters.StartDevice.AllocatedResources
and Irp->Parameters.StartDevice.AllocatedResourcesTranstaled).
Check “Getting a System-Assigned Interrupt Vector, DIRQL, and
Processor
Mask”
in DDK Help.

-----Original Message-----
From: Kiran [mailto:xxxxx@wipro.com]
Sent: Wednesday, August 20, 2003 12:26 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] IoInterruptConnect parameters…

I was trying to register an ISR for COM1. (IRQ = 4)

I have put “???” beside all params I’m not really sure of.

IoInterruptConnect(&myIntObject, myISR, NULL, NULL,
vectorNumber, /*???*/
4, 4, /* ??? */
CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE,
FALSE,
0, /*???*/
FALSE);

My doubt is “how to get the interrupt vector number from the IRQ”
I think this is OS dependent. There is no standard.
It depends on how the OS programs the PIC chip.
And r the other parameters correct ??

Please throw some light…
Thanx
Kiran


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@creo.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@creo.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@wipro.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@wipro.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Kiran,

A better question: ‘is there anything right with this logic?’ I am also
assuming that you did not get this idea from Walter’s book, as I will have
to send my copy back to Walter :slight_smile:

You can’t just go chase pointers off of some other driver’s DriverObject and
call the various driver functions found there, and expect that to work.*
That is why we have a DDK documentation set. This documentation set actually
lists the functions in the kernel that can be called by device drivers. Call
this the ‘Device Driver API’. Do try to restrict your design to this API.

* of course THERE ARE EXCEPTIONS, as always, where the only way to get
something done is to bend the rules, but using such exceptions are last
resorts.

=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com

-----Original Message-----

Further I purchased Walter Oney’s Device Driver Book two days back. And I
hit upon the IoGetDeviceObjectPointer API mentioned in that book. I used
this API to get the handle to \Device\Serial0 and then called
DeviceObject->DriverObject->DriverUnload(DeviceObject->DriverObject);
I was hoping that DriverUnload function of the already loaded driver would
call IoDisconnectInterrupt()

But my purpose was not served. Is there anything wrong with this logic.

Thanx
Kiran

-----Original Message-----
From: Kiran Bacche
Sent: Thursday, August 21, 2003 5:19 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] Serial Port int. fails…(please help)

The IoConnectInterrupt() succeeded repeatedly for Parallel port(irq7) and
COM2 (irq3) But for COM1 port (irq4)

I get “invalid parameters” as return value.

FYI, the call I am making is

status = IoConnectInterrupt( &InterruptObject, //
InterruptObject
(PKSERVICE_ROUTINE)
InterruptIsr, // ServiceRoutine
DeviceObject,
// ServiceContext
NULL,
// SpinLock
MappedVector,
// Vector
Irql,
// Irql
Irql,
// SynchronizeIrql
LevelSensitive,
// InterruptMode
TRUE, //
ShareVector
Aff,
// ProcessorEnableMask
FALSE);
// FloatingSave

I am getting the Irql, MappedVector and Aff values from
HalGetInterruptVector() call.

The same code works fine for COM2. (I get the irql, aff, mappedvector values
from HalGetInterruptvector() by passing a value of 3 (the irq for
com2) )

And this same code works also for Parallel port (irq 7). I have to jusr
replace irq number to 7 in the HalGet… Call.

Please note that I’m writing a non-WDM driver and hence I have to rely on
HalGet… Calls.

So I am wondering what is so different about COM1 ???

Thanx in advance
Kiran

-----Original Message-----
From: Kiran Bacche
Sent: Thursday, August 21, 2003 12:38 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] RE: IoInterruptConnect parameters…

Thanx for this info. I am now able to register ISR for parallel port (IRQ
7). But there is another problem. If i load the driver the second time, then
IoConnectInterrupt fails. That is becoz, I do not do IoDisconnectInterrupt
while unloading.

My question is “If some driver does IoConnectInterrupt and then is unloaded,
then no driver can be loaded that can successfulyy fo
IoInterrutpConnect() ???”

Is restarting, the only way out?

I tried giving “TRUE” value to ShareInterrupt parameter of
IoConnectInterrupt.

But it did not work.

Can anyone help me,plesae?

Thanx
Kiran

Sorry - haven’t really read your question, focused only on
IoConnectInterrupt itself.

IoQueryDeviceDescription() and not HalAssignSlotResources() on NT4
(look at initunlo.c in /src/serial/ sample in NT4 DDK). In W2K DDK
look at pnp.c in /src/kernel/serial/

-----Original Message-----
From: Alexander Krol [mailto:xxxxx@creo.com]
Sent: Wednesday, August 20, 2003 4:15 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] RE: IoInterruptConnect parameters…

If you are on NT4, use HalAssignSlotResources() and
HalGetInterruptVector().
If it’s W2K and later - these parameters are passed by PnP Manager
with IRP_MN_START_DEVICE
(Irp->Parameters.StartDevice.AllocatedResources
and Irp->Parameters.StartDevice.AllocatedResourcesTranstaled).
Check “Getting a System-Assigned Interrupt Vector, DIRQL, and
Processor
Mask”
in DDK Help.

-----Original Message-----
From: Kiran [mailto:xxxxx@wipro.com]
Sent: Wednesday, August 20, 2003 12:26 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] IoInterruptConnect parameters…

I was trying to register an ISR for COM1. (IRQ = 4)

I have put “???” beside all params I’m not really sure of.

IoInterruptConnect(&myIntObject, myISR, NULL, NULL,
vectorNumber, /*???*/
4, 4, /* ??? */
CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE,
FALSE,
0, /*???*/
FALSE);

My doubt is “how to get the interrupt vector number from the IRQ” I
think this is OS dependent. There is no standard. It depends on how
the OS programs the PIC chip. And r the other parameters correct ??

Please throw some light…
Thanx
Kiran


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@creo.com To
unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@creo.com To
unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@wipro.com To
unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@wipro.com To
unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

Yes, I agree it is not the right way. The intention was to make my
IoConnectInterrupt() to go thru successfully.

OK coming back, can u suggest what’s the best way to unload some
existing driver programatically?

Thanx
Kiran

-----Original Message-----
From: Roddy, Mark [mailto:xxxxx@stratus.com]
Sent: Friday, August 22, 2003 7:03 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] RE: Serial Port int. fails…(found the solution !!!)

Kiran,

A better question: ‘is there anything right with this logic?’ I am also
assuming that you did not get this idea from Walter’s book, as I will
have
to send my copy back to Walter :slight_smile:

You can’t just go chase pointers off of some other driver’s DriverObject
and
call the various driver functions found there, and expect that to work.*
That is why we have a DDK documentation set. This documentation set
actually
lists the functions in the kernel that can be called by device drivers.
Call
this the ‘Device Driver API’. Do try to restrict your design to this
API.

* of course THERE ARE EXCEPTIONS, as always, where the only way to get
something done is to bend the rules, but using such exceptions are last
resorts.

=====================
Mark Roddy
Hollis Technology Solutions
www.hollistech.com
xxxxx@hollistech.com

-----Original Message-----

Further I purchased Walter Oney’s Device Driver Book two days back. And
I
hit upon the IoGetDeviceObjectPointer API mentioned in that book. I used
this API to get the handle to \Device\Serial0 and then called
DeviceObject->DriverObject->DriverUnload(DeviceObject->DriverObject);
I was hoping that DriverUnload function of the already loaded driver
would
call IoDisconnectInterrupt()

But my purpose was not served. Is there anything wrong with this logic.

Thanx
Kiran

-----Original Message-----
From: Kiran Bacche
Sent: Thursday, August 21, 2003 5:19 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] Serial Port int. fails…(please help)

The IoConnectInterrupt() succeeded repeatedly for Parallel port(irq7)
and
COM2 (irq3) But for COM1 port (irq4)

I get “invalid parameters” as return value.

FYI, the call I am making is

status = IoConnectInterrupt( &InterruptObject, //
InterruptObject
(PKSERVICE_ROUTINE)
InterruptIsr, // ServiceRoutine
DeviceObject,
// ServiceContext
NULL,
// SpinLock
MappedVector,
// Vector
Irql,
// Irql
Irql,
// SynchronizeIrql
LevelSensitive,
// InterruptMode
TRUE, //
ShareVector
Aff,
// ProcessorEnableMask
FALSE);
// FloatingSave

I am getting the Irql, MappedVector and Aff values from
HalGetInterruptVector() call.

The same code works fine for COM2. (I get the irql, aff, mappedvector
values
from HalGetInterruptvector() by passing a value of 3 (the irq for
com2) )

And this same code works also for Parallel port (irq 7). I have to jusr
replace irq number to 7 in the HalGet… Call.

Please note that I’m writing a non-WDM driver and hence I have to rely
on
HalGet… Calls.

So I am wondering what is so different about COM1 ???

Thanx in advance
Kiran

-----Original Message-----
From: Kiran Bacche
Sent: Thursday, August 21, 2003 12:38 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] RE: IoInterruptConnect parameters…

Thanx for this info. I am now able to register ISR for parallel port
(IRQ
7). But there is another problem. If i load the driver the second time,
then
IoConnectInterrupt fails. That is becoz, I do not do
IoDisconnectInterrupt
while unloading.

My question is “If some driver does IoConnectInterrupt and then is
unloaded,
then no driver can be loaded that can successfulyy fo
IoInterrutpConnect() ???”

Is restarting, the only way out?

I tried giving “TRUE” value to ShareInterrupt parameter of
IoConnectInterrupt.

But it did not work.

Can anyone help me,plesae?

Thanx
Kiran

Sorry - haven’t really read your question, focused only on
IoConnectInterrupt itself.

IoQueryDeviceDescription() and not HalAssignSlotResources() on NT4
(look at initunlo.c in /src/serial/ sample in NT4 DDK). In W2K DDK
look at pnp.c in /src/kernel/serial/

-----Original Message-----
From: Alexander Krol [mailto:xxxxx@creo.com]
Sent: Wednesday, August 20, 2003 4:15 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] RE: IoInterruptConnect parameters…

If you are on NT4, use HalAssignSlotResources() and
HalGetInterruptVector().
If it’s W2K and later - these parameters are passed by PnP Manager
with IRP_MN_START_DEVICE
(Irp->Parameters.StartDevice.AllocatedResources
and Irp->Parameters.StartDevice.AllocatedResourcesTranstaled).
Check “Getting a System-Assigned Interrupt Vector, DIRQL, and
Processor
Mask”
in DDK Help.

-----Original Message-----
From: Kiran [mailto:xxxxx@wipro.com]
Sent: Wednesday, August 20, 2003 12:26 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] IoInterruptConnect parameters…

I was trying to register an ISR for COM1. (IRQ = 4)

I have put “???” beside all params I’m not really sure of.

IoInterruptConnect(&myIntObject, myISR, NULL, NULL,
vectorNumber, /*???*/
4, 4, /* ??? */
CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE,
FALSE,
0, /*???*/
FALSE);

My doubt is “how to get the interrupt vector number from the IRQ” I
think this is OS dependent. There is no standard. It depends on how
the OS programs the PIC chip. And r the other parameters correct ??

Please throw some light…
Thanx
Kiran


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@creo.com To
unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@creo.com To
unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@wipro.com To
unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@wipro.com To
unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com To
unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@wipro.com
To unsubscribe send a blank email to xxxxx@lists.osr.com