/*****************************************************************************/

/*
 *      quasar.h -- NetStream2000 EM8400 (quasar) ioctls
 *
 *      Copyright (C) 1999-2000  Sigma Designs
 *                    written by Emmanuel Michon <emmanuel_michon@sdesigns.com>
 *                           and Howard G. Page
 *
 *      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., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

/*****************************************************************************/

// PCI bus scanning constants
#define PCI_VENDOR_ID_SIGMAD 0x1105

#define IOCTL_GET_PIOMAPSIZE                       0x1233
#define IOCTL_DMABUF_ALLOC                         0x1234
#define IOCTL_DMABUF_FREE                          0x1235
#define IOCTL_TRANSLATE_PROCESSVIRTUAL_TO_PHYSICAL 0x1236
#define IOCTL_UNRESERVE_PAGE_BY_PHYSICAL_ADDRESS   0x1237

#define IOCTL_SEND_RING3_PID                       0x1238
#define IOCTL_SEND_IRQ_DATA                        0x1239

// check interrupt to signal translation consistency
#define IOCTL_GET_IRQ_COUNT                        0x123c
#define IOCTL_GET_PCI_ID_SUBSYSTEM_VENDOR          0x123d
#define IOCTL_GET_PCI_ID_SUBSYSTEM_DEVICE          0x123e
#define IOCTL_FORGE_IRQ                            0x123f
#define IOCTL_GET_PCI_DEVICE_ID		           0x1240
#define IOCTL_GET_SAWEOS                           0x1241

#define IOCTL_RESERVE_PAGE_BY_UV   0x12fe // dtvro patch
#define IOCTL_UNRESERVE_PAGE_BY_UV   0x12ff

// mapping primitives
#define REMAP_PIO              0x1000
#define REMAP_DMA              0x2000

#define REALMAGIC_DEVICE_NAME "realmagic"
#define INTERRUPT_ENTRY_NAME "quasar"

int quasar_init(void);
int quasar_cleanup(void);

#define MAX_dmabuf 40

typedef struct {
	int inuse;
	unsigned long Size;
	unsigned long ProcessVirtualAddress;
	unsigned long KernelVirtualAddress;
	unsigned long PhysicalAddress;
} dmabuf_helper;

typedef struct {
	// some registers.

	/* if risc_status_register is zero, it means the struct has not been
	   initialized. */
	unsigned long irq_status_register;
	unsigned long irq_mask_register;

	// some values.
	unsigned long irq_status;
	
	/* this last value is only used by the _STREAMMACHINE_ configuration.
	   However, it's pretty dangerous to have a variable size struct in
	   the two configurations... */
	unsigned long irq_mask;
} irq_data;
