Showing posts with label EIM. Show all posts
Showing posts with label EIM. Show all posts

Wednesday, July 4, 2018

How to Create Periodic and One-shot Timer in EIM

**Note that this also works on EIM @ solaris**


Assuming you want to create a periodic timer that starts with program or EIM loading, add the these codes to the following EIM entry points:

void myEIM::ExtIntfInit( ProgramControl *program, const int head )
{
// ------------------------------------------------------------------
// create periodic timer that fires every x amount of seconds
// ------------------------------------------------------------------
StopTimer(0xFF); // stop this timer first in case there's already one running with this id
unsigned int nSec = 60;
if (!CreateTimer(0xFF, 1, nSec, 0, true))
{
program->writeln(STDOUT, "ERROR! Failed to create periodic timer of %d seconds!\n", nSec);
}
else
{
time_t tTime;
  struct tm * localTime;
time ( &tTime );
  localTime = localtime ( &tTime );
program->writeln(STDOUT, "SUCCESS! Created periodic timer of %d seconds Starting at %s", nSec, asctime (localTime));
}
}

- myEIM is the external interface' name
- timer id for this code is 0xFF; you can set any unique integer you want
- the above code creates a periodic timer that immediately starts its countdown when CreateTimer() call is successful
- the timer is set to periodically trigger every 60 seconds

Monday, August 15, 2016

Understanding Loaded and Selected Sites in EVXA /EIM

ProgramControl.getNumberLoadedSites()
- returns the number of defined sites in Adapter Object of the test program + 1


ProgramControl.getNumberSelectedSites()
- returns the number of sites (selected or not selected in bin tool) from site 1 up to maximum site that is active (selected in bin tool) + 1
- say 4-site is [1101] where site 3 is inactive. return value is 5
- say 4-site is [1010] where sites 2 and 4 are inactive, return value is 4
- say 4-site is [0110] where sites 1 and 4 are inactive, return value is 4
- say 4-site is [0001] where sites 1, 2, and 3 are inactive, return value is 5


ProgramControl.getLoadedSites()
- returns a a pointer to an array of sites that are defined in Adapter Object of the test program
- site 1 is referenced to array [1] and array[0] does not really define a site
- the size of the array it points to is the return value of getNumberLoadedSites()


ProgramControl.getSelectedSites()
- returns a a pointer to an array of sites from site 1 to last site that is active (selected in bin tool)
- if no site is selected in bin tool, returns 0 ***
- site 1 is referenced to array [1] and array[0] does not really define a site
- the size of the array it points to is the return value of getNumberSelectedSites()











Tuesday, July 26, 2016

Clone an Existing EIM using MethodTool

  1. Load the EIM to be cloned
    • Set MethodTool>Edit>Test Methods>External Interface
    • Click "External Interface" button and "Find enVision Object" dialog box will appear and shows a list of ExternalInterface to choose. 
    • Select The ExternalInterface to clone and press OK.
    • The text box beside "ExternalInterface" button now displays the name of the EIM you selected
    • The "Method Directory" now displays the path of the source code for the loaded EIM
    • All the member functions and variables defined or added into this EIM are also displayed 
  2. Clone the loaded EIM 
    • Set MethodTool>File>Clone...
    • in "Select Clone Directory" popup
      • set name of cloned EIM in text box beside "ExternalInterface"
      • set directory where the cloned EIM will be stored in text box beside "Method Directory:"
        • make sure to specify the folder where the source code and binaries will be stored
      • Click OK 
        • If a new folder is specified, it will be created 
        • mid, tmk, cxx, and hxx files will be created and are copies of the EIM that is cloned
        • the newly created cloned EIM is automatically compiled and DNT/FX1 folder with evso is created after successful build 
  3. Update sources
    • You can now make changes to the source code of the clone EIM

    Thursday, July 21, 2016

    How to Update enVision Demo License in Solaris (Unix Box for EIM Compiling)

    1. Follow instruction from AppsWiki on how to create demo license "license.dat" file for enVision/Unison
      • root access is password:ltxroot
    2. If ".cshrc" file does not exist in maint account home directory, create it
      • make sure to login as  user: maint, password: maint
      • run /ltx/apps_support/com/cde_account_config
        • the above command will generate ".cshrc" file in maint's home directory
    3. log out and log back in again with "maint" account. 
    4. launch enVision

    Tuesday, July 19, 2016

    Create New EIM from Scratch Using MethodTool

    1. Create a new program or load an existing program. 
      • MethodTool can only be invoked when a program is loaded in enVision.
    2. Launch MethodTool from OpTool>Tools>Development>Method
    3. In MethodTool's menu, set MethodTool>Edit>Tool Mode>External Interface
    4. Set the working directory for EIM. 
      • Click the "Method Directory:" button in MethodTool
      • In the file selection dialog box, select the directory where the EIM files are to be stored
      • Optional: If a directory name is specified in "Enter Directory:" field in the file selection dialog box, this new directory will be created (if it does not exist yet) and the EIM files will be stored in it
    5. Specify EIM name using the "ExternalInterface:" button in MethodTool
      • clicking this button will invoke popup listing existing EIM already created previously. If you already created one before and wish to modify it, select it from the list
      • To create a new EIM, type the EIM name in the textbox beside "ExternalInterface:" button and press <return>
      • Once EIM is specified, you will notice that the "Linked Filename:" will now be filled with <path>/<external interface name>.evso and buttons in MethodTool for creating/modifying/building EIM source codes will be enabled
      • The .evso file will be the output binary file of a successful EIM source code compile
    6. Specify the entry point functions to be included in your EIM class
      • Entry point functions are methods that will be included in your EIM class. these methods are event handlers that you can modify to perform action when an event occur in enVision e.g. StartTest(), a function that is executed by EIM when testing starts in enVision. You can modify StartTest() function to perform actions you need when a start of test occurs
      • In MethodTool, click Edit>Entry Points... and "Select Entry Points" popup will appear. Select which entry point function you wish to add in your EIM class and press OK
    7. Create source codes 
      • In MethodTool, click "Create Sources" button and the following files will be created in the working directory:
        • <eim name>.mid
        • <eim name>.cxx
        • <eim_name>.hxx
      • Check the .cxx files if the entry point functions you selected are defined in the code
    8. Create Makefile
      • In MethodTool, click Options>Create Method Makefile... and "Create Method Makefile popup will appear
        • The evso Name will be the name of the binary file to be created when compiling is successful
        • The Path is where the source codes to be compiled are located
      • Right click on each lines listing the required source code files and choose "Dynamic Linked"
      • Press "Create Makefile" button
      • In the working directory, you will now see new files:
        • Makefile
        • <eim name>.tmk
    9. Define member parameters for your custom EIM class
      • MethodTool will only include 2 member methods init_local_member_data() and free_local_member_data() only if at least one custom parameter is declared
      • choose one of the rows (preferably the top most available) and write the name of the variable in "Name" column.
      • to specify the type of variable (e.g. TestheadConnection*)...
        • right-click on the member variable's "Data Type" field and popup will appear. choose "Local Data...".
        • In the dialog box that appear, enter the type name in the text box below "Standard Data Type" and press OK
      • Adding new member parameters or changing/updating existing ones will require you to update your source code in MethodTool so that changes will reflect.
        • In the MethodTool, click the "Update Sources" button
    10. Modify your source code and save changes
    11. Build the EIM
      • In MethodTool, click "Build" button.
      • You will be prompted couple of times. Just keep clicking Yes/OK
      • A terminal will open showing compile in progress. it will automatically close if successful. otherwise it will remain open for you to see the errors
      • The following files will be created in working directory upon successful build:
        • <DNT of FX1>/<eim name>.evso
        • Note that the folder can either be DNT or FX1 depending on which tester you used to compile it with
    12. Test the EIM
      • Create or load an existing test program of your choice in OpTool
      • Load your EIM in MethodTool
      • For debug purposes, make sure to add the ExtIntfInit() entry point function in your EIM if you haven't done so
        • Modify the source code by adding the following line inside ExtIntfInit() function in <eim>.cxx
          • program->writeln(STDOUT, "Hello EIM world!\n");
      • Compile the EIM and if successful, load it into enVision by clicking "Reload" button in MethodTool
      • In Optool menu, go to OpTool>Setup>EIM... and "Setup External Interface Method" popup will appear
        • If your test program already have an existing external interface object defined, you can just insert your EIM method in it by pressing "Insert Methods" button and selecting your EIM in the popup list. 
        • Note that if you can't find your EIM in the list, try pressing "Reload" button again in the MethodTool
        • Press OK
      • Once your EIM is loaded, a message "Hello EIM World!" will be printed in the Dataviewer
      • Note: In simulation, enVision does not automatically start EIM process so start it manually by restarting tester via command line as shown:
        • >restart_tester <tester> -seim


    Friday, July 15, 2016

    EIM FAQ

    • MethodCompiler location
      • Solaris 8 Sun OS: /opt/ltx/bin/, /opt/ltx/releases/<release>/DNT/customer/bin
      • CentOS 4.6: /opt/ltx/releases/<release>/i686*/bin
    • Default EIM source code location
      • enVision (Solaris): /opt/ltx/releases/<version>/customer/test_methods/
      • enVision (CentOS 4.6): 
    • Custom EIM binary location (where the compiled "evso" file is to be placed)
      • enVision (Solaris): 
        • /opt/ltx/releases/<version>/customer/custom_methods/DNT
        • /opt/ltx/releases/<version>/customer/custom_methods/FX1
        • DNT for CX testers while FX1 for FX testers but need to confirm this 
      • enVision (CentOS 4.6): 
        • /opt/ltx/releases/<version>/i686*/custom_methods/DNT
        • /opt/ltx/releases/<version>/i686*/custom_methods/FX1
        • DNT for CX testers while FX1 for FX testers 
    • Command to compile EIM source code
      • >MethodCompiler -t DNT/FX1 -f <file>.tmk
        • Note: Some systems required you to set the full path of MethodCompiler command. 
        • Specify either DNT for DX systems,  or FX1 for X-series systems
    • Do's in Developing EIM 
    • Don'ts in Developing EIMl
    • How to Properly load an EIM into MethodTool
      • enVision only loads EIM's (evso files) that are located in default EIM source code location and custom EIM binary locations.
      • If you have an EIM source code and wishes to load it into MethodTool, follow this:
        • open OpTool>MethodTool
        • in OpTool>MethodTool>Method Directory:, specify the path where your EIM source code is located (cxx, hxx, mid, makefile, etc...)
        • set OpTool>MethodTool>Edit>Tool Mode>External Interface. If you are in the right path, a pop-up will appear letting you select which EIM object to load. select which one you prefer
        • press OpTool>MethodTool>Reload
        • If successful, press OpTool>MethodTool>ExternalInterface and select your EIM. Press OK and your EIM will be loaded successfully