8000 atmel-samd: Turn off nvmctl cache and rework active_read. · boneskull/circuitpython@ef9a7f2 · GitHub
[go: up one dir, main page]

10000
Skip to content

Commit ef9a7f2

Browse files
committed
atmel-samd: Turn off nvmctl cache and rework active_read.
1 parent 971bd7e commit ef9a7f2

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

ports/atmel-samd/asf4_conf/samd51/hpl_nvmctrl_config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
// <i> Indicate whether AHB0 cache is disable or not
2020
// <id> nvm_arch_cache0
2121
#ifndef CONF_NVM_CACHE0
22-
#define CONF_NVM_CACHE0 0
22+
#define CONF_NVM_CACHE0 1
2323
#endif
2424

2525
// <q> AHB1 Cache Disable
2626
// <i> Indicate whether AHB1 cache is disable or not
2727
// <id> nvm_arch_cache1
2828
#ifndef CONF_NVM_CACHE1
29-
#define CONF_NVM_CACHE1 0
29+
#define CONF_NVM_CACHE1 1
3030
#endif
3131

3232
// </h>

ports/atmel-samd/usb_mass_storage.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,6 @@ int32_t usb_msc_xfer_done(uint8_t lun) {
260260
if (active_read) {
261261
active_addr += 1;
262262
active_nblocks--;
263-
if (active_nblocks == 0) {
264-
active_read = false;
265-
}
266263
}
267264

268265
if (active_write) {
@@ -277,6 +274,10 @@ int32_t usb_msc_xfer_done(uint8_t lun) {
277274
// 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.
278275
void usb_msc_background(void) {
279276
if (active_read && !usb_busy) {
277+
if (active_nblocks == 0) {
278+
active_read = false;
279+
return;
280+
}
280281
fs_user_mount_t * vfs = get_vfs(active_lun);
281282
disk_read(vfs, sector_buffer, active_addr, 1);
282283
CRITICAL_SECTION_ENTER();

0 commit comments

Comments
 (0)
0