Browse Source

Firmware: use FatFS FASTSEEK option for MSU1 file access

ikari 12 years ago
parent
commit
90b91583a1
4 changed files with 16 additions and 5 deletions
  1. 3 3
      src/config
  2. 1 1
      src/config.h
  3. 1 1
      src/ffconf.h
  4. 11 0
      src/msu1.c

+ 3 - 3
src/config

@@ -1,4 +1,4 @@
-CONFIG_VERSION=0.1.0
-#FWVER=000100
-CONFIG_FWVER=256
+CONFIG_VERSION=0.1.1
+#FWVER=000101
+CONFIG_FWVER=257
 CONFIG_MCU_FOSC=12000000

+ 1 - 1
src/config.h

@@ -66,7 +66,7 @@
 #define FPGA_MCU_RDY_BIT          9
 
 #define QSORT_MAXELEM             2048
-
+#define CLTBL_SIZE		  100
 #define SSP_REGS LPC_SSP0
 #define SSP_PCLKREG PCLKSEL1
 // 1: PCLKSEL0

+ 1 - 1
src/ffconf.h

@@ -48,7 +48,7 @@
 /* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */
 
 
-#define	_USE_FASTSEEK	0	/* 0:Disable or 1:Enable */
+#define	_USE_FASTSEEK	1	/* 0:Disable or 1:Enable */
 /* To enable fast seek feature, set _USE_FASTSEEK to 1. */
 
 

+ 11 - 0
src/msu1.c

@@ -13,6 +13,9 @@
 #include "smc.h"
 
 FIL msufile;
+DWORD msu_cltbl[CLTBL_SIZE] IN_AHBRAM;
+DWORD pcm_cltbl[CLTBL_SIZE] IN_AHBRAM;
+
 extern snes_romprops_t romprops;
 
 int msu1_check_reset(void) {
@@ -40,6 +43,11 @@ int msu1_check(uint8_t* filename) {
     printf("MSU datafile not found\n");
     return 0;
   }
+  msufile.cltbl = msu_cltbl;
+  msu_cltbl[0] = CLTBL_SIZE;
+  if(f_lseek(&msufile, CREATE_LINKMAP)) {
+    printf("Error creating FF linkmap for MSU file!\n");
+  }
   romprops.fpga_features |= FEAT_MSU1;
   return 1;
 }
@@ -128,6 +136,9 @@ int msu1_loop() {
       strcpy(strrchr((char*)file_buf, (int)'.'), suffix);
       printf("filename: %s\n", file_buf);
       f_open(&file_handle, (const TCHAR*)file_buf, FA_READ);
+      file_handle.cltbl = pcm_cltbl;
+      pcm_cltbl[0] = CLTBL_SIZE;
+      f_lseek(&file_handle, CREATE_LINKMAP);
       f_lseek(&file_handle, 4L);
       f_read(&file_handle, &msu_loop_point, 4, &bytes_read);
       printf("loop point: %ld samples\n", msu_loop_point);