Skip to content

Commit 609ebe5

Browse files
committed
Unrevert the revert below, in preparation for PR adafruit#425 (tannewt/circuitpython, align_usb branch).
Roll back to b4fc464: git revert -m 1 -n b82cfcb git revert -n 0e6928b git revert -n bfe7e05 git commit
1 parent b82cfcb commit 609ebe5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

ports/atmel-samd/usb_mass_storage.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ static fs_user_mount_t* get_vfs(int lun) {
6363
/* Inquiry Information */
6464
// This is designed to handle the common case where we have an internal file
6565
// system and an optional SD card.
66-
COMPILER_ALIGNED(4) static uint8_t inquiry_info[2][36];
66+
static uint8_t inquiry_info[2][36];
6767

6868
/* Capacities of Disk */
69-
COMPILER_ALIGNED(4) static uint8_t format_capa[2][8];
69+
static uint8_t format_capa[2][8];
7070

7171
/**
7272
* \brief Eject Disk
@@ -259,6 +259,9 @@ int32_t usb_msc_xfer_done(uint8_t lun) {
259259
if (active_read) {
260260
active_addr += 1;
261261
active_nblocks--;
262+
if (active_nblocks == 0) {
263+
active_read = false;
264+
}
262265
}
263266

264267
if (active_write) {
@@ -272,10 +275,6 @@ int32_t usb_msc_xfer_done(uint8_t lun) {
272275
// The start_read callback begins a read transaction which we accept but delay our response until the "main thread" calls usb_msc_background. Once it does, we read immediately from the drive into our cache and trigger the USB DMA to output the sector. Once the sector is transmitted, xfer_done will be called.
273276
void usb_msc_background(void) {
274277
if (active_read && !usb_busy) {
275-
if (active_nblocks == 0) {
276-
active_read = false;
277-
return;
278-
}
279278
fs_user_mount_t * vfs = get_vfs(active_lun);
280279
disk_read(vfs, sector_buffer, active_addr, 1);
281280
// TODO(tannewt): Check the read result.

0 commit comments

Comments
 (0)