AnsweredAssumed Answered

Device Driver Parameterization in VDK

Question asked by LilyP on May 3, 2010
Latest reply on May 6, 2010 by LilyP



I am new to VDK and trying to figure out how to create two separate instances of a particular device driver. I have read the VDK manual regarding this topic but it tells me to "see the online Help for details". This is my issue I have 2 UARTs in the DSP (ADSP21369) and I want to be able to use the same driver for both, but since all the access registers are different I will need to differentiate inside the Dispatch function which UART is being accessed.


There is a mechanism for this when the Object is being initiated by the Kernel where the initializer value is passed to the dispatch function. But how do I do that from the tread domain, for instance when I open the device or SyncRead from a thread.


Also there is parameter call **dataH  that is passed by the Kernel to the Dispatch function as part of the inUnion, but from the tread domain the OpenDevice function is defined as

"VDK_DeviceDescriptor VDK_OpenDevice(VDK_IOID inIDNum, char *inFlags);" with no access to the dataH pointer


In the VDK manual this is the explanation that is given:

"OpenClose_t.dataH: A pointer to a thread-specific location that a device
driver can use to hold any thread-specific resources. For example, a thread
can malloc space for a structure that describes the state of a thread associated
with a device. The pointer to the structure can be stored in *dataH,
which is then accessible to every other dispatch call involving this thread.
A device driver can free the space when the thread calls CloseDevice()."


But how do I access the *dataH pointer from the thread domain, it seems to be part of the Kernel call to the device dispatch function.



Also let me know if there is a better approach to writing device drivers with multiple instantiated objects.