none
Adding custom IO control to serial port driver RRS feed

  • Question

  • Hi guys,

    I am developing a Windows CE 5.0 BSP for a custom platform.

    The platform has a serial port that can be used as RS232, RS422 or RS485, this is done by switching digital outputs on the controller to route the data stream through the three different hardware arrangements into one of the UART ports of the controller using logic gates.

    I have thought about using a registry key which is read when the driver is installed to configure the serial port (set the digital outputs) at boot time, but this would be quite hard for the end user to work with, it would be much nicer if they could configure the protocol type in the same way that the set up baud rate, data bits etc... even if it means I have to specify a custom IoControl code for them to use.

    It may also be worth noting that I am not using fully-featured serial for this application, it is RX/TX only, so I might be able to use pdd functions such as SetDTR() and SetRTS() because they are currently unused in my PDD code only I am not sure what implications that will have in the layers between and whether I will even be able to drive them manually.

    Any ideas on how to go about doing this would be greatly appreciated,

    Tom

    Thursday, July 5, 2012 11:25 PM

Answers

  • You could also just use one of the reserved or unused members of the DCB structure. Your customer then simply calls SetCommState and fills in the DCB with one extra parameter to set. Of course you'd have to clone the serial MDD part if you haven't already done so, but I think that's the cleanest option and it gives you full control.

    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: http://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.

    Friday, July 6, 2012 12:07 AM
    Moderator
  • Another possible route is to define your custom IOCTL and handle it in your serial PDD ioctl handler. Depends on the PDD you use, the handler usually called SL_Ioctl and exported via a HW_VTBL structure to MDD.
    • Marked as answer by tomleijen Thursday, August 30, 2012 5:05 AM
    Monday, July 9, 2012 7:21 PM
  • Managed to get it working with an OEM IOControl.

    Thanks guys.

    • Marked as answer by tomleijen Thursday, August 30, 2012 5:06 AM
    Thursday, August 30, 2012 5:05 AM

All replies

  • You could also just use one of the reserved or unused members of the DCB structure. Your customer then simply calls SetCommState and fills in the DCB with one extra parameter to set. Of course you'd have to clone the serial MDD part if you haven't already done so, but I think that's the cleanest option and it gives you full control.

    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: http://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.

    Friday, July 6, 2012 12:07 AM
    Moderator
  • Thanks for the suggestion, sounds like that will work. I will try it out on Monday and let you know.
    Friday, July 6, 2012 4:37 AM
  • Another possible route is to define your custom IOCTL and handle it in your serial PDD ioctl handler. Depends on the PDD you use, the handler usually called SL_Ioctl and exported via a HW_VTBL structure to MDD.
    • Marked as answer by tomleijen Thursday, August 30, 2012 5:05 AM
    Monday, July 9, 2012 7:21 PM
  • Managed to get it working with an OEM IOControl.

    Thanks guys.

    • Marked as answer by tomleijen Thursday, August 30, 2012 5:06 AM
    Thursday, August 30, 2012 5:05 AM