/*
 * ********************************************************
 * *                                                      * 
 * *   Read trigger waveforms from file and load in DSP   * 
 * *                                                      * 
 * ********************************************************
 * File: libs/config/ireadtrigload.c
 *
 *            COPYRIGHT (c) 1998, 1999, 2002, 2003, 2005 BY 
 *          SIGMET INCORPORATED, WESTFORD MASSACHUSETTS, U.S.A.  
 * 
 * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED
 * ONLY  IN  ACCORDANCE WITH  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE
 * INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE  OR  ANY OTHER
 * COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
 * OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY
 * TRANSFERED. 
 */     

#include <stdio.h> 
#include "sigtypes.h"
#include "config_lib.h"
#include "dsp_lib.h"

#include "dsp_def.h"
      
/* ====================================================================
 * This subroutine reads the trigger information data from the file, then
 * loads it into the signal processor.  This must be in a separate file
 * because it calls the DSP library and the config library, and it causes 
 * linking problems.
 * Exit parameters:
 *     ibuffer_a - Temporary buffer to use
 */     
MESSAGE ReadTrigLoad
( Dsp *pDsp_a,
  UINT2 ibuffer_a[2049] )
{
  MESSAGE istatus;
  FLT4 fstart[4][6], fwidth[4][6], fpol_time[4];
  UINT2 ilevel;
  SINT2 icount;

  /* ----------------------------------------------------------------- */
  if (pDsp_a->itype >= DSP_TYPE_RVP7) return SS_NORMAL;

  istatus = trigger_load(
#ifdef TWOD_QUALIFIERS_BROKEN
                       (void *)
#endif
		       fstart,
#ifdef TWOD_QUALIFIERS_BROKEN
                       (void *)
#endif
                       fwidth, fpol_time, &ilevel, &icount );
  if (istatus != SS_NORMAL) return istatus;

  istatus = load_dsp_trig( pDsp_a, fstart,
#ifdef TWOD_QUALIFIERS_BROKEN
			   (void *)
#endif
			   fwidth, fpol_time, &ilevel, ibuffer_a );

  return istatus;
}

                                              
