changeset 861:6ffebb8cec78

implemented feature mokoffs copy; made it part of the gtamodem-gsm config
author Space Falcon <falcon@ivan.Harhan.ORG>
date Sun, 03 May 2015 05:10:58 +0000
parents cbc49d533b7d
children 1b63cc243341
files gsm-fw/cfgmagic/feature.mokoffs gsm-fw/configs/gtamodem-gsm gsm-fw/services/ffs/task.c
diffstat 3 files changed, 37 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/cfgmagic/feature.mokoffs	Sun May 03 04:11:41 2015 +0000
+++ b/gsm-fw/cfgmagic/feature.mokoffs	Sun May 03 05:10:58 2015 +0000
@@ -3,8 +3,11 @@
 # which contains the factory IMEI + RF calibration data and which the
 # original mokoN firmware treats as writable.
 #
-# feature mokoffs	-- use MokoFFS, but treat it as read-only
+# There are 3 different ways in which we can use MokoFFS:
+#
 # feature mokoffs rw	-- treat MokoFFS as R/W like the original fw does
+# feature mokoffs ro	-- use MokoFFS in flash, but disable flash write ops
+# feature mokoffs copy	-- copy MokoFFS into RAM on boot, then R/W in RAM only
 
 if [ $TARGET != gtamodem ]
 then
@@ -12,14 +15,35 @@
 	exit 1
 fi
 
-FFS_IN_RAM=0
 CONFIG_MOKOFFS=1
 export_to_c	CONFIG_MOKOFFS
 
-if [ "$2" = rw ]
+if [ $# != 2 ]
 then
-	CONFIG_FLASH_WRITE=1
-else
-	CONFIG_FLASH_WRITE=0
+	echo "feature mokoffs: extra argument required" 1>&2
+	exit 1
 fi
-export_to_c	CONFIG_FLASH_WRITE
+
+case "$2" in
+	rw)
+		FFS_IN_RAM=0
+		CONFIG_FLASH_WRITE=1
+		export_to_c CONFIG_FLASH_WRITE
+		;;
+	ro)
+		FFS_IN_RAM=0
+		CONFIG_FLASH_WRITE=0
+		export_to_c CONFIG_FLASH_WRITE
+		;;
+	copy)
+		FFS_IN_RAM=1
+		RAMFFS_BLKSIZE_LOG2=16
+		RAMFFS_NBLOCKS=7
+		CONFIG_MOKOFFS_COPY=1
+		export_to_c CONFIG_MOKOFFS_COPY
+		;;
+	*)
+		echo "feature mokoffs: argument must be rw, ro or copy" 1>&2
+		exit 1
+		;;
+esac
--- a/gsm-fw/configs/gtamodem-gsm	Sun May 03 04:11:41 2015 +0000
+++ b/gsm-fw/configs/gtamodem-gsm	Sun May 03 05:10:58 2015 +0000
@@ -4,6 +4,7 @@
 target	gtamodem
 feature	gsm
 feature	at-modem
+feature	mokoffs copy
 
 feature	etm
 feature	tmffs2
--- a/gsm-fw/services/ffs/task.c	Sun May 03 04:11:41 2015 +0000
+++ b/gsm-fw/services/ffs/task.c	Sun May 03 05:10:58 2015 +0000
@@ -210,8 +210,12 @@
     tmp_int_level = TCD_Interrupt_Level;  // Backup Int level
     TCD_Interrupt_Level = 0xC0;           // The Interrups are not yet enabled..
 #if FFS_IN_RAM
+#if CONFIG_MOKOFFS_COPY
+    bcopy_32byte_chunks(0x380000, _RAMFFS_area, 0x70000);
+#else
     memset(_RAMFFS_area, 0xFF, RAMFFS_TOTAL_SIZE);
 #endif
+#endif
     ffs_init_status = ffs_initialize();
     TCD_Interrupt_Level = tmp_int_level;  // Restore Int level
 
@@ -254,7 +258,7 @@
     char *temp_path;
     req_id_t temp_id;
 
-#if FFS_IN_RAM
+#if FFS_IN_RAM && !CONFIG_MOKOFFS_COPY
     // Non formatted FFS should be formatted
     // So we don't have to use PCTM to format it
     if (fs.initerror == EFFS_NOFORMAT)