Cypress CyAPI编程参考手册Beta-3

需积分: 9 6 下载量 31 浏览量 更新于2024-07-21 收藏 715KB PDF 举报
"Cypress CyAPI Programmer's Reference Beta-3 是 Cypress Semiconductor 公司发布的一份编程参考文档,主要关注于CyAPI库的使用,涵盖了USB 3.0支持、不同类型的端点处理等关键功能。该文档包含了多个部分,详细讲解了库的概述、类层次结构、新特性以及针对不同USB端点类型(如Bulk、Control、Interrupt和Isoc)的操作方法。" 在Cypress CyAPI中,开发者可以找到以下重要的知识点: 1. **库概述**:这部分可能介绍CyAPI库的基本概念、设计目的和适用范围。它帮助开发者理解如何在项目中集成和利用CyAPI进行设备驱动或固件开发。 2. **类层次结构**:这部分详细列出了库中的类结构,显示了类之间的继承关系,这有助于开发者理解各个类的功能和相互作用,以便更有效地组织和编写代码。 3. **新特性**:在Beta-3版本中,可能包含了一些新增加的功能或改进,比如对USB 3.0的支持。这部分详细阐述了这些新特性,让开发者了解如何利用这些新功能来提升程序性能或兼容性。 4. **USB 3.0支持**:CyAPI可能提供了专门的接口来支持USB 3.0高速传输,包括数据包管理和错误处理机制。这部分详细介绍了如何使用这些接口进行高速数据传输。 5. **端点操作**:文档分别介绍了Bulk、Control、Interrupt和Isoc四种类型的端点。对于每种端点,都有开始数据传输、创建和管理数据包的方法。例如: - `CCyBulkEndPoint`类用于处理Bulk端点,提供了`BeginDataXfer()`方法来启动数据传输。 - `CCyControlEndPoint`类服务于Control端点,包含了控制传输的相关方法,如`Read()`和`Write()`,用于读写控制数据。 - `CCyInterruptEndPoint`类处理Interrupt端点,提供`BeginDataXfer()`来处理中断传输。 - `CCyIsocEndPoint`类涉及Isoc(Isochronous)端点,用于同步数据传输,包括`CreatePktInfos()`来创建数据包信息。 6. **端点属性与方法**:每个端点类都有一系列属性(如`Direction`, `Index`, `Value`, `ReqCode`, `ReqType`, `Target`等),这些属性定义了端点的行为和状态。方法如`Write()`和`Read()`用于发送和接收数据,而`BeginDataXfer()`是开始端点数据传输的关键。 7. **设备属性**:`CCyUSBDevice`类包含了设备相关的属性,如`AltIntfc()`用于切换接口,`bHighSpeed`和`bSuperSpeed`标识设备是否支持高速或超速模式,`BcdDevice`则表示设备的版本号。 这些知识点为使用Cypress CyAPI进行USB设备编程的开发者提供了详尽的指导,确保他们能够有效地与Cypress半导体的硬件交互。通过这个参考文档,开发者可以深入理解CyAPI的工作原理,并利用其特性来实现高效、可靠的USB通信。
2012-04-26 上传
CyAPI.lib provides a simple, powerful C++ programming interface to USB devices. More specifically, it is a C++ class library that provides a high-level programming interface to the CyUsb.sys device driver. The library is only able to communicate with USB devices that are served by (i.e. matched to) this driver. Rather than communicate with the driver via Windows API calls such as SetupDiXxxx and DeviceIoControl, applications call simpler CyAPI methods such as Open, Close, and XferData to communicate with USB devices. To use the library, you need to include the header file, CyAPI.h, in files that access the CCyUSBDevice class. In addition, the statically linked CyAPI.lib file must be linked to your project. Versions of the .lib file are available for use with Microsoft Visual C++ 6 and 7, and Borland C++ Builder 6.0. The library employs a Device and EndPoints use model. To use the library you must create an instance of the CCyUSBDevice class using the new keyword. A CCyUSBDevice object knows how many USB devices are attached to the CyUsb.sys driver and can be made to abstract any one of those devices at a time by using the Open method. An instance of CCyUSBDevice exposes several methods and data members that are device-specific, such as DeviceName, DevClass, VendorID, ProductID, and SetAltIntfc. When a CCyUSBDevice object is open to an attached USB device, its endpoint members provide an interface for peforming data transfers to and from the device's endpoints. Endpoint-specific data members and methods such as MaxPktSize, TimeOut, bIn, Reset and XferData are only accessible through endpoint members of a CCyUSBDevice object. In addition to its simplicity, the class library facilitates creation of sophisticated applications as well. The CCyUSBDevice constructor automatically registers the application for Windows USB Plug and Play event notification. This allows your application to support "hot plugging" of devices. Also, the asynchronous BeginDataXfer/WaitForXfer/FinishDataXfer methods allow queueing of multiple data transfer requests on a single endpoint, thus enabling data streaming from the application level.