Ejemplo n.º 1
0
void isa_pnp_wake_csn(unsigned char id) {
	isa_pnp_write_address(3); /* Wake[CSN] */
	isa_pnp_write_data(id); /* isolation state */
}
Ejemplo n.º 2
0
/* NTS: The caller is expected to pnp_wake_scn() then siphon off the device id */
int isa_pnp_sound_blaster_get_resources(uint32_t id,unsigned char csn,struct sndsb_ctx *cx) {
	cx->baseio = 0;
	cx->gameio = 0;
	cx->aweio = 0;
	cx->oplio = 0;
	cx->mpuio = 0;
	cx->dma16 = -1;
	cx->dma8 = -1;
	cx->irq = -1;

	if (ISAPNP_ID_FMATCH(id,'E','S','S')) {
		if (ISAPNP_ID_LMATCH(id,0x0100)) { /* ESS0100 ES688 Plug And Play AudioDrive */
			/* TODO: I don't have any ISA cards of this type, only one integrated into a laptop */
		}
	}
	else if (ISAPNP_ID_FMATCH(id,'C','P','Q')) {
		if (ISAPNP_ID_LMATCH(id,0xB040)) { /* CPQB040 ES1887 (Compaq) */
			/* TODO: I don't have any ISA cards of this type, only one integrated into a laptop */
		}
	}
	else if (ISAPNP_ID_FMATCH(id,'Y','M','H')) {
		if (ISAPNP_ID_LMATCH(id,0x0021)) { /* YMH0021 OPL3-SAx (TODO: Which one? SA2 or SA3) */
			/* TODO: I don't have any ISA cards of this type, only one integrated into a laptop */
		}
	}
	else if (ISAPNP_ID_FMATCH(id,'C','T','L')) {
		/* Creative SB PnP cards are fairly consistent on the resource layout. If you have one that this
		 * code fails to match, feel free to add it here */
		if (	ISAPNP_ID_LMATCH(id,0x0070) || /* CTL0070 Creative ViBRA16C PnP */
			ISAPNP_ID_LMATCH(id,0x00B2) || /* CTL00B2 Creative AWE64 Gold PnP */
			ISAPNP_ID_LMATCH(id,0x00C3) || /* CTL00C3 Creative AWE64 PnP */
			ISAPNP_ID_LMATCH(id,0x00F0)) { /* CTL00F0 Creative ViBRA16X/XV PnP */
			/* For ref (configuration regs):
			 *   IO[0]  = Base I/O port
			 *   IO[1]  = MPU I/O port
			 *   IO[2]  = OPL3 I/O port
			 *   IRQ[0] = Interrupt request line
			 *   DMA[0] = 8-bit DMA channel
			 *   DMA[1] = 16-bit DMA channel
			 */
			isa_pnp_write_address(0x07);	/* log device select */
			isa_pnp_write_data(0x00);	/* main device */

			cx->baseio = isa_pnp_read_io_resource(0);
			if (cx->baseio == 0 || cx->baseio == 0xFFFF) cx->baseio = 0;
			cx->mpuio = isa_pnp_read_io_resource(1);
			if (cx->mpuio == 0 || cx->mpuio == 0xFFFF) cx->mpuio = 0;
			cx->oplio = isa_pnp_read_io_resource(2);
			if (cx->oplio == 0 || cx->oplio == 0xFFFF) cx->oplio = 0;
			cx->dma8 = isa_pnp_read_dma(0);
			if ((cx->dma8&7) == 4) cx->dma8 = -1;
			cx->dma16 = isa_pnp_read_dma(1);
			if ((cx->dma16&7) == 4) cx->dma16 = -1;
			cx->irq = isa_pnp_read_irq(0);
			if ((cx->irq&0xF) == 0) cx->irq = -1;

			/* logical device #1: gameport */
			isa_pnp_write_address(0x07);	/* log device select */
			isa_pnp_write_data(0x01);	/* main device */

			cx->gameio = isa_pnp_read_io_resource(0);
			if (cx->gameio == cx->baseio || cx->gameio == 0 || cx->gameio == 0xFFFF) cx->gameio = 0;

			/* SB AWE: logical device #2: wavetable */
			if (ISAPNP_ID_LMATCH(id,0x00C3) || ISAPNP_ID_LMATCH(id,0x00B2)) {
				isa_pnp_write_address(0x07);	/* log device select */
				isa_pnp_write_data(0x02);	/* main device */

				cx->aweio = isa_pnp_read_io_resource(0);
				if (cx->aweio == cx->baseio || cx->aweio == 0 || cx->aweio == 0xFFFF) cx->aweio = 0;
			}
		}
	}

	if (cx->baseio == 0) return ISAPNPSB_NO_RESOURCES;
	return 1;
}