 /* @file api.h
  *
  * @brief Mainly this header should contains definition of ioctl handler.
  *
  *
  *
  */

/** @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 library is free software; you can redistribute it and/or modify it under
 the terms of the GNU Lesser General Public License as published by the
 Free Software Foundation; either version 2.1 of the License,
 or (at your option) any later version.

 This library 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 Lesser General Public License for more details.

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


 You also shoud find the complete LGPL in the LGPL.txt file accompanying
 this source code.

 @endverbatim
**/

#ifndef __APCI3200_API_H_
#define __APCI3200_API_H_

/* Functions are of the form:

 int do_CMD_APCI3200_FunctionAction (struct pci_dev * pdev, unsigned int cmd, unsigned long arg);

 struct pci_dev * pdev: Is the pci structure of the board.
 unsigned int cmd     : Is ALWAYS 0 when using functions in kernel mode.
 unsigned long arg    : Is used to put and get configuration value, or read value.

 Please see in each corresponding c files for functions descriptions (or in the documentation).
*/
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
/* deprecated */
int do_CMD_APCI3200_CheckAndGetPCISlotNumber(struct pci_dev * pdev,unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_GetHardwareInformation(struct pci_dev * pdev, unsigned int cmd, unsigned long arg);

//------------------------------------------------------------------------------
int do_CMD_APCI3200_SetBoardInformation(struct pci_dev * pdev, unsigned int cmd, unsigned long arg);

/* Digital inputs functions (dig_inputs.c) */
int do_CMD_APCI3200_Read1DigitalInput(struct pci_dev * pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_Read4DigitalInputs(struct pci_dev * pdev, unsigned int cmd, unsigned long arg);

/* Digital outputs functions (dig_outputs.c) */
int do_CMD_APCI3200_SetDigitalOutputMemoryOn(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_SetDigitalOutputMemoryOff(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_Set1DigitalOutputOn(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_Set1DigitalOutputOff(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_Set3DigitalOutputsOn(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_Set3DigitalOutputsOff(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);

/* Analog inputs functions (ana_inputs.c) */
int do_CMD_APCI3200_InitAnalogInputChannel(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_Read1AnalogInputChannel(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_ReadCalibrationGainValue(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_ReadCalibrationOffsetValue(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);

/* Temperature functions (temp_inputs.c) */
int do_CMD_APCI3200_ReadCJCValue(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_ReadCJCCalibrationGainValue(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_ReadCJCCalibrationOffsetValue(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);

/* Eeprom functions (eeprom.c) */
int do_CMD_APCI3200_ReadChannelCalibrationValue(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);

/* Scan functions (scan.c) */
int do_CMD_APCI3200_InitScanModuleAcquisitionSensor (struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_InitScanModuleAcquisition (struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_StartScanModuleAcquisition (struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_StopScanModuleAcquisition (struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_ReadReferenceVoltage (struct pci_dev *pdev, unsigned int cmd, unsigned long arg);

int do_CMD_APCI3200_SetConvertingTime (struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_Read1AnalogInputChannelFast (struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_ReadCJCValueFast (struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_ReadCalibrationOffsetValueFast (struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_ReadCalibrationGainValueFast (struct pci_dev *pdev, unsigned int cmd, unsigned long arg);

int i_APCI3200_InitAndReadHeader (struct pci_dev *pdev, const char* name, int num);

/* Diagnostic functions (ana-inputs.c) */
int do_CMD_APCI3200_SetDiagnosticMode(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_GetDiagnosticMode(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);

/* To manage user mode interrupt (event.c) */
int do_CMD_APCI3200_EventEmpty(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3200_EventWait(struct pci_dev *pdev, unsigned int cmd, unsigned long arg);

/** Execute a command.
*
* @param pdev Pointer to a device.
* @param cmd Command to execute
* @param arg Argument of the command.
*/
int apci3200_do_ioctl(struct pci_dev * pdev, unsigned int cmd, unsigned long arg);

#endif // __APCI3200_API_H_
