[riot-notifications] [RIOT-OS/RIOT] USBUS: Initial work towards an USB stack (#10916)

Koen Zandberg notifications at github.com
Thu Mar 28 23:02:18 CET 2019


bergzand commented on this pull request.



> +                                                 @ref usbus_t) */
+    const usbus_handler_driver_t *driver;   /**< driver for this handler */
+    usbus_interface_t *iface;               /**< Interface this handler belongs
+                                                 to */
+    uint32_t flags;                         /**< Report flags */
+};
+
+/**
+ * @brief USBUS context struct
+ */
+struct usbus {
+    usbus_string_t manuf;                           /**< Manufacturer string                   */
+    usbus_string_t product;                         /**< Product string                        */
+    usbus_string_t config;                          /**< Configuration string                  */
+    usbus_endpoint_t ep_out[USBDEV_NUM_ENDPOINTS];  /**< USBUS OUT endpoints                   */
+    usbus_endpoint_t ep_in[USBDEV_NUM_ENDPOINTS];   /**< USBUS IN endpoints                    */

The motivation for this change lies within the change to thread flags. As a thread flag doesn't carry any content, a different way to grab the endpoint that requires servicing was necessary. The solution is a `uint32_t` acting as a holder for bitflags, one for each endpoint (USB has max 16 IN and 16 OUT endpoints as protocol limitation). From this bitmap, the endpoint direction and number that requires servicing is retrieved. The usbus endpoint context and from there the usbdev endpoint context is then retrieved from this array.

A different solution more in line with the previous decentral endpoint context storage would be to iterate all interfaces and for each interface check if it contains the endpoint that we're looking for. As this requires a lot of iterating, I decided that centralizing this storage and potentially allocated too many endpoint structs is the more favorable solution here.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10916#discussion_r270216128
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190328/5a419e30/attachment-0001.html>


More information about the notifications mailing list