Hello , I am working on sending some data via dma to fpga , my issue is
that i wanted to directly communicate via deviceiocontrol function , i have
almost no experience on this topic , Please any help or info is good .
problem is when i send data i do like this :
DeviceIoControl (hDMADevice, ISTART_TEST_SMUX, DataToSend,
sizeof(TestCmdSMUX), NULL, 0, &bytes, &os))
where DataToSend is pointer to structure i send , with size
= sizeof(TestCmdSMUX).
How can i decode this data in driver itself ? what i did so far is :
case ISTART_TEST_SMUX:
{
TestCmdSMUX * pTC;
if (InputBufferLength >= sizeof(TestCmdSMUX))
{
status = WdfRequestRetrieveInputBuffer(Request, sizeof(TestCmdSMUX),
&pTC, NULL);
if (status == STATUS_SUCCESS)
{
status = SetTestModesmux(pDevExt, pTC );
}
}
}
*DataToSend *is ptr to structure like this :
typedef struct {
int Engine; /**< Engine Number */
unsigned int TestMode; /**< Test Mode - Enable TX, Enable loopback */
unsigned int MinPktSize; /**< Min packet size */
unsigned int MaxPktSize; /**< Max packet size */
UCHAR buffer[1];
} TestCmdSMUX *DataToSend **
*UCHAR buffer[1];* –> this is pointer to first element of my data i want
to send to kernel .
so it isn’t working properly , and i don’t know why ! , few questions i
have here :
1 - is WdfRequestRetrieveInputBuffer right to use ? and can i in this way
use members of pTC structure ?
2 - what is diffrence between *WdfRequestRetrieveInputBuffer *and
*Irp->AssociatedIrp.SystemBuffer
,when to use them?*
3 - how can i actually recieve the array data i am passing with
deviceiocontrol datatosend structure ?
4 - what is type of my IOCode in this usecase , Method_In_Direct OR
MethodBuffered ?
5 - suppose i want to address in driver the 3rd element data of array
passed , how i do that in driver ?
Thanks so much
–
Mohamed Abdel Rauof.
communication and electronics Engineer Cairo University BSc. 2011.