Take out direct access to the YM2149. The chip definitions are moved
from video.h to ym2149reg.h.
This commit is contained in:
parent
5cb9a24e79
commit
c5a7f4e977
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: atari_init.c,v 1.10 1996/03/10 21:54:44 leo Exp $ */
|
||||
/* $NetBSD: atari_init.c,v 1.11 1996/03/27 10:07:45 leo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Leo Weppelman
|
||||
|
@ -58,7 +58,6 @@
|
|||
#include <machine/iomap.h>
|
||||
#include <machine/mfp.h>
|
||||
#include <machine/scu.h>
|
||||
#include <machine/video.h>
|
||||
#include <machine/kcore.h>
|
||||
#include <atari/atari/misc.h>
|
||||
|
||||
|
@ -481,12 +480,7 @@ char *esym_addr; /* Address of kernel '_esym' symbol */
|
|||
i = *(int *)proc0paddr;
|
||||
*(volatile int *)proc0paddr = i;
|
||||
|
||||
/*
|
||||
* Initialize the sound-chip YM2149:
|
||||
* All sounds off, both ports output.
|
||||
*/
|
||||
SOUND->sd_selr = YM_MFR;
|
||||
SOUND->sd_wdat = 0xff;
|
||||
ym2149_init();
|
||||
|
||||
/*
|
||||
* Initialize both MFP chips (if both present!) to generate
|
||||
|
@ -498,7 +492,7 @@ char *esym_addr; /* Address of kernel '_esym' symbol */
|
|||
*/
|
||||
MFP->mf_iera = MFP->mf_ierb = 0;
|
||||
MFP->mf_imra = MFP->mf_imrb = 0;
|
||||
MFP->mf_aer = 0;
|
||||
MFP->mf_aer = MFP->mf_ddr = 0;
|
||||
MFP->mf_vr = 0x40;
|
||||
if(!badbaddr(&MFP2->mf_gpip)) {
|
||||
machineid |= ATARI_TT;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fd.c,v 1.17 1996/03/20 12:41:48 leo Exp $ */
|
||||
/* $NetBSD: fd.c,v 1.18 1996/03/27 10:08:28 leo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Leo Weppelman.
|
||||
|
@ -67,6 +67,7 @@
|
|||
#include <machine/mfp.h>
|
||||
#include <machine/dma.h>
|
||||
#include <machine/video.h>
|
||||
#include <atari/dev/ym2149reg.h>
|
||||
#include <atari/dev/fdreg.h>
|
||||
|
||||
/*
|
||||
|
@ -287,8 +288,7 @@ void *auxp;
|
|||
*/
|
||||
fdselect(first_found, 0, FLP_DD);
|
||||
fd_state = FLP_MON;
|
||||
timeout((FPV)fdmotoroff, (void*)getsoftc(fd_cd, first_found),
|
||||
FLP_MONDELAY);
|
||||
timeout((FPV)fdmotoroff, (void*)getsoftc(fd_cd,first_found), 0);
|
||||
|
||||
/*
|
||||
* enable disk related interrupts
|
||||
|
@ -719,7 +719,7 @@ static int
|
|||
fdselect(drive, head, dense)
|
||||
int drive, head, dense;
|
||||
{
|
||||
int i, sps, spinning;
|
||||
int i, spinning;
|
||||
#ifdef FLP_DEBUG
|
||||
printf("fdselect: drive=%d, head=%d, dense=%d\n", drive, head, dense);
|
||||
#endif
|
||||
|
@ -738,12 +738,8 @@ int drive, head, dense;
|
|||
panic("fdselect: unknown density code\n");
|
||||
}
|
||||
if(i != selected) {
|
||||
sps = splhigh();
|
||||
|
||||
selected = i;
|
||||
SOUND->sd_selr = YM_IOA;
|
||||
SOUND->sd_wdat = (SOUND->sd_rdat & 0x78) | (i ^ 0x07);
|
||||
splx(sps);
|
||||
ym2149_fd_select(i ^ PA_FDSEL);
|
||||
}
|
||||
return(spinning);
|
||||
}
|
||||
|
@ -751,13 +747,7 @@ int drive, head, dense;
|
|||
static void
|
||||
fddeselect()
|
||||
{
|
||||
int sps;
|
||||
|
||||
sps = splhigh();
|
||||
SOUND->sd_selr = YM_IOA;
|
||||
SOUND->sd_wdat = SOUND->sd_rdat | 0x07;
|
||||
splx(sps);
|
||||
|
||||
ym2149_fd_select(PA_FDSEL);
|
||||
motoron = selected = 0;
|
||||
DMA->dma_drvmode = 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/* $NetBSD: ym2149.c,v 1.1 1996/03/27 10:08:32 leo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Leo Weppelman.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Leo Weppelman.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <machine/iomap.h>
|
||||
#include <atari/dev/ym2149reg.h>
|
||||
|
||||
/*
|
||||
* Yahama YM-2149 Programmable Sound Generator
|
||||
*
|
||||
* For now only an init function is here...
|
||||
*/
|
||||
u_char ym2149_ioa; /* Soft-copy of port-A */
|
||||
|
||||
void
|
||||
ym2149_init()
|
||||
{
|
||||
/*
|
||||
* Initialize the sound-chip YM2149:
|
||||
* All sounds off, both I/O ports output.
|
||||
*/
|
||||
YM2149->sd_selr = YM_MFR;
|
||||
YM2149->sd_wdat = 0xff;
|
||||
|
||||
/*
|
||||
* Sensible value for ioa:
|
||||
*/
|
||||
YM2149->sd_selr = YM_IOA;
|
||||
YM2149->sd_wdat = ym2149_ioa = PA_FDSEL|PA_PSTROBE|PA_SER2;
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
/* $NetBSD: ym2149reg.h,v 1.1 1996/03/27 10:08:34 leo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Leo Weppelman.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Leo Weppelman.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _YM2149REG_H
|
||||
#define _YM2149REG_H
|
||||
/*
|
||||
* Yahama YM-2149 Programmable Sound Generator
|
||||
*/
|
||||
|
||||
#define YM2149 ((struct ym2149 *)AD_SOUND)
|
||||
|
||||
struct ym2149 {
|
||||
volatile u_char sdb[4]; /* use only the even bytes */
|
||||
};
|
||||
|
||||
#define sd_selr sdb[0] /* select register */
|
||||
#define sd_rdat sdb[0] /* read register data */
|
||||
#define sd_wdat sdb[2] /* write register data */
|
||||
|
||||
/*
|
||||
* Accessing the YM-2149 registers is indirect through ST-specific
|
||||
* circuitry by writing the register number into sd_selr.
|
||||
*/
|
||||
#define YM_PA0 0 /* Period Channel A, bits 0-7 */
|
||||
#define YM_PA1 1 /* Period Channel A, bits 8-11 */
|
||||
#define YM_PB0 2 /* Period Channel B, bits 0-7 */
|
||||
#define YM_PB1 3 /* Period Channel B, bits 8-11 */
|
||||
#define YM_PC0 4 /* Period Channel C, bits 0-7 */
|
||||
#define YM_PC1 5 /* Period Channel C, bits 8-11 */
|
||||
#define YM_PNG 6 /* Period Noise Generator, bits 0-4 */
|
||||
#define YM_MFR 7 /* Multi Function Register */
|
||||
#define YM_VA 8 /* Volume Channel A */
|
||||
#define YM_VB 9 /* Volume Channel B */
|
||||
#define YM_VC 10 /* Volume Channel C */
|
||||
#define YM_PE0 11 /* Period Envelope, bits 0-7 */
|
||||
#define YM_PE1 12 /* Period Envelope, bits 8-15 */
|
||||
#define YM_WFE 13 /* Wave Form Envelope */
|
||||
#define YM_IOA 14 /* I/O port A */
|
||||
#define YM_IOB 15 /* I/O port B */
|
||||
|
||||
/* bits in MFR: */
|
||||
#define SA_OFF 0x01 /* Sound Channel A off */
|
||||
#define SB_OFF 0x02 /* Sound Channel B off */
|
||||
#define SC_OFF 0x04 /* Sound Channel C off */
|
||||
#define NA_OFF 0x08 /* Noise Channel A off */
|
||||
#define NB_OFF 0x10 /* Noise Channel B off */
|
||||
#define NC_OFF 0x20 /* Noise Channel C off */
|
||||
#define PA_OUT 0x40 /* Port A for Output */
|
||||
#define PB_OUT 0x80 /* Port B for Output */
|
||||
|
||||
/* bits in Vx: */
|
||||
#define VOLUME 0x0F /* 16 steps */
|
||||
#define ENVELOP 0x10 /* volume steered by envelope */
|
||||
|
||||
/* bits in WFE: */
|
||||
#define WF_HOLD 0x01 /* hold after one period */
|
||||
#define WF_ALTERNAT 0x02 /* up and down (no saw teeth) */
|
||||
#define WF_ATTACK 0x04 /* start up */
|
||||
#define WF_CONTINUE 0x08 /* multiple periods */
|
||||
|
||||
/* names for bits in Port A (ST specific): */
|
||||
#define PA_SIDEB 0x01 /* select floppy head - if double sided */
|
||||
#define PA_FLOP0 0x02 /* Drive Select Floppy 0 */
|
||||
#define PA_FLOP1 0x04 /* Drive Select Floppy 1 */
|
||||
#define PA_FDSEL (PA_SIDEB|PA_FLOP0|PA_FLOP1)
|
||||
#define PA_SRTS 0x08 /* Serial RTS */
|
||||
#define PA_SDTR 0x10 /* Serial DTR */
|
||||
#define PA_PSTROBE 0x20 /* Parallel Strobe */
|
||||
#define PA_USER 0x40 /* Free Pin on Monitor Connector */
|
||||
#define PA_SER2 0x80 /* Choose between LAN or Ser2 port */
|
||||
|
||||
/*
|
||||
* Access macro's for Port A
|
||||
* Port A is defined as an output port. Reading the port does not work
|
||||
* reliably so keeping a 'soft-copy' seems to be the only way to make
|
||||
* things work.
|
||||
*/
|
||||
extern u_char ym2149_ioa; /* Soft-copy of port-A */
|
||||
|
||||
#define ym2149_write_ioport(port, value) { \
|
||||
int s = splhigh(); \
|
||||
\
|
||||
YM2149->sd_selr = port; \
|
||||
YM2149->sd_wdat = value; \
|
||||
splx(s); \
|
||||
}
|
||||
|
||||
#define ym2149_fd_select(select) { \
|
||||
ym2149_ioa = (ym2149_ioa & ~PA_FDSEL) | (select & PA_FDSEL); \
|
||||
ym2149_write_ioport(YM_IOA, ym2149_ioa); \
|
||||
}
|
||||
|
||||
#define ym2149_rts(set) { \
|
||||
ym2149_ioa = set ? ym2149_ioa | PA_SRTS : ym2149_ioa & ~PA_SRTS;\
|
||||
ym2149_write_ioport(YM_IOA, ym2149_ioa); \
|
||||
}
|
||||
|
||||
#define ym2149_dtr(set) { \
|
||||
ym2149_ioa = set ? ym2149_ioa | PA_SDTR : ym2149_ioa & ~PA_SDTR;\
|
||||
ym2149_write_ioport(YM_IOA, ym2149_ioa); \
|
||||
}
|
||||
|
||||
#define ym2149_strobe(set) { \
|
||||
ym2149_ioa = set ? ym2149_ioa | PA_PSTROBE : ym2149_ioa & ~PA_PSTROBE;\
|
||||
ym2149_write_ioport(YM_IOA, ym2149_ioa); \
|
||||
}
|
||||
|
||||
#define ym2149_ser2_select() { \
|
||||
ym2149_ioa |= PA_SER2; \
|
||||
ym2149_write_ioport(YM_IOA, ym2149_ioa); \
|
||||
}
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
void ym2149_init __P((void));
|
||||
#endif
|
||||
|
||||
#endif /* _YM2149REG_H */
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: zs.c,v 1.17 1996/03/17 01:26:56 thorpej Exp $ */
|
||||
/* $NetBSD: zs.c,v 1.18 1996/03/27 10:08:35 leo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 L. Weppelman (Atari modifications)
|
||||
|
@ -70,7 +70,7 @@
|
|||
#include <machine/iomap.h>
|
||||
#include <machine/scu.h>
|
||||
#include <machine/mfp.h>
|
||||
#include <machine/video.h>
|
||||
#include <atari/dev/ym2149reg.h>
|
||||
|
||||
#include <dev/ic/z8530reg.h>
|
||||
#include <atari/dev/zsvar.h>
|
||||
|
@ -326,10 +326,8 @@ struct proc *p;
|
|||
* When port A (ser02) is selected on the TT, make sure
|
||||
* the port is enabled.
|
||||
*/
|
||||
if((machineid & ATARI_TT) && !(unit & 1)) {
|
||||
SOUND->sd_selr = YM_IOA;
|
||||
SOUND->sd_wdat = SOUND->sd_rdat | PA_SER2;
|
||||
}
|
||||
if((machineid & ATARI_TT) && !(unit & 1))
|
||||
ym2149_ser2_select();
|
||||
|
||||
if (cs->cs_rbuf == NULL) {
|
||||
cs->cs_rbuf = malloc(ZLRB_RING_SIZE * sizeof(int), M_DEVBUF,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: video.h,v 1.5 1996/03/10 11:42:45 leo Exp $ */
|
||||
/* $NetBSD: video.h,v 1.6 1996/03/27 10:08:49 leo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Leo Weppelman.
|
||||
|
@ -139,69 +139,4 @@ struct video {
|
|||
#define FAL_VGA 0x0200
|
||||
#define FAL_TV 0x0300
|
||||
|
||||
/*
|
||||
* Yahama YM-2149 Programmable Sound Generator
|
||||
*/
|
||||
|
||||
#define SOUND ((struct sound *)AD_SOUND)
|
||||
|
||||
struct sound {
|
||||
char sdb[4]; /* use only the even bytes */
|
||||
};
|
||||
|
||||
#define sd_selr sdb[0] /* select register */
|
||||
#define sd_rdat sdb[0] /* read register data */
|
||||
#define sd_wdat sdb[2] /* write register data */
|
||||
|
||||
/*
|
||||
* Accessing the YM-2149 registers is indirect through ST-specific
|
||||
* circuitry by writing the register number into sd_selr.
|
||||
*/
|
||||
#define YM_PA0 0 /* Period Channel A, bits 0-7 */
|
||||
#define YM_PA1 1 /* Period Channel A, bits 8-11 */
|
||||
#define YM_PB0 2 /* Period Channel B, bits 0-7 */
|
||||
#define YM_PB1 3 /* Period Channel B, bits 8-11 */
|
||||
#define YM_PC0 4 /* Period Channel C, bits 0-7 */
|
||||
#define YM_PC1 5 /* Period Channel C, bits 8-11 */
|
||||
#define YM_PNG 6 /* Period Noise Generator, bits 0-4 */
|
||||
#define YM_MFR 7 /* Multi Function Register */
|
||||
#define YM_VA 8 /* Volume Channel A */
|
||||
#define YM_VB 9 /* Volume Channel B */
|
||||
#define YM_VC 10 /* Volume Channel C */
|
||||
#define YM_PE0 11 /* Period Envelope, bits 0-7 */
|
||||
#define YM_PE1 12 /* Period Envelope, bits 8-15 */
|
||||
#define YM_WFE 13 /* Wave Form Envelope */
|
||||
#define YM_IOA 14 /* I/O port A */
|
||||
#define YM_IOB 15 /* I/O port B */
|
||||
|
||||
/* bits in MFR: */
|
||||
#define SA_OFF 0x01 /* Sound Channel A off */
|
||||
#define SB_OFF 0x02 /* Sound Channel B off */
|
||||
#define SC_OFF 0x04 /* Sound Channel C off */
|
||||
#define NA_OFF 0x08 /* Noise Channel A off */
|
||||
#define NB_OFF 0x10 /* Noise Channel B off */
|
||||
#define NC_OFF 0x20 /* Noise Channel C off */
|
||||
#define PA_OUT 0x40 /* Port A for Output */
|
||||
#define PB_OUT 0x80 /* Port B for Output */
|
||||
|
||||
/* bits in Vx: */
|
||||
#define VOLUME 0x0F /* 16 steps */
|
||||
#define ENVELOP 0x10 /* volume steered by envelope */
|
||||
|
||||
/* bits in WFE: */
|
||||
#define WF_HOLD 0x01 /* hold after one period */
|
||||
#define WF_ALTERNAT 0x02 /* up and down (no saw teeth) */
|
||||
#define WF_ATTACK 0x04 /* start up */
|
||||
#define WF_CONTINUE 0x08 /* multiple periods */
|
||||
|
||||
/* names for bits in Port A (ST specific): */
|
||||
#define PA_SIDEB 0x01 /* select floppy head - if double sided */
|
||||
#define PA_FLOP0 0x02 /* Drive Select Floppy 0 */
|
||||
#define PA_FLOP1 0x04 /* Drive Select Floppy 1 */
|
||||
#define PA_SRTS 0x08 /* Serial RTS */
|
||||
#define PA_SDTR 0x10 /* Serial DTR */
|
||||
#define PA_PSTROBE 0x20 /* Parallel Strobe */
|
||||
#define PA_USER 0x40 /* Free Pin on Monitor Connector */
|
||||
#define PA_SER2 0x80 /* Choose between LAN or Ser2 port */
|
||||
|
||||
#endif /* _MACHINE_VIDEO_H */
|
||||
|
|
Loading…
Reference in New Issue