Merge pull request #430 from dhalbert/restore_182a946_msc

Unrevert the revert below, in preparation for PR #425 (tannewt/circuitpython, align_usb branch).
This commit is contained in:
Dan Halbert 2017-11-09 17:17:18 -05:00 committed by GitHub
commit 5e04780148
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -63,10 +63,10 @@ static fs_user_mount_t* get_vfs(int lun) {
/* Inquiry Information */ /* Inquiry Information */
// This is designed to handle the common case where we have an internal file // This is designed to handle the common case where we have an internal file
// system and an optional SD card. // system and an optional SD card.
COMPILER_ALIGNED(4) static uint8_t inquiry_info[2][36]; static uint8_t inquiry_info[2][36];
/* Capacities of Disk */ /* Capacities of Disk */
COMPILER_ALIGNED(4) static uint8_t format_capa[2][8]; static uint8_t format_capa[2][8];
/** /**
* \brief Eject Disk * \brief Eject Disk
@ -259,6 +259,9 @@ int32_t usb_msc_xfer_done(uint8_t lun) {
if (active_read) { if (active_read) {
active_addr += 1; active_addr += 1;
active_nblocks--; active_nblocks--;
if (active_nblocks == 0) {
active_read = false;
}
} }
if (active_write) { if (active_write) {
@ -272,10 +275,6 @@ int32_t usb_msc_xfer_done(uint8_t lun) {
// 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. // 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.
void usb_msc_background(void) { void usb_msc_background(void) {
if (active_read && !usb_busy) { if (active_read && !usb_busy) {
if (active_nblocks == 0) {
active_read = false;
return;
}
fs_user_mount_t * vfs = get_vfs(active_lun); fs_user_mount_t * vfs = get_vfs(active_lun);
disk_read(vfs, sector_buffer, active_addr, 1); disk_read(vfs, sector_buffer, active_addr, 1);
// TODO(tannewt): Check the read result. // TODO(tannewt): Check the read result.