none
One Device Driver Advertising Multiple Interfaces RRS feed

  • Question

  • I have a device that contains 3 different devices that all have different interface requirements and are of completely different device types.  The device itself is accessed over the SPI bus via a set of registers (pretty standard SPI interface) but differs in that various sections of the registers are reserved for the various types of devices that supports / contains.

    Is it possible to write 1 driver that exposes three interfaces, or to create symbolic links in Windows CE.

    For example, can I have a driver load once but register itself as COM1:, DDW1: and SNS1:?

    Or is there a way to create 3 symbolic links:

    • COM1: to DEV1:
    • DDW1: to DEV1:
    • SNS1: to DEV1:

    Thanks,

    Brad.

    Saturday, February 9, 2013 1:05 AM

All replies

  • A common practice is,

    you can develop a common driver that should allow to read/write all the registers of the device using SPI. the read/write should handle with proper critical sections between read/write and other functions. Name the driver Prefix as unique one.

    Develop a separate driver for each internal devices and to access the specific device registers use the common driver mentioned above. Make sure the common driver should be a sharable driver between the device specific driver.


    Vinoth.R

    www.e-consystems.com

    http://vinoth-vinothblog.blogspot.com

    Saturday, February 9, 2013 5:55 AM
  • Yes, this is possible.

    You need to create a driver and load it with three different instances defined in the .reg file having same device name as XYZ but different number from 0-2

    In the driver code read the .reg file and make a conditional execution of the code based on the reg key value.

    This is one of the possibility to create a driver based on your requirement.

    --- Misbah


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com

    Monday, February 11, 2013 4:52 AM
  • If you just want to load/unload a single driver that "advertises three interfaces", you could try the following:

    Create your driver DEV1:

    When DEV1 loads, use ActivateDeviceEx to load a seperate driver for each internal device (COM1, DDW1 and SNS1)

    Have DEV1 read/write all the registers to shared memory accessible by the other drivers and use a named mutex to protect the shared memory from read/write corruptions.

    Before unloading DEV1 call DeactivateDevice to unload the seperate drivers for the internal devices.

    Good luck,

    Tom

    Wednesday, February 13, 2013 12:57 AM