changeset 942:042c178ebac5

gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 01 Nov 2015 03:05:06 +0000
parents 6b0b2f6dbb20
children f22b34873ea5
files gsm-fw/cfgmagic/feature.at-modem gsm-fw/cfgmagic/feature.mokoffs gsm-fw/cfgmagic/feature.pirhack-ffs gsm-fw/cfgmagic/functions gsm-fw/cfgmagic/processconf.sh gsm-fw/cfgmagic/target.gtamodem gsm-fw/cfgmagic/target.pirelli
diffstat 7 files changed, 38 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/cfgmagic/feature.at-modem	Sun Nov 01 00:07:09 2015 +0000
+++ b/gsm-fw/cfgmagic/feature.at-modem	Sun Nov 01 03:05:06 2015 +0000
@@ -1,11 +1,4 @@
-case $TARGET in
-	gtamodem)
-		;;
-	*)
-		echo "Error: feature at-modem not supported on this target" 1>&2
-		exit 1
-		;;
-esac
+check_target_feature "$1"
 
 CONFIG_FDMODEM=1
 export_to_c	CONFIG_FDMODEM
--- a/gsm-fw/cfgmagic/feature.mokoffs	Sun Nov 01 00:07:09 2015 +0000
+++ b/gsm-fw/cfgmagic/feature.mokoffs	Sun Nov 01 03:05:06 2015 +0000
@@ -9,11 +9,7 @@
 # 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
-	echo "Error: feature mokoffs is applicable only to target gtamodem" 1>&2
-	exit 1
-fi
+check_target_feature "$1"
 
 CONFIG_MOKOFFS=1
 export_to_c	CONFIG_MOKOFFS
--- a/gsm-fw/cfgmagic/feature.pirhack-ffs	Sun Nov 01 00:07:09 2015 +0000
+++ b/gsm-fw/cfgmagic/feature.pirhack-ffs	Sun Nov 01 03:05:06 2015 +0000
@@ -29,12 +29,7 @@
 # as the original, but attempting to reuse the original FFS without reformatting
 # is NOT recommended or supported.
 
-if [ $TARGET != pirelli ]
-then
-	echo \
-	"Error: feature pirhack-ffs is applicable only to target pirelli" 1>&2
-	exit 1
-fi
+check_target_feature "$1"
 
 if [ $# != 3 ]
 then
--- a/gsm-fw/cfgmagic/functions	Sun Nov 01 00:07:09 2015 +0000
+++ b/gsm-fw/cfgmagic/functions	Sun Nov 01 03:05:06 2015 +0000
@@ -40,6 +40,35 @@
 	. "cfgmagic/feature.$1"
 }
 
+allow_target_feature() {
+	while [ $# != 0 ]
+	do
+		case "$target_feature_list" in
+			*" $1 "* | *" $1")
+				;;
+			*)
+				target_feature_list="$target_feature_list $1"
+				;;
+		esac
+		shift
+	done
+}
+
+check_target_feature() {
+    while [ $# != 0 ]
+    do
+	case "$target_feature_list" in
+	    *" $1 "* | *" $1" | *" OVERRIDE "* | *" OVERRIDE")
+		;;
+	    *)
+		echo "Error: feature $1 not supported on target $TARGET" 1>&2
+		exit 1
+		;;
+	esac
+	shift
+    done
+}
+
 export_to_c() {
 	while [ $# != 0 ]
 	do
--- a/gsm-fw/cfgmagic/processconf.sh	Sun Nov 01 00:07:09 2015 +0000
+++ b/gsm-fw/cfgmagic/processconf.sh	Sun Nov 01 03:05:06 2015 +0000
@@ -14,6 +14,7 @@
 c_export_list=
 mk_export_list=
 m4_export_list=
+target_feature_list=
 
 # some defaults
 FFS_IN_RAM=1
--- a/gsm-fw/cfgmagic/target.gtamodem	Sun Nov 01 00:07:09 2015 +0000
+++ b/gsm-fw/cfgmagic/target.gtamodem	Sun Nov 01 03:05:06 2015 +0000
@@ -21,3 +21,6 @@
 # For the RF PA we have to set TI's voodoo number directly. :-(
 RF_PA=2
 # We know this setting is correct for the RF3166 PA thanks to the Sotovik find.
+
+allow_target_feature	at-modem
+allow_target_feature	mokoffs
--- a/gsm-fw/cfgmagic/target.pirelli	Sun Nov 01 00:07:09 2015 +0000
+++ b/gsm-fw/cfgmagic/target.pirelli	Sun Nov 01 03:05:06 2015 +0000
@@ -27,3 +27,5 @@
 # even have a number for these Skyworks parts. :-(
 # The best we can do for now is lie and pretend to be Leonardo/Openmoko.
 RF_PA=2
+
+allow_target_feature	pirhack-ffs