Tech Support > Microsoft Windows > Drivers > Sdio question
Sdio question
Posted by Daniel Diaz on January 23rd, 2006


Hello world

I have done an entire SDIO-NDIS driver under Windows CE 5.0 that worked with
no problem for single function cards. Now we are using multifunction (3
functions: 5, 4 and 2). The hardware uses two interruptions one in function
5 and other in function 4. But the operating system only allows us to enable
one function: the first that is loaded. We have tried for every function and
they are correctly enabled as single function but they cannot play together.

For the first function (5) the function driver enable the function and
register the ISRCallback but for the rest, when we call SDSetCardFeature to
enable the function returns 0xC0000019, value that is not documented. We
have used a logic analyser to sniff the traffic in the bus but nothing is
sent when enabling the second function. For the first one we could see the
right commands.

The function drivers are loaded in this order 1, 7, 6, 5, 4, 3, 2.

Please, any help will be appreciated.

Thank you very very much!!

Daniel

Our XXX_Init code looks like this:


psdio_dev->hDevice = SDGetDeviceHandle(dwInitContext,
&psdio_dev->pRegPath);

SDRegisterClient(....)

SDCardInfoQuery(psdio_dev->hDevice,
SD_INFO_CARD_INTERFACE,
&sd_card_interface,
sizeof(SD_CARD_INTERFACE));

if( sd_card_interface->InterfaceMode && SD_INTERFACE_SD_4BIT )
{
LOG_PRINT(TEXT("NSB_Init: The interface mode is 4BIT\n"));
}
else
{
LOG_PRINT(TEXT("NSB_Init: Not using 4BIT mode yet\n"));
}

SDCardInfoQuery(psdio_dev->hDevice,
SD_INFO_SDIO,
&sd_card_info,
sizeof(SDIO_CARD_INFO));

/* track all the handles */
hDevFn[sd_card_info.FunctionNumber] = psdio_dev->hDevice;

switch(sd_card_info.FunctionNumber)
{
case 0:
case 1:
case 3:
case 6:
case 7:
/* Disable */
if (!
SD_API_SUCCESS(SDSetCardFeature(hDevFn[sd_card_info.FunctionNumber],
SD_IO_FUNCTION_DISABLE,
NULL,
0);
break;
case 2:
case 4:
case 5:

/* Enable function */
sd_io_function_enable.ReadyRetryCount = 5; /* try 5 times */
sd_io_function_enable.Interval = 5; /* 5 milliseconds */

if (! SD_API_SUCCESS(SDSetCardFeature(
hDevFn[sd_card_info.FunctionNumber],
SD_IO_FUNCTION_ENABLE,
&sd_io_function_enable,
sizeof(SD_IO_FUNCTION_ENABLE_INFO))))
{
retval = FALSE;
goto fail;
}

if (! SD_API_SUCCESS(SDIOConnectInterrupt(
hDevFn[sd_card_info.FunctionNumber],
NDSBUSSDIOIsrCallBack)))
break;
default:
}


Posted by r.b. on February 19th, 2006


Hi,
I developing Sdio WLAN driver (Single Function - Function 1) on Mainstone
Platform.
I have done firmware download. And now I am in data path (Tx/ Rx).
Firmware has interrupted the host, the interrupt (SDIO interrupt).
The interruot seems to come to host SD host controller also but for
some reason SDIOIsrCallBack (of my card driver) is not getting called !!

Here what I have done -

In XXX_Init() -
------------------

hSDDevice = SDGetDeviceHandle(dwContext, &pSDRegPath);
g_dwSDContext = dwContext;
g_hSDDevice = hSDDevice;

Call NdisRegisterAdapter(...)
.... which calls DriverEntry and then MiniportInitialize is called....

In MiniportInitialize() -
---------------------------

memset(&g_SDClientInfo, 0, sizeof(g_SDClientInfo));
wcscpy(g_SDClientInfo.ClientName, TEXT("SDIO WLAN Card"));
Status = SDRegisterClient(g_hSDDevice, g_Adapter, &g_SDClientInfo);

// Firmware download
if(! SD_API_SUCCESS(MyWriteFunc0RegWord(hSDDevice, REG_FUNC0_BLK_SIZE, 2048)))
{
DBG_DISPLAY(gDbgInfo, ("ERR WR fn0 REG_FUNC0_BLK_SIZE\n"));
goto exit;
}


dwSDArgument = BUILD_IO_RW_EXTENDED_ARG(SD_IO_OP_WRITE, SD_IO_BLOCK_MODE,
FUNC_1, REG_DATAPORT, SD_IO_FIXED_ADDRESS,
10); // blk count
if(! SD_API_SUCCESS(status = SDSynchronousBusRequest(hSDDevice,
SD_CMD_IO_RW_EXTENDED, dwSDArgument,
SD_WRITE, ResponseR5, &responseSD,
10, // blk count 2048, // Blk size
pFirmwareImage, 0))) // Flag (dcare)
{
DBG_DISPLAY(gDbgInfo, (" Failed BusReq for Write Blk %0x\n", responseSD));
DBG_DISPLAY(gDbgInfo, ("Status %x\n", status));
goto exit;
}

// Enabling Interrupts at host side, so that it can listen to device (firmware

if(! SD_API_SUCCESS(MyWriteFunc0RegByte(hSDDevice, REG_CCCR_CARD_CAP, BIT_5)))
{
DBG_DISPLAY(gDbgInfo, ("ERR WR fn0 REG_CCCR_CARD_CAP\n"));
}

if(! SD_API_SUCCESS(BusWriteFunc1RegdwWord(pBus, REG__INT_ENABLE, 0xffff)))
{
DBG_DISPLAY(gDbgInfo, ("err wr REG__INT_ENABLE\n"));
}

if (! SD_API_SUCCESS(SDIOConnectInterrupt(pBus->hDevice, SDIOIsrCallBack)))
{
DBG_DISPLAY(gDbgInfo, ("Unable to register SD IST !!\n"));
}

----------------------------

Now this is the observation when I debugged --

When I enable interrupts though the above SDIOConnectInterrupt API in my
card driver, the SD host controller's EnableSDIOInterrupts(...) function is
called which enables host controller to listen to SDIO interrupts from device.
Also, SDIOConnectDisconnectInterrupt(....) [Sdcardio.cpp in Sbus driver] is
called which registers my SDIOIsrCallBack(...) with the SD Bus.

When firmware send interrupt, SD Host Controller's IST is triggered and it
goes for handling SDIO interrupt. It submits slot event to SD Bus through
SDHCDIndicateSlotStateChange(...) [in sdhclib.cpp]. This function
calls SDHCDIndicateSlotStateChange__X(...) [sdhcenum.cpp in SD bus driver].
PostSlotEvent(...) [Sdbusdriver.cpp in SD bus driver] is called which posts
message to the dispatcher.

After this my SDIOIsrCallBack(...) function is not entered where I would
acknowledge the interrupt and then do the interrupt processing.

Please let me know what I am missing in all this. And when and how
SDIOIsrCallBack(...) will be called.

Any help would be indeed very much grateful.

Thanks and Regards,
- rahul.



"Daniel Diaz" wrote:

Posted by Daniel Diaz on February 20th, 2006


Hello,



I think you need to enable the SDIO function. Although you might have
already enabled the function by sending the appropriate commands to the
hardware, Windows CE maintains some registers internally that need to be
updated to be aware when a function interrupts.



So use:



functionEnable.Interval = ???; // time between reties

//Retries to verify if it is really enabled

functionEnable.ReadyRetryCount = ???;



if (! SD_API_SUCCESS(SDSetCardFeature(yourhDevice,
SD_IO_FUNCTION_ENABLE, &functionEnable, sizeof(functionEnable))))

{

//Error code here

}



Maybe someone with more experience can correct this post. Try this and if it
doesn't work I will check it another time.



Daniel Diaz



--

Daniel Diaz Sanchez

Telecommunication Engineer

Researcher / Teaching Assistant





Dep. Ing. Telemática

Universidad Carlos III de Madrid

Av. Universidad, 30

28911 Leganés (Madrid/Spain)

Tel: (+34) 91-624-8817, Fax: -8749

Web: www.it.uc3m.es/dds

web: http://www.it.uc3m.es/pervasive

Mail: dds@nospam.it.uc3m.es

[--Remove nospam--]





-----Mensaje original-----
De: Rahul Bansal [mailto:rahulban79@gmail.com]
Enviado el: domingo, 19 de febrero de 2006 16:28
Para: Daniel Diaz
Asunto: Re: SDIO multifunction impossible



Hi Daniel,

I developing Sdio WLAN driver (Single Function - Function 1) on

Mainstone Platform.

I have done firmware download. And now I am in data path (Tx/ Rx).

Firmware has interrupted the host, the interrupt (SDIO interrupt).

The interruot seems to come to host SD host controller also but for

some reason SDIOIsrCallBack (of my card driver) is not getting called

!!



Here what I have done -



In XXX_Init() -

------------------



hSDDevice = SDGetDeviceHandle(dwContext, &pSDRegPath);

g_dwSDContext = dwContext;

g_hSDDevice = hSDDevice;



Call NdisRegisterAdapter(...)

.... which calls DriverEntry and then MiniportInitialize is called....



In MiniportInitialize() -

---------------------------



memset(&g_SDClientInfo, 0, sizeof(g_SDClientInfo));

wcscpy(g_SDClientInfo.ClientName, TEXT("SDIO WLAN Card"));

Status = SDRegisterClient(g_hSDDevice, g_Adapter, &g_SDClientInfo);



// Firmware download

if(! SD_API_SUCCESS(MyWriteFunc0RegWord(hSDDevice, REG_FUNC0_BLK_SIZE,

2048)))

{

DBG_DISPLAY(gDbgInfo, ("ERR WR fn0 REG_FUNC0_BLK_SIZE\n"));

goto exit;

}





dwSDArgument = BUILD_IO_RW_EXTENDED_ARG(SD_IO_OP_WRITE,

SD_IO_BLOCK_MODE,

FUNC_1,

REG_DATAPORT,

SD_IO_FIXED_ADDRESS,

10); // blk count

if(! SD_API_SUCCESS(status = SDSynchronousBusRequest(hSDDevice,

SD_CMD_IO_RW_EXTENDED,

dwSDArgument,

SD_WRITE,

ResponseR5,

&responseSD,

10, // blk count

2048, // Blk size

pFirmwareImage,

0))) // Flag (dont
care)

{

DBG_DISPLAY(gDbgInfo, (" Failed BusReq for Write Blk %0x\n",

responseSD));

DBG_DISPLAY(gDbgInfo, ("Status %x\n", status));

goto exit;

}



// Enabling Interrupts at host side, so that it can listen to device

(firmware



if(! SD_API_SUCCESS(MyWriteFunc0RegByte(hSDDevice, REG_CCCR_CARD_CAP,

BIT_5)))

{

DBG_DISPLAY(gDbgInfo, ("ERR WR fn0 REG_CCCR_CARD_CAP\n"));

}



if(! SD_API_SUCCESS(BusWriteFunc1RegdwWord(pBus, REG__INT_ENABLE,

0xffff)))

{

DBG_DISPLAY(gDbgInfo, ("err wr REG__INT_ENABLE\n"));

}



if (! SD_API_SUCCESS(SDIOConnectInterrupt(pBus->hDevice,

SDIOIsrCallBack)))

{

DBG_DISPLAY(gDbgInfo, ("Unable to register SD IST !!\n"));

}



----------------------------



Now this is the observation when I debugged --



When I enable interrupts though the above SDIOConnectInterrupt API in

my card driver, the SD host controller's

EnableSDIOInterrupts(...) function is called which enables host

controller to listen to SDIO interrupts from device.

Also, SDIOConnectDisconnectInterrupt(....) [Sdcardio.cpp in Sbus

driver] is called which registers my SDIOIsrCallBack(...)

with the SD Bus.



When firmware send interrupt, SD Host Controller's IST is triggered and

it goes for handling SDIO interrupt.

It submits slot event to SD Bus through

SDHCDIndicateSlotStateChange(...) [in sdhclib.cpp]. This function

calls SDHCDIndicateSlotStateChange__X(...) [sdhcenum.cpp in SD bus

driver]. PostSlotEvent(...)

[Sdbusdriver.cpp in SD bus driver] is called which posts message to the

dispatcher.



After this my SDIOIsrCallBack(...) function is not entered where I

would acknowledge the interrupt and then do

the interrupt processing.



Please let me know what I am missing in all this. And when and how

SDIOIsrCallBack(...) will be called.



Any help would be indeed very much grateful.



Thanks and Regards,

- rahul.













Daniel Diaz wrote:





--

No virus found in this incoming message.

Checked by AVG Free Edition.

Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17/02/2006



"r.b." <rb@discussions.microsoft.com> escribió en el mensaje
news:85370740-D8D4-4E98-8480-F4582F9E2A85@microsoft.com...


Posted by r.b. on February 20th, 2006


I tried enabling my function 1 after calling -

if (! SD_API_SUCCESS(SDIOConnectInterrupt(pBus->hDevice, SDIOIsrCallBack)))

and here is the log --

MYNDS:0:FullMac Firmware loaded (my driver msg....)
SDIOConnectDisconnectInterrupt Status 0 (sdbus drv msg...)
SDControllerIstThread MMC_IREG_SDIO_INT (sd host controller msg..)
SDBusDriver: DeviceInterrupting
SDBusDriver: PostSlotEvent
SDBusDriver: PostMessage 5091912, SlotEvent 3
SDBusDriver: PostMessage calls WakeUpWorkItem
SDEnableDisableFunction: Card Function 1 is now ready
SDEnableDisableFunction: Enable Card Function 1

After this i expect that SDIOIsrCallBack to be called, but its not getting
called

regards,
-rahul.

"Daniel Diaz" wrote:

Posted by Daniel Diaz on February 20th, 2006


Hello,

I suppose that the logs that you are providing are the debug output from
Platform Builder, do you get any of these messages?
1)"HandleDeviceInterrupting - HC reported interrupt on disabled slot"
2) "HandleDeviceInterrupting - Function XX Interrupting" messages?.
3) "HandleDeviceInterrupting - Calling interrupt handler for ClientNAME"

Are you working with SDIO 4bit mode?
You are using function 1, isn't it?. Have you tried with other functions?.
(Function 1 is the one that holds the common information for the whole SDIO
device, it should work but...)

When you load the driver by writing some registry entries MANF...function
number..., what are you doing with the rest of the functions (that you
aren't using)?

Daniel Diaz




"r.b." <rb@discussions.microsoft.com> escribió en el mensaje
news:6E7AA9CD-DF56-470B-907F-839D5A66136D@microsoft.com...


Posted by r.b. on February 20th, 2006


Hi Daniel,
Thanks a lot for your help.

Yes my card is 4bit SDIO card. Our WLAN function is actually Function 1.
We have only Function 0 and Function 1 on the card. Function 0 being common.

I am right now not loading my driver through Manf/Vendor ID. This is my
registry key for my driver -

[HKEY_LOCAL_MACHINE\Comm\MySTN]
"DisplayName"="My WLAN SDIO Card"
"Group"="NDIS"
"ImagePath"="MYWLANSDIO.dll"

[HKEY_LOCAL_MACHINE\Comm\MySTN\Linkage]
"Route"=multi_sz:"MySTN1"

[HKEY_LOCAL_MACHINE\Comm\MySTN1]
"DisplayName"="My WLAN SDIO Card"
"Group"="NDIS"
"ImagePath"="MYWLANSDIO.dll"

[HKEY_LOCAL_MACHINE\Comm\MySTN1\Parms]
"BusNumber"=dword:00000000
"BusType"=dword:00000000
"LoadFirmware"=dword:00000001

[HKEY_LOCAL_MACHINE\Comm\MySTN1\Parms\TcpIp]
"EnableDHCP"=dword:1


[HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Cl ass\SDIO_Class\7]
"Dll"="MYWLANSDIO.dll"
"Prefix"="STN"
"Instance0"="MySTN:MySTN1"


This what I did now -
I enabled prints in VOID CSDBusDriver::SlotStatusChange(...) function.
And found out that when card was inserted the card, I get the dbg output -
SDBusDriver: SlotStatusChange DeviceInserted

Bus then I never get "SDBusDriver: SlotStatusChange DeviceInterrupting" after
I am done with firmware download and after device (firmware) has given me
interrupt. But then my confusion is why host controller's and bus driver's
dbg
outputs (which are listed below) suggest that there was SDIO interrupt
reception
by the host controller.

I am explaining things within curly braces for the logs I am giving you
below....

SDBusDriver: PostSlotEvent
SDBusDriver: PostMessage 5091992, SlotEvent 2
SDBusDriver: SlotStatusChange DeviceInserted
SDGetClientFunctions: +Init
SDGetClientFunctions: -Init
SDHSlotOptionHandler - called - SetSlotInterface : Clock Setting: 100000
SDHSlotOptionHandler - called - SetSlotInterface : setting for 1 bit mode
SDSetCardInterfaceForSlot - HC ClockRate differs desired setting: desired:
100000 Hz, Actual : 312500 Hz
SDHSlotOptionHandler - called - SetSlotPower : 0x00100000
SDHSlotOptionHandler - called - SetSlotInterface : Clock Setting: 25000000
SDHSlotOptionHandler - called - SetSlotInterface : setting for 4 bit mode
SDSetCardInterfaceForSlot - HC ClockRate differs desired setting: desired:
25000000 Hz, Actual : 10000000 Hz
DllMain address: 0x0303C930 {My driver DLL called}
SDInitializeCardLib SUCCESS {I initialize SDCardLib in DllMain}
STN_Init CONTEXT 866f57c {My driver's Stream's entry called}
DriverObject=0x4FA650 RegistryPath=\Comm\MySTN {Miniport's DriverEntry called}
SDGetClientFunctions: +Init
SDGetClientFunctions: -Init
MYNDS:0:NOTICE: Adapter#1=0x4FAD60 DbgFlags=0x8003
DbgSystems=0xFFFFFFFF {one instance for the function 1}
SDEnableDisableFunction: Card Function 1 is now ready {When I enable
function 1 using SDSetCardFeature}
SDEnableDisableFunction: Enable Card Function 1 {When I enable function 1
using SDSetCardFeature}
MYNDS:0:Set Function: 1 {When I enable function 1 using SDSetCardFeature}
MYNDS:0:Card Type: 7 {When I query card using SDCardInfoQuery}
MYNDS:0ownload Mac.. Image size : 149036, Base: 1FFE0000 {I download
firmware using Block Mode using SDSynchronousBusRequest}
MYNDS:0:Mac Downloaded !!
MYNDS:0:RAMBoot Given {Driver execute firmware by writing to Function 1
internal register, Here I see my firmware running on UART}
SDHSlotOptionHandler - called - EnableSDIOInterrupts : on slot 0 {When I
call SDIOConnectInterrupt(...SDIOIsrCallBack)}
SDIOConnectDisconnectInterrupt Status SUCCESS {When I call
SDIOConnectInterrupt(...SDIOIsrCallBack)}
SDControllerIstThread: MMC_IREG_SDIO_INT {When Firmware gives interrupt,
SD host controller gets SDIO interrupt}
SDBusDriver: SDHCDIndicateSlotStateChange__X --> DeviceInterrupting ==
Event {Then this function is called indicating the event as
DeviceInterrupting}
SDBusDriver: PostSlotEvent --> pMessage 5091912, SlotEvent 3 {Bus posts
DeviceInterrupting event}
SDBusDriver: PostMessage --> Calls WakeUpWorkItem {And in end bus sets
the event for m_hWorkerWakeUp}


After this nothing happens !!

Please let me know ig you infer something from this.

Thanks and regards
-rahul.


"Daniel Diaz" wrote:

Posted by Rahul Bansal on February 20th, 2006


Hi Daniel,
Thanks a lot for your help.

Yes my card is 4bit SDIO card. Our WLAN function is actually Function
1.
We have only Function 0 and Function 1 on the card. Function 0 being
common.

I am right now not loading my driver through Manf/Vendor ID. This is my
registry key for my driver -

[HKEY_LOCAL_MACHINE\Comm\MySTN]
"DisplayName"="My WLAN SDIO Card"
"Group"="NDIS"
"ImagePath"="MYWLANSDIO.dll"

[HKEY_LOCAL_MACHINE\Comm\MySTN\Linkage]
"Route"=multi_sz:"MySTN1"

[HKEY_LOCAL_MACHINE\Comm\MySTN1]
"DisplayName"="My WLAN SDIO Card"
"Group"="NDIS"
"ImagePath"="MYWLANSDIO.dll"

[HKEY_LOCAL_MACHINE\Comm\MySTN1\Parms]
"BusNumber"=dword:00000000
"BusType"=dword:00000000
"LoadFirmware"=dword:00000001

[HKEY_LOCAL_MACHINE\Comm\MySTN1\Parms\TcpIp]
"EnableDHCP"=dword:1


[HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Cl ass\SDIO_Class\7]
"Dll"="MYWLANSDIO.dll"
"Prefix"="STN"
"Instance0"="MySTN:MySTN1"


This what I did now -
I enabled prints in VOID CSDBusDriver::SlotStatusChange(...) function.
And found out that when card was inserted the card, I get the dbg
output -
SDBusDriver: SlotStatusChange DeviceInserted

Bus then I never get "SDBusDriver: SlotStatusChange DeviceInterrupting"
after
I am done with firmware download and after device (firmware) has given
me
interrupt. But then my confusion is why host controller's and bus
driver's dbg
outputs (which are listed below) suggest that there was SDIO interrupt
reception
by the host controller.

I am explaining things within curly braces for the logs I am giving you
below....

SDBusDriver: PostSlotEvent
SDBusDriver: PostMessage 5091992, SlotEvent 2
SDBusDriver: SlotStatusChange DeviceInserted
SDGetClientFunctions: +Init
SDGetClientFunctions: -Init
SDHSlotOptionHandler - called - SetSlotInterface : Clock Setting:
100000
SDHSlotOptionHandler - called - SetSlotInterface : setting for 1 bit
mode
SDSetCardInterfaceForSlot - HC ClockRate differs desired setting:
desired: 100000 Hz, Actual : 312500 Hz
SDHSlotOptionHandler - called - SetSlotPower : 0x00100000
SDHSlotOptionHandler - called - SetSlotInterface : Clock Setting:
25000000
SDHSlotOptionHandler - called - SetSlotInterface : setting for 4 bit
mode
SDSetCardInterfaceForSlot - HC ClockRate differs desired setting:
desired: 25000000 Hz, Actual : 10000000 Hz
DllMain address: 0x0303C930 {My driver DLL called}
SDInitializeCardLib SUCCESS {I initialize SDCardLib in DllMain}
STN_Init CONTEXT 866f57c {My driver's Stream's entry called}
DriverObject=0x4FA650 RegistryPath=\Comm\MySTN {Miniport's DriverEntry
called}
SDGetClientFunctions: +Init
SDGetClientFunctions: -Init
MYNDS:0:NOTICE: Adapter#1=0x4FAD60 DbgFlags=0x8003
DbgSystems=0xFFFFFFFF {one instance for the function 1}
SDEnableDisableFunction: Card Function 1 is now ready {When I enable
function 1 using SDSetCardFeature}
SDEnableDisableFunction: Enable Card Function 1 {When I enable function
1 using SDSetCardFeature}
MYNDS:0:Set Function: 1 {When I enable function 1 using
SDSetCardFeature}
MYNDS:0:Card Type: 7 {When I query card using SDCardInfoQuery}
MYNDS:0ownload Mac.. Image size : 149036, Base: 1FFE0000 {I
download firmware using Block Mode using SDSynchronousBusRequest}
MYNDS:0:Mac Downloaded !!
MYNDS:0:RAMBoot Given {Driver execute firmware by writing to
Function 1 internal register, Here I see my firmware running on UART}
SDHSlotOptionHandler - called - EnableSDIOInterrupts : on slot 0 {When
I call SDIOConnectInterrupt(...SDIOIsrCallBack)}
SDIOConnectDisconnectInterrupt Status SUCCESS {When I call
SDIOConnectInterrupt(...SDIOIsrCallBack)}
SDControllerIstThread: MMC_IREG_SDIO_INT {When Firmware gives
interrupt, SD host controller gets SDIO interrupt}
SDBusDriver: SDHCDIndicateSlotStateChange__X --> DeviceInterrupting ==
Event {Then this function is called indicating the event as
DeviceInterrupting}
SDBusDriver: PostSlotEvent --> pMessage 5091912, SlotEvent 3 {Bus
posts DeviceInterrupting event}
SDBusDriver: PostMessage --> Calls WakeUpWorkItem {And in end bus
sets the event for m_hWorkerWakeUp}


After this nothing happens !!

Please let me know ig you infer something from this.

Thanks and regards
-rahul.



Daniel Diaz wrote:

Posted by Daniel Diaz on February 20th, 2006



Hello,

Have a look to the comments, I hope them help you.

Sometimes there are problems with interrupts and SDIO 4 bit, since one bus
line is now shared for data and interrupts, but it doesn't seem to be your
problem. If your card is correctly recognized as 4bit SDIO you configuration
is automatically done by the controller.

True, I forgot it; the common one (for registers) is 0, so you are right.
But the first one in the queue is 1 (parentDevice). The functions are called
in the order 1,7,6,5,4,3,2.

I asked that because when using the notation Manf/vendorID it is necessary
to write a registry entry for every function in the card (used or not). So
entries for unused ones should be redirected to a dummy dll that disables
them. Sometimes it is possible to disable a function that it is really in
use.

I used MANF-<manufacturer ID>-CARDID-<card ID>-FUNC-<function> because I
thought that SDIO_Class was used only by standard function drivers (memory
and bluetooth) and custom drivers.

CSDBusDriver::SDLoadDevice is called by CSDBusDriver::HandleAddDevice once
the hardware is inserted in the slot. This function tries to open a custom
reg path and if it is not found, it checks for pDevice->DeviceType of type
Device_SD_Memory or type Device_MMC. If pDevice->DeviceType is SDIO it
returns "unknown class: no custom driver found" if no standard class entry
was found or tries to find a standard class device driver under a key like
Class\SDIO_Class.

Are you sure that the class you are using is a standard class? (if not try
to move to a custom driver). We used custom since network drivers are not
standard (at least we didn't know).

Try to enable debug in HandleDeviceInterrupting, this is the one that
handles the interrupt once the SlotEvent has been recognized as an
interrupt. This function checks ((pSlot)->Flags &
SD_SLOT_FLAG_SDIO_INTERRUPTS_ENABLED). This flag is set by
SdioConnectInterrupt (it turns on the function interrupt and the master) but
you told me that you were using SdioConnectInterrupt so it should work.

Maybe your device is not set correctly. If I were you I will try with custom
reg path (this is important). But, may it doesn't make sense (probably you
have more information than me).

filling up a message and posting in the queue, and also setting up the event
but nobody is hearing the event (so nobody consume the message).

try to use custom reg entry (if not maybe your card is treated as SD or
something like that). Of course you are using Windows Mobile 5.0, don't you?

Let me know your advances.

Dani

B.R
--
Daniel Diaz Sanchez
Telecommunication Engineer
Researcher / Teaching Assistant


Dep. Ing. Telemática
Universidad Carlos III de Madrid
Av. Universidad, 30
28911 Leganés (Madrid/Spain)
Tel: (+34) 91-624-8817, Fax: -8749
Web: www.it.uc3m.es/dds
web: http://www.it.uc3m.es/pervasive
Mail: dds@nospam.it.uc3m.es
[--Remove nospam--]


"Rahul Bansal" <rahulban79@gmail.com> escribió en el mensaje
news:1140443188.623199.106990@g14g2000cwa.googlegr oups.com...
Hi Daniel,
Thanks a lot for your help.

Yes my card is 4bit SDIO card. Our WLAN function is actually Function
1.
We have only Function 0 and Function 1 on the card. Function 0 being
common.

I am right now not loading my driver through Manf/Vendor ID. This is my
registry key for my driver -

[HKEY_LOCAL_MACHINE\Comm\MySTN]
"DisplayName"="My WLAN SDIO Card"
"Group"="NDIS"
"ImagePath"="MYWLANSDIO.dll"

[HKEY_LOCAL_MACHINE\Comm\MySTN\Linkage]
"Route"=multi_sz:"MySTN1"

[HKEY_LOCAL_MACHINE\Comm\MySTN1]
"DisplayName"="My WLAN SDIO Card"
"Group"="NDIS"
"ImagePath"="MYWLANSDIO.dll"

[HKEY_LOCAL_MACHINE\Comm\MySTN1\Parms]
"BusNumber"=dword:00000000
"BusType"=dword:00000000
"LoadFirmware"=dword:00000001

[HKEY_LOCAL_MACHINE\Comm\MySTN1\Parms\TcpIp]
"EnableDHCP"=dword:1


[HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Cl ass\SDIO_Class\7]
"Dll"="MYWLANSDIO.dll"
"Prefix"="STN"
"Instance0"="MySTN:MySTN1"


This what I did now -
I enabled prints in VOID CSDBusDriver::SlotStatusChange(...) function.
And found out that when card was inserted the card, I get the dbg
output -
SDBusDriver: SlotStatusChange DeviceInserted

Bus then I never get "SDBusDriver: SlotStatusChange DeviceInterrupting"
after
I am done with firmware download and after device (firmware) has given
me
interrupt. But then my confusion is why host controller's and bus
driver's dbg
outputs (which are listed below) suggest that there was SDIO interrupt
reception
by the host controller.

I am explaining things within curly braces for the logs I am giving you
below....

SDBusDriver: PostSlotEvent
SDBusDriver: PostMessage 5091992, SlotEvent 2
SDBusDriver: SlotStatusChange DeviceInserted
SDGetClientFunctions: +Init
SDGetClientFunctions: -Init
SDHSlotOptionHandler - called - SetSlotInterface : Clock Setting:
100000
SDHSlotOptionHandler - called - SetSlotInterface : setting for 1 bit
mode
SDSetCardInterfaceForSlot - HC ClockRate differs desired setting:
desired: 100000 Hz, Actual : 312500 Hz
SDHSlotOptionHandler - called - SetSlotPower : 0x00100000
SDHSlotOptionHandler - called - SetSlotInterface : Clock Setting:
25000000
SDHSlotOptionHandler - called - SetSlotInterface : setting for 4 bit
mode
SDSetCardInterfaceForSlot - HC ClockRate differs desired setting:
desired: 25000000 Hz, Actual : 10000000 Hz
DllMain address: 0x0303C930 {My driver DLL called}
SDInitializeCardLib SUCCESS {I initialize SDCardLib in DllMain}
STN_Init CONTEXT 866f57c {My driver's Stream's entry called}
DriverObject=0x4FA650 RegistryPath=\Comm\MySTN {Miniport's DriverEntry
called}
SDGetClientFunctions: +Init
SDGetClientFunctions: -Init
MYNDS:0:NOTICE: Adapter#1=0x4FAD60 DbgFlags=0x8003
DbgSystems=0xFFFFFFFF {one instance for the function 1}
SDEnableDisableFunction: Card Function 1 is now ready {When I enable
function 1 using SDSetCardFeature}
SDEnableDisableFunction: Enable Card Function 1 {When I enable function
1 using SDSetCardFeature}
MYNDS:0:Set Function: 1 {When I enable function 1 using
SDSetCardFeature}
MYNDS:0:Card Type: 7 {When I query card using SDCardInfoQuery}
MYNDS:0ownload Mac.. Image size : 149036, Base: 1FFE0000 {I
download firmware using Block Mode using SDSynchronousBusRequest}
MYNDS:0:Mac Downloaded !!
MYNDS:0:RAMBoot Given {Driver execute firmware by writing to
Function 1 internal register, Here I see my firmware running on UART}
SDHSlotOptionHandler - called - EnableSDIOInterrupts : on slot 0 {When
I call SDIOConnectInterrupt(...SDIOIsrCallBack)}
SDIOConnectDisconnectInterrupt Status SUCCESS {When I call
SDIOConnectInterrupt(...SDIOIsrCallBack)}
SDControllerIstThread: MMC_IREG_SDIO_INT {When Firmware gives
interrupt, SD host controller gets SDIO interrupt}
SDBusDriver: SDHCDIndicateSlotStateChange__X --> DeviceInterrupting ==
Event {Then this function is called indicating the event as
DeviceInterrupting}
SDBusDriver: PostSlotEvent --> pMessage 5091912, SlotEvent 3 {Bus
posts DeviceInterrupting event}
SDBusDriver: PostMessage --> Calls WakeUpWorkItem {And in end bus
sets the event for m_hWorkerWakeUp}


After this nothing happens !!

Please let me know ig you infer something from this.

Thanks and regards
-rahul.



Daniel Diaz wrote:


Posted by Rahul Bansal on February 21st, 2006


Hi daniel,
thanks for bringing up really good ideas....

I tried with custom reg key and also with Std class key as follows -

[HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Cu stom\MANF-0013-CARDID-c684-FUNC-1]
"Dll"="MYSDIO.dll"
"Prefix"="STN"
"WakeOnSDIOInterrupts"=dword:1 {addded this key
after reading SDLoadDevice}
"Instance0"="MySTN:MySTN1"

[HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Cl ass\SDIO_Class\7]
"Dll"="MySDIO.dll"
"Prefix"="STN"
"WakeOnSDIOInterrupts"=dword:1 {addded this key after reading
SDLoadDevice}
"Instance0"="MySTN:MySTN1"

....And got same results for the same as before (i.e my SDIOIsrCallBack
was not sheduled by SD Bus)...

I enabled debug prints in HandleAddDevice(...) and SDLoadDevice(.....)
And here is the observation -

In case of Custom device (reg key) -->
------------------------------------------------------
In HandleAddDevice(...):
Checking for SDIO card in slot 0 ....
SDIO Card detected in slot 0 , Number of Functions: 1
SDIO-Only Card Detected in Slot 0
Device Ready, loading driver...

In SDLoadDevice(...):
Device Type 3
loadpath -
\Drivers\SDCARD\ClientDrivers\Custom\MANF-0013-CARDID-C684-FUNC-1
Loading Driver : MYSDIO.dll

(please note: pDevice->hDriver = LoadDriver(keyString); in
SDLoadDevice() loads my driver. and then my driver starts executing
(i.e. DllMain -> STN_Init -> DriverEntry -> MiniportInitialize), but
then then the control never comes back to SDLoadDevice() function and
therefore statements which are for enabling sdio interrupts on wakeup
in SDLoadDevice() never gets called !!

This behavior is same for
Drivers\SDCARD\ClientDrivers\Class\SDIO_Class\7

Please let me know where its really neccessary for SD Bus to enable
sdio interrupts during insertion time ?

Still I am not getting this. When SD host controller has posted message
to SD Bus that it got SDIO interrupt then whats stopping SD Bus to
shedule SDIOIsrCallBack(...) function...







Daniel Diaz wrote:

Posted by Rahul Bansal on February 21st, 2006


Hi Daniel,

An update ......

In SDLoadDevice it goes upto -
status = m_sdBusEnum.ActivateChild(loadPath,
pHostController->dwHCNumber,
pSlot->SlotIndex,
pDevice->SDCardInfo.SDIOInformation.Function,
pDevice, &pDevice->pDeviceFolder);

And after that I have put a debug print and it never came !

regards,
-rahul.


Rahul Bansal wrote:


Similar Posts