This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
您好!
我正在尝试弄清楚如何使用 USB driverlib"器件 API 层"、特别是如何传递配置/接口/端点描述符。 器件信息结构似乎不包含这些内容、但确实包含 uint8指针的器件描述符。 那么、作为使用此驱动程序层的第一步-配置、接口和端点描述符的预期处理是什么?
为了节省任何有关 tDeviceInfo 的时间、此处提供的源代码未提及对器件描述非常重要的上述三个缺失描述符。
//***************************************************************************** // //! This structure is passed to the USB library on a call to USBDCDInit and //! provides the library with information about the device that the //! application is implementing. It contains functions pointers for the //! various USB event handlers and pointers to each of the standard device //! descriptors. // //***************************************************************************** struct tDeviceInfo { // //! A pointer to a structure containing pointers to event handler functions //! provided by the client to support the operation of this device. // const tCustomHandlers * psCallbacks; // //! A pointer to the device descriptor for this device. // const uint8_t *pui8DeviceDescriptor; // //! A pointer to an array of configuration descriptor pointers. Each entry //! in the array corresponds to one configuration that the device may be //! set to use by the USB host. The number of entries in the array must //! match the bNumConfigurations value in the device descriptor //! array, \e pui8DeviceDescriptor. // const tConfigHeader * const *ppsConfigDescriptors; // //! A pointer to the string descriptor array for this device. This array //! must be arranged as follows: //! //! [0] - Standard descriptor containing supported language codes. //! //! [1] - String 1 for the first language listed in descriptor 0. //! //! [2] - String 2 for the first language listed in descriptor 0. //! //! ... //! //! [n] - String n for the first language listed in descriptor 0. //! //! [n+1] - String 1 for the second language listed in descriptor 0. //! //! ... //! //! [2n] - String n for the second language listed in descriptor 0. //! //! [2n+1]- String 1 for the third language listed in descriptor 0. //! //! ... //! //! [3n] - String n for the third language listed in descriptor 0. //! //! and so on. // const uint8_t * const *ppui8StringDescriptors; // //! The total number of descriptors provided in the ppStringDescriptors //! array. // uint32_t ui32NumStringDescriptors; };
您好、Robert、
我将把您的帖子转发给我们的 USB 专家。
谢谢 Charles。 这有点低级、但我越详细地介绍标准 USB 规范和 TI 文档、我就需要确保 MCU 能够在投资 TI 芯片之前向每个事务实际提供足够大的数据包、而这种缓冲问题是一个大问题。
感谢您的支持!
您好、Robert、
遗憾的是、USB 低级代码有点混乱、因此很难在所有方面进行跟踪。 要在这里后退一步、您希望使用哪种接口? 批量端点可以是 USB 批量接口和批量端点。
从事务的角度来看、大容量数据包的主要问题是什么? 吞吐量能力、还是更基本的功能? USB 堆栈应满足所有 USB 2.0全速处理要求。
此致、
Ralph Jacobi
您好、Ralph、
因此、我尝试使用 USB 2.0全速大容量接口、如果我正确、该接口将使用大容量端点。 我不使用大容量存储、而 是使用原始大容量传输、因为我希望软件获取接口并开始通过大容量传输在器件中进出。
为此、我将使用第一个帖子中所述的 API。 我可能已经在数小时的时间里盯着代码看了一下这个问题、但我的问题只是以下几个方面。
对于"器件 API 层"方法、其中加载了配置/接口/端点描述符。 我*可能*已经解决了这个问题。 您最终会在 init 调用中加载这些描述符、因此您似乎希望使用此层。 我很困惑、因为它们不是传递给 init 调用的 tDeviceInfo 结构的显式部分。 我所指的初始化调用如下所示:
USBDBulkCompositeInit()
长故事简短描述 tDeviceInfo 中缺少关键描述符,我本来应该会在那里,但看起来它们是单独构建的,并单独加载到 USBDBulkCompositeInit()调用中。
您好、Robert、
感谢您在此处解释更高级别的需求。
我们在 TivaWare 中有一个 USB_DEV_BULK、其中重点介绍了如何配置批量器件接口及其与我们提供的批量示例进行配对: https://dr-download.ti.com/secure/software-development/software-development-kit-sdk/MD-oCcDwnGrsI/2.2.0.295/SW-USB-win-2.2.0.295.msi
因此、这将为您的开发提供坚实的初始基础。
现在、下面介绍下一层信息:
USBDBulkInit/USBDBulkCompositeInit 调用是如何初始化接口的、这一点是正确的。 这就是 USB 堆栈的设计方式。 并传递到该 init 调用的结构必须具有初始化接口所需的所有数据。
[引用 userid="482605" URL"~/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1179098/tm4c123ge6pm-usb-driverlib---device-api-layer---tdeviceinfo/4441476 #4441476"]长故事中缺少关键描述符,我本来希望这些描述符会出现在那里,但看起来它们是单独构建的,并单独加载到 USBDBulkCompositeInit()调用中。正确、描述符在应用层定义并传递到 USB 库中、使其易于调整、但更重要的是、任何调整都是在应用级而不是在库级进行的。
对于 USB_dev_bulk 示例、您将在 USB_bulk_structs.c 文件中找到所有描述符。 您希望对这些描述符进行的任何修改 都应在该文件中完成、然后您可以将定义的结构传递到 Init 调用中。
此致、
Ralph Jacobi