Hi All,
I am writing a SDIO driver for a WLAN device using Win2k3 server SP1 DDK.
I am facing problem when I am trying to read and write the SDIO registers, the communication is not happening. The bus driver is not generating commands (CMD 53 and etc) for reading and writing. This is happening in both byte transfer and block transfer. But I could able to install and uninstall the driver with out any problem.
Please find the code for the byte reading.
NTSTATUS ReadDirect(PDEVICE_OBJECT fdo, long function, int Offset, unsigned short
*Data)
{
NTSTATUS status;
PSDBUS_REQUEST_PACKET sdrp = NULL;
SD_RW_DIRECT_ARGUMENT sdIoArgument;
PWDM_DEVICE_EXTENSION dx = (PWDM_DEVICE_EXTENSION)fdo->DeviceExtension;
DbgPrint (“Entering ReadDirect\n”);
sdrp = (PSDBUS_REQUEST_PACKET)ExAllocatePool(NonPagedPool,
sizeof(SDBUS_REQUEST_PACKET));
if (!sdrp) {
DbgPrint (“Error : Insufficient Memory\n”);
return STATUS_INSUFFICIENT_RESOURCES;
}
RtlZeroMemory(sdrp, sizeof(SDBUS_REQUEST_PACKET));
sdrp->RequestFunction = SDRF_DEVICE_COMMAND;
sdrp->Parameters.DeviceCommand.CmdDesc = ReadIoDirectDesc;
//
// Set up the argument and command descriptor
//
sdIoArgument.u.AsULONG =
0;
sdIoArgument.u.bits.Address = Offset; //offset = 0xa
sdIoArgument.u.bits.Function = function; // function = 1
sdrp->Parameters.DeviceCommand.Argument =
sdIoArgument.u.AsULONG;
sdrp->Parameters.DeviceCommand.Length = 1; //Byte Access
//
// submit the request
//
status = SdBusSubmitRequest(dx->BusInterface.Context, sdrp);
if (NT_SUCCESS(status)) {
// for direct IO, the data comes in the response
//*Data = sdrp->ResponseData.AsUCHAR[0];
DbgPrint (“Msg : SdBusSubmitRequest success \n”);
RtlCopyMemory (Data, sdrp->ResponseData.AsUCHAR, sizeof (unsigned short));
}
else
{
DbgPrint (“Msg : SdBusSubmitRequest Failed \n”);
}
DbgPrint (“Msg : Data Read : %d\n”, Data);
ExFreePool(sdrp);
DbgPrint (“Exiting ReadDirect \n”);
return status;
}
Can any body tell how I can solve this problem.
Please help.
Thanks,
Sundar
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com