Integrator Resources

The official home for NAI Support

Not sure where to start? Try Quick Start Guide or ask a question below!

Toggle Components with Visual Button
JavaScript Form Processing

DL BasicOps

DL BasicOps Sample Application (SSK 2.x)

Overview

The DL BasicOps sample application demonstrates how to configure and operate data link / LVDT (Linear Variable Differential Transformer) modules using the NAI Software Support Kit (SSK 2.x). It covers the core DL operations you will need in your own application: setting channel status enable, controlling power supply state, configuring wire mode and output mode, setting position values, clearing status flags, enabling test modes, and configuring hardware floating-point conversion.

This sample supports DL1 through DLN LVDT/RVDT position measurement modules. The application provides a main menu for basic operations and a floating-point sub-menu for configuring hardware-level data scaling. Each menu command maps directly to one or more naibrd_DL_*() API calls that you can lift into your own code.

For the SSK 1.x version, see DL BasicOps (SSK 1.x).

Prerequisites

Before running this sample, make sure you have:

  • An NAI board with a DL module installed (DL1-DLN).

  • SSK 2.x installed on your development host.

  • The sample applications built. Refer to the SSK 2.x Software Development Guide for platform-specific build instructions.

How to Run

Launch the dl_basic_ops executable from your build output directory. On startup the application looks for a configuration file (default_DL_BasicOps.txt). On the first run, this file will not exist — the application will present an interactive board menu where you configure a board connection, card index, and module slot. You can save this configuration so that subsequent runs skip the menu and connect automatically. Once connected, a command menu lets you exercise each DL operation.

Board Connection and Module Selection

Note
This startup sequence is common to all NAI sample applications. The board connection and module selection code shown here is not specific to DL.

The main() function follows a standard SSK 2.x startup flow:

  1. Call naiapp_RunBoardMenu() to load a saved configuration file (if one exists) or present the interactive board menu. The configuration file (default_DL_BasicOps.txt) is not included with the SSK — it is created when the user saves their connection settings from the board menu. On the first run, the menu will always appear.

  2. Query the user for a card index with naiapp_query_CardIndex().

  3. Query for a module slot with naiapp_query_ModuleNumber().

  4. Retrieve the module ID with naibrd_GetModuleName() so downstream code can adapt to the specific DL variant installed.

#if defined (__VXWORKS__)
int32_t DL_BasicOpsMenu(void)
#else
int32_t main(void)
#endif
{
   bool_t stop = NAI_FALSE;
   int32_t cardIndex;
   int32_t moduleCnt;
   int32_t module;
   uint32_t moduleID = 0;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

   if (naiapp_RunBoardMenu(CONFIG_FILE) == NAI_TRUE)
   {
      while (stop != NAI_TRUE)
      {
         /* Query the user for the card index */
         stop = naiapp_query_CardIndex(naiapp_GetBoardCnt(), 0, &cardIndex);
         if (stop != NAI_TRUE)
         {
            check_status(naibrd_GetModuleCount(cardIndex, &moduleCnt));

            /* Query the user for the module number */
            stop = naiapp_query_ModuleNumber(moduleCnt, 1, &module);
            if (stop != NAI_TRUE)
            {
               check_status(naibrd_GetModuleName(cardIndex, module, &moduleID));
               if ((moduleID != 0))
               {
                  DLBasicMenu_Run(cardIndex, module, moduleID);
               }
            }
         }

         naiif_printf("\r\nType Q to quit or Enter key to restart application:\r\n");
         stop = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      }
   }

   naiif_printf("\r\nType the Enter key to exit the program: ");
   naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   naiapp_access_CloseAllOpenCards();

   return 0;
}

Note the SSK 2.x differences from SSK 1.x in this startup sequence:

  • This sample uses the legacy __VXWORKS__ preprocessor guard. Most SSK 2.x samples use NAIBSP_CONFIG_SOFTWARE_OS_VXWORKS.

  • The module identifier is retrieved with naibrd_GetModuleName() (SSK 1.x uses naibrd_GetModuleID()).

  • Boolean constants are NAI_TRUE / NAI_FALSE (SSK 1.x uses TRUE / FALSE).

  • Console output uses naiif_printf() from the platform abstraction layer (SSK 1.x uses printf() directly).

Important

Common connection errors you may encounter at this stage:

  • No board found — verify that the board is powered on and physically connected. Check that the configuration file lists the correct interface and address.

  • Connection timeout — confirm network settings (for Ethernet connections) or bus configuration (for PCI/PCIe). Firewalls and IP mismatches are frequent causes.

  • Invalid card or module index — indices are zero-based for cards and one-based for modules. Ensure the values you pass match your hardware setup.

  • Module not present at selected slot — the slot you selected does not contain a DL module. Use the board menu to verify which slots are populated.

Program Structure

Entry Point

On VxWorks the entry point is DL_BasicOpsMenu(); on all other platforms it is main(). The preprocessor guard __VXWORKS__ selects between them. After board connection and module selection, the application calls DLBasicMenu_Run() which presents the main command loop.

Command Loop

DLBasicMenu_Run() displays the current measurement data for all channels, then presents the command menu. Several commands prompt the user for a channel number before executing. The display can be toggled between decimal and hexadecimal formats.

Command Description

1

Set channel status enable (activate or deactivate status reporting for a channel).

2

Set power supply state (on/off) for a channel.

3

Set channel output mode (ratio or fixed VLL).

4

Set position value for a channel.

5

Set configuration parameters (wire mode, expected voltages, thresholds).

6

Clear status flags for a channel.

7

Enable or disable D0/D2/D3 test modes.

8

Set D2 test verify value.

9

Open the floating-point configuration sub-menu.

A

Toggle display mode between decimal and hexadecimal.

Displaying Measurements

The DLBasicMenu_DisplayMeasurements() function reads and displays comprehensive measurement data for all channels including: wire mode, expected reference and signal voltages, position (A and B sub-channels), wrap position, reference voltage, signal voltage, frequency, current, phase offset, velocity, VLL mode, and power state.

Key API calls used:

  • naibrd_DL_GetChannelCount() — returns the number of DL channels for the module.

  • naibrd_DL_GetWireMode() — reads the wire mode (2-wire or 4-wire).

  • naibrd_DL_GetConfigurationValue() — reads configuration values (reference voltage, VLL voltage, phase offset).

  • naibrd_DL_GetPosition() — reads position data for a sub-channel (A or B).

  • naibrd_DL_GetMeasuredValue() — reads measured values (wrap position, voltages, frequency, current, velocity).

  • naibrd_DL_GetOutputMode() — reads the output mode (ratio or fixed).

  • naibrd_DL_GetPowerSupplyState() — reads the power supply state.

Configuring Channel Settings

The application provides several configuration functions:

  • naibrd_DL_SetChanStatusEnable() — enables or disables status reporting for a channel.

  • naibrd_DL_SetPowerSupplyState() — turns the power supply on or off for a channel.

  • naibrd_DL_SetOutputMode() — sets the VLL output mode (ratio or fixed).

  • naibrd_DL_SetPosition() — sets the position value for a channel.

  • naibrd_DL_SetConfiguration() — sets configuration parameters (wire mode, expected voltages, thresholds).

  • naibrd_DL_ClearStatus() — clears latched status flags.

Test Mode Configuration

D0, D2, and D3 built-in tests can be independently enabled or disabled. The D2 test uses a verify value for comparison against the measured output.

  • naibrd_DL_SetTestEnable() — enables or disables D0/D2/D3 tests.

  • naibrd_DL_SetD2TestVerifyValue() — sets the D2 test comparison value.

Floating-Point Sub-Menu

The floating-point sub-menu provides hardware-level data scaling for position measurements. You can enable floating-point conversion and set per-sub-channel scale factors and offsets.

  • naibrd_DL_SetFloatingPointEnable() — enables or disables hardware floating-point conversion.

  • naibrd_DL_SetFloatingPointScale() — sets the scale factor for a sub-channel.

  • naibrd_DL_SetFloatingPointOffset() — sets the offset for a sub-channel.

Troubleshooting Reference

Error / Symptom Possible Causes Suggested Resolution

Module not recognized as DL

The selected module slot does not contain a DL module.

Verify the module type in the slot. See the DL1-DLN Manual.

Position reads zero

Module power supply is disabled, or no transducer is connected.

Enable the power supply and verify transducer wiring.

Signal loss status active

The module is not detecting the expected signal voltage.

Check the transducer connections and verify the expected VLL voltage setting.

Reference loss status active

The module is not detecting the expected reference voltage.

Verify the reference voltage source and expected reference voltage setting.

PLL status active

The phase-locked loop is not locked to the reference signal.

Check the reference signal frequency and amplitude.

Overcurrent status active

The channel is drawing more current than specified.

Reduce the load on the channel. Check for short circuits in the wiring.

Position values differ between decimal and hex display

Hexadecimal display shows raw register values; decimal shows engineering units.

This is expected behavior. Use decimal display for human-readable values.

Floating-point settings have no effect

Floating-point mode must be enabled before scale and offset settings take effect.

Use command 1 in the floating-point sub-menu to enable floating-point conversion.

Full Source

The complete source for this sample is provided below for reference. The sections above explain each part in detail.

Full Source — dl_basic_ops.c (SSK 2.x)
/* nailib include files */
#include "nai_libs/nailib/include/naitypes.h"
#include "nai_libs/nailib/include/nailib.h"
#include "nai_libs/nailib/include/nailib_utils.h"

/* naibrd include files */
#include "nai_libs/naibrd/include/naibrd.h"
#include "nai_libs/naibrd/include/functions/naibrd_dl.h"

/* naiif include files */
#include "nai_libs/naiif/include/naiif.h"
#include "nai_libs/naiif/include/naiif_stdio.h"

/* Common Sample Program include files */
#include "nai_sample_apps/naiapp_common/include/naiapp_boardaccess_menu.h"
#include "nai_sample_apps/naiapp_common/include/naiapp_boardaccess_query.h"
#include "nai_sample_apps/naiapp_common/include/naiapp_boardaccess_access.h"
#include "nai_sample_apps/naiapp_common/include/naiapp_boardaccess_display.h"
#include "nai_sample_apps/naiapp_common/include/naiapp_boardaccess_utils.h"

static const int8_t *SAMPLE_PGM_NAME = (int8_t*) "DL Module Basic Operation Program";
static const int8_t *CONFIG_FILE = (int8_t*) "default_DL_BasicOps.txt";
static bool_t displayHex = NAI_FALSE;

static bool_t DLBasicMenu_Run(int32_t cardIndex, int32_t module, uint32_t modid);
static void DLBasicMenu_DisplayMeasurements(int32_t cardIndex, int32_t module, uint32_t modid);
static nai_status_t DL_BasicMenu_SetChanStatusEnable(int32_t paramCount, int32_t* p_params);
static bool_t DLBasicMenu_SetPowerState(int32_t cardIndex, int32_t module, int32_t channel);
static nai_status_t DLBasicMenu_SetChannelOutput(int32_t paramCount, int32_t* p_params);
static nai_status_t DL_BasicMenu_SetPosition(int32_t paramCount, int32_t* p_params);
static nai_status_t DL_BasicMenu_SetConfiguration(int32_t paramCount, int32_t* p_params);
static nai_status_t DL_BasicMenu_ClearStatus(int32_t paramCount, int32_t* p_params);
static nai_status_t DL_BasicMenu_SetTestEnable(int32_t paramCount, int32_t* p_params);
static nai_status_t DL_BasicMenu_SetD2TestVerifyValue(int32_t paramCount, int32_t* p_params);
static nai_status_t DL_BasicMenu_RunFloatingPointMenu(int32_t paramCount, int32_t* p_params);

static void DL_Display_FloatingPointMenu(int32_t cardIndex, int32_t module, uint32_t modId);
static nai_status_t DL_FloatingPointMenu_SetFloatingPointEnable(int32_t paramCount, int32_t* p_params);
static nai_status_t DL_FloatingPointMenu_SetPositionAScale(int32_t paramCount, int32_t* p_params);
static nai_status_t DL_FloatingPointMenu_SetPositionBScale(int32_t paramCount, int32_t* p_params);
static nai_status_t DL_FloatingPointMenu_SetPositionAOffset(int32_t paramCount, int32_t* p_params);
static nai_status_t DL_FloatingPointMenu_SetPositionBOffset(int32_t paramCount, int32_t* p_params);

enum dl_basicOpsMenu_commands
{
   DL_BASICMENU_CMD_SET_CHAN_STATUS_ENABLE,
   DL_BASICMENU_CMD_SET_POWER_STATE,
   DL_BASICMENU_CMD_SET_CHANNEL_OUTPUT,
   DL_BASICMENU_CMD_SET_POSITION,
   DL_BASICMENU_CMD_SET_CONFIGURATION,
   DL_BASICMENU_CMD_CLEAR_STATUS,
   DL_BASICMENU_CMD_SET_TEST_ENABLE,
   DL_BASICMENU_CMD_SET_D2_TEST_VERIFY_VALUE,
   DL_BASICMENU_CMD_RUN_FLOATING_POINT_MENU,
   DL_BASICMENU_CMD_SET_DISPLAY_HEX,
   DL_BASICMENU_CMD_COUNT
};

enum dl_floatingPointMenu_commands
{
   DL_FLOATINGPOINTMENU_CMD_SET_FLOATING_POINT_ENABLE,
   DL_FLOATINGPOINTMENU_CMD_SET_POSITION_A_SCALE,
   DL_FLOATINGPOINTMENU_CMD_SET_POSITION_B_SCALE,
   DL_FLOATINGPOINTMENU_CMD_SET_POSITION_A_OFFSET,
   DL_FLOATINGPOINTMENU_CMD_SET_POSITION_B_OFFSET,
   DL_FLOATINGPOINTMENU_CMD_COUNT
};

naiapp_cmdtbl_params_t DL_BasicOpsMenuCmds[] =
{
   {"1",   "Set Chan Status Enable",         DL_BASICMENU_CMD_SET_CHAN_STATUS_ENABLE,    DL_BasicMenu_SetChanStatusEnable  },
   {"2",   "Set Power State",                DL_BASICMENU_CMD_SET_POWER_STATE,           NULL                              },
   {"3",   "Set Channel Output Mode",        DL_BASICMENU_CMD_SET_CHANNEL_OUTPUT,        DLBasicMenu_SetChannelOutput      },
   {"4",   "Set Position",                   DL_BASICMENU_CMD_SET_POSITION,              DL_BasicMenu_SetPosition          },
   {"5",   "Set Configuration",              DL_BASICMENU_CMD_SET_CONFIGURATION,         DL_BasicMenu_SetConfiguration     },
   {"6",   "Clear Status",                   DL_BASICMENU_CMD_CLEAR_STATUS,              DL_BasicMenu_ClearStatus          },
   {"7",   "Enable/Disable D0/D2/D3 Tests",  DL_BASICMENU_CMD_SET_TEST_ENABLE,           DL_BasicMenu_SetTestEnable        },
   {"8",   "Set D2 Test Verify Value",       DL_BASICMENU_CMD_SET_D2_TEST_VERIFY_VALUE,  DL_BasicMenu_SetD2TestVerifyValue },
   {"9",   "Run Floating-Point Menu",        DL_BASICMENU_CMD_RUN_FLOATING_POINT_MENU,   DL_BasicMenu_RunFloatingPointMenu },
   {"A",   "Set Display Mode",               DL_BASICMENU_CMD_SET_DISPLAY_HEX,           NULL                              }
};

naiapp_cmdtbl_params_t DL_FloatingPointMenuCmds[] =
{
   {"1", "Set Floating Point Mode Enable", DL_FLOATINGPOINTMENU_CMD_SET_FLOATING_POINT_ENABLE, DL_FloatingPointMenu_SetFloatingPointEnable},
   {"2", "Set Position A Scale",           DL_FLOATINGPOINTMENU_CMD_SET_POSITION_A_SCALE,      DL_FloatingPointMenu_SetPositionAScale     },
   {"3", "Set Position B Scale",           DL_FLOATINGPOINTMENU_CMD_SET_POSITION_B_SCALE,      DL_FloatingPointMenu_SetPositionBScale     },
   {"4", "Set Position A Offset",          DL_FLOATINGPOINTMENU_CMD_SET_POSITION_A_OFFSET,     DL_FloatingPointMenu_SetPositionAOffset    },
   {"5", "Set Position B Offset",          DL_FLOATINGPOINTMENU_CMD_SET_POSITION_B_OFFSET,     DL_FloatingPointMenu_SetPositionBOffset    }
};

#if defined (__VXWORKS__)
int32_t DL_BasicOpsMenu(void)
#else
int32_t main(void)
#endif
{
   bool_t stop = NAI_FALSE;
   int32_t cardIndex;
   int32_t moduleCnt;
   int32_t module;
   uint32_t moduleID = 0;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

   if (naiapp_RunBoardMenu(CONFIG_FILE) == NAI_TRUE)
   {
      while (stop != NAI_TRUE)
      {
         /* Query the user for the card index */
         stop = naiapp_query_CardIndex(naiapp_GetBoardCnt(), 0, &cardIndex);
         if (stop != NAI_TRUE)
         {
            check_status(naibrd_GetModuleCount(cardIndex, &moduleCnt));

            /* Query the user for the module number */
            stop = naiapp_query_ModuleNumber(moduleCnt, 1, &module);
            if (stop != NAI_TRUE)
            {
               check_status(naibrd_GetModuleName(cardIndex, module, &moduleID));
               if ((moduleID != 0))
               {
                  DLBasicMenu_Run(cardIndex, module, moduleID);
               }
            }
         }

         naiif_printf("\r\nType Q to quit or Enter key to restart application:\r\n");
         stop = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      }
   }

   naiif_printf("\r\nType the Enter key to exit the program: ");
   naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   naiapp_access_CloseAllOpenCards();

   return 0;
}

static bool_t DLBasicMenu_Run(int32_t cardIndex, int32_t module, uint32_t modid)
{
   bool_t bQuit = NAI_FALSE;
   bool_t bCmdFound = NAI_FALSE;
   int32_t cmd;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;
   naiapp_AppParameters_t  dl_params;
   p_naiapp_AppParameters_t dl_basicops_params = &dl_params;
   int32_t MAX_CHANNELS = naibrd_DL_GetChannelCount(modid);
   dl_basicops_params->cardIndex = cardIndex;
   dl_basicops_params->module = module;
   dl_basicops_params->modId = modid;

   naiif_printf("\r\n\r\n\r\n\r\n");
   do
   {
      naiapp_utils_LoadParamMenuCommands(DL_BASICMENU_CMD_COUNT, DL_BasicOpsMenuCmds);
      DLBasicMenu_DisplayMeasurements(cardIndex, module, modid);
      naiapp_display_ParamMenuCommands((int8_t*)SAMPLE_PGM_NAME);
      naiif_printf("\r\n Type command or %c to quit : ", NAI_QUIT_CHAR);
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         bCmdFound = naiapp_utils_GetParamMenuCmdNum(inputResponseCnt, inputBuffer, &cmd);
         if (bCmdFound)
         {
            switch (cmd)
            {
               case DL_BASICMENU_CMD_SET_POWER_STATE:
                  naiapp_query_ChannelNumber(MAX_CHANNELS, 1, &(dl_basicops_params->channel));
                  bQuit = DLBasicMenu_SetPowerState(cardIndex, module, dl_basicops_params->channel);
               break;
               case DL_BASICMENU_CMD_SET_CHAN_STATUS_ENABLE:
               case DL_BASICMENU_CMD_SET_CHANNEL_OUTPUT:
               case DL_BASICMENU_CMD_SET_POSITION:
               case DL_BASICMENU_CMD_SET_CONFIGURATION:
               case DL_BASICMENU_CMD_CLEAR_STATUS:
                  naiapp_query_ChannelNumber(MAX_CHANNELS, 1, &(dl_basicops_params->channel));
                  DL_BasicOpsMenuCmds[cmd].func(APP_PARAM_COUNT, (int32_t*)dl_basicops_params);
               break;
               case DL_BASICMENU_CMD_SET_TEST_ENABLE:
               case DL_BASICMENU_CMD_SET_D2_TEST_VERIFY_VALUE:
               case DL_BASICMENU_CMD_RUN_FLOATING_POINT_MENU:
                  DL_BasicOpsMenuCmds[cmd].func(APP_PARAM_COUNT, (int32_t*)dl_basicops_params);
               break;
               case DL_BASICMENU_CMD_SET_DISPLAY_HEX:
                  naiif_printf("\r\n 0 for DECIMAL, 1 for HEX: ");
                  bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
                  if (atoi((char*)inputBuffer) == 0)
                  {
                     displayHex = NAI_FALSE;
                  }
                  else
                  {
                     displayHex = NAI_TRUE;
                  }
               break;
            }
         }
      }
   } while (!bQuit);

   return bQuit;
}

static void DLBasicMenu_DisplayMeasurements(int32_t cardIndex, int32_t module, uint32_t modid)
{
   int32_t channel = 0;
   naibrd_dl_wire_mode_type_t outWireMode = NAIBRD_DL_4WIRE_MODE;
   float64_t outExpRefVolt = 0.0;
   float64_t outExpSigVolt = 0.0;
   float64_t outPosition = 0.0;
   float64_t outPositionB = 0.0;
   float64_t outWrapPosition = 0.0;
   float64_t outWrapPositionB = 0.0;
   float64_t outRefVolt = 0.0;
   float64_t outSigVolt = 0.0;
   float64_t outSigVoltB = 0.0;
   float64_t outFreq = 0.0;
   float64_t outCurr = 0.0;
   float64_t outCurrB = 0.0;
   float64_t outSigThresA = 0.0;
   float64_t outSigThresB = 0.0;
   float64_t outRefThres = 0.0;
   float64_t outCurrThresA = 0.0;
   float64_t outCurrThresB = 0.0;
   float64_t outPhaseOffset = 0.0;
   float64_t outVelocityA = 0.0;
   float64_t outVelocityB = 0.0;
   naibrd_dl_vll_mode_type_t outOutputState = NAIBRD_DL_VLL_MODE_RATIO;
   naibrd_dl_on_off_t outPowerSupplyState = NAIBRD_DL_OFF;
   uint32_t outExpRefVoltRaw = 0u;
   uint32_t outExpVllVoltRaw = 0u;
   uint32_t outPositionRaw = 0u;
   uint32_t outPositionBRaw = 0u;
   uint32_t outWrapPositionRaw = 0u;
   uint32_t outWrapPositionBRaw = 0u;
   uint32_t outWrapRefVoltRaw = 0u;
   uint32_t outWrapVllVoltRaw = 0u;
   uint32_t outWrapVllVoltBRaw = 0u;
   uint32_t outCurrRaw = 0u;
   uint32_t outCurrBRaw = 0u;
   uint32_t outFreqRaw = 0u;
   uint32_t outSigThresARaw = 0u;
   uint32_t outSigThresBRaw = 0u;
   uint32_t outRefThresRaw = 0u;
   uint32_t outCurrThresARaw = 0u;
   uint32_t outCurrThresBRaw = 0u;
   uint32_t outPhaseOffsetRaw = 0u;
   uint32_t outVelocityARaw = 0u;
   uint32_t outVelocityBRaw = 0u;
   naibrd_dl_vll_mode_type_t outVllMode = NAIBRD_DL_VLL_MODE_RATIO;

   bool_t chanStatusEnable = NAI_FALSE;
   naibrd_dl_module_status_t bitStatusLatched = 0u;
   naibrd_dl_module_status_t bitStatusRealtime = 0u;
   naibrd_dl_module_status_t signalLossStatusLatched = 0u;
   naibrd_dl_module_status_t signalLossStatusRealtime = 0u;
   naibrd_dl_module_status_t refLossStatusLatched = 0u;
   naibrd_dl_module_status_t refLossStatusRealtime = 0u;
   naibrd_dl_module_status_t pllStatusLatched = 0u;
   naibrd_dl_module_status_t pllStatusRealtime = 0u;
   naibrd_dl_module_status_t overcurrentStatusLatched = 0u;
   naibrd_dl_module_status_t overcurrentStatusRealtime = 0u;
   naibrd_dl_module_status_t bitBStatusLatched = 0u;
   naibrd_dl_module_status_t bitBStatusRealtime = 0u;
   naibrd_dl_module_status_t signalLossBStatusLatched = 0u;
   naibrd_dl_module_status_t signalLossBStatusRealtime = 0u;
   bool_t d0TestEnabled = NAI_FALSE;
   bool_t d2TestEnabled = NAI_FALSE;
   bool_t d3TestEnabled = NAI_FALSE;
   uint32_t d2TestVerifyValue = 0u;

   int32_t MAX_CHANNEL = naibrd_DL_GetChannelCount(modid);

   naiif_printf("\r\n============================");
   naiif_printf("\r\n====Display Measurements====");
   naiif_printf("\r\n============================\r\n\r\n");

   if (displayHex == NAI_FALSE)
   {
      naiif_printf("%5s%6s%14s%12s%11s%11s%12s%13s%11s%11s%11s%11s%11s%11s%11s%11s%11s%9s%8s\r\n", "Chan", "Mode", "Exp.Ref(V)",
                   "Exp.Sig(V)", "Position", "PositionB", "W.Position", "W.PositionB", "RefVolt", "SigVolt", "SigVoltB", "Freq",
                   "Curr", "CurrB", "Phase", "VelA", "VelB", "VLLMode", "Power");
      naiif_printf("-----------------------------------------------------------------------------------------------------------------");
      naiif_printf("------------------------------------------------------------------------------------------\r\n");
      for (channel = 1; channel <= MAX_CHANNEL; channel++)
      {
         check_status(naibrd_DL_GetWireMode(cardIndex, module, channel, &outWireMode));
         check_status(naibrd_DL_GetConfigurationValue(cardIndex, module, channel, NAIBRD_DL_CONFIGURATION_REF_VOLT, &outExpRefVolt));
         check_status(naibrd_DL_GetConfigurationValue(cardIndex, module, channel, NAIBRD_DL_CONFIGURATION_VLL_VOLT, &outExpSigVolt));
         check_status(naibrd_DL_GetPosition(cardIndex, module, channel, NAIBRD_DL_SUBCHANNEL_A, &outPosition));
         check_status(naibrd_DL_GetPosition(cardIndex, module, channel, NAIBRD_DL_SUBCHANNEL_B, &outPositionB));
         check_status(naibrd_DL_GetMeasuredValue(cardIndex, module, channel, NAIBRD_DL_MEASURED_WRAP_POSITION_SUBCHANNEL_A,
                                                 &outWrapPosition));
         check_status(naibrd_DL_GetMeasuredValue(cardIndex, module, channel, NAIBRD_DL_MEASURED_WRAP_POSITION_SUBCHANNEL_B,
                                                 &outWrapPositionB));
         check_status(naibrd_DL_GetMeasuredValue(cardIndex, module, channel, NAIBRD_DL_MEASURED_REF_VOLTAGE, &outRefVolt));
         check_status(naibrd_DL_GetMeasuredValue(cardIndex, module, channel, NAIBRD_DL_MEASURED_VLL_VOLTAGE, &outSigVolt));
         check_status(naibrd_DL_GetMeasuredValue(cardIndex, module, channel, NAIBRD_DL_MEASURED_VLL_VOLTAGE_SUBCHANNEL_B, &outSigVoltB));
         check_status(naibrd_DL_GetMeasuredValue(cardIndex, module, channel, NAIBRD_DL_MEASURED_REF_FREQUENCY, &outFreq));
         check_status(naibrd_DL_GetMeasuredValue(cardIndex, module, channel, NAIBRD_DL_MEASURED_SIGNAL_CURRENT, &outCurr));
         check_status(naibrd_DL_GetMeasuredValue(cardIndex, module, channel, NAIBRD_DL_MEASURED_SIGNAL_CURRENT_SUBCHANNEL_B, &outCurrB));
         check_status(naibrd_DL_GetConfigurationValue(cardIndex, module, channel, NAIBRD_DL_CONFIGURATION_PHASE_OFFSET, &outPhaseOffset));
         check_status(naibrd_DL_GetMeasuredValue(cardIndex, module, channel, NAIBRD_DL_MEASURED_VELOCITY_SUBCHANNEL_A, &outVelocityA));
         check_status(naibrd_DL_GetMeasuredValue(cardIndex, module, channel, NAIBRD_DL_MEASURED_VELOCITY_SUBCHANNEL_B, &outVelocityB));
         check_status(naibrd_DL_GetOutputMode(cardIndex, module, channel, &outOutputState));
         check_status(naibrd_DL_GetPowerSupplyState(cardIndex, module, channel, &outPowerSupplyState));

         naiif_printf("%4d   ", channel);
         switch (outWireMode)
         {
            case NAIBRD_DL_2WIRE_MODE:
               naiif_printf("%8s", "2-WI    ");
            break;
            case NAIBRD_DL_4WIRE_MODE:
               naiif_printf("%8s", "4-WI    ");
            break;
            default:
               naiif_printf("%8s", "UNKNOWN ");
            break;
         }
         naiif_printf("%10.3f %11.3f %10.3f %10.3f  %10.3f   %10.3f %10.3f %10.3f %10.3f %10.3f %10.3f %10.3f %10.3f %10.3f %10.3f ",
                      outExpRefVolt, outExpSigVolt, outPosition, outPositionB, outWrapPosition, outWrapPositionB, outRefVolt, outSigVolt,
                      outSigVoltB, outFreq, outCurr, outCurrB, outPhaseOffset, outVelocityA, outVelocityB);
         switch (outOutputState)
         {
            case NAIBRD_DL_VLL_MODE_RATIO:
               naiif_printf("%8s", "  RATIO ");
            break;
            case NAIBRD_DL_VLL_MODE_FIXED:
               naiif_printf("%8s", "  FIXED ");
            break;
            default:
               naiif_printf("%8s", " UNKNOWN");
            break;
         }
         switch (outPowerSupplyState)
         {
            case NAIBRD_DL_OFF:
               naiif_printf("%12s", "  DISABLED  ");
            break;
            case NAIBRD_DL_ON:
               naiif_printf("%12s", "  ENABLED   ");
            break;
            default:
               naiif_printf("%12s", "  UNKNOWN   ");
            break;
         }

         naiif_printf("\r\n");
      }
   }
   else
   {
      naiif_printf("%5s%6s%14s%12s%10s%11s%12s%13s%10s%11s%12s%9s%11s%11s%11s%11s%11s%11s%9s\r\n", "Chan", "Mode", "Exp.Ref(V)",
                   "Exp.Sig(V)", "Position", "PositionB", "W.Position", "W.PositionB", "RefVolt", "SigVolt", "SigVoltB", "Freq",
                   "Curr", "CurrB", "Phase", "VelA", "VelB", "VLLMode", "Power");
      naiif_printf("-----------------------------------------------------------------------------------------------------------------");
      naiif_printf("------------------------------------------------------------------------------------------\r\n");
      for (channel = 1; channel <= MAX_CHANNEL; channel++)
      {
         check_status(naibrd_DL_GetWireMode(cardIndex, module, channel, &outWireMode));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_REF_VOLT, &outExpRefVoltRaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_VLL_VOLT, &outExpVllVoltRaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_POSITION_SUBCHANNEL_A, &outPositionRaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_POSITION_SUBCHANNEL_B, &outPositionBRaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_WRAP_POSITION_SUBCHANNEL_A,
                                                     &outWrapPositionRaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_WRAP_POSITION_SUBCHANNEL_B,
                                                     &outWrapPositionBRaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_WRAP_REF_VOLT, &outWrapRefVoltRaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_WRAP_VLL_VOLT, &outWrapVllVoltRaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_WRAP_VLL_VOLT_SUBCHANNEL_B,
                                                     &outWrapVllVoltBRaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_WRAP_REF_FREQ, &outFreqRaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_WRAP_CURRENT_SUBCHANNEL_A, &outCurrRaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_WRAP_CURRENT_SUBCHANNEL_B, &outCurrBRaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_PHASE_OFFSET, &outPhaseOffsetRaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_WRAP_VELOCITY_SUBCHANNEL_A,
                                                     &outVelocityARaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_WRAP_VELOCITY_SUBCHANNEL_B,
                                                     &outVelocityBRaw));
         check_status(naibrd_DL_GetOutputMode(cardIndex, module, channel, &outVllMode));
         check_status(naibrd_DL_GetPowerSupplyState(cardIndex, module, channel, &outPowerSupplyState));

         naiif_printf("%4d   ", channel);
         switch (outWireMode)
         {
            case NAIBRD_DL_2WIRE_MODE:
               naiif_printf("%8s", "2-WI    ");
            break;
            case NAIBRD_DL_4WIRE_MODE:
               naiif_printf("%8s", "4-WI    ");
            break;
            default:
               naiif_printf("%8s", "UNKNOWN ");
            break;
         }
         naiif_printf("0x%08X  0x%08X 0x%08X 0x%08X 0x%08X  0x%08X   0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X ",
                      outExpRefVoltRaw, outExpVllVoltRaw, outPositionRaw, outPositionBRaw, outWrapPositionRaw, outWrapPositionBRaw,
                      outWrapRefVoltRaw, outWrapVllVoltRaw, outWrapVllVoltBRaw, outFreqRaw, outCurrRaw, outCurrBRaw, outPhaseOffsetRaw,
                      outVelocityARaw, outVelocityBRaw);
         switch (outVllMode)
         {
            case NAIBRD_DL_VLL_MODE_RATIO:
               naiif_printf("%8s", " RATIO  ");
            break;
            case NAIBRD_DL_VLL_MODE_FIXED:
               naiif_printf("%8s", " FIXED  ");
            break;
            default:
               naiif_printf("%8s", "UNKNOWN ");
            break;
         }
         switch (outPowerSupplyState)
         {
            case NAIBRD_DL_OFF:
               naiif_printf("%12s", "  DISABLED  ");
            break;
            case NAIBRD_DL_ON:
               naiif_printf("%12s", "  ENABLED   ");
            break;
            default:
               naiif_printf("%12s", "  UNKNOWN   ");
            break;
         }

         naiif_printf("\r\n");
      }
   }

   if (displayHex == NAI_FALSE)
   {
      naiif_printf("\r\n %4s %13s  %13s  %13s  %13s  %13s\r\n", "Chan", "Sig Thres A", "Sig Thres B", "Ref Thres", "Curr Thres A",
                                                                "Curr Thres B");
      naiif_printf("--------------------------------------------------------------------------------\r\n");
      for (channel = 1; channel <= MAX_CHANNEL; channel++)
      {
         check_status(naibrd_DL_GetConfigurationValue(cardIndex, module, channel, NAIBRD_DL_CONFIGURATION_THRESHOLD_VLL_VOLT,
                                                      &outSigThresA));
         check_status(naibrd_DL_GetConfigurationValue(cardIndex, module, channel, NAIBRD_DL_CONFIGURATION_THRESHOLD_VLL_VOLT_SUBCHANNEL_B,
                                                      &outSigThresB));
         check_status(naibrd_DL_GetConfigurationValue(cardIndex, module, channel, NAIBRD_DL_CONFIGURATION_THRESHOLD_REF_VOLT,
                                                      &outRefThres));
         check_status(naibrd_DL_GetConfigurationValue(cardIndex, module, channel, NAIBRD_DL_CONFIGURATION_THRESHOLD_CURRENT_SUBCHANNEL_A,
                                                      &outCurrThresA));
         check_status(naibrd_DL_GetConfigurationValue(cardIndex, module, channel, NAIBRD_DL_CONFIGURATION_THRESHOLD_CURRENT_SUBCHANNEL_B,
                                                      &outCurrThresB));
         naiif_printf(" %3d  %13.4f  %13.4f  %13.4f  %13.4f  %13.4f\r\n", channel, outSigThresA, outSigThresB, outRefThres, outCurrThresA,
                                                                          outCurrThresB);
      }
   }
   else
   {
      naiif_printf("\r\n %4s %13s  %13s  %13s  %13s  %13s\r\n", "Chan", "Sig Thres A", "Sig Thres B", "Ref Thres", "Curr Thres A",
                                                                "Curr Thres B");
      naiif_printf("--------------------------------------------------------------------------------\r\n");
      for (channel = 1; channel <= MAX_CHANNEL; channel++)
      {
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_THRESHOLD_VLL_VOLT, &outSigThresARaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_THRESHOLD_VLL_VOLT_SUBCHANNEL_B,
                                                     &outSigThresBRaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_THRESHOLD_REF_VOLT, &outRefThresRaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_THRESHOLD_CURRENT_SUBCHANNEL_A,
                                                     &outCurrThresARaw));
         check_status(naibrd_DL_GetRawValueByChannel(cardIndex, module, channel, NAIBRD_DL_RAW_THRESHOLD_CURRENT_SUBCHANNEL_B,
                                                     &outCurrThresBRaw));
         naiif_printf(" %3d     0x%08X     0x%08X     0x%08X     0x%08X     0x%08X\r\n", channel, outSigThresARaw, outSigThresBRaw,
                                                                                       outRefThresRaw, outCurrThresARaw, outCurrThresBRaw);
      }
   }

   naiif_printf("\r\n%5s%12s%6s%6s%6s%6s%9s%6s%6s\r\n", "", "Chan Status", "BIT ", "SIG ", "REF ", "PLL ", "OVERCURR", "BIT B", "SIG B");
   naiif_printf("%5s%12s%6s%6s%6s%6s%9s%6s%6s\r\n", "Chan", "Enable   ", "(R/L)", "(R/L)", "(R/L)", "(R/L)", "(R/L)  ", "(R/L)", "(R/L)");
   naiif_printf("---------------------------------------------------------------\r\n");
   for (channel = 1; channel <= MAX_CHANNEL; channel++)
   {
      check_status(naibrd_DL_GetChanStatusEnable(cardIndex, module, channel, &chanStatusEnable));
      check_status(naibrd_DL_GetChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_BIT_LATCHED, &bitStatusLatched));
      check_status(naibrd_DL_GetChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_BIT_REALTIME,
                                                 &bitStatusRealtime));
      check_status(naibrd_DL_GetChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_SIGNAL_LOSS_LATCHED,
                                                 &signalLossStatusLatched));
      check_status(naibrd_DL_GetChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_SIGNAL_LOSS_REALTIME,
                                                 &signalLossStatusRealtime));
      check_status(naibrd_DL_GetChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_REF_LOSS_LATCHED,
                                                 &refLossStatusLatched));
      check_status(naibrd_DL_GetChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_REF_LOSS_REALTIME,
                                                 &refLossStatusRealtime));
      check_status(naibrd_DL_GetChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_PLL_LATCHED, &pllStatusLatched));
      check_status(naibrd_DL_GetChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_PLL_REALTIME,
                                                 &pllStatusRealtime));
      check_status(naibrd_DL_GetChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_OVERCURRENT_LATCHED,
                                                 &overcurrentStatusLatched));
      check_status(naibrd_DL_GetChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_OVERCURRENT_REALTIME,
                                                 &overcurrentStatusRealtime));
      check_status(naibrd_DL_GetChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_BIT_B_LATCHED,
                                                 &bitBStatusLatched));
      check_status(naibrd_DL_GetChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_BIT_B_REALTIME,
                                                 &bitBStatusRealtime));
      check_status(naibrd_DL_GetChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_SIGNAL_LOSS_B_LATCHED,
                                                 &signalLossBStatusLatched));
      check_status(naibrd_DL_GetChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_SIGNAL_LOSS_B_REALTIME,
                                                 &signalLossBStatusRealtime));

      naiif_printf("%4d ", channel);
      switch (chanStatusEnable)
      {
         case NAI_TRUE:
            naiif_printf("%10s", " ENABLED ");
         break;
         case NAI_FALSE:
            naiif_printf("%10s", " DISABLED");
         break;
         default:
            naiif_printf("%10s", " UNKNOWN ");
         break;
      }

      naiif_printf("   (%1u/%1u) (%1u/%1u) (%1u/%1u) (%1u/%1u)  (%1u/%1u)   (%1u/%1u) (%1u/%1u)\r\n", bitStatusRealtime, bitStatusLatched,
                   signalLossStatusRealtime, signalLossStatusLatched, refLossStatusRealtime, refLossStatusLatched, pllStatusRealtime,
                   pllStatusLatched, overcurrentStatusRealtime, overcurrentStatusLatched, bitBStatusRealtime, bitBStatusLatched,
                   signalLossBStatusRealtime, signalLossBStatusLatched);
   }

   check_status(naibrd_DL_GetTestEnable(cardIndex, module, NAIBRD_DL_D0_TEST, &d0TestEnabled));
   check_status(naibrd_DL_GetTestEnable(cardIndex, module, NAIBRD_DL_D2_TEST, &d2TestEnabled));
   check_status(naibrd_DL_GetTestEnable(cardIndex, module, NAIBRD_DL_D3_TEST, &d3TestEnabled));
   check_status(naibrd_DL_GetD2TestVerifyValue(cardIndex, module, &d2TestVerifyValue));
   naiif_printf("\r\nD0 Test Enable: ");
   switch (d0TestEnabled)
   {
      case NAI_TRUE:
         naiif_printf("%8s", "ENABLED");
      break;
      case NAI_FALSE:
         naiif_printf("%9s", "DISABLED");
      break;
      default:
         naiif_printf("%8s", "UNKNOWN");
      break;
   }

   naiif_printf("\r\nD2 Test Enable: ");
   switch (d2TestEnabled)
   {
      case NAI_TRUE:
         naiif_printf("%8s", "ENABLED");
      break;
      case NAI_FALSE:
         naiif_printf("%9s", "DISABLED");
      break;
      default:
         naiif_printf("%8s", "UNKNOWN");
      break;
   }

   naiif_printf("\r\nD3 Test Enable: ");
   switch (d3TestEnabled)
   {
      case NAI_TRUE:
         naiif_printf("%8s", "ENABLED");
      break;
      case NAI_FALSE:
         naiif_printf("%9s", "DISABLED");
      break;
      default:
         naiif_printf("%8s", "UNKNOWN");
      break;
   }

   naiif_printf("\r\nD2 Test Verify Value: 0x%08X\r\n", d2TestVerifyValue);
}

static nai_status_t DL_BasicMenu_SetChanStatusEnable(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = NAI_FALSE;
   p_naiapp_AppParameters_t p_dl_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_dl_params->cardIndex;
   int32_t module = p_dl_params->module;
   int32_t channel = p_dl_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   naiif_printf("\r\n Type 1 to enable or 0 to disable channel status reporting: ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            check_status(naibrd_DL_SetChanStatusEnable(cardIndex, module, channel, NAI_FALSE));
         break;
         case '1':
            check_status(naibrd_DL_SetChanStatusEnable(cardIndex, module, channel, NAI_TRUE));
         break;
         default:
            naiif_printf("\r\nInvalid option entered!\r\n");
         break;
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static bool_t DLBasicMenu_SetPowerState(int32_t cardIndex, int32_t module, int32_t channel)
{
   bool_t bQuit = NAI_FALSE;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

   naiif_printf("\r\n 0 for DISABLED, 1 for ENABLED: ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            check_status(naibrd_DL_SetPowerSupplyState(cardIndex, module, channel, NAIBRD_DL_OFF));
         break;
         case '1':
            check_status(naibrd_DL_SetPowerSupplyState(cardIndex, module, channel, NAIBRD_DL_ON));
         break;
         default:
            naiif_printf("\r\nInvalid option entered!\r\n");
         break;
      }
   }

   return bQuit;
}

static nai_status_t DLBasicMenu_SetChannelOutput(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = NAI_FALSE;
   p_naiapp_AppParameters_t p_dl_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_dl_params->cardIndex;
   int32_t module = p_dl_params->module;
   int32_t channel = p_dl_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   naiif_printf("\r\n 0 for RATIO, 1 for FIXED: ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            check_status(naibrd_DL_SetOutputMode(cardIndex, module, channel, NAIBRD_DL_VLL_MODE_RATIO));
         break;
         case '1':
            check_status(naibrd_DL_SetOutputMode(cardIndex, module, channel, NAIBRD_DL_VLL_MODE_FIXED));
         break;
         default:
            naiif_printf("\r\nInvalid option entered!\r\n");
         break;
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t DL_BasicMenu_SetPosition(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_dl_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_dl_params->cardIndex;
   int32_t module = p_dl_params->module;
   int32_t channel = p_dl_params->channel;
   bool_t bQuit = NAI_FALSE;
   float64_t floatValue = 0.0;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   naiif_printf("\r\n Enter subchannel to set position for (A or B): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case 'a':
         case 'A':
            naiif_printf("\r\n Enter A-side Position to set: ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if ((!bQuit) && (inputResponseCnt > 0))
            {
               floatValue = atof((char*)inputBuffer);
               if ((floatValue == 0.0) && (inputBuffer[0] != '0'))
               {
                  naiif_printf("\r\nInvalid Position entered!\r\n");
               }
               else
               {
                  check_status(naibrd_DL_SetPosition(cardIndex, module, channel, NAIBRD_DL_SUBCHANNEL_A, floatValue));
               }
            }
         break;
         case 'b':
         case 'B':
            naiif_printf("\r\n Enter B-side Position to set: ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if ((!bQuit) && (inputResponseCnt > 0))
            {
               floatValue = atof((char*)inputBuffer);
               if ((floatValue == 0.0) && (inputBuffer[0] != '0'))
               {
                  naiif_printf("\r\nInvalid Position entered!\r\n");
               }
               else
               {
                  check_status(naibrd_DL_SetPosition(cardIndex, module, channel, NAIBRD_DL_SUBCHANNEL_B, floatValue));
               }
            }
         break;
         default:
            naiif_printf("\r\nInvalid Subchannel entered!\r\n");
         break;
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t DL_BasicMenu_SetConfiguration(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_dl_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_dl_params->cardIndex;
   int32_t module = p_dl_params->module;
   int32_t channel = p_dl_params->channel;
   bool_t bQuit = NAI_FALSE;
   naibrd_dl_configuration_type_t configurationType = NAIBRD_DL_CONFIGURATION_PHASE_OFFSET;
   int value = 0;
   float64_t floatValue = 0.0;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   naiif_printf("\r\n Select Configuration (0 Phase, 1 Wire Mode, 2 VLL Thresh A, 3 VLL Thresh B, 4 Ref Thresh, "\
                 "5 Curr Thresh A, 6 Curr Thresh B, 7 Exp VLL, 8 Exp Ref, 9 VLL Mode): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((bQuit == NAI_FALSE) && (inputResponseCnt > 0))
   {
      configurationType = (naibrd_dl_configuration_type_t)atoi((char*)inputBuffer);
      if ((configurationType == NAIBRD_DL_CONFIGURATION_PHASE_OFFSET) && (inputBuffer[0] != '0'))
      {
         naiif_printf("\r\nInvalid option entered!\r\n");
      }
      else
      {
         switch (configurationType)
         {
            case NAIBRD_DL_CONFIGURATION_PHASE_OFFSET:
               naiif_printf("\r\n Enter Phase Offset value to set: ");
               bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
               if ((!bQuit) && (inputResponseCnt > 0))
               {
                  floatValue = atof((char*)inputBuffer);
                  if ((floatValue == 0.0) && (inputBuffer[0] != '0'))
                  {
                     naiif_printf("\r\nInvalid Phase Offset value entered!\r\n");
                  }
                  else
                  {
                     check_status(naibrd_DL_SetConfigurationValue(cardIndex, module, channel, NAIBRD_DL_CONFIGURATION_PHASE_OFFSET,
                                                                  floatValue));
                  }
               }
            break;
            case NAIBRD_DL_CONFIGURATION_WIRE_MODE:
               naiif_printf("\r\n Enter Wire Mode setting to set (1 for 4-Wire, 2 for 2-Wire): ");
               bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
               if ((!bQuit) && (inputResponseCnt > 0))
               {
                  value = atoi((char*)inputBuffer);
                  switch (value)
                  {
                     case NAIBRD_DL_4WIRE_MODE:
                        check_status(naibrd_DL_SetWireMode(cardIndex, module, channel, NAIBRD_DL_4WIRE_MODE));
                     break;
                     case NAIBRD_DL_2WIRE_MODE:
                        check_status(naibrd_DL_SetWireMode(cardIndex, module, channel, NAIBRD_DL_2WIRE_MODE));
                     break;
                     default:
                        naiif_printf("\r\nInvalid Wire Mode setting entered!\r\n");
                     break;
                  }
               }
            break;
            case NAIBRD_DL_CONFIGURATION_THRESHOLD_VLL_VOLT:
               naiif_printf("\r\n Enter VLL Threshold A-side value to set: ");
               bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
               if ((!bQuit) && (inputResponseCnt > 0))
               {
                  floatValue = atof((char*)inputBuffer);
                  if ((floatValue == 0.0) && (inputBuffer[0] != '0'))
                  {
                     naiif_printf("\r\nInvalid VLL Threshold value entered!\r\n");
                  }
                  else
                  {
                     check_status(naibrd_DL_SetConfigurationValue(cardIndex, module, channel, NAIBRD_DL_CONFIGURATION_THRESHOLD_VLL_VOLT,
                                                                  floatValue));
                  }
               }
            break;
            case NAIBRD_DL_CONFIGURATION_THRESHOLD_VLL_VOLT_SUBCHANNEL_B:
               naiif_printf("\r\n Enter VLL Threshold B-side value to set: ");
               bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
               if ((!bQuit) && (inputResponseCnt > 0))
               {
                  floatValue = atof((char*)inputBuffer);
                  if ((floatValue == 0.0) && (inputBuffer[0] != '0'))
                  {
                     naiif_printf("\r\nInvalid VLL Threshold value entered!\r\n");
                  }
                  else
                  {
                     check_status(naibrd_DL_SetConfigurationValue(cardIndex, module, channel,
                                                                  NAIBRD_DL_CONFIGURATION_THRESHOLD_VLL_VOLT_SUBCHANNEL_B, floatValue));
                  }
               }
            break;
            case NAIBRD_DL_CONFIGURATION_THRESHOLD_REF_VOLT:
               naiif_printf("\r\n Enter Ref Threshold value to set: ");
               bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
               if ((!bQuit) && (inputResponseCnt > 0))
               {
                  floatValue = atof((char*)inputBuffer);
                  if ((floatValue == 0.0) && (inputBuffer[0] != '0'))
                  {
                     naiif_printf("\r\nInvalid Ref Threshold value entered!\r\n");
                  }
                  else
                  {
                     check_status(naibrd_DL_SetConfigurationValue(cardIndex, module, channel, NAIBRD_DL_CONFIGURATION_THRESHOLD_REF_VOLT,
                                                                  floatValue));
                  }
               }
            break;
            case NAIBRD_DL_CONFIGURATION_THRESHOLD_CURRENT_SUBCHANNEL_A:
               naiif_printf("\r\n Enter Current Threshold A-side value to set: ");
               bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
               if ((!bQuit) && (inputResponseCnt > 0))
               {
                  floatValue = atof((char*)inputBuffer);
                  if ((floatValue == 0.0) && (inputBuffer[0] != '0'))
                  {
                     naiif_printf("\r\nInvalid Current Threshold value entered!\r\n");
                  }
                  else
                  {
                     check_status(naibrd_DL_SetConfigurationValue(cardIndex, module, channel,
                                                                  NAIBRD_DL_CONFIGURATION_THRESHOLD_CURRENT_SUBCHANNEL_A, floatValue));
                  }
               }
            break;
            case NAIBRD_DL_CONFIGURATION_THRESHOLD_CURRENT_SUBCHANNEL_B:
               naiif_printf("\r\n Enter Current Threshold B-side value to set: ");
               bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
               if ((!bQuit) && (inputResponseCnt > 0))
               {
                  floatValue = atof((char*)inputBuffer);
                  if ((floatValue == 0.0) && (inputBuffer[0] != '0'))
                  {
                     naiif_printf("\r\nInvalid Current Threshold value entered!\r\n");
                  }
                  else
                  {
                     check_status(naibrd_DL_SetConfigurationValue(cardIndex, module, channel,
                                                                  NAIBRD_DL_CONFIGURATION_THRESHOLD_CURRENT_SUBCHANNEL_B, floatValue));
                  }
               }
            break;
            case 7: /* NAIBRD_DL_CONFIGURATION_VLL_VOLT */
               naiif_printf("\r\n Enter Exp VLL value to set: ");
               bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
               if ((!bQuit) && (inputResponseCnt > 0))
               {
                  floatValue = atof((char*)inputBuffer);
                  if ((floatValue == 0.0) && (inputBuffer[0] != '0'))
                  {
                     naiif_printf("\r\nInvalid Exp VLL value entered!\r\n");
                  }
                  else
                  {
                     check_status(naibrd_DL_SetConfigurationValue(cardIndex, module, channel, NAIBRD_DL_CONFIGURATION_VLL_VOLT,
                                                                  floatValue));
                  }
               }
            break;
            case 8: /* NAIBRD_DL_CONFIGURATION_REF_VOLT */
               naiif_printf("\r\n Enter Exp Ref value to set: ");
               bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
               if ((!bQuit) && (inputResponseCnt > 0))
               {
                  floatValue = atof((char*)inputBuffer);
                  if ((floatValue == 0.0) && (inputBuffer[0] != '0'))
                  {
                     naiif_printf("\r\nInvalid Exp Ref value entered!\r\n");
                  }
                  else
                  {
                     check_status(naibrd_DL_SetConfigurationValue(cardIndex, module, channel, NAIBRD_DL_CONFIGURATION_REF_VOLT,
                                                                  floatValue));
                  }
               }
            break;
            case 9: /* NAIBRD_DL_CONFIGURATION_OUTPUT_MODE */
               naiif_printf("\r\n Enter Ratio/Fixed VLL mode setting to set (0 for Ratio, 1 for Fixed): ");
               bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
               if ((!bQuit) && (inputResponseCnt > 0))
               {
                  value = atoi((char*)inputBuffer);
                  if ((value == 0) && (inputBuffer[0] != '0'))
                  {
                     naiif_printf("\r\nInvalid VLL Mode setting entered!\r\n");
                  }
                  else
                  {
                     switch (value)
                     {
                        case NAIBRD_DL_VLL_MODE_RATIO:
                           check_status(naibrd_DL_SetOutputMode(cardIndex, module, channel, NAIBRD_DL_VLL_MODE_RATIO));
                        break;
                        case NAIBRD_DL_VLL_MODE_FIXED:
                           check_status(naibrd_DL_SetOutputMode(cardIndex, module, channel, NAIBRD_DL_VLL_MODE_FIXED));
                        break;
                        default:
                           naiif_printf("\r\nInvalid VLL Mode setting entered!\r\n");
                        break;
                     }
                  }
               }
            break;
            default:
               naiif_printf("\r\nInvalid Configuration Type entered!\r\n");
            break;
         }
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t DL_BasicMenu_ClearStatus(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = NAI_FALSE;
   p_naiapp_AppParameters_t p_dl_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_dl_params->cardIndex;
   int32_t module = p_dl_params->module;
   int32_t channel = p_dl_params->channel;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   naiif_printf("\r\n Enter Latched Status Type to clear (0 for BIT, 1 for Signal Loss, 2 for Ref Loss, 3 for Phase, 4 for Overcurrent, ");
   naiif_printf("5 for BIT B, 6 for Signal Loss B, 7 to clear all statuses for the channel): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            check_status(naibrd_DL_ClearChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_BIT_LATCHED));
         break;
         case '1':
            check_status(naibrd_DL_ClearChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_SIGNAL_LOSS_LATCHED));
         break;
         case '2':
            check_status(naibrd_DL_ClearChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_REF_LOSS_LATCHED));
         break;
         case '3':
            check_status(naibrd_DL_ClearChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_PLL_LATCHED));
         break;
         case '4':
            check_status(naibrd_DL_ClearChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_OVERCURRENT_LATCHED));
         break;
         case '5':
            check_status(naibrd_DL_ClearChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_BIT_B_LATCHED));
         break;
         case '6':
            check_status(naibrd_DL_ClearChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_SIGNAL_LOSS_B_LATCHED));
         break;
         case '7':
            check_status(naibrd_DL_ClearChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_BIT_LATCHED));
            check_status(naibrd_DL_ClearChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_SIGNAL_LOSS_LATCHED));
            check_status(naibrd_DL_ClearChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_REF_LOSS_LATCHED));
            check_status(naibrd_DL_ClearChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_PLL_LATCHED));
            check_status(naibrd_DL_ClearChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_OVERCURRENT_LATCHED));
            check_status(naibrd_DL_ClearChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_BIT_B_LATCHED));
            check_status(naibrd_DL_ClearChanMappedStatus(cardIndex, module, channel, NAIBRD_DL_CHAN_MAPPED_STATUS_SIGNAL_LOSS_B_LATCHED));
         break;
         default:
            naiif_printf("\r\nInvalid status type entered!\r\n");
         break;
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t DL_BasicMenu_SetTestEnable(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = NAI_FALSE;
   p_naiapp_AppParameters_t p_dl_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_dl_params->cardIndex;
   int32_t module = p_dl_params->module;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   naiif_printf("\r\n Enter Test Type To Enable/Disable (0 for D0 test, 2 for D2 test, 3 for D3 test): ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            naiif_printf("\r\n Do you want to enable or disable the D0 Test? (1 to enable, 0 to disable): ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if ((!bQuit) && (inputResponseCnt > 0))
            {
               switch (inputBuffer[0])
               {
                  case '0':
                     check_status(naibrd_DL_SetTestEnable(cardIndex, module, NAIBRD_DL_D0_TEST, NAI_FALSE));
                  break;
                  case '1':
                     check_status(naibrd_DL_SetTestEnable(cardIndex, module, NAIBRD_DL_D0_TEST, NAI_TRUE));
                  break;
                  default:
                     naiif_printf("\r\nInvalid option entered!\r\n");
                  break;
               }
            }
         break;
         case '2':
            naiif_printf("\r\n Do you want to enable or disable the D2 Test? (1 to enable, 0 to disable): ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if ((!bQuit) && (inputResponseCnt > 0))
            {
               switch (inputBuffer[0])
               {
                  case '0':
                     check_status(naibrd_DL_SetTestEnable(cardIndex, module, NAIBRD_DL_D2_TEST, NAI_FALSE));
                  break;
                  case '1':
                     check_status(naibrd_DL_SetTestEnable(cardIndex, module, NAIBRD_DL_D2_TEST, NAI_TRUE));
                  break;
                  default:
                     naiif_printf("\r\nInvalid option entered!\r\n");
                  break;
               }
            }
         break;
         case '3':
            naiif_printf("\r\n Do you want to enable or disable the D3 Test? (1 to enable, 0 to disable): ");
            bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
            if ((!bQuit) && (inputResponseCnt > 0))
            {
               switch (inputBuffer[0])
               {
                  case '0':
                     check_status(naibrd_DL_SetTestEnable(cardIndex, module, NAIBRD_DL_D3_TEST, NAI_FALSE));
                  break;
                  case '1':
                     check_status(naibrd_DL_SetTestEnable(cardIndex, module, NAIBRD_DL_D3_TEST, NAI_TRUE));
                  break;
                  default:
                     naiif_printf("\r\nInvalid option entered!\r\n");
                  break;
               }
            }
         break;
         default:
            naiif_printf("\r\nInvalid test type entered!\r\n");
         break;
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t DL_BasicMenu_SetD2TestVerifyValue(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_dl_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_dl_params->cardIndex;
   int32_t module = p_dl_params->module;
   bool_t bQuit = NAI_FALSE;
   uint32_t valueToSet = 0u;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   naiif_printf("\r\n Enter Raw Hex D2 Test Verify Value to set: 0x");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      valueToSet = strtoul((const char*)inputBuffer, NULL, 16);
      if (((valueToSet == 0u) && (inputBuffer[0] != '0')) || (inputResponseCnt > 8))
      {
         naiif_printf("\r\nInvalid D2 Test Verify Value entered!\r\n");
      }
      else
      {
         check_status(naibrd_DL_SetD2TestVerifyValue(cardIndex, module, valueToSet));
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t DL_BasicMenu_RunFloatingPointMenu(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = NAI_FALSE;
   bool_t bCmdFound = NAI_FALSE;
   int32_t cmd;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;
   p_naiapp_AppParameters_t p_dl_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_dl_params->cardIndex;
   int32_t module = p_dl_params->module;
   uint32_t modId = p_dl_params->modId;
   int32_t MAX_CHANNELS = naibrd_DL_GetChannelCount(modId);

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   naiapp_utils_LoadParamMenuCommands(DL_FLOATINGPOINTMENU_CMD_COUNT, DL_FloatingPointMenuCmds);
   naiif_printf("\r\n\r\n\r\n\r\n");
   do
   {
      DL_Display_FloatingPointMenu(cardIndex, module, modId);
      naiapp_display_ParamMenuCommands((int8_t*)("DL Floating Point Menu"));
      naiif_printf("\r\n Type command or %c to quit : ", NAI_QUIT_CHAR);
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
      if ((!bQuit) && (inputResponseCnt > 0))
      {
         bCmdFound = naiapp_utils_GetParamMenuCmdNum(inputResponseCnt, inputBuffer, &cmd);
         if (bCmdFound)
         {
            switch (cmd)
            {
               case DL_FLOATINGPOINTMENU_CMD_SET_FLOATING_POINT_ENABLE:
                  DL_FloatingPointMenuCmds[cmd].func(APP_PARAM_COUNT, (int32_t*)p_dl_params);
               break;
               case DL_FLOATINGPOINTMENU_CMD_SET_POSITION_A_SCALE:
               case DL_FLOATINGPOINTMENU_CMD_SET_POSITION_B_SCALE:
               case DL_FLOATINGPOINTMENU_CMD_SET_POSITION_A_OFFSET:
               case DL_FLOATINGPOINTMENU_CMD_SET_POSITION_B_OFFSET:
                  naiapp_query_ChannelNumber(MAX_CHANNELS, 1, &(p_dl_params->channel));
                  DL_FloatingPointMenuCmds[cmd].func(APP_PARAM_COUNT, (int32_t*)p_dl_params);
               break;
            }
         }
      }
   } while (!bQuit);

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static void DL_Display_FloatingPointMenu(int32_t cardIndex, int32_t module, uint32_t modId)
{
   int32_t channel = 0;
   bool_t floatModeEnabled = NAI_FALSE;
   float64_t positionAScale = 0.0;
   float64_t positionBScale = 0.0;
   float64_t positionAOffset = 0.0;
   float64_t positionBOffset = 0.0;
   int32_t MAX_CHANNEL = naibrd_DL_GetChannelCount(modId);

   naiif_printf("\r\n=================================");
   naiif_printf("\r\n====Floating-Point Mode Table====");
   naiif_printf("\r\n=================================\r\n\r\n");

   naiif_printf("%7s%12s %12s %12s %12s\r\n", "", "Position", "Position", "Position", "Position");
   naiif_printf("%7s%12s %12s %12s %12s\r\n", "Chan  ", "A Scale", "B Scale", "A Offset", "B Offset");
   naiif_printf("-----------------------------------------------------------\r\n");
   check_status(naibrd_GetFloatingPointModeEnable(cardIndex, module, &floatModeEnabled));
   for (channel = 1; channel <= MAX_CHANNEL; channel++)
   {
      check_status(naibrd_DL_GetFloatingPointAttributes(cardIndex, module, channel, NAIBRD_DL_FLOATING_POINT_POSITION_A_SCALE,
                                                        &positionAScale));
      check_status(naibrd_DL_GetFloatingPointAttributes(cardIndex, module, channel, NAIBRD_DL_FLOATING_POINT_POSITION_B_SCALE,
                                                        &positionBScale));
      check_status(naibrd_DL_GetFloatingPointAttributes(cardIndex, module, channel, NAIBRD_DL_FLOATING_POINT_POSITION_A_OFFSET,
                                                        &positionAOffset));
      check_status(naibrd_DL_GetFloatingPointAttributes(cardIndex, module, channel, NAIBRD_DL_FLOATING_POINT_POSITION_B_OFFSET,
                                                        &positionBOffset));
      naiif_printf("%3d    %12.4f %12.4f %12.4f %12.4f\r\n", channel, positionAScale, positionBScale, positionAOffset, positionBOffset);
   }

   naiif_printf("\r\nFloating-Point Mode Enable: ");
   switch (floatModeEnabled)
   {
      case NAI_TRUE:
         naiif_printf("%8s", "ENABLED");
      break;
      case NAI_FALSE:
         naiif_printf("%9s", "DISABLED");
      break;
      default:
         naiif_printf("%8s", "UNKNOWN");
      break;
   }
   naiif_printf("\r\n");
}

static nai_status_t DL_FloatingPointMenu_SetFloatingPointEnable(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = NAI_FALSE;
   p_naiapp_AppParameters_t p_dl_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_dl_params->cardIndex;
   int32_t module = p_dl_params->module;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   naiif_printf("\r\n Type 1 to enable or 0 to disable floating-point mode: ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      switch (inputBuffer[0])
      {
         case '0':
            check_status(naibrd_SetFloatingPointModeEnable(cardIndex, module, NAI_FALSE));
         break;
         case '1':
            check_status(naibrd_SetFloatingPointModeEnable(cardIndex, module, NAI_TRUE));
         break;
         default:
            naiif_printf("\r\nInvalid option entered!\r\n");
         break;
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t DL_FloatingPointMenu_SetPositionAScale(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_dl_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_dl_params->cardIndex;
   int32_t module = p_dl_params->module;
   int32_t channel = p_dl_params->channel;
   bool_t bQuit = NAI_FALSE;
   float64_t floatValue = 0.0;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   naiif_printf("\r\n Enter A-side Floating-Point Position Scale to set: ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      floatValue = atof((char*)inputBuffer);
      if ((floatValue == 0.0) && (inputBuffer[0] != '0'))
      {
         naiif_printf("\r\nInvalid Position Scale entered!\r\n");
      }
      else
      {
         check_status(naibrd_DL_SetFloatingPointAttributes(cardIndex, module, channel, NAIBRD_DL_FLOATING_POINT_POSITION_A_SCALE,
                                                           floatValue));
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t DL_FloatingPointMenu_SetPositionBScale(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_dl_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_dl_params->cardIndex;
   int32_t module = p_dl_params->module;
   int32_t channel = p_dl_params->channel;
   bool_t bQuit = NAI_FALSE;
   float64_t floatValue = 0.0;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   naiif_printf("\r\n Enter B-side Floating-Point Position Scale to set: ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      floatValue = atof((char*)inputBuffer);
      if ((floatValue == 0.0) && (inputBuffer[0] != '0'))
      {
         naiif_printf("\r\nInvalid Position Scale entered!\r\n");
      }
      else
      {
         check_status(naibrd_DL_SetFloatingPointAttributes(cardIndex, module, channel, NAIBRD_DL_FLOATING_POINT_POSITION_B_SCALE,
                                                           floatValue));
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t DL_FloatingPointMenu_SetPositionAOffset(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_dl_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_dl_params->cardIndex;
   int32_t module = p_dl_params->module;
   int32_t channel = p_dl_params->channel;
   bool_t bQuit = NAI_FALSE;
   float64_t floatValue = 0.0;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   naiif_printf("\r\n Enter A-side Floating-Point Position Offset to set: ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      floatValue = atof((char*)inputBuffer);
      if ((floatValue == 0.0) && (inputBuffer[0] != '0'))
      {
         naiif_printf("\r\nInvalid Position Offset entered!\r\n");
      }
      else
      {
         check_status(naibrd_DL_SetFloatingPointAttributes(cardIndex, module, channel, NAIBRD_DL_FLOATING_POINT_POSITION_A_OFFSET,
                                                           floatValue));
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

static nai_status_t DL_FloatingPointMenu_SetPositionBOffset(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_dl_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_dl_params->cardIndex;
   int32_t module = p_dl_params->module;
   int32_t channel = p_dl_params->channel;
   bool_t bQuit = NAI_FALSE;
   float64_t floatValue = 0.0;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   naiif_printf("\r\n Enter B-side Floating-Point Position Offset to set: ");
   bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   if ((!bQuit) && (inputResponseCnt > 0))
   {
      floatValue = atof((char*)inputBuffer);
      if ((floatValue == 0.0) && (inputBuffer[0] != '0'))
      {
         naiif_printf("\r\nInvalid Position Offset entered!\r\n");
      }
      else
      {
         check_status(naibrd_DL_SetFloatingPointAttributes(cardIndex, module, channel, NAIBRD_DL_FLOATING_POINT_POSITION_B_OFFSET,
                                                           floatValue));
      }
   }

   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

Help Bot

X