Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

dscud.h

Go to the documentation of this file.
00001 /*
00002 
00003         DSCUD.H
00004         
00005         Diamond Systems Corporation Universal Driver
00006         Version 5.91
00007 
00008         Copyright (c) Diamond Systems Corporation 2005
00009         All Rights Reserved.
00010         
00011         http://www.diamondsystems.com
00012 
00013         DSCUD currently supports these boards:
00014 
00015         METIS
00016         ATHENA
00017         HERCULES EBX
00018         DIAMOND-MM
00019         DIAMOND-MM-16-AT
00020         DIAMOND-MM-32
00021         DIAMOND-MM-32X
00022         DIAMOND-MM-AT
00023         ELEKTRA
00024         EMERALD-MM-8
00025         EMERALD-MM-DIO
00026         EMERALD-OPTO
00027         MERCURY
00028         GARNET-MM
00029         IR-104
00030         ONYX-MM
00031         ONYX-MM-DIO
00032         OPAL-MM
00033         PEARL-MM
00034         PROMETHEUS
00035         QUARTZ-MM
00036         RUBY-MM
00037         RUBY-MM-416
00038         RUBY-MM-1612
00039         ZIRCON-MM
00040 
00041 */
00042 
00043 
00044 #ifndef _DSCUD_H
00045 #define _DSCUD_H
00046 
00047 /* MS Visual C++ > 1.52 only - 1-byte structure alignment */
00048 #ifndef MSVC_1_52
00049 #ifdef _MSC_VER
00050 #pragma pack(push, dscud_packing)
00051 #pragma pack(1)
00052 #endif
00053 #endif
00054 
00055 #ifdef __cplusplus
00056 extern "C" {
00057 #endif
00058 
00059 /*/////////////////////////////////////////////////////////////////
00060 ///////////////////////////////////////////////////////////////////
00061 ///////////////////////////////////////////////////////////////////
00062 ///////////////////// Type Definitions ////////////////////////////
00063 ///////////////////////////////////////////////////////////////////
00064 ///////////////////////////////////////////////////////////////////
00065 //////////////////////////////////////////////////////////////// */
00066 
00067 #ifndef BYTE
00068 #define BYTE unsigned char
00069 #endif
00070 
00071 
00072 #ifndef SBYTE
00073 #define SBYTE signed char
00074 #endif
00075 
00076 
00077 #ifndef WORD
00078 #define WORD unsigned short
00079 #endif
00080 
00081 
00082 #ifndef SWORD
00083 #define SWORD signed short
00084 #endif
00085 
00086 
00087 #ifndef DWORD
00088 #define DWORD unsigned long
00089 #endif
00090 
00091 
00092 #ifndef SDWORD
00093 #define SDWORD signed long
00094 #endif
00095 
00096 
00097 #ifndef LONG
00098 #define LONG signed long
00099 #endif
00100 
00101 
00102 #ifndef FLOAT
00103 #define FLOAT float
00104 #endif
00105 
00106 
00107 #ifndef DFLOAT
00108 #define DFLOAT double
00109 #endif
00110 
00111 
00112 #ifndef BOOL
00113 #define BOOL int
00114 #endif
00115 
00116 
00117 #ifndef TRUE
00118 #define TRUE ((BOOL)1)
00119 #endif
00120 
00121 
00122 #ifndef FALSE
00123 #define FALSE ((BOOL)0)
00124 #endif
00125 
00126 
00127 #ifndef DSCSAMPLE
00128 #define DSCSAMPLE SWORD
00129 #endif
00130 
00131 #ifndef DSCDACODE
00132 #define DSCDACODE DWORD
00133 #endif
00134 
00135 typedef void (*DSCUserInterruptFunction) (void* parameter);
00136 
00137 #ifdef WIN32
00138 #define DSCUDAPICALL __declspec(dllexport)
00139 #else /* WIN32 not defined */
00140 #define DSCUDAPICALL 
00141 #endif /* #ifdef WIN32 */
00142 
00143 #define DSCB SWORD
00144 
00145 
00146 /*/////////////////////////////////////////////////////////////////
00147 ///////////////////////////////////////////////////////////////////
00148 ///////////////////////////////////////////////////////////////////
00149 //////////////////////// Constants ////////////////////////////////
00150 ///////////////////////////////////////////////////////////////////
00151 ///////////////////////////////////////////////////////////////////
00152 //////////////////////////////////////////////////////////////// */
00153 
00154 /*///////////
00155 // Version //
00156 ////////// */
00157 
00158 #define DSC_VERSION  0x0591  /* 0xVVRR - Version & Revision */
00159 
00160 /*///////////////
00161 // Board Types //
00162 ////////////// */
00163 
00164 #define DSC_DMM16    0          
00165 #define DSC_RMM      1
00166 #define DSC_TMM      2
00167 #define DSC_OPMM     3
00168 #define DSC_DMM      4
00169 #define DSC_SMM      5
00170 #define DSC_GMM      6
00171 #define DSC_QMM      7
00172 #define DSC_ZMM      8
00173 #define DSC_PMM      9
00174 #define DSC_OMM      10
00175 #define DSC_RMM416   11
00176 #define DSC_DMM32    12
00177 #define DSC_DMM32AT  12
00178 #define DSC_EMMDIO   13
00179 #define DSC_RMM1612  14
00180 #define DSC_DMMAT    15
00181 #define DSC_DMM16AT  16
00182 #define DSC_IR104    17
00183 #define DSC_EMM8         18
00184 #define DSC_PROM         19
00185 #define DSC_HERCEBX  20
00186 #define DSC_CPT      21
00187 #define DSC_DMM48    22
00188 #define DSC_DMM48AT  22
00189 #define DSC_OMMDIO       23
00190 #define DSC_DIO82C55 24   
00191 #define DSC_MRC      24   
00192 #define DSC_EMMOPTO  24
00193 #define DSC_ATHENA   25
00194 #define DSC_METIS    26
00195 #define DSC_DMM32X   27
00196 #define DSC_DMM32XAT 27  
00197 #define DSC_ELEKTRA  28  
00198 #define DSC_TEST     126
00199 #define DSC_RAW      127
00200 #define DSC_DRVR     255
00201 
00202 /*//////////////////////
00203 // A/D Mode Constants //
00204 ///////////////////// */
00205 
00206 #define RANGE_5         0
00207 #define RANGE_10        1
00208 
00209 #define BIPOLAR         0
00210 #define UNIPOLAR        1
00211 
00212 #define GAIN_1          0
00213 #define GAIN_2          1
00214 #define GAIN_4          2
00215 #define GAIN_8          3
00216 #define GAIN_10         1 /* higher gains for SMM boards */
00217 #define GAIN_100        2
00218 #define GAIN_1000       3
00219 
00220 #define SCAN_INTERVAL_4         5       /* scan interval in microseconds constant for dscadSetSettings struct */
00221 #define SCAN_INTERVAL_5         3       
00222 #define SCAN_INTERVAL_9         4
00223 #define SCAN_INTERVAL_10        2
00224 #define SCAN_INTERVAL_15        1
00225 #define SCAN_INTERVAL_20        0
00226 
00227 #define SINGLE_ENDED 0
00228 #define DIFFERENTIAL 1
00229 
00230 
00231 /*/////////////
00232 // GMM modes //
00233 //////////// */
00234 
00235 #define MODE_0_INT11_INT12 0
00236 #define MODE_0_INT21_INT22 1
00237 #define MODE_1_82C55_1_C0  2
00238 #define MODE_1_82C55_1_C3  3
00239 #define MODE_1_82C55_2_C0  4
00240 #define MODE_1_82C55_2_C3  5
00241 
00242 /*///////////////
00243 // OMM sources //
00244 ////////////// */
00245 
00246 #define SOURCE_82C55_1_C0 0
00247 #define SOURCE_COUNTER_0  1
00248 #define SOURCE_82C55_2_C0 2
00249 #define SOURCE_COUNTER_1  3
00250 #define SOURCE_EXTERNAL   4
00251 #define SOURCE_COUNTER_2  5
00252 
00253 #define OMM_SOURCE_PIN 0
00254 #define OMM_SOURCE_CLOCK 1
00255 #define OMM_SOURCE_OUT 2
00256 
00257 
00258 /*////////////////////////////////////////
00259 // Prometheus Watchdog Option Constants //
00260 /////////////////////////////////////// */
00261 
00262 /* Look in ZFx86 Training Book for details */
00263 
00264 #define PROM_WD_TRIGGER_SCI             0x01
00265 #define PROM_WD_TRIGGER_NMI             0x02
00266 #define PROM_WD_TRIGGER_SMI             0x04
00267 #define PROM_WD_TRIGGER_RESET           0x08
00268 #define PROM_WD_WDI_ASSERT_FALLING_EDGE 0x10
00269 #define PROM_WD_WDO_TRIGGERED_EARLY     0x20
00270 #define PROM_WD_ENABLE_WDI_ASSERTION    0x40
00271 
00272 
00273 /*////////////////////////////////////////
00274 //      Hercules Watchdog Option Constants      //
00275 /////////////////////////////////////// */
00276 
00277 #define HERC_WD_TRIGGER_NMI             0x10
00278 #define HERC_WD_TRIGGER_RESET                   0x08
00279 #define HERC_WD_WDI_ASSERT_FALLING_EDGE 0x02
00280 #define HERC_WD_WDO_TRIGGERED_EARLY     0x04
00281 #define HERC_WD_ENABLE_WDI_ASSERTION    0x01
00282 
00283 /*////////////////////////////////////////
00284 //      Athena Watchdog Option Constants        //
00285 /////////////////////////////////////// */
00286 
00287 #define ATHENA_WD_WDI_ASSERT_RISING_EDGE 0x10
00288 #define ATHENA_WD_TRIGGER_SMI            0x20
00289 #define ATHENA_WD_ENABLE_WDO             0x40
00290 #define ATHENA_WD_ENABLE_WDI             0x80
00291 
00292 /*////////////////////////////////////////
00293 //      Elektra Watchdog Option Constants       //
00294 /////////////////////////////////////// */
00295 
00296 #define ELEKTRA_WD_WDI_ASSERT_RISING_EDGE 0x10
00297 #define ELEKTRA_WD_TRIGGER_SMI            0x20
00298 #define ELEKTRA_WD_ENABLE_WDO             0x40
00299 #define ELEKTRA_WD_ENABLE_WDI             0x80
00300 
00301 /*/////////////////////////////////////////////////////
00302 // Counter Defines Types for dscCounterSetRateSingle //
00303 //////////////////////////////////////////////////// */
00304 
00305 #define COUNTER_0               0x00
00306 #define COUNTER_1               0x01
00307 #define COUNTER_2               0x02
00308 #define COUNTER_0_1             0x04
00309 #define COUNTER_1_2             0x08
00310 #define COUNTER_0_1_2   0x10
00311 
00312 
00313 /*/////////////////////////////
00314 // Interrupt Operation Types //
00315 //////////////////////////// */
00316 
00317 #define OP_TYPE_NONE 0
00318 #define OP_TYPE_INT  1
00319 #define OP_TYPE_DMA  2
00320 
00321 #define INT_TYPE_AD             0x01
00322 #define INT_TYPE_DA             0x02
00323 #define INT_TYPE_DIOIN          0x04
00324 #define INT_TYPE_USER           0x08
00325 #define INT_TYPE_COUNTER        0x10
00326 #define INT_TYPE_DIOREAD        0x20
00327 #define INT_TYPE_OPTO           0x40
00328 #define INT_TYPE_DIOWRITE       0x80
00329 
00330 #define INT_TYPE_INDEX_AD      0
00331 #define INT_TYPE_INDEX_DA      1
00332 #define INT_TYPE_INDEX_DIOIN   2
00333 #define INT_TYPE_INDEX_USER    3
00334 #define INT_TYPE_INDEX_COUNTER 4
00335 #define INT_TYPE_INDEX_DIOREAD 5
00336 #define INT_TYPE_INDEX_OPTO        6
00337 #define INT_TYPE_INDEX_DIOWRITE 7
00338 
00339 /*////////////////////////
00340 // User Interrupt Modes //
00341 /////////////////////// */
00342 
00343 #define USER_INT_CANCEL  0
00344 #define USER_INT_AFTER   1
00345 #define USER_INT_INSTEAD 2
00346 
00347 #define USER_INT_SOURCE_EXTERNAL 1
00348 #define USER_INT_SOURCE_INTERNAL 0
00349 
00350 
00351 /*///////////////////////////////
00352 // Waveform Generator Commands //
00353 ////////////////////////////// */
00354 
00355 #define WG_CMD_START 0x01               /* Start the waveform generator */
00356 #define WG_CMD_PAUSE 0x02               /* Pause the waveform generator */
00357 #define WG_CMD_RESET 0x04               /* Reset the waveform generator */
00358 #define WG_CMD_INC   0x08               /* Manually Increment the waveform generator by one frame. */
00359 
00360 
00361 /*//////////////////////////////
00362 // Waveform Generator Sources //
00363 ///////////////////////////// */
00364 
00365 #define WG_SRC_MANUAL 0         /* Manual trigger (software) */
00366 #define WG_SRC_CTR0       1             /* Rising edges on Counter 0 output */
00367 #define WG_SRC_CTR12  2         /* Rising edges on Counter 1+2 cascade output */
00368 #define WG_SRC_EXT        3             /* Rising edges on EXTTRIG */
00369 
00370 
00371 /*/////////////////////////////////////////
00372 // Waveform Generator Channels Per Frame //
00373 /////////////////////////////////////////// */
00374 
00375 #define WG_CH_PER_FRAME_1       0               /* 1 channel per frame */
00376 #define WG_CH_PER_FRAME_2       1               /* 2 channels per frame */
00377 #define WG_CH_PER_FRAME_4       2               /* 4 channels per frame */
00378 
00379 
00380 
00381 /*////////////////////////////////
00382 // Autoautocalibration Commands //
00383 /////////////////////////////// */
00384 
00385 #define AAC_CMD_HOLD  0x10  /* Enable the hold-off line, prevent AAC from running */
00386 #define AAC_CMD_REL   0x08  /* Release the hold-off line, allow AAC to run */
00387 #define AAC_CMD_RESET 0x04  /* Reset the dsPIC device to its initial power-on state */
00388 #define AAC_CMD_ABORT 0x02  /* Abort any currently running AAC routine */
00389 #define AAC_CMD_TRIG  0x01  /* Force-trigger an AAC routine */
00390 
00391 
00392 /*/////////////////
00393 // PCI Constants //
00394 //////////////// */
00395 
00396 #define PCI_MAX_RESOURCES 5
00397 #define PCI_DSC_VENDORID 0x1234
00398 
00399 /*///////////////
00400 // Error Codes //
00401 ////////////// */
00402 
00403 #define DE_NONE                                         0   /* no error  */
00404 #define DE_HW_FAILURE                           1   /* hardware failed */
00405 #define DE_SW_FAILURE                           2   /* software failed */
00406 #define DE_HW_NOT_SUPPORTED                     3   /* could not perform operation on this board  */
00407 #define DE_SW_NOT_SUPPORTED                     4   /* software does not yet support this operation */
00408 #define DE_INVALID_PARM                         5   /* a parameter to the function is invalid */
00409 #define DE_ALTERNATE_IN_PROGRESS        6   /* alternate interrupt function in progress */
00410 #define DE_NONE_IN_PROGRESS                     7   /* no interrupt function in progress to pause/cancel/resume */
00411 #define DE_BUFFER_ROLLOVER                      8   /* pointer passed in + sizeof data to be written would roll over a segment */
00412 #define DE_INVALID_ERROR_CODE       9   /* we used an invalid error code somewhere */
00413 #define DE_ALREADY_PAUSED                       10  /* can't pause an operation--it's already paused */
00414 #define DE_OVERFLOW                                     11  /* Am9513A counter function overflowed */
00415 #define DE_INVALID_FUNC                         12  /* Function number not recognized by board type */
00416 #define DE_DSCUDH_INVALID                       13  /* Header - Library version mismatch */
00417 #define DE_INVALID_BOARD                        14  /* Invalid board-type constant */
00418 #define DE_BOARD_LIMIT_REACHED          15  /* Tried to initialize too many boards at once */
00419 #define DE_BOARD_BUSY                           16  /* Attempt to acquire the board timed out */
00420 #define DE_INVALID_WINDRVR_HANDLE       17  /* Windriver initialization failed */
00421 #define DE_INVALID_WINDRVR_VERSION      18  /* Windriver version conflict */
00422 #define DE_BAD_WINDRVR_BOARD_INIT       19  /* Windriver could not initialize the board */
00423 #define DE_OPERATION_TIMED_OUT          20  /* Operation timed out */
00424 #define DE_INVALID_WINDRVR_KP           21      /* Windriver kernel plugin initialization failed */
00425 #define DE_THREAD_FAILURE                       22      /* Windriver failed to initialize thread */
00426 
00427 /*/////////////////
00428 // Error Strings //
00429 //////////////// */
00430 
00431 #define STR_DE_NONE                                             "NO ERRORS REPORTED"
00432 #define STR_DE_HW_FAILURE                               "HARDWARE FAILURE"
00433 #define STR_DE_SW_FAILURE                               "SOFTWARE FAILURE"
00434 #define STR_DE_HW_NOT_SUPPORTED                 "OPERATION NOT SUPPORTED BY HARDWARE"
00435 #define STR_DE_SW_NOT_SUPPORTED                 "OPERATION NOT SUPPORTED BY SOFTWARE"
00436 #define STR_DE_INVALID_PARM                             "INVALID PARAMETER"
00437 #define STR_DE_ALTERNATE_IN_PROGRESS    "ALTERNATE INTERRUPT OPERATION IN PROGRESS"
00438 #define STR_DE_NONE_IN_PROGRESS                 "NO INTERRUPT OPERATION IN PROGRESS"
00439 #define STR_DE_BUFFER_ROLLOVER                  "POINTER + SIZE OF DATA OVERRUN BUFFER"
00440 #define STR_DE_INVALID_ERROR_CODE       "INVALID ERROR CODE, PLEASE IGNORE"
00441 #define STR_DE_ALREADY_PAUSED                   "OPERATION ALREADY PAUSED"
00442 #define STR_DE_OVERFLOW                                 "AM9513A COUNTER FUNCTION OVERFLOWED OR BUFFER OVERFLOW"
00443 #define STR_DE_INVALID_FUNC                             "INVALID FUNCTION FOR SELECTED BOARD"
00444 #define STR_DE_DSCUDH_INVALID                   "LIBRARY HEADER VERSION MISMATCH"
00445 #define STR_DE_INVALID_BOARD                    "INVALID BOARD TYPE SPECIFIED"
00446 #define STR_DE_BOARD_LIMIT_REACHED              "MAXIMUM NUMBER OF BOARDS REACHED"
00447 #define STR_DE_BOARD_BUSY                               "ATTEMPT TO ACQUIRE BOARD TIMED OUT"
00448 #define STR_DE_INVALID_WINDRVR_HANDLE   "INVALID WINDRIVER HANDLE RETURNED"
00449 #define STR_DE_INVALID_WINDRVR_VERSION  "INVALID WINDRIVER VERSION"
00450 #define STR_DE_BAD_WINDRVR_BOARD_INIT   "WINDRIVER BOARD INITIALIZATION FAILURE"
00451 #define STR_DE_OPERATION_TIMED_OUT              "OPERATION TIMED OUT"
00452 #define STR_DE_INVALID_WINDRVR_KP               "KERNEL PLUGIN INITIALIZATION FAILURE"
00453 #define STR_DE_THREAD_FAILURE                   "THREAD INITIALIZATION FAILURE"
00454 #define STR_DE_MUTEX_FAIL                               "MUTEX CREATION OR LOCKING OPERATION FAILED"
00455 
00456 
00457 /*/////////////////////////////////////////////////////////////////
00458 ///////////////////////////////////////////////////////////////////
00459 ///////////////////////////////////////////////////////////////////
00460 //////////////////////// Structures ///////////////////////////////
00461 ///////////////////////////////////////////////////////////////////
00462 ///////////////////////////////////////////////////////////////////
00463 //////////////////////////////////////////////////////////////// */
00464 
00465 /*/////////
00466 // DSCCB //
00467 //////// */
00468 
00469 typedef struct
00470 {
00471         /*//////////////////////////////////////////////////////////
00472         // These members are filled automatically by dscInitBoard //
00473         //    THE USER DOES NOT HAVE TO FILL THESE IN MANUALLY    //
00474         ///////////////////////////////////////////////////////// */
00475         BYTE boardtype;     /* Contains the boardtype constant */
00476         DSCB boardnum;      /* The handle to the board */
00477         
00478         /*///////////////////////////////////////////////////////////
00479         // The user must fill in everything below that pertains to //
00480         // board before the call to dscInitBoard                   //
00481         ////////////////////////////////////////////////////////// */   
00482         WORD base_address;  /* Base address of the board */
00483 
00484         /*////////////////////////////////////////////////////
00485         // Use int_level for boards with only one interrupt //
00486         /////////////////////////////////////////////////// */
00487         BYTE int_level;     /* Interrupt level of the board */
00488 
00489         /*///////////////////////////////
00490         // RMM416 and RMM1612 specific //
00491         ////////////////////////////// */
00492         BOOL RMM_external_trigger;  /* Enable/disable external trigger */
00493 
00494         /*////////////////
00495         // RMM specific //
00496         /////////////// */
00497     BOOL RMM_external_trigger_c3;
00498     
00499         /*/////////////////
00500         // EMM specific  //
00501         //////////////// */
00502         WORD EMM_IOAddr[8];         /* IO addresses for up to eight ports */
00503         WORD EMM_Interrupt[8];      /* Interrupts for up to eight ports */
00504 
00505         /*/////////////////
00506         // PROM specific //
00507         //////////////// */
00508         BYTE clkfrq0;          /* 0 = 10Mhz, 1 = 1MHz */
00509         BYTE clkfrq1;          /* 0 = 10Mhz, 1 = 100KHz */
00510         BYTE clksel1;          /* 0 = internal oscillator, frequency set by ckfrq1.  1 = external clock input CLK1 */
00511     
00512         /*////////////////
00513         // RAW specific //
00514         /////////////// */
00515         WORD address_space; /* Size of I/O block (in bytes) to allocate.  Only needed for DSC_RAW */ 
00516 
00517         /*//////////////////////////////////////////////////////
00518         // Obsolete  Kept for backwards compatability only    //
00519         ///////////////////////////////////////////////////// */
00520         LONG clock_freq;
00521         BYTE dma_level;
00522         BYTE int_level1;
00523         BYTE int_level2;
00524         BYTE int_level3;
00525         WORD fpga;
00526         BYTE SMM_AD_resolution;
00527         BOOL RMM_mode_16bit;
00528         BOOL RMM_DAC_0_3_external_enable;  
00529         BOOL RMM_DAC_4_7_external_enable;
00530 
00531 } DSCCB;
00532 
00533 /*//////////
00534 // DSCCBP //
00535 ///////// */
00536 
00537 typedef struct
00538 {
00539         /*/////////////////////////////////////////////////////////////
00540         // These members are filled automatically by dscPCIInitBoard //
00541         //    THE USER DOES NOT HAVE TO FILL THESE IN MANUALLY       //
00542         //////////////////////////////////////////////////////////// */
00543         BYTE boardtype;     /* Contains the boardtype constant */
00544         DSCB boardnum;      /* The handle to the board */
00545         DWORD phys_mem_address[PCI_MAX_RESOURCES]; // Physical memory address if any assigned to board
00546         DWORD user_mem_address[PCI_MAX_RESOURCES]; // User-space memory address if any assigned to board
00547         DWORD io_address[PCI_MAX_RESOURCES]; // I/O address if any assigned to board
00548         DWORD irq_level[PCI_MAX_RESOURCES]; // IRQ levels assigned to the board
00549 
00550         
00551         /*///////////////////////////////////////////////////////////
00552         // The user must fill in everything below that pertains to //
00553         // board before the call to dscPCIInitBoard                //
00554         ////////////////////////////////////////////////////////// */   
00555         BYTE pci_slot; // PCI slot jumper configured on the board
00556 
00557 } DSCCBP;
00558 
00559 
00560 /*/////////////////
00561 // DSCADSETTINGS //
00562 //////////////// */
00563 
00564 typedef struct
00565 {
00566 
00567         BYTE current_channel; /* INPUT: Which channel to read AD samples from */ 
00568         BYTE gain;            /* INPUT: 0 = gain of 1, 1 = gain of 2, 2 = gain of 4, 3 = gain of 8 */
00569         BYTE range;           /* INPUT: 0 = 5V range, 1 = 10V range */
00570         BYTE polarity;        /* INPUT: 0 = bipolar, 1 = unipolar */
00571         BYTE load_cal;        /* INPUT: 0 = do not load calibration values, 1 = load */
00572         BYTE scan_interval;   /* For DMM32, Hercules, DMM48 only. Use constants SCAN_INTERVAL_X */
00573         BYTE addiff;              /* For HERCULES only, 0 = SINGLE_ENDED or 1 = DIFFERENTIAL */
00574         
00575 } DSCADSETTINGS;
00576 
00577 
00578 /*/////////////
00579 // DSCADSCAN //
00580 //////////// */
00581 
00582 typedef struct
00583 {
00584 
00585         BYTE      low_channel;    /* INPUT: Low channel of the scan */
00586         BYTE      high_channel;   /* INPUT: High channel of the scan */
00587         DSCSAMPLE *sample_values; /* I/O:   The user must point this to memory that has been allocated and ready to accept (high - low + 1) DSCADSAMPLE values into it */
00588         BYTE      gain;           /* Obsolete */
00589 
00590 } DSCADSCAN;
00591 
00592 
00593 /*/////////////
00594 // REGPARAMS //
00595 //////////// */
00596 
00597 /* This structure is for internal driver use */
00598 
00599 typedef struct
00600 {
00601 
00602         DWORD address;
00603         BYTE  data;
00604 
00605 } REGPARAMS;
00606 
00607 
00608 /*/////////////
00609 // ERRPARAMS //
00610 //////////// */
00611 
00612 typedef struct
00613 {
00614 
00615         BYTE ErrCode;    /* OUTPUT: The numerical value of the last error */
00616         char *errstring; /* OUTPUT: A string description of the last error */
00617 
00618 } ERRPARAMS;
00619 
00620 
00621 /*/////////////
00622 // DSCAIOINT //
00623 //////////// */
00624 
00625 typedef struct
00626 {
00627 
00628         DWORD num_conversions;      /* INPUT: total # of conversions to write to sample_values, unless cycling. */
00629         FLOAT conversion_rate;      /* INPUT: interrupts per second  */
00630         FLOAT conversion_rate_final;/* OUTPUT: the actual conversion rate programmed into the clock  */
00631         BOOL  cycle;                /* INPUT: when done with num_conversions, restart at the beginning of the buffer?  */
00632         BOOL  internal_clock;       /* INPUT: use the internal clock (82c54) ? */
00633         BYTE  low_channel;          /* INPUT: lowest channel number to perform A/D conversion on  */
00634         BYTE  high_channel;         /* INPUT: highest channel number to perform A/D conversion on  */
00635         BOOL  external_gate_enable; /* INPUT: A/D dmm, dmm-16 only  */
00636         BOOL  internal_clock_gate;  /* INPUT: Set internal gating on or off (refer to manual) */
00637         DSCSAMPLE  *sample_values;       /* I/O:   pointer to the user's sample buffer */
00638         BOOL  fifo_enab;            /* INPUT: Fifo operation flag for int sample/scan modes. */
00639         WORD  fifo_depth;           /* INPUT: Fifo depth (if fifo mode used) */
00640         DWORD dump_threshold;           /* INPUT: Threshold at which to dump the sample buffer */
00641         BOOL  channel_align;        /* INPUT: if true, the interrupt will automatically realign the channels each cycle */
00642         BYTE  clksource;                        /* INPUT (PROM only): 0 for 100KHz, 1 for 10MHz internal clock source.*/
00643 
00644 } DSCAIOINT;
00645 
00646 
00647 /*//////////////////////////////
00648 // DSCAUTOCAL, DSCADCALPARAMS //
00649 ///////////////////////////// */
00650 
00651 typedef struct
00652 {
00653 
00654         BYTE   adrange;             /* INPUT:  A/D Range to calibrate (use 0xFF for all ranges) */
00655         BYTE   boot_adrange;        /* INPUT:  When cal'ed, this adrange is stored to BOOT values */
00656         FLOAT  ad_offset, ad_gain;  /* OUTPUT: Difference between target and measured vals. */
00657         DFLOAT target_values[8];    /* OUTPUT: Target values read from EEPROM */
00658 
00659         BOOL   use_eeprom;          /* Obsolete, but kept in for backwards compatibility */
00660                                     /* To set the reference values, use dsc(S/G)etReferenceVoltages */
00661         
00662 } DSCAUTOCAL, DSCADCALPARAMS;
00663 
00664 
00665 /*////////////////
00666 // SETCALPARAMS //
00667 /////////////// */
00668 
00669 /* This structure is here for backwards compatibility, but is no longer used */
00670 
00671 typedef struct
00672 {
00673   
00674         BYTE chan;          
00675         BOOL cal_enable;
00676 
00677 } SETCALPARAMS;
00678 
00679 
00680 /*///////////
00681 // DSCDACS //
00682 ////////// */
00683 
00684 #define DACS_MAX_CHANNELS 16
00685 
00686 typedef struct
00687 {
00688 
00689         BOOL channel_enable[DACS_MAX_CHANNELS]; /* INPUT: Which to update.  channel_enable[x] = 1 means that output_codes[x] is valid */
00690         DSCDACODE *output_codes; /* INPUT: A pointer to the user's array of DA codes */
00691 
00692 } DSCDACS;
00693 
00694 
00695 /*/////////////////
00696 // DSCDASETTINGS //
00697 //////////////// */
00698 
00699 typedef struct
00700 {
00701         BYTE polarity;      /* INPUT: 0 = BIPOLAR, 1 = UNIPOLAR */
00702         BYTE load_cal;      /* INPUT: 0 = FALSE, 1= TRUE. Loads calibration from eeprom */
00703         FLOAT range;            /* INPUT: Absolute value of maximum voltage */
00704 
00705 } DSCDASETTINGS;
00706 
00707 
00708 /*////////////
00709 // DAPARAMS //
00710 /////////// */
00711 
00712 typedef struct
00713 {
00714 
00715         BYTE channel;          /* INPUT: Which DA channel to modify */
00716         DSCDACODE output_code; /* INPUT: The new output value for the DA channel */
00717 
00718 } DAPARAMS;
00719 
00720 
00721 /*//////////////////
00722 // DSCDACALPARAMS //
00723 ///////////////// */
00724 
00725 typedef struct   
00726 {
00727         BOOL   fixed;       /* INPUT/OUTPUT: reports the "fixed" status that was detected.  fixed=FALSE means programmable. */
00728         BOOL   polarity;    /* INPUT/OUTPUT: Bipolar=FALSE, Unipolar=TRUE */
00729         DFLOAT darange;     /* INPUT:  D/A programmable value to calibrate */
00730         FLOAT  offset;      /* OUTPUT: Difference between target and measured vals. */
00731         FLOAT  gain;        /* OUTPUT: Difference between target and measured vals. */
00732         
00733         /*///////////////////////////
00734         // For DMMAT specific use: //
00735         ////////////////////////// */
00736         BOOL  ch0pol, ch0prog, ch0ext;  /* cho0pol=true: bipolar, ch0prog=true: programmable, ch0ext=true: external; */
00737         BOOL  ch1pol, ch1prog, ch1ext;
00738         FLOAT ref;
00739 
00740 } DSCDACALPARAMS; /* Single D/A channel */
00741 
00742 
00743 /*////////
00744 // DSCS //
00745 /////// */
00746 
00747 typedef struct
00748 {
00749 
00750         DWORD op_type;            /* OUTPUT: reports the current operation type.  Will usually be either OP_TYPE_NONE or OP_TYPE_INT */
00751         DWORD transfers;          /* OUTPUT: the number of A/D transfers the operation has performed in the current cycle */
00752         DWORD total_transfers;    /* OUTPUT: the total number of A/D transfers performed during every cycle */
00753         DWORD da_transfers;       /* OUTPUT: the number of D/A transfers the operation has performed in the current cycle */
00754         DWORD da_total_transfers; /* OUTPUT: the total number of D/A transfers performed during every cycle */
00755         DWORD overflows;          /* OUTPUT: increments this value each time an overflow occurs */
00756 
00757         /* The following are for backwards compatibility, not used anymore */
00758         BYTE  paused;
00759         BYTE  output;
00760         WORD  base_address;
00761         BYTE  int_level;
00762         BOOL  analog;   
00763 
00764 } DSCS;
00765 
00766 /*//////////////////////
00767 // DSCUSERINTFUNCTION //
00768 ///////////////////// */
00769 
00770 typedef struct
00771 {
00772 
00773         DSCUserInterruptFunction func; /* INPUT:  A pointer to the user's interrupt function */
00774         BYTE int_mode;                 /* INPUT:  Which user int mode to use */
00775         DWORD int_type;                /* INPUT:  Which interrupt type to attach this function to (INT_TYPE_XXX) */
00776 
00777 } DSCUSERINTFUNCTION;
00778 
00779 
00780 /*//////////////
00781 // DSCUSERINT //
00782 ///////////// */
00783 
00784 /* These input values are board specific, please refer to the user's manual */
00785 
00786 typedef struct
00787 {
00788         BYTE  intsource;
00789         BYTE  counter; 
00790         BYTE  clksource;
00791         FLOAT rate;     
00792         DWORD int_type;    /* OUTPUT: returns the "int_type" that this operation resulted in (INT_TYPE_XXX) */
00793         DSCUserInterruptFunction func; /* OUTPUT:  A pointer to the user's interrupt function */
00794         
00795 } DSCUSERINT;
00796 
00797 /*/////////
00798 // DSCCS //
00799 //////// */
00800 
00801 typedef struct
00802 {
00803 
00804         DWORD value; /* OUTPUT: Counter readback value */
00805         BYTE status; /* OUTPUT: Counter readback status */
00806 
00807 } DSCCS;
00808 
00809 
00810 /*/////////
00811 // DSCCR //
00812 //////// */
00813 
00814 /* Used only in dscCounterRead, otherwise mostly for internal driver use */
00815 
00816 
00817 typedef struct
00818 {
00819 
00820         BYTE control_code;   
00821         BYTE counter_number; 
00822         DWORD counter_data;  /* Counter write data */
00823         DSCCS counter0;      /* Counter read data */
00824         DSCCS counter1;
00825         DSCCS counter2;
00826 
00827 } DSCCR;
00828 
00829 
00830 /*/////////////
00831 // DSCDIOINT //
00832 //////////// */
00833 
00834 typedef struct
00835 {
00836 
00837         DWORD num_transfers;  /* INPUT:  Number of conversions to perform */
00838         BYTE port;            /* INPUT:  for boards w/ >8 bits of dio */
00839         BYTE size;            /* INPUT:  0-7 for bits 0-7, 8 for full byte, 16 for word */
00840         BOOL cycle;           /* INPUT:  Set to TRUE to repeat the operation continuously */
00841         BOOL internal_clock;  /* INPUT:  Set to TRUE to use the internal clock as a trigger, FALSE to use an external trigger */
00842         DFLOAT rate;          /* INPUT:  Rate for internal clock (if used) */
00843         BYTE mode;            /* INPUT:  for Garnet only */
00844         BYTE source;          /* INPUT:  for Onyx only */
00845         BYTE *digital_values; /* INPUT:  The array that holds the DIO values to send */
00846         DWORD fifo_depth;     /* INPUT:  FIFO depth (threshold) where interrupts are triggered */
00847         DWORD dump_threshold; /* INPUT:  Threshold at which to dump the sample buffer */
00848 
00849 } DSCDIOINT;
00850 
00851 /*/////////////
00852 //      DSCEMMDIO // this structure is for use with the EMMDIO function dscEMMDIO[G/S]etState 
00853 //////////// */
00854 
00855 typedef struct 
00856 {
00857 
00858         BYTE DIOpins[6];           /* EMMDIO I/O:    contains values to write to pins, or values read from pins - based on use_DIOpins */
00859         BOOL lock_port[6];         /* EMMDIO INPUT:  values for the lock bits at base+7 */
00860         BYTE edge_polarity[4];     /* EMMDIO OUTPUT: contains the polarity to each pin on ports 0-2 (each BYTE is one port w/ 8 pins) 0=negative, 1=positive */
00861         BYTE edge_detect[4];       /* EMMDIO INPUT:  set edge detection enabled (1) or disabled (0) for the 8 pins on each port 0-2 */
00862         BYTE edge_detect_int[4];   /* EMMDIO OUTPUT: read-only: specifies if an edge was detected on the pin since its port was last cleared */
00863         BYTE edge_detect_clear[3]; /* EMMDIO INPUT:  set to 1 for ech port 0-2 to clear the edge detection values */
00864         BOOL use_DIOpins;          /* EMMDIO INPUT:  0 = ignore DIOpins, 1 = use DIOpins */
00865         BOOL use_lock_port;        /* EMMDIO INPUT:  0 = ignore lock_port, 1 = use lock_port */
00866         BOOL use_edge_polarity;    /* EMMDIO INPUT:  0 = ignore edge_polarity, 1 = use edge_polarity */
00867         BOOL use_edge_detect;      /* EMMDIO INPUT:  0 = ignore edge_detect, 1 = use edge_detect */     
00868         BYTE interrupt_status;     /* EMMDIO OUTPUT: read-only: corresponds to base+6, bits 0-2 are interrupt status for port 0-2 */
00869 
00870 } DSCEMMDIO;
00871 
00872 
00873 /*/////////////////
00874 //      DSCOPTOSTATE // this structure is used for the dscOptoGetState/SetState
00875 //////////////// */
00876 
00877 #define DSCUD_MAX_OPTO 8 /* The maximum number of optos that can be reported by the above functions */
00878 
00879 typedef struct 
00880 {
00881 
00882         BYTE edge_polarity[DSCUD_MAX_OPTO];             /* READ/WRITE: contains the polarity to each pin, opto 0-3 (each opto has a programmable edge) 0=falling, 1=rising */
00883         BYTE edge_detect_enab[DSCUD_MAX_OPTO];  /* READ/WRITE:  set edge detection enabled (1) or disabled (0) for 4 pins, opto 0-3 */
00884         BYTE edge_status[DSCUD_MAX_OPTO];               /* READ: read-only, specifies if an edge was detected on the pin, opto 0-3 */
00885         BYTE oint_state[DSCUD_MAX_OPTO];                /* READ: read-only, the state of each opto */
00886 
00887         BYTE dmm48at_oint_state;                /* READ: this reports the state of the opto register, base+7, on the DMM48 when the last opto interrupt occured.  Only valid when opto interrupts are enabled. 
00888                                                                                                         For DMM48 this variable replaces the edge_status array */
00889 
00890 } DSCOPTOSTATE;
00891 
00892 
00893 /*/////////////////////
00894 // DSCEMMDIORESETINT //
00895 //////////////////// */
00896 
00897 typedef struct
00898 {
00899 
00900         BOOL use_lock_port;        /* INPUT:  0 = ignore lock_port, 1 = use lock_port */
00901         BOOL lock_port[6];         /* INPUT:  values for the lock bits at base+7 */
00902         BYTE edge_detect_clear[3]; /* INPUT:  set to 1 for ech port 0-2 to clear the edge detection values */
00903 
00904 } DSCEMMDIORESETINT;
00905 
00906 
00907 /*///////////////
00908 // DSCWATCHDOG //
00909 ////////////// */
00910 
00911 typedef struct
00912 {
00913 
00914         WORD wd1;      /* INPUT: WD1 16-bit timer value (runs at ~32KHz - max 2 seconds) */
00915         BYTE wd2;      /* INPUT: WD2  8-bit timer value (runs at ~32KHz - max 7.2ms) */
00916         BYTE options;  /* INPUT: option mask (e.g. "PROM_WD_TRIGGER_SMI | PROM_WD_TRIGGER_NMI") 
00917                                                                                                 or "HERC_WD_TRIGGER_SMI | HERC_WD_TRIGGER_NMI"*/
00918         
00919 } DSCWATCHDOG;
00920 
00921 
00922 /*////////////
00923 //      DSCPWM  //
00924 /////////// */
00925 
00926 typedef struct
00927 {
00928         DFLOAT output_freq;  /* Freq in Hz  */
00929         FLOAT duty_cycle;    /* % of freq you want as duty cycle. Range 0-100 */
00930         BYTE polarity;       /* polarity of output pulse. 0 for active low, 1 for active high */
00931         BYTE pwm_circuit;    /* pwm circuit. Range 0-3 */
00932         BOOL output_enab;    /* 0 for disable, 1 for enable output */
00933 
00934 } DSCPWM;
00935 
00936 
00937 /*/////////////////
00938 //      DSCAACSTATUS //
00939 //////////////// */
00940 
00941 typedef struct 
00942 {
00943         BOOL pic_present; /* TRUE if PIC device is present, FALSE otherwise */
00944         BOOL pic_busy;    /* TRUE if PIC device is busy with an operation, FALSE otherwise */
00945         BOOL aac_hold;    /* TRUE if AAC Hold-Off is enabled, FALSE otherwise */
00946         BOOL aac_error;   /* TRUE if the last AAC command has failed, FALSE otherwise */
00947         BOOL aac_active;  /* TRUE if the AAC routing is currently running, FALSE otherwise */
00948 
00949 } DSCAACSTATUS;
00950 
00951 
00952 /*////////////////
00953 //      DSCWGCONFIG //
00954 /////////////// */
00955 
00956 typedef struct 
00957 {
00958         DWORD depth;         /* WG depth (absolute, i.e. 64, 128, 256, 512, etc.) */
00959         DWORD ch_per_frame;  /* # of values to send from the buffer during a frame, check define WG_CH_PER_FRAME_X*/
00960         DWORD source;        /* WG trigger source, check define WG_SRC_XXX */
00961 
00962 } DSCWGCONFIG;
00963 
00964 
00965 
00966 
00967 
00968 /*/////////////////////////////////////////////////////////////////
00969 ///////////////////////////////////////////////////////////////////
00970 ///////////////////////////////////////////////////////////////////
00971 //////////////////// API Function Prototypes //////////////////////
00972 ///////////////////////////////////////////////////////////////////
00973 ///////////////////////////////////////////////////////////////////
00974 //////////////////////////////////////////////////////////////// */
00975 
00976 /*////////////////////////////
00977 // Error-Handling Functions //
00978 /////////////////////////// */
00979 
00980 BYTE DSCUDAPICALL dscGetLastError(ERRPARAMS* errparams);
00981 DSCUDAPICALL char* dscGetErrorString(BYTE error_code);
00982 
00983 /*////////////////////////////
00984 // Initialization Functions //
00985 /////////////////////////// */
00986 
00987 BYTE DSCUDAPICALL dscInit(WORD version);
00988 BYTE DSCUDAPICALL dscFree(void);
00989 BYTE DSCUDAPICALL dscInitBoard(BYTE boardtype, DSCCB* dsccb, DSCB* board);
00990 BYTE DSCUDAPICALL dscPCIInitBoard(BYTE boardtype, DSCCBP* dsccbp, DSCB* board);
00991 BYTE DSCUDAPICALL dscFreeBoard(DSCB board);
00992 
00993 /*/////////////////
00994 // A/D Functions //
00995 //////////////// */
00996 
00997 BYTE DSCUDAPICALL dscADSetSettings(DSCB board, DSCADSETTINGS* settings);
00998 BYTE DSCUDAPICALL dscADSetChannel(DSCB board, BYTE low_channel, BYTE high_channel);
00999 BYTE DSCUDAPICALL dscADSample(DSCB board, DSCSAMPLE* sample);
01000 BYTE DSCUDAPICALL dscADSampleInt(DSCB board, DSCAIOINT* dscaioint);
01001 BYTE DSCUDAPICALL dscADSampleAvg(DSCB board, DFLOAT* average, int count);
01002 BYTE DSCUDAPICALL dscADScan(DSCB board, DSCADSCAN* dscadscan, DSCSAMPLE* sample_values);
01003 BYTE DSCUDAPICALL dscADScanInt(DSCB board, DSCAIOINT* dscaioint);
01004 BYTE DSCUDAPICALL dscADScanAvg(DSCB board, DSCADSCAN* dscadscan, DFLOAT* average_values, int count);
01005 
01006 /*/////////////////
01007 // D/A Functions //
01008 //////////////// */
01009 
01010 BYTE DSCUDAPICALL dscDASetPolarity(DSCB board, BYTE polarity);
01011 BYTE DSCUDAPICALL dscDASetSettings( DSCB board, DSCDASETTINGS * dasettings);
01012 BYTE DSCUDAPICALL dscDAConvert(DSCB board, BYTE channel, DSCDACODE output_code);
01013 BYTE DSCUDAPICALL dscDAConvertScan(DSCB board, DSCDACS *dscdacs);
01014 BYTE DSCUDAPICALL dscDAConvertScanInt(DSCB board, DSCAIOINT *dscaioint);
01015 
01016 /*/////////////////
01017 // DIO Functions //
01018 //////////////// */
01019 
01020 BYTE DSCUDAPICALL dscDIOSetConfig(DSCB board, BYTE* config_bytes);
01021 BYTE DSCUDAPICALL dscDIOInputByte(DSCB board, BYTE port, BYTE* digital_value);
01022 BYTE DSCUDAPICALL dscDIOInputWord(DSCB board, BYTE port, WORD* digital_value);
01023 BYTE DSCUDAPICALL dscDIOOutputByte(DSCB board, BYTE port, BYTE digital_value);
01024 BYTE DSCUDAPICALL dscDIOOutputWord(DSCB board, BYTE port, WORD digital_value);
01025 BYTE DSCUDAPICALL dscDIOInputBit(DSCB board,BYTE port,BYTE bit,BYTE  *digital_value);
01026 BYTE DSCUDAPICALL dscDIOOutputBit(DSCB board,BYTE port, BYTE bit,BYTE digital_value);
01027 BYTE DSCUDAPICALL dscDIOSetBit(DSCB board,BYTE port,BYTE bit);
01028 BYTE DSCUDAPICALL dscDIOClearBit(DSCB board,BYTE port,BYTE bit);
01029 BYTE DSCUDAPICALL dscDIOInputInt(DSCB board,DSCDIOINT *dscdioint);
01030 BYTE DSCUDAPICALL dscDIOOutputInt(DSCB board,DSCDIOINT *dscdioint);
01031 BYTE DSCUDAPICALL dscDMM32DIOOutputByte(DSCB board, BYTE port, BYTE digital_value);
01032 BYTE DSCUDAPICALL dscDMM32DIOInputByte(DSCB board, BYTE port, BYTE  *digital_value);
01033 
01034 
01035 /*////////////////////
01036 //      Opto Functions  //
01037 /////////////////// */
01038 
01039 BYTE DSCUDAPICALL dscOptoInputByte(DSCB board, BYTE port, BYTE * optoValue);
01040 BYTE DSCUDAPICALL dscOptoInputBit(DSCB board, BYTE port, BYTE bit, BYTE * optoValue);
01041 BYTE DSCUDAPICALL dscOptoGetPolarity(DSCB board, BYTE * polarity);
01042 
01043 
01044 /*////////////////////
01045 //      Opto Edge State //
01046 /////////////////// */
01047 
01048 BYTE DSCUDAPICALL dscOptoGetState(DSCB board, DSCOPTOSTATE* state);
01049 BYTE DSCUDAPICALL dscOptoSetState(DSCB board, DSCOPTOSTATE* state);
01050 
01051 /*/////////////////////
01052 // Counter Functions //
01053 //////////////////// */
01054 
01055 BYTE DSCUDAPICALL dscCounterSetRateSingle(DSCB board, float hertz, DWORD ctr); // for ctr, please use the counter set rate single defines on top
01056 BYTE DSCUDAPICALL dscCounterSetRate(DSCB board, float hertz);
01057 BYTE DSCUDAPICALL dscCounterDirectSet(DSCB board, BYTE code, DWORD data, BYTE ctr_number);
01058 BYTE DSCUDAPICALL dscCounterRead(DSCB board, DSCCR* dsccr);
01059 
01060 /*/////////////////////////
01061 // Calibration Functions //
01062 //////////////////////// */
01063 
01064 BYTE DSCUDAPICALL dscSetCalMux(DSCB board, BOOL on);
01065 BYTE DSCUDAPICALL dscADAutoCal(DSCB board, DSCADCALPARAMS* params);
01066 BYTE DSCUDAPICALL dscDAAutoCal(DSCB board, DSCDACALPARAMS* params);
01067 BYTE DSCUDAPICALL dscADCalVerify(DSCB board, DSCADCALPARAMS* params);
01068 BYTE DSCUDAPICALL dscDACalVerify(DSCB board, DSCDACALPARAMS* params);
01069 BYTE DSCUDAPICALL dscGetReferenceVoltages(DSCB board, DFLOAT* refs);
01070 BYTE DSCUDAPICALL dscSetReferenceVoltages(DSCB board, DFLOAT* refs);
01071 BYTE DSCUDAPICALL dscDAGetOffsets(DSCB board, DFLOAT* offsets, int count);
01072 BYTE DSCUDAPICALL dscDASetOffsets(DSCB board, DFLOAT* offsets, int count);
01073 
01074 /*////////////////////
01075 // Relay Functions      //
01076 /////////////////// */
01077 
01078 BYTE DSCUDAPICALL dscSetRelay(DSCB board, BYTE relay, BYTE value); // relays start from 0
01079                                                                                                                                    // For ir104, please use dscIR104 functions
01080 BYTE DSCUDAPICALL dscGetRelay(DSCB board, BYTE relay, BYTE* value); // relays start from 0
01081                                                                                                                                         // For ir104, please use dscIR104 functions
01082 BYTE DSCUDAPICALL dscSetRelayMulti(DSCB board, BYTE relayGroup, BYTE value); /*each relayGroup groups 8 relays together. 
01083                                                                                                                                                          ex. relayGroup 0 refers to relays 0-7
01084                                                                                                                                                          relayGroup 1 referes to relays 8-15, etc.
01085                                                                                                                                                      for boards with relays that aren't multiples 
01086                                                                                                                                                          of 8, such as IR104, relays 16-20 are part of
01087                                                                                                                                                          relayGroup 2. The same applies to other boards.
01088                                                                                                                                                          Parameter value is the value to set for each relay. 
01089                                                                                                                                                          Bit0 of value is value set for relay 0, 
01090                                                                                                                                                          bit1 of value is value set for relay 1, etc 
01091                                                                                                                                                                                                                                                         */
01092 BYTE DSCUDAPICALL dscGetRelayMulti(DSCB board, BYTE relayGroup, BYTE * value); /*each relayGroup groups 8 relays together. 
01093                                                                                                                                                          ex. relayGroup 0 refers to relays 0-7
01094                                                                                                                                                          relayGroup 1 referes to relays 8-15, etc.
01095                                                                                                                                                      for boards with relays that aren't multiples 
01096                                                                                                                                                          of 8, such as IR104, relays 16-20 are part of
01097                                                                                                                                                          relayGroup 2. The same applies to other boards.
01098                                                                                                                                                          Parameter value is the value to set for each relay. 
01099                                                                                                                                                          Bit0 of value is value set for relay 0, 
01100                                                                                                                                                          bit1 of value is value set for relay 1, etc */
01101 
01102 /*//////////////////////
01103 // WATCHDOG Functions //
01104 ///////////////////// */
01105 
01106 BYTE DSCUDAPICALL dscWatchdogEnable(DSCB board, WORD timer16, BYTE timer8, SDWORD options);
01107 BYTE DSCUDAPICALL dscWatchdogDisable(DSCB board);
01108 BYTE DSCUDAPICALL dscWatchdogTrigger(DSCB board);
01109 
01110 
01111 /*////////////////////////////////
01112 //      PULSE WIDTH MOD Functions       //
01113 /////////////////////////////// */
01114 
01115 BYTE DSCUDAPICALL dscPWMLoad(DSCB board, BYTE pwm_circuit, BYTE counter, DWORD value);
01116 BYTE DSCUDAPICALL dscPWMConfig(DSCB board, BYTE * config_byte);
01117 BYTE DSCUDAPICALL dscPWMClear(DSCB board, BYTE pwm_circuit);
01118 BYTE DSCUDAPICALL dscPWMFunction(DSCB board, DSCPWM * dscpwm);
01119 
01120 /*//////////////////////
01121 // Register Functions //
01122 ///////////////////// */
01123 
01124 BYTE DSCUDAPICALL dscRegisterRead(DSCB board, WORD address, BYTE* data);
01125 BYTE DSCUDAPICALL dscRegisterWrite(DSCB board, WORD address, BYTE data);
01126 BYTE DSCUDAPICALL dscInp(DWORD address, BYTE* value);
01127 BYTE DSCUDAPICALL dscInpw(DWORD address, WORD* value);
01128 BYTE DSCUDAPICALL dscInpl(DWORD address, DWORD* value);
01129 BYTE DSCUDAPICALL dscInpws(DWORD address, WORD* buffer, WORD n);
01130 BYTE DSCUDAPICALL dscOutp(DWORD address, BYTE value);
01131 BYTE DSCUDAPICALL dscOutpw(DWORD address, WORD value);
01132 BYTE DSCUDAPICALL dscOutpl(DWORD address, DWORD value);
01133 BYTE DSCUDAPICALL dscOutpws(DWORD address, WORD* buffer, WORD n);
01134 
01135 /*///////////////////
01136 // Misc. Functions //
01137 ////////////////// */
01138 
01139 BYTE DSCUDAPICALL dscSleep(DWORD ms);
01140 BYTE DSCUDAPICALL dscGetTime(DWORD* ms);
01141 BYTE DSCUDAPICALL dscGetEEPROM(DSCB board, DWORD address, BYTE* data);
01142 BYTE DSCUDAPICALL dscSetEEPROM(DSCB board, DWORD address, BYTE data);
01143 BYTE DSCUDAPICALL dscSetTrimDac(DSCB board, DWORD trimDac, BYTE value);
01144 BYTE DSCUDAPICALL dscGetStatus(DSCB board, DSCS* status);
01145 BYTE DSCUDAPICALL dscCancelOp(DSCB board);
01146 BYTE DSCUDAPICALL dscCancelOpType(DSCB board, DWORD int_type);
01147 BYTE DSCUDAPICALL dscPauseOp(DSCB board);
01148 BYTE DSCUDAPICALL dscResumeOp(DSCB board);
01149 BYTE DSCUDAPICALL dscSetUserInterruptFunction(DSCB board, DSCUSERINTFUNCTION * dscuserintfunc);
01150 BYTE DSCUDAPICALL dscSetUserInterruptFunctionType(DSCB board, DSCUSERINTFUNCTION * dscuserintfunc, DWORD int_type);
01151 BYTE DSCUDAPICALL dscUserInt(DSCB board, DSCUSERINT * dscuserint, DSCUserInterruptFunction function);
01152 BYTE DSCUDAPICALL dscUserIntVB(DSCB board, DSCUSERINT * dscuserint);
01153 BYTE DSCUDAPICALL dscClearUserInterruptFunction(DSCB board);
01154 BYTE DSCUDAPICALL dscClearUserInterruptFunctionType(DSCB board, DWORD int_type);
01155 BYTE DSCUDAPICALL dscGetBoardMacro(char* boardtype, BYTE* macro);
01156 BYTE DSCUDAPICALL dscGetFPGARev(DSCB board, WORD* fpga);
01157 BYTE DSCUDAPICALL dscSetSystemPriority(DWORD priority);
01158 
01159 /*/////////////////////////////
01160 // Unit Conversion Functions //
01161 //////////////////////////// */
01162 BYTE DSCUDAPICALL dscADCodeToVoltage(DSCB board, DSCADSETTINGS adsettings, DSCSAMPLE adcode, DFLOAT *voltage);
01163 BYTE DSCUDAPICALL dscVoltageToADCode(DSCB board, DSCADSETTINGS adsettings, DFLOAT voltage, DSCSAMPLE *adcode);
01164 BYTE DSCUDAPICALL dscDACodeToVoltage(DSCB board, DSCDASETTINGS dasettings, DSCDACODE dacode, DFLOAT *voltage);
01165 BYTE DSCUDAPICALL dscVoltageToDACode(DSCB board, DSCDASETTINGS dasettings, DFLOAT voltage, DSCDACODE *dacode);
01166 
01167 /*///////////////
01168 //      IR104      //
01169 ////////////// */
01170 
01171 BYTE DSCUDAPICALL dscIR104ClearRelay(DSCB board,BYTE relay);    /*relay range 1-20*/
01172 BYTE DSCUDAPICALL dscIR104SetRelay(DSCB board,BYTE relay);              /*relay range 1-20*/
01173 BYTE DSCUDAPICALL dscIR104RelayInput(DSCB board, BYTE relay, BYTE* value);      /*relay range 1-20*/
01174 BYTE DSCUDAPICALL dscIR104OptoInput(DSCB board,BYTE opto, BYTE* value); /*opto range 1-20*/
01175 
01176 /*////////////////////
01177 // EMMDIO Functions //
01178 /////////////////// */
01179 
01180 BYTE DSCUDAPICALL dscEMMDIOGetState(DSCB board, DSCEMMDIO* state);
01181 BYTE DSCUDAPICALL dscEMMDIOSetState(DSCB board, DSCEMMDIO* state);
01182 BYTE DSCUDAPICALL dscEMMDIOResetInt(DSCB board, DSCEMMDIORESETINT* edge);
01183 
01184 /*////////////////////
01185 // DMM32X Functions //
01186 /////////////////// */
01187 
01188 BYTE DSCUDAPICALL dscEnhancedFeaturesEnable(DSCB board, BOOL enable);
01189 BYTE DSCUDAPICALL dscPICOutp(DSCB board, DWORD address, BYTE value);
01190 BYTE DSCUDAPICALL dscPICInp(DSCB board, DWORD address, BYTE* value);
01191 BYTE DSCUDAPICALL dscPICProgEnable(DSCB board, BOOL enable);
01192 BYTE DSCUDAPICALL dscPICProgSet(DSCB board, BOOL dout, BOOL dstate, BOOL cstate);
01193 BYTE DSCUDAPICALL dscPICProgGet(DSCB board, BOOL *din);
01194 BYTE DSCUDAPICALL dscAACCommand(DSCB board, DWORD cmd);
01195 BYTE DSCUDAPICALL dscAACGetStatus(DSCB board, DSCAACSTATUS *status);
01196 BYTE DSCUDAPICALL dscWGCommand(DSCB board, DWORD cmd);
01197 BYTE DSCUDAPICALL dscWGConfigSet(DSCB board, DSCWGCONFIG *config);
01198 BYTE DSCUDAPICALL dscWGBufferSet(DSCB board, DWORD address, DSCDACODE value, DWORD channel, BOOL simul);
01199 
01200 /*/////////////////////
01201 // QMM SECTION BELOW //
01202 //////////////////// */
01203 
01204 /* QMM counter group */
01205 #define QMM_COUNTER_GROUP_1             1
01206 #define QMM_COUNTER_GROUP_2             2
01207 
01208 /* QMM fout/counter source */
01209 #define QMM_SOURCE_E1_TC_NM1            0
01210 #define QMM_SOURCE_SRC1                 1
01211 #define QMM_SOURCE_SRC2                 2
01212 #define QMM_SOURCE_SRC3                 3
01213 #define QMM_SOURCE_SRC4                 4
01214 #define QMM_SOURCE_SRC5                 5
01215 #define QMM_SOURCE_GATE1                6
01216 #define QMM_SOURCE_GATE2                7
01217 #define QMM_SOURCE_GATE3                8
01218 #define QMM_SOURCE_GATE4                9
01219 #define QMM_SOURCE_GATE5                10
01220 #define QMM_SOURCE_F1_4MHZ              11
01221 #define QMM_SOURCE_F2_400KHZ            12
01222 #define QMM_SOURCE_F3_40KHZ             13
01223 #define QMM_SOURCE_F4_4KHZ              14
01224 #define QMM_SOURCE_F5_400HZ             15
01225 
01226 /* QMM time of day mode */
01227 #define QMM_TOD_DISABLED                0
01228 #define QMM_TOD_DIVIDE_BY_5             1
01229 #define QMM_TOD_DIVIDE_BY_6             2
01230 #define QMM_TOD_DIVIDE_BY_10            3
01231 
01232 /* QMM gating control */
01233 #define QMM_NO_GATING                   0
01234 #define QMM_ACTIVE_HIGH_TC_NM1          1
01235 #define QMM_ACTIVE_HIGH_LEVEL_GATE_NP1  2
01236 #define QMM_ACTIVE_HIGH_LEVEL_GATE_NM1  3
01237 #define QMM_ACTIVE_HIGH_LEVEL_GATE_N    4
01238 #define QMM_ACTIVE_LOW_LEVEL_GATE_N     5
01239 #define QMM_ACTIVE_HIGH_EDGE_GATE_N     6
01240 #define QMM_ACTIVE_LOW_EDGE_GATE_N      7
01241 
01242 /* QMM output control */
01243 #define QMM_INACTIVE_OUTPUT_LOW         0
01244 #define QMM_ACTIVE_HIGH_PULSE_ON_TC     1
01245 #define QMM_TOGGLE_ON_TC                2
01246 #define QMM_INACTIVE_OUTPUT_HIGH        4
01247 #define QMM_ACTIVE_LOW_PULSE_ON_TC      5
01248 
01249 /* QMM counter actions */
01250 #define QMM_ACTION_NONE                 0
01251 #define QMM_ACTION_ARM                  1
01252 #define QMM_ACTION_LOAD                 2
01253 #define QMM_ACTION_LOAD_AND_ARM         3
01254 #define QMM_ACTION_DISARM_AND_SAVE      4
01255 #define QMM_ACTION_SAVE                 5
01256 #define QMM_ACTION_DISARM               6
01257 
01258 /* QMM special counter actions */
01259 #define QMM_SPECIAL_CLEAR_TOGGLE_OUTPUT 0
01260 #define QMM_SPECIAL_SET_TOGGLE_OUTPUT   1
01261 #define QMM_SPECIAL_STEP_COUNTER        2
01262 #define QMM_SPECIAL_PROGRAM_ALARM       3
01263 
01264 /* QMM frequency intervals */
01265 #define QMM_INTERVAL_1MS_1KHZ           0
01266 #define QMM_INTERVAL_10MS_100HZ         1
01267 #define QMM_INTERVAL_100MS_10HZ         2
01268 #define QMM_INTERVAL_1S_1HZ             3
01269 #define QMM_INTERVAL_10S_01HZ           4
01270 
01271 /* QMM master mode register */
01272 typedef struct
01273 {
01274 
01275         BYTE counter_group;
01276         BYTE fout_divider;
01277         BYTE fout_source;
01278         BYTE compare1_enable;
01279         BYTE compare2_enable;
01280         BYTE tod_mode;
01281 
01282 } DSCQMM_MMR;
01283 
01284 /* QMM counter mode register */
01285 typedef struct
01286 {
01287 
01288         BYTE counter;
01289         BYTE gating_control;
01290         BYTE active_source_edge;
01291         BYTE count_source;
01292         BYTE special_gate;
01293         BYTE reload_source;
01294         BYTE cycle;
01295         BYTE count_type;
01296         BYTE count_direction;
01297         BYTE output_control;
01298 
01299 } DSCQMM_CMR;
01300 
01301 /* QMM multiple counter control */
01302 typedef struct
01303 {
01304 
01305         BYTE group1_action;
01306         BYTE group1_counter_select;
01307         BYTE group2_action;
01308         BYTE group2_counter_select;
01309         
01310 } DSCQMM_MCC;
01311 
01312 /* QMM special counter functions */
01313 typedef struct
01314 {
01315 
01316         BYTE counter;
01317         BYTE action;
01318         WORD alarm_value;
01319 
01320 } DSCQMM_SCF;
01321 
01322 
01323 
01324 /* QMM pulse width modulation control */
01325 typedef struct
01326 {
01327 
01328         BYTE  init;
01329         BYTE  counter;
01330         FLOAT output_freq;
01331         FLOAT duty_cycle;
01332         
01333         DWORD input_freq;
01334         WORD  load_reg;
01335         WORD  hold_reg; 
01336         BYTE  hit_extreme;
01337 
01338 } DSCQMM_PWM;
01339 
01340 
01341 
01342 /* QMM Function Prototypes */
01343 
01344 BYTE DSCUDAPICALL dscQMMReset(DSCB board);
01345 
01346 BYTE DSCUDAPICALL dscQMMSetMMR(DSCB board, DSCQMM_MMR* dscqmmmmr);
01347 BYTE DSCUDAPICALL dscQMMSetCMR(DSCB board, DSCQMM_CMR* dscqmmcmr);
01348 BYTE DSCUDAPICALL dscQMMCounterControl(DSCB board, DSCQMM_MCC* dscqmmmcc, BYTE * status);
01349 BYTE DSCUDAPICALL dscQMMSingleCounterControl(DSCB board, BYTE counter, BYTE action);
01350 
01351 BYTE DSCUDAPICALL dscQMMSetLoadRegister(DSCB board, BYTE counter, WORD value);
01352 BYTE DSCUDAPICALL dscQMMSetHoldRegister(DSCB board, BYTE counter, WORD value);
01353 BYTE DSCUDAPICALL dscQMMReadHoldRegister(DSCB board, BYTE counter, WORD* value);
01354 
01355 BYTE DSCUDAPICALL dscQMMSpecialCounterFunction(DSCB board, DSCQMM_SCF* dscqmmscf);
01356 BYTE DSCUDAPICALL dscQMMMeasureFrequency(DSCB board, BYTE interval, BYTE source, FLOAT* freq);
01357 BYTE DSCUDAPICALL dscQMMMeasurePeriod(DSCB board, BYTE frequency, FLOAT* period);
01358 
01359 BYTE DSCUDAPICALL dscQMMPulseWidthModulation(DSCB board, DSCQMM_PWM* dscqmmpwm);
01360 
01361 /* END QMM SECTION */
01362 
01363 
01364 #ifdef __cplusplus
01365 } /* Closes the extern "C" */
01366 #endif
01367 
01368 /* MS Visual C++ only - end 1-byte structure alignment */
01369 #ifndef MSVC_1_52
01370 #ifdef _MSC_VER
01371 #pragma pack(pop, dscud_packing)
01372 #endif
01373 #endif
01374 
01375 
01376 #endif /* #ifndef _DSCUD_H */
01377 

Generated on Wed Sep 5 12:54:20 2007 for DSACSS Operational Code by  doxygen 1.3.9.1