//  The engineering data logger uses the tattletale's 12 bit MAX186 
//  converter.  It must share the SPI interface to this converter with
//  the science data loggers SPI interface to the AD7716.
//
//	The user available routines for interaction with the engineering data
//  logger are the following:
//
//	eng_logger_open ():
//		Initialization routine which must be called before all others.
//		This routine sets up the data structures used to determine
//		when it is time to collect data.  It does not allocate any
//		memory for the data buffers; this is done in the channel_setup
//		routine.
//
//	eng_logger_close ():
//		Shuts down the engineering data logger; deallocates all memory
//		used.  The only routine that the user should call after this is
//		the eng_logger_open () routine
//
//	eng_logger_channel_setup ():
//		Sets the time delay between sample collections on a particular
//		one of the eight available channels.  A channel is activated for
//		collection as soon as this routine is called (if the open routine
//		was called first)  There is no "start data" subroutine.
//
//	eng_logger_collect ():
//		Checks each of the activated channels;  collects data from that
//		channel if appropriate.  Tries to do so in a way which prevents 
//		collisions with the science loggers use of the SPI interface.
//
//	eng_logger_disk_request ():
//		Returns non-zero if the engineering logger has data to write to
//		disk.  The main routine should then power on the disk and call
//		eng_logger_write_disk ().
//
//	eng_logger_write_disk ():
//		Writes any waiting data from the internal engineering logger data
//		buffers to the disk
//		
//  eng_logger_disk_switch ():
//  	Resets variables so that header information is written out on the
//		next disk write.  Useful when we switch disks
//
#ifndef ENGINEER_INCLUDED
#define	ENGINEER_INCLUDED	0x7F06

#include		<tt8lib.h>

void eng_logger_power_on_init (void);
void eng_logger_open (void);
void eng_logger_close (void);
void eng_logger_start_data (void);
void eng_logger_stop_data (void);
int eng_logger_channel_setup (int chan, long delay);
int eng_logger_collect (void);
int eng_logger_write_disk (void);
int eng_logger_disk_request (void);
int eng_logger_read_channel (int chan, int n_to_average);
int eng_logger_print_file (int fd);
void eng_logger_disk_switch (void);

#define		N_ENG_CHANNELS		4

#endif
