User Client Question
User Client Question
- Subject: User Client Question
- From: Frank McGirt <email@hidden>
- Date: Thu, 7 Feb 2002 09:54:37 -0700
Hi,
I hope this is an easy question but I have been having trouble getting
the parameters of the IOConnectMethods from user space to match
up with my methods in my User Client in my kernel driver.
I am writing a driver for a custom PCI card with an onboard large
(8MB) memory buffer which connects to external hardware. On command
from user space, the PCI card will either get a block of data from
the external hardware to the onboard buffer of put a block of data from
the buffer to the external hardware. Several parameters must be passed
on either the get or the put to setup the hardware for the transfer.
These are in addition to the user space buffer addresses and lengths.
So I have defined two user client methods, getBlock as StructIStructO,
and putBlock as ScalarIStructI and in the UserClient::sMethods these
appear as
{
// kGetBlock method
kMethodObjectThis,
(IOMethod) &PCIFMDriverUserClient::getBlock,
kIOUCStructIStructO, // struct input, struct output
sizeof(MapRegisterStruct), // input struct size
0xffffffff // variable size of the output structure
},
{
// kPutBlock method
kMethodObjectThis,
(IOMethod) &PCIFMDriverUserClient::putBlock,
kIOUCScalarIStructI, // scalar input, struct input
0, // no scalar input
0xffffffff // variable size of the input structure
},
where I intend to use the variable size structures to pass the data back
and
forth to user space. The MapRegisterStruct structure is defined as
typedef struct MapRegisterStruct
{
UInt32 *userAddress; // user space buffer address
UInt32 vmeAddress;
UInt32 numberBytes;
UInt16 addressModifier;
UInt16 addressSpace;
UInt8 accessWidth;
} MapRegisterStruct;
and contains the parameters needed as well as the user space buffer
address
and byte length of transfer.
My user client methods are then defined as
virtual IOReturn getBlock(void *vInData,void *vOutData,
void *, void *, void *);
virtual IOReturn putVmeLongData(void *vInData, void *,
void *, void *, void *, void *);
I guess I am really confused about how to pass a variable size user
buffer
address to/from a user client running in the kernel. I have looked at
several
examples but none seem to match exactly what I want o do or if I try
them,
they don't work. I have also tried seperating the transfer parameters
into their
own structure (StructI) and passing the user space buffer address and
length as
individual arguments - haven't gotten this to work either.
I would appreciate any suggestions or links to appropriate documentation,
sample code, etc.
And if this is the wrong list, please let me know.
Frank McGirt
email@hidden
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.