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

IOCT BasicOps

IOCT BasicOps

Explanation

About the Sample Application Code

This application showcases how to use North Atlantic Industries' (NAI) System Solution Kit (SSK) to interface with their embedded function modules, specifically the IOCT modules. The program provides various functionalities to configure and interact with the IOCT modules.

Header Files Standard Includes - stdio.h, stdlib.h, string.h, time.h, ctype.h: Standard C libraries for input/output, memory allocation, strings, time handling, and character manipulation functions.

Application-Specific Includes - naiapp_boardaccess_menu.h, naiapp_boardaccess_query.h, naiapp_boardaccess_access.h, naiapp_boardaccess_display.h, naiapp_boardaccess_utils.h: These headers include functions and data structures for accessing the NAI board and its attached modules, displaying information, and utility functions. - nai.h, naibrd.h, naibrd_ioct.h, nai_ether_adv.h, nai_ioct_utils.h: Headers providing definitions and functions at the NAI board and module level, including specific operations for IOCT modules.

Main Constants and Function Prototypes

Constants - CONFIG_FILE: A constant string containing the default configuration file name for IOCT Basic Operations.

Function Prototypes - IOCTBasicOpsMenu_run: Drives the menu for IOCT basic operations. - Various function prototypes for handling IOCT commands, such as setting master/slave modes, loopback, transmit/receive data, and checking status.

Enumerations and Command Tables

Enumerations - ioct_BasicOpsMenu_commands: Enumerates the various command IDs for the available operations in the IOCT menu.

Command Tables - IOCT_PE_BasicOpMenuCmds, IOCT_SC4_BasicOpMenuCmds: Arrays holding command table parameters for different module configurations. Each entry specifies a command name, description, command ID, and the associated function.

Main Function The main function of the program drives the overall execution flow. It initializes and configures the system, queries user input, and responds by calling the appropriate IOCT menu functions.

Steps in the Main Function: 1. Configuration and Menu Setup: Calls naiapp_RunBoardMenu with CONFIG_FILE to set up the board. 2. User Interaction Loop: Continuously queries the user for the card and module indices via naiapp_query_CardIndex and naiapp_query_ModuleNumber. 3. Module Configuration and Execution: Upon user selection, retrieves the module ID and runs IOCTBasicOpsMenu_run to handle further user commands. 4. Exit Mechanism: Allows the user to exit the program by typing 'Q' or the Enter key, then closes all open cards.

Key Functions

IOCTBasicOpsMenu_run - Manages channel configuration and command handling for user interactions. - Loads parameter menu commands and queries the user for command inputs, processing them accordingly.

IOCT Command Functions - IOCTBasicOpsMenu_commandCfg: Displays the contents in the command register for the module. - IOCTBasicOpsMenu_setMaster, IOCTBasicOpsMenu_setSlave: Configure the IOCT channel for Master or Slave mode. - IOCTBasicOpsMenu_setLoopback: Enables or disables loopback mode on the IOCT channel. - IOCTBasicOpsMenu_xmit, IOCTBasicOpsMenu_recv: Handle data transmission and reception for the IOCT channel. - IOCTBasicOpsMenu_status, IOCTBasicOpsMenu_interruptstatus: Display the IOCT channel’s status, including interrupt status. - IOCTBasicOpsMenu_clrinterruptstatus: Clears selected interrupt statuses based on user input. - IOCTBasicOpsMenu_reset: Resets the IOCT channel. - IOCTBasicOpsMenu_clearTxFifo, IOCTBasicOpsMenu_TxFifoCnt, IOCTBasicOpsMenu_RxFifoCnt: Manage and query the transmit and receive FIFOs on the IOCT channel.

System Configuration Functions Not directly shown in the example, but referenced in the comments, are critical routines from nai_sys_cfg.c that assist in setting up the environment: - ConfigDevice, DisplayDeviceCfg, GetBoardSNModCfg, CheckModule: Perform device configuration, display settings, retrieve board and module configurations, and validate module configurations.

The complete setup and interaction through these functions give the user control over various operations related to the IOCT modules in an organized and structured manner.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <ctype.h>

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

/* naibrd include files */
#include "nai.h"
#include "naibrd.h"
#include "functions/naibrd_ioct.h"
#include "advanced/nai_ether_adv.h"

#include "nai_ioct_utils.h"

static const int8_t *CONFIG_FILE = (const int8_t *)"default_IOCT_BasicOps.txt";

/* Function prototypes */
static bool_t IOCTBasicOpsMenu_run(int32_t cardIndex, int32_t module, uint32_t modid);

/* IOCT Command Functions */
static nai_status_t IOCTBasicOpsMenu_commandCfg(int32_t paramCount, int32_t* p_params);
static nai_status_t IOCTBasicOpsMenu_setMaster(int32_t paramCount, int32_t* p_params);
static nai_status_t IOCTBasicOpsMenu_setSlave(int32_t paramCount, int32_t* p_params);
static nai_status_t IOCTBasicOpsMenu_setLoopback(int32_t paramCount, int32_t* p_params);
static nai_status_t IOCTBasicOpsMenu_xmit(int32_t paramCount, int32_t* p_params);
static nai_status_t IOCTBasicOpsMenu_recv(int32_t paramCount, int32_t* p_params);
static nai_status_t IOCTBasicOpsMenu_status(int32_t paramCount, int32_t* p_params);
static nai_status_t IOCTBasicOpsMenu_interruptstatus(int32_t paramCount, int32_t* p_params);
static nai_status_t IOCTBasicOpsMenu_clrinterruptstatus(int32_t paramCount, int32_t* p_params);
static nai_status_t IOCTBasicOpsMenu_reset(int32_t paramCount, int32_t* p_params);
static nai_status_t IOCTBasicOpsMenu_clearTxFifo(int32_t paramCount, int32_t* p_params);
static nai_status_t IOCTBasicOpsMenu_TxFifoCnt(int32_t paramCount, int32_t* p_params);
static nai_status_t IOCTBasicOpsMenu_RxFifoCnt(int32_t paramCount, int32_t* p_params);

/****** Command Table *******/
/* Invariant: enumeration of cmd table starts from 0 and increments by 1 */
enum ioct_BasicOpsMenu_commands
{
   IOCT_BASICOPS_CMD_MASTER,
   IOCT_BASICOPS_CMD_SLAVE,
   IOCT_BASICOPS_CMD_LOOPBACK,
   IOCT_BASICOPS_CMD_XMIT,
   IOCT_BASICOPS_CMD_RECV,
   IOCT_BASICOPS_CMD_STATUS,
   IOCT_BASICOPS_CMD_INTSTATUS,
   IOCT_BASICOPS_CMD_RESET,
   IOCT_BASICOPS_CMD_CLEAR_TX_FIFO,
   IOCT_BASICOPS_CMD_TX_FIFO_CNT,
   IOCT_BASICOPS_CMD_RX_FIFO_CNT,
   IOCT_BASICOPS_CMD_COMMAND_CFG,
   IOCT_BASICOPS_CMD_COUNT
};

naiapp_cmdtbl_params_t IOCT_PE_BasicOpMenuCmds[] = {
   {"Master",     "Set Master Mode",        IOCT_BASICOPS_CMD_MASTER,            IOCTBasicOpsMenu_setMaster},
   {"SLave",      "Set Slave Mode",         IOCT_BASICOPS_CMD_SLAVE,             IOCTBasicOpsMenu_setSlave},
   {"Loopback",   "Loopback Mode",          IOCT_BASICOPS_CMD_LOOPBACK,          IOCTBasicOpsMenu_setLoopback},
   {"Xmt",        "Transmit Data",          IOCT_BASICOPS_CMD_XMIT,              IOCTBasicOpsMenu_xmit},
   {"RCv",        "Receive Data",           IOCT_BASICOPS_CMD_RECV,              IOCTBasicOpsMenu_recv},
   {"STatus",     "IOCT Status",            IOCT_BASICOPS_CMD_STATUS,            IOCTBasicOpsMenu_status},
   {"IntStat",    "Interrupt Status",       IOCT_BASICOPS_CMD_INTSTATUS,         IOCTBasicOpsMenu_interruptstatus},
   {"CLRStat",    "Interrupt Status",       IOCT_BASICOPS_CMD_INTSTATUS,         IOCTBasicOpsMenu_clrinterruptstatus},
   {"REset",      "Reset Channel",          IOCT_BASICOPS_CMD_RESET,             IOCTBasicOpsMenu_reset},
   {"CLRTx",      "Clear Tx Fifo",          IOCT_BASICOPS_CMD_CLEAR_TX_FIFO,     IOCTBasicOpsMenu_clearTxFifo},
   {"TXCnt",      "Tx Fifo Count",          IOCT_BASICOPS_CMD_TX_FIFO_CNT,       IOCTBasicOpsMenu_TxFifoCnt},
   {"RXCnt",      "Rx Fifo Count",          IOCT_BASICOPS_CMD_RX_FIFO_CNT,       IOCTBasicOpsMenu_RxFifoCnt},
   {"CMd",        "Display Command",        IOCT_BASICOPS_CMD_COMMAND_CFG,       IOCTBasicOpsMenu_commandCfg},
};

/* Note, SC4 cannot be configured as a Slave */
naiapp_cmdtbl_params_t IOCT_SC4_BasicOpMenuCmds[] = {
   {"Master",     "Set Master Mode",        IOCT_BASICOPS_CMD_MASTER,            IOCTBasicOpsMenu_setMaster},
   {"Loopback",   "Loopback Mode",          IOCT_BASICOPS_CMD_LOOPBACK,          IOCTBasicOpsMenu_setLoopback},
   {"Xmt",        "Transmit Data",          IOCT_BASICOPS_CMD_XMIT,              IOCTBasicOpsMenu_xmit},
   {"RCv",        "Receive Data",           IOCT_BASICOPS_CMD_RECV,              IOCTBasicOpsMenu_recv},
   {"STatus",     "IOCT Status",            IOCT_BASICOPS_CMD_STATUS,            IOCTBasicOpsMenu_status},
   {"IntStat",    "Interrupt Status",       IOCT_BASICOPS_CMD_INTSTATUS,         IOCTBasicOpsMenu_interruptstatus},
   {"CLRStat",    "Interrupt Status",       IOCT_BASICOPS_CMD_INTSTATUS,         IOCTBasicOpsMenu_clrinterruptstatus},
   {"REset",      "Reset Channel",          IOCT_BASICOPS_CMD_RESET,             IOCTBasicOpsMenu_reset},
   {"CLRTx",      "Clear Tx Fifo",          IOCT_BASICOPS_CMD_CLEAR_TX_FIFO,     IOCTBasicOpsMenu_clearTxFifo},
   {"TXCnt",      "Tx Fifo Count",          IOCT_BASICOPS_CMD_TX_FIFO_CNT,       IOCTBasicOpsMenu_TxFifoCnt},
   {"RXCnt",      "Rx Fifo Count",          IOCT_BASICOPS_CMD_RX_FIFO_CNT,       IOCTBasicOpsMenu_RxFifoCnt},
   {"CMd",        "Display Command",        IOCT_BASICOPS_CMD_COMMAND_CFG,       IOCTBasicOpsMenu_commandCfg},
};

static uint32_t ioct_modid = 0;

/*****************************************************************************/
/**
<summary>
The purpose of the IOCT_BasicOpsMenu is to illustrate the methods to call in the
naibrd library to perform basic operations with the IOCT modules for
configuration setup and reading the channels.

The following system configuration routines from the nai_sys_cfg.c file are
called to assist with the configuration setup for this program prior to
calling the naibrd IOCT routines.
 - ConfigDevice
 - DisplayDeviceCfg
 - GetBoardSNModCfg
 - CheckModule
</summary>
*/
/*****************************************************************************/
#if defined (__VXWORKS__)
int32_t IOCT_BasicOpsMenu(void)
#else
int32_t main(void)
#endif
{
   bool_t stop = 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) == TRUE)
   {
      while (stop != TRUE)
      {
         /* Query the user for the card index */
         stop = naiapp_query_CardIndex(naiapp_GetBoardCnt(), 0, &cardIndex);
         if (stop != TRUE)
         {
            check_status(naibrd_GetModuleCount(cardIndex, &moduleCnt));

            /* Query the user for the module number */
            stop = naiapp_query_ModuleNumber(moduleCnt, 1, &module);
            if (stop != TRUE)
            {
               moduleID = naibrd_GetModuleID(cardIndex, module);
               if ((moduleID != 0))
               {
                  IOCTBasicOpsMenu_run(cardIndex, module, moduleID);
               }
            }
         }

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

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

   return 0;
}

/*****************************************************************************/
/**
<summary>
IOCTBasicOpsMenu_run illustrates the channel configuration and prepares the menu
which will handle user command requests. Returns TRUE if the user enters
the Quit Command at any point within its scope.
</summary>
*/
/*****************************************************************************/
static bool_t IOCTBasicOpsMenu_run(int32_t cardIndex, int32_t module, uint32_t modid)
{
   bool_t bQuit = FALSE;
   int8_t inputBuffer[80];
   int32_t inputResponseCnt;

   /* int32_t MAX_CHANNELS = naibrd_IOCT_GetChannelCount(modid); */

   ioct_modid = modid;
   if (ioct_modid == NAI_MODULE_ID_SC4)
      naiapp_utils_LoadParamMenuCommands(IOCT_BASICOPS_CMD_COUNT, IOCT_SC4_BasicOpMenuCmds);
   else
      naiapp_utils_LoadParamMenuCommands(IOCT_BASICOPS_CMD_COUNT, IOCT_PE_BasicOpMenuCmds);
   DisplayIOCTConfigurations(cardIndex, module, modid);
   do
   {
      naiapp_display_ParamMenuCommands((int8_t*)"MENU_TITLE");
      bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
   } while (!bQuit);
   return bQuit;
}

/*****************************************************************************/
/**
<summary>
IOCTBasicOpsMenu_commandCfg displays the contents in the command register.
</summary>
*/
/*****************************************************************************/
static nai_status_t IOCTBasicOpsMenu_commandCfg(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_ioct_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_ioct_params->cardIndex;
   int32_t module = p_ioct_params->module;
#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif
   DisplayIOCTConfigurations(cardIndex, module, ioct_modid);
   return NAI_ERROR_UNKNOWN;
}

/*****************************************************************************/
/**
<summary>
IOCTBasicOpsMenu_setMaster calls CfgForMaster to configure IOCT channel for
Master mode.
</summary>
*/
/*****************************************************************************/
static nai_status_t IOCTBasicOpsMenu_setMaster(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_ioct_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_ioct_params->cardIndex;
   int32_t module = p_ioct_params->module;
   int32_t channel = p_ioct_params->channel;
#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   CfgForIOCTMaster(cardIndex, module, channel, ioct_modid);
   DisplayIOCTConfigurations(cardIndex, module, ioct_modid);
   return NAI_ERROR_UNKNOWN;
}

/*****************************************************************************/
/**
<summary>
IOCTBasicOpsMenu_setSlave calls CfgForMaster to configure IOCT channel for
Slave mode.
</summary>
*/
/*****************************************************************************/
static nai_status_t IOCTBasicOpsMenu_setSlave(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_ioct_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_ioct_params->cardIndex;
   int32_t module = p_ioct_params->module;
   int32_t channel = p_ioct_params->channel;
#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   CfgForIOCTSlave(cardIndex, module, channel, ioct_modid);
   DisplayIOCTConfigurations(cardIndex, module, ioct_modid);
   return NAI_ERROR_UNKNOWN;
}

/*****************************************************************************/
/**
<summary>
IOCTBasicOpsMenu_setLoopback calls CfgForIOCTLoopback to query the user on
whether to enable or disable IOCT loopback.
</summary>
*/
/*****************************************************************************/
static nai_status_t IOCTBasicOpsMenu_setLoopback(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   bool_t loopbackEnabled = FALSE;
   p_naiapp_AppParameters_t p_ioct_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_ioct_params->cardIndex;
   int32_t module = p_ioct_params->module;
   int32_t channel = p_ioct_params->channel;
#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   bQuit = CfgForIOCTLoopback(cardIndex, module, channel, &loopbackEnabled);
   if (!bQuit)
   {
      DisplayIOCTConfigurations(cardIndex, module, ioct_modid);
   }
   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

/*****************************************************************************/
/**
<summary>
IOCTBasicOpsMenu_xmit handles the user request to transmit data from the IOCT
channel.
</summary>
*/
/*****************************************************************************/
static nai_status_t IOCTBasicOpsMenu_xmit(int32_t paramCount, int32_t* p_params)
{
   bool_t bQuit = FALSE;
   bool_t bGenRandomData = FALSE;
   int32_t datacnt = 0;
   p_naiapp_AppParameters_t p_ioct_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_ioct_params->cardIndex;
   int32_t module = p_ioct_params->module;
   int32_t channel = p_ioct_params->channel;

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

   bQuit = QueryForIOCTXmitDataCount(&datacnt, &bGenRandomData);
   if (!bQuit)
   {
      InitializeDataForIOCTXmit(datacnt, bGenRandomData);
      IOCTXmit(cardIndex, module, channel, datacnt);
   }
   return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}

/*****************************************************************************/
/**
<summary>
IOCTBasicOpsMenu_recv handles the user request to read the data received on
the IOCT channel.
</summary>
*/
/*****************************************************************************/
static nai_status_t IOCTBasicOpsMenu_recv(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_ioct_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_ioct_params->cardIndex;
   int32_t module = p_ioct_params->module;
   int32_t channel = p_ioct_params->channel;
#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif

   IOCTRecv(cardIndex, module, channel);
   return NAI_ERROR_UNKNOWN;
}

/*****************************************************************************/
/**
<summary>
IOCTBasicOpsMenu_status handles showing the status information for the IOCT channel.
</summary>
*/
/*****************************************************************************/
static nai_status_t IOCTBasicOpsMenu_status(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_ioct_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_ioct_params->cardIndex;
   int32_t module = p_ioct_params->module;
#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif
   DisplayIOCTStatus(cardIndex, module, ioct_modid);
   return NAI_ERROR_UNKNOWN;
}

/*****************************************************************************/
/**
<summary>
IOCTBasicOpsMenu_interruptstatus handles showing the status information for the IOCT channel.
</summary>
*/
/*****************************************************************************/
static nai_status_t IOCTBasicOpsMenu_interruptstatus(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_ioct_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_ioct_params->cardIndex;
   int32_t module = p_ioct_params->module;
#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif
   DisplayIOCTInterruptStatus(cardIndex, module, ioct_modid);
   return NAI_ERROR_UNKNOWN;
}

/*****************************************************************************/
/**
<summary>
IOCTBasicOpsMenu_clrinterruptstatus handles queries the user on which interrupt
status to clear.
</summary>
*/
/*****************************************************************************/
static nai_status_t IOCTBasicOpsMenu_clrinterruptstatus(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_ioct_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_ioct_params->cardIndex;
   int32_t module = p_ioct_params->module;
#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif
   DisplayIOCTInterruptStatus(cardIndex, module, ioct_modid);
   QueryForIntStatusClr(ioct_modid, cardIndex, module);
   return NAI_ERROR_UNKNOWN;
}

/*****************************************************************************/
/**
<summary>
IOCTBasicOpsMenu_reset calls IOCTResetChannel to reset the IOCT channel.
</summary>
*/
/*****************************************************************************/
static nai_status_t IOCTBasicOpsMenu_reset(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_ioct_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_ioct_params->cardIndex;
   int32_t module = p_ioct_params->module;
   int32_t channel = p_ioct_params->channel;
#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif
   IOCTResetChannel(cardIndex, module, channel);
   return NAI_ERROR_UNKNOWN;
}

/*****************************************************************************/
/**
<summary>
IOCTBasicOpsMenu_clearTxFifo calls IOCTClearTxFifo to clear the Tx FIFO on
the IOCT channel.
</summary>
*/
/*****************************************************************************/
static nai_status_t IOCTBasicOpsMenu_clearTxFifo(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_ioct_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_ioct_params->cardIndex;
   int32_t module = p_ioct_params->module;
   int32_t channel = p_ioct_params->channel;
#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif
   IOCTClearTxFifo(cardIndex, module, channel);
   return NAI_ERROR_UNKNOWN;
}

/*****************************************************************************/
/**
<summary>
IOCTBasicOpsMenu_TxFifoCnt retrieves the number of elements in the Tx FIFO on
the IOCT channel.
</summary>
*/
/*****************************************************************************/
static nai_status_t IOCTBasicOpsMenu_TxFifoCnt(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_ioct_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_ioct_params->cardIndex;
   int32_t module = p_ioct_params->module;
   int32_t channel = p_ioct_params->channel;
   uint32_t fifocount;
#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif
   check_status(naibrd_IOCT_GetFIFOCount(cardIndex, module, channel, NAI_IOCT_TX_FIFO, &fifocount));
   printf("Tx FIFO Element Count = %d\n", fifocount);
   return NAI_ERROR_UNKNOWN;
}

/*****************************************************************************/
/**
<summary>
IOCTBasicOpsMenu_RxFifoCnt retrieves the number of elements in the Rx FIFO on
the IOCT channel.
</summary>
*/
/*****************************************************************************/
static nai_status_t IOCTBasicOpsMenu_RxFifoCnt(int32_t paramCount, int32_t* p_params)
{
   p_naiapp_AppParameters_t p_ioct_params = (p_naiapp_AppParameters_t)p_params;
   int32_t cardIndex = p_ioct_params->cardIndex;
   int32_t module = p_ioct_params->module;
   int32_t channel = p_ioct_params->channel;
   uint32_t fifocount;
#if defined (WIN32)
   UNREFERENCED_PARAMETER(paramCount);
#endif
   check_status(naibrd_IOCT_GetFIFOCount(cardIndex, module, channel, NAI_IOCT_RX_FIFO, &fifocount));
   printf("Rx FIFO Element Count = %d\n", fifocount);
   return NAI_ERROR_UNKNOWN;
}

Help Bot

X