auxlib_device_h

/*
**	Copyright 1991-2016, Fermi Research Alliance, LLC.  All rights reserved.
*/
/******************************************************************************/
/* auxlib_device.h
**  
**	defined constants for arguments and returned values for
**	device-specific ul_cbsaux routines
**
*/
/******************************************************************************/

#include "cbslib.h"

#ifndef AUXLIB_DEVICE_DEFINED			/* do this only once */
#define	AUXLIB_DEVICE_DEFINED

#include "cbslib.h"

/*
** support_cog ...
*/
#define	COG_PROTONS		1
#define	COG_PBARS		2

/*
** support_tclk ...
*/
#define	TCLK_TXTLEN		26		/* length of TCLK descriptive text */

/*
** support_oddmod ...
*/
#define	ODDMOD_LINBOOST		1		/* ODDMOD Linac/Booster module */
#define	ODDMOD_MRPBAR		2		/* ODDMOD MR/P-bar module */
#define	ODDMOD_TEVSY		3		/* ODDMOD Tev/SY module */

#define	ODDMOD_WEEKLY		0		/* ODDMOD weekly save data */
#define	ODDMOD_MONTHLY		1		/* ODDMOD monthly save data */
#define	ODDMOD_SHIFT		2		/* ODDMOD shift save data */
#define	ODDMOD_USER		3		/* ODDMOD user save data */
#define	ODDMOD_INCREMENTAL	4		/* ODDMOD incremental save data */

#define	ODDMOD_TXTLEN		14		/* ODDMOD descriptor length */
#define	ODDMOD_UNIT_TXTLEN	4		/* ODDMOD units text length */

/* 
** waveform generator support...
*/
#define	WG_CONVERT_TO_SCALED	1		/* convert raw values to engineering units */
#define	WG_CONVERT_TO_RAW	2		/* convert values in engineering units to raw values */

#define	WG_FAMILY_DEVICE	(-1)
#define	WG_MAIN_DEVICE		0
#define	WG_TIME_DEVICE		1
#define	WG_HI_DEVICE		2
#define	WG_MAP_DEVICE		3
#define	WG_SF_DEVICE		4
#define	WG_VERSION_DEVICE	5
#define	WG_REF_DEVICE		6
#define	WG_GI_ABSC_DEVICE	7
#define	WG_HI_ABSC_DEVICE	8
#define	WG_CLOCK_DEVICE		9
#define	WG_MDAT_DEVICE		10
#define	WG_GI_DEVICE		11
#define	WG_OFFSET_DEVICE	12
#define	WG_DELAY_DEVICE		13
#define	WG_FREQUENCY_DEVICE	14
#define	WG_PHASE_DEVICE		15
#define	WG_MUX_DEVICE		16
#define	WG_FT_FREQUENCY_DEVICE	17

#define	WG_INTERRUPT_LEVELS	32		/* number of interrupt levels in a module */
#define	WG_EVENTS_PER_LEVEL	8		/* number of clock events per interrupt level */
#define	WG_NUM_TABLES		15		/* number of tables of a given type */
#define	WG_TABLE_LENGTH		64		/* number of time table entries */

#define	WG_FAMILY_SIZE		17

#define	WG_EXTRACT_FT_TABLE(x)	(( (x) >> 4 ) & 0xF )	/* extracts F(t) ptr from Map device */
#define	WG_EXTRACT_GI_TABLE(x)	(( (x) >> 8 ) & 0xF )	/* extracts G(i) ptr from Map device */
#define	WG_EXTRACT_HI_TABLE(x)	(( (x) >> 12 ) & 0xF )	/* extracts H(i) ptr from Map device */

#define	WG_BUILD_RAMP_POINTER(f,g,h)	(((f) << 4) | ((g) << 8) | ((h) << 12))	/* build ramp table pointer entry */

#define	WG_STOP_CONT_MODE	0x10008		/* special waveform generator modes */
#define	WG_PS_OFF_MODE		0x20008
#define	WG_FT_TO_GI_COPY_MODE	0x40008
#define	WG_FT_TO_HI_COPY_MODE	0x200008
#define	WG_RAMP_DOWN_MODE	0x80008
#define	WG_ARCHIVE_MODE		0x100008
#define	WG_COPY_TABLES_MODE	0x400008
#define	WG_ADD_TABLES_MODE	0x800008

#define	WG_OPT_NONE		0		/* no options selected */
#define	WG_OPT_IS_C453		1		/* treat as a C453 module */
#define	WG_OPT_IS_C475		2		/* treat as a C475 module */

#define	WG_SEARCH_LE		0		/* search for less than or equal to */
#define	WG_SEARCH_GE		1		/* search for greater than or equal to */
#define	WG_SEARCH_EQUAL		2		/* search for equal to */

/* 
** C465 support...
*/
#define	C465_INTERRUPT_LEVELS	32		/* number of interrupt levels in a C46x module */
#define	C465_EVENTS_PER_LEVEL	8		/* number of clock events per interrupt level */
#define	C465_NUM_TABLES		15		/* number of tables of a given type */
#define	C465_TABLE_LENGTH	64		/* number of time table entries */
#define	C465_NUM_SCALE_FACTORS	15		/* number of scale factors available */
#define	C465_NUM_EQUATION_TERMS	3		/* number of terms in the output equation */
#define	C465_NUM_CHANNELS	1		/* number of output channels */

#define	C465_FAMILY_SIZE	12

#define	C465_1KHZ		9
#define	C465_5KHZ		0x10009
#define	C465_10KHZ		0x20009

#define	C465_STPCON_MODE	0x10008
#define	C465_PSOFF_MODE		0x20008
#define	C465_FTCOPY_MODE	0x40008
#define	C465_FT_TO_HI_COPY_MODE	0x200008
#define	C465_RMPDWN_MODE	0x80008
#define	C465_ARCHIVE_MODE	0x100008
#define	C465_COPY_TABLES_MODE	0x400008
#define	C465_ADD_TABLES_MODE	0x800008

#define	C465_MAIN		0
#define	C465_TIME		1
#define	C465_HI			2
#define	C465_MAP		3
#define	C465_SF			4
#define	C465_VERSION		5
#define	C465_REF		6
#define	C465_GI_ABSC		7
#define	C465_HI_ABSC		8
#define	C465_CLOCK		9
#define	C465_MDAT		10
#define	C465_GI			11

#define	C453_INTERRUPT_LEVELS	32		/* number of interrupt levels in a C453 module */
#define	C453_EVENTS_PER_LEVEL	8		/* number of clock events per interrupt level */
#define	C453_NUM_TABLES		15		/* number of tables of a given type */
#define	C453_TABLE_LENGTH	64		/* number of time table entries */
#define	C453_NUM_SCALE_FACTORS	15		/* number of scale factors available */
#define	C453_NUM_EQUATION_TERMS	3		/* number of terms in the output equation */
#define	C453_NUM_CHANNELS	4		/* number of output channels */

#define	C453_FAMILY_SIZE	12

#define	C453_MAIN		0
#define	C453_TIME		1
#define	C453_HI			2
#define	C453_MAP		3
#define	C453_SF			4
#define	C453_VERSION		5
#define	C453_BULK_PARAM		6
#define	C453_GI_ABSC		7
#define	C453_HI_ABSC		8
#define	C453_CLOCK		9
#define	C453_MDAT		10
#define	C453_GI			11

#define	C473_INTERRUPT_LEVELS	32		/* number of interrupt levels in a C473 module */
#define	C473_EVENTS_PER_LEVEL	8		/* number of clock events per interrupt level */
#define	C473_NUM_TABLES		15		/* number of tables of a given type */
#define	C473_TABLE_LENGTH	64		/* number of time table entries */
#define	C473_NUM_SCALE_FACTORS	31		/* number of scale factors available */
#define	C473_NUM_EQUATION_TERMS	1		/* number of terms in the output equation */
#define	C473_NUM_CHANNELS	4		/* number of output channels */

#define	C473_FAMILY_SIZE	12
#define	C473_NUM_OPTIONAL	3

#define	C473_MAIN		0
#define	C473_TIME		1
#define	C473_MAP		2
#define	C473_SF			3
#define	C473_VERSION		4
#define	C473_BULK_PARAM		5
#define	C473_CLOCK		6
#define	C473_OFFSET		7
#define	C473_DELAY		8
#define	C473_FREQUENCY		9
#define	C473_PHASE		10
#define	C473_FT_FREQUENCY_DEVICE	11

#define	V473_INTERRUPT_LEVELS	32		/* number of interrupt levels in a V473 module */
#define	V473_EVENTS_PER_LEVEL	8		/* number of clock events per interrupt level */
#define	V473_NUM_TABLES		15		/* number of tables of a given type */
#define	V473_TABLE_LENGTH	64		/* number of time table entries */
#define	V473_NUM_SCALE_FACTORS	31		/* number of scale factors available */
#define	V473_NUM_EQUATION_TERMS	1		/* number of terms in the output equation */
#define	V473_NUM_CHANNELS	4		/* number of output channels */

#define	V473_FAMILY_SIZE	11
#define	V473_NUM_OPTIONAL	2

#define	V473_MAIN		0
#define	V473_TIME		1
#define	V473_MAP		2
#define	V473_SF			3
#define	V473_VERSION		4
#define	V473_BULK_PARAM		5
#define	V473_CLOCK		6
#define	V473_OFFSET		7
#define	V473_DELAY		8
#define	V473_FREQUENCY		9
#define	V473_PHASE		10

#define	C475_INTERRUPT_LEVELS	32		/* number of interrupt levels in a C475 module */
#define	C475_EVENTS_PER_LEVEL	8		/* number of clock events per interrupt level */
#define	C475_NUM_TABLES		15		/* number of tables of a given type */
#define	C475_TABLE_LENGTH	64		/* number of time table entries */
#define	C475_NUM_SCALE_FACTORS	31		/* number of scale factors available */
#define	C475_NUM_EQUATION_TERMS	3		/* number of terms in the output equation */
#define	C475_NUM_CHANNELS	4		/* number of output channels */

#define	C475_FAMILY_SIZE	17
#define	C475_NUM_OPTIONAL	5

#define	C475_MAIN		0
#define	C475_TIME		1
#define	C475_HI			2
#define	C475_MAP		3
#define	C475_SF			4
#define	C475_VERSION		5
#define	C475_BULK_PARAM		6
#define	C475_GI_ABSC		7
#define	C475_HI_ABSC		8
#define	C475_CLOCK		9
#define	C475_MDAT		10
#define	C475_GI			11
#define	C475_OFFSET		12
#define	C475_DELAY		13
#define	C475_FREQUENCY		14
#define	C475_PHASE		15
#define	C475_FT_FREQUENCY_DEVICE	16

/*
** SBD ...
*/
#define	SBD_TEV_SETUP		0		/* Tevatron setup mode */
#define	SBD_MR_SETUP		1		/* Main Ring setup mode */
#define	SBD_NORMAL		2		/* normal mode */
#define	SBD_FAST		3		/* fast measurement mode (injection) */
#define	SBD_DISPLAY_MODE	4		/* display mode */
#define	SBD_LOCAL		5		/* local mode */
#define	SBD_SLOW		6		/* slow measurement mode */

#define	SBD_ALL_BUNCHES		0		/* do to all bunches */
#define	SBD_NO_BUNCHES		-1		/* do to none of the bunches */

#define	SBD_PROTON		0		/* proton bunch */
#define	SBD_PBAR		1		/* p-bar bunch */
#define	SBD_BOTH		2		/* both proton and p-bar bunches */

/*
** support_power_leads...
*/
#define	LEAD_RING		1		/* ring power leads */
#define	LEAD_B0_HIGH_CURR	2		/* B0 low beta high current PS leads */
#define	LEAD_B0_MED_CURR	4		/* B0 low beta medium current PS leads */
#define	LEAD_B0_LOW_CURR	8		/* B0 low beta low current PS leads */
#define	LEAD_D0_HIGH_CURR	0x10		/* D0 low beta high current PS leads */
#define	LEAD_D0_MED_CURR	0x20		/* D0 low beta medium current PS leads */
#define	LEAD_D0_LOW_CURR	0x40		/* D0 low beta low current PS leads */
#define	LEAD_ALL		0x7F		/* all power leads */

#define	LEAD_BOTH		0		/* low and high energy power leads */
#define	LEAD_LOW		1		/* low energy power leads */
#define	LEAD_HIGH		2		/* high energy power leads */

/*
**  070/071 support
*/
#define	C070_NUM_FRAMES		16		/* number of frames in an 070 module */
#define	C071_NUM_FRAMES		16		/* number of frames in an 071 module */
#define	C069_NUM_FRAMES		3		/* number of frames in an 069 module */

#define	C070_MIN_FRAME		0		/* minimum 070 frame number */
#define	C070_MAX_FRAME		15		/* maximum 070 frame number */
#define	C071_MIN_FRAME		0		/* minimum 071 frame number */
#define	C071_MAX_FRAME		15		/* maximum 071 frame number */

#define	C070_MAX_TIMES		1008		/* maximum number of time entries for an 070 module */
#define	C071_MAX_VALUES		1008		/* maximum number of value entries for an 071 module */

#define	C070_TITLE_NAME_LEN	64		/* length of an 070 save file title */
#define	C070_SHORT_FILE_NAME_LEN	12	/* length of an 070 save file short name */

#define	C070_OPT_NONE		0		/* no options selected */
#define	C070_OPT_SEQUENCER_ONLY	1		/* access Sequencer files only */

#define	DATA_SOURCE_DATAPOOL	0		/* get data from datapool */
#define	DATA_SOURCE_SDA		1		/* get data from SDA */
#define	DATA_SOURCE_SR		2		/* get data from save/restore */

/*
**  front end interface
*/
#define	FE_MAX_CRATES		256		/* maximum number of crates per front end */
#define	FE_MAX_GAS_HOUSES	42		/* maximum number of GAS houses per front end */
#define	FE_MAX_MADCS		128		/* maximum number of MADCs per front end */

/*
**  LLRF curve support
*/
#define	LLRF_CURVE_MAX_LEN	1024		/* maximum length of a LLRF curve */


/******************************************************************************/
/*
**	function prototypes for device-specific functions in the
**	ul_cbsaux library
*/
/******************************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

short build_ramp_pointer_c(int time_table, int gi_table=0, int hi_table=0);
int c070_configure(int device_index, char *file_name);
int c070_data_source_c(int source, void *source_spec=(void *) NULL);
int c070_delete_frame_c(int device_index, int frame);
int c070_get_file_names(int device, char ***names,
			unsigned int options=C070_OPT_NONE);
int c070_get_shortnames(int device_index, char ***file_names,
			unsigned int options=C070_OPT_SEQUENCER_ONLY);
int c070_read_data_source(int *data_source, void *source_spec=(void *) NULL);
int c070_restore_c(int device_index);
int c070_save_c(int device_index);
int c071_delete_frame_c(int device_index, int frame);
int c071_restore_c(int device_index);
int c071_save_c(int device_index);
int c453_device_type_c(char *names, int *device_types, short *errors,
		       int num_devices=1);
int c465_find_level_c(char *main_device, int event);
int c465_find_level_list_c(char *main_devices, int event,
			   short *levels, short *errors, int num_devices);
int c465_find_table_numbers_c(char *main_device, int event,
			      short *time_table, short *gi_table,
			      short *hi_table);
int c465_find_table_numbers_list_c(char *main_devices, int event,
				   short *time_tables, short *gi_tables,
				   short *hi_tables, short *errors,
				   int num_devices);
int c465_ft_frequency_c(char *main_device);
int c465_ft_frequency_list_c(char *main_devices, int *frequencies,
			     short *errors, int num_devices);
int c465_get_table_c(char *main_device, int interrupt_level);
int c465_get_table_list_c(char *main_devices,
			  short *interrupt_levels,
			  short *table_numbers, short *errors,
			  int num_devices, int same_level);
int c465_get_table_numbers_c(char *main_device, int interrupt_level,
			     short *time_table, short *gi_table,
			     short *hi_table);
int c465_get_table_numbers_list_c(char *main_devices,
				  short *levels, short *time_tables,
				  short *gi_tables, short *hi_tables,
				  short *errors, int num_devices,
				  int same_level);
int c465_set_ft_frequency_c(char *name, int ft_freq);
int c465_trigger_level_c(char *main_device, int interrupt_level);
int c465_trigger_level_list_c(char *main_devices,
			      int *interrupt_levels, short *errors,
			      int num_devices, int same_level);
int c46x_device_type_c(char *names, int *device_types, short *errors,
		       int num_devices=1);
int c473_device_type_c(char *names, int *device_types, short *errors,
		       int num_devices=1);
int c473_ft_frequency(char *name, int *ft_freq);
int c473_get_device(char *name, int *which, int *device_indices,
		    short *errors, int num_devices, int same_type);
int c473_get_family(char *name, int *device_indices, short *errors,
		    int num_devices=1);
int c473_set_ft_frequency_c(char *name, int ft_freq);
int c475_device_type_c(char *names, int *device_types, short *errors,
		       int num_devices);
int c475_ft_frequency(char *name, int *ft_freq);
int c475_get_device(char *name, int *which, int *device_indices,
		    short *errors, int num_devices, int same_type);
int c475_get_family(char *name, int *device_indices, short *errors,
		    int num_devices=1);
int c475_set_ft_frequency_c(char *name, int ft_freq);
int clear_070_c(int device_index);
int device_type_text_c(int device_index, short property, int text_type,
		       char *text);
/*
int dfg_maximum_current_c(int *device_index, float *max_current,
			  short *errors, ...);
int dfg_scaling_c(int device_index, float *input_value,
		  float *scaled_value, int convert_type, ...);
*/
int dio_gas_module_devices_c(int node, int house, int gas_slot,
			     int *num_devices, int **device_indices);
int dio_gas_module_type_c(int *device_indices, short *properties,
			  int *gas_types, int *gas_slots, short *errors,
			      int num_devices);
int enable_070_c(int device_index, int onflag);
int fe_create_crate_data_type_c(short node, int *data_type_id,
				int *data_length, int *field_width);
int fe_create_gas_house_type_c(short node, int *data_type_id,
			       int *data_length, int *field_width);
int fe_create_madc_data_type_c(short node, int *data_type_id,
			       int *data_length, int *field_width);
int fe_create_madc_enum_type_c(short node, int *enum_id,
			       int *data_length, int *field_width);
int fe_get_crate_list_c(short node, char *crates, int max_return,
			int *actual_nodes = (int *)NULL );
int fe_get_gas_house_list_c(short node, char *house_names,
			    int *house_codes, int max_return,
			    int *actual_nodes = (int *)NULL);
int fe_get_madc_list_c(int node, int *madc_numbers, int *crates,
		       int *slots, int max_return,
		       int *actual_nodes = (int *)NULL);
int find_time_slot_c(char *main_device, float time, int table_num);
int find_time_slot_list_c(char *main_devices, float time,
			  short *table_numbers, short *slot_numbers,
			  short *errors, int num_devices, int same_table);
int fly_wire_specs(int wire, int spec_number);
int get_069_c(int device_index, int *num_triggers, float *delta_ts);
int get_070_c(int device_index, int num_times, float *times, 
	      int frame=C070_MIN_FRAME );
int get_070_frame_info_c(int device_index, int *num_times);
int get_070_frame_pointers_c(int device_index, int *pointers);
int get_070_raw_c(int device_index, int num_times, int *times,
		  int frame=C070_MIN_FRAME );
int get_071_c(int device_index, int max_values, float *values,
	      int frame=C071_MIN_FRAME );
int get_071_frame_info_c(int device_index, int *num_values);
int get_071_frame_pointers_c(int device_index, int *pointers);
int get_071_raw_c(int device_index, int num_values, int *values,
		  int frame=C071_MIN_FRAME);
int get_453_channel(int *device_indices, int *channel,
		    short *errors, int numdev=1);
int get_453_device(char *name, int *which,
		   int *device_indices, short *errors, int numdev=1,
		   int same_type=FALSE );
int get_453_family(char *name, int *device_indices,
		   short *errors, int numdev=1);
int get_465_device(char *name, int *which, int *device_indices,
		   short *errors, int numdev=1,
		   int same_type=FALSE);
int get_465_family(char *name, int *device_indices,
		   short *errors, int numdev=1);
int get_465_type(char *name, int *types, short *errors, int numdev=1);
int llrf_curve_current_length_c(int device_index, int *num_slots);
int llrf_curve_max_length_c(int device_index, int *num_slots);
int llrf_curve_root_name_c(int device_index, char *root_name);
int llrf_get_curve_devices_c(int device_index, int *times_device=(int *) NULL,
			     int *values_device=(int *) NULL,
			     int *control_device=(int *) NULL);
int llrf_read_curve_c(int device_index, int slot_number, int num_slots,
		      double *times, double *values,
		      int *ret_num_slots=(int *) NULL);
int llrf_write_curve_c(int device_index, int slot_number, int num_slots,
		       double *times, double *values);
int oddmod_all_time_c(int module, int channel, double *value,
		      char *units=(char *) NULL);
int oddmod_device_text_c(int module, int channel, char *text);
int oddmod_real_time_c(int mod, int channel, double *value,
		       char *units=(char *) NULL);
int old_profile_c(int entry_num);
int put_070_c(int device_index, int num_times, float *times,
	      int frame=C070_MIN_FRAME );
int put_070_raw_c(int device_index, int num_times, int *times,
		  int frame=C070_MIN_FRAME );
int put_071_c(int device_index, int num_values, float *values, 
	      int fram=C071_MIN_FRAME, int start=-1);
int put_071_raw_c(int device_index, int num_values, int *values,
		  int frame=C071_MIN_FRAME, int start=-1);
/*
int read_160_masks_c(int *device_indices, short *masks,
		     short *errors, ...);
int read_160_stops_c(int *device_indices, short *stops, short *errors,
		     int type, ...);
int restore_160_masks(short *errors);
int set_160_masks_c(int *device_indices, int mask, short *errors, ...);
*/
void tclk_event_select_c(int event);
int tclk_event_text_c(char *text, int event=(int)CLIB_DEFAULT_ARG);
int v473_device_type_c(char *names, int *device_types, short *errors,
		       int num_devices=1);
int v473_get_device_c(char *name, int *which, int *device_indices,
		      short *errors, int num_devices, int same_type);
int v473_get_family_c(char *name, int *device_indices, short *errors,
		      int num_devices=1);
int vcr_record(void);
int vcr_rewind(void);
int wg_are_clock_event_interrupts_enabled(char *root_device, int *ints_enabled);
int wg_device_type_c(char *names, int *device_types, short *errors,
		     int num_devices=1);
int wg_disable_clock_event_interrupts(char *main_device);
int wg_disable_ramp(char *root_device);
int wg_disable_sine_wave_mode(char *root_device);
int wg_enable_clock_event_interrupts(char *root_device);
int wg_enable_ramp(char *root_device);
int wg_enable_sine_wave_mode(char *root_device);
int wg_find_level_c(char *main_device, int event);
int wg_find_level_list_c(char *main_device, int event, short *levels,
			 short *errors, int num_devices);
int wg_find_table_numbers_c(char *main_device, int event,
			    short *time_table, short *gi_table,
			    short *hi_table);
int wg_find_table_numbers_list_c(char *main_device, int event,
				 short *time_tables, short *gi_tables,
				 short *hi_tables, short *errors,
				 int num_devices);
int wg_find_time_slot_c(char *main_device, double time,
			int table_number=1, int search_type=WG_SEARCH_LE,
			double *match_time=(double *) NULL);
int wg_find_time_slot_list_c(char *main_device, double time,
			     short *table_numbers,
			     short *slot_numbers, short *errors,
			     int num_devices, int same_table,
			     int search_type=WG_SEARCH_LE,
			     double *match_times=(double *) NULL);
int wg_ft_frequency(char *main_device, int *ft_freq);
int wg_get_device_c(char *names, int *which_devices,
		    int *device_indices, short *errors, int num_devices,
		    int same_type);
int wg_get_family_c(char *names, int *device_indices, short *errors,
		    int num_devices);
int wg_get_root_device_c(char *names, char *root_names, short *errors,
			 int num_devices=1);
int wg_get_root_device_by_di_c(int *device_indices, char *root_names,
			       short *errors, int num_devices=1);
int wg_get_table_numbers_c(char *main_device, int interrupt_level,
			   short *time_table, short *gi_table,
			   short *hi_table);
int wg_get_table_numbers_list_c(char *main_device, short *levels,
				short *time_tables, short *gi_tables,
				short *hi_tables, short *errors,
				int num_devices, int same_level);
int wg_is_ramp_enabled(char *root_device, int *is_enabled);
int wg_is_sine_wave_mode_enabled(char *device_name, int *is_enabled);
int wg_read_mdat_selections_list_c(char *main_device,
				   int *gi_mdat_frames,
				   int *hi_mdat_frames,
				   short *errors, int num_devices);
int wg_reset_module(char *main_device);
int wg_scale_mdat_data_c(int mdat_frame, int num_values,
			 int convert_type, void *source_data,
			 void *dest_data, short *errors, char *units_text);
int wg_scale_mdat_mults_c(unsigned short *raw_values, int num_values,
			  int *mdat_frames, short *errors,
			  unsigned int options);
int wg_scale_mdat_selections_c(unsigned short *raw_values, int num_values,
			       int *gi_mdat_frames, int *hi_mdat_frames,
			       short *errors, unsigned int options);
int wg_scale_time_data_c(char *root_name, int num_values,
			 int convert_type, void *source_data,
			 void *dest_data, short *errors,
			 char *units_text,
			 char * sign_flags = NULL );
int wg_set_ft_frequency_c(char *main_device, int ft_freq);
int wg_set_mdat_selections_list_c(char *main_device,
				  int *gi_mdat_frames,
				  int *hi_mdat_frames,
				  short *errors, int num_devices,
				  unsigned int options);
int wg_td_table_type_to_device_type_c(int table_type, int *device_type);
int wg_unscale_mdat_mults_c(int *mdat_frames, int num_values,
			    unsigned short *raw_values, short *errors,
			    unsigned int options);
int wg_unscale_mdat_selections_c(int *gi_mdat_frames, int *hi_mdat_frames,
				 int num_values,
				 unsigned short *raw_values,
				 short *errors, unsigned int options);

#ifdef __cplusplus
}
#endif


/******************************************************************************/
/*
**	equivalent name definitions
*/
/******************************************************************************/

#define	BUILD_RAMP_POINTER_C		build_ramp_pointer_c
#define C070_CONFIGURE			c070_configure
#define	C070_DATA_SOURCE_C		c070_data_source_c
#define	C070_DELETE_FRAME_C		c070_delete_frame_c
#define	C070_GET_FILE_NAMES		c070_get_file_names
#define C070_GET_SHORTNAMES		c070_get_shortnames
#define	C070_READ_DATA_SOURCE		c070_read_data_source
#define	C070_RESTORE_C			c070_restore_c
#define	C070_SAVE_C			c070_save_c
#define	C071_DELETE_FRAME_C		c071_delete_frame_c
#define	C071_RESTORE_C			c071_restore_c
#define	C071_SAVE_C			c071_save_c
#define	C453_DEVICE_TYPE_C		c453_device_type_c
#define	C465_FIND_LEVEL_C		c465_find_level_c
#define	C465_FIND_LEVEL_LIST_C		c465_find_level_list_c
#define	C465_FIND_TABLE_NUMBERS_C	c465_find_table_numbers_c
#define	C465_FIND_TABLE_NUMBERS_LIST_C	c465_find_table_numbers_list_c
#define	C465_FT_FREQUENCY_C		c465_ft_frequency_c
#define	C465_FT_FREQUENCY_LIST_C	c465_ft_frequency_list_c
#define	C465_GET_TABLE_C		c465_get_table_c
#define	C465_GET_TABLE_LIST_C		c465_get_table_list_c
#define	C465_GET_TABLE_NUMBERS_C	c465_get_table_numbers_c
#define	C465_GET_TABLE_NUMBERS_LIST_C	c465_get_table_numbers_list_c
#define	C465_SET_FT_FREQUENCY_C		c465_set_ft_frequency_c
#define	C465_TRIGGER_LEVEL_C		c465_trigger_level_c
#define	C465_TRIGGER_LEVEL_LIST_C	c465_trigger_level_list_c
#define	C46X_DEVICE_TYPE_C		c46x_device_type_c
#define	V473_DEVICE_TYPE_C		v473_device_type_c
#define	C473_DEVICE_TYPE_C		c473_device_type_c
#define	C473_FT_FREQUENCY		c473_ft_frequency
#define	C473_GET_DEVICE			c473_get_device
#define	C473_GET_FAMILY			c473_get_family
#define	C473_SET_FT_FREQUENCY_C		c473_set_ft_frequency_c
#define	C475_DEVICE_TYPE_C		c475_device_type_c
#define	C475_FT_FREQUENCY		c475_ft_frequency
#define	C475_GET_DEVICE			c475_get_device
#define	C475_GET_FAMILY			c475_get_family
#define	C475_SET_FT_FREQUENCY_C		c475_set_ft_frequency_c
#define	CLEAR_070_C			clear_070_c
#define	DEVICE_TYPE_TEXT_C		device_type_text_c
#define	DFG_MAXIMUM_CURRENT_C		dfg_maximum_current_c
#define	DFG_SCALING_C			dfg_scaling_c
#define	DIO_GAS_MODULE_DEVICES_C	dio_gas_module_devices_c
#define	DIO_GAS_MODULE_TYPE_C		dio_gas_module_type_c
#define	ENABLE_070_C			enable_070_c
#define	FE_CREATE_CRATE_DATA_TYPE_C	fe_create_crate_data_type_c
#define	FE_CREATE_GAS_HOUSE_TYPE_C	fe_create_gas_house_type_c
#define	FE_CREATE_MADC_DATA_TYPE_C	fe_create_madc_data_type_c
#define	FE_CREATE_MADC_ENUM_TYPE_C	fe_create_madc_enum_type_c
#define	FE_GET_CRATE_LIST_C		fe_get_crate_list_c
#define	FE_GET_GAS_HOUSE_LIST_C		fe_get_gas_house_list_c
#define	FE_GET_MADC_LIST_C		fe_get_madc_list_c
#define	FIND_TIME_SLOT_C		find_time_slot_c
#define	FIND_TIME_SLOT_LIST_C		find_time_slot_list_c
#define	FLY_WIRE_SPECS			fly_wire_specs
#define	GET_069_C			get_069_c
#define	GET_070_C			get_070_c
#define	GET_070_FRAME_INFO_C		get_070_frame_info_c
#define	GET_070_FRAME_POINTERS_C	get_070_frame_pointers_c
#define	GET_070_RAW_C			get_070_raw_c
#define	GET_071_C			get_071_c
#define	GET_071_FRAME_INFO_C		get_071_frame_info_c
#define	GET_071_FRAME_POINTERS_C	get_071_frame_pointers_c
#define	GET_071_RAW_C			get_071_raw_c
#define	GET_453_CHANNEL			get_453_channel
#define	GET_453_DEVICE			get_453_device
#define	GET_453_FAMILY			get_453_family
#define	GET_465_DEVICE			get_465_device
#define	GET_465_FAMILY			get_465_family
#define	GET_465_TYPE			get_465_type
#define	LLRF_CURVE_CURRENT_LENGTH_C	llrf_curve_current_length_c
#define	LLRF_CURVE_MAX_LENGTH_C		llrf_curve_max_length_c
#define	LLRF_CURVE_ROOT_NAME_C		llrf_curve_root_name_c
#define	LLRF_GET_CURVE_DEVICES_C	llrf_get_curve_devices_c
#define	LLRF_READ_CURVE_C		llrf_read_curve_c
#define	LLRF_WRITE_CURVE_C		llrf_write_curve_c
#define	ODDMOD_ALL_TIME_C		oddmod_all_time_c
#define	ODDMOD_DEVICE_TEXT_C		oddmod_device_text_c
#define	ODDMOD_REAL_TIME_C		oddmod_real_time_c
#define	OLD_PROFILE_C			old_profile_c
#define	PUT_070_C			put_070_c
#define	PUT_070_RAW_C			put_070_raw_c
#define	PUT_071_C			put_071_c
#define	PUT_071_RAW_C			put_071_raw_c
#define	READ_160_MASKS_C		read_160_masks_c
#define	READ_160_STOPS_C		read_160_stops_c
/* #define	RESTORE_160_MASKS		restore_160_masks */
#define	SET_160_MASKS_C			set_160_masks_c
#define	TCLK_EVENT_SELECT_C		tclk_event_select_c
#define	TCLK_EVENT_TEXT_C		tclk_event_text_c
#define	V473_GET_DEVICE_C		v473_get_device_c
#define	V473_GET_FAMILY_C		v473_get_family_c
#define	VCR_RECORD			vcr_record
#define	VCR_REWIND			vcr_rewind
#define	WG_ARE_CLOCK_EVENT_INTERRUPTS_ENABLED	wg_are_clock_event_interrupts_enabled
#define	WG_DEVICE_TYPE_C		wg_device_type_c
#define	WG_DISABLE_CLOCK_EVENT_INTERRUPTS	wg_disable_clock_event_interrupts
#define	WG_DISABLE_RAMP			wg_disable_ramp
#define	WG_DISABLE_SINE_WAVE_MODE	wg_disable_sine_wave_mode
#define	WG_ENABLE_CLOCK_EVENT_INTERRUPTS	wg_enable_clock_event_interrupts
#define	WG_ENABLE_RAMP			wg_enable_ramp
#define	WG_ENABLE_SINE_WAVE_MODE	wg_enable_sine_wave_mode
#define	WG_FIND_LEVEL_C			wg_find_level_c
#define	WG_FIND_LEVEL_LIST_C		wg_find_level_list_c
#define	WG_FIND_TABLE_NUMBERS_C		wg_find_table_numbers_c
#define	WG_FIND_TABLE_NUMBERS_LIST_C	wg_find_table_numbers_list_c
#define	WG_FIND_TIME_SLOT_C		wg_find_time_slot_c
#define	WG_FIND_TIME_SLOT_LIST_C	wg_find_time_slot_list_c
#define	WG_FT_FREQUENCY			wg_ft_frequency
#define	WG_GET_DEVICE_C			wg_get_device_c
#define	WG_GET_FAMILY_C			wg_get_family_c
#define	WG_GET_ROOT_DEVICE_C		wg_get_root_device_c
#define	WG_GET_ROOT_DEVICE_BY_DI_C	wg_get_root_device_by_di_c
#define	WG_GET_TABLE_NUMBERS_C		wg_get_table_numbers_c
#define	WG_GET_TABLE_NUMBERS_LIST_C	wg_get_table_numbers_list_c
#define	WG_IS_RAMP_ENABLED		wg_is_ramp_enabled
#define	WG_IS_SINE_WAVE_MODE_ENABLED	wg_is_sine_wave_mode_enabled
#define	WG_READ_MDAT_SELECTIONS_LIST_C	wg_read_mdat_selections_list_c
#define	WG_RESET_MODULE			wg_reset_module
#define	WG_SCALE_MDAT_DATA_C		wg_scale_mdat_data_c
#define	WG_SCALE_MDAT_MULTS_C		wg_scale_mdat_mults_c
#define	WG_SCALE_MDAT_SELECTIONS_C	wg_scale_mdat_selections_c
#define	WG_SCALE_TIME_DATA_C		wg_scale_time_data_c
#define	WG_SET_FT_FREQUENCY_C		wg_set_ft_frequency_c
#define	WG_SET_MDAT_SELECTIONS_LIST_C	wg_set_mdat_selections_list_c
#define	WG_TD_TABLE_TYPE_TO_DEVICE_TYPE_C	wg_td_table_type_to_device_type_c
#define	WG_UNSCALE_MDAT_MULTS_C		wg_unscale_mdat_mults_c
#define	WG_UNSCALE_MDAT_SELECTIONS_C	wg_unscale_mdat_selections_c

#endif