Quantcast
Channel: Embedded Software (Read Only)
Viewing all articles
Browse latest Browse all 25965

Forum Post: RE: Package close ordering logic

$
0
0

I am starting to understand the reasoning behind this ordering now. I recently added to one of my driver packages the ability to update the Dev.tableSize based on the number of instances. That was a case where my driver package required to make a change to Dev.

The particular situation which is giving me trouble, I have a module which wants to configure a handful of it's own config parameters based on another module's instance's config parameters. Those config parameters for those instances are updated in the users script, and no where else.


below is a code snippet from module A's package close. ModB was useModule'd in ModA's module$use.

// configure all max values
   ModA.NumPowerMonitorDevices = ModA.PowerMonitorDevices.length;
   ModA.NumHotSwapDevices = ModA.HotSwapDevices.length;

   ModA.PowerMonitorDeviceRxSyncEventH.length = ModA.NumPowerMonitorDevices;
   ModA.HotSwapDeviceRxSyncEventH.length = ModA.NumHotSwapDevices;

   ModA.NumVoltageReadingsPerPowerMonitor.length = ModA.NumPowerMonitorDevices;
   ModA.NumCurrentReadingsPerPowerMonitor.length = ModA.NumPowerMonitorDevices;

   ModA.NumTempReadings = LM95214.NumCommands + ModA.NumHotSwapDevices + ModA.NumPowerMonitorDevices;
   ModA.NumVoltageReadings = ModA.NumHotSwapDevices * 2;
   ModA.NumCurrentReadings = ModA.NumHotSwapDevices;

   for(i = 0; i < ModA.NumPowerMonitorDevices; ++i)
   {
      ModA.NumVoltageReadingsPerPowerMonitor[i] = 0;
      ModA.NumCurrentReadingsPerPowerMonitor[i] = 0;
      print(ModA.PowerMonitorDevices[i]);
      print(ModA.PowerMonitorDevices[i].match(/^\/\w*(\d+)/)[1]);
      var devInstInd = parseInt(ModA.PowerMonitorDevices[i].match(/^\/\w*(\d+)/)[1], 10);;
      print(devInstInd);
      // Aux reading
      ++ModA.NumVoltageReadings;
      ++ModA.NumVoltageReadingsPerPowerMonitor[i];
      // For all channel readings
      for(var j = 0; j < ModB.NumPages; ++j)
      {
         if(ModB.$instances[devInstInd].MonitorPageChannelDataDescriptions[j].Valid == true)
         {
            if(ModB.$instances[devInstInd].MonitorPageChannelDataDescriptions[j].CurrentTVoltageF == true)
            {
               ++ModA.NumCurrentReadings;
               ++ModA.NumCurrentReadingsPerPowerMonitor[i];
            }
            else
            {
               ++ModA.NumVoltageReadings;
               ++ModA.NumVoltageReadingsPerPowerMonitor[i];
            }
         }
      }
      print(ModA.NumVoltageReadingsPerPowerMonitor[i]);
      print(ModA.NumCurrentReadingsPerPowerMonitor[i]);
   }

my problem is that all of ModB.$instances[devInstInd].MonitorPageChannelDataDescriptions[j] (which are instance config values) are still the defaults from ModB.xdc.

Maybe this isn't even a package close problem? the users script should finish before package close.


Thanks


Viewing all articles
Browse latest Browse all 25965

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>