/*
 * libapci3200sample.h
 *
 *  Created on: 7 juil. 2009
 *      Author: sylvain
 */

#ifndef LIBAPCI3200SAMPLE_H_
#define LIBAPCI3200SAMPLE_H_

/** @file temperature.c

@brief functions commonly used by sample.


@par LICENCE
@verbatim
Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.

ADDI-DATA GmbH
Dieselstrasse 3
D-77833 Ottersweier
Tel: +19(0)7223/9493-0
Fax: +49(0)7223/9493-92
http://www.addi-data-com
info@addi-data.com

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

You shoud also find the complete GPL in the COPYING file
accompanying this source code.
@endverbatim
*/


#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <dirent.h>
#include <string.h>
#include <errno.h>
#include <sys/sysmacros.h> /* major() minor() */
#define NDEBUG
#include <assert.h>
#include <apci3200.h>
#include "convert.h"
#include "findboards.h"
#include "input.h"
#include "errorlib.h"
#include "errormsg.h"


//--------------------------------------------------------------------------------
struct acquisition_t
{
	unsigned long dw_CJCValue;				// CJC Value
	unsigned long dw_CJCOffsetValue;		// CJC Offset
	unsigned long dw_CJCGainValue;			// CJC Gain
	unsigned long dw_CJCCurrentSource;		// CJC Current source
	unsigned long dw_ChannelValue;			// Channel Value
	unsigned long dw_ChannelCurrentSource;	// Channel Value
	unsigned long dw_ChannelOffsetValue;	// Channel Offset
	unsigned long dw_ChannelGainValue;		// Channel Gain
	unsigned long dw_ChannelGainFactor;		// Channel gain factor
	unsigned long dw_ReferenceVoltage;		// Needed for conversion

	/* configuration */
	struct InitAnalogInputChannel_t ChannelInit;
	unsigned long Frequency;				//
	unsigned long SensorClass;
	unsigned long SensorType;
	unsigned long RTDValue;
};

int apci3200_find_cards(int ** cards);
/* utility function to convert numerical unit value in symbol */
const char* apci3200_unit2symb(unsigned int val);
int apci3200_ask_frequency(void);
void apci3200_dump_sensor(struct acquisition_t *acquisition);
void apci3200_ask_sensortype(int ch, struct acquisition_t *acquisition);
unsigned int apci3200_ask_gain(void);
unsigned int apci3200_ask_polarity(void);
unsigned int apci3200_ask_connection_type(void);
#endif /* LIBAPCI3200SAMPLE_H_ */
