A CUSTOM FTDI STREAM DRIVER

Starting with a Compact 7 system with the FTDI VCP driver installed and one of the modules 1, 2, or 4 (as in Table 44-1) connected, it would be simple enough to create an application that opens COM0: and reads and writes to it. These three modules all have a similar textual API. This could be done as a native application or as a managed code application. It would require writing code with a lot of magic numbers, or should I say magic characters, to implement the module’s textual API. It would be neater though to have a set of commands across all three with some commonality. For example, the ping command would have a similar meaning across all these boards. In this section a stream driver is developed to wrapper the FTDI VCP driver specifically for these three modules.

Table 44-7 shows some common commands.

TABLE 44-7: Stream Driver Commands

image

SetMode indicates which module is used and will be implemented as the Write stream function, sending 0, 1, or 2 as a parameter. Ping is implemented as the Read function with no parameters. The other commands will all be implemented as IOCTLs with an IOCTL code indexed from the Clear IOCTL code as per the Index column. All parameters are bytes except SendStr and GetStr, which use a string.

Creating the Stream Driver

  • Start with an existing Compact 7 OS project for a board target that has a host USB port. Add the FTDI ...

Get Professional Windows® Embedded Compact 7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.