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

nai dsw cfg

nai dsw cfg

Explanation

About the Sample Application Code

This sample C program is designed for interacting with embedded function modules using the Software Support Kit (SSK) provided by North Atlantic Industries (NAI). The code demonstrates an example of initializing configurations for Data Switch (DSW) modules.

File Inclusions

The program begins with the inclusion of standard C libraries, followed by specific header files provided by NAI. These headers contain functions, macros, and definitions needed to interact with NAI’s embedded function modules.

Standard Libraries

  • <stdio.h>: Standard Input/Output library for functions like printf.

  • <ctype.h>: Character handling functions library.

  • <stdlib.h>: Standard library functions like memory allocation.

  • <string.h>: String manipulation functions.

NAI Common Sample Program Include Files

  • "include/naiapp_interrupt.h": Functions and macros for handling interrupts.

  • "include/naiapp_interrupt_ether.h": Ethernet specific interrupt handling.

  • "include/naiapp_boardaccess_menu.h": Functions and definitions for menu-based board access.

  • "include/naiapp_boardaccess_query.h": Functions for querying board status.

  • "include/naiapp_boardaccess_access.h": General access functions for the board.

  • "include/naiapp_boardaccess_display.h": Display utilities for board information.

  • "include/naiapp_boardaccess_utils.h": Auxiliary utilities for board access.

NAI Common DSW Sample Program Include Files

  • "nai_dsw_cfg.h": Configuration parameters for DSW modules.

  • "nai_dsw_int.h": Internal functionalities for DSW modules.

NAI Board Include Files

  • "nai.h": Generic NAI functionalities.

  • "naibrd.h": Board-specific functionalities.

  • "functions/naibrd_dsw.h": Specific functions for DSW modules.

Function: initializeDSWConfigurations

This function is defined to initialize configurations for a DSW module. Below is a breakdown of its components:

Parameters

  • int32_t cardIndex: Index of the card.

  • int32_t module: Module identifier.

  • int32_t modid: Module ID.

  • int32_t channel: Current channel in use.

  • int32_t maxChannel: Maximum channel allowed.

  • int32_t minChannel: Minimum channel allowed.

Body of the Function

The function assigns given parameter values to the inputDSWConfig structure’s members. This prepares the configuration parameters that will be used by other parts of the program to correctly interact with the DSW module.

void initializeDSWConfigurations(int32_t cardIndex, int32_t module, int32_t modid, int32_t channel, int32_t maxChannel, int32_t minChannel)
{
   inputDSWConfig.cardIndex = cardIndex;
   inputDSWConfig.module = module;
   inputDSWConfig.modid = modid;
   inputDSWConfig.channel = channel;
   inputDSWConfig.maxChannel = maxChannel;
   inputDSWConfig.minChannel = minChannel;
}

Summary

This sample code provides a foundation for initializing and configuring DSW modules within an NAI card environment by harnessing a variety of helper functions, definitions, and structures provided in the included libraries. The initializeDSWConfigurations function exemplifies how configuration parameters are set up, which is a crucial step for subsequent module operations.

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

/* Common Sample Program include files */
#include "include/naiapp_interrupt.h"
#include "include/naiapp_interrupt_ether.h"
#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"

/* Common DSW Sample Program include files */
#include "nai_dsw_cfg.h"
#include "nai_dsw_int.h"
/* naibrd include files */
#include "nai.h"
#include "naibrd.h"
#include "functions/naibrd_dsw.h"

/**************************************************************************************************************/
/**
<summary>

</summary>
*/
/**************************************************************************************************************/
void initializeDSWConfigurations(int32_t cardIndex, int32_t module, int32_t modid, int32_t channel, int32_t maxChannel, int32_t minChannel)
{
   inputDSWConfig.cardIndex = cardIndex;
   inputDSWConfig.module = module;
   inputDSWConfig.modid = modid;
   inputDSWConfig.channel = channel;
   inputDSWConfig.maxChannel = maxChannel;
   inputDSWConfig.minChannel = minChannel;

}

Help Bot

X