enable pseudo-dma on ivsc, allow no ite/grfcc.

This commit is contained in:
chopps 1995-05-07 15:37:02 +00:00
parent ad2b81e4f0
commit 2ca98c3cb6
7 changed files with 229 additions and 127 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf.c,v 1.20 1995/04/23 16:20:49 chopps Exp $ */
/* $NetBSD: grf.c,v 1.21 1995/05/07 15:37:02 chopps Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -69,6 +69,8 @@
#include <amiga/dev/grfvar.h>
#include <amiga/dev/itevar.h>
#include "view.h"
#include "grf.h"
#if NGRF > 0
@ -272,6 +274,7 @@ grfioctl(dev, cmd, data, flag, p)
Amiga. 15/11/94 ill */
return(gp->g_mode(gp, GM_GRFIOCTL, cmd, data));
default:
#if NVIEW > 0
/*
* check to see whether it's a command recognized by the
* view code if the unit is 0
@ -279,6 +282,7 @@ grfioctl(dev, cmd, data, flag, p)
*/
if (GRFUNIT(dev) == 0)
return(viewioctl(dev, cmd, data, flag, p));
#endif
error = EINVAL;
break;

View File

@ -106,8 +106,13 @@ unsigned long cl_maxpixelclock = 115000000;
* grfconfig to change the mode after boot.
*/
/* Console font */
#ifdef KFONT_8X11
#define CIRRUSFONT kernel_font_8x11
#define CIRRUSFONTY 11
#else
#define CIRRUSFONT kernel_font_8x8
#define CIRRUSFONTY 8
#endif
extern unsigned char CIRRUSFONT[];
struct grfcltext_mode clconsole_mode = {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite.c,v 1.28 1995/04/23 18:24:35 chopps Exp $ */
/* $NetBSD: ite.c,v 1.29 1995/05/07 15:37:06 chopps Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -58,6 +58,7 @@
#include <sys/systm.h>
#include <sys/proc.h>
#include <dev/cons.h>
#include <amiga/amiga/cc.h>
#include <amiga/amiga/kdassert.h>
#include <amiga/amiga/color.h> /* DEBUG */
#include <amiga/amiga/device.h>
@ -67,6 +68,7 @@
#include <amiga/dev/grfioctl.h>
#include <amiga/dev/grfvar.h>
#include "grfcc.h"
/*
* XXX go ask sys/kern/tty.c:ttselect()
@ -97,6 +99,17 @@ u_char cons_tabs[MAX_TABS];
struct ite_softc *kbd_ite;
int kbd_init;
/* audio bell stuff */
u_int bvolume = 10;
u_int bpitch = 660;
u_int bmsec = 75;
static char *bsamplep;
static char sample[20] = {
0,39,75,103,121,127,121,103,75,39,0,
-39,-75,-103,-121,-127,-121,-103,-75,-39
};
static char *index __P((const char *, char));
static int inline atoi __P((const char *));
void iteputchar __P((int c, struct ite_softc *ip));
@ -233,6 +246,41 @@ itecnprobe(cd)
}
}
/* audio bell stuff */
void
init_bell()
{
short i;
if (bsamplep != NULL)
return;
bsamplep = alloc_chipmem(20);
if (bsamplep == NULL)
panic("no chipmem for ite_bell");
bcopy(sample, bsamplep, 20);
}
void
ite_bell()
{
u_int clock;
u_int period;
u_int count;
clock = 3579545; /* PAL 3546895 */
/*
* the number of clock ticks per sample byte must be > 124
* ergo bpitch must be < clock / 124*20
* i.e. ~1443, 1300 to be safe (PAL etc.). also not zero obviously
*/
period = clock / (bpitch * 20);
count = bmsec * bpitch / 1000;
play_sample(10, PREP_DMA_MEM(bsamplep), period, bvolume, 0x3, count);
}
void
itecninit(cd)
struct consdev *cd;
@ -242,6 +290,8 @@ itecninit(cd)
ip = getitesp(cd->cn_dev);
iteinit(cd->cn_dev);
ip->flags |= ITE_ACTIVE | ITE_ISCONS;
init_bell();
}
/*
@ -463,6 +513,7 @@ iteioctl(dev, cmd, addr, flag, p)
{
struct iterepeat *irp;
struct ite_softc *ip;
struct itebell *ib;
struct tty *tp;
int error;
@ -479,6 +530,24 @@ iteioctl(dev, cmd, addr, flag, p)
return (error);
switch (cmd) {
case ITEIOCGBELL:
ib = (struct itebell *)addr;
ib->volume = bvolume;
ib->pitch = bpitch;
ib->msec = bmsec;
break;
case ITEIOCSBELL:
ib = (struct itebell *)addr;
/* bounds check */
if (ib->pitch > MAXBPITCH || ib->pitch < MINBPITCH ||
ib->volume > MAXBVOLUME || ib->msec > MAXBTIME)
error = EINVAL;
else {
bvolume = ib->volume;
bpitch = ib->pitch;
bmsec = ib->msec;
}
break;
case ITEIOCSKMAP:
if (addr == 0)
return(EFAULT);
@ -501,12 +570,14 @@ iteioctl(dev, cmd, addr, flag, p)
next_repeat_timeo = irp->next;
return(0);
}
#if NGRFCC > 0
/* XXX */
if (minor(dev) == 0) {
error = ite_grf_ioctl(ip, cmd, addr, flag, p);
if (error >= 0)
return (error);
}
#endif
return (ENOTTY);
}
@ -894,9 +965,15 @@ ite_filter(c, caller)
code |= 0x80;
} else if ((key.mode & KBD_MODE_KPAD) &&
(kbd_ite && kbd_ite->keypad_appmode)) {
static char *in = "0123456789-+.\r()/*";
static char in[] = {
0x0f /* 0 */, 0x1d /* 1 */, 0x1e /* 2 */, 0x1f /* 3 */,
0x2d /* 4 */, 0x2e /* 5 */, 0x2f /* 6 */, 0x3d /* 7 */,
0x3e /* 8 */, 0x3f /* 9 */, 0x4a /* - */, 0x5e /* + */,
0x3c /* . */, 0x43 /* e */, 0x5a /* ( */, 0x5b /* ) */,
0x5c /* / */, 0x5d /* * */
};
static char *out = "pqrstuvwxymlnMPQRS";
char *cp = index (in, code);
char *cp = index (in, c);
/*
* keypad-appmode sends SS3 followed by the above
@ -1275,7 +1352,6 @@ ite_putstr(s, len, dev)
SUBR_CURSOR(ip, END_CURSOROPT);
}
void
iteputchar(c, ip)
register int c;
@ -2030,7 +2106,7 @@ doesc:
break;
case BEL:
if (kbd_tty && kbd_ite && kbd_ite->tp == kbd_tty)
kbdbell();
ite_bell();
break;
case SO:
ip->GL = ip->G1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite_cc.c,v 1.23 1995/03/02 04:42:39 chopps Exp $ */
/* $NetBSD: ite_cc.c,v 1.24 1995/05/07 15:37:08 chopps Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@ -123,17 +123,6 @@ int ite_default_height = 512; /* def PAL height */
int ite_default_height = 400; /* def NON-PAL/NTSC height (?) */
#endif
/* audio bell stuff */
u_int bvolume = 10;
u_int bpitch = 660;
u_int bmsec = 75;
static char *bsamplep;
static char sample[20] = {
0,39,75,103,121,127,121,103,75,39,0,
-39,-75,-103,-121,-127,-121,-103,-75,-39
};
/*
* called from grf_cc to return console priority
*/
@ -159,41 +148,6 @@ grfcc_iteinit(gp)
gp->g_itedeinit = view_deinit;
}
void
init_bell()
{
short i;
if (bsamplep != NULL)
return;
bsamplep = alloc_chipmem(20);
if (bsamplep == NULL)
panic("no chipmem for ccbell");
bcopy(sample, bsamplep, 20);
}
void
cc_bell()
{
u_int clock;
u_int period;
u_int count;
clock = 3579545; /* PAL 3546895 */
/*
* the number of clock ticks per sample byte must be > 124
* ergo bpitch must be < clock / 124*20
* i.e. ~1443, 1300 to be safe (PAL etc.). also not zero obviously
*/
period = clock / (bpitch * 20);
count = bmsec * bpitch / 1000;
play_sample(10, PREP_DMA_MEM(bsamplep), period, bvolume, 0x3, count);
}
int
ite_newsize(ip, winsz)
struct ite_softc *ip;
@ -280,8 +234,6 @@ view_init(ip)
if (cci)
return;
init_bell();
ip->font = kernel_font;
ip->font_lo = kernel_font_lo;
@ -324,7 +276,6 @@ ite_grf_ioctl (ip, cmd, addr, flag, p)
{
struct winsize ws;
struct itewinsize *is;
struct itebell *ib;
ipriv_t *cci;
int error;
@ -364,24 +315,6 @@ ite_grf_ioctl (ip, cmd, addr, flag, p)
case ITEIOCREMWIN:
cc_mode(ip->grf, GM_GRFOFF, NULL, 0, 0);
break;
case ITEIOCGBELL:
ib = (struct itebell *)addr;
ib->volume = bvolume;
ib->pitch = bpitch;
ib->msec = bmsec;
break;
case ITEIOCSBELL:
ib = (struct itebell *)addr;
/* bounds check */
if (ib->pitch > MAXBPITCH || ib->pitch < MINBPITCH ||
ib->volume > MAXBVOLUME || ib->msec > MAXBTIME)
error = EINVAL;
else {
bvolume = ib->volume;
bpitch = ib->pitch;
bmsec = ib->msec;
}
break;
case VIOCSCMAP:
case VIOCGCMAP:
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: ivsc.c,v 1.10 1995/04/10 13:08:54 mycroft Exp $ */
/* $NetBSD: ivsc.c,v 1.11 1995/05/07 15:37:10 chopps Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
@ -39,7 +39,6 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
#include <vm/vm.h> /* XXXX Kludge for IVS Vector - mlh */
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
#include <amiga/amiga/custom.h>
@ -54,12 +53,10 @@ void ivscattach __P((struct device *, struct device *, void *));
int ivscmatch __P((struct device *, struct cfdata *, void *));
int ivsc_intr __P((struct sci_softc *));
#ifdef notyet
int ivsc_dma_xfer_in __P((struct sci_softc *dev, int len,
register u_char *buf, int phase));
int ivsc_dma_xfer_out __P((struct sci_softc *dev, int len,
register u_char *buf, int phase));
#endif
struct scsi_adapter ivsc_scsiswitch = {
sci_scsicmd,
@ -83,6 +80,8 @@ extern int sci_debug;
extern int sci_data_wait;
int ivsdma_pseudo = 1; /* 0=off, 1=on */
struct cfdriver ivsccd = {
NULL, "ivsc", (cfmatch_t)ivscmatch, ivscattach,
DV_DULL, sizeof(struct sci_softc), NULL, 0 };
@ -107,31 +106,6 @@ ivscmatch(pdp, cdp, auxp)
(zap->prodid != 52 && /* product = Trumpcard */
zap->prodid != 243)) /* product = Vector SCSI */
return(0); /* didn't match */
#if 0 /* shouldn't need this any more */
if (zap->prodid == 243) {
/*
* XXXX Ouch! board addresss isn't Zorro II or Zorro III!
* XXXX Kludge it up until I can do it better (MLH).
*
* XXXX pa 0x00f00000 shouldn't be used for anything
*/
if (pmap_extract(pmap_kernel(), (vm_offset_t) ztwomap(0x00f00000))
== 0x00f00000) {
physaccess(ztwomap(0x00f00000),zap->pa,
NBPG, PG_W|PG_CI);
zap->va = (void *) ztwomap(0x00f00000) +
((int)zap->pa & PGOFSET);
#ifdef DEBUG
printf("IVS Vector: mapped to %x kva %x\n",
ztwomap(0x00f00000), zap->va);
#endif
}
else {
printf("Unable to map IVS Vector SCSI\n");
return (0);
}
}
#endif
return(1);
}
@ -164,10 +138,10 @@ ivscattach(pdp, dp, auxp)
sc->sci_iack = rp + 14;
sc->sci_irecv = rp + 14;
#ifdef notyet
sc->dma_xfer_in = ivsc_dma_xfer_in;
sc->dma_xfer_out = ivsc_dma_xfer_out;
#endif
if (ivsdma_pseudo == 1) {
sc->dma_xfer_in = ivsc_dma_xfer_in;
sc->dma_xfer_out = ivsc_dma_xfer_out;
}
sc->sc_isr.isr_intr = ivsc_intr;
sc->sc_isr.isr_arg = sc;
@ -202,7 +176,6 @@ ivscprint(auxp, pnp)
return(QUIET);
}
#ifdef notyet
int
ivsc_dma_xfer_in (dev, len, buf, phase)
struct sci_softc *dev;
@ -210,6 +183,82 @@ ivsc_dma_xfer_in (dev, len, buf, phase)
register u_char *buf;
int phase;
{
int wait = sci_data_wait;
u_char csr;
u_char *obp = buf;
volatile register u_char *sci_dma = dev->sci_idata + 0x20;
volatile register u_char *sci_csr = dev->sci_csr;
QPRINTF(("ivsc_dma_in %d, csr=%02x\n", len, *dev->sci_bus_csr));
*dev->sci_tcmd = phase;
*dev->sci_mode |= SCI_MODE_DMA;
*dev->sci_irecv = 0;
while (len >= 128) {
wait = sci_data_wait;
while ((*sci_csr & (SCI_CSR_DREQ|SCI_CSR_PHASE_MATCH)) !=
(SCI_CSR_DREQ|SCI_CSR_PHASE_MATCH)) {
if (!(*sci_csr & SCI_CSR_PHASE_MATCH)
|| !(*dev->sci_bus_csr & SCI_BUS_BSY)
|| --wait < 0) {
#ifdef DEBUG
if (sci_debug)
printf("ivsc_dma_in2 fail: l%d i%x w%d\n",
len, csr, wait);
#endif
*dev->sci_mode &= ~SCI_MODE_DMA;
return 0;
}
}
#define R1 (*buf++ = *sci_dma)
R1; R1; R1; R1; R1; R1; R1; R1;
R1; R1; R1; R1; R1; R1; R1; R1;
R1; R1; R1; R1; R1; R1; R1; R1;
R1; R1; R1; R1; R1; R1; R1; R1;
R1; R1; R1; R1; R1; R1; R1; R1;
R1; R1; R1; R1; R1; R1; R1; R1;
R1; R1; R1; R1; R1; R1; R1; R1;
R1; R1; R1; R1; R1; R1; R1; R1;
R1; R1; R1; R1; R1; R1; R1; R1;
R1; R1; R1; R1; R1; R1; R1; R1;
R1; R1; R1; R1; R1; R1; R1; R1;
R1; R1; R1; R1; R1; R1; R1; R1;
R1; R1; R1; R1; R1; R1; R1; R1;
R1; R1; R1; R1; R1; R1; R1; R1;
R1; R1; R1; R1; R1; R1; R1; R1;
R1; R1; R1; R1; R1; R1; R1; R1;
len -= 128;
}
while (len > 0) {
wait = sci_data_wait;
while ((*sci_csr & (SCI_CSR_DREQ|SCI_CSR_PHASE_MATCH)) !=
(SCI_CSR_DREQ|SCI_CSR_PHASE_MATCH)) {
if (!(*sci_csr & SCI_CSR_PHASE_MATCH)
|| !(*dev->sci_bus_csr & SCI_BUS_BSY)
|| --wait < 0) {
#ifdef DEBUG
if (sci_debug)
printf("ivsc_dma_in1 fail: l%d i%x w%d\n",
len, csr, wait);
#endif
*dev->sci_mode &= ~SCI_MODE_DMA;
return 0;
}
}
*buf++ = *sci_dma;
len--;
}
QPRINTF(("ivsc_dma_in {%d} %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
len, obp[0], obp[1], obp[2], obp[3], obp[4], obp[5],
obp[6], obp[7], obp[8], obp[9]));
*dev->sci_mode &= ~SCI_MODE_DMA;
return 0;
}
int
@ -219,8 +268,51 @@ ivsc_dma_xfer_out (dev, len, buf, phase)
register u_char *buf;
int phase;
{
}
int wait = sci_data_wait;
u_char csr;
u_char *obp = buf;
volatile register u_char *sci_dma = dev->sci_data + 0x20;
volatile register u_char *sci_csr = dev->sci_csr;
QPRINTF(("ivsc_dma_out %d, csr=%02x\n", len, *dev->sci_bus_csr));
QPRINTF(("ivsc_dma_out {%d} %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
len, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5],
buf[6], buf[7], buf[8], buf[9]));
*dev->sci_tcmd = phase;
*dev->sci_mode |= SCI_MODE_DMA;
*dev->sci_icmd |= SCI_ICMD_DATA;
*dev->sci_dma_send = 0;
while (len > 0) {
wait = sci_data_wait;
while ((*sci_csr & (SCI_CSR_DREQ|SCI_CSR_PHASE_MATCH)) !=
(SCI_CSR_DREQ|SCI_CSR_PHASE_MATCH)) {
if (!(*sci_csr & SCI_CSR_PHASE_MATCH)
|| !(*dev->sci_bus_csr & SCI_BUS_BSY)
|| --wait < 0) {
#ifdef DEBUG
if (sci_debug)
printf("ivsc_dma_out fail: l%d i%x w%d\n",
len, csr, wait);
#endif
*dev->sci_mode &= ~SCI_MODE_DMA;
return 0;
}
}
*sci_dma = *buf++;
len--;
}
wait = sci_data_wait;
while ((*sci_csr & (SCI_CSR_DREQ|SCI_CSR_PHASE_MATCH)) ==
SCI_CSR_PHASE_MATCH && --wait);
*dev->sci_mode &= ~SCI_MODE_DMA;
return 0;
}
int
ivsc_intr(dev)

View File

@ -1,4 +1,4 @@
/* $NetBSD: kbd.c,v 1.14 1995/04/10 09:10:20 mycroft Exp $ */
/* $NetBSD: kbd.c,v 1.15 1995/05/07 15:37:11 chopps Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@ -266,14 +266,6 @@ kbdintr (mask)
}
int
kbdbell()
{
/* nice, mykes provided audio-support! */
cc_bell ();
}
int
kbdgetcn ()
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: kbdmap.h,v 1.8 1995/03/28 18:14:56 jtc Exp $ */
/* $NetBSD: kbdmap.h,v 1.9 1995/05/07 15:37:13 chopps Exp $ */
/*
* Copyright (c) 1993 Markus Wild
@ -96,13 +96,13 @@
/* size of string table */
#define KBD_STRTAB_SIZE 255
/* for dead keys, index into acctable */
#define KBD_ACC_GRAVE 0
#define KBD_ACC_ACUTE 1
#define KBD_ACC_CIRC 2
#define KBD_ACC_TILDE 3
#define KBD_ACC_DIER 4
#define KBD_NUM_ACC 5
/* for dead keys, index into acctable (plus 1!) */
#define KBD_ACC_GRAVE 1
#define KBD_ACC_ACUTE 2
#define KBD_ACC_CIRC 3
#define KBD_ACC_TILDE 4
#define KBD_ACC_DIER 5
#define KBD_NUM_ACC 6
struct key {
@ -119,7 +119,7 @@ struct key {
#define KBD_MODE_CIRC (KBD_ACC_CIRC << 4)
#define KBD_MODE_TILDE (KBD_ACC_TILDE << 4)
#define KBD_MODE_DIER (KBD_ACC_DIER << 4)
#define KBD_MODE_ACCENT(m) ((m) >> 4) /* get accent from mode */
#define KBD_MODE_ACCENT(m) (((m) >> 4) - 1) /* get accent from mode */
#define KBD_MODE_ACCMASK (0xf0)
struct kbdmap {