Skip to content
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

Rework USB architecture #35

Open
wants to merge 8 commits into
base: adamgreloch/RTOS-937
Choose a base branch
from

Conversation

adamgreloch
Copy link
Member

@adamgreloch adamgreloch commented Nov 22, 2024

Reworks USB device drivers API to allow them to run in two variants: either as a standalone process or (statically) linked with the host driver and run as an internal thread. The API is constructed in such a way that from the perspective of device driver implementation the choice of variant is transparent

JIRA: RTOS-970

Description

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: ia32-generic-qemu (umass), imx6ull (usbacm)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

@adamgreloch adamgreloch force-pushed the adamgreloch/RTOS-970 branch 2 times, most recently from 25acf9a to 2ab1ead Compare November 22, 2024 14:47
@adamgreloch adamgreloch force-pushed the adamgreloch/RTOS-970 branch 2 times, most recently from 9047765 to f53dc3b Compare November 25, 2024 09:17
@adamgreloch adamgreloch marked this pull request as ready for review November 25, 2024 09:17
@adamgreloch adamgreloch force-pushed the adamgreloch/RTOS-970 branch 2 times, most recently from 3645782 to 6926923 Compare November 29, 2024 12:39
@adamgreloch adamgreloch force-pushed the adamgreloch/RTOS-937 branch 2 times, most recently from 257c6d9 to 1f3319f Compare December 2, 2024 12:34
@adamgreloch adamgreloch force-pushed the adamgreloch/RTOS-970 branch 3 times, most recently from 065b7eb to 5ccd210 Compare December 2, 2024 12:53
@adamgreloch adamgreloch mentioned this pull request Dec 6, 2024
14 tasks
@adamgreloch adamgreloch force-pushed the adamgreloch/RTOS-970 branch 2 times, most recently from fc0e5f9 to 351c423 Compare January 10, 2025 16:06
Every driver talking to usb host implements some sort of this handling
loop, so it's better to move it to libusb to eliminate redundancy.
This is also a first step in making the driver logic expressible via
handler functions API only

JIRA: RTOS-970
It is now possible to substitute driver-side pipe operations (e.g. the
hostdriver can now provide its own implementations that does not use msg
API and call the host functions directly)

JIRA: RTOS-970
This makes it possible to run drivers straight from the usbhost process
thereby allowing for various optimizations based on shared memory
between device driver and host driver -- ability to bypass msg-passing,
as included in this change, being a prime example.

JIRA: RTOS-970
Adds options to exclude external driver logic from the usbhost driver if
for instance no such driver is ever expected to be run.

JIRA: RTOS-970
LTO allowed for inlining of substitutable libusb driver API functions,
e.g. usb_open(drv, ...) got inlined into drv->pipeOps->open(drv, ...),
and decreased text section size by ~300 bytes on imxrt117x.

JIRA: RTOS-970
If hcd became operational before returning from hcd init, it could try to
access hcd->roothub while it was still uninitialized

JIRA: RTOS-970
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant