none
WDF Serial Driver -Win32API RRS feed

  • Question

  • I am new to this field and I have to build serial driver for some device. According  to serial communication following Win32API function should be support by the driver. I check some sample driver in MSDN and got to know that when we call ReadFile   from application driver will call SerialEvtIoRead (define in serialp.h) function in driver side. Functionality in  ReadFile   should be implement in SerialEvtIoRead function. Same time WriteFile have  SerialEvtIoWrite  finction in driver side. 

    1.        IS this correct.
    2.        Serial communication have bellow listed Win32API and what is the relevant functions of each API in driver side. Where should find this information?

    ReadFile   è SerialEvtIoRead  (serialp.h)

    WriteFile è SerialEvtIoWrite (serialp.h)

    WaitCommEvent

    CloseHandle

    SetupComm

    SetCommMask

    SetCommState

    SetCommTimeouts

    CreateFile

    BuildCommDCB

    BuildCommDCBAndTimeouts

    ClearCommBreak

    ClearCommError

    CommConfigDialog

    EscapeCommFunction

    GetCommConfig

    GetCommMask

    GetCommModemStatus

    GetCommProperties

    GetCommState

    GetCommTimeouts

    GetDefaultCommConfig

    PurgeComm

    SetCommBreak

    SetCommConfig

    SetDegaultCommConfig

    TransmitCommChar


    Thanks in advance

    Hasitha Perera



    • Edited by HP Hasitha Friday, May 31, 2013 10:31 AM
    Friday, May 31, 2013 10:05 AM

Answers

  • Why do you want this mapping?  If your job is to create a serial driver then what you should be caring about are the interactions of the driver and the hardware.  So if you look in serial.h you will see a number of calls and macros such as SerialWriteRegisterUChar that interact with the hardware. 

    If your hardware looks like a standard serial port then things are easy, since you are just using these calls.

    If it does not look like a standard serial port these calls are the place to start, the hardware interactions will need to be modified so that the bits are adjusted to match your hardware.   Personally, I would keep the mapping of your the standard hardware to your hardware in a small layer, since the serial driver has a lot of interactions and layers.  By keeping things in your own layer, the rest of the driver can be maintained as is and new updates from Microsoft can be incorporated fairly easily.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Friday, May 31, 2013 10:41 AM

All replies

  • Why do you want this mapping?  If your job is to create a serial driver then what you should be caring about are the interactions of the driver and the hardware.  So if you look in serial.h you will see a number of calls and macros such as SerialWriteRegisterUChar that interact with the hardware. 

    If your hardware looks like a standard serial port then things are easy, since you are just using these calls.

    If it does not look like a standard serial port these calls are the place to start, the hardware interactions will need to be modified so that the bits are adjusted to match your hardware.   Personally, I would keep the mapping of your the standard hardware to your hardware in a small layer, since the serial driver has a lot of interactions and layers.  By keeping things in your own layer, the rest of the driver can be maintained as is and new updates from Microsoft can be incorporated fairly easily.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Friday, May 31, 2013 10:41 AM
  • The rest of the APIs you list are supported by the ioctls also implemented on the sample. Some have a 1:1 mapping, other APIs call multiple ioctls in sequence. As don said, these mappings don't matter to the driver. What important is that you implement the full interface.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, May 31, 2013 1:53 PM
  • Thanks for your supports

    I found all IOCTRL codes related to Win API's.

    Friday, June 21, 2013 11:27 AM