/* @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 __APCI3600_API_H_
#define __APCI3600_API_H_

#include "privdata.h"

//------------------------------------------------------------------------------

/* IOCTL dispatcher */
int apci3600_do_ioctl_base(struct pci_dev * pdev, unsigned int cmd, unsigned long arg);
int apci3600_do_ioctl_digital_input(struct pci_dev * pdev, unsigned int cmd, unsigned long arg);
int apci3600_do_ioctl_digital_output(struct pci_dev * pdev, unsigned int cmd, unsigned long arg);
int apci3600_do_ioctl_analog_input(struct pci_dev * pdev, unsigned int cmd, unsigned long arg, uint8_t module);
int apci3600_do_ioctl_analog_ouput(struct pci_dev * pdev, unsigned int cmd, unsigned long arg);
int apci3600_do_ioctl_external_trigger(struct pci_dev * pdev, unsigned int cmd, unsigned long arg);

/*/proc functions  */
void apci3600_proc_init (void);
void apci3600_proc_release (void);
void apci3600_proc_create_device (struct pci_dev *dev, unsigned int minor_number);
void apci3600_proc_release_device (struct pci_dev *dev);

/* interrupt related function */
int apci3600_register_interrupt (struct pci_dev *pdev);
int apci3600_deregister_interrupt (struct pci_dev *pdev);

/* buff_alloc.c */
int __needlock i_ADDIUTILS_GetDMABufferAllocationInformation (struct pci_dev *,str_PCIDMAInformation *	ps_PCAllocatedMemoryBuffer);
int __needlock i_ADDIUTILS_ResetDMABuffer(struct pci_dev * pdev);
int __needlock i_ADDIUTILS_AllocDescriptorsMemory(struct pci_dev *pdev, uint32_t size);
//------------------------------------------------------------------------------
/* deprecated */
int do_CMD_APCI3600_CheckAndGetPCISlotNumber (struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3600_GetHardwareInformation (struct pci_dev *pdev, unsigned int cmd, unsigned long arg);

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

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

//------------------------------------------------------------------------------
/* ANALOG INPUT IOCTLs */
int do_CMD_APCI3600_InitAnalogInputModule (struct pci_dev *pdev, unsigned int cmd, unsigned long arg, unsigned long module);
int do_CMD_APCI3600_InitAnalogInputModuleCyclicAcquisition (struct pci_dev *pdev, unsigned int cmd, unsigned long arg, unsigned long module);
int do_CMD_APCI3600_StartAnalogInputModuleCyclicAcquisition (struct pci_dev *pdev, unsigned int cmd, unsigned long arg, unsigned long module);
int do_CMD_APCI3600_StartMoreAnalogInputModuleCyclicAcquisition (struct pci_dev *pdev, unsigned int cmd, unsigned long arg);
int do_CMD_APCI3600_GetAnalogInputModuleCyclicAcquisitionStatus (struct pci_dev *pdev, unsigned int cmd, unsigned long arg, unsigned long module);
int do_CMD_APCI3600_ReleaseAnalogInputModuleCyclicAcquisition (struct pci_dev *pdev, unsigned int cmd, unsigned long arg, unsigned long module);
int do_CMD_APCI3600_ReleaseAnalogInputModule (struct pci_dev *pdev, unsigned int cmd, unsigned long arg, unsigned long module);
int do_CMD_APCI3600_GetAnalogInputModuleCalibrationStatus(struct pci_dev *pdev, unsigned int cmd, unsigned long arg, unsigned long module);
int do_CMD_APCI3600_AnalogInput_EnableDisableMasterTrigger(struct pci_dev *pdev, unsigned int cmd, unsigned long arg, unsigned long module);
int do_CMD_APCI3600_StopAnalogInputModuleCyclicAcquisition (struct pci_dev *pdev, unsigned int cmd, unsigned long arg, unsigned long module);
int do_CMD_APCI3600_AnalogInput_EnableDisableDigitalInputExternalTrigger(struct pci_dev *pdev, unsigned int cmd, unsigned long arg, unsigned long module);
int __needlock apci3600_do_read_available_data(struct pci_dev * pdev, struct file *filp, char __user * pdata, size_t count, loff_t* off);
int __needlock apci3600_clear_available_data(struct pci_dev * pdev);

unsigned long  __needlock i_PCI3600_Intern_GetNumberOfData(struct pci_dev *pdev);

#endif // __APCI3600_API_H_
