#ifndef __APCI3600_EVENTS_H__
#define __APCI3600_EVENTS_H__

/* @file apci3600-events.h
  * 
  * @brief Defines the event type for the board. 
  * 
  * This board implement a event system that allows a user-mode process (or thread) to know when a specific change happened on the board.
  * 
  * This is done by using a blocking ioctl call.  
  *
  */

/** @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
**/

typedef
struct
{
	uint32_t source;		/* Source of the interrupt. See Table below */                                         
	uint32_t mask;			/* Mask of the events which have generated the interrupt. see Table below */
	uint32_t buffnumber;	/* Number of computer buffer whose contains the values */
	uint32_t numberbytes;	/* Number of bytes in the buffer */
} apci3600_event_t;


/* interrupt sources 
0000 0000 0000 0000 0000 0000 0000 0001 | 0x00000001 | Analog Output 0
0000 0000 0000 0000 0000 0000 0000 0010 | 0x00000002 | Analog Output 1
0000 0000 0000 0000 0000 0000 0000 0100 | 0x00000004 | Analog Input Module 0
0000 0000 0000 0000 0000 0000 0000 1000 | 0x00000008 | Analog Input Module 1
0000 0000 0000 0000 0000 0000 0001 0000 | 0x00000010 | Analog Input Module 2
0000 0000 0000 0000 0000 0000 0010 0000 | 0x00000020 | Analog Input Module 3
0000 0000 0000 0000 0000 0000 0100 0000 | 0x00000040 | Chronometer 0
0000 0000 0000 0000 0000 0000 1000 0000 | 0x00000080 | Chronometer 1
0000 0000 0000 0000 0000 0001 0000 0000 | 0x00000100 | Chronometer 2
0000 0000 0000 0000 0000 0010 0000 0000 | 0x00000200 | Chronometer 3
*/

/* interrupt mask 
Analogue Output 
0000 0000 0000 0000 0000 0000 0000 0001 | 0x00000001 | Compare interrupt has occured and a transfer has been done.
0000 0000 0000 0000 0000 0000 0000 0010 | 0x00000002 | Internal FIFO error interrupt
0000 0000 0000 0000 0000 0000 0000 0100 | 0x00000004 | SDRAM Underflow interrupt
0000 0000 0000 0000 0000 0000 0000 1000 | 0x00000008 | PC Buffer Underflow interrupt

Analog Input module / Chronometer
0000 0000 0000 0000 0000 0000 0000 0001 | 0x00000001 | DMA interrupt
0000 0000 0000 0000 0000 0000 0000 0010 | 0x00000002 | Internal FIFO error interrupt
0000 0000 0000 0000 0000 0000 0000 0100 | 0x00000004 | SDRAM Overflow interrupt
0000 0000 0000 0000 0000 0000 0000 1000 | 0x00000008 | PC Buffer Overflow interrupt
0000 0000 0000 0000 0000 0000 0001 0000 | 0x00000010 | Auto-Stop interrupt
*/

#endif /*__APCI3600_EVENTS_H__*/
