How to add SDIO interrupt in miniport driver?

Dear Developers,

Greetings!!!

Actually, I am developing a miniport driver from scratch for AM335x using ndis6.0 framework. Now, I am in initialization stage and I have registered some ndis_miniport_adapter_attributes place holder structure. Now, I want to register an interrupt handling in my initialization function of miniport driver…

I am going to use

NDIS_STATUS
NdisMRegisterInterruptEx(
IN NDIS_HANDLE MiniportAdapterHandle,
IN NDIS_HANDLE MiniportInterruptContext,
IN PNDIS_MINIPORT_INTERRUPT_CHARACTERISTICS MiniportInterruptCharacteristics,
OUT PNDIS_HANDLE NdisInterruptHandle
);

Here parameter
1 is clear to me, it is the miniporthandle that is passed by the ndis freamwork when it calls to MPInitialize.
2, not clear to me, what is this???
3, clear to me,
4, I think this is the InterruptHandle function, if yes then I should assign the same to the

NDIS_MINIPORT_INTERRUPT_CHARACTERISTICS MyIntChar;

NdisZeroMemory(&MyIntChar, sizeof(MyIntChar));

MyIntChar.InterruptHandler = INterruptHandle;

or it should be something different…

xxxxx@gmail.com wrote:

Actually, I am developing a miniport driver from scratch for AM335x using ndis6.0 framework. Now, I am in initialization stage and I have registered some ndis_miniport_adapter_attributes place holder structure. Now, I want to register an interrupt handling in my initialization function of miniport driver…

I am going to use

NDIS_STATUS
NdisMRegisterInterruptEx(
IN NDIS_HANDLE MiniportAdapterHandle,
IN NDIS_HANDLE MiniportInterruptContext,
IN PNDIS_MINIPORT_INTERRUPT_CHARACTERISTICS MiniportInterruptCharacteristics,
OUT PNDIS_HANDLE NdisInterruptHandle
);

Here parameter
1 is clear to me, it is the miniporthandle that is passed by the ndis freamwork when it calls to MPInitialize.
2, not clear to me, what is this???

This pointer will be passed through untouched to your interrupt
handler… Usually, you put your device context structure, or some other
pointer that lets you figure out which device you are working with.

3, clear to me,
4, I think this is the InterruptHandle function, if yes then I should assign the same to the

Did you read the documentation? And did you notice the “OUT”
annotation? NdisInterruptHandle is the address of a location where NDIS
will return to you a handle for this interrupt. You will need this
later to call NdisMDeregisterInterruptEx.

NDIS_MINIPORT_INTERRUPT_CHARACTERISTICS MyIntChar;
NdisZeroMemory(&MyIntChar, sizeof(MyIntChar));
MyIntChar.InterruptHandler = INterruptHandle;

or it should be something different…

There is quite a bit more. There are 15 different fields in that
structure. You don’t need most of them, but you certainly have to fill
out the Header and the four callbacks. Have you looked at the samples?
hw_isr.c in the athwifi sample shows one way to do this. The xframeii
sample also calls it.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Dear developers,
Greetings!!

Hi Tim,

Thanks for sharing more information. Actually, I am able to add the Header entries, and four entries realted to the Interrupt…

Actually, I asked the question in wrong way. Actually, i wanted to ask, How SDIO lines detect the device and interact with my driver.
Suppose, without interrupt enable from Wl1835, if I insert the device on my SD slot then SD interrupt generates and it the part of sdhc.dll who will take care. but after checking the device detection, how it intract with my driver. and which funciton in driver it calls. I think so via ndis it will call the driver…
I need more info about this topic.
If you want then I can create the new thread for my query…

On Nov 13, 2015, at 10:17 PM, xxxxx@gmail.com wrote:

Actually, I asked the question in wrong way. Actually, i wanted to ask, How SDIO lines detect the device and interact with my driver.
Suppose, without interrupt enable from Wl1835, if I insert the device on my SD slot then SD interrupt generates and it the part of sdhc.dll who will take care. but after checking the device detection, how it intract with my driver. and which funciton in driver it calls. I think so via ndis it will call the driver….

All of the resources (memory, port, interrupt) are owned and managed by the SD bus driver, sdbus.sys. Your driver interfaces with that driver by calling into the SD bus library, sdbus.lib. You will register yourself using that library. When the bus driver gets an interrupt, it will call a callback in your driver. Your driver will never get an interrupt in the kernel sense, so NDIS will not be involved, and you do not need to use NdisMRegisterInterruptEx at all.

You need to read this and its suggested links carefully:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff537964.aspx

Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.