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

Add commit_and_grant convenience methods #56

Open
jamesmunns opened this issue Apr 12, 2020 · 1 comment
Open

Add commit_and_grant convenience methods #56

jamesmunns opened this issue Apr 12, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@jamesmunns
Copy link
Owner

Often you want to commit a grant (read or write), then immediately get the next grant, if possible. We should add an interface that lets you do that in one operation.

This would be particularly useful for "self reloading" DMA operations, where the "end of DMA interrupt" could immediately retrigger the next DMA transaction to start.

@jamesmunns
Copy link
Owner Author

jamesmunns commented Apr 12, 2020

Note: This might be a little awkward, because the commit methods are on the GRANT, not the Producer/Consumer.

We could still add methods that take ownership of the grant in the Producer/Consumer, and potentially return the next one.

something like (on the consumer):

let (_producer, mut consumer) = BBQUEUE.try_split().unwrap();

// first grant
let mut grantr = consumer.read().unwrap();
foo(&grantr);

while let Some(grantr) = consumer.commit_and_read(grantr) {
    // read some data...
    foo(&grantr);
}

@jamesmunns jamesmunns added the enhancement New feature or request label Apr 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant