]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/commitdiff
Move Watchdog module configuration assignments to module$use()
authorRobert Tivy <rtivy@ti.com>
Sat, 6 Sep 2014 00:12:40 +0000 (17:12 -0700)
committerRobert Tivy <rtivy@ti.com>
Sat, 6 Sep 2014 00:12:40 +0000 (17:12 -0700)
When the ti.deh package is loaded the Watchdog module$meta$init() method
is run.  If the package is loaded by an architecture/device that is not
supported by Watchdog then module$meta$init() fails and the whole
configuration fails.  This happens even when the Watchdog module is *not*
used, such as when the ti.deh package gets loaded as a result of an
xdc.module() reference.

packages/ti/deh/Watchdog.xs

index 9f2efeff0c0f0b3a8145bd125f2076c4a4fa9c1e..df10f74d8720551130d021c8b74c28b49c80b9af 100644 (file)
@@ -112,10 +112,12 @@ if (xdc.om.$name == "cfg" || typeof(genCdoc) != "undefined") {
 }
 
 /*
- *  ======== module$meta$init ========
+ *  ======== module$use ========
  */
-function module$meta$init()
+function module$use()
 {
+    var found = false;
+
     /* Only process during "cfg" phase */
     if (xdc.om.$name != "cfg") {
         return;
@@ -140,26 +142,23 @@ function module$meta$init()
                 Watchdog.timerSettings[i].eventId = device[i].eventId;
             }
 
-            return;
+            found = true;
+
+           break;
         }
     }
 
-    /* Falls through on failure */
-    print("Watchdog Timer configuration is not found for the specified device ("
-            + Program.cpu.deviceName + ").");
+    if (!found) {
+        print("Watchdog Timer configuration is not found for the " +
+              "specified device (" + Program.cpu.deviceName + ").");
 
-    for (device in deviceTable[catalogName]) {
-        print("\t" + device);
-    }
+        for (device in deviceTable[catalogName]) {
+            print("\t" + device);
+        }
 
-    throw new Error ("Watchdog Timer unsupported on device!");
-}
+        throw new Error ("Watchdog Timer unsupported on device!");
+    }
 
-/*
- *  ======== module$use ========
- */
-function module$use()
-{
     var Settings = xdc.module("ti.sysbios.family.Settings");
     var Hwi = xdc.useModule(Settings.getDefaultHwiDelegate());