Application Note an 407 D3XX .NET Programmers Guide Version 1.0
Total Page:16
File Type:pdf, Size:1020Kb
Application Note AN_407 D3XX .NET Programmers Guide Version 1.0 Issue Date: 2016-11-01 FTDI provides a .NET DLL class library to its SuperSpeed USB drivers. This document provides information about the class library for FTD3XX .NET DLL. Use of FTDI devices in life support and/or safety applications is entirely at the user’s risk, and the user agrees to defend, indemnify and hold FTDI harmless from any and all damages, claims, suits or expense resulting from such use. Future Technology Devices International Limited (FTDI) Unit 1, 2 Seaward Place, Glasgow G41 1HH, United Kingdom Tel.: +44 (0) 141 429 2777 Fax: + 44 (0) 141 429 2758 Web Site: http://ftdichip.com Copyright © Future Technology Devices International Limited Application Note AN_407 D3XX .NET Programmers Guide Version 1.0 Document Reference No.: FT_001315 Clearance No.: FTDI#513 Table of Contents 1 Introduction .............................................................. 5 2 Overview ................................................................... 6 3 D3XX .NET Class Library ............................................ 8 3.1 GetNumberOfDevicesConnected .......................................... 8 3.2 CreateDeviceInfoList ........................................................... 9 3.3 GetDeviceInfoList .............................................................. 10 3.4 OpenByIndex .................................................................... 11 3.5 OpenBySerialNumber ........................................................ 12 3.6 OpenByDescription ............................................................ 13 3.7 Close ................................................................................. 14 3.8 WritePipe .......................................................................... 15 3.9 ReadPipe ........................................................................... 16 3.10 WritePipeAsync ............................................................... 17 3.11 ReadPipeAsync ............................................................... 18 3.12 WaitAsync ....................................................................... 19 3.13 AbortPipe ........................................................................ 21 3.14 FlushPipe ........................................................................ 22 3.15 SetStreamPipe ................................................................ 23 3.16 ClearStreamPipe ............................................................. 24 3.17 SetPipeTimeout .............................................................. 25 3.18 GetPipeTimeout .............................................................. 26 3.19 GetChipConfiguration ...................................................... 27 3.20 SetChipConfiguration ...................................................... 32 3.21 ResetChipConfiguration .................................................. 34 3.22 EnableGPIO .................................................................... 35 3.23 WriteGPIO ...................................................................... 36 2 Product Page Document Feedback Copyright © Future Technology Devices International Limited Application Note AN_407 D3XX .NET Programmers Guide Version 1.0 Document Reference No.: FT_001315 Clearance No.: FTDI#513 3.24 ReadGPIO ....................................................................... 37 3.25 SetGPIOPull .................................................................... 38 3.26 SetNotificationCallback ................................................... 39 3.27 ClearNotificationCallback ................................................ 41 3.28 CycleDevicePort .............................................................. 42 3.29 IsDevicePath .................................................................. 43 3.30 SetSuspendTimeout ........................................................ 45 3.31 GetSuspendTimeout ........................................................ 46 3.32 ControlTransfer ............................................................... 47 3.33 IsOpen ............................................................................ 48 3.34 IsUSB3 ............................................................................ 49 3.35 VendorID ........................................................................ 50 3.36 ProductID ....................................................................... 51 3.37 Manufacturer .................................................................. 52 3.38 ProductDescription ......................................................... 53 3.39 SerialNumber .................................................................. 54 3.40 DriverVersion .................................................................. 55 3.41 LibraryVersion ................................................................ 56 3.42 FirmwareVersion ............................................................ 57 3.43 DeviceDescriptor ............................................................ 58 3.44 ConfigurationDescriptor .................................................. 59 3.45 InterfaceDescriptor ........................................................ 60 3.46 ReservedPipeInformation ............................................... 61 3.47 DataPipeInformation ...................................................... 62 4 Contact Information ................................................ 63 Appendix A – References ............................................. 64 Major differences with D2XX ..................................................... 64 3 Product Page Document Feedback Copyright © Future Technology Devices International Limited Application Note AN_407 D3XX .NET Programmers Guide Version 1.0 Document Reference No.: FT_001315 Clearance No.: FTDI#513 Support for multiple devices ..................................................... 65 Support for hot plugging ........................................................... 65 Support for .NET framework versions ....................................... 67 Achieving maximum performance ............................................. 67 Code References ....................................................................... 69 Document References ............................................................... 83 Acronyms and Abbreviations ..................................................... 83 Appendix B – List of Tables & Figures .......................... 84 List of Tables ............................................................................. 84 List of Figures ........................................................................... 84 Appendix C – Revision History ..................................... 87 4 Product Page Document Feedback Copyright © Future Technology Devices International Limited Application Note AN_407 D3XX .NET Programmers Guide Version 1.0 Document Reference No.: FT_001315 Clearance No.: FTDI#513 1 Introduction The D3XX .NET library is a .NET class library for the D3XX interface which is a proprietary interface specifically for FTDI SuperSpeed USB devices (FT60x series). It allows application developers to write C# applications for the FT60X chip series. C# is a simple, powerful, type-safe, and object-oriented programming language designed for building all kinds of applications, ranging from desktop to mobile to web. C# applications run on top of .NET framework which provides a rich set of high-level programming environment, interfaces and services (such as automatic memory management and hardware/OS virtualization) while providing low-level access to native memory and APIs. This document provides an explanation of the class library available to application developers to build .NET applications for FT60X chips using any modern language such as C#, F#, Managed C++ or Visual Basic programming language. D3XX .NET Application D3XX .NET Library FTD3XX_NET.DLL Microsoft .NET Framework D3XX User Library FTD3XX.DLL D3XX Kernel Driver FTDIBUS3.SYS USB Host Controller Driver Figure 1.1 D3XX .NET Driver Architecture D3XX .NET Library (FTD3XX_NET.dll) is a wrapper class library that translates managed code to the native/unmanaged D3XX User Library (FTD3XX.dll). The D3XX .NET Library source code is written in C# and is provided as open-source (similar to the D2XX .NET library) so customers can customize it for their specific requirements (i.ei.e., recompile to use .NET framework versions lower than 4.5). Any software code examples given in this document are for information only. The examples are not guaranteed (i.ei.e., error handling has been removed for conciseness). For demo applications, please refer to the website. FTDI provides a number of demo applications to help customerscustomers’ jumpstart their projects. Console-based and UI-based modern WPF demo applications are provided. 5 Product Page Document Feedback Copyright © Future Technology Devices International Limited Application Note AN_407 D3XX .NET Programmers Guide Version 1.0 Document Reference No.: FT_001315 Clearance No.: FTDI#513 2 Overview FT600 and FT601 are the first devices in a brand new USB SuperSpeed series from FTDI Chip. The devices provide a USB 3.0 SuperSpeed to FIFO Bridge, with up to 5Gbps of bandwidth. With the option of 16 bit (FT600) and 32 bit (FT601) wide parallel FIFO interfaces, the FT60x enables connectivity for numerous applications including high resolution cameras, displays, multifunction printers and much more. The FT60x series implements a proprietary Function Protocol to maximize