%%{
    let module = system.modules[args[0]];
%%}
/*
 * EnDat
 */

/* EnDat Instance Macros */
#define CONFIG_ENDAT_NUM_INSTANCES               `module.$instances.length`
%for(let i = 0; i < module.$instances.length; i++) {
    % let instance = module.$instances[i];
    % let Mode = 0;
    % let Slice = 0 ;
    %if(instance.instance === "ICSSG1")
    %{
       % if(instance.PRU_ICSSG1_PRU.$assign === "PRU_ICSSG1_PRU1")
       %{
          % Slice = 1;
       %}

    %}
    %else
    %{
       %if(instance.PRU_ICSSG0_PRU.$assign === "PRU_ICSSG0_PRU1")
       %{
          % Slice = 1;
       %}

    %}
    %if(((instance.Channel_0 & 1)&&(instance.Channel_1 & 1))||((instance.Channel_1 & 1)&&(instance.Channel_2 & 1))||((instance.Channel_2 & 1)&&(instance.Channel_0 & 1)))
    %{
        % Mode = 1;
    %}
    %if(instance.Multi_Channel_Load_Share & 1)
    %{
        % Mode = 2;
    %}

#define `instance.$name`                  `i`
#define `instance.$name`_CHANNEL0         `instance.Channel_0 & 1`
#define `instance.$name`_CHANNEL1         `instance.Channel_1 & 1`
#define `instance.$name`_CHANNEL2         `instance.Channel_2 & 1`
#define `instance.$name`_load_share_mode  `instance.Multi_Channel_Load_Share & 1`
#define  `instance.$name`_MODE             `Mode`
#define `instance.$name`_BOOSTER_PACK     `instance.Booster_Pack & 1`
#define  PRU_ICSSGx_PRU_SLICE            `Slice`
% }



