/** @par LICENCE
* @verbatim
 Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code and the documentation.
        
        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 shoud find the complete GPL in the COPYING file accompanying 
    this source code. 
* @endverbatim
*/
#include <linux/module.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
	#include <linux/config.h>
#else
	#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
		#include <linux/autoconf.h>
	#else
		#include <generated/autoconf.h>
	#endif
#endif

#include <linux/version.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <apci.h>
#include <apci3600.h>
#include <apci3600-kapi.h>

//#include "../apci3600-private.h"

MODULE_LICENSE ("GPL");
MODULE_AUTHOR ("ADDI-DATA GmbH <info@addi-data.com>");
MODULE_DESCRIPTION ("APCI-3600 IOCTL driver sample03");

/*minor of the board*/
static int board_minor=0;

/*can be override*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)  
	MODULE_PARM (board_minor,"i");
	EXPORT_NO_SYMBOLS;
#else
	module_param(board_minor, int, S_IRUGO);
#endif

static int sample03(struct pci_dev *pdev)
{ // Read 8 Digital Inputs Test
	uint8_t b_Value = 0;
	int i_ReturnValue = 0;

	printk ("Read 8 digital inputs test\n");
	i_ReturnValue = i_PCI3600_Read8DigitalInputs (pdev,&b_Value);
	if (i_ReturnValue == 0)
	{
		printk ("i_PCI3600_Read8DigitalInputs OK\n");
		printk ("Digital Inputs Value : %hx in Hex \n",b_Value);

	} else
	{
		printk ("i_PCI3600_Read8DigitalInputs Error : %i\n",i_ReturnValue);

	}
	return (0);
}




//------------------------------------------------------------------------------
/** Called when module loads. */
static int __init
apci3600_sample03_init (void)
{

	printk("Using board minor %d (override with board_minor parameter)\n",board_minor);
	sample03(apci3600_lookup_board_by_index(board_minor));
	printk("Succesfull end of the sample, you can unload it...\n");

	return 0;

}

//-------------------------------------------------------------------
/** Called when module is unloaded. */
static void __exit
apci3600_sample03_exit (void)
{



}


//------------------------------------------------------------------------------
module_exit (apci3600_sample03_exit);

module_init (apci3600_sample03_init);

