/************************************************************************/ /* */ /* dwf.h -- Public Interface Declarations for DWF.DLL */ /* */ /************************************************************************/ /* Author: Laszlo Attila Kovacs */ /* Copyright 2013 Digilent Inc. */ /************************************************************************/ /* File Description: */ /* */ /* This header file contains the public interface declarations for */ /* the DWF.DLL. This interface consists of hardware device */ /* enumeration, connection (open/close), and hardware instrument */ /* control. This spans all 4 main instruments supported by the */ /* WaveForms system: */ /* Analog In, Analog Out, Analog I/O, and Digital I/O */ /* */ /* For details on using this interface, refer to: */ /* The WaveForms SDK User's Manual (available in the WaveForms SDK) */ /* */ /************************************************************************/ /* Revision History: */ /* */ /* 06/6/2009(KovacsLA) : Created */ /* */ /************************************************************************/ #pragma once #ifndef DWFINC #define DWFINC TRUE #ifndef DWFAPI #if defined(WIN32) #if defined(__cplusplus) #define DWFAPI extern "C" __declspec(dllimport) #else #define DWFAPI __declspec(dllimport) #endif #else #if defined(__cplusplus) #define DWFAPI extern "C" #else #define DWFAPI #endif #endif #endif #ifndef BOOL typedef int BOOL; #endif #ifndef BYTE typedef unsigned char BYTE; #endif // hardware device handle typedef int HDWF; const HDWF hdwfNone = 0; // device enumeration filters typedef int ENUMFILTER; const ENUMFILTER enumfilterAll = 0; const ENUMFILTER enumfilterEExplorer = 1; const ENUMFILTER enumfilterDiscovery = 2; const ENUMFILTER enumfilterDiscovery2 = 3; const ENUMFILTER enumfilterDDiscovery = 4; // device ID typedef int DEVID; const DEVID devidEExplorer = 1; const DEVID devidDiscovery = 2; const DEVID devidDiscovery2 = 3; const DEVID devidDDiscovery = 4; // device version typedef int DEVVER; const DEVVER devverEExplorerC = 2; const DEVVER devverEExplorerE = 4; const DEVVER devverEExplorerF = 5; const DEVVER devverDiscoveryA = 1; const DEVVER devverDiscoveryB = 2; const DEVVER devverDiscoveryC = 3; // trigger source typedef BYTE TRIGSRC; const TRIGSRC trigsrcNone = 0; const TRIGSRC trigsrcPC = 1; const TRIGSRC trigsrcDetectorAnalogIn = 2; const TRIGSRC trigsrcDetectorDigitalIn = 3; const TRIGSRC trigsrcAnalogIn = 4; const TRIGSRC trigsrcDigitalIn = 5; const TRIGSRC trigsrcDigitalOut = 6; const TRIGSRC trigsrcAnalogOut1 = 7; const TRIGSRC trigsrcAnalogOut2 = 8; const TRIGSRC trigsrcAnalogOut3 = 9; const TRIGSRC trigsrcAnalogOut4 = 10; const TRIGSRC trigsrcExternal1 = 11; const TRIGSRC trigsrcExternal2 = 12; const TRIGSRC trigsrcExternal3 = 13; const TRIGSRC trigsrcExternal4 = 14; const TRIGSRC trigsrcHigh = 15; const TRIGSRC trigsrcLow = 16; // instrument states: typedef BYTE DwfState; const DwfState DwfStateReady = 0; const DwfState DwfStateConfig = 4; const DwfState DwfStatePrefill = 5; const DwfState DwfStateArmed = 1; const DwfState DwfStateWait = 7; const DwfState DwfStateTriggered = 3; const DwfState DwfStateRunning = 3; const DwfState DwfStateDone = 2; // typedef int DwfEnumConfigInfo; const DwfEnumConfigInfo DECIAnalogInChannelCount = 1; const DwfEnumConfigInfo DECIAnalogOutChannelCount = 2; const DwfEnumConfigInfo DECIAnalogIOChannelCount = 3; const DwfEnumConfigInfo DECIDigitalInChannelCount = 4; const DwfEnumConfigInfo DECIDigitalOutChannelCount = 5; const DwfEnumConfigInfo DECIDigitalIOChannelCount = 6; const DwfEnumConfigInfo DECIAnalogInBufferSize = 7; const DwfEnumConfigInfo DECIAnalogOutBufferSize = 8; const DwfEnumConfigInfo DECIDigitalInBufferSize = 9; const DwfEnumConfigInfo DECIDigitalOutBufferSize = 10; // acquisition modes: typedef int ACQMODE; const ACQMODE acqmodeSingle = 0; const ACQMODE acqmodeScanShift = 1; const ACQMODE acqmodeScanScreen = 2; const ACQMODE acqmodeRecord = 3; const ACQMODE acqmodeOvers = 4; const ACQMODE acqmodeSingle1 = 5; // analog acquisition filter: typedef int FILTER; const FILTER filterDecimate = 0; const FILTER filterAverage = 1; const FILTER filterMinMax = 2; // analog acquisition filter: typedef int DwfTriggerSlope; const DwfTriggerSlope DwfTriggerSlopeRise = 0; const DwfTriggerSlope DwfTriggerSlopeFall = 1; const DwfTriggerSlope DwfTriggerSlopeEither = 2; // analog in trigger mode: typedef int TRIGTYPE; const TRIGTYPE trigtypeEdge = 0; const TRIGTYPE trigtypePulse = 1; const TRIGTYPE trigtypeTransition = 2; // analog in trigger length condition typedef int TRIGLEN; const TRIGLEN triglenLess = 0; const TRIGLEN triglenTimeout = 1; const TRIGLEN triglenMore = 2; // error codes for DWF Public API: typedef int DWFERC; const DWFERC dwfercNoErc = 0; // No error occurred const DWFERC dwfercUnknownError = 1; // API waiting on pending API timed out const DWFERC dwfercApiLockTimeout = 2; // API waiting on pending API timed out const DWFERC dwfercAlreadyOpened = 3; // Device already opened const DWFERC dwfercNotSupported = 4; // Device not supported const DWFERC dwfercInvalidParameter0 = 0x10; // Invalid parameter sent in API call const DWFERC dwfercInvalidParameter1 = 0x11; // Invalid parameter sent in API call const DWFERC dwfercInvalidParameter2 = 0x12; // Invalid parameter sent in API call const DWFERC dwfercInvalidParameter3 = 0x13; // Invalid parameter sent in API call const DWFERC dwfercInvalidParameter4 = 0x14; // Invalid parameter sent in API call // analog out signal types typedef BYTE FUNC; const FUNC funcDC = 0; const FUNC funcSine = 1; const FUNC funcSquare = 2; const FUNC funcTriangle = 3; const FUNC funcRampUp = 4; const FUNC funcRampDown = 5; const FUNC funcNoise = 6; const FUNC funcPulse = 7; const FUNC funcTrapezium= 8; const FUNC funcSinePower= 9; const FUNC funcCustom = 30; const FUNC funcPlay = 31; // analog io channel node types typedef BYTE ANALOGIO; const ANALOGIO analogioEnable = 1; const ANALOGIO analogioVoltage = 2; const ANALOGIO analogioCurrent = 3; const ANALOGIO analogioPower = 4; const ANALOGIO analogioTemperature = 5; typedef int AnalogOutNode; const AnalogOutNode AnalogOutNodeCarrier = 0; const AnalogOutNode AnalogOutNodeFM = 1; const AnalogOutNode AnalogOutNodeAM = 2; typedef int DwfAnalogOutMode; const DwfAnalogOutMode DwfAnalogOutModeVoltage = 0; const DwfAnalogOutMode DwfAnalogOutModeCurrent = 1; typedef int DwfAnalogOutIdle; const DwfAnalogOutIdle DwfAnalogOutIdleDisable = 0; const DwfAnalogOutIdle DwfAnalogOutIdleOffset = 1; const DwfAnalogOutIdle DwfAnalogOutIdleInitial = 2; typedef int DwfDigitalInClockSource; const DwfDigitalInClockSource DwfDigitalInClockSourceInternal = 0; const DwfDigitalInClockSource DwfDigitalInClockSourceExternal = 1; typedef int DwfDigitalInSampleMode; const DwfDigitalInSampleMode DwfDigitalInSampleModeSimple = 0; // alternate samples: noise|sample|noise|sample|... // where noise is more than 1 transition between 2 samples const DwfDigitalInSampleMode DwfDigitalInSampleModeNoise = 1; typedef int DwfDigitalOutOutput; const DwfDigitalOutOutput DwfDigitalOutOutputPushPull = 0; const DwfDigitalOutOutput DwfDigitalOutOutputOpenDrain = 1; const DwfDigitalOutOutput DwfDigitalOutOutputOpenSource = 2; const DwfDigitalOutOutput DwfDigitalOutOutputThreeState = 3; // for custom and random typedef int DwfDigitalOutType; const DwfDigitalOutType DwfDigitalOutTypePulse = 0; const DwfDigitalOutType DwfDigitalOutTypeCustom = 1; const DwfDigitalOutType DwfDigitalOutTypeRandom = 2; const DwfDigitalOutType DwfDigitalOutTypeROM = 3; const DwfDigitalOutType DwfDigitalOutTypeFSM = 3; typedef int DwfDigitalOutIdle; const DwfDigitalOutIdle DwfDigitalOutIdleInit = 0; const DwfDigitalOutIdle DwfDigitalOutIdleLow = 1; const DwfDigitalOutIdle DwfDigitalOutIdleHigh = 2; const DwfDigitalOutIdle DwfDigitalOutIdleZet = 3; typedef int DwfParam; const DwfParam DwfParamUsbPower = 2; // 1 keep the USB power enabled even when AUX is connected, Analog Discovery 2 const DwfParam DwfParamLedBrightness = 3; // LED brightness 0 ... 100%, Digital Discovery const DwfParam DwfParamOnClose = 4; // 0 run, 1 stop, 2 shutdown const DwfParam DwfParamAudioOut = 5; // 0 disable / 1 enable audio output, Analog Discovery 1, 2 const DwfParam DwfParamUsbLimit = 6; // 0..1000 mA USB power limit, -1 no limit, Analog Discovery 1, 2 // Macro used to verify if bit is 1 or 0 in given bit field #define IsBitSet(fs, bit) ((fs & (1<