summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/common/dircache.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c
index 7599c1b6c5..6167aa3933 100644
--- a/firmware/common/dircache.c
+++ b/firmware/common/dircache.c
@@ -623,14 +623,10 @@ int dircache_build(int last_size)
623 return 2; 623 return 2;
624 } 624 }
625 625
626 dircache_root = (struct dircache_entry *)(((long)audiobuf & ~0x03) + 0x04);
627
628 if (last_size > DIRCACHE_RESERVE && last_size < DIRCACHE_LIMIT ) 626 if (last_size > DIRCACHE_RESERVE && last_size < DIRCACHE_LIMIT )
629 { 627 {
630 allocated_size = last_size + DIRCACHE_RESERVE; 628 allocated_size = last_size + DIRCACHE_RESERVE;
631 629 dircache_root = (struct dircache_entry *)buffer_alloc(allocated_size);
632 /* We have to long align the audiobuf to keep the buffer access fast. */
633 audiobuf += (long)((allocated_size & ~0x03) + 0x04);
634 thread_enabled = true; 630 thread_enabled = true;
635 631
636 /* Start a transparent rebuild. */ 632 /* Start a transparent rebuild. */
@@ -638,6 +634,8 @@ int dircache_build(int last_size)
638 return 3; 634 return 3;
639 } 635 }
640 636
637 dircache_root = (struct dircache_entry *)(((long)audiobuf & ~0x03) + 0x04);
638
641 /* Start a non-transparent rebuild. */ 639 /* Start a non-transparent rebuild. */
642 return dircache_do_rebuild(); 640 return dircache_do_rebuild();
643} 641}
@@ -672,8 +670,7 @@ void dircache_init(void)
672 memset(opendirs, 0, sizeof(opendirs)); 670 memset(opendirs, 0, sizeof(opendirs));
673 for (i = 0; i < MAX_OPEN_DIRS; i++) 671 for (i = 0; i < MAX_OPEN_DIRS; i++)
674 { 672 {
675 opendirs[i].secondary_entry.d_name = audiobuf; 673 opendirs[i].secondary_entry.d_name = buffer_alloc(MAX_PATH);
676 audiobuf += MAX_PATH;
677 } 674 }
678 675
679 queue_init(&dircache_queue); 676 queue_init(&dircache_queue);