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

📄 include.txt

📁 一个使用DSP的数字示波器的例子
💻 TXT
📖 第 1 页 / 共 2 页
字号:
Engine Manager DLL 
// enmgr.h:  Engine Manager definitions for use with DirectDSP and

// supporting type definitions

typedef HGLOBAL    HENGINE;    // engine handle


// DLL call prototypes

#ifdef __cplusplus
extern "C" {
#endif

// initialize library (also done automatically by DSEngineOpen 
and DSAddEngMgrStatusLine)

HWND       WINAPI DSInitEngMgr               ();

// enmgr DLL status

short int  WINAPI DSGetEngMgrErrorStatus     ();

// engine manager error/status window

void       WINAPI DSShowEngMgrStatusWindow   ();
HWND       WINAPI DSAddEngMgrStatusLine      (LPCSTR);
void       WINAPI DSHideEngMgrStatusWindow   ();

// engine functions

HENGINE    WINAPI DSEngineOpen               (LPCSTR, LPCSTR);
UINT       WINAPI DSEngineClose              (HENGINE);
UINT       WINAPI DSGetEngineUsage           ();
UINT       WINAPI DSExecEngineFunction       (HENGINE, LPCSTR, UINT);
short int  WINAPI DSGetEngineErrorStatus     (HENGINE);
UINT       WINAPI DSGetEnginePath            (HENGINE, LPSTR);
UINT       WINAPI DSGetEngineWaveformPath    (HENGINE, LPSTR);
UINT       WINAPI DSGetEngineState           (HENGINE);

UINT       WINAPI DSSendEngineCommand        
(HENGINE, short int, UINT);
UINT       WINAPI DSRegisterEngineMsgWnd     (HENGINE, UINT, HWND);
UINT       WINAPI DSUnregisterEngineMsgWnd   (HENGINE, UINT);
UINT       WINAPI DSSetEngineWaveformPath    (HENGINE, LPCSTR);
UINT       WINAPI DSSetEngineTemplatePath    (HENGINE, LPCSTR);

#ifdef __cplusplus
}
#endif


// DSP Engine messages; window must be registered with DSRegisterEngineMsgWnd 
to receive

#define WM_DSPENGINE_CMDDATA         WM_USER      // engine data/command queue 
needs attention

#define WM_DSPENGINE_BUFRDY          WM_USER+1    // buffer ready
#define WM_DSPENGINE_FLGRDY          WM_USER+2    // flag ready

// program status messages

#define WM_DSPENGINE_PROGSTATUS      WM_USER+3    // engine program status 
(function done, program done, etc.)

// engine status messages

#define WM_DSPENGINE_ENGINESTATE     WM_USER+5    // engine state has changed
#define WM_DSPENGINE_FUNCTIONERROR   WM_USER+6    // engine encountered function 
input or setup error
#define WM_DSPENGINE_CODEGENERROR    WM_USER+7    // engine encountered code 
generation error
#define WM_DSPENGINE_COMPILEERROR    WM_USER+8    // engine encountered compile error
#define WM_DSPENGINE_RUNTIMEERROR    WM_USER+9    // engine encountered run-time error 
(waveform file error, hardware problem, etc.)

// engine statistics/parameter messages

#define WM_DSPENGINE_BUFSIZE         WM_USER+10   // current buffer size
#define WM_DSPENGINE_SAMPFREQ        WM_USER+11   // actual sampling frequency

#define WM_DSPENGINE_BUFNUM          WM_USER+12   // current buffer number

#define WM_DSPENGINE_LEVEL           WM_USER+13   // current amplitude level


#define WM_DS_USER                   WM_USER+14   // next available user-defined 
message for apps using enmgr.h


// wParam values in WM_DSPENGINE_PROGSTATUS messages

#define DS_PS_FUNCDONE               0            // function is done  
#define DS_PS_PROGDONE               1            // program is done


// DSP engine states sent in wParam of WM_DSPENGINE_ENGINESTATE message

#define DS_ES_RUNNING                32
#define DS_ES_IDLE                   33
#define DS_ES_STOPPENDING            1
#define DS_ES_STOPPED                -1


// error codes

#include                                // include general DirectDSP 
DLL error messages

#define DSCOULDNOTOPENENGINE         2            // engine-related error messages
#define DSINVALIDENGINEPATH          1
#define DSENGINETIMEOUT              -12
#define DSCOULDNOTOPENPIPE           -13
#define DSCOULDNOTSTARTENGINE        -14
#define DSNOENGINESOPEN              -15
#define DSNOENGINESFOUNDINLIST       -16
#define DSENGINEHANDLEWASNULL        -17
#define DSENGINEMEMORYDISCARDED      -18

// possible default engine types for use in DSEngineOpen call

#define DS_EO_HSM                    (LPCSTR)1L   // Hypersignal-Macro 4.x 
(real-time)
#define DS_EO_HSA                    (LPCSTR)2L   // Hypersignal-Acoustic 4.x
#define DS_EO_HSMNRT                 (LPCSTR)3L   // Hypersignal-Macro NRT 4.x 
(non-real-time)
#define DS_EO_MAT                    (LPCSTR)4L   // MATLAB 4.x


// ExecEngineFunction constants

#define DS_EEF_ASYNC                 0
#define DS_EEF_SYNC                  1


// SendEngineCommand constants

#define DS_SEC_ABORT                 -1
#define DS_SEC_IDLE                  -2
#define DS_SEC_PAUSE                 -3
#define DS_SEC_RESUME                -4


// RegisterEngineMsgWnd constants

#define DS_REMW_SETENGINESTATUSMSG   0x0001       // engine status messages
#define DS_REMW_SETPROGSTATUSMSG     0x0002       // program status messages
#define DS_REMW_SETDSPDATARDYMSG     0x0004       // DSP buffer ready and flag 
ready callbacks
#define DS_REMW_SETSTATISTICSMSG     0x0008       // DSP/analog hardware 
statistics/parameters messages
#define DS_REMW_SETBUFNUMMSG         0x0010       // current buffer count messages
#define DS_REMW_SETLEVELMSG          0x0020       // current data level messages
#define DS_REMW_SETALLMSG            0x00ff       // set all messages to one control


// structure pointed to be lParam in WM_DSPENGINE_BUFRDY and WM_DSPENGINE_FLGRDY 
messages

typedef struct {

    short int  nNum;                // buffer or flag number
    DWORD      dwFlagValue;         // flag value
    DWORD      dwFlagAddr;          // flag address
    HGLOBAL    hBoard;              // board handle

} DSPDATARDYINFO;

typedef DSPDATARDYINFO FAR* PDSPDATARDYINFO;


// structure pointed to be lParam in WM_DSPENGINE_COMPILEERR and 
WM_DSPENGINE_RUNTIMEERR messages

typedef struct {

    short int  nErrorNum;           // buffer or flag number
    char       szErrorStatus[256];  // error/status string or error log filename

} ERRORMSGINFO;

typedef ERRORMSGINFO FAR* PERRORMSGINFO;



Hardware Manager DLL 
// hwmgr.h:  Hardware Manager definitions for use with DirectDSP software

// DLL prototypes

#ifdef __cplusplus
extern "C" {
#endif

// hwmgr DLL status

short int WINAPI DSGetHWMgrErrorStatus(void);

// hwmgr functions

short int WINAPI DSGetHWMgrNumEntries();

short int WINAPI DSGetHWMgrEntryIndex(LPCSTR);  // get index of entry matching 
specified board designator string

UINT      WINAPI DSGetHWMgrEntry(short int, void far*);  // read entry into 
HWLISTENTRY structure
UINT      WINAPI DSSetHWMgrEntry(short int, void far*);  // write entry from 
HWLISTENTRY structure

UINT      WINAPI DSGetHWMgrCurVal(LPSTR);       // get board designator string 
of current hardware value
UINT      WINAPI DSSetHWMgrCurVal(LPCSTR);      // set current hardware value 
to board designator string

UINT      WINAPI DSGetHWMgrVar(WORD, LPSTR);    // get board designator string 
from specified hardware variable
UINT      WINAPI DSSetHWMgrVar(WORD, LPCSTR);   // set board designator string 
of specified hardware variable

HGLOBAL   WINAPI DSReadHWSetupFile();           // read hardware setup file
UINT      WINAPI DSWriteHWSetupFile();          // write hardware setup file

long      WINAPI DSShowHardwareSelectorDlg(HWND, LPSTR);  // show the hardware 
selector dialog

#ifdef __cplusplus
}
#endif

// error codes

#define DSUNABLETOREADHWSETUPFILE   -100
#define DSCOULDNOTLOCKHWLIST        -101
#define DSBOARDDESIGNATORNOTLISTED  -102
#define DSCOULDNOTFINDHWSETUPFILE   -103
#define DSCOULDNOTINCREASEHWLISTMEM -104
#define DSHWSETUPFILENOTYETREAD     -105


// DSP/analog "variables" that are referred to by source code generation; 
this scheme allows
// multiple boards to be in use at the same time, because each variable can 
be assigned a
// different hardware value

#define MAXBOARDVARS                14   // maximum number of hardware 
"variables" that user can refer to (each variable contains one of the board types)

#define RE                          0    // real-time engine
#define SA                          1    // spectrum analyzer
#define ACC                         2    // DSP accelerator
#define DTR                         3    // digital tape recorder
#define ACQ                         4    // data acquisition, waveform file record
#define CSG                         5    // continuous signal generation
#define SR                          6    // stimulus & response
#define PB                          7    // waveform file playback
#define DO                          8    // digital oscilloscope
#define UD1                         9    // user-defined 1-5
#define UD2                         10
#define UD3                         11
#define UD4                         12
#define UD5                         13


// hardware categories that determine which calls into HwLib are allowed 
for each entry

#define CALLCLASS_NODSP             1    // calls-allowed classfications
#define CALLCLASS_NOANALOG          2
#define CALLCLASS_NOPROCCALLS       4


// supporting definitions for hardware setup


typedef char DESCSTR[50];                // descriptors:  mfg, description, designator
typedef char VALSTR[10];                 // values:  base addresses, clock rates, etc.

typedef struct {                         // list of valid DSP/Analog hardware 
entries discovered when reading library hwsetup.lst file

    DESCSTR    szMfg;                    // manufacturer
    DESCSTR    szDescription;            // description:  model/name, DSP device, etc.
    DESCSTR    szBoardDesignator;        // board designator
    short int  MajorDriverID;            // major driver classification for board
    short int  MinorDriverID;            // minor driver classification
    char       szCodeFile[144];          // current DSP program file (filename of 
DSP executable)
    char       szCodeFileDef[144];       // default DSP program file
    VALSTR     szIOBaseAddr;             // current base I/O address (in hex)
    VALSTR     szIOBaseAddrDef;          // default base I/O address
    VALSTR     szMemBaseAddr;            // current base memory address (in hex)
    VALSTR     szMemBaseAddrDef;         // default base memory address
    short int  BusType;
    short int  BusTypeDef;
    VALSTR     szProcClock;              // processor clock (in MHz)
    VALSTR     szProcClockDef;
    VALSTR     szVoltageRanges;          // voltage ranges (should be stored as 
"input,output")
    VALSTR     szVoltageRangesDef;
    short int  AnalClockType;            // analog clock:  0 = ext, 1 = fixed int, 
2 = prog int
    short int  AnalClockTypeDef;
    VALSTR     szMemArch;                // memory architecture
    VALSTR     szMemArchDef;
    short int  NumProcessors;            // number of processors
    short int  NumProcessorsDef;

 // following parameters not read from file:

    short int  CallClass;                // calls-allowed classification
    short int  Flags;                    // internal info used to mark pending 
updates, deletes, etc.

} HWLISTENTRY;

typedef HWLISTENTRY FAR* PHWLISTENTRY;

typedef HWLISTENTRY HWList[1];        // list of valid DSP/Analog hardware 
entries discovered when reading library hwsetup.lst file

typedef HWList FAR* PHWLIST;



Hardware Library DLL 
// hwlib.h:  definitions for use with DirectDSP software

// supporting type definitions

typedef HGLOBAL    HENGINE;    // engine handle
typedef HGLOBAL    HBOARD;     // board handle

⌨️ 快捷键说明

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