Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Sep 1999 08:40:07 -0700
From:      Bill Fenner <fenner@research.att.com>
To:        multimedia@freebsd.org
Subject:   Anyone have a YMF740 driver?
Message-ID:  <199909141540.IAA26665@windsor.research.att.com>

next in thread | raw e-mail | index | archive | help

--19701020
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline


Howdy,

  My wife has an Intel SE440BX-2 motherboard with a YMF740 on board.
With all this talk about PCI audio, is there a driver for it?  I
tried to write a cheap hack which enabled the SB emulation and then
let pcm probe it; it did allow pcm to probe it but DMA transfers
didn't really work.  It's entirely possible that they never would,
since I don't know how many of the compatibility pins are attached
on this motherboard.

  I attach my hack in case anyone can improve upon it.  I found the
YMF740 datasheet at some non-obvious place at yamaha's web site
(I started at yamaha.com but then the datasheet was at some other
yamahafoo.com domain) but I can forward it to anyone who wants it.

Thanks,
  Bill


--19701020
Content-Type: text/plain; name="ymf740.c"; x-unix-mode=0644
Content-Disposition: attachment; filename="ymf740.c"

#include "pci.h"

#include <sys/param.h>
#include <sys/queue.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <machine/bus_pio.h>
#include <machine/bus_memio.h>
#include <machine/bus.h>
#include <pci/pcireg.h>
#include <pci/pcivar.h>

#if NPCI != 0

static const char *ymf_pci_probe __P((pcici_t, pcidi_t));
static void	   ymf_pci_attach __P((pcici_t, int));

#define YMF740C_PCI_ID 0x000c1073

static u_long nymf = 0;

static struct pci_device ymf_pci_driver = {
	"ymf",
	ymf_pci_probe,
	ymf_pci_attach,
	&nymf,
	NULL
};

DATA_SET(pcidevice_set, ymf_pci_driver);

static const char *
ymf_pci_probe(pcici_t tag, pcidi_t type)
{
	if (type == YMF740C_PCI_ID)
		return ("Yamaha YMF740C [legacy mode]");

	return (NULL);
}

static void
ymf_pci_attach(pcici_t config_id, int unit)
{
	u_int32_t	data;

	/* turn on legacy support */
#define	YMF_REVISION_ID			0x08
#define	YMF_LEGACY_AUDIO		0x40
#define	YMF_LEGACY_AUDIO_DISABLE	0x8000
	data = pci_cfgread(config_id, YMF_LEGACY_AUDIO, 4);
	data &= ~YMF_LEGACY_AUDIO_DISABLE;
	pci_conf_write(config_id, YMF_LEGACY_AUDIO, data, 4);

/* set legacy IRQ mode, and map my INTA# to IRQ 5? */
/* I think it's really DMA that's not really working. */

	/* Could set up as SB and then call pcminit() */

	printf("ymf%d: rev.%d.  set up legacy audio support.\n",
		pci_cfgread(config_id, YMF_REVISION_ID, 1), unit);
	return;
}

#endif /* NPCI */

--19701020--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-multimedia" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199909141540.IAA26665>