-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -705,7 +705,7 @@ int sd_readblocks_sync(uint32_t *buf, uint32_t block, uint block_count) | |
if (!rc) | ||
{ | ||
// printf("waiting for finish\n"); | ||
while (!sd_scatter_read_complete(&rc)) | ||
while (!sd_scatter_read_complete(&rc, NULL)) | ||
{ | ||
tight_loop_contents(); | ||
} | ||
|
@@ -804,7 +804,7 @@ int sd_readblocks_scatter_async(uint32_t *control_words, uint32_t block, uint bl | |
|
||
int check_crc_count; | ||
|
||
bool sd_scatter_read_complete(int *status) { | ||
bool sd_scatter_read_complete(int *status, int *blocks_complete) { | ||
// printf("%d:%d %d:%d %d:%d %d\n", dma_busy(sd_chain_dma_channel), (uint)dma_hw->ch[sd_chain_dma_channel].transfer_count, | ||
// dma_busy(sd_data_dma_channel), (uint)dma_hw->ch[sd_data_dma_channel].transfer_count, | ||
// dma_busy(sd_pio_dma_channel), (uint)dma_hw->ch[sd_pio_dma_channel].transfer_count, (uint)pio->sm[SD_DAT_SM].addr); | ||
|
@@ -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 commentThe 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 commentThe 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. |
||
*blocks_complete = ((uint32_t*)dma_channel_hw_addr(sd_chain_dma_channel)->read_addr - ctrl_words) >> 2; | ||
} | ||
if (status) *status = s; | ||
return rc; | ||
} | ||
|
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 whensd_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 🤣