⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 niscope.h

📁 此为某测试平台的上位机软件部分
💻 H
📖 第 1 页 / 共 5 页
字号:
/****************************************************************************
 *                                niScope                                   *
 *--------------------------------------------------------------------------*
 *      Copyright (c) National Instruments 2004.  All Rights Reserved.      *
 *--------------------------------------------------------------------------*
 *                                                                          *
 * Title:    niScope.h                                                      *
 * Purpose:  niScope                                                        *
 *           instrument driver declarations.                                *
 *                                                                          *
 ****************************************************************************/

#ifndef __NISCOPE_HEADER
#define __NISCOPE_HEADER


#if defined(LONG_MAX) && (LONG_MAX > 0x7FFFFFFFL)
typedef unsigned int        ViUInt32;
typedef int      ViInt32;
#else
typedef unsigned long       ViUInt32;
typedef long     ViInt32;
#endif

typedef ViUInt32    ViPUInt32;
typedef ViUInt32    ViAUInt32;
typedef ViInt32     ViPInt32;
typedef ViInt32     ViAInt32;

typedef unsigned short      ViUInt16;
typedef ViUInt16    ViPUInt16;
typedef ViUInt16    ViAUInt16;

typedef short    ViInt16;
typedef ViInt16     ViPInt16;
typedef ViInt16     ViAInt16;

typedef unsigned char       ViUInt8;
typedef ViUInt8     ViPUInt8;
typedef ViUInt8     ViAUInt8;

typedef char     ViInt8;
typedef ViInt8      ViPInt8;
typedef ViInt8      ViAInt8;

typedef char        ViChar;
typedef ViChar      ViPChar;
typedef ViChar      ViAChar;

typedef unsigned char       ViByte;
typedef ViByte      ViPByte;
typedef ViByte      ViAByte;

typedef void        ViAddr;
typedef ViAddr      ViPAddr;
typedef ViAddr      ViAAddr;

typedef float       ViReal32;
typedef ViReal32    ViPReal32;
typedef ViReal32    ViAReal32;

typedef double      ViReal64;
typedef ViReal64    ViPReal64;
typedef ViReal64    ViAReal64;

typedef ViPByte             ViBuf;
typedef ViPByte             ViPBuf;
typedef ViPByte     ViABuf;

typedef ViPChar             ViString;
typedef ViPChar             ViPString;
typedef ViPChar     ViAString;

typedef char*            ViRsrc;
typedef ViString            ViPRsrc;
typedef ViString    ViARsrc;

typedef ViUInt16            ViBoolean;
typedef ViBoolean   ViPBoolean;
typedef ViBoolean   ViABoolean;

typedef ViInt32             ViStatus;
typedef ViStatus    ViPStatus;
typedef ViStatus    ViAStatus;

typedef ViUInt32            ViVersion;
typedef ViVersion   ViPVersion;
typedef ViVersion   ViAVersion;

typedef ViUInt32            ViObject;
typedef ViObject    ViPObject;
typedef ViObject    ViAObject;

typedef ViObject            ViSession;
typedef ViSession    ViPSession;
typedef ViSession    ViASession;

typedef ViUInt32             ViAttr;

//#ifndef _VI_CONST_STRING_DEFINED
typedef const ViChar * ViConstString;
//#define _VI_CONST_STRING_DEFINED
//#endif  

#include "ivi.h"
//#include "IviScope.h"
#include <string.h>

#if defined(__cplusplus) || defined(__cplusplus__)
extern "C" {
#endif

/* Pragma used in CVI to indicate that functions in this file have 
 * user protection associated with them */
#ifdef _CVI_
 #pragma EnableLibraryRuntimeChecking
#endif
/****************************************************************************
 *----------------- Instrument Driver Revision Information -----------------*
 ****************************************************************************/
#define NISCOPE_MAJOR_VERSION         3     /* Instrument driver major version */
#define NISCOPE_MINOR_VERSION         200   /* Instrument driver minor version */

/****************************************************************************
 *---------------------- Useful Macros and Defines -------------------------*
 ****************************************************************************/
/* Maximum length of a niscope function name */
#define MAX_FUNCTION_NAME_SIZE      55
/* Maximum size of an error message returned from niScope_errorHandler */
#define MAX_ERROR_DESCRIPTION       (IVI_MAX_MESSAGE_BUF_SIZE * 2 + MAX_FUNCTION_NAME_SIZE + 75)

/* This macro handles all errors and warnings returned from NI SCOPE.
   It requires two variables be declared:
      ViStatus error
      ViChar errorSource[MAX_FUNCTION_NAME_SIZE]
   and a line marked "Error:" that marks the beginning of cleanup code.
   If a function returns an error code, "error" is set to the error code
   and "errorSource" is set to the calling function's name, and execution
   skips to the "Error:" line.  Otherwise, "error" and "errorSource" store
   the location of warnings that occur, and execution proceeds normally.    */
#define handleErr(fCall) { int code = (fCall);                      \
        if (code < 0) {                                             \
           error = code;                                            \
           strncpy( errorSource, #fCall, MAX_FUNCTION_NAME_SIZE );  \
           errorSource[MAX_FUNCTION_NAME_SIZE - 1] = '\0';          \
           strcpy( errorSource, strtok( errorSource, " (") );       \
           goto Error; }                                            \
        else if ((error == 0) && (code > 0)) {                      \
           error = code;                                            \
           strncpy( errorSource, #fCall, MAX_FUNCTION_NAME_SIZE );  \
           errorSource[MAX_FUNCTION_NAME_SIZE - 1] = '\0';          \
           strcpy( errorSource, strtok( errorSource, " (") ); } }

/* Use this macro to set a customized error elaboration for a particular function
   call.  The overwrite parameter in Ivi_SetErrorInfo is set to VI_TRUE so this
   macro will overwrite the default error elaboration that is on the error queue. */
#define niScopeCheckParm(fCall, paramPosition, errorElaboration) \
        if (error = (fCall), (error = (error < 0) ? (error) : VI_SUCCESS)) \
           {Ivi_SetErrorInfo(vi, VI_TRUE, error, Ivi_ParamPositionError(paramPosition), \
           errorElaboration); goto Error;} else

/* Use this macro in the same manner as above but for cases where it is not a user
   set parameter that is in error
   Let errors over-ride warnings, but if there's no error or warning don't clear the
   previous warning!  If there are TWO warnings, then the new one will take precedence. */
#define niScopeCheckErrElab(fCall,elab)                              \
   {  int tempErrorForElab = (fCall);                                \
      if (tempErrorForElab < 0)                                      \
      {                                                              \
         Ivi_SetErrorInfo(vi, VI_TRUE, tempErrorForElab, 0, elab);   \
         error = tempErrorForElab;                                   \
         goto Error;                                                 \
      }                                                              \
      else if (tempErrorForElab > 0)                                 \
      {                                                              \
         Ivi_SetErrorInfo(vi, VI_TRUE, tempErrorForElab, 0, elab);   \
         error = tempErrorForElab;                                   \
      }                                                              \
   }

/* WARNING: These are overrides of some of the IVI macros to preserve warnings.
   These changes should ONLY affect the way warnings are dealt with.  However,
   there are other functions that may erase warning messages. */
#ifdef viCheckErrElab
#undef viCheckErrElab
#define viCheckErrElab(fCall, elab)                            \
   {                                                           \
      int code = (fCall);                                      \
      if (code < 0)                                            \
      {                                                        \
         error = code;                                         \
         Ivi_SetErrorInfo(vi, VI_FALSE, error, 0, elab);       \
         goto Error;                                           \
      }                                                        \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -