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

Re-evaluate in-memory ep_out bitmask #16

Open
mciantyre opened this issue Jan 3, 2022 · 1 comment
Open

Re-evaluate in-memory ep_out bitmask #16

mciantyre opened this issue Jan 3, 2022 · 1 comment

Comments

@mciantyre
Copy link
Member

/// Track which read endpoints have completed, so as to not
/// confuse the device and appear out of sync with poll() calls.
///
/// Persisting the ep_out mask across poll() calls lets us make
/// sure that results of ep_read calls match what's signaled from
/// poll() calls. During testing, we saw that poll() wouldn't signal
/// ep_out complete. But, the class could still call ep_read(), and
/// it would return data. The usb-device test_class treats that as
/// a failure, so we should keep behaviors consistent.
ep_out: u16,

I don't remember why we couldn't keep this state in ENDPTCOMPLETE[ERCE]. After a second glance, it seems like we could drop this bitmask and maintain the state in the registers. The flags persist in ERCE until ep_read returns data to the caller and schedules the next OUT transfer.

Figure out if this bitmask is still necessary. If it is necessary, add a comment to clarify why we can't keep the flags in ENDPTCOMPLETE[ERCE].

@mciantyre
Copy link
Member Author

Nevermind, I remember now. Had to read that comment a few times.

  • poll() called, no ep_out bit set.
  • Device receives OUT packet with data.
  • Something reads the endpoint, and finds data.

The mask hides the fact that the driver could receive data before poll() is called. From these notes, it sounds like the test class treats that as an error. I'm not sure why.

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

No branches or pull requests

1 participant