diff options
| author | Dan Halbert <halbert@halwitz.org> | 2018-03-13 15:16:40 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-03-13 15:16:40 -0400 |
| commit | b64d56826743a58c1aede6cdbbbc86209f177dec (patch) | |
| tree | 8ba7a3a1d71b010d598e878b7bed4cc253963132 | |
| parent | 15dd2fc0ab1a1a151c07b87598ebdd61d1e7dac6 (diff) | |
| parent | 81572481894bb371a65313ee75b8a9d3fcbbafcd (diff) | |
Merge pull request #677 from tannewt/usb_active_read
Move usb read finish into interrupt.
| -rw-r--r-- | ports/atmel-samd/usb_mass_storage.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ports/atmel-samd/usb_mass_storage.c b/ports/atmel-samd/usb_mass_storage.c index 818736a78..b337839d5 100644 --- a/ports/atmel-samd/usb_mass_storage.c +++ b/ports/atmel-samd/usb_mass_storage.c @@ -260,6 +260,9 @@ int32_t usb_msc_xfer_done(uint8_t lun) { if (active_read) { active_addr += 1; active_nblocks--; + if (active_nblocks == 0) { + active_read = false; + } } if (active_write) { @@ -278,10 +281,6 @@ int32_t usb_msc_xfer_done(uint8_t lun) { // sector. Once the sector is transmitted, xfer_done will be called. void usb_msc_background(void) { if (active_read && !usb_busy) { - if (active_nblocks == 0) { - active_read = false; - return; - } fs_user_mount_t * vfs = get_vfs(active_lun); disk_read(vfs, sector_buffer, active_addr, 1); CRITICAL_SECTION_ENTER(); |
