#ifndef __SNDPCI_H__
#define __SNDPCI_H__

/*
 *  PCI support
 *  Copyright (c) 1994-98 by Jaroslav Kysela <perex@jcu.cz>
 *
 *
 *   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.
 *
 */

struct snd_pci_dev {
	void *handle;
	/* public variables */
	unsigned int bus;	/* bus number */
	unsigned int devfn;	/* encoded device & function index */
	unsigned short vendor;
	unsigned short device;
	unsigned int class;	/* 3 bytes: (base, sub, prog-if) */
	unsigned int master:1;	/* set if device is master capable */
	unsigned int irq;	/* irq generated by this device */
	unsigned long base_address[6];
	unsigned long rom_address;
};

#define PCI_BASE_ADDRESS_SPACE	0x00000003

#define PCI_COMMAND			0x04
	#define PCI_COMMAND_MASTER	PCI_COMMAND_MASTER_ENABLE
	#define PCI_COMMAND_MEMORY	PCI_COMMAND_MEM_ENABLE
	#define PCI_COMMAND_IO		PCI_COMMAND_IO_ENABLE

#define PCI_REVISION_ID		0x08
#define PCI_LATENCY_TIMER	0x0D
#define PCI_SUBSYSTEM_VENDOR_ID	0x2C

#define snd_pci_resource_start(pci, idx)	((pci)->base_address[idx] & ~PCI_BASE_ADDRESS_SPACE)

extern int snd_pci_find_device(int vendor, int device, unsigned int index, struct snd_pci_dev *dev);
int snd_pci_write_config_word(struct snd_pci_dev *pci, int index, unsigned short value);
int snd_pci_read_config_word(struct snd_pci_dev *pci, int index, unsigned short *value);
int snd_pci_write_config_dword(struct snd_pci_dev *pci, int index, unsigned long value);
int snd_pci_read_config_dword(struct snd_pci_dev *pci, int index, unsigned long *value);
int snd_pci_write_config_byte(struct snd_pci_dev *pci, int index, unsigned char value);
int snd_pci_read_config_byte(struct snd_pci_dev *pci, int index, unsigned char *value);


#endif				/* __SND_PCI_H__ */
