]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/pdk.git/blobdiff - packages/ti/drv/i2c/package.xs
i2c-lld: add to PDK
[processor-sdk/pdk.git] / packages / ti / drv / i2c / package.xs
diff --git a/packages/ti/drv/i2c/package.xs b/packages/ti/drv/i2c/package.xs
new file mode 100755 (executable)
index 0000000..67722ca
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+
+/*
+ *  ======== Package.getLibs ========
+ *  This function is called when a program's configuration files are
+ *  being generated and it returns the name of a library appropriate
+ *  for the program's configuration.
+ */
+
+function getLibs(prog)
+{
+    var suffix = prog.build.target.suffix;
+    var name = "";
+    var socType = this.Settings.socType;
+    var profilingTag = "";
+    var fwIcss0Tag = "";
+
+    socType = socType.toLowerCase();
+    /* Replace the last charecter in SoC am#### to am###x */
+    if (socType.substring(0, 2) == "am")
+    {
+        socType = socType.substring(0, socType.length - 1);
+        socType = socType.concat("x");
+    }
+
+    if (this.Settings.enableProfiling == true)
+    {
+        profilingTag = ".profiling"
+    }
+    name = this.$name + profilingTag + ".a" + suffix;
+
+    if (this.Settings.fwIcss0 == true)
+    {
+        fwIcss0Tag = "_icss0"
+    }
+    name = this.$name + fwIcss0Tag + profilingTag + ".a" + suffix;
+
+    /* Read LIBDIR variable */
+    var lib = java.lang.System.getenv("LIBDIR");
+
+    /* If NULL, default to "lib" folder */
+    if (lib == null)
+    {
+        lib = "./lib";
+    } else {
+        print ("\tSystem environment LIBDIR variable defined : " + lib);
+    }
+
+    var socTypes = [
+                     'am571x',
+                     'dra72x',
+                     'dra75x',
+                     'dra78x',
+                     'am572x',
+                     'am574x',
+                     'am335x',
+                     'am437x',
+                     'k2h',
+                     'k2k',
+                     'k2e',
+                     'k2l',
+                     'k2g',
+                     'omapl137',
+                     'omapl138',
+                     'c6678',
+                     'c6657',
+                     'c6747',
+                     'am65xx',
+                     'j721e'
+                   ];
+
+    /* Get the SOC */
+    for each (var soc in socTypes)
+    {
+        if (socType.equals(soc))
+        {
+            lib = lib + "/" + soc;
+            name = this.$name + fwIcss0Tag + profilingTag + ".a" + suffix;
+            break;
+        }
+    }
+
+    /* Get target folder, if applicable */
+    if ( java.lang.String(suffix).contains('66') )
+        lib = lib + "/c66";
+    else if (java.lang.String(suffix).contains('a15') )
+        lib = lib + "/a15";
+    else if (java.lang.String(suffix).contains('674') )
+        lib = lib + "/c674";
+    else if (java.lang.String(suffix).contains('m4') )
+        lib = lib + "/m4";
+    else if (java.lang.String(suffix).contains('a9') )
+        lib = lib + "/a9";
+       else if (java.lang.String(suffix).contains('e9') )
+        lib = lib + "/arm9";
+    else if (java.lang.String(suffix).contains('a8') )
+        lib = lib + "/a8";
+    else if (java.lang.String(suffix).contains('a53'))
+           lib = lib + "/a53";
+       else if (java.lang.String(suffix).contains('r5f'))
+           lib = lib + "/r5f";
+    else
+        throw new Error("\tUnknown target for: " + this.packageBase + lib);
+
+    var libProfiles = ["debug", "release"];
+    /* get the configured library profile */
+    for each(var profile in libProfiles)
+    {
+        if (this.Settings.libProfile.equals(profile))
+        {
+            lib = lib + "/" + profile;
+            break;
+        }
+    }
+
+    /* Get library name with path */
+    lib = lib + "/" + name;
+    if (java.io.File(this.packageBase + lib).exists()) {
+       print ("\tLinking with library " + this.$name + ":" + lib);
+       return lib;
+    }
+
+    /* Could not find any library, throw exception */
+    throw new Error("\tLibrary not found: " + this.packageBase + lib);
+}
+
+function init() {
+    xdc.loadPackage("ti.osal");
+    xdc.loadPackage("ti.csl");
+}
+
+/*
+ *  ======== package.close ========
+ */
+function close()
+{
+    if (xdc.om.$name != 'cfg') {
+        return;
+    }
+
+    var socType = this.Settings.socType;
+    socType = socType.toLowerCase();
+    /* Replace the last character in SoC am#### to am###x */
+    if (socType.substring(0, 2) == "am")
+    {
+        socType = socType.substring(0, socType.length - 1);
+        socType = socType.concat("x");
+    }
+    print ("\t SoC Type is " + socType );
+    
+    /* Append list for SoC which depend on PRUSS. */
+    /* This is for PRU UART firmware. */
+    /* Add entry in this array for newly supported SoCs. */
+    var prussDepSocTypes = [
+                        'k2g',
+                        'am335x', 
+                        'am437x',
+                        'am572x',
+                        'am571x',
+                        'am574x'
+                      ];
+    
+    if (this.Settings.enableSwIp == true)
+    {
+        for each(var soc in prussDepSocTypes)
+        {
+            if (socType.equals(soc))
+            {
+                var Pruss = xdc.loadPackage("ti.drv.pruss");
+                Pruss.Settings.socType  = socType;
+                break;
+            }
+        }
+    }
+}