SDIOclientdriver: Where to read the byte data returned, in CMD53 command ?

Hi,

I have the SDIO client driver up and running. I can do the CMD 52 read
and write properly. Now, i’m trying the CMD53 (read extended). In this,
first i’m trying the byte mode (SDTT_CMD_ONLY) and not the block mode.
But I dont know where do i get the response data. The DDK does not
document it properly ? Will the Mdl be used in case of byte mode also ?
Or is it similar to CMD52 where the read value will be in
sdrp->ResponseData.AsUCHAR[0] ?? What will be there in sdrp.Information
??? (The SDIO status ?)

I have attached my function here

NTSTATUS SdioReadWriteBuffer(PDEVICE_OBJECT fdo, IN ULONG Function, IN
PUCHAR PBuffer,IN ULONG Address,IN UCHAR BlockMode,IN ULONG Length,IN
BOOLEAN WriteToDevice,OUT PULONG BytesRead )
/*++
This takes care of reading or writing to SDIO device using CMD53
–*/
{
PFDO_DATA fdoData;
SDBUS_REQUEST_PACKET sdrp;
SD_RW_EXTENDED_ARGUMENT extendedArgument;
NTSTATUS status;
PMDL Mdl=NULL;

const SDCMD_DESCRIPTOR ReadIoExtendedDesc =
{SDCMD_IO_RW_EXTENDED, SDCC_STANDARD, SDTD_READ,
SDTT_CMD_ONLY, SDRT_1};
const SDCMD_DESCRIPTOR WriteIoExtendedDesc =
{SDCMD_IO_RW_EXTENDED, SDCC_STANDARD, SDTD_WRITE,
SDTT_CMD_ONLY, SDRT_1};

//PAGED_CODE();
fdoData = (PFDO_DATA)fdo->DeviceExtension;
RtlZeroMemory(&sdrp, sizeof(SDBUS_REQUEST_PACKET));
// first, get an MDL to map the data. Call IoAllocateMdl to
// allocate an MDL and pass in a pointer to a buffer
// allocated from the non-paged pool.

Mdl = IoAllocateMdl(PBuffer, Length, FALSE, FALSE, NULL);
if (Mdl == NULL) {
return STATUS_INSUFFICIENT_RESOURCES;
}
MmBuildMdlForNonPagedPool (Mdl);
sdrp.RequestFunction = SDRF_DEVICE_COMMAND;
sdrp.Parameters.DeviceCommand.Mdl = Mdl;
extendedArgument.u.AsULONG = 0;
extendedArgument.u.bits.Function = Function;
extendedArgument.u.bits.OpCode = 0;
extendedArgument.u.bits.BlockMode = 0;
extendedArgument.u.bits.Address = Address;

if((fdoData->SdioGlobals.ioctlData.requestMode == BLOCK_MODE) &&
(fdoData->BlockMode == 0))
{
SdioDbgPrint(TRACE,“\nSdioReadWriteBuffer: Block
Mode not supported by the device\n”);
//Device does not support the block mode - return error
//since this is the dianostics driver all to send any block mode.
//return STATUS_INVALID_DEVICE_REQUEST;
}
if (WriteToDevice) {
extendedArgument.u.bits.WriteToDevice = 1;
sdrp.Parameters.DeviceCommand.CmdDesc
= WriteIoExtendedDesc;
} else {
sdrp.Parameters.DeviceCommand.CmdDesc = ReadIoExtendedDesc;
}

sdrp.Parameters.DeviceCommand.Argument =
extendedArgument.u.AsULONG;
sdrp.Parameters.DeviceCommand.Length = Length;

//
// Send the IO request down to the bus driver
//

status =
SdBusSubmitRequest(fdoData->SDBusInterface.Context, &sdrp);
*BytesRead = *(ULONG)sdrp.Information;

if (NT_SUCCESS(status) && !WriteToDevice) {
DbgPrint(“\nReadExtended: Uchar0 0x%X\n”,
sdrp.ResponseData.AsUCHAR[0]);
//*Data = sdrp.ResponseData.AsUCHAR[0];
SdioDbgPrint(TRACE,“\nReadEx: Byte in the buff
0x%X\n”,*PBuffer);

}
SdioDbgPrint(TRACE,“\nSdioReadWriteBuffer: BytesRead
%d\n”,*BytesRead);
IoFreeMdl(mdl);
return status;

}


Regards
Esha


Eshanye.K.P
Processor Systems (India) Pvt. Ltd
#24, Richmond Road
Bangalore-560025
India
Ph: +91-80-22273090
e-mail: xxxxx@procsys.com