Main Page Class Hierarchy Compound List File List Compound Members File Members

# kwhdrs_ew.h

Go to the documentation of this file.

    00001 /*
    00002  *   THIS FILE IS UNDER RCS - DO NOT MODIFY UNLESS YOU HAVE
    00003  *   CHECKED IT OUT USING THE COMMAND CHECKOUT.
    00004  *
    00005  *    $Id: kwhdrs__ew_8h-source.html 2161 2006-05-19 16:55:03Z paulf $
    00006  *
    00007  *    Revision history:
    00008  *     $Log$
    00008  *     Revision 1.1  2006/05/19 16:55:02  paulf
    00008  *     first inclusion
    00008  *
    00009  *     Revision 1.1  2002/03/22 19:53:47  lucky
    00010  *     Initial revision
    00011  *
    00012  *
    00013  */
    00014
    00015 /* nkwhdrs.h   Combined K2 & Mt. Whitney header definition
    00016               also Tag definition & Frame header definition  */
    00017
    00018 /*   2/18/99 -- [ET]  Modified version with 'FIX_8BYTES_K2RW' fix */
    00019
    00020 /*   11/3/00 -- [JL]  Changed the variable type of cellStartTime[5]
    00021                       in MODEM_RW_PARMS from int to short.
    00022
    00023                       Changed the variable type of blockTime
    00024                       in FRAME_HEADER from
    00025                       unsigned long blockTime;
    00026                          to
    00027                       unsigned short blockTime;
    00028                       unsigned short blockTime2;
    00029                       This circumvents a mis-alignment problem
    00030                       that otherwise occurs due to the fact
    00031                       that long variables on the SUN are aligned
    00032                       on longword boundaries.
    00033
    00034                       Reversed [ET]'s modification of 2/18/99
    00035                       and fixed the problem properly.
    00036
    00037                       Added SENSOR TYPE CODES 32-40
    00038
    00039                       */
    00040 /**************************************************************
    00041
    00042 REVISION HISTORY:
    00043
    00044 Version 1.00 (July 5, 1994)
    00045 -------------------------
    00046 Initial release with support for 12 channels.
    00047
    00048 Version 1.10 (August 25, 1994)
    00049 ----------------------------
    00050 NOTE: all structure sizes and previous parameter offsets remain the same.
    00051
    00052 Used expansion space in CHANNEL_RW_PARMS to add the following:
    00053    unsigned short sensorSerialNumberExt;  (high word of sensor serial number)
    00054    float resp1,resp2,resp3,resp4,resp5,resp6; (sensor response)
    00055
    00056 Used expansion space in MISC_RW_PARMS to add the following:
    00057    unsigned char minBatteryVoltage; (minimum battery voltage x 10)
    00058
    00059 Added new sensor code definitions for FBA 4g, 2g, 1g, 0.5g, 0.25g and 0.1g
    00060 for parameter CHANNEL_RW_PARMS.sensorType.  The code definitions are
    00061    #define SENSOR_FBA_4G 11
    00062    #define SENSOR_FBA_2G 12
    00063                 etc.
    00064
    00065 Changed MISC_RO_PARMS.batteryVoltage type from unsigned short to signed
    00066 short.  MISC_RO_PARMS.batteryVoltage has negative value if charging.
    00067 (For example, MISC_RO_PARMS.batteryVoltage = -130 indicates 13.0 V
    00068 and charging).
    00069
    00070 Redefined the meaning of STREAM_RW_PARMS.filterFlag.
    00071 Redefined the meaning of MODEM_RW_PARMS.flags.
    00072 Changed TIMING_RW_PARMS.gpsTurnOnInterval from hours to minutes.
    00073
    00074 New parameters:
    00075    MISC_RO_PARMS.temperature
    00076    MISC_RO_PARMS.restartSource
    00077    MISC_RW_PARMS.networkFlag
    00078    FRAME_HEADER.msec
    00079    STREAM_RO_PARMS.nscans
    00080    STREAM_RO_PARMS.startTimeMsec
    00081    STREAM_RO_PARMS.triggerTimeMsec
    00082    CHANNEL_RO_PARMS.aqOffset
    00083
    00084    Added on 8/26/94:
    00085    TIMING_RO_PARMS.gpsLongitude
    00086    TIMING_RO_PARMS.gpsLatitude
    00087    TIMING_RO_PARMS.gpsAltitude
    00088
    00089    Added 9/9/94:
    00090    MODEM_RW_PARMS.flags: added more definitions for bit fields
    00091
    00092    Added 10/11/94:
    00093    TIMING_RO_PARMS.dacCount
    00094
    00095
    00096   10/20/94 make note to CORRECT name:
    00097    STREAM_RW_PARMS.triggerThreshold & .detriggerThreshold ACTUALLY 'VOTES TO TRIGGER' !!!!!
    00098
    00099    11/18/94   make header 24 channels -- to check arrays --  OK!
    00100
    00101    Version 1.20 (28 November 1994)
    00102  ---------------------------------------
    00103    11/29/94  make header 18 channels - Mt.Whitney -- for now
    00104                 MAX_CHANNELS 18
    00105                 FRAME_HEADER_TYPE:  FHT16 3   one 16-bit channel bit map
    00106                                     FHT24 4     "        "                + byte bit map
    00107                 PARAMETER_VERSION 120
    00108  ---------------------------------------------------------
    00109
    00110
    00111
    00112   Version 1.20 Mt Whit / 1.30 K2 (January 30, 1995) (March 3, 1995)
    00113   ----------------------------
    00114       Moved MTWHITNEY define here from mt.h to allow preprocessing
    00115       for different headers for K2 and Mt Whit
    00116               Mt Whit:        MAX_CHANNELS                    12 -> 18
    00117                                       PARAMETER_VERSION               110 -> 120
    00118                                       FRAME_HEADER_TYPE               3 (16 ch) -> 4 (24 ch)
    00119
    00120       FRAME_HEADER:  Renamed 'unsigned char pad4' to 'uc channelBitMap1' to
    00121       support chan 17-24 (chan 1-16 are in channelBitMap)
    00122
    00123       MISC_RW_PARMS: added ul channel_bitmap, ul cutler_bitmap,
    00124       uc cutler_decimation, uc cutler_irig_type, uc cutler_protocol;
    00125       uc cutlerCode now just sets the baudrate;
    00126       reduced 'char bpad[14]' & 'int wpad[7]
    00127       to [10] & [3] to keep structure the same size
    00128
    00129       MISC_RO_PARMS: add us installedChan so QT can see how many
    00130       channels are installed; decreased char bytepad[5] -> [3] to
    00131       keep struct the same size
    00132
    00133       K2_ALARM: changed ui channelBitMap to ulong
    00134
    00135   *********************************************
    00136
    00137      8/25/94
    00138      3/03/95   Ver 1.20/1.30
    00139               remove K2 File System(K2-Directory) definitions. not used
    00140               remove EVT_SUMMARY, not used
    00141               remove STATUS_INFO, not used
    00142               add from another .H: K2_TAG
    00143
    00144   -----------------03-05-95 06:23pm-----------------
    00145    3/05/95  update with 1.20/1.30 header
    00146             make final header, frame & tag structures = typedefs
    00147   --------------------------------------------------
    00148
    00149   -----------------03-16-95 01:05pm-----------------
    00150    3/16/95  combined version K2 & MW headers - 12/18 channels
    00151   --------------------------------------------------
    00152
    00153    ----------------------------------------------
    00154    5/21/96  add Parameters to Mt. Whitney (& K2)
    00155             NO CHANGE IN VERSION NUMBER - REDEFINITION OF EXISTING PADS
    00156
    00157             STREAM_RO_PARAMS: pad[2] -> triggerBitMap, pad[1]
    00158             MISC_RW_PARMS: bpad[11],wpad[3] -> char siteID[17]
    00159             MODEM_RW_PARMS:
    00160
    00161               char pauseBetweenCalls   '' define '0'= random delay 5-30sec
    00162
    00163               from:  char bytepad[17]
    00164               to:    char cellShare;  '' K2 only, =0 for 1 Hz output, =1 for cell phone ''
    00165                      char cellOnTime;       '' in minutes ''
    00166                      unsigned char cellWarmupTime;  '' in seconds ''
    00167                      int cellStartTime[2];  '' minutes since midnight ''
    00168                      char bytepad[10];
    00169
    00170               from:  unsigned short wordpad[7];
    00171                      unsigned long dwordpad[8];
    00172               to:    char calloutMsg[46];
    00173
    00174   -------------------------------------------------
    00175
    00176
    00177   -------------------------------------------------
    00178     5/31/96  add SRT & TRIG DATA bits to  ' roParms.stream.flags'
    00179   -------------------------------------------------
    00180
    00181    ----------------------------------------------
    00182     6/10/96  change  modem-rw:
    00183                          int  cellStartTime[] from 2 to 5
    00184                          char bytepad[] from 10 to 4
    00185
    00186   -------------------------------------------------
    00187
    00188    7/2/96  noted for CHANNEL_RO_PARAMETERS:
    00189               'recorded channels entered consecutively'
    00190
    00191    9/18/96  new k2defs.h from MERGED MCU - no changes that effect
    00192                kwhd1.c
    00193               QLCA's vhf1/2.c merged into kwhd1/2.c
    00194               cellShare -- NOT USED
    00195               REMOVE:  from formatted files: Sensor Response -- not used
    00196               kwhdrs.h NOT redistributed over all files
    00197   *************************************************************
    00198
    00199    ---------------------
    00200
    00201    3/28/97
    00202
    00203   File Version 1.50: 1.40(K2) & 1.50(MW) 12/18-channel header (February 1997)
    00204   ------------------------------------------------------
    00205
    00206     Change the following:
    00207
    00208     CHANNEL_RW_PARAMETERS:
    00209
    00210     after 'gain':
    00211
    00212     OUT -- 8 bytes :
    00213
    00214      float resp1; * sensor response; poles and zeroes *
    00215      float resp2;
    00216
    00217     IN  -- 8 bytes :
    00218
    00219      unsigned char triggertype;       * Type of trigger calculation  *
    00220                                       default = 0 = Threshold
    00221
    00222                                    valid: code 0h  threshold
    00223                                                1   sta/lta
    00224
    00225      unsigned char iirtrigfilter;     * coefficients for iir trigger filter *
    00226                                       default = 1 = B  0.1Hz to 12.5 Hz @ 200sps
    00227
    00228                     valid: code 0h  A
    00229                                 1   B
    00230                                 2   C
    00231                                 3   D
    00232
    00233      unsigned char stasecondsTten;    * STA seconds * ten *
    00234                                        default = code 7 = 1.0 seconds
    00235
    00236                       valid: code 0h  0.1  store 1     Ah  1.6 store 16
    00237                                   1   0.2   as   2     B   1.8  as   18
    00238                                   2   0.3        3     C   2.0       20
    00239                                   3   0.4        4     D   2.5       25
    00240                                   4   0.5        5     E   3.0       30
    00241                                   5   0.6        6     F   5.0       50
    00242                                   6   0.8        8    10  10.0      100
    00243                                   7   1.0       10
    00244                                   8   1.2       12
    00245                                   9   1.4       14
    00246
    00247      unsigned char ltaseconds;         * LTA seconds *
    00248                                         default = code 4 = 60 seconds
    00249
    00250                                    valid: code 0h  20
    00251                                                1   30
    00252                                                2   40
    00253                                                3   50
    00254                                                4   60
    00255                                                5   80
    00256                                                6  100
    00257                                                7  120
    00258
    00259      unsigned short sta/ltaratio;    * STA/LTA trigger ratio * ten *
    00260                                      default = code 3 = 4
    00261
    00262                       valid: code 0h  1.5  store 15   7h  15 store 150
    00263                                   1   2     as   20   8h  20  as   200
    00264                                   2   3          30   9   30       300
    00265                                   3   4          40   A   40       400
    00266                                   4   6          60   B   60       600
    00267                                   5   8          80   C  100      1000
    00268                                   6  10         100
    00269
    00270      unsigned char sta/ltapercent;  * STA/LTA detrigger percent of trigger ratio *
    00271                                      default = code 3 = 40%
    00272
    00273                       valid: code 0h  10%  store 10
    00274                                   1   15    as   15
    00275                                   2   20         20
    00276                                   3   40         40
    00277                                   4   60         60
    00278                                   5  100        100
    00279
    00280      char bytepad1[1];        * reserved *
    00281
    00282
    00283
    00284     after 'alarmTriggerThreshold':
    00285
    00286     OUT - 16 bytes :
    00287
    00288      float resp3;
    00289      float resp4;
    00290      float resp5;
    00291      float resp6;
    00292
    00293     IN  - 16 bytes:
    00294
    00295      char bytepad[16];     * reserved *
    00296
    00297      ------------
    00298
    00299    STREAM_RW_PARMS:
    00300
    00301    OUT -- 24 bytes:
    00302
    00303      short wordpad[4]; * for expansion *
    00304
    00305      long dwordpad[4]; * for expansion *
    00306
    00307    IN -- 24 bytes:
    00308
    00309      char bytepada;
    00310      unsigned char FilterType;        * FirB: 0 regular, 1 causal *
    00311      unsigned char DataFmt;           * Serial Data Stream: 0=uncompressed
    00312                                                        1=compressed  *
    00313      char Reserved;
    00314      short Timeout;                   * Serial Data Stream Mode:        *
    00315                                       *    mode 1 - 0   default    *
    00316                                       *         2 - 6..32767       *
    00317                                       *             send 'continue cmd' *
    00318                                       *         3 -  -1  cmd for each block *
    00319
    00320      unsigned short TxBlkSize;        * Serial Data Stream :           *
    00321                                       *  fixed @ 100 samples per block *
    00322      unsigned short BufferSize;       * Serial Data Stream:            *
    00323                                       *  size of #SSTRBUF.BIN file in disk *
    00324                                       *  number of 16,384 byte blocks *
    00325                                       *  default= 64  - 1Meg *
    00326      unsigned short SampleRate;       * Serial Data Stream:            *
    00327                                       *  fixed at 100 sps *
    00328      unsigned long TxChanMap;         * Serial Data Stream:            *
    00329                                       *  select up to 6 channels *
    00330
    00331      long dwordpad[2]; * for expansion *
    00332
    00333    ----------------
    00334
    00335
    00336
    00337
    00338
    00339
    00340
    00341
    00342    Bottom Of Header Comments
    00343 ****************************************************************************/
    00344
    00345 /* Type Definitions:
    00346  *        char: 1 byte integer
    00347  *        short: 2 byte integer
    00348  *        float: 4 byte floating point (IEEE format)
    00349  *        long: 4 byte integer
    00350  *   All structures are 16-bit aligned
    00351 */
    00352
    00353 /*
    00354 #define FIX_8BYTES_K2RW 1          8-byte fix for K2_HEADER -- see below */
    00355
    00356 #define MAX_ETNA_CHANNELS 4
    00357
    00358 #define MAX_EVEREST_CHANNELS 6
    00359
    00360 #define MAX_MW_CHANNELS 18
    00361 #define VERSION_MW 150 /* =1.20 & 1.50; header version number x 100 */
    00362
    00363 #define MAX_K2_CHANNELS 12
    00364 #define VERSION_K2 140 /* = 1.00, 1.10, 1.30 & 1.40; header version number x 100 */
    00365
    00366 #define DFS_MAX_CHANNELS 3  /* =3 orig, eventually = 6 */
    00367
    00368 #define MAX_STREAMS 1
    00369 #define INSTRUMENT_CODE 9 /* for K2 */
    00370
    00371 /* SENSOR TYPE CODES */
    00372 #define SENSOR_UNKNOWN      0
    00373 #define SENSOR_ACCELERATION 1
    00374 #define SENSOR_VELOCITY     2
    00375 #define SENSOR_FBA11       10
    00376 #define SENSOR_FBA_4G      11     /* 4g FBA */
    00377 #define SENSOR_FBA_2G      12     /* 2g FBA */
    00378 #define SENSOR_FBA_1G      13     /* 1g FBA */
    00379 #define SENSOR_FBA_0_5G    14     /* 0.5g FBA */
    00380 #define SENSOR_FBA_0_25G   15     /* 0.25g FBA */
    00381 #define SENSOR_FBA_0_1G    16     /* 0.1g FBA */
    00382 #define SENSOR_FBA23       20
    00383 #define SENSOR_WR1         30     /* velocity OR acceleration */
    00384 #define SENSOR_EPI         32     /* Episensor */
    00385 #define SENSOR_S6000       33
    00386 #define SENSOR_MARKL22     34
    00387 #define SENSOR_MARKL4C     35
    00388 #define SENSOR_CMG3        36
    00389 #define SENSOR_CMG3T       37
    00390 #define SENSOR_CMG40T      38
    00391 #define SENSOR_CMG5        39
    00392 #define SENSOR_KS_2000     40
    00393
    00394 /* Voter type codes */
    00395 #define VOTER_UNDEFINED         0
    00396 #define VOTER_CHANNEL           'C'
    00397 #define VOTER_STREAM            'S'
    00398 #define VOTER_NETWORK           'N'
    00399 #define VOTER_KEYBOARD          'K'
    00400 #define VOTER_EXTERNAL          'E'
    00401 #define STREAM_K2_MAX_VOTERS (MAX_K2_CHANNELS+3) /* channels+network+keyboard+ext */
    00402 #define STREAM_MW_MAX_VOTERS (MAX_MW_CHANNELS+3) /* channels+network+keyboard+ext */
    00403
    00404 /* Restart sources for use with MISC_RO_PARMS.restartSource */
    00405 #define RESTART_UNKNOWN 0
    00406 #define RESTART_FROM_POWERSWITCH 1 /* someone flipped the power switch */
    00407 #define RESTART_FROM_COMMAND 2 /* user command to reset */
    00408 #define RESTART_FROM_WATCHDOG 3 /* watchdog caught a system crash */
    00409 #define RESTART_FROM_DSPFAILURE 4 /* DSP failure caused reset */
    00410 #define RESTART_FROM_BATTERYFAILURE 5 /* battery failure caused reset */
    00411 #define RESTART_FROM_MEMORYERROR 6 /* memory error caused reset */
    00412
    00413 /*---------------------------------------------------*/
    00414
    00415 /* Voting information */
    00416 struct VOTER_INFO {
    00417    unsigned char type; /* voter type code */
    00418    unsigned char number; /* channel number, stream number, etc. */
    00419    short weight; /* voting weight: range is -100 to 100 */
    00420 };
    00421
    00422 /*---------------------------------------------------*/
    00423
    00424 /* Channel read/write parameters */
    00425 struct CHANNEL_RW_PARMS {
    00426 #define CHANNEL_ID_LENGTH 5
    00427    char id[CHANNEL_ID_LENGTH]; /* NULL terminated */
    00428    char bytepad; /* for expansion */
    00429    unsigned short sensorSerialNumberExt; /* high word of serial number */
    00430    short north; /* displacement */
    00431    short east; /* displacement */
    00432    short up; /* displacement */
    00433    short altitude;
    00434    short azimuth;
    00435    unsigned short sensorType;
    00436    unsigned short sensorSerialNumber; /* low word of serial number */
    00437   unsigned short gain;  /*  only '1' defined as gain of 1 5/31/95 */
    00438
    00439 /* begin  added 3/29/97 1.40 K2 & 1.50 MTW */
    00440    unsigned char triggerType;  /* Type of trigger calculation  added headver 1.50
    00441                                   default = 0 = Threshold
    00442
    00443                                   valid: code 0h  threshold
    00444                                               1   sta/lta    */
    00445
    00446    unsigned char iirTriggerFilter;  /* coefficients for iir trigger filter  ver 1.50
    00447                                     default = 1 = B  0.1Hz to 12.5 Hz @ 200sps
    00448
    00449                                     valid: code 0h  A
    00450                                                 1   B
    00451                                                 2   C  */
    00452
    00453
    00454
    00455    unsigned char StaSeconds;  /* STA seconds * ten   ver 1.50
    00456                                      default = code 7 = 1.0 seconds
    00457
    00458                     valid: code 0h  0.1  store 1     Ah  1.6 store 16
    00459                                 1   0.2   as   2     B   1.8  as   18
    00460                                 2   0.3        3     C   2.0       20
    00461                                 3   0.4        4     D   2.5       25
    00462                                 4   0.5        5     E   3.0       30
    00463                                 5   0.6        6     F   5.0       50
    00464                                 6   0.8        8    10  10.0      100
    00465                                 7   1.0       10
    00466                                 8   1.2       12
    00467                                 9   1.4       14   */
    00468
    00469    unsigned char LtaSeconds;    /* LTA seconds     ver 1.50
    00470                                    default = code 4 = 60 seconds
    00471
    00472                                  valid: code 0h  20
    00473                                              1   30
    00474                                              2   40
    00475                                              3   50
    00476                                              4   60
    00477                                              5   80
    00478                                              6  100
    00479                                              7  120  */
    00480
    00481    unsigned short StaLtaRatio;  /* STA/LTA trigger ratio * ten  ver 1.50
    00482                                     default = code 3 = 4
    00483
    00484                     valid: code 0h  1.5  store 15   7h  15 store 150
    00485                                 1   2     as   20   8h  20  as   200
    00486                                 2   3          30   9   30       300
    00487                                 3   4          40   A   40       400
    00488                                 4   6          60   B   60       600
    00489                                 5   8          80   C  100      1000
    00490                                 6  10         100      */
    00491
    00492    unsigned char StaLtaPercent;  /* STA/LTA detrigger percent of trigger ratio
    00493                                      default = code 3 = 40%         ver 1.50
    00494
    00495                     valid: code 0h  10%  store 10
    00496                                 1   15    as   15
    00497                                 2   20         20
    00498                                 3   40         40
    00499                                 4   60         60
    00500                                 5  100        100   */
    00501
    00502    char bytepada;
    00503 /* end 1.40 & 1./50 additions */
    00504
    00505    float fullscale; /* volts */
    00506    float sensitivity; /* in volts per unit (e.g., g's) */
    00507    float damping; /* fraction of critical */
    00508    float naturalFrequency; /* hz */
    00509    float triggerThreshold; /* fraction of fullscale */
    00510    float detriggerThreshold; /* fraction of fullscale */
    00511    float alarmTriggerThreshold; /* fraction of fullscale */
    00512
    00513 /* begin change 3/29/97  1.40 & 1.50 */
    00514    char bytepad2[16];
    00515 /* end change 1.40 & 1.50 */
    00516
    00517
    00518 };
    00519
    00520
    00521 /*---------------------------------------------------*/
    00522 /* Read only parameters */
    00523 /* recorded channels entered consecutivly */
    00524 struct CHANNEL_RO_PARMS {
    00525    long maxPeak; /* raw sample counts */
    00526    unsigned long maxPeakOffset; /* offset from start of file */
    00527    long minPeak;
    00528    unsigned long minPeakOffset; /* offset from start of file */
    00529    long mean; /* raw sample counts */
    00530    long aqOffset;
    00531    long dwordpad[3]; /* for expansion */
    00532 };
    00533
    00534 /*---------------------------------------------------*/
    00535
    00536 /* Stream read/write information */
    00537 struct STREAM_K2_RW_PARMS {
    00538    unsigned char filterFlag; /* BIT0 = 1 if filtered data;  NOT USED
    00539                                 BIT1 = 1 if auto FT after Event
    00540                                 BIT2 = 1 if compressed - NOT USED */
    00541    unsigned char primaryStorage; /* = 0 for drive A: ,etc. */
    00542    unsigned char secondaryStorage; /* = 1 for drive B:, etc. */
    00543    unsigned char bytepad[5]; /* for expansion */
    00544    unsigned short eventNumber; /* *NOT USED* */
    00545    unsigned short sps; /* sampling rate */
    00546    unsigned short apw; /* array propagation window, in seconds */
    00547    unsigned short preEvent; /* in seconds */
    00548    unsigned short postEvent; /* in seconds */
    00549    unsigned short minRunTime; /* in seconds */
    00550    short VotesToTrigger; /* signed number */
    00551    short VotesToDetrigger;
    00552
    00553 /* begin change 3/29/97 1.40 & 1.50 */
    00554    char bytepada;
    00555    unsigned char FilterType;        /* 0 regular, 1 causal */
    00556    unsigned char DataFmt;
    00557    char Reserved;
    00558    short Timeout;
    00559    unsigned short TxBlkSize;
    00560    unsigned short BufferSize;
    00561    unsigned short SampleRate;
    00562    unsigned long TxChanMap;
    00563    long dwordpad[2]; /* for expansion */
    00564 /* end change 3/29/97 1.40 & 1.50 */
    00565
    00566    /* Voter info: one entry for each channel, network, user command */
    00567    /* Use functions IsStreamVoter() and GetStreamVoterWeight() in
    00568           STRMPAR.C to access the members.
    00569    */
    00570    struct VOTER_INFO voterInfo[STREAM_K2_MAX_VOTERS];
    00571 };
    00572
    00573
    00574 /* Stream read/write information */
    00575 struct STREAM_MW_RW_PARMS {
    00576    unsigned char filterFlag; /* BIT0 = 1 if filtered data;
    00577                                 BIT1 = 1 if auto FT after Event
    00578                                 BIT2 = 1 if compressed */
    00579    unsigned char primaryStorage; /* = 0 for drive A: ,etc. */
    00580    unsigned char secondaryStorage; /* = 1 for drive B:, etc. */
    00581    unsigned char bytepad[5]; /* for expansion */
    00582    unsigned short eventNumber; /* *NOT USED* */
    00583    unsigned short sps; /* sampling rate */
    00584    unsigned short apw; /* array propagation window, in seconds */
    00585    unsigned short preEvent; /* in seconds */
    00586    unsigned short postEvent; /* in seconds */
    00587    unsigned short minRunTime; /* in seconds */
    00588    short VotesToTrigger; /* signed number */
    00589    short VotesToDetrigger;
    00590
    00591 /* begin change 3/29/97 1.40 & 1.50 */
    00592    char bytepada;
    00593    unsigned char FilterType;        /* 0 regular, 1 causal */
    00594    unsigned char DataFmt;
    00595    char Reserved;
    00596    short Timeout;
    00597    unsigned short TxBlkSize;
    00598    unsigned short BufferSize;
    00599    unsigned short SampleRate;
    00600    unsigned long TxChanMap;
    00601    long dwordpad[2]; /* for expansion */
    00602 /* end change 3/29/97 1.40 & 1.50 */
    00603
    00604    /* Voter info: one entry for each channel, network, user command */
    00605    /* Use functions IsStreamVoter() and GetStreamVoterWeight() in
    00606           STRMPAR.C to access the members.
    00607    */
    00608    struct VOTER_INFO voterInfo[STREAM_MW_MAX_VOTERS];
    00609 };
    00610
    00611
    00612 /*---------------------------------------------------*/
    00613
    00614 /* Stream read only parameters */
    00615 struct STREAM_RO_PARMS {
    00616    unsigned long startTime; /* first sample time, includes PEM */
    00617    unsigned long triggerTime;
    00618    unsigned long duration; /* in # of frames; note: frames may have different sizes */
    00619 /*   unsigned int errors;
    00620    unsigned int flags;  Bit 0 = 1 if functional test */
    00621                        /* bit 1 = 1 if Sensor Response Test, SRT (& 0x03 = 0x03) */
    00622                        /* bit 2 = 1 if recorded data = trigger data (& 0x04 = 0x04)
    00623    unsigned int startTimeMsec;
    00624    unsigned int triggerTimeMsec; */
    00625    unsigned short errors;
    00626    unsigned short flags; /* Bit 0 = 1 if functional test */
    00627                        /* bit 1 = 1 if Sensor Response Test, SRT (& 0x03 = 0x03) */
    00628                        /* bit 2 = 1 if recorded data = trigger data (& 0x04 = 0x04) */
    00629    unsigned short startTimeMsec;
    00630    unsigned short triggerTimeMsec;
    00631    unsigned long nscans; /* # of scans in the event */
    00632
    00633   /* start of RW_K2_PARMS is 8 bytes too far along--don't know where */
    00634   /*  the problem is, so taking 8 bytes away from the end of the */
    00635   /*  RO_K2_PARMS area -- 2/18/99 -- [ET] */
    00636
    00637   /* The problem was the ambiguous definition of four variables as int
    00638      rather than short.  With these fixed, ET's kludge is no longer required.
    00639      -- 11/3/00 -- [JL]  */
    00640 /* #if !FIX_8BYTES_K2RW  */
    00641    unsigned long triggerBitMap; /* indicates first channel to trigger 5/96 */
    00642    unsigned long pad; /* for expansion */
    00643 /* #endif  */
    00644 };
    00645
    00646 /*---------------------------------------------------*/
    00647
    00648 /* Miscellaneous read/write parameters: 92 bytes */
    00649 struct MISC_RW_PARMS {
    00650    unsigned short serialNumber;
    00651    unsigned short nchannels;            /* number of channels used */
    00652 #define STN_ID_LENGTH 5
    00653    char stnID[STN_ID_LENGTH]; /* null terminated */
    00654 #define COMMENT_LENGTH 33
    00655    char comment[COMMENT_LENGTH]; /* NULL terminated */
    00656    short elevation; /* meters above sea level */
    00657    float latitude; /*  degrees North */
    00658    float longitude; /* degrees East */
    00659    short userCodes[4];                             /* 60 bytes to here */
    00660
    00661    /* Cutler grabber */
    00662    unsigned char cutlerCode; /* 0: Cutler Off
    00663                               * 1: 4800 baud
    00664                               * 2: 9600 baud
    00665                               * 3: 19200 baud
    00666                               * 4: 38400 baud    added 1.20-1.30
    00667                               * 5: 57600 baud    added 1.20-1.30
    00668                               */
    00669
    00670    unsigned char minBatteryVoltage; /* minimum alarm battery voltage x 10 */
    00671
    00672   /*  added 5 following parameters 3/3/95 for 1.20 MW & 1.30 K2 headers */
    00673    unsigned char cutler_decimation;     /* Cutler grabber decimation factor */
    00674                                                                         /* valid 0=1:1(raw), 1= 1:2, 2= 1:4, 3= 1:5, 4= 1:10, 5= 1:20 */
    00675                                                                         /* restrictions on 1:4 @ 250 sps? */
    00676    unsigned char cutler_irig_type;  /* 0:B   1:E (default)   2:H */
    00677    unsigned long cutler_bitmap;         /* Digital Field Station bit map - channels to output */
    00678    unsigned long channel_bitmap;        /* channels selected for acq storage */
    00679    unsigned char cutler_protocol; /* 0:CRLF - USGS DFS, 1:KMI/Agbabian */
    00680
    00681    char siteID[17];    /* added 5/21/96 */
    00682
    00683    /* Network */
    00684    unsigned char externalTrigger; /* either 1 (on) or 0 (off) */
    00685    unsigned char networkFlag; /* BIT0 = 0 (Master) or = 1 (Slave) */
    00686
    00687 };
    00688
    00689 /*---------------------------------------------------*/
    00690
    00691 /* Miscellaneous read only parameters */
    00692 struct MISC_RO_PARMS {
    00693    unsigned char a2dBits; /* A/D bits per sample; = A2DBITS */
    00694    unsigned char sampleBytes; /* bytes per sample; = 3 */
    00695    unsigned char restartSource; /* code of restart source:
    00696                                    0 = unknown
    00697                                    1 = power switch;
    00698                                    2 = user command,
    00699                                    3 = software watchdog,
    00700                                    4 = DSP failure,
    00701                                    5 = battery failure
    00702                                    6 = memory error */
    00703    char bytepad[3]; /* for expansion */
    00704
    00705    unsigned short installedChan; /* number of channels in system
    00706                                     = (# dsp brds) * (chan per brd) */
    00707    unsigned short maxChannels; /* physical number of channels */
    00708    unsigned short sysBlkVersion; /* sys block version * 100 */
    00709    unsigned short bootBlkVersion; /* boot block version * 100 */
    00710    unsigned short appBlkVersion;  /* application block version * 100 */
    00711    unsigned short dspBlkVersion; /* DSP version * 100 */
    00712
    00713    /* System Status */
    00714    short batteryVoltage; /* voltage * 10; negative value indicates charging */
    00715
    00716    unsigned short crc; /* 16-bit CRC of entire file, with this word set to 0xffff */
    00717                                            /* NOTE: this parameter is not used at the moment.
    00718               For integrity checking, the header and each frame are preceeded
    00719               by a structure tag which contains a checksum */
    00720    unsigned short flags; /* bit 0 = 1 if DSP system error */
    00721    short temperature; /* degrees C x 10 */
    00722    short wordpad[3]; /* for expansion */
    00723
    00724    long dwordpad[4]; /* for expansion */
    00725 };
    00726
    00727 /*---------------------------------------------------*/
    00728 struct TIMING_RW_PARMS
    00729 {
    00730    unsigned char gpsTurnOnInterval; /* minutes between GPS update checking */
    00731    unsigned char gpsMaxTurnOnTime; /* max time in minutes GPS tries to lock before giving up */
    00732    unsigned char bytepad[6];
    00733    short localOffset; /* hours ahead of UTC; if this parameter is non-zero
    00734                                                  then all times are in UTC time. If this parameter
    00735                                                  is zero, then all times are based on local time.
    00736                                           */
    00737    short wordpad[3];
    00738    long dwordpad[4];
    00739 };
    00740
    00741 /*---------------------------------------------------*/
    00742
    00743 struct TIMING_RO_PARMS
    00744 {
    00745    unsigned char clockSource; /* 0 = RTC from cold start
    00746                                  1 = keyboard
    00747                                  2 = Sync w/ ext. ref. pulse
    00748                                  3 = Internal GPS
    00749                                  */
    00750
    00751    unsigned char gpsStatus; /* Bit 0=1 if currently checking for presence
    00752                                           of GPS board
    00753                                Bit 1=1 if GPS board present
    00754                                Bit 2=1 if error communicating with GPS
    00755                                Bit 3=1 if failed to lock within an
    00756                                           allotted time (gpsMaxTurnOnTime)
    00757                                Bit 4=1 if not locked
    00758                                Bit 5=1 when GPS power is ON
    00759                                Bits 6,7=undefined
    00760                              */
    00761
    00762    unsigned char gpsSOH; /* Current state of health; same as Acutime SOH code */
    00763    unsigned char bytepad[5]; /* for expansion */
    00764
    00765    unsigned short gpsLockFailCount; /* # of times GPS failed to locked within gpsMaxTurnOnTime */
    00766    unsigned short gpsUpdateRTCCount; /* # of times GPS actually updated the RTC */
    00767    short acqDelay; /* time in msec between actual A/D conversion and DSP output */
    00768    short gpsLatitude; /* latitude x 100 , degrees North */
    00769    short gpsLongitude; /* longitude x 100, degrees East */
    00770    short gpsAltitude; /* altitude in meters */
    00771    unsigned short dacCount; /* dac counts */
    00772    short wordpad; /* for expansion */
    00773    short gpsLastDrift[2]; /* in msec.; e.g. 5 = RTC was 5 msec faster than GPS */
    00774
    00775    unsigned long gpsLastTurnOnTime[2]; /* time when GPS was last turned on */
    00776    unsigned long gpsLastUpdateTime[2]; /* time of last RTC update */
    00777    unsigned long gpsLastLockTime[2]; /* time of last GPS lock */
    00778    long dwordpad[4]; /* for expansion */
    00779 };
    00780
    00781 /*---------------------------------------------------*/
    00782 #define MODEM_INITCMD_LENGTH 64
    00783 #define MODEM_DIALPREFIX_LENGTH 16
    00784 #define MODEM_DIALSUFFIX_LENGTH 16
    00785 #define MODEM_HANGUPCMD_LENGTH 16
    00786 #define MODEM_AUTOANSWERON_LENGTH 16
    00787 #define MODEM_AUTOANSWEROFF_LENGTH 16
    00788 #define MODEM_PHONES 4
    00789 #define MODEM_PHONENUMBER_LENGTH 24
    00790
    00791 struct MODEM_RW_PARMS {
    00792    /* reserved space for modems */
    00793    char initCmd[MODEM_INITCMD_LENGTH]; /* initialization string */
    00794    char dialingPrefix[MODEM_DIALPREFIX_LENGTH]; /* dialing prefix */
    00795    char dialingSuffix[MODEM_DIALSUFFIX_LENGTH];
    00796    char hangupCmd[MODEM_HANGUPCMD_LENGTH];
    00797    char autoAnswerOnCmd[MODEM_AUTOANSWERON_LENGTH];
    00798    char autoAnswerOffCmd[MODEM_AUTOANSWEROFF_LENGTH];
    00799    char phoneNumber[MODEM_PHONES][MODEM_PHONENUMBER_LENGTH]; /* 4 phone numbers */
    00800
    00801    unsigned char waitForConnection; /* secs */
    00802    unsigned char pauseBetweenCalls; /* secs, 5/21/96 define '0' */
    00803    unsigned char maxDialAttempts;
    00804
    00805   /*  added 5/21/96 */
    00806    char cellShare;  /* K2 only, =0 for 1 Hz output, =1 for cell phone */
    00807                     /* @ MERGE 9/18/96 -- NOT USED */
    00808    char cellOnTime;       /* in minutes */
    00809    unsigned char cellWarmupTime;  /* in seconds */
    00810    short cellStartTime[5];  /* minutes since midnight, 2->5, 6/10/96 */
    00811    char bytepad[4];       /* 10->4, 6/10/96 */
    00812
    00813    unsigned short flags; /* BIT0 = 1 to enable auto call out
    00814                             BIT1 = 1 to call out on battery < 12 V
    00815                             BIT2 = 1 to call out on battery charge failed
    00816                             BIT3 = 1 to call out on extreme temperature
    00817                             BIT4 = 1 to call out on event
    00818                             BIT5 = 1 to call out on GPS lock failure
    00819                          */
    00820   char calloutMsg[46];   /*  added 5/21/96 */
    00821 };
    00822
    00823 /*---------------------------------------------------*/
    00824
    00825 /* Group read/write parms into one structure */
    00826
    00827 struct RW_K2_PARMS {
    00828    struct MISC_RW_PARMS misc;
    00829    struct TIMING_RW_PARMS timing;
    00830    struct CHANNEL_RW_PARMS channel[MAX_K2_CHANNELS];
    00831    struct STREAM_K2_RW_PARMS stream;
    00832    struct MODEM_RW_PARMS modem;
    00833 };
    00834
    00835
    00836 /*---------------------------------------------------*/
    00837
    00838 /* Group read/write parms into one structure */
    00839 struct RW_MW_PARMS {
    00840    struct MISC_RW_PARMS misc;
    00841    struct TIMING_RW_PARMS timing;
    00842    struct CHANNEL_RW_PARMS channel[MAX_MW_CHANNELS];
    00843    struct STREAM_MW_RW_PARMS stream;
    00844    struct MODEM_RW_PARMS modem;
    00845 };
    00846
    00847
    00848 /*---------------------------------------------------*/
    00849
    00850 #define FILE_DESCRIPTOR_SIZE 8 /* size of file descriptor */
    00851
    00852 /*   K2 */
    00853 /* Group read only parms into one structure */
    00854 struct RO_K2_PARMS {
    00855    /* first 8 bytes is a common file descriptor */
    00856    char id[3]; /* = 'KMI' to denote a Kinemetrics file */
    00857    unsigned char instrumentCode; /* = '9' for K2 */
    00858    unsigned short headerVersion; /* header version * 100 */
    00859    unsigned short headerBytes; /* size of header following (includes RW_PARMS) */
    00860
    00861    /* actual header follows */
    00862    struct MISC_RO_PARMS misc;
    00863    struct TIMING_RO_PARMS timing;
    00864    struct CHANNEL_RO_PARMS channel[MAX_K2_CHANNELS];
    00865    struct STREAM_RO_PARMS stream;
    00866 };
    00867
    00868
    00869 /*---------------------------------------------------*/
    00870
    00871 /* Group read only parms into one structure */
    00872 struct RO_MW_PARMS {
    00873    /* first 8 bytes is a common file descriptor */
    00874    char id[3]; /* = 'KMI' to denote a Kinemetrics file */
    00875    unsigned char instrumentCode; /* = '9' for K2 */
    00876    unsigned short headerVersion; /* header version * 100 */
    00877    unsigned short headerBytes; /* size of header following (includes RW_PARMS) */
    00878
    00879    /* actual header follows */
    00880    struct MISC_RO_PARMS misc;
    00881    struct TIMING_RO_PARMS timing;
    00882    struct CHANNEL_RO_PARMS channel[MAX_MW_CHANNELS];
    00883    struct STREAM_RO_PARMS stream;
    00884 };
    00885
    00886
    00887 /* This is what the K2 header looks like */
    00888 typedef struct {
    00889    struct RO_K2_PARMS roParms;
    00890    struct RW_K2_PARMS rwParms;
    00891 } K2_HEADER;
    00892
    00893 /* This is what the MtWhitney header looks like */
    00894 typedef struct {
    00895    struct RO_MW_PARMS roParms;
    00896    struct RW_MW_PARMS rwParms;
    00897 } MW_HEADER;
    00898
    00899 /*---------------------------------------------------*/
    00900 /*---------------------------------------------------*/
    00901
    00902
    00903 /*---------------------------------------------------*/
    00904 /* K2 Event Frame Structure */
    00905 /*---------------------------------------------------*/
    00906
    00907 #define FRAME_HEADER_SIZE 32 /* bytes */
    00908 #define MW_FRAME_HEADER_TYPE 4  /* 4 for 24 ch */
    00909 #define K2_FRAME_HEADER_TYPE 3  /* 3 for 16 ch */
    00910 #define TIMECODE_BYTES 13
    00911
    00912 typedef struct { /* 32 bytes */
    00913    unsigned char frameType; /* like a version #, = FRAME_HEADER_TYPE */
    00914    unsigned char instrumentCode; /* instrument code */
    00915    unsigned short recorderID;
    00916    unsigned short frameSize; /* # of frame bytes, includes 32 byte header */
    00917 /*   note: the unsigned long variable blockTime (defined below) is represented
    00918            here by two unsigned short variables to circumvent a mis-alignment
    00919            problem that otherwise occurs due to the fact that long variables
    00920            on the SUN are aligned on longword boundaries.
    00921    unsigned long blockTime;  block time */
    00922    unsigned short blockTime; /* block time */
    00923    unsigned short blockTime2; /* block time */
    00924    unsigned short channelBitMap; /* 1 bit for each ch. in use. Ch. 1 is bit 0 */
    00925    unsigned short streamPar; /* see comments below */
    00926    unsigned char frameStatus; /* see comments below */
    00927    unsigned char frameStatus2; /* see comments below */
    00928    unsigned short msec; /* 0..999 */
    00929    unsigned char channelBitMap1; /* extended chan bit map, ch17-24 */
    00930    unsigned char timeCode[TIMECODE_BYTES]; /* time code, see comment below */
    00931 } FRAME_HEADER;
    00932
    00933 /* FRAME_HEADER Description:
    00934    frameStatus:
    00935           Bits 0-3 = frame sequence number 0..9
    00936           Bit 4    = stream triggered flag. Set if frame exceeds stream trigger level.
    00937           Bit 5    = Compressed flag. Set if compressed frame.
    00938           Bits 6-7 = Sample size. 1=16 bits (2 bytes), 2=24 bits (3 bytes)
    00939                                                           3=32 bits (4 bytes)
    00940                                  Samples are expressed as a signed integer of digital counts.
    00941    frameStatus2:
    00942           Bit 0 = set if issued the ADD SCAN command
    00943           Bits 1-7: currently unused.
    00944
    00945    streamPar:
    00946           Bits 0-11 = Stream sampling rate, 1..4095
    00947           Bits 12-15 = Stream number 0..15
    00948
    00949    timeCode[]:
    00950           Time code sampled every millisecond.
    00951           Bits 4-7 of timeCode[0] = time code type (TBD)
    00952           Bit 3 of timeCode[0] = time code bit sampled at first msec of frame (0=low, 1=high)
    00953           Bit 2 of timeCode[0] = time code bit at 2nd msec.
    00954           Bit 0 of timeCode[12] = last (100th msec) bit of time code
    00955 */
    00956
    00957 /*----------------------------------------------------*/
    00958 /*----------------------------------------------------*/
    00959
    00960
    00961 /*----------------------------------------------------*/
    00962 /*    K2 TAG FRAME HEADER */
    00963 /*----------------------------------------------------*/
    00964 /* STRUCTURE TYPE CODES */
    00965 #define KFF_K2_HDR 1 /* K2 header */
    00966 #define KFF_K2_FRAME 2 /* K2 FRAME; frame data follows */
    00967 #define KFF_BYTE_ORDER 1/* 0=INTEL (LSB first) , 1 = MOTOROLA (MSB first) */
    00968 #define KFF_VERSION 1
    00969 #define KFF_SYNC_CHAR 'K'
    00970
    00971
    00972 /* TAG. Separates and identifies structures */
    00973 typedef struct {
    00974    unsigned char sync; /* sync character 'K' */
    00975    unsigned char byteOrder; /* = 0 for LSB first (INTEL), 1 for MSB first (MOTOROLA) */
    00976    unsigned char version; /* File format version; KFF_VERSION */
    00977    unsigned char instrumentType; /* instrument type code */
    00978    unsigned long type; /* structure type code */
    00979    unsigned short length; /* structure size in bytes */
    00980    unsigned short dataLength; /* # of data bytes following the structure */
    00981    unsigned short id; /* unique instrument id (e.g. serial number); used for multi-instrument files */
    00982    unsigned short checksum; /* 16 bit checksum of structure + data */
    00983 } KFF_TAG;
    00984
    00985 /*---------------------------------------------------*/
    00986 /*---------------------------------------------------*/
    00987
    00988