-
Notifications
You must be signed in to change notification settings - Fork 121
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
Return the number of blocks completely read when querying read completion #12
base: master
Are you sure you want to change the base?
Conversation
nice, yes i had planned such a feature! will take a look |
@@ -828,6 +828,10 @@ bool sd_scatter_read_complete(int *status) { | |||
} | |||
check_crc_count = 0; | |||
} | |||
else if (blocks_complete) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there should be a code-comment that blocks_complete
will only be set when sd_scatter_read_complete
returns false? 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, I would've added a comment to the API if the API had any comments at all 🤣
@@ -828,6 +828,10 @@ bool sd_scatter_read_complete(int *status) { | |||
} | |||
check_crc_count = 0; | |||
} | |||
else if (blocks_complete) | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
brace-error 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do normally try to fit in with surrounding code's style, but I'm very much used to braces being on their own line! Will try to remember.
I've just realised that It should record the control words pointer passed into scatter_async and compare with that. I'll fix that and update the PR, hopefully today. |
yeah, the API is obviously not currenlty ideal :-) |
I'm going to switch to use the scatter read function directly in my video code. So, really I just want a call to get the number of control words that have been consumed. But that's not a particularly user friendly interface if you are using the normal methods. Options:
|
Especially when doing a longer async transfer, it can be useful to start reading it before it has finished.
This change allows the user to read the number of blocks already read by checking how far the chain DMA has got.
It's a breaking change, but I don't think there are many users yet, and you can just use NULL if you don't care.