-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow parallel instantiation of FS and HS OTG #12
Comments
I think that one of the ways to support both FS and HS is to define a superset of registers and use it. Maybe HS register set is already a superset of the FS register set, I don't know. |
I have to admit that I did not look at it in any detail, I just wanted to qucikly check whether it works at all. If the register sets are mostly compatible, then runtime checks of which operations to use (i.e., a HS/FS flag somewhere in one of the structs) would probably be the cleanest solution (code-wise).
Of course - in my example, the macros immediately broke rustfmt. Maybe a small encapsulation of the operations differing between different peripheral types/versions might be viable, so that that wrapper could be passed to the other types as a generic parameter. That might generate slightly better executable code for situations in which only either FS or HS would be used (and would cause lots of duplicated code for situations in which both would be used). |
I’m interested in doing the opposite; appear as host to two different USB devices. Has any thinking evolved around this? In embassy-rs/embassy#602 they appear to be using the HS driver with FS peripheral. |
I currently have a use case where I would want the MCU to present itself as two devices to two different USB hosts. Currently, this driver does not allow this scenario. However, it should not be too difficult to implement, probably without any negative sideeffects.
I quickly modified the code using some ugly macros to find out whether such parallel operation is actually supported, and managed to make my discovery board to appear like two individual serial ports:
https://github.com/mgottschlag/synopsys-usb-otg/tree/parallel-fs-hs
It is obvious, though, that this approach is not viable, as such macros introduce major headaches.
The text was updated successfully, but these errors were encountered: