Kill arch/arm32. The last platform supported there, Shark, is now
in arch/shark. (NOTE: arch/dnard, a premature move to split out the Shark support code, is going to be deleted. It has bit-rotted.)
This commit is contained in:
parent
e694f74c6e
commit
8067595564
|
@ -1,29 +0,0 @@
|
|||
# $NetBSD: Makefile,v 1.5 1998/06/12 23:22:33 cgd Exp $
|
||||
|
||||
# Makefile for arm32 tags file and boot blocks
|
||||
|
||||
TARM32= ../arm32/tags
|
||||
SARM32= ../arm32/arm32/*.[ch] ../arm32/include/*.h \
|
||||
../arm32/dev/*.[ch] ../arm32/podulebus/*.[ch] ../arm32/mainbus/*.[ch]
|
||||
AARM32= ../arm32/arm32/*.s
|
||||
|
||||
# Directories in which to place tags links
|
||||
DARM32= dev mainbus podulebus include
|
||||
|
||||
.include "../../kern/Make.tags.inc"
|
||||
|
||||
tags:
|
||||
-ctags -wdtf ${TARM32} ${SARM32} ${COMM}
|
||||
egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AARM32} | \
|
||||
sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
|
||||
>> ${TARM32}
|
||||
sort -o ${TARM32} ${TARM32}
|
||||
|
||||
links:
|
||||
-for i in ${DARM32}; do \
|
||||
cd $$i && rm -f tags; ln -s ../tags tags; done
|
||||
|
||||
|
||||
SUBDIR= include
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -1,380 +0,0 @@
|
|||
/* $NetBSD: iic.c,v 1.14 2001/11/23 19:36:48 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994-1996 Mark Brinicombe.
|
||||
* Copyright (c) 1994 Brini.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software written for Brini by Mark Brinicombe
|
||||
*
|
||||
* 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 Mark Brinicombe.
|
||||
* 4. The name of the company nor the name of the author may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI OR CONTRIBUTORS 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.
|
||||
*
|
||||
* RiscBSD kernel project
|
||||
*
|
||||
* iic.c
|
||||
*
|
||||
* Routines to communicate with IIC devices
|
||||
*
|
||||
* Created : 13/10/94
|
||||
*
|
||||
* Based of kate/display/iiccontrol.c
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <arm/cpufunc.h>
|
||||
#include <arm32/dev/iic.h>
|
||||
#include <arm32/dev/iicvar.h>
|
||||
|
||||
#include "locators.h"
|
||||
|
||||
/* Local function prototypes */
|
||||
|
||||
static int iic_getack __P((void));
|
||||
static void iic_write_bit __P((int bit));
|
||||
static int iic_write_byte __P((u_char value));
|
||||
static u_char iic_read_byte __P((void));
|
||||
static void iic_start_bit __P((void));
|
||||
static void iic_stop_bit __P((void));
|
||||
|
||||
static int iicprint __P((void *aux, const char *name));
|
||||
|
||||
/* External functions that do the bit twiddling */
|
||||
extern int iic_getstate __P((void));
|
||||
extern void iic_set_state_and_ack __P((int, int));
|
||||
extern void iic_set_state __P((int, int));
|
||||
extern void iic_delay __P((int));
|
||||
|
||||
extern struct cfdriver iic_cd;
|
||||
|
||||
/*
|
||||
* Main entry to IIC driver.
|
||||
*/
|
||||
|
||||
int
|
||||
iic_control(address, buffer, count)
|
||||
u_char address;
|
||||
u_char *buffer;
|
||||
int count;
|
||||
{
|
||||
int loop;
|
||||
|
||||
/* Send the start bit */
|
||||
|
||||
iic_start_bit();
|
||||
|
||||
/* Send the address */
|
||||
|
||||
if (!iic_write_byte(address)) {
|
||||
iic_stop_bit();
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Read or write the data as required */
|
||||
|
||||
if ((address & 1) == 0) {
|
||||
/* Write bytes */
|
||||
for (loop = 0; loop < count; ++loop) {
|
||||
if (!iic_write_byte(buffer[loop])) {
|
||||
iic_stop_bit();
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Read bytes */
|
||||
for (loop = 0; loop < count; ++loop) {
|
||||
buffer[loop] = iic_read_byte();
|
||||
|
||||
/* Send final acknowledge */
|
||||
|
||||
if (loop == (count - 1))
|
||||
iic_write_bit(1);
|
||||
else
|
||||
iic_write_bit(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send stop bit */
|
||||
|
||||
iic_stop_bit();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
iic_getack()
|
||||
{
|
||||
u_int oldirqstate;
|
||||
int ack;
|
||||
|
||||
iic_set_state(1, 0);
|
||||
oldirqstate = disable_interrupts(I32_bit);
|
||||
iic_set_state_and_ack(1, 1);
|
||||
ack = iic_getstate();
|
||||
iic_set_state(1, 0);
|
||||
restore_interrupts(oldirqstate);
|
||||
|
||||
return((ack & 1) == 0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
iic_write_bit(bit)
|
||||
int bit;
|
||||
{
|
||||
u_int oldirqstate;
|
||||
|
||||
iic_set_state(bit, 0);
|
||||
oldirqstate = disable_interrupts(I32_bit);
|
||||
iic_set_state_and_ack(bit, 1);
|
||||
iic_set_state(bit, 0);
|
||||
restore_interrupts(oldirqstate);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
iic_write_byte(value)
|
||||
u_char value;
|
||||
{
|
||||
int loop;
|
||||
int bit;
|
||||
|
||||
for (loop = 0x80; loop != 0; loop = loop >> 1) {
|
||||
bit = ((value & loop) != 0);
|
||||
iic_write_bit(bit);
|
||||
}
|
||||
|
||||
return(iic_getack());
|
||||
}
|
||||
|
||||
|
||||
static u_char
|
||||
iic_read_byte()
|
||||
{
|
||||
int loop;
|
||||
u_char byte;
|
||||
u_int oldirqstate;
|
||||
|
||||
iic_set_state(1,0);
|
||||
|
||||
byte = 0;
|
||||
|
||||
for (loop = 0; loop < 8; ++loop) {
|
||||
oldirqstate = disable_interrupts(I32_bit);
|
||||
iic_set_state_and_ack(1, 1);
|
||||
byte = (byte << 1) + (iic_getstate() & 1);
|
||||
iic_set_state(1, 0);
|
||||
restore_interrupts(oldirqstate);
|
||||
}
|
||||
|
||||
return(byte);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
iic_start_bit()
|
||||
{
|
||||
iic_set_state(1, 1);
|
||||
iic_set_state(0, 1);
|
||||
iic_delay(10);
|
||||
iic_set_state(0, 0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
iic_stop_bit()
|
||||
{
|
||||
iic_set_state(0, 1);
|
||||
iic_set_state(1, 1);
|
||||
}
|
||||
|
||||
/* driver structures */
|
||||
|
||||
/*
|
||||
* int iicprint(void *aux, const char *name)
|
||||
*
|
||||
* print function for child device configuration
|
||||
*/
|
||||
|
||||
static int
|
||||
iicprint(aux, name)
|
||||
void *aux;
|
||||
const char *name;
|
||||
{
|
||||
struct iicbus_attach_args *iba = aux;
|
||||
|
||||
if (!name) {
|
||||
if (iba->ib_addr)
|
||||
printf(" addr 0x%02x", iba->ib_addr);
|
||||
}
|
||||
|
||||
/* XXXX print flags */
|
||||
return (QUIET);
|
||||
}
|
||||
|
||||
/*
|
||||
* iic search function
|
||||
*
|
||||
* search for devices that are children of the iic device
|
||||
* fill out the attach arguments and call the probe and
|
||||
* attach function (as required).
|
||||
*
|
||||
* Note: since the offsets of the devices need to be specified in the
|
||||
* config file we ignore the FSTAT_STAR.
|
||||
*/
|
||||
|
||||
int
|
||||
iicsearch(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct iic_softc *sc = (struct iic_softc *)parent;
|
||||
struct iicbus_attach_args iba;
|
||||
int tryagain;
|
||||
|
||||
do {
|
||||
iba.ib_iic_softc = sc;
|
||||
iba.ib_addr = cf->cf_loc[IICCF_ADDR];
|
||||
iba.ib_aux = NULL;
|
||||
|
||||
tryagain = 0;
|
||||
if ((*cf->cf_attach->ca_match)(parent, cf, &iba) > 0) {
|
||||
config_attach(parent, cf, &iba, iicprint);
|
||||
/* tryagain = (cf->cf_fstate == FSTATE_STAR);*/
|
||||
}
|
||||
} while (tryagain);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Q: Do we really need a device interface ?
|
||||
*/
|
||||
|
||||
int
|
||||
iicopen(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag;
|
||||
int mode;
|
||||
struct proc *p;
|
||||
{
|
||||
struct iic_softc *sc;
|
||||
int unit = minor(dev);
|
||||
|
||||
if (unit >= iic_cd.cd_ndevs)
|
||||
return(ENXIO);
|
||||
|
||||
sc = iic_cd.cd_devs[unit];
|
||||
|
||||
if (!sc) return(ENXIO);
|
||||
|
||||
if (sc->sc_flags & IIC_OPEN) return(EBUSY);
|
||||
|
||||
sc->sc_flags |= IIC_OPEN;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
iicclose(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag;
|
||||
int mode;
|
||||
struct proc *p;
|
||||
{
|
||||
int unit = minor(dev);
|
||||
struct iic_softc *sc = iic_cd.cd_devs[unit];
|
||||
|
||||
sc->sc_flags &= ~IIC_OPEN;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* No support for device reads, writes or ioctls yet
|
||||
*/
|
||||
|
||||
int
|
||||
iicread(dev, uio, flag)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int flag;
|
||||
{
|
||||
/* int unit = minor(dev);*/
|
||||
/* struct iic_softc *sc = iic_cd.cd_devs[unit];*/
|
||||
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
iicwrite(dev, uio, flag)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int flag;
|
||||
{
|
||||
/* int unit = minor(dev);*/
|
||||
/* struct iic_softc *sc = iic_cd.cd_devs[unit];*/
|
||||
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
iicioctl(dev, cmd, data, flag, p)
|
||||
dev_t dev;
|
||||
int cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
/* struct iic_softc *sc = iic_cd.cd_devs[minor(dev)];*/
|
||||
|
||||
/* switch (cmd) {
|
||||
case IICIOC_CONTROL:
|
||||
if (iiccontrol() != 0) {
|
||||
return(EIO);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
*/
|
||||
return(EINVAL);
|
||||
}
|
||||
|
||||
/* End of iic.c */
|
|
@ -1,72 +0,0 @@
|
|||
/* $NetBSD: iic.h,v 1.1 1997/10/14 19:35:41 mark Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Mark Brinicombe.
|
||||
* 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 Brini.
|
||||
* 4. The name of the company nor the name of the author may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI OR CONTRIBUTORS 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.
|
||||
*
|
||||
* RiscBSD kernel project
|
||||
*
|
||||
* iic.h
|
||||
*
|
||||
* header file for IIC
|
||||
*
|
||||
* Created : 15/04/96
|
||||
*/
|
||||
|
||||
/*
|
||||
* IIC bus driver attach arguments
|
||||
*/
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
struct iicbus_attach_args {
|
||||
int ib_addr; /* i/o address */
|
||||
void *ib_aux; /* driver specific */
|
||||
void *ib_iic_softc; /* softc of iic parent */
|
||||
};
|
||||
|
||||
#define iic_bitdelay 10
|
||||
|
||||
#define IIC_WRITE 0x00
|
||||
#define IIC_READ 0x01
|
||||
|
||||
/* Prototypes for assembly functions */
|
||||
|
||||
void iic_set_state __P((int data, int clock));
|
||||
void iic_set_state_and_ack __P((int data, int clock));
|
||||
void iic_delay __P((int delay));
|
||||
|
||||
/* Prototype for kernel interface to IIC bus */
|
||||
|
||||
int iic_control __P((u_char address, u_char *buffer, int count));
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
/* End of iic.h */
|
|
@ -1,60 +0,0 @@
|
|||
/* $NetBSD: iicvar.h,v 1.1 1997/10/14 19:35:42 mark Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe.
|
||||
* Copyright (c) 1997 Causality Limited
|
||||
* 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 Mark Brinicombe
|
||||
* 4. The name of the company nor the name of the author may 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 OR CONTRIBUTORS 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.
|
||||
*
|
||||
* RiscBSD kernel project
|
||||
*
|
||||
* iicvar.h
|
||||
*
|
||||
* Created : 02/02/97
|
||||
*/
|
||||
|
||||
/*
|
||||
* softc structure for the iic device.
|
||||
*/
|
||||
|
||||
struct iic_softc {
|
||||
struct device sc_dev; /* device node */
|
||||
int sc_flags; /* flags */
|
||||
#define IIC_BROKEN 1 /* device is broken */
|
||||
#define IIC_OPEN 2 /* device is open */
|
||||
#define IIC_BUSY 4 /* device is busy */
|
||||
bus_space_tag_t sc_iot; /* bus tag */
|
||||
bus_space_handle_t sc_ioh; /* bus handle */
|
||||
};
|
||||
|
||||
/* prototypes for functions used in attach routines */
|
||||
|
||||
int iicsearch __P((struct device *, struct cfdata *, void *));
|
||||
|
||||
/* End of iicvar.h */
|
File diff suppressed because it is too large
Load Diff
|
@ -1,77 +0,0 @@
|
|||
/* $NetBSD: kbdvar.h,v 1.2 1998/01/18 03:51:13 mark Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe.
|
||||
* Copyright (c) 1997 Causality Limited
|
||||
* 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 Mark Brinicombe
|
||||
* 4. The name of the company nor the name of the author may 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 OR CONTRIBUTORS 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.
|
||||
*
|
||||
* RiscBSD kernel project
|
||||
*
|
||||
* kbdvar.h
|
||||
*
|
||||
* Created : 02/02/97
|
||||
*/
|
||||
|
||||
/* Define the key_struct structure */
|
||||
|
||||
typedef struct {
|
||||
int base_code; /* Base ASCII code */
|
||||
int shift_code; /* Shifted ASCII code */
|
||||
int ctrl_code; /* CTRL code */
|
||||
int alt_code; /* Alt code */
|
||||
int flags; /* Flags field */
|
||||
} key_struct;
|
||||
|
||||
/*
|
||||
* softc structure for the kbd device
|
||||
*/
|
||||
|
||||
struct kbd_softc {
|
||||
struct device sc_device; /* device node */
|
||||
void *sc_ih; /* interrupt pointer */
|
||||
|
||||
bus_space_tag_t sc_iot; /* bus tag */
|
||||
bus_space_handle_t sc_ioh; /* bus handle */
|
||||
|
||||
int sc_state; /* device state */
|
||||
#define RAWKBD_OPEN 0x01
|
||||
#define KBD_OPEN 0x02
|
||||
#define RAWKBD_ASLEEP 0x04
|
||||
struct clist sc_q;
|
||||
struct selinfo sc_rsel;
|
||||
struct proc *sc_proc;
|
||||
};
|
||||
|
||||
/* function prototypes used by attach routines */
|
||||
|
||||
int kbdreset __P((struct kbd_softc *sc));
|
||||
int kbdintr __P((void *arg));
|
||||
|
||||
/* End of kbdvar.h */
|
|
@ -1,107 +0,0 @@
|
|||
/* $NetBSD: md_hooks.c,v 1.19 2001/09/24 17:00:52 rearnsha Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Gordon W. Ross
|
||||
* 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. 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 "opt_md.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <dev/md.h>
|
||||
|
||||
#include "opt_mdsize.h"
|
||||
|
||||
#ifdef MINIROOTSIZE
|
||||
#define ROOTBYTES (MINIROOTSIZE << DEV_BSHIFT)
|
||||
|
||||
/*
|
||||
* This array will be patched to contain a file-system image.
|
||||
* See the program: src/distrib/sun3/common/rdsetroot.c
|
||||
*/
|
||||
int md_root_size = ROOTBYTES;
|
||||
char md_root_image[ROOTBYTES] = "|This is the root ramdisk!\n";
|
||||
|
||||
#else /* MINIROOTSIZE */
|
||||
|
||||
u_int memory_disc_size = 0; /* set by machdep.c */
|
||||
static struct md_conf *bootmd = NULL;
|
||||
|
||||
extern int load_memory_disc_from_floppy __P((struct md_conf *md, dev_t dev));
|
||||
|
||||
#include "fdc.h"
|
||||
#endif /* MINIROOTSIZE */
|
||||
|
||||
void
|
||||
md_attach_hook(unit, md)
|
||||
int unit;
|
||||
struct md_conf *md;
|
||||
{
|
||||
if (unit == 0) {
|
||||
#ifdef MINIROOTSIZE
|
||||
/* Setup root ramdisk */
|
||||
md->md_addr = (caddr_t) md_root_image;
|
||||
md->md_size = (size_t) md_root_size;
|
||||
md->md_type = MD_KMEM_FIXED;
|
||||
#else /* MINIROOTSIZE */
|
||||
#ifdef MEMORY_DISK_SIZE
|
||||
if (memory_disc_size == 0 && MEMORY_DISK_SIZE)
|
||||
memory_disc_size = (MEMORY_DISK_SIZE << DEV_BSHIFT);
|
||||
#endif /* MEMORY_DISK_SIZE */
|
||||
if (memory_disc_size != 0) {
|
||||
md->md_size = round_page(memory_disc_size);
|
||||
md->md_addr = (caddr_t)uvm_km_zalloc(kernel_map, memory_disc_size);
|
||||
md->md_type = MD_KMEM_FIXED;
|
||||
bootmd = md;
|
||||
}
|
||||
#endif /* MINIROOTSIZE */
|
||||
printf("md%d: allocated %ldK (%ld blocks)\n", unit, (long)md->md_size / 1024, (long)md->md_size / DEV_BSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This is called during open (i.e. mountroot)
|
||||
*/
|
||||
|
||||
void
|
||||
md_open_hook(unit, md)
|
||||
int unit;
|
||||
struct md_conf *md;
|
||||
{
|
||||
if (unit == 0) {
|
||||
/* The root memory disk only works single-user. */
|
||||
boothowto |= RB_SINGLE;
|
||||
#if !defined(MINIROOTSIZE) && NFDC > 0
|
||||
load_memory_disc_from_floppy(bootmd, makedev(17, 1)); /* XXX 1.44MB FD */
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -1,694 +0,0 @@
|
|||
/* $NetBSD: pms.c,v 1.23 2001/09/16 16:34:28 wiz Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 D.C. Tsen
|
||||
* Copyright (c) 1994 Charles M. Hannum.
|
||||
* Copyright (c) 1992, 1993 Erik Forsberg.
|
||||
* 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 the RiscBSD team.
|
||||
* 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 AUTHORS ``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 AUTHORS 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.
|
||||
*
|
||||
* from:pms.c,v 1.24 1995/12/24 02:30:28 mycroft Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
* Ported from 386 version of PS/2 mouse driver.
|
||||
* D.C. Tsen
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/poll.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/conf.h>
|
||||
#include <machine/mouse.h>
|
||||
#include <arm32/dev/pmsvar.h>
|
||||
|
||||
#define MOUSE_IOC_ACK
|
||||
|
||||
/* mouse commands */
|
||||
#define PMS_SET_SCALE11 0xe6 /* set scaling 1:1 */
|
||||
#define PMS_SET_SCALE21 0xe7 /* set scaling 2:1 */
|
||||
#define PMS_SET_RES 0xe8 /* set resolution */
|
||||
#define PMS_GET_SCALE 0xe9 /* get scaling factor */
|
||||
#define PMS_SET_STREAM 0xea /* set streaming mode */
|
||||
#define PMS_SET_SAMPLE 0xf3 /* set sampling rate */
|
||||
#define PMS_DEV_ENABLE 0xf4 /* mouse on */
|
||||
#define PMS_DEV_DISABLE 0xf5 /* mouse off */
|
||||
#define PMS_RESET 0xff /* reset */
|
||||
|
||||
#define PMS_CHUNK 128 /* chunk size for read */
|
||||
#define PMS_BSIZE (20*64) /* buffer size */
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
void pmswatchdog __P((void *));
|
||||
#ifdef MOUSE_IOC_ACK
|
||||
static void pmsputbuffer __P((struct pms_softc *sc, struct mousebufrec *buf));
|
||||
#endif
|
||||
static __inline void pms_flush __P((struct pms_softc *sc));
|
||||
|
||||
extern struct cfdriver opms_cd;
|
||||
|
||||
/* pms device driver structure */
|
||||
|
||||
#define PMS_DATA 0
|
||||
#define PMS_CR 1
|
||||
#define PMS_STATUS 1
|
||||
|
||||
#define PMS_CR_ENABLE 0x08
|
||||
#define PMS_CR_KDATAO 0x02
|
||||
#define PMS_CR_KCLKO 0x01
|
||||
|
||||
#define PMS_ST_TXE 0x80
|
||||
#define PMS_ST_TXB 0x40
|
||||
#define PMS_ST_RXF 0x20
|
||||
#define PMS_ST_RXB 0x10
|
||||
#define PMS_ST_ENABLE 0x08
|
||||
#define PMS_ST_RXPARITY 0x04
|
||||
#define PMS_ST_KDATAI 0x02
|
||||
#define PMS_ST_KCLKI 0x01
|
||||
|
||||
#define PMSUNIT(dev) (minor(dev))
|
||||
|
||||
/*
|
||||
* Flush any pending mouse data
|
||||
*/
|
||||
|
||||
static __inline void
|
||||
pms_flush(sc)
|
||||
struct pms_softc *sc;
|
||||
{
|
||||
int n = 1000;
|
||||
|
||||
while (n-- && (bus_space_read_1(sc->sc_iot, sc->sc_ioh, PMS_STATUS)
|
||||
& PMS_ST_RXF)) {
|
||||
delay(6);
|
||||
(void) bus_space_read_1(sc->sc_iot, sc->sc_ioh, PMS_DATA);
|
||||
delay(6);
|
||||
(void) bus_space_read_1(sc->sc_iot, sc->sc_ioh, PMS_DATA);
|
||||
delay(6);
|
||||
(void) bus_space_read_1(sc->sc_iot, sc->sc_ioh, PMS_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Send a command to the mouse
|
||||
*/
|
||||
|
||||
static int
|
||||
cmd_mouse(sc, cmd)
|
||||
struct pms_softc * sc;
|
||||
u_char cmd;
|
||||
{
|
||||
int c;
|
||||
int i = 0;
|
||||
int retry = 10;
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
if (bus_space_read_1(sc->sc_iot, sc->sc_ioh, PMS_STATUS) & PMS_ST_TXE)
|
||||
break;
|
||||
delay(2);
|
||||
}
|
||||
if (i == 1000)
|
||||
printf("Mouse transmit not ready\n");
|
||||
|
||||
resend:
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, PMS_DATA, cmd);
|
||||
delay(2);
|
||||
c = bus_space_read_1(sc->sc_iot, sc->sc_ioh, PMS_STATUS);
|
||||
i = 1000;
|
||||
while (i-- && !(c & PMS_ST_RXF)) {
|
||||
delay(1);
|
||||
c = bus_space_read_1(sc->sc_iot, sc->sc_ioh, PMS_STATUS);
|
||||
}
|
||||
|
||||
delay(10000);
|
||||
|
||||
c = bus_space_read_1(sc->sc_iot, sc->sc_ioh, PMS_DATA);
|
||||
if ((c == 0xFA) || (c == 0xEE))
|
||||
return(0);
|
||||
|
||||
if (--retry) {
|
||||
pms_flush(sc);
|
||||
goto resend;
|
||||
}
|
||||
|
||||
printf("%s: Mouse cmd failed, cmd = %x, status = %x\n", sc->sc_dev.dv_xname, cmd, c);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* initialise the mouse
|
||||
*
|
||||
*
|
||||
* The sets up parts of the softc and then tests the mouse
|
||||
* to make sure it is responding.
|
||||
* It then configures the mouse as required.
|
||||
*/
|
||||
|
||||
int
|
||||
pmsinit(sc)
|
||||
struct pms_softc *sc;
|
||||
{
|
||||
int i, j;
|
||||
int mid;
|
||||
|
||||
/* Set up softc */
|
||||
callout_init(&sc->sc_watchdog_ch);
|
||||
sc->sc_state = 0;
|
||||
sc->origx = 0;
|
||||
sc->origy = 0;
|
||||
sc->boundx = -4095;
|
||||
sc->boundy = -4095;
|
||||
sc->bounda = 4096;
|
||||
sc->boundb = 4096;
|
||||
|
||||
/* Enable the mouse */
|
||||
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, PMS_CR, PMS_CR_ENABLE);
|
||||
|
||||
i = 0;
|
||||
while ((bus_space_read_1(sc->sc_iot, sc->sc_ioh, PMS_STATUS) & 0x03)
|
||||
!= 0x03) {
|
||||
if (i++ > 10) {
|
||||
printf("Mouse not found, status = <%x>.\n",
|
||||
bus_space_read_1(sc->sc_iot, sc->sc_ioh,
|
||||
PMS_STATUS));
|
||||
return(0);
|
||||
}
|
||||
pms_flush(sc);
|
||||
delay(2);
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, PMS_CR, PMS_CR_ENABLE);
|
||||
}
|
||||
|
||||
pms_flush(sc);
|
||||
|
||||
/*
|
||||
* Disable, reset and enable the mouse.
|
||||
*/
|
||||
if (cmd_mouse(sc, PMS_DEV_DISABLE))
|
||||
return(0);
|
||||
|
||||
cmd_mouse(sc, PMS_RESET);
|
||||
delay(300000);
|
||||
j = 10;
|
||||
i = 0;
|
||||
while ((mid = bus_space_read_1(sc->sc_iot, sc->sc_ioh, PMS_DATA)) != 0xAA) {
|
||||
if (++i > 500) {
|
||||
if (--j < 0) {
|
||||
printf("Mouse Reset failed, status = <%x>.\n", mid);
|
||||
return(0);
|
||||
}
|
||||
pms_flush(sc);
|
||||
cmd_mouse(sc, PMS_RESET);
|
||||
i = 0;
|
||||
}
|
||||
delay(100000);
|
||||
}
|
||||
mid = bus_space_read_1(sc->sc_iot, sc->sc_ioh, PMS_DATA);
|
||||
#if 0
|
||||
cmd_mouse(sc, PMS_SET_RES);
|
||||
cmd_mouse(sc, 3); /* 8 counts/mm */
|
||||
cmd_mouse(sc, PMS_SET_SCALE21);
|
||||
#endif
|
||||
cmd_mouse(sc, PMS_SET_SAMPLE);
|
||||
cmd_mouse(sc, 40); /* 40 samples/sec */
|
||||
cmd_mouse(sc, PMS_SET_STREAM);
|
||||
cmd_mouse(sc, PMS_DEV_ENABLE);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* device open routine
|
||||
*/
|
||||
int
|
||||
pmsopen(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag;
|
||||
int mode;
|
||||
struct proc *p;
|
||||
{
|
||||
int unit = PMSUNIT(dev);
|
||||
struct pms_softc *sc;
|
||||
|
||||
/* validate the unit and the softc */
|
||||
if (unit >= opms_cd.cd_ndevs)
|
||||
return ENXIO;
|
||||
sc = opms_cd.cd_devs[unit];
|
||||
if (!sc)
|
||||
return ENXIO;
|
||||
|
||||
/* Are we already open ? */
|
||||
if (sc->sc_state & PMS_OPEN)
|
||||
return EBUSY;
|
||||
|
||||
/* initialise buffer */
|
||||
if (clalloc(&sc->sc_q, PMS_BSIZE, 0) == -1)
|
||||
return ENOMEM;
|
||||
|
||||
/* set up the softc structure */
|
||||
sc->sc_proc = p;
|
||||
sc->sc_mode = MOUSEMODE_ABS;
|
||||
sc->sc_state |= PMS_OPEN;
|
||||
sc->sc_status = 0;
|
||||
sc->sc_x = sc->sc_y = 0;
|
||||
sc->lastx = -1;
|
||||
sc->lasty = -1;
|
||||
sc->lastb = -1;
|
||||
|
||||
/* enable interrupts */
|
||||
sc->sc_intenable(sc, 1);
|
||||
|
||||
/* install watchdog timeout */
|
||||
callout_reset(&sc->sc_watchdog_ch, 30 * hz,
|
||||
pmswatchdog, sc);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* driver close function
|
||||
*/
|
||||
int
|
||||
pmsclose(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag;
|
||||
int mode;
|
||||
struct proc *p;
|
||||
{
|
||||
struct pms_softc *sc = opms_cd.cd_devs[PMSUNIT(dev)];
|
||||
|
||||
/* remove the timeout */
|
||||
callout_stop(&sc->sc_watchdog_ch);
|
||||
|
||||
/* disable interrupts */
|
||||
sc->sc_intenable(sc, 0);
|
||||
|
||||
/* clean up*/
|
||||
sc->sc_proc = NULL;
|
||||
sc->sc_state &= ~PMS_OPEN;
|
||||
sc->sc_x = sc->sc_y = 0;
|
||||
|
||||
clfree(&sc->sc_q);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pmsread(dev, uio, flag)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int flag;
|
||||
{
|
||||
struct pms_softc *sc = opms_cd.cd_devs[PMSUNIT(dev)];
|
||||
int s;
|
||||
int error = 0;
|
||||
size_t length;
|
||||
u_char buffer[PMS_CHUNK];
|
||||
|
||||
/* Block until mouse activity occurred. */
|
||||
|
||||
s = spltty();
|
||||
while (sc->sc_q.c_cc == 0) {
|
||||
if (flag & IO_NDELAY) {
|
||||
(void)splx(s);
|
||||
return EWOULDBLOCK;
|
||||
}
|
||||
sc->sc_state |= PMS_ASLP;
|
||||
if ((error = tsleep((caddr_t)sc, (PZERO | PCATCH), "pmsread", 0))) {
|
||||
sc->sc_state &= ~PMS_ASLP;
|
||||
(void)splx(s);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
/* Transfer as many chunks as possible. */
|
||||
|
||||
while (sc->sc_q.c_cc > 0 && uio->uio_resid > 0) {
|
||||
length = min(sc->sc_q.c_cc, uio->uio_resid);
|
||||
if (length > sizeof(buffer))
|
||||
length = sizeof(buffer);
|
||||
|
||||
/* Remove a small chunk from the input queue. */
|
||||
(void) q_to_b(&sc->sc_q, buffer, length);
|
||||
|
||||
/* Copy the data to the user process. */
|
||||
if ((error = uiomove(buffer, length, uio)))
|
||||
break;
|
||||
}
|
||||
(void)splx(s);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
int
|
||||
pmsioctl(dev, cmd, addr, flag, p)
|
||||
dev_t dev;
|
||||
u_long cmd;
|
||||
caddr_t addr;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
struct pms_softc *sc = opms_cd.cd_devs[PMSUNIT(dev)];
|
||||
struct mouseinfo info;
|
||||
int s;
|
||||
int error = 0;
|
||||
|
||||
s = spltty();
|
||||
|
||||
switch (cmd) {
|
||||
case MOUSEIOC_SETSTATE:
|
||||
printf("MOUSEIOC_SETSTATE called\n");
|
||||
break;
|
||||
case MOUSEIOC_WRITEX:
|
||||
sc->sc_x = *(int *) addr;
|
||||
break;
|
||||
case MOUSEIOC_WRITEY:
|
||||
sc->sc_y = *(int *) addr;
|
||||
break;
|
||||
case MOUSEIOC_SETBOUNDS:
|
||||
{
|
||||
register struct mouse_boundingbox *bo = (void *) addr;
|
||||
struct mousebufrec buffer;
|
||||
|
||||
sc->boundx = bo->x; sc->boundy = bo->y;
|
||||
sc->bounda = bo->a; sc->boundb = bo->b;
|
||||
|
||||
buffer.status = IOC_ACK;
|
||||
buffer.x = sc->origx;
|
||||
buffer.y = sc->origy;
|
||||
#ifdef MOUSE_IOC_ACK
|
||||
pmsputbuffer(sc, &buffer);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case MOUSEIOC_SETMODE:
|
||||
{
|
||||
struct mousebufrec buffer;
|
||||
sc->sc_mode = *(int *)addr;
|
||||
|
||||
buffer.status = IOC_ACK;
|
||||
buffer.x = sc->origx;
|
||||
buffer.y = sc->origy;
|
||||
#ifdef MOUSE_IOC_ACK
|
||||
if (sc->sc_q.c_cc > 0)
|
||||
printf("%s: setting mode with non empty buffer (%d)\n",
|
||||
sc->sc_dev.dv_xname, sc->sc_q.c_cc);
|
||||
pmsputbuffer(sc, &buffer);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case MOUSEIOC_SETORIGIN:
|
||||
{
|
||||
register struct mouse_origin *oo = (void *) addr;
|
||||
struct mousebufrec buffer;
|
||||
|
||||
sc->origx = oo->x;
|
||||
sc->origy = oo->y;
|
||||
|
||||
buffer.status = IOC_ACK;
|
||||
buffer.x = sc->origx;
|
||||
buffer.y = sc->origy;
|
||||
#ifdef MOUSE_IOC_ACK
|
||||
pmsputbuffer(sc, &buffer);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case MOUSEIOC_GETBOUNDS:
|
||||
{
|
||||
register struct mouse_boundingbox *bo = (void *) addr;
|
||||
bo->x = sc->boundx; bo->y = sc->boundy;
|
||||
bo->a = sc->bounda; bo->b = sc->boundb;
|
||||
break;
|
||||
}
|
||||
case MOUSEIOC_GETORIGIN:
|
||||
{
|
||||
register struct mouse_origin *oo = (void *) addr;
|
||||
oo->x = sc->origx;
|
||||
oo->y = sc->origy;
|
||||
break;
|
||||
}
|
||||
case MOUSEIOC_GETSTATE:
|
||||
info.status = sc->sc_status;
|
||||
if (sc->sc_x || sc->sc_y)
|
||||
info.status |= MOVEMENT;
|
||||
|
||||
#if 1
|
||||
info.xmotion = sc->sc_x;
|
||||
info.ymotion = sc->sc_y;
|
||||
#else
|
||||
if (sc->sc_x > sc->bounda)
|
||||
info.xmotion = sc->bounda;
|
||||
else if (sc->sc_x < sc->boundx)
|
||||
info.xmotion = sc->boundx;
|
||||
else
|
||||
info.xmotion = sc->sc_x;
|
||||
|
||||
if (sc->sc_y > sc->boundb)
|
||||
info.ymotion = sc->boundb;
|
||||
else if (sc->sc_y < sc->boundy)
|
||||
info.ymotion = sc->boundy;
|
||||
else
|
||||
info.ymotion = sc->sc_y;
|
||||
#endif
|
||||
|
||||
/* Reset historical information. */
|
||||
sc->sc_x = sc->sc_y = 0;
|
||||
sc->sc_status &= ~BUTCHNGMASK;
|
||||
ndflush(&sc->sc_q, sc->sc_q.c_cc);
|
||||
|
||||
error = copyout(&info, addr, sizeof(struct mouseinfo));
|
||||
break;
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
(void)splx(s);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Masks for the first byte of a packet */
|
||||
#define PS2LBUTMASK 0x01
|
||||
#define PS2RBUTMASK 0x02
|
||||
#define PS2MBUTMASK 0x04
|
||||
|
||||
#define XNEG_MASK 0x10
|
||||
#define YNEG_MASK 0x20
|
||||
|
||||
int
|
||||
pmsintr(arg)
|
||||
void *arg;
|
||||
{
|
||||
struct pms_softc *sc = arg;
|
||||
static int state = 0;
|
||||
static u_char buttons;
|
||||
u_char changed;
|
||||
static int dx, dy;
|
||||
int dosignal = 0;
|
||||
int s;
|
||||
u_char b;
|
||||
struct mousebufrec mbuffer;
|
||||
|
||||
if ((sc->sc_state & PMS_OPEN) == 0) {
|
||||
/* Interrupts are not expected. Discard the byte. */
|
||||
pms_flush(sc);
|
||||
return(-1); /* Could have been ours but pass it on */
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case 0:
|
||||
buttons = bus_space_read_1(sc->sc_iot, sc->sc_ioh, PMS_DATA);
|
||||
if ((buttons & 0xc0) == 0)
|
||||
++state;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
dx = bus_space_read_1(sc->sc_iot, sc->sc_ioh, PMS_DATA);
|
||||
dx = (buttons & XNEG_MASK) ? -dx : dx;
|
||||
++state;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
dy = bus_space_read_1(sc->sc_iot, sc->sc_ioh, PMS_DATA);
|
||||
dy = (buttons & YNEG_MASK) ? -dy : dy;
|
||||
state = 0;
|
||||
|
||||
buttons = ((buttons & PS2LBUTMASK) << 2) |
|
||||
((buttons & (PS2RBUTMASK | PS2MBUTMASK)) >> 1);
|
||||
/*
|
||||
* Ahhh, the Xarm server interrupt button bits reversed.
|
||||
* If bit is set to 1, it means button is not pressed which is
|
||||
* not what PS/2 mouse button bits said. Since we are simulating
|
||||
* the quadmouse, that's not too picky about it.
|
||||
*/
|
||||
buttons ^= BUTSTATMASK;
|
||||
changed = ((buttons ^ sc->sc_status) & BUTSTATMASK) << 3;
|
||||
sc->sc_status = buttons | (sc->sc_status & ~BUTSTATMASK) | changed;
|
||||
|
||||
if (dx || dy || changed) {
|
||||
if (dx < 0)
|
||||
dx = -(256 + dx);
|
||||
if (dy < 0)
|
||||
dy = -(256 + dy);
|
||||
|
||||
/* Update accumulated movements. */
|
||||
sc->sc_x += dx;
|
||||
sc->sc_y += dy;
|
||||
|
||||
if (sc->sc_x > sc->bounda)
|
||||
sc->sc_x = sc->bounda;
|
||||
else if (sc->sc_x < sc->boundx)
|
||||
sc->sc_x = sc->boundx;
|
||||
|
||||
if (sc->sc_y > sc->boundb)
|
||||
sc->sc_y = sc->boundb;
|
||||
else if (sc->sc_y < sc->boundy)
|
||||
sc->sc_y = sc->boundy;
|
||||
|
||||
if (sc->sc_q.c_cc == 0)
|
||||
dosignal = 1;
|
||||
|
||||
/* Add this event to the queue. */
|
||||
b = buttons & BUTSTATMASK;
|
||||
mbuffer.status = b | (b ^ sc->lastb) << 3
|
||||
| (((sc->sc_x==sc->lastx) && (sc->sc_y==sc->lasty))?0:MOVEMENT);
|
||||
mbuffer.x = sc->sc_x * 2;
|
||||
mbuffer.y = sc->sc_y * 2;
|
||||
microtime(&mbuffer.event_time);
|
||||
s = spltty();
|
||||
(void) b_to_q((char *)&mbuffer, sizeof(mbuffer), &sc->sc_q);
|
||||
(void) splx(s);
|
||||
sc->lastx = sc->sc_x;
|
||||
sc->lasty = sc->sc_y;
|
||||
sc->lastb = b;
|
||||
|
||||
if(sc->sc_mode == MOUSEMODE_REL) {
|
||||
sc->origx = sc->origy = 0;
|
||||
sc->sc_x = sc->sc_y = 0;
|
||||
}
|
||||
|
||||
selwakeup(&sc->sc_rsel);
|
||||
if (sc->sc_state & PMS_ASLP) {
|
||||
sc->sc_state &= ~PMS_ASLP;
|
||||
wakeup((caddr_t)sc);
|
||||
}
|
||||
/* if (dosignal)*/
|
||||
psignal(sc->sc_proc, SIGIO);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return(1); /* Claim interrupt */
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
pmspoll(dev, events, p)
|
||||
dev_t dev;
|
||||
int events;
|
||||
struct proc *p;
|
||||
{
|
||||
struct pms_softc *sc = opms_cd.cd_devs[PMSUNIT(dev)];
|
||||
int revents = 0;
|
||||
int s = spltty();
|
||||
|
||||
if (events & (POLLIN | POLLRDNORM)) {
|
||||
if (sc->sc_q.c_cc > 0)
|
||||
revents |= events & (POLLIN | POLLRDNORM);
|
||||
else
|
||||
selrecord(p, &sc->sc_rsel);
|
||||
}
|
||||
|
||||
(void)splx(s);
|
||||
return (revents);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pmswatchdog(arg)
|
||||
void *arg;
|
||||
{
|
||||
struct pms_softc *sc = arg;
|
||||
int s;
|
||||
|
||||
if ((bus_space_read_1(sc->sc_iot, sc->sc_ioh, PMS_STATUS) & 0x03)
|
||||
!= 0x03) {
|
||||
printf("%s: Mouse is dead (%x), restart it\n",
|
||||
sc->sc_dev.dv_xname, bus_space_read_1(sc->sc_iot,
|
||||
sc->sc_ioh, PMS_STATUS));
|
||||
s = spltty();
|
||||
pmsinit(sc);
|
||||
(void)splx(s);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOUSE_IOC_ACK
|
||||
static void
|
||||
pmsputbuffer(sc, buffer)
|
||||
struct pms_softc *sc;
|
||||
struct mousebufrec *buffer;
|
||||
{
|
||||
int s;
|
||||
int dosignal = 0;
|
||||
|
||||
/* Time stamp the buffer */
|
||||
microtime(&buffer->event_time);
|
||||
|
||||
if (sc->sc_q.c_cc == 0)
|
||||
dosignal = 1;
|
||||
|
||||
s=spltty();
|
||||
(void)b_to_q((char *)buffer, sizeof(*buffer), &sc->sc_q);
|
||||
(void)splx(s);
|
||||
selwakeup(&sc->sc_rsel);
|
||||
|
||||
if (sc->sc_state & PMS_ASLP) {
|
||||
sc->sc_state &= ~PMS_ASLP;
|
||||
wakeup((caddr_t)sc);
|
||||
}
|
||||
|
||||
if (dosignal)
|
||||
psignal(sc->sc_proc, SIGIO);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* End of pms.c */
|
|
@ -1,78 +0,0 @@
|
|||
/* $NetBSD: pmsvar.h,v 1.2 2000/03/23 06:35:14 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe.
|
||||
* Copyright (c) 1997 Causality Limited
|
||||
* 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 Mark Brinicombe
|
||||
* 4. The name of the company nor the name of the author may 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 OR CONTRIBUTORS 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.
|
||||
*
|
||||
* RiscBSD kernel project
|
||||
*
|
||||
* pmsvar.h
|
||||
*
|
||||
* Created : 02/02/97
|
||||
*/
|
||||
|
||||
/*
|
||||
* softc structure for the pms device
|
||||
*/
|
||||
|
||||
#include <sys/callout.h>
|
||||
|
||||
struct pms_softc {
|
||||
struct device sc_dev; /* device node */
|
||||
void *sc_ih; /* interrupt pointer */
|
||||
bus_space_tag_t sc_iot; /* bus tag */
|
||||
bus_space_handle_t sc_ioh; /* bus handle */
|
||||
int sc_irqnum; /* interrupt number */
|
||||
|
||||
struct callout sc_watchdog_ch;
|
||||
|
||||
void (*sc_intenable) __P((struct pms_softc *, int));
|
||||
|
||||
struct proc *sc_proc;
|
||||
struct clist sc_q;
|
||||
struct selinfo sc_rsel;
|
||||
u_int sc_state; /* mouse driver state */
|
||||
#define PMS_OPEN 0x01 /* device is open */
|
||||
#define PMS_ASLP 0x02 /* waiting for mouse data */
|
||||
int sc_mode; /* device mode */
|
||||
u_int sc_status; /* mouse button status */
|
||||
int sc_x, sc_y; /* accumulated motion in the X,Y axis */
|
||||
int boundx, boundy, bounda, boundb; /* Bounding box. x,y is bottom left */
|
||||
int origx, origy;
|
||||
int lastx, lasty, lastb;
|
||||
};
|
||||
|
||||
/* function prototypes used by attach routines */
|
||||
|
||||
int pmsintr __P((void *));
|
||||
int pmsinit __P((struct pms_softc *));
|
||||
|
||||
/* End of pmsvar.h */
|
|
@ -1,470 +0,0 @@
|
|||
/* $NetBSD: qms.c,v 1.22 1999/06/01 09:34:06 mark Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) Scott Stevens 1995 All rights reserved
|
||||
* Copyright (c) Melvin Tang-Richardson 1995 All rights reserved
|
||||
* Copyright (c) Mark Brinicombe 1995 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 for the NetBSD Project.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Quadrature mouse driver
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/errno.h>
|
||||
#include <dev/cons.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/poll.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/conf.h>
|
||||
#include <machine/mouse.h>
|
||||
#include <arm32/dev/qmsvar.h>
|
||||
|
||||
#define MOUSE_IOC_ACK
|
||||
|
||||
#define QMOUSE_BSIZE 12*64
|
||||
|
||||
#ifdef MOUSE_IOC_ACK
|
||||
static void qmsputbuffer __P((struct qms_softc *sc, struct mousebufrec *buf));
|
||||
#endif
|
||||
|
||||
extern struct cfdriver qms_cd;
|
||||
|
||||
/* qms device structure */
|
||||
|
||||
/* Offsets of hardware registers */
|
||||
#define QMS_MOUSEX 0 /* 16 bit X register */
|
||||
#define QMS_MOUSEY 1 /* 16 bit Y register */
|
||||
|
||||
#define QMS_BUTTONS 0 /* mouse buttons register */
|
||||
|
||||
/*
|
||||
* generic attach routine. This does the generic part of the driver
|
||||
* attachment and is called from the bus specific attach routine.
|
||||
*/
|
||||
|
||||
void
|
||||
qmsattach(sc)
|
||||
struct qms_softc *sc;
|
||||
{
|
||||
/* Set up origin and multipliers */
|
||||
sc->origx = 0;
|
||||
sc->origy = 0;
|
||||
sc->xmult = 2;
|
||||
sc->ymult = 2;
|
||||
|
||||
/* Set up bounding box */
|
||||
sc->boundx = -4095;
|
||||
sc->boundy = -4095;
|
||||
sc->bounda = 4096;
|
||||
sc->boundb = 4096;
|
||||
|
||||
sc->sc_state = 0;
|
||||
|
||||
/* Set the mouse X & Y registers to a known state */
|
||||
bus_space_write_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEX, sc->origx);
|
||||
bus_space_write_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEX, sc->origx);
|
||||
}
|
||||
|
||||
int
|
||||
qmsopen(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag;
|
||||
int mode;
|
||||
struct proc *p;
|
||||
{
|
||||
struct qms_softc *sc;
|
||||
int unit = minor(dev);
|
||||
|
||||
/* validate the unit and softc */
|
||||
if (unit >= qms_cd.cd_ndevs)
|
||||
return(ENXIO);
|
||||
|
||||
sc = qms_cd.cd_devs[unit];
|
||||
|
||||
if (!sc) return(ENXIO);
|
||||
|
||||
/* check if we are already open */
|
||||
if (sc->sc_state & QMOUSE_OPEN) return(EBUSY);
|
||||
|
||||
/* update softc */
|
||||
sc->sc_proc = p;
|
||||
|
||||
sc->lastx = -1;
|
||||
sc->lasty = -1;
|
||||
sc->lastb = -1;
|
||||
|
||||
/* initialise buffer */
|
||||
if (clalloc(&sc->sc_buffer, QMOUSE_BSIZE, 0) == -1)
|
||||
return(ENOMEM);
|
||||
|
||||
/* set mode and state */
|
||||
sc->sc_mode = MOUSEMODE_ABS;
|
||||
sc->sc_state |= QMOUSE_OPEN;
|
||||
|
||||
/* enable interrupts */
|
||||
sc->sc_intenable(sc, 1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qmsclose(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag;
|
||||
int mode;
|
||||
struct proc *p;
|
||||
{
|
||||
int unit = minor(dev);
|
||||
struct qms_softc *sc = qms_cd.cd_devs[unit];
|
||||
|
||||
/* disable interrupts */
|
||||
sc->sc_intenable(sc, 0);
|
||||
|
||||
/* clean up */
|
||||
sc->sc_proc = NULL;
|
||||
sc->sc_state = 0;
|
||||
|
||||
clfree(&sc->sc_buffer);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
qmsread(dev, uio, flag)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int flag;
|
||||
{
|
||||
int unit = minor(dev);
|
||||
struct qms_softc *sc = qms_cd.cd_devs[unit];
|
||||
int error;
|
||||
int s;
|
||||
int length;
|
||||
u_char buffer[128];
|
||||
|
||||
error = 0;
|
||||
s = spltty();
|
||||
while (sc->sc_buffer.c_cc == 0) {
|
||||
if (flag & IO_NDELAY) {
|
||||
(void)splx(s);
|
||||
return(EWOULDBLOCK);
|
||||
}
|
||||
sc->sc_state |= QMOUSE_ASLEEP;
|
||||
if ((error = tsleep((caddr_t)sc, PZERO | PCATCH, "qmsread", 0))) {
|
||||
sc->sc_state &= ~QMOUSE_ASLEEP;
|
||||
(void)splx(s);
|
||||
return(error);
|
||||
}
|
||||
}
|
||||
|
||||
while (sc->sc_buffer.c_cc > 0 && uio->uio_resid > 0) {
|
||||
length = min(sc->sc_buffer.c_cc, uio->uio_resid);
|
||||
if(length>sizeof(buffer))
|
||||
length=sizeof(buffer);
|
||||
|
||||
(void)q_to_b(&sc->sc_buffer, buffer, length);
|
||||
|
||||
if ((error = (uiomove(buffer, length, uio))))
|
||||
break;
|
||||
}
|
||||
(void)splx(s);
|
||||
return(error);
|
||||
}
|
||||
|
||||
|
||||
#define FMT_START \
|
||||
int x = bus_space_read_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEX) & 0xffff; \
|
||||
int y = bus_space_read_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEY) & 0xffff; \
|
||||
int b = bus_space_read_1(sc->sc_iot, sc->sc_butioh, QMS_BUTTONS) & 0x70;\
|
||||
if (x & 0x8000) x |= 0xffff0000; \
|
||||
if (y & 0x8000) y |= 0xffff0000; \
|
||||
x = (x - sc->origx); \
|
||||
y = (y - sc->origy); \
|
||||
if (x < (sc->boundx)) x = sc->boundx; \
|
||||
if (x > (sc->bounda)) x = sc->bounda; \
|
||||
bus_space_write_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEX, x + sc->origx); \
|
||||
if (y < (sc->boundy)) y = sc->boundy; \
|
||||
if (y > (sc->boundb)) y = sc->boundb; \
|
||||
bus_space_write_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEY, y + sc->origy); \
|
||||
x = x * sc->xmult; \
|
||||
y = y * sc->ymult;
|
||||
|
||||
#define FMT_END
|
||||
|
||||
|
||||
int
|
||||
qmsioctl(dev, cmd, data, flag, p)
|
||||
dev_t dev;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
struct qms_softc *sc = qms_cd.cd_devs[minor(dev)];
|
||||
|
||||
switch (cmd) {
|
||||
case MOUSEIOC_WRITEX:
|
||||
bus_space_write_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEX,
|
||||
*(int *)data + sc->origx);
|
||||
return 0;
|
||||
case MOUSEIOC_WRITEY:
|
||||
bus_space_write_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEY,
|
||||
*(int *)data + sc->origy);
|
||||
return 0;
|
||||
case MOUSEIOC_SETSTATE:
|
||||
{
|
||||
struct mouse_state *co = (void *)data;
|
||||
bus_space_write_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEX, co->x);
|
||||
bus_space_write_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEY, co->y);
|
||||
return 0;
|
||||
}
|
||||
case MOUSEIOC_SETBOUNDS:
|
||||
{
|
||||
struct mouse_boundingbox *bo = (void *)data;
|
||||
struct mousebufrec buffer;
|
||||
#ifdef MOUSE_IOC_ACK
|
||||
int s;
|
||||
|
||||
s = spltty();
|
||||
#endif
|
||||
|
||||
sc->boundx = bo->x;
|
||||
sc->boundy = bo->y;
|
||||
sc->bounda = bo->a;
|
||||
sc->boundb = bo->b;
|
||||
|
||||
buffer.status = IOC_ACK;
|
||||
buffer.x = sc->origx;
|
||||
buffer.y = sc->origy;
|
||||
#ifdef MOUSE_IOC_ACK
|
||||
if (sc->sc_buffer.c_cc > 0)
|
||||
printf("%s: setting bounding with non empty buffer (%d)\n",
|
||||
sc->sc_device.dv_xname, sc->sc_buffer.c_cc);
|
||||
qmsputbuffer(sc, &buffer);
|
||||
(void)splx(s);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
case MOUSEIOC_SETMODE:
|
||||
{
|
||||
struct mousebufrec buffer;
|
||||
#ifdef MOUSE_IOC_ACK
|
||||
int s;
|
||||
|
||||
s = spltty();
|
||||
#endif
|
||||
sc->sc_mode = *(int *)data;
|
||||
|
||||
buffer.status = IOC_ACK;
|
||||
buffer.x = sc->origx;
|
||||
buffer.y = sc->origy;
|
||||
#ifdef MOUSE_IOC_ACK
|
||||
if (sc->sc_buffer.c_cc > 0)
|
||||
printf("%s: setting mode with non empty buffer (%d)\n",
|
||||
sc->sc_device.dv_xname, sc->sc_buffer.c_cc);
|
||||
qmsputbuffer(sc, &buffer);
|
||||
(void)splx(s);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
case MOUSEIOC_SETORIGIN:
|
||||
{
|
||||
struct mouse_origin *oo = (void *)data;
|
||||
struct mousebufrec buffer;
|
||||
#ifdef MOUSE_IOC_ACK
|
||||
int s;
|
||||
|
||||
s = spltty();
|
||||
#endif
|
||||
/* Need to fix up! */
|
||||
sc->origx = oo->x;
|
||||
sc->origy = oo->y;
|
||||
|
||||
buffer.status = IOC_ACK;
|
||||
buffer.x = sc->origx;
|
||||
buffer.y = sc->origy;
|
||||
#ifdef MOUSE_IOC_ACK
|
||||
if (sc->sc_buffer.c_cc > 0)
|
||||
printf("%s: setting origin with non empty buffer (%d)\n",
|
||||
sc->sc_device.dv_xname, sc->sc_buffer.c_cc);
|
||||
qmsputbuffer(sc, &buffer);
|
||||
(void)splx(s);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
case MOUSEIOC_GETSTATE:
|
||||
{
|
||||
struct mouse_state *co = (void *)data;
|
||||
FMT_START
|
||||
co->x = x;
|
||||
co->y = y;
|
||||
co->buttons = b ^ 0x70;
|
||||
FMT_END
|
||||
return 0;
|
||||
}
|
||||
case MOUSEIOC_GETBOUNDS:
|
||||
{
|
||||
struct mouse_boundingbox *bo = (void *)data;
|
||||
bo->x = sc->boundx;
|
||||
bo->y = sc->boundy;
|
||||
bo->a = sc->bounda;
|
||||
bo->b = sc->boundb;
|
||||
return 0;
|
||||
}
|
||||
case MOUSEIOC_GETORIGIN:
|
||||
{
|
||||
struct mouse_origin *oo = (void *)data;
|
||||
oo->x = sc->origx;
|
||||
oo->y = sc->origy;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qmsintr(arg)
|
||||
void *arg;
|
||||
{
|
||||
struct qms_softc *sc = arg;
|
||||
int s;
|
||||
struct mousebufrec buffer;
|
||||
int dosignal=0;
|
||||
|
||||
FMT_START
|
||||
|
||||
b &= 0x70;
|
||||
b >>= 4;
|
||||
if (x != sc->lastx || y != sc->lasty || b != sc->lastb) {
|
||||
/* Mouse state changed */
|
||||
buffer.status = b | ( b ^ sc->lastb) << 3 | (((x==sc->lastx) && (y==sc->lasty))?0:MOVEMENT);
|
||||
if(sc->sc_mode == MOUSEMODE_REL) {
|
||||
sc->origx = sc->origy = 0;
|
||||
bus_space_write_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEX, sc->origx);
|
||||
bus_space_write_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEY, sc->origy);
|
||||
}
|
||||
buffer.x = x;
|
||||
buffer.y = y;
|
||||
microtime(&buffer.event_time);
|
||||
|
||||
if (sc->sc_buffer.c_cc == 0)
|
||||
dosignal = 1;
|
||||
|
||||
s = spltty();
|
||||
(void)b_to_q((char *)&buffer, sizeof(buffer), &sc->sc_buffer);
|
||||
(void)splx(s);
|
||||
selwakeup(&sc->sc_rsel);
|
||||
|
||||
if (sc->sc_state & QMOUSE_ASLEEP) {
|
||||
sc->sc_state &= ~QMOUSE_ASLEEP;
|
||||
wakeup((caddr_t)sc);
|
||||
}
|
||||
|
||||
/* if (dosignal)*/
|
||||
psignal(sc->sc_proc, SIGIO);
|
||||
|
||||
sc->lastx = x;
|
||||
sc->lasty = y;
|
||||
sc->lastb = b;
|
||||
}
|
||||
|
||||
FMT_END
|
||||
return(0); /* Pass interrupt on down the chain */
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qmspoll(dev, events, p)
|
||||
dev_t dev;
|
||||
int events;
|
||||
struct proc *p;
|
||||
{
|
||||
struct qms_softc *sc = qms_cd.cd_devs[minor(dev)];
|
||||
int revents = 0;
|
||||
int s = spltty();
|
||||
|
||||
if (events & (POLLIN | POLLRDNORM)) {
|
||||
if (sc->sc_buffer.c_cc > 0)
|
||||
revents |= events & (POLLIN | POLLRDNORM);
|
||||
else
|
||||
selrecord(p, &sc->sc_rsel);
|
||||
}
|
||||
|
||||
(void)splx(s);
|
||||
return (revents);
|
||||
}
|
||||
|
||||
|
||||
#ifdef MOUSE_IOC_ACK
|
||||
static void
|
||||
qmsputbuffer(sc, buffer)
|
||||
struct qms_softc *sc;
|
||||
struct mousebufrec *buffer;
|
||||
{
|
||||
int s;
|
||||
int dosignal = 0;
|
||||
|
||||
/* Time stamp the buffer */
|
||||
microtime(&buffer->event_time);
|
||||
|
||||
if (sc->sc_buffer.c_cc == 0)
|
||||
dosignal=1;
|
||||
|
||||
s = spltty();
|
||||
(void)b_to_q((char *)buffer, sizeof(*buffer), &sc->sc_buffer);
|
||||
(void)splx(s);
|
||||
selwakeup(&sc->sc_rsel);
|
||||
|
||||
if (sc->sc_state & QMOUSE_ASLEEP) {
|
||||
sc->sc_state &= ~QMOUSE_ASLEEP;
|
||||
wakeup((caddr_t)sc);
|
||||
}
|
||||
|
||||
if (dosignal)
|
||||
psignal(sc->sc_proc, SIGIO);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* End of qms.c */
|
|
@ -1,74 +0,0 @@
|
|||
/* $NetBSD: qmsvar.h,v 1.1 1997/10/14 19:35:37 mark Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe.
|
||||
* Copyright (c) 1997 Causality Limited
|
||||
* 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 Mark Brinicombe
|
||||
* 4. The name of the company nor the name of the author may 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 OR CONTRIBUTORS 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.
|
||||
*
|
||||
* RiscBSD kernel project
|
||||
*
|
||||
* qmsvar.h
|
||||
*
|
||||
* Created : 02/02/97
|
||||
*/
|
||||
|
||||
/*
|
||||
* softc structure for the qms device
|
||||
*/
|
||||
|
||||
struct qms_softc {
|
||||
struct device sc_device; /* device node */
|
||||
void *sc_ih; /* interrupt pointer */
|
||||
bus_space_tag_t sc_iot; /* bus tag */
|
||||
bus_space_handle_t sc_ioh; /* bus handle */
|
||||
bus_space_handle_t sc_butioh; /* bus handle */
|
||||
int sc_irqnum; /* interrupt number */
|
||||
|
||||
void (*sc_intenable) __P((struct qms_softc *, int));
|
||||
|
||||
struct selinfo sc_rsel;
|
||||
#define QMOUSE_OPEN 0x01
|
||||
#define QMOUSE_ASLEEP 0x02
|
||||
int sc_state; /* device state */
|
||||
int sc_mode; /* device mode */
|
||||
int boundx, boundy, bounda, boundb; /* Bounding box. x,y is bottom left */
|
||||
int origx, origy;
|
||||
int xmult, ymult; /* Multipliers */
|
||||
int lastx, lasty, lastb;
|
||||
struct proc *sc_proc;
|
||||
struct clist sc_buffer;
|
||||
};
|
||||
|
||||
/* function prototypes used by attach routines */
|
||||
|
||||
int qmsintr __P((void *arg));
|
||||
void qmsattach __P((struct qms_softc *sc));
|
||||
|
||||
/* End of qmsvar.h */
|
|
@ -1,651 +0,0 @@
|
|||
/* $NetBSD: rpckbd.c,v 1.5 2001/06/12 15:17:17 wiz Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Reinoud Zandijk
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* rpckbd.c
|
||||
*
|
||||
* Keyboard driver functions
|
||||
* Loosly based on the origional `pckbd.c' by Charles M. Hannum.
|
||||
*
|
||||
* Created : 04/03/01
|
||||
*/
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_pmap_debug.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/conf.h>
|
||||
|
||||
#include "opt_pckbd_layout.h"
|
||||
#include "opt_wsdisplay_compat.h"
|
||||
|
||||
#include <dev/wscons/wsconsio.h>
|
||||
#include <dev/wscons/wskbdvar.h>
|
||||
#include <dev/wscons/wsksymdef.h>
|
||||
#include <dev/wscons/wsksymvar.h>
|
||||
|
||||
#include <arm32/dev/rpckbdvar.h>
|
||||
#include <arm32/dev/wskbdmap_mfii.h>
|
||||
#include <dev/cons.h>
|
||||
|
||||
#include "beep.h"
|
||||
|
||||
/* Keyboard commands */
|
||||
|
||||
#define KBC_RESET 0xFF /* reset the keyboard */
|
||||
#define KBC_RESEND 0xFE /* request the keyboard resend the last byte */
|
||||
#define KBC_SET_TMB 0xFA /* What is this one ? */
|
||||
#define KBC_SETDEFAULT 0xF6 /* resets keyboard to its power-on defaults */
|
||||
#define KBC_DISABLE 0xF5 /* as per KBC_SETDEFAULT, but also disable key scanning */
|
||||
#define KBC_ENABLE 0xF4 /* enable key scanning */
|
||||
#define KBC_TYPEMATIC 0xF3 /* set typematic rate and delay */
|
||||
#define KBD_READID 0xF2 /* Read keyboard ID */
|
||||
#define KBC_SETSCANTBL 0xF0 /* set scancode translation table */
|
||||
#define KBC_SETLEDS 0xED /* set mode indicators (i.e. LEDs) */
|
||||
#define KBC_ECHO 0xEE /* request an echo from the keyboard */
|
||||
|
||||
#define KBD_SETSCAN_2 0x02
|
||||
#define KBD_SETSCAN_3 0x03
|
||||
|
||||
/* keyboard responses */
|
||||
#define KBR_EXTENDED0 0xE0 /* extended key sequence */
|
||||
#define KBR_EXTENDED1 0xE1 /* extended key sequence */
|
||||
#define KBR_RESEND 0xFE /* needs resend of command */
|
||||
#define KBR_ACK 0xFA /* received a valid command */
|
||||
#define KBR_OVERRUN 0x00 /* flooded */
|
||||
#define KBR_FAILURE 0xFD /* diagnosic failure */
|
||||
#define KBR_BREAK 0xF0 /* break code prefix - sent on key release */
|
||||
#define KBR_RSTDONE 0xAA /* reset complete */
|
||||
#define KBR_ECHO 0xEE /* echo response */
|
||||
|
||||
#define KBD_DATA 0
|
||||
#define KBD_CR 1
|
||||
#define KBD_STATUS 1
|
||||
|
||||
#define KBD_CR_ENABLE 0x08
|
||||
#define KBD_CR_KDATAO 0x02
|
||||
#define KBD_CR_KCLKO 0x01
|
||||
|
||||
#define KBD_ST_TXE 0x80
|
||||
#define KBD_ST_TXB 0x40
|
||||
#define KBD_ST_RXF 0x20
|
||||
#define KBD_ST_RXB 0x10
|
||||
#define KBD_ST_ENABLE 0x08
|
||||
#define KBD_ST_RXPARITY 0x04
|
||||
#define KBD_ST_KDATAI 0x02
|
||||
#define KBD_ST_KCLKI 0x01
|
||||
|
||||
/* Flags used to decode the raw keys */
|
||||
|
||||
#define FLAG_KEYUP 0x01
|
||||
#define FLAG_E0 0x02
|
||||
#define FLAG_E1 0x04
|
||||
#define FLAG_BREAKPRELUDE 0x08
|
||||
|
||||
|
||||
/* Declaration of datatypes and their associated function pointers */
|
||||
int rpckbd_enable __P((void *, int));
|
||||
void rpckbd_set_leds __P((void *, int));
|
||||
int rpckbd_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
|
||||
int sysbeep __P((int, int));
|
||||
|
||||
|
||||
const struct wskbd_accessops rpckbd_accessops = {
|
||||
rpckbd_enable,
|
||||
rpckbd_set_leds,
|
||||
rpckbd_ioctl,
|
||||
};
|
||||
|
||||
|
||||
void rpckbd_cngetc __P((void *, u_int *, int *));
|
||||
void rpckbd_cnpollc __P((void *, int));
|
||||
void rpckbd_cnbell __P((void *, u_int, u_int, u_int));
|
||||
|
||||
const struct wskbd_consops rpckbd_consops = {
|
||||
rpckbd_cngetc,
|
||||
rpckbd_cnpollc,
|
||||
rpckbd_cnbell,
|
||||
};
|
||||
|
||||
|
||||
const struct wskbd_mapdata rpckbd_keymapdata = {
|
||||
rpckbd_keydesctab,
|
||||
KB_UK,
|
||||
};
|
||||
|
||||
|
||||
/* Forward declaration of functions */
|
||||
static int kbdcmd __P((struct rpckbd_softc *sc, u_char cmd, int eat_ack));
|
||||
static void kbd_flush_input __P((struct rpckbd_softc *sc));
|
||||
static int rpckbd_decode __P((struct rpckbd_softc *id, int datain, u_int *type, int *dataout));
|
||||
static int rpckbd_led_encode __P((int));
|
||||
static int rpckbd_led_decode __P((int));
|
||||
static void rpckbd_bell __P((int, int, int));
|
||||
|
||||
|
||||
struct rpckbd_softc console_kbd;
|
||||
|
||||
|
||||
/* modelled after the origional pckbd device code */
|
||||
int
|
||||
rpckbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
{
|
||||
struct rpckbd_softc *sc = (struct rpckbd_softc *)v;
|
||||
int res, new_ledstate;
|
||||
|
||||
switch (cmd) {
|
||||
case WSKBDIO_GTYPE:
|
||||
*(int *)data = WSKBD_TYPE_RISCPC;
|
||||
return 0;
|
||||
case WSKBDIO_SETLEDS: {
|
||||
/* same as rpckbd_set_leds */
|
||||
|
||||
/* check if we're allready in this state */
|
||||
new_ledstate = rpckbd_led_encode(*(int *)data);
|
||||
if (new_ledstate == sc->sc_ledstate)
|
||||
return (0);
|
||||
|
||||
sc->sc_ledstate = new_ledstate;
|
||||
res = kbdcmd(sc, KBC_SETLEDS, 0);
|
||||
res = kbdcmd(sc, sc->sc_ledstate, 0);
|
||||
if (res == KBR_ACK)
|
||||
return (0);
|
||||
return (res);
|
||||
}
|
||||
case WSKBDIO_GETLEDS:
|
||||
*(int *)data = rpckbd_led_decode(sc->sc_ledstate);
|
||||
return (0);
|
||||
case WSKBDIO_COMPLEXBELL:
|
||||
#define d ((struct wskbd_bell_data *)data)
|
||||
/*
|
||||
* Keyboard can't beep directly; we have an
|
||||
* externally-provided global hook to do this.
|
||||
*/
|
||||
rpckbd_bell(d->pitch, d->period, d->volume);
|
||||
#undef d
|
||||
return (0);
|
||||
#ifdef WSDISPLAY_COMPAT_RAWKBD
|
||||
case WSKBDIO_SETMODE:
|
||||
sc->rawkbd = (*(int *)data == WSKBD_RAW);
|
||||
return (0);
|
||||
#endif
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* modelled after the origional pckbd device code */
|
||||
int
|
||||
rpckbd_enable(void *v, int on)
|
||||
{
|
||||
struct rpckbd_softc *sc = v;
|
||||
int res;
|
||||
|
||||
if (on) {
|
||||
if (sc->sc_enabled)
|
||||
return (EBUSY);
|
||||
res = kbdcmd(sc, KBC_ENABLE, 0);
|
||||
if (res != KBR_ACK) {
|
||||
printf("rpckbd_enable: command error; got response %d\n", res);
|
||||
return (res);
|
||||
};
|
||||
sc->sc_enabled = 1;
|
||||
} else {
|
||||
if (sc->t_isconsole)
|
||||
return (EBUSY);
|
||||
res = kbdcmd(sc, KBC_DISABLE, 0);
|
||||
if (res != KBR_ACK) {
|
||||
printf("rpckbd_disable: command error; got response %d\n", res);
|
||||
return (res);
|
||||
};
|
||||
sc->sc_enabled = 0;
|
||||
};
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* kbdreset()
|
||||
* Modelled after kbd.c
|
||||
*
|
||||
* Resets the keyboard.
|
||||
* Returns 0 if successful.
|
||||
* Returns 1 if keyboard could not be enabled.
|
||||
* Returns 2 if keyboard could not be reset.
|
||||
*/
|
||||
int
|
||||
rpckbd_reset(struct rpckbd_softc *sc)
|
||||
{
|
||||
int i;
|
||||
u_char c;
|
||||
|
||||
/* flush garbage */
|
||||
kbd_flush_input(sc);
|
||||
|
||||
/* reset the keyboard ; more elaborate than the pcwskbd ! */
|
||||
|
||||
/* Disable, wait then enable the keyboard interface */
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, KBD_CR, 0x00);
|
||||
delay(100);
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, KBD_CR, KBD_CR_ENABLE);
|
||||
|
||||
/* Wait for kdata and kclk to go go high */
|
||||
for (i = 1000; i; i--) {
|
||||
if ((bus_space_read_1(sc->sc_iot, sc->sc_ioh, KBD_STATUS)
|
||||
& (KBD_ST_KDATAI | KBD_ST_KCLKI))
|
||||
== (KBD_ST_KDATAI | KBD_ST_KCLKI))
|
||||
break;
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, KBD_CR,
|
||||
(KBD_CR_KDATAO | KBD_CR_KCLKO));
|
||||
delay(200);
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, KBD_CR, KBD_CR_ENABLE);
|
||||
};
|
||||
if (i == 0 || (bus_space_read_1(sc->sc_iot, sc->sc_ioh, KBD_STATUS)
|
||||
& KBD_ST_ENABLE) == 0)
|
||||
return(1);
|
||||
|
||||
kbd_flush_input(sc);
|
||||
kbdcmd(sc, KBC_DISABLE, 0);
|
||||
|
||||
retry:
|
||||
kbdcmd(sc, KBC_RESET, 1);
|
||||
delay(500000);
|
||||
for (i = 100; i; i--) {
|
||||
c = bus_space_read_1(sc->sc_iot, sc->sc_ioh, KBD_DATA);
|
||||
if (c == KBR_RSTDONE)
|
||||
break;
|
||||
delay(100000);
|
||||
if (c == KBR_RESEND) {
|
||||
printf(" [retry]");
|
||||
goto retry;
|
||||
}
|
||||
};
|
||||
if (i == 0)
|
||||
return(2);
|
||||
|
||||
kbdcmd(sc, KBC_SETSCANTBL, 0);
|
||||
kbdcmd(sc, KBD_SETSCAN_2, 0);
|
||||
kbdcmd(sc, KBC_ENABLE, 0);
|
||||
|
||||
return (0);
|
||||
|
||||
#if 0
|
||||
res = kbdcmd(sc, KBC_RESET, 1);
|
||||
if (res != KBR_RSTDONE) {
|
||||
printf(" : reset error, got 0x%02x ", res);
|
||||
return 1;
|
||||
};
|
||||
return 0; /* flag success */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rpckbd_set_leds(void *context, int leds)
|
||||
{
|
||||
struct rpckbd_softc *sc = (struct rpckbd_softc *) context;
|
||||
int res, new_ledstate;
|
||||
|
||||
|
||||
/* check if we're allready in this state */
|
||||
new_ledstate = rpckbd_led_encode(leds);
|
||||
if (new_ledstate == sc->sc_ledstate)
|
||||
return;
|
||||
|
||||
/* set state */
|
||||
sc->sc_ledstate = new_ledstate;;
|
||||
kbdcmd(sc, KBC_SETLEDS, 0);
|
||||
res = kbdcmd(sc, sc->sc_ledstate, 0);
|
||||
|
||||
/* could fail .... */
|
||||
if (res != KBR_ACK) printf("kbd_set_leds: kbderr %d", res);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rpckbd_intr(void *context)
|
||||
{
|
||||
struct rpckbd_softc *sc = (struct rpckbd_softc *) context;
|
||||
int data, key, type;
|
||||
|
||||
/* read the key code */
|
||||
data = bus_space_read_1(sc->sc_iot, sc->sc_ioh, KBD_DATA);
|
||||
|
||||
if (data == 0) return (1);
|
||||
|
||||
#ifdef WSDISPLAY_COMPAT_RAWKBD
|
||||
if (sc->rawkbd) {
|
||||
wskbd_rawinput(sc->sc_wskbddev, (u_char *) &data, 1);
|
||||
return (1); /* claim interrupt */
|
||||
}
|
||||
#endif
|
||||
if (rpckbd_decode(sc, data, &type, &key))
|
||||
wskbd_input(sc->sc_wskbddev, type, key);
|
||||
|
||||
return (1); /* claim interrupt */
|
||||
}
|
||||
|
||||
|
||||
/* should really be renamed to attach using the normal attachment stuff */
|
||||
int
|
||||
rpckbd_init(struct device *self, int isconsole, vaddr_t data_port, vaddr_t cmd_port)
|
||||
{
|
||||
struct rpckbd_softc *sc = (struct rpckbd_softc *) self;
|
||||
struct wskbddev_attach_args a;
|
||||
int return_code;
|
||||
|
||||
/* init keyboard */
|
||||
sc->data_port = data_port;
|
||||
sc->cmd_port = cmd_port;
|
||||
|
||||
/* init attachment stuff */
|
||||
sc->sc_enabled = 1;
|
||||
|
||||
/* reset keyboard */
|
||||
return_code = rpckbd_reset(sc);
|
||||
|
||||
printf("\n");
|
||||
|
||||
/* attach to wskbd */
|
||||
|
||||
a.console= isconsole;
|
||||
a.keymap = &rpckbd_keymapdata;
|
||||
a.accessops = &rpckbd_accessops;
|
||||
a.accesscookie = sc;
|
||||
|
||||
sc->sc_wskbddev = config_found(self, &a, wskbddevprint);
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rpckbd_cnattach(struct device *self)
|
||||
{
|
||||
struct rpckbd_softc *sc = (struct rpckbd_softc *) self;
|
||||
|
||||
/* attach to wskbd ; the 2nd. arg. is a information pointer passed on to us */
|
||||
wskbd_cnattach(&rpckbd_consops, sc, &rpckbd_keymapdata);
|
||||
|
||||
return (0); /* flag success */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rpckbd_cngetc(void *v, u_int *type, int *data)
|
||||
{
|
||||
struct rpckbd_softc *sc = v;
|
||||
int val;
|
||||
|
||||
for (;;) {
|
||||
/* wait for a receive event */
|
||||
while ((bus_space_read_1(console_kbd.sc_iot, console_kbd.sc_ioh, KBD_STATUS) & KBD_ST_RXF) == 0) ;
|
||||
delay(10);
|
||||
|
||||
val = bus_space_read_1(console_kbd.sc_iot, console_kbd.sc_ioh, KBD_DATA);
|
||||
if (rpckbd_decode(sc, val, type, data))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rpckbd_cnpollc(void *v, int on)
|
||||
{
|
||||
/* switched on/off polling ... what to do ? */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rpckbd_cnbell(void *v, u_int pitch, u_int period, u_int volume)
|
||||
{
|
||||
/* dunno yet */
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
rpckbd_bell(int pitch, int period, int volume)
|
||||
{
|
||||
/* dunno yet */
|
||||
#if NBEEP>0
|
||||
sysbeep(pitch, period);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/* Code derived from the standard pckbd_decode driver */
|
||||
static int
|
||||
rpckbd_decode(struct rpckbd_softc *id, int datain, u_int *type, int *dataout)
|
||||
{
|
||||
int key;
|
||||
|
||||
#if 0
|
||||
printf(" +%02x", datain);
|
||||
#endif
|
||||
|
||||
/* mark keyup flag */
|
||||
if (datain == 0xf0) {
|
||||
id->t_flags |= FLAG_KEYUP;
|
||||
return (0);
|
||||
};
|
||||
|
||||
/* special code -> ignore */
|
||||
if ((datain == 0xff) || (datain == 0x00)) {
|
||||
id->t_flags = 0;
|
||||
return (0);
|
||||
};
|
||||
|
||||
/* just note resend ... */
|
||||
if (datain == KBR_RESEND) {
|
||||
/* printf("rpckbd:resend\n"); */
|
||||
id->t_resend = 1;
|
||||
return (0);
|
||||
};
|
||||
|
||||
/* just note ack code */
|
||||
if (datain == KBR_ACK) {
|
||||
/* printf("rpckbd:ack\n"); */
|
||||
id->t_ack = 1;
|
||||
return (0);
|
||||
};
|
||||
|
||||
if (datain == KBR_EXTENDED0) {
|
||||
id->t_flags |= FLAG_E0;
|
||||
return(0);
|
||||
} else if (datain == KBR_EXTENDED1) {
|
||||
id->t_flags |= FLAG_E1;
|
||||
return(0);
|
||||
}
|
||||
|
||||
key = datain;
|
||||
|
||||
/* map extended keys to (unused) codes 256 and higher */
|
||||
if (id->t_flags & FLAG_E0) {
|
||||
id->t_flags &= ~FLAG_E0;
|
||||
if (datain == 0x12) {
|
||||
id->t_flags &= ~FLAG_KEYUP;
|
||||
return (0);
|
||||
};
|
||||
key |= 0x100;
|
||||
};
|
||||
|
||||
/*
|
||||
* process BREAK key (EXT1 0x14 0x77):
|
||||
* map to (unused) code 7F
|
||||
*/
|
||||
if ((id->t_flags & FLAG_E1) && (datain == 0x14)) {
|
||||
id->t_flags |= FLAG_BREAKPRELUDE;
|
||||
return(0);
|
||||
} else if ((id->t_flags & FLAG_BREAKPRELUDE) &&
|
||||
(datain == 0x77)) {
|
||||
id->t_flags &= ~(FLAG_E1 | FLAG_BREAKPRELUDE);
|
||||
key = 0x7f;
|
||||
} else if (id->t_flags & FLAG_E1) {
|
||||
id->t_flags &= ~FLAG_E1;
|
||||
}
|
||||
|
||||
|
||||
if (id->t_flags & FLAG_KEYUP) {
|
||||
id->t_flags &= ~FLAG_KEYUP;
|
||||
id->t_lastchar = 0;
|
||||
*type = WSCONS_EVENT_KEY_UP;
|
||||
#if 0
|
||||
printf(" [%d, UP]", key);
|
||||
#endif
|
||||
} else {
|
||||
/* Always ignore typematic keys */
|
||||
if (key == id->t_lastchar)
|
||||
return(0);
|
||||
id->t_lastchar = key;
|
||||
*type = WSCONS_EVENT_KEY_DOWN;
|
||||
#if 0
|
||||
printf(" [%d, DOWN]", key);
|
||||
#endif
|
||||
}
|
||||
*dataout = key;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* return wscons keyboard leds code for this kbd led byte */
|
||||
static int
|
||||
rpckbd_led_decode(int code)
|
||||
{
|
||||
int scroll, num, caps;
|
||||
|
||||
scroll = (code & 1) ? 1:0;
|
||||
num = (code & 2) ? 1:0;
|
||||
caps = (code & 4) ? 1:0;
|
||||
|
||||
return (scroll*WSKBD_LED_SCROLL) | (num*WSKBD_LED_NUM) | (caps*WSKBD_LED_CAPS);
|
||||
};
|
||||
|
||||
|
||||
/* return kbd led byte for this wscons keyboard leds code */
|
||||
static int
|
||||
rpckbd_led_encode(int code)
|
||||
{
|
||||
int scroll, num, caps;
|
||||
|
||||
scroll = (code & WSKBD_LED_SCROLL) ? 1:0;
|
||||
num = (code & WSKBD_LED_NUM) ? 1:0;
|
||||
caps = (code & WSKBD_LED_CAPS) ? 1:0;
|
||||
/* cant do compose :( */
|
||||
|
||||
return (caps<<2) | (num<<1) | (scroll<<0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
kbd_flush_input(struct rpckbd_softc *sc)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Loop round reading bytes while the receive buffer is not empty */
|
||||
|
||||
for (i = 0; i < 20; i++) {
|
||||
if ((bus_space_read_1(sc->sc_iot, sc->sc_ioh, KBD_STATUS) & KBD_ST_RXF) == 0)
|
||||
break;
|
||||
delay(100);
|
||||
(void)bus_space_read_1(sc->sc_iot, sc->sc_ioh, KBD_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* XXX fix me ... what to return */
|
||||
static int
|
||||
kbdcmd(struct rpckbd_softc *sc, u_char cmd, int eat_acks)
|
||||
{
|
||||
u_char c;
|
||||
int i = 0;
|
||||
int retry;
|
||||
|
||||
for (retry = 7; retry >= 0; --retry) {
|
||||
|
||||
/* Wait for empty kbd transmit register */
|
||||
|
||||
for (i = 1000; i; i--) {
|
||||
if (bus_space_read_1(sc->sc_iot, sc->sc_ioh, KBD_STATUS) & KBD_ST_TXE)
|
||||
break;
|
||||
delay(200);
|
||||
}
|
||||
if (i == 0)
|
||||
printf("%s: transmit not ready\n", sc->sc_device.dv_xname);
|
||||
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, KBD_DATA, cmd);
|
||||
|
||||
do {
|
||||
delay(200);
|
||||
/* Wait for full kbd receive register */
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
c = bus_space_read_1(sc->sc_iot, sc->sc_ioh, KBD_STATUS);
|
||||
if ((c & KBD_ST_RXF) == KBD_ST_RXF)
|
||||
break;
|
||||
delay(100);
|
||||
}
|
||||
|
||||
delay(100);
|
||||
|
||||
/* Get byte from kbd receive register */
|
||||
c = bus_space_read_1(sc->sc_iot, sc->sc_ioh, KBD_DATA);
|
||||
if ((c == KBR_ECHO) || (c == KBR_RSTDONE))
|
||||
return (c);
|
||||
} while ((c==KBR_ACK) && eat_acks);
|
||||
if (c == KBR_ACK)
|
||||
return (c);
|
||||
|
||||
/* Failed if we have more reties to go flush kbd */
|
||||
|
||||
if (retry) {
|
||||
kbd_flush_input(sc);
|
||||
printf(" [retry] ");
|
||||
};
|
||||
}
|
||||
printf("%s: command failed, cmd = %02x, status = %02x\n", sc->sc_device.dv_xname, cmd, c);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* end of rpckbd.c */
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/* $NetBSD: rpckbdvar.h,v 1.2 2001/05/03 23:05:48 reinoud Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Reinoud Zandijk
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* rpckbdvar.h
|
||||
*
|
||||
* Created : 04/03/01
|
||||
*/
|
||||
|
||||
/*
|
||||
* softc structure for the rpckbd device
|
||||
*/
|
||||
|
||||
struct rpckbd_softc {
|
||||
struct device sc_device; /* device node */
|
||||
void *sc_ih; /* interrupt pointer */
|
||||
|
||||
bus_space_tag_t sc_iot; /* bus tag */
|
||||
bus_space_handle_t sc_ioh; /* bus handle */
|
||||
|
||||
vaddr_t data_port;
|
||||
vaddr_t cmd_port;
|
||||
|
||||
int t_lastchar;
|
||||
int t_flags;
|
||||
int t_resend;
|
||||
int t_ack;
|
||||
|
||||
int t_isconsole;
|
||||
|
||||
int sc_enabled;
|
||||
int sc_ledstate;
|
||||
|
||||
struct device *sc_wskbddev;
|
||||
|
||||
int rawkbd;
|
||||
};
|
||||
|
||||
|
||||
/* function prototypes used by attach routines */
|
||||
|
||||
extern int rpckbd_reset __P((struct rpckbd_softc *sc));
|
||||
extern int rpckbd_intr __P((void *arg));
|
||||
extern int rpckbd_init __P((struct device *self, int isconsole, vaddr_t, vaddr_t));
|
||||
extern int rpckbd_cnattach __P((struct device *self));
|
||||
|
||||
/* End of rpckbdvar.h */
|
||||
|
|
@ -1,494 +0,0 @@
|
|||
/* $NetBSD: rtc.c,v 1.11 2000/11/01 12:28:50 abs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994-1996 Mark Brinicombe.
|
||||
* Copyright (c) 1994 Brini.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software written for Brini by Mark Brinicombe
|
||||
*
|
||||
* 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 Brini.
|
||||
* 4. The name of the company nor the name of the author may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI OR CONTRIBUTORS 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.
|
||||
*
|
||||
* RiscBSD kernel project
|
||||
*
|
||||
* rtc.c
|
||||
*
|
||||
* Routines to read and write the RTC and CMOS RAM
|
||||
*
|
||||
* Created : 13/10/94
|
||||
* Updated : 15/07/2000 DD
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/device.h>
|
||||
#include <machine/rtc.h>
|
||||
#include <arm32/dev/iic.h>
|
||||
#include <arm32/dev/todclockvar.h>
|
||||
|
||||
struct rtc_softc {
|
||||
struct device sc_dev;
|
||||
int sc_flags;
|
||||
#define RTC_BROKEN 1
|
||||
#define RTC_OPEN 2
|
||||
};
|
||||
|
||||
void rtcattach __P((struct device *parent, struct device *self, void *aux));
|
||||
int rtcmatch __P((struct device *parent, struct cfdata *cf, void *aux));
|
||||
int rtc_read __P((void *, rtc_t *));
|
||||
int rtc_write __P((void *, rtc_t *));
|
||||
|
||||
/* Read a byte from CMOS RAM */
|
||||
|
||||
int
|
||||
cmos_read(location)
|
||||
int location;
|
||||
{
|
||||
u_char buff;
|
||||
|
||||
/*
|
||||
* This commented code dates from when I was translating CMOS address
|
||||
* from the RISCOS addresses. Now all addresses are specifed as
|
||||
* actual addresses in the CMOS RAM
|
||||
*/
|
||||
|
||||
/*
|
||||
if (location > 0xF0)
|
||||
return(-1);
|
||||
|
||||
if (location < 0xC0)
|
||||
buff = location + 0x40;
|
||||
else
|
||||
buff = location - 0xB0;
|
||||
*/
|
||||
buff = location;
|
||||
|
||||
if (iic_control(RTC_Write, &buff, 1))
|
||||
return(-1);
|
||||
if (iic_control(RTC_Read, &buff, 1))
|
||||
return(-1);
|
||||
|
||||
return(buff);
|
||||
}
|
||||
|
||||
|
||||
/* Write a byte to CMOS RAM */
|
||||
|
||||
int
|
||||
cmos_write(location, value)
|
||||
int location;
|
||||
int value;
|
||||
{
|
||||
u_char buff[2];
|
||||
int oldvalue, oldsum;
|
||||
|
||||
/*
|
||||
* This commented code dates from when I was translating CMOS address
|
||||
* from the RISCOS addresses. Now all addresses are specifed as
|
||||
* actual addresses in the CMOS RAM
|
||||
*/
|
||||
|
||||
/* if (location > 0xF0)
|
||||
return(-1);
|
||||
|
||||
if (location < 0xC0)
|
||||
buff = location + 0x40;
|
||||
else
|
||||
buff = location - 0xB0;
|
||||
*/
|
||||
buff[0] = location;
|
||||
buff[1] = value;
|
||||
|
||||
/* Read the old CMOS location value and old checksum */
|
||||
oldvalue = cmos_read(location);
|
||||
if (oldvalue<0)
|
||||
return(-1);
|
||||
oldsum = cmos_read(RTC_ADDR_CHECKSUM);
|
||||
if (oldsum<0)
|
||||
return(-1);
|
||||
|
||||
if (iic_control(RTC_Write, buff, 2))
|
||||
return(-1);
|
||||
|
||||
/* Now update the checksum. This code only modifies the value. It does */
|
||||
/* not recalculate it */
|
||||
|
||||
buff[0] = RTC_ADDR_CHECKSUM;
|
||||
buff[1] = oldsum - oldvalue + value;
|
||||
if (iic_control(RTC_Write, buff, 2))
|
||||
return(-1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/* Hex to BCD and BCD to hex conversion routines */
|
||||
|
||||
static __inline int
|
||||
hexdectodec(n)
|
||||
u_char n;
|
||||
{
|
||||
return(((n >> 4) & 0x0F) * 10 + (n & 0x0F));
|
||||
}
|
||||
|
||||
static __inline int
|
||||
dectohexdec(n)
|
||||
u_char n;
|
||||
{
|
||||
return(((n / 10) << 4) + (n % 10));
|
||||
}
|
||||
|
||||
|
||||
/* Write the RTC data from an 8 byte buffer */
|
||||
|
||||
int
|
||||
rtc_write(arg, rtc)
|
||||
void *arg;
|
||||
rtc_t *rtc;
|
||||
{
|
||||
u_char buff[8];
|
||||
|
||||
buff[0] = 1;
|
||||
|
||||
/* buff[1] = dectohexdec(rtc->rtc_centi);
|
||||
buff[2] = dectohexdec(rtc->rtc_sec);
|
||||
buff[3] = dectohexdec(rtc->rtc_min);
|
||||
buff[4] = dectohexdec(rtc->rtc_hour) & 0x3f;
|
||||
buff[5] = dectohexdec(rtc->rtc_day);
|
||||
buff[6] = dectohexdec(rtc->rtc_mon);
|
||||
|
||||
if (iic_control(RTC_Write, buff, 7))
|
||||
return(0);
|
||||
|
||||
if (cmos_write(RTC_ADDR_YEAR, rtc->rtc_year))
|
||||
return(0);
|
||||
if (cmos_write(RTC_ADDR_CENT, rtc->rtc_cen))
|
||||
return(0);
|
||||
*/
|
||||
printf("rtc_write: Currently disabled\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* Read the RTC data into a 8 byte buffer */
|
||||
|
||||
int
|
||||
rtc_read(arg, rtc)
|
||||
void *arg;
|
||||
rtc_t *rtc;
|
||||
{
|
||||
u_char buff[8];
|
||||
int byte;
|
||||
|
||||
buff[0] = 0;
|
||||
|
||||
if (iic_control(RTC_Write, buff, 1))
|
||||
return(0);
|
||||
|
||||
if (iic_control(RTC_Read, buff, 8))
|
||||
return(0);
|
||||
|
||||
rtc->rtc_micro = 0;
|
||||
rtc->rtc_centi = hexdectodec(buff[1] & 0xff);
|
||||
rtc->rtc_sec = hexdectodec(buff[2] & 0x7f);
|
||||
rtc->rtc_min = hexdectodec(buff[3] & 0x7f);
|
||||
rtc->rtc_hour = hexdectodec(buff[4] & 0x3f);
|
||||
|
||||
/* If in 12 hour mode need to look at the AM/PM flag */
|
||||
|
||||
if (buff[4] & 0x80)
|
||||
rtc->rtc_hour += (buff[4] & 0x40) ? 12 : 0;
|
||||
|
||||
rtc->rtc_day = hexdectodec(buff[5] & 0x3f);
|
||||
rtc->rtc_mon = hexdectodec(buff[6] & 0x1f);
|
||||
|
||||
byte = cmos_read(RTC_ADDR_YEAR);
|
||||
if (byte == -1)
|
||||
return(0);
|
||||
rtc->rtc_year = byte;
|
||||
|
||||
byte = cmos_read(RTC_ADDR_CENT);
|
||||
if (byte == -1)
|
||||
return(0);
|
||||
rtc->rtc_cen = byte;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* device and attach structures */
|
||||
|
||||
struct cfattach rtc_ca = {
|
||||
sizeof(struct rtc_softc), rtcmatch, rtcattach
|
||||
};
|
||||
|
||||
extern struct cfdriver rtc_cd;
|
||||
|
||||
/*
|
||||
* rtcmatch()
|
||||
*
|
||||
* Validate the IIC address to make sure its an RTC we understand
|
||||
*/
|
||||
|
||||
int
|
||||
rtcmatch(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct iicbus_attach_args *ib = aux;
|
||||
|
||||
if ((ib->ib_addr & IIC_PCF8583_MASK) == IIC_PCF8583_ADDR)
|
||||
return(1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* rtcattach()
|
||||
*
|
||||
* Attach the rtc device
|
||||
*/
|
||||
|
||||
void
|
||||
rtcattach(parent, self, aux)
|
||||
struct device *parent;
|
||||
struct device *self;
|
||||
void *aux;
|
||||
{
|
||||
struct rtc_softc *sc = (struct rtc_softc *)self;
|
||||
struct iicbus_attach_args *ib = aux;
|
||||
u_char buff[1];
|
||||
struct todclock_attach_args ta;
|
||||
|
||||
sc->sc_flags |= RTC_BROKEN;
|
||||
if ((ib->ib_addr & IIC_PCF8583_MASK) == IIC_PCF8583_ADDR) {
|
||||
printf(": PCF8583");
|
||||
|
||||
/* Read RTC register 0 and report info found */
|
||||
|
||||
buff[0] = 0;
|
||||
|
||||
if (iic_control(RTC_Write, buff, 1))
|
||||
return;
|
||||
|
||||
if (iic_control(RTC_Read, buff, 1))
|
||||
return;
|
||||
|
||||
printf(" clock base ");
|
||||
switch (buff[0] & 0x30) {
|
||||
case 0x00:
|
||||
printf("32.768KHz");
|
||||
break;
|
||||
case 0x10:
|
||||
printf("50Hz");
|
||||
break;
|
||||
case 0x20:
|
||||
printf("event");
|
||||
break;
|
||||
case 0x30:
|
||||
printf("test mode");
|
||||
break;
|
||||
}
|
||||
|
||||
if (buff[0] & 0x80)
|
||||
printf(" stopped");
|
||||
if (buff[0] & 0x04)
|
||||
printf(" alarm enabled");
|
||||
sc->sc_flags &= ~RTC_BROKEN;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
ta.ta_name = "todclock";
|
||||
ta.ta_rtc_arg = NULL;
|
||||
ta.ta_rtc_write = rtc_write;
|
||||
ta.ta_rtc_read = rtc_read;
|
||||
ta.ta_flags = 0;
|
||||
config_found(self, &ta, NULL);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rtcopen(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag;
|
||||
int mode;
|
||||
struct proc *p;
|
||||
{
|
||||
struct rtc_softc *sc;
|
||||
int unit = minor(dev);
|
||||
|
||||
if (unit >= rtc_cd.cd_ndevs)
|
||||
return(ENXIO);
|
||||
|
||||
sc = rtc_cd.cd_devs[unit];
|
||||
|
||||
if (!sc) return(ENXIO);
|
||||
|
||||
if (sc->sc_flags & RTC_BROKEN) return(ENXIO);
|
||||
if (sc->sc_flags & RTC_OPEN) return(EBUSY);
|
||||
|
||||
sc->sc_flags |= RTC_OPEN;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rtcclose(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag;
|
||||
int mode;
|
||||
struct proc *p;
|
||||
{
|
||||
int unit = minor(dev);
|
||||
struct rtc_softc *sc = rtc_cd.cd_devs[unit];
|
||||
|
||||
sc->sc_flags &= ~RTC_OPEN;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rtcread(dev, uio, flag)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int flag;
|
||||
{
|
||||
rtc_t rtc;
|
||||
int s;
|
||||
char buffer[32];
|
||||
int length;
|
||||
|
||||
s = splclock();
|
||||
if (rtc_read(NULL, &rtc) == 0) {
|
||||
(void)splx(s);
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
(void)splx(s);
|
||||
|
||||
sprintf(buffer, "%02d:%02d:%02d.%02d%02d %02d/%02d/%02d%02d\n",
|
||||
rtc.rtc_hour, rtc.rtc_min, rtc.rtc_sec, rtc.rtc_centi,
|
||||
rtc.rtc_micro, rtc.rtc_day, rtc.rtc_mon, rtc.rtc_cen,
|
||||
rtc.rtc_year);
|
||||
|
||||
if (uio->uio_offset > strlen(buffer))
|
||||
return 0;
|
||||
|
||||
length = strlen(buffer) - uio->uio_offset;
|
||||
if (length > uio->uio_resid)
|
||||
length = uio->uio_resid;
|
||||
|
||||
return(uiomove((caddr_t)buffer, length, uio));
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
twodigits(buffer, pos)
|
||||
char *buffer;
|
||||
int pos;
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
if (buffer[pos] >= '0' && buffer[pos] <= '9')
|
||||
result = (buffer[pos] - '0') * 10;
|
||||
if (buffer[pos+1] >= '0' && buffer[pos+1] <= '9')
|
||||
result += (buffer[pos+1] - '0');
|
||||
return(result);
|
||||
}
|
||||
|
||||
int
|
||||
rtcwrite(dev, uio, flag)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int flag;
|
||||
{
|
||||
rtc_t rtc;
|
||||
int s;
|
||||
char buffer[25];
|
||||
int length;
|
||||
int error;
|
||||
|
||||
/*
|
||||
* We require atomic updates!
|
||||
*/
|
||||
length = uio->uio_resid;
|
||||
if (uio->uio_offset || (length != sizeof(buffer)
|
||||
&& length != sizeof(buffer - 1)))
|
||||
return(EINVAL);
|
||||
|
||||
if ((error = uiomove((caddr_t)buffer, sizeof(buffer), uio)))
|
||||
return(error);
|
||||
|
||||
if (length == sizeof(buffer) && buffer[sizeof(buffer) - 1] != '\n')
|
||||
return(EINVAL);
|
||||
|
||||
printf("rtcwrite: %s\n", buffer);
|
||||
|
||||
rtc.rtc_micro = 0;
|
||||
rtc.rtc_centi = twodigits(buffer, 9);
|
||||
rtc.rtc_sec = twodigits(buffer, 6);
|
||||
rtc.rtc_min = twodigits(buffer, 3);
|
||||
rtc.rtc_hour = twodigits(buffer, 0);
|
||||
rtc.rtc_day = twodigits(buffer, 14);
|
||||
rtc.rtc_mon = twodigits(buffer, 17);
|
||||
rtc.rtc_year = twodigits(buffer, 22);
|
||||
rtc.rtc_cen = twodigits(buffer, 20);
|
||||
|
||||
s = splclock();
|
||||
rtc_write(NULL, &rtc);
|
||||
(void)splx(s);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rtcioctl(dev, cmd, data, flag, p)
|
||||
dev_t dev;
|
||||
int cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
/* struct rtc_softc *sc = rtc_cd.cd_devs[minor(dev)];*/
|
||||
|
||||
/* switch (cmd) {
|
||||
case RTCIOC_READ:
|
||||
return(0);
|
||||
}*/
|
||||
|
||||
return(EINVAL);
|
||||
}
|
||||
|
||||
/* End of rtc.c */
|
|
@ -1,347 +0,0 @@
|
|||
/* $NetBSD: todclock.c,v 1.10 2002/01/05 22:41:48 chris Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994-1997 Mark Brinicombe.
|
||||
* Copyright (c) 1994 Brini.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software written for Brini by Mark Brinicombe
|
||||
*
|
||||
* 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 Mark Brinicombe.
|
||||
* 4. The name of the company nor the name of the author may 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 OR CONTRIBUTORS 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.
|
||||
*
|
||||
* RiscBSD kernel project
|
||||
*
|
||||
* clock.c
|
||||
*
|
||||
* Timer related machine specific code
|
||||
*
|
||||
* Created : 29/09/94
|
||||
*/
|
||||
|
||||
/* Include header files */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/rtc.h>
|
||||
#include <arm32/dev/todclockvar.h>
|
||||
|
||||
#include "todclock.h"
|
||||
|
||||
#if NTODCLOCK > 1
|
||||
#error "Can only had 1 todclock device"
|
||||
#endif
|
||||
|
||||
static int yeartoday __P((int));
|
||||
|
||||
/*
|
||||
* softc structure for the todclock device
|
||||
*/
|
||||
|
||||
struct todclock_softc {
|
||||
struct device sc_dev; /* device node */
|
||||
void *sc_rtc_arg; /* arg to read/write */
|
||||
int (*sc_rtc_write) __P((void *, rtc_t *)); /* rtc write function */
|
||||
int (*sc_rtc_read) __P((void *, rtc_t *)); /* rtc read function */
|
||||
};
|
||||
|
||||
/* prototypes for functions */
|
||||
|
||||
static void todclockattach __P((struct device *parent, struct device *self,
|
||||
void *aux));
|
||||
static int todclockmatch __P((struct device *parent, struct cfdata *cf,
|
||||
void *aux));
|
||||
|
||||
/*
|
||||
* We need to remember our softc for functions like inittodr()
|
||||
* and resettodr()
|
||||
* since we only ever have one time-of-day device we can just store
|
||||
* the direct pointer to softc.
|
||||
*/
|
||||
|
||||
static struct todclock_softc *todclock_sc = NULL;
|
||||
|
||||
/* driver and attach structures */
|
||||
|
||||
struct cfattach todclock_ca = {
|
||||
sizeof(struct todclock_softc), todclockmatch, todclockattach
|
||||
};
|
||||
|
||||
/*
|
||||
* int todclockmatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
*
|
||||
* todclock device probe function.
|
||||
* just validate the attach args
|
||||
*/
|
||||
|
||||
int
|
||||
todclockmatch(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct todclock_attach_args *ta = aux;
|
||||
|
||||
if (todclock_sc != NULL)
|
||||
return(0);
|
||||
if (strcmp(ta->ta_name, "todclock") != 0)
|
||||
return(0);
|
||||
|
||||
if (ta->ta_flags & TODCLOCK_FLAG_FAKE)
|
||||
return(1);
|
||||
return(2);
|
||||
}
|
||||
|
||||
/*
|
||||
* void todclockattach(struct device *parent, struct device *self, void *aux)
|
||||
*
|
||||
* todclock device attach function.
|
||||
* Initialise the softc structure and do a search for children
|
||||
*/
|
||||
|
||||
void
|
||||
todclockattach(parent, self, aux)
|
||||
struct device *parent;
|
||||
struct device *self;
|
||||
void *aux;
|
||||
{
|
||||
struct todclock_softc *sc = (void *)self;
|
||||
struct todclock_attach_args *ta = aux;
|
||||
|
||||
/* set up our softc */
|
||||
todclock_sc = sc;
|
||||
todclock_sc->sc_rtc_arg = ta->ta_rtc_arg;
|
||||
todclock_sc->sc_rtc_write = ta->ta_rtc_write;
|
||||
todclock_sc->sc_rtc_read = ta->ta_rtc_read;
|
||||
|
||||
printf("\n");
|
||||
|
||||
/*
|
||||
* Initialise the time of day register.
|
||||
* This is normally left to the filing system to do but not all
|
||||
* filing systems call it e.g. cd9660
|
||||
*/
|
||||
|
||||
inittodr(0);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
yeartoday(year)
|
||||
int year;
|
||||
{
|
||||
return((year % 4) ? 365 : 366);
|
||||
}
|
||||
|
||||
|
||||
static int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||
static int timeset = 0;
|
||||
|
||||
#define SECPERDAY (24*60*60)
|
||||
#define SECPERNYEAR (365*SECPERDAY)
|
||||
#define SECPER4YEARS (4*SECPERNYEAR+SECPERDAY)
|
||||
#define EPOCHYEAR 1970
|
||||
|
||||
/*
|
||||
* Globally visable functions
|
||||
*
|
||||
* These functions are used from other parts of the kernel.
|
||||
* These functions use the functions defined in the tod_sc
|
||||
* to actually read and write the rtc.
|
||||
*
|
||||
* The first todclock to be attached will be used for handling
|
||||
* the time of day.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Write back the time of day to the rtc
|
||||
*/
|
||||
|
||||
void
|
||||
resettodr()
|
||||
{
|
||||
int s;
|
||||
time_t year, mon, day, hour, min, sec;
|
||||
rtc_t rtc;
|
||||
|
||||
/* Have we set the system time in inittodr() */
|
||||
if (!timeset)
|
||||
return;
|
||||
|
||||
/* We need a todclock device and should always have one */
|
||||
if (!todclock_sc)
|
||||
#ifdef NC
|
||||
return;
|
||||
#else
|
||||
panic("resettodr: No todclock device attached\n");
|
||||
#endif /* NC */
|
||||
|
||||
/* Abort early if there is not actually an RTC write routine */
|
||||
if (todclock_sc->sc_rtc_write == NULL)
|
||||
return;
|
||||
|
||||
sec = time.tv_sec;
|
||||
sec -= rtc_offset * 60;
|
||||
year = (sec / SECPER4YEARS) * 4;
|
||||
sec %= SECPER4YEARS;
|
||||
|
||||
/* year now hold the number of years rounded down 4 */
|
||||
|
||||
while (sec > (yeartoday(EPOCHYEAR+year) * SECPERDAY)) {
|
||||
sec -= yeartoday(EPOCHYEAR+year)*SECPERDAY;
|
||||
year++;
|
||||
}
|
||||
|
||||
/* year is now a correct offset from the EPOCHYEAR */
|
||||
|
||||
year+=EPOCHYEAR;
|
||||
mon=0;
|
||||
if (yeartoday(year) == 366)
|
||||
month[1]=29;
|
||||
else
|
||||
month[1]=28;
|
||||
while (sec >= month[mon]*SECPERDAY) {
|
||||
sec -= month[mon]*SECPERDAY;
|
||||
mon++;
|
||||
}
|
||||
|
||||
day = sec / SECPERDAY;
|
||||
sec %= SECPERDAY;
|
||||
hour = sec / 3600;
|
||||
sec %= 3600;
|
||||
min = sec / 60;
|
||||
sec %= 60;
|
||||
rtc.rtc_cen = year / 100;
|
||||
rtc.rtc_year = year % 100;
|
||||
rtc.rtc_mon = mon+1;
|
||||
rtc.rtc_day = day+1;
|
||||
rtc.rtc_hour = hour;
|
||||
rtc.rtc_min = min;
|
||||
rtc.rtc_sec = sec;
|
||||
rtc.rtc_centi =
|
||||
rtc.rtc_micro = 0;
|
||||
|
||||
printf("resettod: %02d/%02d/%02d%02d %02d:%02d:%02d\n", rtc.rtc_day,
|
||||
rtc.rtc_mon, rtc.rtc_cen, rtc.rtc_year, rtc.rtc_hour,
|
||||
rtc.rtc_min, rtc.rtc_sec);
|
||||
|
||||
s = splclock();
|
||||
todclock_sc->sc_rtc_write(todclock_sc->sc_rtc_arg, &rtc);
|
||||
(void)splx(s);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialise the time of day register, based on the time base which is, e.g.
|
||||
* from a filesystem.
|
||||
*/
|
||||
|
||||
void
|
||||
inittodr(base)
|
||||
time_t base;
|
||||
{
|
||||
time_t n;
|
||||
int i, days = 0;
|
||||
int s;
|
||||
int year;
|
||||
rtc_t rtc;
|
||||
|
||||
/*
|
||||
* Default to the suggested time but replace that we one from an
|
||||
* RTC is we can.
|
||||
*/
|
||||
|
||||
/* We expect a todclock device */
|
||||
#ifndef NC
|
||||
if (!todclock_sc)
|
||||
panic("inittodr: No todclock device attached\n");
|
||||
#endif /* NC */
|
||||
|
||||
/* Use the suggested time as a fall back */
|
||||
time.tv_sec = base;
|
||||
time.tv_usec = 0;
|
||||
|
||||
/* Can we read an RTC ? */
|
||||
if (todclock_sc->sc_rtc_read) {
|
||||
s = splclock();
|
||||
if (todclock_sc->sc_rtc_read(todclock_sc->sc_rtc_arg, &rtc) == 0) {
|
||||
(void)splx(s);
|
||||
return;
|
||||
}
|
||||
(void)splx(s);
|
||||
} else
|
||||
return;
|
||||
|
||||
/* Convert the rtc time into seconds */
|
||||
|
||||
n = rtc.rtc_sec + 60 * rtc.rtc_min + 3600 * rtc.rtc_hour;
|
||||
n += (rtc.rtc_day - 1) * 3600 * 24;
|
||||
year = (rtc.rtc_year + rtc.rtc_cen * 100) - 1900;
|
||||
|
||||
if (yeartoday(year) == 366)
|
||||
month[1] = 29;
|
||||
for (i = rtc.rtc_mon - 2; i >= 0; i--)
|
||||
days += month[i];
|
||||
month[1] = 28;
|
||||
|
||||
for (i = 70; i < year; i++)
|
||||
days += yeartoday(i);
|
||||
|
||||
n += days * 3600 * 24;
|
||||
|
||||
n += rtc_offset * 60;
|
||||
|
||||
time.tv_sec = n;
|
||||
time.tv_usec = 0;
|
||||
|
||||
/* timeset is used to ensure the time is valid before a resettodr() */
|
||||
|
||||
timeset = 1;
|
||||
|
||||
/* If the base was 0 then keep quiet */
|
||||
|
||||
if (base) {
|
||||
printf("inittodr: %02d:%02d:%02d.%02d%02d %02d/%02d/%02d%02d\n",
|
||||
rtc.rtc_hour, rtc.rtc_min, rtc.rtc_sec, rtc.rtc_centi,
|
||||
rtc.rtc_micro, rtc.rtc_day, rtc.rtc_mon, rtc.rtc_cen,
|
||||
rtc.rtc_year);
|
||||
|
||||
if (n > base + 60) {
|
||||
days = (n - base) / SECPERDAY;
|
||||
printf("Clock has gained %d day%c %ld hours %ld minutes %ld secs\n",
|
||||
days, ((days == 1) ? 0 : 's'),
|
||||
(long)((n - base) / 3600) % 24,
|
||||
(long)((n - base) / 60) % 60,
|
||||
(long) (n - base) % 60);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* End of todclock.c */
|
|
@ -1,55 +0,0 @@
|
|||
/* $NetBSD: todclockvar.h,v 1.3 1998/04/19 03:51:44 mark Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe.
|
||||
* Copyright (c) 1997 Causality Limited
|
||||
* 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 Mark Brinicombe
|
||||
* 4. The name of the company nor the name of the author may 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 OR CONTRIBUTORS 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.
|
||||
*
|
||||
* todclockvar.h
|
||||
*
|
||||
* structures and variables for the todclock device
|
||||
*
|
||||
* Created : 12/02/97
|
||||
*/
|
||||
|
||||
/*
|
||||
* Attach args for todclock device
|
||||
*/
|
||||
|
||||
struct todclock_attach_args {
|
||||
const char *ta_name; /* device name */
|
||||
void *ta_rtc_arg; /* arg to read/write */
|
||||
int (*ta_rtc_write) __P((void *, rtc_t *)); /* function to write rtc */
|
||||
int (*ta_rtc_read) __P((void *, rtc_t *)); /* function to read rtc */
|
||||
int ta_flags; /* flags */
|
||||
#define TODCLOCK_FLAG_FAKE 0x01 /* tod service is faked */
|
||||
};
|
||||
|
||||
/* End of todclockvar.h */
|
|
@ -1,553 +0,0 @@
|
|||
/* $NetBSD: wskbdmap_mfii.c,v 1.1 2001/03/20 18:20:54 reinoud Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Reinoud Zandijk
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*
|
||||
* Created the RiscPC keyboard table on base of the XT table origionaly
|
||||
* created by Juergen Hannken-Illjes.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <dev/wscons/wsksymdef.h>
|
||||
#include <dev/wscons/wsksymvar.h>
|
||||
#include <arm32/dev/wskbdmap_mfii.h>
|
||||
|
||||
#define KC(n) KS_KEYCODE(n)
|
||||
|
||||
static const keysym_t rpckbd_keydesc_uk[] = {
|
||||
/* pos command normal shifted altgr shift-altgr */
|
||||
KC(118), KS_Cmd_Debugger, KS_Escape,
|
||||
|
||||
KC(22), KS_1, KS_exclam, KS_plusminus, KS_exclamdown,
|
||||
KC(30), KS_2, KS_quotedbl, KS_twosuperior, KS_cent,
|
||||
KC(38), KS_3, KS_sterling, KS_threesuperior,
|
||||
KC(37), KS_4, KS_dollar, KS_acute, KS_currency,
|
||||
KC(46), KS_5, KS_percent, KS_mu, KS_yen,
|
||||
KC(54), KS_6, KS_asciicircum, KS_paragraph,
|
||||
KC(61), KS_7, KS_ampersand, KS_periodcentered,
|
||||
KC(62), KS_8, KS_asterisk, KS_cedilla, KS_ordfeminine,
|
||||
KC(70), KS_9, KS_parenleft, KS_onesuperior, KS_diaeresis,
|
||||
KC(69), KS_0, KS_parenright, KS_masculine, KS_copyright,
|
||||
KC(78), KS_minus, KS_underscore, KS_hyphen, KS_ssharp,
|
||||
KC(85), KS_equal, KS_plus, KS_onehalf, KS_guillemotleft,
|
||||
KC(14), KS_grave, KS_notsign, KS_brokenbar,
|
||||
KC(102), KS_Cmd_ResetEmul, KS_Delete,
|
||||
KC(13), KS_Tab,
|
||||
KC(21), KS_q,
|
||||
KC(29), KS_w,
|
||||
KC(36), KS_e,
|
||||
KC(45), KS_r,
|
||||
KC(44), KS_t,
|
||||
KC(53), KS_y,
|
||||
KC(60), KS_u,
|
||||
KC(67), KS_i,
|
||||
KC(68), KS_o,
|
||||
KC(77), KS_p,
|
||||
KC(84), KS_bracketleft, KS_braceleft,
|
||||
KC(91), KS_bracketright, KS_braceright,
|
||||
KC(90), KS_Return,
|
||||
KC(20), KS_Cmd1, KS_Control_L,
|
||||
KC(28), KS_a,
|
||||
KC(27), KS_s,
|
||||
KC(35), KS_d,
|
||||
KC(43), KS_f,
|
||||
KC(52), KS_g,
|
||||
KC(51), KS_h,
|
||||
KC(59), KS_j,
|
||||
KC(66), KS_k,
|
||||
KC(75), KS_l,
|
||||
KC(76), KS_semicolon, KS_colon,
|
||||
KC(82), KS_apostrophe, KS_at, KS_section, KS_Agrave,
|
||||
KC(93), KS_numbersign, KS_asciitilde, KS_sterling, KS_thorn,
|
||||
KC(18), KS_Shift_L,
|
||||
KC(97), KS_backslash, KS_bar,
|
||||
KC(26), KS_z,
|
||||
KC(34), KS_x,
|
||||
KC(33), KS_c,
|
||||
KC(42), KS_v,
|
||||
KC(50), KS_b,
|
||||
KC(49), KS_n,
|
||||
KC(58), KS_m,
|
||||
KC(65), KS_comma, KS_less,
|
||||
KC(73), KS_period, KS_greater,
|
||||
KC(74), KS_slash, KS_question,
|
||||
KC(89), KS_Shift_R,
|
||||
KC(124), KS_KP_Multiply,
|
||||
KC(17), KS_Cmd2, KS_Alt_L, KS_Meta_L,
|
||||
KC(41), KS_space,
|
||||
KC(88), KS_Caps_Lock,
|
||||
KC(5), KS_Cmd_Screen0, KS_f1,
|
||||
KC(6), KS_Cmd_Screen1, KS_f2,
|
||||
KC(4), KS_Cmd_Screen2, KS_f3,
|
||||
KC(12), KS_Cmd_Screen3, KS_f4,
|
||||
KC(3), KS_Cmd_Screen4, KS_f5,
|
||||
KC(11), KS_Cmd_Screen5, KS_f6,
|
||||
KC(131), KS_Cmd_Screen6, KS_f7,
|
||||
KC(10), KS_Cmd_Screen7, KS_f8,
|
||||
KC(1), KS_Cmd_Screen8, KS_f9,
|
||||
KC(9), KS_Cmd_Screen9, KS_f10,
|
||||
KC(119), KS_Num_Lock,
|
||||
KC(126), KS_Hold_Screen,
|
||||
KC(108), KS_KP_Home, KS_KP_7,
|
||||
KC(117), KS_KP_Up, KS_KP_8,
|
||||
KC(125), KS_KP_Prior, KS_KP_9,
|
||||
KC(123), KS_KP_Subtract,
|
||||
KC(107), KS_KP_Left, KS_KP_4,
|
||||
KC(115), KS_KP_Begin, KS_KP_5,
|
||||
KC(116), KS_KP_Right, KS_KP_6,
|
||||
KC(121), KS_KP_Add,
|
||||
KC(105), KS_KP_End, KS_KP_1,
|
||||
KC(114), KS_KP_Down, KS_KP_2,
|
||||
KC(122), KS_KP_Next, KS_KP_3,
|
||||
KC(112), KS_KP_Insert, KS_KP_0,
|
||||
KC(113), KS_KP_Delete, KS_KP_Decimal,
|
||||
KC(120), KS_f11,
|
||||
KC(7), KS_f12,
|
||||
KC(127), KS_Pause, /* Break */ /* XXX fixme XXX */
|
||||
KC(346), KS_KP_Enter,
|
||||
KC(276), KS_Control_R,
|
||||
KC(380), KS_Print_Screen,
|
||||
KC(330), KS_KP_Divide,
|
||||
KC(380), KS_Print_Screen,
|
||||
/* pos command normal shifted altgr shift-altgr */
|
||||
KC(273), KS_Mode_switch, KS_Mode_switch, KS_Mode_switch, KS_Multi_key,
|
||||
#if 0
|
||||
KC(198), KS_Cmd_ResetClose, /* CTL-Break */ /* XXX fixme XXX */
|
||||
#endif
|
||||
KC(364), KS_Home,
|
||||
KC(373), KS_Up,
|
||||
KC(381), KS_Prior,
|
||||
KC(363), KS_Left,
|
||||
KC(372), KS_Right,
|
||||
KC(361), KS_End,
|
||||
KC(370), KS_Down,
|
||||
KC(378), KS_Next,
|
||||
KC(368), KS_Insert,
|
||||
KC(369), KS_Delete,
|
||||
#if 0 /* dunno what to map this one too */
|
||||
KC(221), KS_Menu,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#define KBD_MAP(name, base, map) \
|
||||
{ name, base, sizeof(map)/sizeof(keysym_t), map }
|
||||
/* KBD_NULLMAP generates a entry for machine native variant.
|
||||
the entry will be modified by machine dependent keyboard driver. */
|
||||
#define KBD_NULLMAP(name, base) { name, base, 0, 0 }
|
||||
|
||||
const struct wscons_keydesc rpckbd_keydesctab[] = {
|
||||
KBD_MAP(KB_UK, 0, rpckbd_keydesc_uk),
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
#undef KBD_MAP
|
||||
#undef KC
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* OLD STUFF *
|
||||
************************************************************************/
|
||||
|
||||
#if 0
|
||||
static const keysym_t pckbd_keydesc_de[] = {
|
||||
/* pos normal shifted altgr shift-altgr */
|
||||
KC(3), KS_2, KS_quotedbl, KS_twosuperior,
|
||||
KC(4), KS_3, KS_section, KS_threesuperior,
|
||||
KC(7), KS_6, KS_ampersand,
|
||||
KC(8), KS_7, KS_slash, KS_braceleft,
|
||||
KC(9), KS_8, KS_parenleft, KS_bracketleft,
|
||||
KC(10), KS_9, KS_parenright, KS_bracketright,
|
||||
KC(11), KS_0, KS_equal, KS_braceright,
|
||||
KC(12), KS_ssharp, KS_question, KS_backslash,
|
||||
KC(13), KS_dead_acute, KS_dead_grave,
|
||||
KC(16), KS_q, KS_Q, KS_at,
|
||||
KC(21), KS_z,
|
||||
KC(26), KS_udiaeresis,
|
||||
KC(27), KS_plus, KS_asterisk, KS_dead_tilde,
|
||||
KC(39), KS_odiaeresis,
|
||||
KC(40), KS_adiaeresis,
|
||||
KC(41), KS_dead_circumflex,KS_dead_abovering,
|
||||
KC(43), KS_numbersign, KS_apostrophe,
|
||||
KC(44), KS_y,
|
||||
KC(50), KS_m, KS_M, KS_mu,
|
||||
KC(51), KS_comma, KS_semicolon,
|
||||
KC(52), KS_period, KS_colon,
|
||||
KC(53), KS_minus, KS_underscore,
|
||||
KC(86), KS_less, KS_greater, KS_bar, KS_brokenbar,
|
||||
KC(184), KS_Mode_switch, KS_Multi_key,
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_de_nodead[] = {
|
||||
/* pos normal shifted altgr shift-altgr */
|
||||
KC(13), KS_apostrophe, KS_grave,
|
||||
KC(27), KS_plus, KS_asterisk, KS_asciitilde,
|
||||
KC(41), KS_asciicircum, KS_degree,
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_dk[] = {
|
||||
/* pos normal shifted altgr shift-altgr */
|
||||
KC(3), KS_2, KS_quotedbl, KS_at,
|
||||
KC(4), KS_3, KS_numbersign, KS_sterling,
|
||||
KC(5), KS_4, KS_currency, KS_dollar,
|
||||
KC(7), KS_6, KS_ampersand,
|
||||
KC(8), KS_7, KS_slash, KS_braceleft,
|
||||
KC(9), KS_8, KS_parenleft, KS_bracketleft,
|
||||
KC(10), KS_9, KS_parenright, KS_bracketright,
|
||||
KC(11), KS_0, KS_equal, KS_braceright,
|
||||
KC(12), KS_plus, KS_question,
|
||||
KC(13), KS_dead_acute, KS_dead_grave, KS_bar,
|
||||
KC(26), KS_aring,
|
||||
KC(27), KS_dead_diaeresis, KS_dead_circumflex, KS_dead_tilde,
|
||||
KC(39), KS_ae,
|
||||
KC(40), KS_oslash,
|
||||
KC(41), KS_onehalf, KS_paragraph,
|
||||
KC(43), KS_apostrophe, KS_asterisk,
|
||||
KC(51), KS_comma, KS_semicolon,
|
||||
KC(52), KS_period, KS_colon,
|
||||
KC(53), KS_minus, KS_underscore,
|
||||
KC(86), KS_less, KS_greater, KS_backslash,
|
||||
KC(184), KS_Mode_switch, KS_Multi_key,
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_dk_nodead[] = {
|
||||
/* pos normal shifted altgr shift-altgr */
|
||||
KC(13), KS_apostrophe, KS_grave, KS_bar,
|
||||
KC(27), KS_diaeresis, KS_asciicircum, KS_asciitilde,
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_sv[] = {
|
||||
/* pos normal shifted altgr shift-altgr */
|
||||
KC(12), KS_plus, KS_question, KS_backslash,
|
||||
KC(27), KS_dead_diaeresis, KS_dead_circumflex, KS_dead_tilde,
|
||||
KC(39), KS_odiaeresis,
|
||||
KC(40), KS_adiaeresis,
|
||||
KC(41), KS_paragraph, KS_onehalf,
|
||||
KC(86), KS_less, KS_greater, KS_bar,
|
||||
KC(184), KS_Mode_switch, KS_Multi_key,
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_sv_nodead[] = {
|
||||
/* pos normal shifted altgr shift-altgr */
|
||||
KC(13), KS_apostrophe, KS_grave, KS_bar,
|
||||
KC(27), KS_diaeresis, KS_asciicircum, KS_asciitilde,
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_no[] = {
|
||||
/* pos normal shifted altgr shift-altgr */
|
||||
KC(13), KS_backslash, KS_dead_grave, KS_dead_acute,
|
||||
KC(27), KS_dead_diaeresis, KS_dead_circumflex, KS_dead_tilde,
|
||||
KC(39), KS_oslash,
|
||||
KC(40), KS_ae,
|
||||
KC(41), KS_bar, KS_paragraph,
|
||||
KC(86), KS_less, KS_greater,
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_no_nodead[] = {
|
||||
/* pos normal shifted altgr shift-altgr */
|
||||
KC(13), KS_backslash, KS_grave, KS_acute,
|
||||
KC(27), KS_diaeresis, KS_asciicircum, KS_asciitilde,
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_fr[] = {
|
||||
/* pos normal shifted altgr shift-altgr */
|
||||
KC(2), KS_ampersand, KS_1,
|
||||
KC(3), KS_eacute, KS_2, KS_asciitilde,
|
||||
KC(4), KS_quotedbl, KS_3, KS_numbersign,
|
||||
KC(5), KS_apostrophe, KS_4, KS_braceleft,
|
||||
KC(6), KS_parenleft, KS_5, KS_bracketleft,
|
||||
KC(7), KS_minus, KS_6, KS_bar,
|
||||
KC(8), KS_egrave, KS_7, KS_grave,
|
||||
KC(9), KS_underscore, KS_8, KS_backslash,
|
||||
KC(10), KS_ccedilla, KS_9, KS_asciicircum,
|
||||
KC(11), KS_agrave, KS_0, KS_at,
|
||||
KC(12), KS_parenright, KS_degree, KS_bracketright,
|
||||
KC(13), KS_equal, KS_plus, KS_braceright,
|
||||
KC(16), KS_a,
|
||||
KC(17), KS_z,
|
||||
KC(26), KS_dead_circumflex, KS_dead_diaeresis,
|
||||
KC(27), KS_dollar, KS_sterling, KS_currency,
|
||||
KC(30), KS_q,
|
||||
KC(39), KS_m,
|
||||
KC(40), KS_ugrave, KS_percent,
|
||||
KC(41), KS_twosuperior, KS_asciitilde,
|
||||
KC(43), KS_asterisk, KS_mu,
|
||||
KC(44), KS_w,
|
||||
KC(50), KS_comma, KS_question,
|
||||
KC(51), KS_semicolon, KS_period,
|
||||
KC(52), KS_colon, KS_slash,
|
||||
KC(53), KS_exclam, KS_section,
|
||||
KC(86), KS_less, KS_greater,
|
||||
KC(184), KS_Mode_switch, KS_Multi_key,
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_it[] = {
|
||||
/* pos normal shifted altgr shift-altgr */
|
||||
KC(3), KS_2, KS_quotedbl, KS_twosuperior,
|
||||
KC(4), KS_3, KS_sterling, KS_threesuperior,
|
||||
KC(5), KS_4, KS_dollar,
|
||||
KC(6), KS_5, KS_percent,
|
||||
KC(7), KS_6, KS_ampersand,
|
||||
KC(8), KS_7, KS_slash,
|
||||
KC(9), KS_8, KS_parenleft,
|
||||
KC(10), KS_9, KS_parenright,
|
||||
KC(11), KS_0, KS_equal,
|
||||
KC(12), KS_apostrophe, KS_question,
|
||||
KC(13), KS_igrave, KS_asciicircum,
|
||||
KC(26), KS_egrave, KS_eacute, KS_braceleft, KS_bracketleft,
|
||||
KC(27), KS_plus, KS_asterisk, KS_braceright, KS_bracketright,
|
||||
KC(39), KS_ograve, KS_Ccedilla, KS_at,
|
||||
KC(40), KS_agrave, KS_degree, KS_numbersign,
|
||||
KC(41), KS_backslash, KS_bar,
|
||||
KC(43), KS_ugrave, KS_section,
|
||||
KC(51), KS_comma, KS_semicolon,
|
||||
KC(52), KS_period, KS_colon,
|
||||
KC(53), KS_minus, KS_underscore,
|
||||
KC(86), KS_less, KS_greater,
|
||||
KC(184), KS_Mode_switch, KS_Multi_key,
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_uk[] = {
|
||||
/* pos normal shifted altgr shift-altgr */
|
||||
KC(2), KS_1, KS_exclam, KS_plusminus, KS_exclamdown,
|
||||
KC(3), KS_2, KS_quotedbl, KS_twosuperior, KS_cent,
|
||||
KC(4), KS_3, KS_sterling, KS_threesuperior,
|
||||
KC(5), KS_4, KS_dollar, KS_acute, KS_currency,
|
||||
KC(6), KS_5, KS_percent, KS_mu, KS_yen,
|
||||
KC(7), KS_6, KS_asciicircum, KS_paragraph,
|
||||
KC(8), KS_7, KS_ampersand, KS_periodcentered, KS_brokenbar,
|
||||
KC(9), KS_8, KS_asterisk, KS_cedilla, KS_ordfeminine,
|
||||
KC(10), KS_9, KS_parenleft, KS_onesuperior, KS_diaeresis,
|
||||
KC(11), KS_0, KS_parenright, KS_masculine, KS_copyright,
|
||||
KC(12), KS_minus, KS_underscore, KS_hyphen, KS_ssharp,
|
||||
KC(13), KS_equal, KS_plus, KS_onehalf, KS_guillemotleft,
|
||||
KC(40), KS_apostrophe, KS_at, KS_section, KS_Agrave,
|
||||
KC(41), KS_grave, KS_grave, KS_agrave, KS_agrave,
|
||||
KC(43), KS_numbersign, KS_asciitilde, KS_sterling, KS_thorn,
|
||||
KC(86), KS_backslash, KS_bar, KS_Udiaeresis,
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_jp[] = {
|
||||
/* pos normal shifted altgr shift-altgr */
|
||||
KC(3), KS_2, KS_quotedbl,
|
||||
KC(7), KS_6, KS_ampersand,
|
||||
KC(8), KS_7, KS_apostrophe,
|
||||
KC(9), KS_8, KS_parenleft,
|
||||
KC(10), KS_9, KS_parenright,
|
||||
KC(11), KS_0,
|
||||
KC(12), KS_minus, KS_equal,
|
||||
KC(13), KS_asciicircum, KS_asciitilde,
|
||||
KC(26), KS_at, KS_grave,
|
||||
KC(27), KS_bracketleft, KS_braceleft,
|
||||
KC(39), KS_semicolon, KS_plus,
|
||||
KC(40), KS_colon, KS_asterisk,
|
||||
KC(41), KS_Zenkaku_Hankaku, /* replace grave/tilde */
|
||||
KC(43), KS_bracketright, KS_braceright,
|
||||
KC(112), KS_Hiragana_Katakana,
|
||||
KC(115), KS_backslash, KS_underscore,
|
||||
KC(121), KS_Henkan,
|
||||
KC(123), KS_Muhenkan,
|
||||
KC(125), KS_backslash, KS_bar,
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_es[] = {
|
||||
/* pos normal shifted altgr shift-altgr */
|
||||
KC(2), KS_1, KS_exclam, KS_bar,
|
||||
KC(3), KS_2, KS_quotedbl, KS_at,
|
||||
KC(4), KS_3, KS_periodcentered, KS_numbersign,
|
||||
KC(5), KS_4, KS_dollar, KS_asciitilde,
|
||||
KC(7), KS_6, KS_ampersand,
|
||||
KC(8), KS_7, KS_slash,
|
||||
KC(9), KS_8, KS_parenleft,
|
||||
KC(10), KS_9, KS_parenright,
|
||||
KC(11), KS_0, KS_equal,
|
||||
KC(12), KS_grave, KS_question,
|
||||
KC(13), KS_exclamdown, KS_questiondown,
|
||||
KC(26), KS_dead_grave, KS_dead_circumflex, KS_bracketleft,
|
||||
KC(27), KS_plus, KS_asterisk, KS_bracketright,
|
||||
KC(39), KS_ntilde,
|
||||
KC(40), KS_dead_acute, KS_dead_diaeresis, KS_braceleft,
|
||||
KC(41), KS_degree, KS_ordfeminine, KS_backslash,
|
||||
KC(43), KS_ccedilla, KS_Ccedilla, KS_braceright,
|
||||
KC(51), KS_comma, KS_semicolon,
|
||||
KC(52), KS_period, KS_colon,
|
||||
KC(53), KS_minus, KS_underscore,
|
||||
KC(86), KS_less, KS_greater,
|
||||
KC(184), KS_Mode_switch, KS_Multi_key,
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_us_declk[] = {
|
||||
/* pos normal shifted altgr shift-altgr */
|
||||
KC(1), KS_grave, KS_asciitilde, /* replace escape */
|
||||
KC(41), KS_less, KS_greater, /* replace grave/tilde */
|
||||
KC(143), KS_Multi_key, /* left compose */
|
||||
KC(157), KS_Multi_key, /* right compose, replace right control */
|
||||
KC(87), KS_Cmd_Debugger, KS_Escape, /* replace F11 */
|
||||
KC(189), KS_f13,
|
||||
KC(190), KS_f14,
|
||||
KC(191), KS_Help,
|
||||
KC(192), KS_Execute,
|
||||
KC(193), KS_f17,
|
||||
KC(183), KS_f18,
|
||||
KC(70), KS_f19, /* replace scroll lock */
|
||||
KC(127), KS_f20, /* replace break */
|
||||
KC(69), KS_KP_F1, /* replace num lock */
|
||||
KC(181), KS_KP_F2, /* replace divide */
|
||||
KC(55), KS_KP_F3, /* replace multiply */
|
||||
KC(74), KS_KP_F4, /* replace subtract */
|
||||
|
||||
/* keypad is numbers only - no num lock */
|
||||
KC(71), KS_KP_7,
|
||||
KC(72), KS_KP_8,
|
||||
KC(73), KS_KP_9,
|
||||
KC(75), KS_KP_4,
|
||||
KC(76), KS_KP_5,
|
||||
KC(77), KS_KP_6,
|
||||
KC(79), KS_KP_1,
|
||||
KC(80), KS_KP_2,
|
||||
KC(81), KS_KP_3,
|
||||
KC(82), KS_KP_0,
|
||||
KC(83), KS_KP_Decimal,
|
||||
|
||||
KC(206), KS_KP_Subtract,
|
||||
KC(78), KS_KP_Separator, /* replace add */
|
||||
KC(199), KS_Find, /* replace home */
|
||||
KC(207), KS_Select, /* replace end */
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_us_dvorak[] = {
|
||||
/* pos command normal shifted */
|
||||
KC(12), KS_bracketleft, KS_braceleft,
|
||||
KC(13), KS_bracketright, KS_braceright,
|
||||
KC(16), KS_apostrophe, KS_quotedbl,
|
||||
KC(17), KS_comma, KS_less,
|
||||
KC(18), KS_period, KS_greater,
|
||||
KC(19), KS_p,
|
||||
KC(20), KS_y,
|
||||
KC(21), KS_f,
|
||||
KC(22), KS_g,
|
||||
KC(23), KS_c,
|
||||
KC(24), KS_r,
|
||||
KC(25), KS_l,
|
||||
KC(26), KS_slash, KS_question,
|
||||
KC(27), KS_equal, KS_plus,
|
||||
KC(31), KS_o,
|
||||
KC(32), KS_e,
|
||||
KC(33), KS_u,
|
||||
KC(34), KS_i,
|
||||
KC(35), KS_d,
|
||||
KC(36), KS_h,
|
||||
KC(37), KS_t,
|
||||
KC(38), KS_n,
|
||||
KC(39), KS_s,
|
||||
KC(40), KS_minus, KS_underscore,
|
||||
KC(44), KS_semicolon, KS_colon,
|
||||
KC(45), KS_q,
|
||||
KC(46), KS_j,
|
||||
KC(47), KS_k,
|
||||
KC(48), KS_x,
|
||||
KC(49), KS_b,
|
||||
KC(51), KS_w,
|
||||
KC(52), KS_v,
|
||||
KC(53), KS_z,
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_swapctrlcaps[] = {
|
||||
/* pos command normal shifted */
|
||||
KC(29), KS_Caps_Lock,
|
||||
KC(58), KS_Cmd1, KS_Control_L,
|
||||
};
|
||||
|
||||
static const keysym_t pckbd_keydesc_iopener[] = {
|
||||
/* pos command normal shifted */
|
||||
KC(59), KS_Cmd_Debugger, KS_Escape,
|
||||
KC(60), KS_Cmd_Screen0, KS_f1,
|
||||
KC(61), KS_Cmd_Screen1, KS_f2,
|
||||
KC(62), KS_Cmd_Screen2, KS_f3,
|
||||
KC(63), KS_Cmd_Screen3, KS_f4,
|
||||
KC(64), KS_Cmd_Screen4, KS_f5,
|
||||
KC(65), KS_Cmd_Screen5, KS_f6,
|
||||
KC(66), KS_Cmd_Screen6, KS_f7,
|
||||
KC(67), KS_Cmd_Screen7, KS_f8,
|
||||
KC(68), KS_Cmd_Screen8, KS_f9,
|
||||
KC(87), KS_Cmd_Screen9, KS_f10,
|
||||
KC(88), KS_f11,
|
||||
};
|
||||
|
||||
#define KBD_MAP(name, base, map) \
|
||||
{ name, base, sizeof(map)/sizeof(keysym_t), map }
|
||||
/* KBD_NULLMAP generates a entry for machine native variant.
|
||||
the entry will be modified by machine dependent keyboard driver. */
|
||||
#define KBD_NULLMAP(name, base) { name, base, 0, 0 }
|
||||
|
||||
const struct wscons_keydesc pckbd_keydesctab[] = {
|
||||
KBD_MAP(KB_US, 0, pckbd_keydesc_us),
|
||||
KBD_MAP(KB_DE, KB_US, pckbd_keydesc_de),
|
||||
KBD_MAP(KB_DE | KB_NODEAD, KB_DE, pckbd_keydesc_de_nodead),
|
||||
KBD_MAP(KB_FR, KB_US, pckbd_keydesc_fr),
|
||||
KBD_MAP(KB_DK, KB_US, pckbd_keydesc_dk),
|
||||
KBD_MAP(KB_DK | KB_NODEAD, KB_DK, pckbd_keydesc_dk_nodead),
|
||||
KBD_MAP(KB_IT, KB_US, pckbd_keydesc_it),
|
||||
KBD_MAP(KB_UK, KB_US, pckbd_keydesc_uk),
|
||||
KBD_MAP(KB_JP, KB_US, pckbd_keydesc_jp),
|
||||
KBD_MAP(KB_SV, KB_DK, pckbd_keydesc_sv),
|
||||
KBD_MAP(KB_SV | KB_NODEAD, KB_SV, pckbd_keydesc_sv_nodead),
|
||||
KBD_MAP(KB_NO, KB_DK, pckbd_keydesc_no),
|
||||
KBD_MAP(KB_NO | KB_NODEAD, KB_NO, pckbd_keydesc_no_nodead),
|
||||
KBD_MAP(KB_US | KB_DECLK, KB_US, pckbd_keydesc_us_declk),
|
||||
KBD_MAP(KB_US | KB_DVORAK, KB_US, pckbd_keydesc_us_dvorak),
|
||||
KBD_MAP(KB_US | KB_SWAPCTRLCAPS, KB_US, pckbd_keydesc_swapctrlcaps),
|
||||
KBD_MAP(KB_US | KB_IOPENER, KB_US, pckbd_keydesc_iopener),
|
||||
KBD_MAP(KB_JP | KB_SWAPCTRLCAPS, KB_JP, pckbd_keydesc_swapctrlcaps),
|
||||
KBD_MAP(KB_FR | KB_SWAPCTRLCAPS, KB_FR, pckbd_keydesc_swapctrlcaps),
|
||||
KBD_MAP(KB_US | KB_DVORAK | KB_SWAPCTRLCAPS, KB_US | KB_DVORAK,
|
||||
pckbd_keydesc_swapctrlcaps),
|
||||
KBD_MAP(KB_US | KB_IOPENER | KB_SWAPCTRLCAPS, KB_US | KB_IOPENER,
|
||||
pckbd_keydesc_swapctrlcaps),
|
||||
KBD_MAP(KB_ES , KB_US, pckbd_keydesc_es),
|
||||
KBD_NULLMAP(KB_US | KB_MACHDEP, KB_US),
|
||||
KBD_NULLMAP(KB_JP | KB_MACHDEP, KB_JP),
|
||||
KBD_NULLMAP(KB_US | KB_MACHDEP | KB_SWAPCTRLCAPS,
|
||||
KB_US | KB_SWAPCTRLCAPS),
|
||||
KBD_NULLMAP(KB_JP | KB_MACHDEP | KB_SWAPCTRLCAPS,
|
||||
KB_JP | KB_SWAPCTRLCAPS),
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
#undef KBD_MAP
|
||||
#undef KC
|
||||
|
||||
#endif
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
/* $NetBSD: wskbdmap_mfii.h,v 1.1 2001/03/20 18:20:54 reinoud Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Juergen Hannken-Illjes.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
extern const struct wscons_keydesc rpckbd_keydesctab[];
|
||||
|
|
@ -1,189 +0,0 @@
|
|||
/* $NetBSD: wsqms.c,v 1.2 2001/11/27 01:06:28 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Reinoud Zandijk
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Reinoud Zandijk
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* Quadratic mouse driver for the wscons as used in the IOMD but is in
|
||||
* principle more generic.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <sys/device.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <dev/wscons/wsconsio.h>
|
||||
#include <dev/wscons/wsksymdef.h>
|
||||
#include <dev/wscons/wsmousevar.h>
|
||||
|
||||
#include <arch/arm32/dev/wsqmsvar.h>
|
||||
|
||||
|
||||
/* Offsets of hardware registers */
|
||||
#define QMS_MOUSEX 0 /* 16 bits X register */
|
||||
#define QMS_MOUSEY 1 /* 16 bits Y register */
|
||||
#define QMS_BUTTONS 0 /* mouse buttons in bits 4,5,6 */
|
||||
|
||||
#define MAX_XYREG 4096
|
||||
|
||||
/* forward declarations */
|
||||
|
||||
static int wsqms_enable __P((void *cookie));
|
||||
static int wsqms_ioctl __P((void *cookie, u_long cmd, caddr_t data, int flag, struct proc *p));
|
||||
static void wsqms_disable __P((void *cookie));
|
||||
|
||||
|
||||
static struct wsmouse_accessops wsqms_accessops = {
|
||||
wsqms_enable, wsqms_ioctl, wsqms_disable
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
wsqms_attach(sc, self)
|
||||
struct wsqms_softc *sc;
|
||||
struct device *self;
|
||||
{
|
||||
struct wsmousedev_attach_args wsmouseargs;
|
||||
|
||||
/* set up wsmouse attach arguments */
|
||||
wsmouseargs.accessops = &wsqms_accessops;
|
||||
wsmouseargs.accesscookie = self;
|
||||
|
||||
printf("\n");
|
||||
|
||||
sc->sc_wsmousedev = config_found(self, &wsmouseargs, wsmousedevprint);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
wsqms_enable(cookie)
|
||||
void *cookie;
|
||||
{
|
||||
struct wsqms_softc *sc = cookie;
|
||||
|
||||
sc->sc_flags |= WSQMS_ENABLED;
|
||||
|
||||
/* enable interrupts */
|
||||
sc->sc_intenable(sc, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
wsqms_disable(cookie)
|
||||
void *cookie;
|
||||
{
|
||||
struct wsqms_softc *sc = cookie;
|
||||
|
||||
sc->sc_flags &= ~WSQMS_ENABLED;
|
||||
|
||||
/* disable interrupts */
|
||||
sc->sc_intenable(sc, 0);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
wsqms_ioctl(cookie, cmd, data, flag, p)
|
||||
void *cookie;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
switch (cmd) {
|
||||
case WSMOUSEIO_GTYPE:
|
||||
*(int *)data = WSMOUSE_TYPE_ARCHIMEDES;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* We can really put in the mouse XY as absolutes ? */
|
||||
int
|
||||
wsqms_intr(arg)
|
||||
void *arg;
|
||||
{
|
||||
struct wsqms_softc *sc = arg;
|
||||
int x, y, b;
|
||||
|
||||
x = bus_space_read_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEX) & 0xffff;
|
||||
y = bus_space_read_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEY) & 0xffff;
|
||||
b = bus_space_read_1(sc->sc_iot, sc->sc_butioh, QMS_BUTTONS) & 0x70;
|
||||
b >>= 4;
|
||||
if (x & 0x8000) x |= 0xffff0000;
|
||||
if (y & 0x8000) y |= 0xffff0000;
|
||||
|
||||
/* patch up the buttons */
|
||||
b = ~( ((b & 1)<<2) | (b & 2) | ((b & 4)>>2));
|
||||
|
||||
if ((x != sc->lastx) || (y != sc->lasty) || (b != sc->lastb)) {
|
||||
/* save old values */
|
||||
sc->lastx = x;
|
||||
sc->lasty = y;
|
||||
sc->lastb = b;
|
||||
|
||||
/* do we have to bound x and y ? => yes */
|
||||
if (x < -MAX_XYREG) x = -MAX_XYREG;
|
||||
if (x > MAX_XYREG) x = MAX_XYREG;
|
||||
if (y < -MAX_XYREG) y = -MAX_XYREG;
|
||||
if (y > MAX_XYREG) y = MAX_XYREG;
|
||||
|
||||
/* write the bounded values back */
|
||||
bus_space_write_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEX, x);
|
||||
bus_space_write_4(sc->sc_iot, sc->sc_ioh, QMS_MOUSEY, y);
|
||||
|
||||
wsmouse_input(sc->sc_wsmousedev, b, x, y, 0,
|
||||
WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y);
|
||||
};
|
||||
|
||||
return (0); /* pass on */
|
||||
}
|
||||
|
||||
|
||||
/* end of wsqms.c */
|
|
@ -1,75 +0,0 @@
|
|||
/* $NetBSD: wsqmsvar.h,v 1.1 2001/04/14 19:22:44 reinoud Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Reinoud Zandijk
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Reinoud Zandijk
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* Quadratic mouse driver variable for the wscons as used in the IOMD but is in
|
||||
* principle more generic.
|
||||
*
|
||||
* wsqmsvar.h
|
||||
*/
|
||||
|
||||
|
||||
/* softc structure for the wsqms device */
|
||||
|
||||
struct wsqms_softc {
|
||||
struct device sc_device; /* remember our own device as attached */
|
||||
struct device *sc_wsmousedev; /* remember our wsmouse device... */
|
||||
|
||||
bus_space_tag_t sc_iot; /* bus tag */
|
||||
bus_space_handle_t sc_ioh; /* bus handle for XY */
|
||||
bus_space_handle_t sc_butioh; /* bus handle for buttons */
|
||||
|
||||
/* interupt handler switch function + goo */
|
||||
void (*sc_intenable) __P((struct wsqms_softc *, int));
|
||||
void *sc_ih; /* interrupt pointer */
|
||||
int sc_irqnum; /* IRQ number */
|
||||
|
||||
#define WSQMS_ENABLED 0x01
|
||||
int sc_flags;
|
||||
|
||||
int lastx;
|
||||
int lasty;
|
||||
int lastb;
|
||||
};
|
||||
|
||||
|
||||
/* function prototypes */
|
||||
extern void wsqms_attach __P((struct wsqms_softc *sc, struct device *));
|
||||
extern int wsqms_intr __P((void *arg));
|
||||
|
||||
|
||||
/* End of wsqmsvar.h */
|
|
@ -1,56 +0,0 @@
|
|||
# $NetBSD: TODO,v 1.9 1999/01/01 12:13:49 mark Exp $
|
||||
|
||||
Ok this is the current todo list.
|
||||
|
||||
There are a number of things that need to be done that I do not
|
||||
have time to do and am unlikely to have time to do them in the near
|
||||
future. These are currently being left in the hope that users will do them
|
||||
instead and are marked with *.
|
||||
|
||||
o replace netns/ns_chsum.c with an assembly version (*)
|
||||
o drivers for currently unsupported podules (*)
|
||||
o replacing the C string functions in libc with assembly ones (work
|
||||
started but not finished) (*)
|
||||
o L1 page tables should be freed when a process is swapped out and
|
||||
reallocated when the process is swapped in.
|
||||
o debug / replace console code. UNDER DEVELOPMENT
|
||||
o optimise irq delivery code UNDER DEVELOPMENT
|
||||
o improve fiq handling code
|
||||
o Complete hydra support
|
||||
o Remove stubs.c
|
||||
o Remove postmortem.c
|
||||
o Debug audio drivers
|
||||
o 16 bit sound driver.
|
||||
o Create generic SEEQ8004/8005 driver. (TESTING DRIVER)
|
||||
o Create ea and eb front ends for the generic SEEQ driver. (TESTING DRIVER)
|
||||
o Merge in Ether2 driver
|
||||
o Reorganise kernel VM space UNDER DEVELOPMENT
|
||||
o Implement DMA transfers to buffer memory for the asc driver.
|
||||
o Add interrupt and DMA support to the cosc driver
|
||||
o Optimise Strong ARM support UNDER DEVELOPMENT
|
||||
o Debug multiple mappings in pmap.c UNDER DEVELOPMENT
|
||||
o Optimise data xfers for the ea and eb drivers (TESTING DRIVER)
|
||||
o Update drivers to use new bus space macros UNDER DEVELOPMENT
|
||||
o Debug serial consoles.
|
||||
o Implement bus space DMA support for IOMD.
|
||||
o the podule attach args should pass the interrupt number for
|
||||
podule or network slot so that the podulebus is the only
|
||||
driver that needs to know about the irq numbers.
|
||||
o A mechanism for obtaining the MAC address for netslot cards
|
||||
is needed instead of drivers building it from the bootconfig
|
||||
machine ID on the RiscPC.
|
||||
o Implement interrupts on the Connect32 driver.
|
||||
o Debug IOMD DMA handling.
|
||||
o Implement driver for etherlan500 podule.
|
||||
o Implement generic soft interrupts. (UNDER DEVELOPMENT)
|
||||
o Improve interaction of VIDC and IOMD.
|
||||
o Cleanup passing of boot information.
|
||||
o Cleanup description of available memory regions
|
||||
o Replace sfas driver with MI NCR53C9X driver.
|
||||
o Support runtime selection of IRQ subsystem.
|
||||
o Support runtime selection of FPE.
|
||||
o vm_offset_t -> [pv]addr_t (PENDING EBSA285 COMMIT)
|
||||
o Delayed cache / TLB clean/flushing
|
||||
o Tracking dirty state of USR addresses in cache
|
||||
o Close all outstanding PRs
|
||||
o merge SA1100 support
|
|
@ -1,460 +0,0 @@
|
|||
# $NetBSD: history,v 1.7 2001/10/17 23:58:35 reinoud Exp $
|
||||
|
||||
3135 - fixed mode selection on boot
|
||||
- page up/down, insert and delete now generate the correct codes in
|
||||
the console
|
||||
- the configured modesare now compiled in a separate file rather
|
||||
than in vidcconsole.c
|
||||
- The eb timeout reduced to 30 secs
|
||||
|
||||
- clreos problems fixed
|
||||
- / on the keypad generated the correct code
|
||||
- the block cursor hove down 2 scan lines to align with characters
|
||||
- extended irq renamed netslot
|
||||
- extra double mapping of kstack removed
|
||||
- kstack located at efbfe000
|
||||
- implementation of cpu_swapin() to remap the kstack
|
||||
- patch to vm_glue to use kmem_alloc for the kstack
|
||||
- extra pmap debugging code added with DEBUG669
|
||||
- the pventry tables can not be dumped from the kshell
|
||||
or from a running system.
|
||||
|
||||
- merged console code v133 into kernel
|
||||
- the disklabel code no longer prints a warning if a HD is found
|
||||
without a adfs partition
|
||||
- the kbd driver now is capable of setting the keyboard leds.
|
||||
- added ioctl to set the keyboard leds.
|
||||
- added a routine to read the keyboard state.
|
||||
- added a routine to set the keyboard state.
|
||||
- added some prototypes to kbd.h
|
||||
- implmented irq_setmasks() as an assembly function.
|
||||
- added an extra disable irq mask
|
||||
- the irq bits from IOMD reg A are cleared as soon as req A is read
|
||||
- Debugged the plip driver. The ip packet is now word aligned when
|
||||
passed to the upper network levels
|
||||
|
||||
20/09/95
|
||||
- the cpu_switch routine checks the amount of stack space used when
|
||||
swapping in a task and prints a warning when 6K has been used
|
||||
- removed the remnants of the old kstack double mapping
|
||||
- a separate message is printed for umounts during a halt.
|
||||
- added extra validation in copyin() copyout() copyinstr() and
|
||||
copyoutstr()
|
||||
- podule irq handler no longer panics
|
||||
- Lark A16 podule now recognised
|
||||
- section permission faults now cause bus errors
|
||||
- the syscall handler now correctly uses bcopy to copy the register
|
||||
passed parameters
|
||||
- the copyin() function now validates the uaddrs argumant
|
||||
- the kstack is filled with a know pattern on a fork()
|
||||
- the postmortem code will check the size of the kstack fill pattern
|
||||
- the assembly bcopyinout() now returns EFAULT on error
|
||||
- the copyin() copyout() copyinstr() copyoutstr() now return EFAULT
|
||||
if the validation checks fail.
|
||||
23/09/95
|
||||
- the fault handler will report faults from (fu/su)iwintr()
|
||||
- added new pmap function to return the address of the next physical
|
||||
page (pmap_next_phys_page).
|
||||
- added code to machdep.c to compare the page number against
|
||||
pmap_next_phys_page() to try and locate source to kernel size
|
||||
limit
|
||||
- added option to syscall_special (32) to return the address of the
|
||||
next physical page.
|
||||
- fixed the primary bootstrap to map more memory for the secondary
|
||||
bootstrap to use.
|
||||
- The 936K kernel size limit has been removed.
|
||||
- Added support for KTRACE in syscall.c
|
||||
- Seondary bootstrap now zeros down its memory
|
||||
- cpu_switch now zeros curpcb while there is no valid process
|
||||
-
|
||||
1/10/95
|
||||
- cpuswitch now detects trahsed stacks.
|
||||
- new compile option for generation of enhanced postmortem debugging
|
||||
- merged console code 183b
|
||||
- implemented a memcpy routine
|
||||
- removed remnants of the kstackpte's
|
||||
- cleaned old commented debugging code out of cpu_switch
|
||||
- Added new comments in exception.S
|
||||
- userret() check for a non-zero proc pointer
|
||||
- extended postmortem debug for cpu_switch bug
|
||||
- updated prototype declarations in machdep.c
|
||||
- fixed passing of proc0 pointer into cpu_switch from switch_exit
|
||||
- podulebus now recognised Lingenuity podules
|
||||
- Lingenuity 16bit SCSI card recognised
|
||||
|
||||
3/10/95
|
||||
- new compile option ROTTEN_INARDS to dump full debugging info on
|
||||
postmortem
|
||||
- Rewritten postmortem debug information printout
|
||||
- Postmortem will now examine the IRQ stack for traceback info
|
||||
- Fix cpu_exit() bug thus could result in the idle being entered at
|
||||
splhigh()
|
||||
- Added function prototypes for functions called in vm_machdep.c
|
||||
- boot0() now makes sure IRQ's and FIQ's have been disabled
|
||||
- The ARM700 FPA is now correctly turned off during boot
|
||||
- A major has been allocated for the vidcaudio device (36)
|
||||
- vidcaudio.c added to mainbus/ and associated support added in
|
||||
conf/ and conf.c
|
||||
- Patch to the console code to report the version number
|
||||
- Latest version of dev/isa/com.c merged into mainbus/com.c
|
||||
- Latest version of dev/isa/lpt.c merged into mainbus/lpt.c
|
||||
- Latest version of dev/isa/wd.c merged into mainbus/wd.c
|
||||
- new assembly version of copystr added
|
||||
- buffer address for beep0 removed from attach message
|
||||
- unrecognised undefined instructions are now logged as errors to
|
||||
syslog
|
||||
- fpe now attaches a coproc2 handler to stap coproc2 FP instructions
|
||||
and report an error
|
||||
- New compile option FPE_INLINE added to fpe.c to inline some of the
|
||||
conversion functions
|
||||
- Added new compile option FPE_PROF to fpe.c to compile in FP profiling
|
||||
code
|
||||
-
|
||||
|
||||
14/10/95
|
||||
- added podule id for laser direct card
|
||||
- added podule id for morley SCSI card
|
||||
- added podule id for AXRE SCSI card
|
||||
- added podule id for CC midi max card
|
||||
- modified primary/secondary bootstraps to reserve special boot
|
||||
- memory for hydra board
|
||||
- added hydra device
|
||||
- Added cpu identification for all hydra processors
|
||||
- Private stacks are allocated to all slave processors
|
||||
- All hydra processors are halted on reboot
|
||||
- podule code checks for chunk directories but does not try to read
|
||||
them yet.
|
||||
- polling, immediate execution asc driver written for Acorn SCSI
|
||||
card
|
||||
- new special syscalls added to aid development of hydra software
|
||||
|
||||
01/11/95
|
||||
- kernel built with new netbsd-current source tree
|
||||
- arm32 source updated to conform to latest netbsd-current source
|
||||
tree
|
||||
|
||||
03/11/95
|
||||
- ALT-Cursor Left/Right now work the correct way round
|
||||
- ALT-F6 now gernerates the correct code
|
||||
- alpha version of the cumana SCSI II driver added
|
||||
- alpha version of the ether1 driver added
|
||||
- console code upgraded to V191
|
||||
- driver directory structure changed.
|
||||
- ./src/patch directory updated
|
||||
- alpha version of ATAPI CDROM driver added
|
||||
- mainbus and podulebus directories split in to public and private
|
||||
directories.
|
||||
- warnings from validate_trapframe() are prefixed with "VTF"
|
||||
- old rpc console stuff removed from files.arm32 and source moved to
|
||||
arch/arm32/old/
|
||||
- the arch/arm32/pmap_stuff dir has been moved to arch/arm32/old/
|
||||
- the _mcount.S and belgium.S files have been moved to old and
|
||||
removed from files.arm32
|
||||
- the device name to major code in autoconf.c now recognised /dev/cd
|
||||
and /dev/wcd
|
||||
- the mountroot code in stubs.c will call cd9660_mountroot() instead
|
||||
of ffs_mountroot() is the root dev is a CDROM major.
|
||||
- major 36 allocated to audio device
|
||||
- major 37 allocated to vidcvideo device
|
||||
- major 38 allocated to hydra device
|
||||
|
||||
|
||||
07/11/95
|
||||
- cpu_fork() now maps in a page table for each process covering the
|
||||
0M-4M block of memory.
|
||||
- VM_MIN_ADDRESS lowered to 0x1000
|
||||
- cpu_swapout() unmaps the system page at 0x00000000 from its page
|
||||
table
|
||||
- cpu_swapin() wires down the pagetable covering 0x00000000 and
|
||||
maps in the system page at 0x00000000
|
||||
- cpu_swapin() and cpu_swapout() moved to vm_machdep.c
|
||||
- pmap_enter_pv() no longer panics on duplicate mapping, it just
|
||||
prints an warning.
|
||||
- alpha version of the powertec SCSI driver
|
||||
|
||||
15/11/95
|
||||
- switch_exit now unmaps the system page.
|
||||
- added newline to printf in disksubr.c
|
||||
- the console code has been moved to the dev directory
|
||||
- cumana SCSI II driver upgraded to support interrupts
|
||||
- powertec SCSI II driver upgraded to support interrupts
|
||||
- the mount root code in stubs.c will attempt to mount
|
||||
a hd partition as cd9660 if the ffs_mountroot() fails.
|
||||
- added missing copyright notices
|
||||
- updated some declarations in header files
|
||||
- removed DEBUG669 code from pmap.c
|
||||
- new syncing routine written for boot()
|
||||
- syncing no longer requires kshell support
|
||||
- Added extra comments to the boot() function
|
||||
- Implemented cpu_sysctl() function (just returns not supported
|
||||
error)
|
||||
- The nosync kernel interrupt now correctly uses RB_NOSYNC
|
||||
-
|
||||
|
||||
20/11/95
|
||||
- restructure of directories contains device files
|
||||
- fixed bug in pmap_pte() that could result in non-word
|
||||
aligned pointers being returned in a off page boundry virtual
|
||||
address was specified.
|
||||
-
|
||||
|
||||
24/11/95
|
||||
- merged in new netbsd-current source tree
|
||||
- removed all the validate_trapframe() calls
|
||||
- the ioctl CONSOLE_BLANKTIME now reloads the blank timer
|
||||
- the ioctl CONSOLE_BLANKTIME uses the default blank time if a
|
||||
negative time is specified.
|
||||
- the machine id is now passed in the bootconfig structure
|
||||
- the eb0 driver will set the MAC address from the machine id
|
||||
if the address has not already been set.
|
||||
|
||||
26/11/95
|
||||
- Fixed the definition of va_dcl in arm32/include/varargs.h
|
||||
-
|
||||
|
||||
02/12/95
|
||||
- Fixed the WriteShort() macro
|
||||
- Removed some redundant code from machdep.c
|
||||
- cpu_sysctl is now declared to return an int
|
||||
- stubs.c now has prototypes for the floppy driver functions it
|
||||
calls when loading the ramdisc.
|
||||
- further debugging work on the ether3 driver
|
||||
|
||||
10/12/95
|
||||
- Added uk device for unknown scsi devices to configuration files
|
||||
and conf.c
|
||||
- Alpha version of the ether3 ea device driver
|
||||
|
||||
14/12/95
|
||||
- Merged in beta version of the ether1 (ie) device driver
|
||||
- added ifdefs to stubs.c so the cd9660_mountroot() is only called
|
||||
when the kernel is compiled with CD9660
|
||||
- created new text file to track all major and minor numbers
|
||||
|
||||
16/12/95
|
||||
- define __FORK_BRAINDAMAGE for compilation with the latest NetBSD
|
||||
sources
|
||||
- boot() now calls doshutdownhooks()
|
||||
- merged in frank's new debugger code (process_machdep.c, ptrace.h,
|
||||
regs.h)
|
||||
- patches stub.c to take account of frank's new code
|
||||
- patch cpu.h to give more detail on the PSR bits
|
||||
- fixed the setting of p->p_mdregs to point to the trapframe in
|
||||
the kernel mapping of kstack rather than the current mapping.
|
||||
- removed some redundant code from mem.c
|
||||
- commented out all the trace_debug code
|
||||
- cpu_coredump moved from stubs.c to vm_machdep.c
|
||||
- implemented ptrace.S in libc
|
||||
- boot() no longer sets the curproc to proc0 if it was zero.
|
||||
- spl's added to the console locking code
|
||||
-
|
||||
|
||||
19/12/95
|
||||
- merged in new console code (V203) from Nut
|
||||
- dosoftints() now calls pppintr()
|
||||
|
||||
21/12/95
|
||||
- sys_sysarch() no longer panics but returns EINVAL instead.
|
||||
- added 3 new debugging syscalls for tracing the vnode bug
|
||||
- identified what goes wrong with vnodes resulting in a lockup
|
||||
- fixed a number of source file headers
|
||||
- Added new comments to a number of routines.
|
||||
- readdisklabel() now sets the B_AGE flag on its buffer
|
||||
- ether3 drive now reports the controller chip type
|
||||
- removed all stand and glue code from kshell
|
||||
- added a new debugging syscall to all wakeup() to be called
|
||||
|
||||
24/12/95
|
||||
- removed redundant physconinit() call in initarm().
|
||||
- updated comments in machdep.c
|
||||
- added support for mulitple swap devices to be specified at boot
|
||||
time
|
||||
- changed debugging output in userret()
|
||||
- added extra debugging
|
||||
- added new debugging syscalls for tracubg the vnode bug
|
||||
- added new debugging commands to the kshell
|
||||
- added a new insw16() function for faster block transfers
|
||||
- created a patch to fix p_nice
|
||||
- the wd driver now supports multisector transfers
|
||||
- added a new outsw16() function for faster block transfers but is
|
||||
currently untested
|
||||
- the existing arm32/fpe directory has been renamed to
|
||||
arm32/fpe-sp
|
||||
- started work on integrating the ARM FPE
|
||||
- a new fpe directory arm32/fpe-arm has been created for the new FPE
|
||||
- file arm32/cpu.S renamed to arm32/cpuswitch.S
|
||||
- created new mainbus device 'cpu' (mainbus/cpu.c)
|
||||
- created new header file include/cpus.h to hold macros and
|
||||
structure definitions for cpus.
|
||||
- all identify functions for the processor and FPA have been moved
|
||||
to mainbus/cpu.c
|
||||
- FPE is now attached during the cpu attachment during
|
||||
autoconfiguration
|
||||
- Identification of CPU and FPU split into separate functions in
|
||||
mainbus/cpu.c
|
||||
- Added new function initialise_fpe() to fpe-sp/fpe.c This is the
|
||||
new initialisation point for the FPE. All vector claiming is done
|
||||
in this routine. Routine is also responsible for IDing the FPE.
|
||||
- ramdisc memory allocation now only ever done in the ramdisc driver
|
||||
- cpu_model now declared in mainbus/cpu.c
|
||||
- rpc_configure() renamed to configure()
|
||||
- added function need_proftick() to clock.c
|
||||
- further development work ARM FPE driver
|
||||
- glue code for ARM FPE written and tested.
|
||||
- ARM FPE now gets first chance as being installed with
|
||||
the existing FPE installed as a fallback if the ARM FPE
|
||||
installation failed.
|
||||
- Hooks for the ARM FPE added in cpu_fork() cpu_exit() and
|
||||
cpu_switch()
|
||||
- Recoding of ether3 driver started.
|
||||
- More debugging code added to trace vnode bug
|
||||
- macro added to syscall.c to handle exit from the syscall handler
|
||||
for special development syscalls.
|
||||
- Vnode bug idenitfied as a corruption of the first word (v_flag)
|
||||
of certain vnodes.
|
||||
- Ether3 driver rewritten and debugged. Now a beta stage driver
|
||||
- Vnode corruption traced to console code.
|
||||
- Ether3 drive now has interface buffer memory tests
|
||||
- vnode corruption traced to do_scrolldown() routine in the
|
||||
console driver.
|
||||
- vnode corruption bug located and fixed. Incorrect loop start and
|
||||
end points when scrolling the character map down (writing beyond
|
||||
allocated memory).
|
||||
- Started work on rewriting the etherB driver
|
||||
- cleaned up various header files
|
||||
- removed stub.c as it was no longer needed
|
||||
- updated strstr.c
|
||||
- hydra code hooks now only compiled in if hydra device is
|
||||
configured
|
||||
- EtherB driver rewritten to match recoding of ether3 driver
|
||||
- EtherB driver now a beta stage driver
|
||||
- Work started on generic driver code for SEEQ EDLC's
|
||||
- vidcvideo device now supports multiple openings
|
||||
- EtherB driver now puts the controller to sleep when not active
|
||||
- strstr() replaced with version borrowed from libc/string/strstr.c
|
||||
|
||||
05/01/96
|
||||
- Further development of ARM FPE
|
||||
- generic fas216 code no longer experimental/NDA
|
||||
- powertec scsi driver no longer experimental/NDA
|
||||
- entry to undefined instruction handlers is now indirected in
|
||||
exception.s
|
||||
- entry to the undefined instruction handlers is made a trapframe
|
||||
on the stack and r0-r12 preserved from exception.
|
||||
- bounce code added so the existing undefined instuction handler
|
||||
can be called with r0 pointing to the trapframe.
|
||||
- new function arm_fpe_copycontext created
|
||||
- fixed the use of FP instructions in sfas.c
|
||||
- fixed errors in the softint code
|
||||
- netns support can be be compiled in the kernel
|
||||
- fixed warnings in fpe-sp/fpe.c and mainbus/cpu.c
|
||||
|
||||
10/01/96
|
||||
- exception.S updated pending new undefined instruction handling
|
||||
code
|
||||
- merged in new wd driver from NetBSD-current
|
||||
- merged in new com driver from NetBSD-current
|
||||
- merged in new fd driver from NetBSD-current
|
||||
- created new file sys_machdep.c for machine dependant syscall stuff
|
||||
- moved sys_sysctl from machdep.c to sys_machdep.c
|
||||
- fixed nested comments in iic.S
|
||||
- removed old bug tracing code from cpuswitch.S
|
||||
- debugged new fd driver
|
||||
|
||||
13/01/96
|
||||
- undefined mode r13 added to the pcb structure
|
||||
- new version of the ARM fpe built
|
||||
- ARM FPE now has core deactivate routine accessible
|
||||
- Call back from ARM FPE added on instruction completion
|
||||
- cpu_switch() now switches UND32 mode r13
|
||||
- cpu_fork() now sets up UND32 mode r13 in pcb
|
||||
- undefined vector now calls stub routine that indirects
|
||||
via address held in data area.
|
||||
- data abort handler address now held in data area rather
|
||||
than text area.
|
||||
- prefetch abort handler address now held in data area rather
|
||||
than text area.
|
||||
- disabled warnings about soft errors from the fd driver
|
||||
|
||||
17/01/96
|
||||
- implemented pmap_resident_count()
|
||||
- fixed the kernel avail_start and avail_end variable. This
|
||||
fixes the divide by zero bug in /bin/ps
|
||||
- ps now reports the correct resident size
|
||||
|
||||
19/01/96
|
||||
- kernel now supports permission faults in UND32 mode.
|
||||
- kernel shell now has kshell> prompt instead of #
|
||||
- ramdisc loading code has been moved from stubs.c to fd.c
|
||||
- ramdisc loading code now uses a rd_conf structure to
|
||||
describe the ramdisc.
|
||||
- rd_hooks.c file added to the arm32/dev directory in
|
||||
order to support the generic ramdisk.
|
||||
- patch to generic ramdisc driver to allow a device match hook
|
||||
- mainbus/ramdisc.c removed.
|
||||
- generic ramdisc has now replaces to mainbus/ramdisc.
|
||||
- fault.c reformatted
|
||||
- new compile symbols introduced to comile in debug code for
|
||||
fault correction.
|
||||
- all remnants of the trace_debug code removed.
|
||||
- armfpe code moved from arm32/fpe-arm/arm32 to arm32/fpe-arm/
|
||||
- fu*() su*() functions moved from libkern into arm32/fusu.c
|
||||
- added code to locore.S to traceback frames on the user process
|
||||
stack
|
||||
- added variable to enable / disable tracing back of user process
|
||||
stacks
|
||||
- added syscall to control user stack trackbacks.
|
||||
- optimised ARM FPE exception delivery code
|
||||
- implemented ARM FPE post processing callback glue
|
||||
- ARM FPE post processor now calls user
|
||||
- ARM FPE post processor optimised to recover some of the
|
||||
performance lost by calling userret()
|
||||
- integrated alpha version of the etherH driver
|
||||
- updated ramdisc hooks to removed the need for a rd_match_hook()
|
||||
function
|
||||
- added Oak to the list of podule manufacturers
|
||||
- kernel now reconised Oak SCSI I cards.
|
||||
- Added generic NCR5380 SCSI driver code
|
||||
- integrating in alpha version of the oak SCSI driver
|
||||
|
||||
26/01/96
|
||||
- merged in latest updates from the NetBSD-current source tree
|
||||
|
||||
29/01/96
|
||||
- code updated for merging into NetBSD source tree
|
||||
|
||||
02/02/96
|
||||
- assembly symbol file now names assym.h instead of assym.s
|
||||
- The symbol LOCORE has been replaced with _LOCORE
|
||||
- ramdisc loading code in now compiled in conditionally on
|
||||
RAMDISK_HOOKS
|
||||
- Further development of hydrabus device.
|
||||
- cpus can noe be attached to both the mainbus and the hydrabus
|
||||
- hooks for hydrabus device updated in pmap.c syscall.c and
|
||||
machdep.c
|
||||
- Extra comments added in exception.S
|
||||
- sizeof(struct trapframe) now defined in assym.h
|
||||
- register fixup for data transfer instruction aborts now handles
|
||||
LDC/STC instructions i.e. hardware executed LDF/STF
|
||||
- configuration files updated for latest devices
|
||||
- fixed use of mkdepend in makefile
|
||||
- fixed the bug that caused panics when issuing the mode change
|
||||
ioctl to the vidcvideo device
|
||||
- console code version number updated
|
||||
- Updated armfpe_post_proc() to take a trapframe pointer as the
|
||||
second argument
|
||||
- updated the armfpe_post_proc_glue() code to fake a trapframe
|
||||
structure from the FPE frame before calling the post proc handler
|
||||
so that sendsig has a valid trapframe in p->p_md.md_regs
|
||||
- updated the armfpe_post_proc_glue() code to patch the FPE frame
|
||||
with data from the trapframe on return from the post proc handler.
|
||||
- signal delivery is now working during FP instructions.
|
||||
- mondef code resurrected and renamed to setdisplay and moved to the
|
||||
stand directory.
|
||||
|
||||
|
||||
NetBSD/arm32 source code is now merged in to the NetBSD source tree.
|
||||
All code changes are now logged via CVS and are available from the
|
||||
NetBSD source-changes mailing list.
|
||||
|
||||
18/10/2001 moving Acorn machines out of arch/arm32 into own arch/acorn32.
|
|
@ -1,81 +0,0 @@
|
|||
/* $NetBSD: interrupts,v 1.1 1996/10/14 22:27:03 mark Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Mark Brinicombe.
|
||||
* 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 Mark Brinicombe.
|
||||
* 4. The name of the company nor the name of the author may 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 OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
Notes on interrupts.
|
||||
|
||||
Ok since interrupts can be chained the return value from an interrupt
|
||||
handler is important.
|
||||
|
||||
The following return values are defined :
|
||||
|
||||
-1 - interrupt may have been for us but not sure so pass it on
|
||||
0 - interrupt no serviced (not ours)
|
||||
interrupt serviced but pass on down the chain
|
||||
1 - interrupt serviced do not pass on down the chain
|
||||
|
||||
The important bit is whether the interrupt should be passed on down
|
||||
the chain of attached interrupt handlers.
|
||||
|
||||
For some interrupts and drivers where only a single device is
|
||||
ever expected, the interrupt should be claimed if it has been serviced.
|
||||
Passing it on down the chain may result in the stray interrupt handler
|
||||
being called.
|
||||
There are however some interrupt that should *always* be passed on down
|
||||
the chain. These are interrupt which may commonly have multiple drivers
|
||||
attached.
|
||||
|
||||
The following interrupts should always be passed on (return value of 0)
|
||||
|
||||
IRQ_TIMER0
|
||||
IRQ_TIMER1
|
||||
IRQ_VSYNC
|
||||
IRQ_FLYBACK
|
||||
IRQ_PODULE
|
||||
|
||||
IRQ_CLOCK (RC7500)
|
||||
|
||||
The following interrupts are recommended to be passed on
|
||||
|
||||
IRQ_DMACH0
|
||||
IRQ_DMACH1
|
||||
IRQ_DMACH2
|
||||
IRQ_DMACH3
|
||||
IRQ_DMASCH0
|
||||
IRQ_DMASCH1
|
||||
|
||||
IRQ_SDMA (RC7500)
|
||||
|
||||
All other interrupts are not expected to be shared and may be claimed
|
||||
when serviced. Stray IRQ handlers may or may not be attached to the end
|
||||
of these irq chains.
|
|
@ -1,298 +0,0 @@
|
|||
/* $NetBSD: majors+minors,v 1.12 2001/02/20 22:58:34 reinoud Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 19941198 Mark Brinicombe.
|
||||
* 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 Mark Brinicombe
|
||||
* for the NetBSD Project.
|
||||
* 4. The name of the company nor the name of the author may 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 OR CONTRIBUTORS 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.
|
||||
*
|
||||
* list of all allocated major numbers
|
||||
*
|
||||
* Created : 17/09/94
|
||||
*/
|
||||
|
||||
List of allocated and reserved major and minor numbers
|
||||
|
||||
The block and character major numbers are ALWAYS allocated together to the
|
||||
same device driver even if the driver does not require both.
|
||||
|
||||
0 B - reserved
|
||||
0 C - memory device
|
||||
minor = 0 - /dev/mem
|
||||
minor = 1 - /dev/kmem
|
||||
minor = 2 - /dev/null
|
||||
minor = 3 - /dev/zero
|
||||
1 B - swap device
|
||||
1 C - psuedo swap device
|
||||
minor = 0 - /dev/drum
|
||||
2 B - reserved
|
||||
2 C - console device
|
||||
minor = 0 - /dev/console
|
||||
3 B - reserved
|
||||
3 C - controlling terminal
|
||||
minor = 0 - /dev/tty
|
||||
4 B - reserved
|
||||
4 C - virtual console
|
||||
/dev/ttyv{unit}
|
||||
unit = minor
|
||||
5 B - reserved
|
||||
5 C - kernel log device
|
||||
minor = 0 - /dev/klog
|
||||
6 B - reserved
|
||||
6 C - psuedo tty master
|
||||
/dev/pty{class}{unit}
|
||||
unit = minor % 16
|
||||
minor / 16 = 0 - class = p
|
||||
minor / 16 = 1 - class = q
|
||||
minor / 16 = 2 - class = r
|
||||
minor / 16 = 3 - class = s
|
||||
minor / 16 = 4 - class = t
|
||||
7 B - reserved
|
||||
7 C - psuedo tty slave
|
||||
/dev/tty{class}{unit}
|
||||
unit = minor % 16
|
||||
minor / 16 = 0 - class = p
|
||||
minor / 16 = 1 - class = q
|
||||
minor / 16 = 2 - class = r
|
||||
minor / 16 = 3 - class = s
|
||||
minor / 16 = 4 - class = t
|
||||
8 B - reserved
|
||||
8 C - parallel printer
|
||||
/dev/lp{class}{unit}
|
||||
unit = minor & 0x1f
|
||||
minor & 0x80 = 0x00 - class = t - interrupt driver
|
||||
minor & 0x80 = 0x80 - class = a - polling driver
|
||||
e.g.
|
||||
0 - /dev/lpt0
|
||||
128 - /dev/lpa0
|
||||
9 B - reserved
|
||||
9 C - quadrature mouse
|
||||
minor = 0 - /dev/quadmouse
|
||||
10 B - reserved
|
||||
10 C - beep device
|
||||
minor = 0 - /dev/beep
|
||||
11 B - reserved
|
||||
11 C - keyboard device
|
||||
minor = 0 - /dev/kbd
|
||||
12 B - reserved
|
||||
12 C - serial port
|
||||
/dev/tty0{unit}
|
||||
unit = minor
|
||||
13 B - reserver
|
||||
13 C - reserved
|
||||
14 B - reserved
|
||||
14 C - reserved
|
||||
15 B - reserved
|
||||
15 C - reserved
|
||||
16 B - ST506/ESDI/IDE disk
|
||||
/dev/wd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
16 C - ST506/ESDI/IDE disk
|
||||
/dev/rwd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
17 B - floppy disk
|
||||
/dev/fd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
17 C - floppy disk
|
||||
/dev/rfd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
18 B - ram disk
|
||||
/dev/rd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
18 C - ram disk
|
||||
/dev/rrd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
19 B - vnode disk driver
|
||||
/dev/vnd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
19 C - vnode disk driver
|
||||
/dev/rvnd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
20 B - reserved (ATAPI CDROM)
|
||||
/dev/acd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
20 C - reserved (ATAPI CDROM)
|
||||
/dev/racd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
21 B - concatenated disk driver
|
||||
/dev/ccd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
21 C - concatenated disk driver
|
||||
/dev/rccd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
22 B - reserved
|
||||
22 C - reserved
|
||||
23 B - reserved
|
||||
23 C - reserved
|
||||
24 B - SCSI disk
|
||||
/dev/sd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
24 C - SCSI disk
|
||||
/dev/rsd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
25 B - SCSI tape
|
||||
25 C - SCSI tape
|
||||
26 B - SCSI cdrom
|
||||
/dev/cd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
26 C - SCSI cdrom
|
||||
/dev/rcd{unit}{partition}
|
||||
partition = minor % 8
|
||||
unit = minor / 8
|
||||
27 B - reserved
|
||||
27 C - SCSI autochanger
|
||||
/dev/ch{unit}
|
||||
unit = minor
|
||||
28 B - reserved
|
||||
28 C - SCSI unknown device
|
||||
/dev/uk{unit}
|
||||
unit = minor
|
||||
29 B - reserved
|
||||
29 C - SCSI scanner device
|
||||
/dev/ss{unit}
|
||||
unit = minor
|
||||
30 B - reserved
|
||||
30 C - reserved
|
||||
31 B - reserved
|
||||
31 C - reserved
|
||||
32 B - reserved
|
||||
32 C - Berkeley packet filter
|
||||
/dev/bpf{unit}
|
||||
unit = minor
|
||||
minor = 0 - /dev/bpf0
|
||||
minor = 1 - /dev/bpf1
|
||||
minor = 2 - /dev/bpf2
|
||||
minor = 3 - /dev/bpf3
|
||||
33 B - reserved
|
||||
33 C - network tunnel
|
||||
/dev/tun{unit}
|
||||
unit = minor
|
||||
minor = 0 - /dev/tun0
|
||||
minor = 1 - /dev/tun1
|
||||
minor = 2 - /dev/tun2
|
||||
34 B - reserved
|
||||
34 C - file descriptor pseudo-device
|
||||
minor = 0 - /dev/stdin
|
||||
minor = 1 - /dev/stdout
|
||||
minor = 2 - /dev/stderr
|
||||
35 B - reserved
|
||||
35 C - loadable module driver
|
||||
minor = 0 - /dev/lkm
|
||||
36 B - reserved
|
||||
36 C - generic audio device
|
||||
37 B - reserved
|
||||
37 C - vidcconsole device
|
||||
minor = 0 - /dev/vidcconsole
|
||||
38 B - reserved
|
||||
38 C - cpu/hydra
|
||||
minor = 0 - /dev/cpu0
|
||||
39 B - reserved
|
||||
39 C - reserved
|
||||
40 B - reserved
|
||||
40 C - PS2 mouse
|
||||
minor = 0 - /dev/pms
|
||||
41 B - reserved
|
||||
41 C - reserved
|
||||
42 B - reserved
|
||||
42 C - IIC device
|
||||
43 B - reserved
|
||||
43 C - RTC device
|
||||
44 B - reserved
|
||||
44 C - reserved (generic video)
|
||||
(/dev/gfx{unit})
|
||||
(unit = minor)
|
||||
45 B - reserved
|
||||
45 C - reserved (virtual console)
|
||||
(/dev/ttyg{unit})
|
||||
(unit = minor)
|
||||
46 B - reserved
|
||||
46 C - ip-filter
|
||||
47 - reserved
|
||||
48 B - reserved
|
||||
48 C - S/PDIF
|
||||
49 B - reserved
|
||||
49 C - ofrom
|
||||
50 B - reserved
|
||||
50 C - smart card (/dev/scr)
|
||||
51 B - reserved
|
||||
51 C - reserved
|
||||
52 B - reserved
|
||||
52 C - random device
|
||||
53 B - reserved
|
||||
53 C - FIQ profiler
|
||||
54 B - reserved
|
||||
54 C - Footbridge diag serial
|
||||
minor = 0 - /dev/fcom
|
||||
55 B - reserved
|
||||
55 C - reserved for bypass device
|
||||
56 B - reserved
|
||||
56 C - ISA jostick
|
||||
57 B - reserved
|
||||
57 C - MIDI I/O
|
||||
58 B - reserved
|
||||
58 C - Sequencer I/O
|
||||
59 B - reserved
|
||||
59 C - reserved for CODA
|
||||
60 B - reserved
|
||||
60 C - wsdisplay device
|
||||
61 B - reserved
|
||||
61 C - wskbd device
|
||||
62 B - reserved
|
||||
62 C - wsmouse device
|
||||
63 B - reserved
|
||||
63 C - reserved
|
||||
64 B - reserved
|
||||
64 C - USB controller
|
||||
65 B - reserved
|
||||
65 C - USB HID
|
||||
66 B - reserved
|
||||
66 C - USB printer
|
||||
67 B - reserved
|
||||
67 C - reserved
|
||||
68 B - reserved
|
||||
68 C - reserved
|
||||
69 B - reserved
|
||||
69 C - reserved
|
||||
|
||||
70+ free for allocation
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: ansi.h,v 1.12 2001/01/11 22:07:57 bjh21 Exp $ */
|
||||
|
||||
#include <arm/ansi.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: aout_machdep.h,v 1.6 2001/01/11 22:07:57 bjh21 Exp $ */
|
||||
|
||||
#include <arm/aout_machdep.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: asm.h,v 1.21 2001/01/11 22:07:57 bjh21 Exp $ */
|
||||
|
||||
#include <arm/asm.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: bswap.h,v 1.3 2001/01/11 22:07:57 bjh21 Exp $ */
|
||||
|
||||
#include <arm/bswap.h>
|
|
@ -1,4 +0,0 @@
|
|||
/* $NetBSD: bus.h,v 1.22 2001/06/18 21:37:33 bjh21 Exp $ */
|
||||
|
||||
#include <arm/bus.h>
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: cdefs.h,v 1.8 2001/01/11 22:07:57 bjh21 Exp $ */
|
||||
|
||||
#include <arm/cdefs.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: cpu.h,v 1.25 2001/02/23 21:23:50 reinoud Exp $ */
|
||||
|
||||
#include <arm/cpu.h>
|
|
@ -1,4 +0,0 @@
|
|||
/* $NetBSD: db_machdep.h,v 1.14 2001/02/23 21:23:50 reinoud Exp $ */
|
||||
|
||||
#include <arm/db_machdep.h>
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: disklabel.h,v 1.7 2001/01/11 22:07:58 bjh21 Exp $ */
|
||||
|
||||
#include <arm/disklabel.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: elf_machdep.h,v 1.2 2001/01/18 17:47:59 tv Exp $ */
|
||||
|
||||
#include <arm/elf_machdep.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: endian.h,v 1.10 2000/03/17 00:09:19 mycroft Exp $ */
|
||||
|
||||
#include <sys/endian.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: endian_machdep.h,v 1.2 2001/02/17 14:55:45 bjh21 Exp $ */
|
||||
|
||||
#include <arm/endian_machdep.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: float.h,v 1.7 2001/01/11 22:07:58 bjh21 Exp $ */
|
||||
|
||||
#include <arm/float.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: fp.h,v 1.5 2001/01/11 22:07:58 bjh21 Exp $ */
|
||||
|
||||
#include <arm/fp.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: frame.h,v 1.9 2001/02/23 21:23:50 reinoud Exp $ */
|
||||
|
||||
#include <arm/arm32/frame.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: ieee.h,v 1.3 2001/01/11 22:07:58 bjh21 Exp $ */
|
||||
|
||||
#include <arm/ieee.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: ieeefp.h,v 1.4 2001/01/11 22:07:59 bjh21 Exp $ */
|
||||
|
||||
#include <arm/ieeefp.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: int_const.h,v 1.1 2001/04/14 22:38:35 kleink Exp $ */
|
||||
|
||||
#include <arm/int_const.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: int_fmtio.h,v 1.1 2001/04/15 17:13:07 kleink Exp $ */
|
||||
|
||||
#include <arm/int_fmtio.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: int_limits.h,v 1.1 2001/04/15 15:29:04 kleink Exp $ */
|
||||
|
||||
#include <arm/int_limits.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: int_mwgwtypes.h,v 1.1 2001/04/14 12:19:51 kleink Exp $ */
|
||||
|
||||
#include <arm/int_mwgwtypes.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: int_types.h,v 1.4 2001/01/11 22:07:59 bjh21 Exp $ */
|
||||
|
||||
#include <arm/int_types.h>
|
|
@ -1,4 +0,0 @@
|
|||
/* $NetBSD: ipkdb.h,v 1.2 2001/02/23 21:23:50 reinoud Exp $ */
|
||||
|
||||
#include <arm/ipkdb.h>
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: isa_machdep.h,v 1.9 2001/02/23 21:23:50 reinoud Exp $ */
|
||||
|
||||
#include <arm/isa_machdep.h>
|
|
@ -1,4 +0,0 @@
|
|||
/* $NetBSD: isapnp_machdep.h,v 1.6 2001/02/23 21:23:50 reinoud Exp $ */
|
||||
|
||||
#include <arm/isapnp_machdep.h>
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: limits.h,v 1.9 2001/01/11 22:07:59 bjh21 Exp $ */
|
||||
|
||||
#include <arm/limits.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: lock.h,v 1.3 2001/01/11 22:07:59 bjh21 Exp $ */
|
||||
|
||||
#include <arm/lock.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: math.h,v 1.4 2001/01/11 22:07:59 bjh21 Exp $ */
|
||||
|
||||
#include <arm/math.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: ofisa_machdep.h,v 1.8 2001/02/23 21:23:50 reinoud Exp $ */
|
||||
|
||||
#include <arm/ofisa_machdep.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: ofw.h,v 1.4 2001/02/23 21:27:46 reinoud Exp $ */
|
||||
|
||||
#include <arm/ofw.h>
|
|
@ -1,4 +0,0 @@
|
|||
/* $NetBSD: pcb.h,v 1.6 2001/09/03 19:20:28 matt Exp $ */
|
||||
|
||||
#include <arm/pcb.h>
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
/* $NetBSD: pci_machdep.h,v 1.9 2001/06/08 04:48:56 simonb Exp $ */
|
||||
|
||||
#include <arm/pci_machdep.h>
|
||||
|
||||
#define __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: pio.h,v 1.4 2001/02/23 21:23:51 reinoud Exp $ */
|
||||
|
||||
#include <arm/pio.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: pmap.h,v 1.20 2001/11/23 17:29:01 thorpej Exp $ */
|
||||
|
||||
#include <arm/arm32/pmap.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: proc.h,v 1.4 2001/02/23 21:23:51 reinoud Exp $ */
|
||||
|
||||
#include <arm/proc.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: profile.h,v 1.10 2001/02/23 21:23:51 reinoud Exp $ */
|
||||
|
||||
#include <arm/profile.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: ptrace.h,v 1.4 2001/02/11 17:03:06 bjh21 Exp $ */
|
||||
|
||||
#include <arm/ptrace.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: reg.h,v 1.5 2001/02/11 14:51:57 bjh21 Exp $ */
|
||||
|
||||
#include <arm/reg.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: rtc.h,v 1.7 2001/02/23 21:23:51 reinoud Exp $ */
|
||||
|
||||
#include <arm/arm32/rtc.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: setjmp.h,v 1.7 2001/01/11 22:07:59 bjh21 Exp $ */
|
||||
|
||||
#include <arm/setjmp.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: signal.h,v 1.9 2001/01/13 17:02:37 bjh21 Exp $ */
|
||||
|
||||
#include <arm/signal.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: stdarg.h,v 1.9 2001/01/11 22:08:00 bjh21 Exp $ */
|
||||
|
||||
#include <arm/stdarg.h>
|
|
@ -1,4 +0,0 @@
|
|||
/* $NetBSD: sysarch.h,v 1.7 2001/07/14 00:23:10 matt Exp $ */
|
||||
|
||||
#include <arm/sysarch.h>
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: trap.h,v 1.4 2001/01/11 22:08:00 bjh21 Exp $ */
|
||||
|
||||
#include <arm/trap.h>
|
|
@ -1,3 +0,0 @@
|
|||
/* $NetBSD: varargs.h,v 1.5 2001/01/11 22:08:00 bjh21 Exp $ */
|
||||
|
||||
#include <arm/varargs.h>
|
|
@ -1,151 +0,0 @@
|
|||
/* $NetBSD: shark_fiq.S,v 1.1 2001/12/20 01:20:27 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997
|
||||
* Digital Equipment Corporation. All rights reserved.
|
||||
*
|
||||
* This software is furnished under license and may be used and
|
||||
* copied only in accordance with the following terms and conditions.
|
||||
* Subject to these conditions, you may download, copy, install,
|
||||
* use, modify and distribute this software in source and/or binary
|
||||
* form. No title or ownership is transferred hereby.
|
||||
*
|
||||
* 1) Any source code used, modified or distributed must reproduce
|
||||
* and retain this copyright notice and list of conditions as
|
||||
* they appear in the source file.
|
||||
*
|
||||
* 2) No right is granted to use any trade name, trademark, or logo of
|
||||
* Digital Equipment Corporation. Neither the "Digital Equipment
|
||||
* Corporation" name nor any trademark or logo of Digital Equipment
|
||||
* Corporation may be used to endorse or promote products derived
|
||||
* from this software without the prior written permission of
|
||||
* Digital Equipment Corporation.
|
||||
*
|
||||
* 3) This software is provided "AS-IS" and any express or implied
|
||||
* warranties, including but not limited to, any implied warranties
|
||||
* of merchantability, fitness for a particular purpose, or
|
||||
* non-infringement are disclaimed. In no event shall DIGITAL be
|
||||
* liable for any damages whatsoever, and in particular, DIGITAL
|
||||
* shall not be liable for special, indirect, consequential, or
|
||||
* incidental damages or damages for lost profits, loss of
|
||||
* revenue or loss of use, whether such damages arise in contract,
|
||||
* negligence, tort, under statute, in equity, at law or otherwise,
|
||||
* even if advised of the possibility of such damage.
|
||||
*/
|
||||
|
||||
/*
|
||||
* fiq.S
|
||||
*
|
||||
* Low level fiq handlers
|
||||
*
|
||||
* Created : 19/05/97
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <arm32/shark/shark_fiq.h>
|
||||
#include <arm32/shark/sequoia.h>
|
||||
|
||||
sp .req r13
|
||||
lr .req r14
|
||||
pc .req r15
|
||||
|
||||
.text
|
||||
|
||||
/* this variable is used to detect when it is necessary to unwedge the
|
||||
sequoia SMI/PMI edge detect logic. *sigh* */
|
||||
Lfiqs_happened:
|
||||
.word _C_LABEL(fiqs_happened)
|
||||
Lsequoia_index_cache:
|
||||
.word _C_LABEL(sequoia_index_cache)
|
||||
|
||||
.data
|
||||
.global _C_LABEL(fiqs_happened)
|
||||
_C_LABEL(fiqs_happened):
|
||||
.word 0
|
||||
|
||||
.text
|
||||
|
||||
.global _C_LABEL(shark_fiq)
|
||||
.global _C_LABEL(shark_fiq_end)
|
||||
|
||||
/*
|
||||
* r8 - VAM_IO_DATA = address of IO space in virtual memory
|
||||
* r9 - C routine to call (0 => no routine)
|
||||
* r10 - argument (0 => pass PMI reason register)
|
||||
* r11 - scratch
|
||||
* r12 - scratch
|
||||
* r13 - stack for C routine call
|
||||
*/
|
||||
|
||||
_C_LABEL(shark_fiq):
|
||||
/* clear the FIQ immediately */
|
||||
/* do the FIQ/SMI clear here to avoid synchronization problems!
|
||||
both the chip enable (caused by the ISA register read) and
|
||||
the sequoia bit clear must be done. do it in that order so
|
||||
the sequoia port accesses will clear the chip enable caused
|
||||
by accessing FIQ_CLEAR_IOPORT
|
||||
*/
|
||||
/* set up to read/write the power management status register */
|
||||
ldr r11, Lsequoia_index_cache
|
||||
ldr r12, [r11]
|
||||
|
||||
/* see if the index is properly set. unfortunately, the common
|
||||
case will probably be that the FIQ handler (e.g. smartcard)
|
||||
talks to the sequoia, so the index will need to be set. */
|
||||
cmp r12, #PMC_PMSR_REG
|
||||
movne r12, #PMC_PMSR_REG
|
||||
#ifdef STRH
|
||||
strneh r12, [r8, #SEQUOIA_INDEX]
|
||||
#else
|
||||
.word 0x11c8c2b4
|
||||
#endif
|
||||
strne r12, [r11]
|
||||
|
||||
/* set SMIACT by changing the power management mode to sleep */
|
||||
mov r12, #PMMD_SLEEP
|
||||
#ifdef STRH
|
||||
strh r12, [r8, #SEQUOIA_DATA]
|
||||
#else
|
||||
.word 0xe1c8c2b6
|
||||
#endif
|
||||
|
||||
/* get the PMI reason register, if desired */
|
||||
cmp r10, #0
|
||||
#ifdef LDRH
|
||||
ldreqh r10, [r8, #SEQUOIA_DATA]
|
||||
#else
|
||||
.word 0x01d8a2b6 /* ldrh r10, [r8, #0x26] */
|
||||
#endif
|
||||
|
||||
/* simultaneously clear the PMI reason bits and clear SMIACT */
|
||||
mov r12, #PMMD_ON
|
||||
orr r12, r12, #PMSR_M_PMISRC
|
||||
#ifdef STRH
|
||||
strh r12, [r8, #SEQUOIA_DATA]
|
||||
#else
|
||||
.word 0xe1c8c2b6
|
||||
#endif
|
||||
|
||||
ldr r12, Lfiqs_happened
|
||||
ldr r11, [r12]
|
||||
add r11, r11, #1
|
||||
str r11, [r12]
|
||||
|
||||
cmp r9, #0
|
||||
subeqs pc, lr, #4 /* no routine => return from trap */
|
||||
|
||||
/* assume that the C routine follows the ARM procedure call standard.
|
||||
save only user registers and let the C code save the rest.
|
||||
r0-r3, r12, r14 clobbered. other regs should be restored
|
||||
by C code.
|
||||
*/
|
||||
stmfd sp!, {r0-r3, lr} /* save user registers */
|
||||
mov r0, r10 /* pass the PMI reason register */
|
||||
mov lr, pc /* call C routine */
|
||||
mov pc, r9
|
||||
ldmfd sp!, {r0-r3, lr} /* restore user registers */
|
||||
subs pc, lr, #4 /* return from trap */
|
||||
_C_LABEL(shark_fiq_end):
|
||||
|
||||
/* End of fiq.S */
|
|
@ -1,5 +0,0 @@
|
|||
# $NetBSD: Makefile,v 1.1 2002/02/06 21:30:41 thorpej Exp $
|
||||
|
||||
SUBDIR= ofwboot
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -1,5 +0,0 @@
|
|||
# $NetBSD: Makefile.inc,v 1.1 2002/02/06 21:30:41 thorpej Exp $
|
||||
|
||||
BINDIR= /usr/mdec
|
||||
|
||||
CPPFLAGS+= -D_STANDALONE
|
|
@ -1,3 +0,0 @@
|
|||
$NetBSD: version,v 1.1 2001/11/01 22:50:19 thorpej Exp $
|
||||
|
||||
1.1: Boot program for OpenFirmware; initial revision
|
|
@ -0,0 +1,29 @@
|
|||
# $NetBSD: Makefile,v 1.1 2002/02/10 01:56:59 thorpej Exp $
|
||||
|
||||
# Makefile for shark tags file and boot blocks
|
||||
|
||||
TSHARK= ../shark/tags
|
||||
SSHARK= ../shark/shark/*.[ch] ../shark/include/*.h \
|
||||
../shark/isa/*.[ch] ../shark/ofw/*.[ch]
|
||||
ASHARK= ../shark/isa/*.S ../shark/shark/*.S
|
||||
|
||||
# Directories in which to place tags links
|
||||
DSHARK= isa include ofw
|
||||
|
||||
.include "../../kern/Make.tags.inc"
|
||||
|
||||
tags:
|
||||
-ctags -wdtf ${TSHARK} ${SSHARK} ${COMM}
|
||||
egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${ASHARK} | \
|
||||
sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
|
||||
>> ${TSHARK}
|
||||
sort -o ${TSHARK} ${TSHARK}
|
||||
|
||||
links:
|
||||
-for i in ${DSHARK}; do \
|
||||
cd $$i && rm -f tags; ln -s ../tags tags; done
|
||||
|
||||
|
||||
SUBDIR= include
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -1,3 +1,3 @@
|
|||
$NetBSD: .keep_me,v 1.1 1996/01/31 23:19:04 mark Exp $
|
||||
$NetBSD: .keep_me,v 1.1 2002/02/10 01:57:00 thorpej Exp $
|
||||
|
||||
This file must remain so that 'cvs checkout' makes the compile directory.
|
|
@ -1,12 +1,11 @@
|
|||
# $NetBSD: SHARK,v 1.46 2002/02/06 21:30:28 thorpej Exp $
|
||||
# From: NetBSD: GENERIC,v 1.72 2000/08/04 02:17:46 hubertf Exp
|
||||
# $NetBSD: GENERIC,v 1.1 2002/02/10 01:57:00 thorpej Exp $
|
||||
#
|
||||
# SHARK
|
||||
# Generic Shark configuration.
|
||||
#
|
||||
|
||||
include "arch/arm32/conf/std.arm32"
|
||||
include "arch/shark/conf/std.shark"
|
||||
|
||||
#ident "GENERIC-$Revision: 1.46 $"
|
||||
#ident "GENERIC-$Revision: 1.1 $"
|
||||
|
||||
# estimated number of users
|
||||
maxusers 32
|
|
@ -1,11 +1,9 @@
|
|||
# $NetBSD: SHARKINST,v 1.13 2002/02/06 21:30:28 thorpej Exp $
|
||||
# From: NetBSD: SHARK,v 1.23 1999/06/26 06:56:26 cgd Exp
|
||||
# $NetBSD: INSTALL,v 1.1 2002/02/10 01:57:01 thorpej Exp $
|
||||
#
|
||||
# SHARK Install Kernel
|
||||
# XXX can't just 'include' SHARK because of config lines.
|
||||
# Shark installation kernel
|
||||
#
|
||||
|
||||
include "arch/arm32/conf/std.arm32"
|
||||
include "arch/shark/conf/std.shark"
|
||||
|
||||
# estimated number of users
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# $NetBSD: Makefile.arm32.inc,v 1.1 2002/02/06 19:59:41 thorpej Exp $
|
||||
# $NetBSD: Makefile.shark.inc,v 1.1 2002/02/10 01:57:02 thorpej Exp $
|
||||
|
||||
GENASSYM_EXTRAS+= ${THISARM}/arm32/genassym.cf
|
||||
GENASSYM_EXTRAS+= ${THISARM}/shark/genassym.cf
|
||||
|
||||
.if (${OBJECT_FMT} == "ELF")
|
||||
# Need to convert the kernel from ELF to a.out so that OpenFirmware
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: OFWGENCFG,v 1.17 2002/02/06 21:30:27 thorpej Exp $
|
||||
# $NetBSD: OFWGENCFG,v 1.1 2002/02/10 01:57:02 thorpej Exp $
|
||||
#
|
||||
# OFWGENCFG: 'generic' configuration for Open Firmware boards.
|
||||
#
|
||||
|
@ -6,8 +6,8 @@
|
|||
# close enough to generic).
|
||||
#
|
||||
|
||||
include "arch/arm32/conf/std.arm32"
|
||||
include "arch/arm32/conf/std.ofwgencfg"
|
||||
include "arch/shark/conf/std.arm32"
|
||||
include "arch/shark/conf/std.ofwgencfg"
|
||||
|
||||
# estimated number of users
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.arm32,v 1.135 2002/02/06 21:30:28 thorpej Exp $
|
||||
# $NetBSD: files.shark,v 1.1 2002/02/10 01:57:03 thorpej Exp $
|
||||
#
|
||||
# First try for arm-specific configuration info
|
||||
#
|
||||
|
@ -43,42 +43,42 @@ major {wd = 16}
|
|||
include "dev/ofw/files.ofw"
|
||||
include "arch/arm/ofw/files.ofw"
|
||||
attach ofbus at root with ofbus_root
|
||||
file arch/arm32/ofw/ofw.c
|
||||
file arch/arm32/ofw/oftodclock.c
|
||||
file arch/shark/ofw/ofw.c
|
||||
file arch/shark/ofw/oftodclock.c
|
||||
|
||||
# OFW console initialization
|
||||
file arch/arm32/ofw/consinit.c
|
||||
file arch/shark/ofw/consinit.c
|
||||
file dev/cninit.c
|
||||
|
||||
# ISA DMA glue
|
||||
file arch/arm32/isa/isadma_machdep.c isadma
|
||||
file arch/shark/isa/isadma_machdep.c isadma
|
||||
|
||||
# Game adapter (joystick)
|
||||
file arch/arm32/isa/joy_timer.c joy
|
||||
file arch/shark/isa/joy_timer.c joy
|
||||
|
||||
# OFW ISA bus driver.
|
||||
include "dev/ofisa/files.ofisa"
|
||||
file arch/arm32/ofw/ofisa_machdep.c ofisa
|
||||
file arch/arm32/ofw/com_ofisa_machdep.c com_ofisa
|
||||
file arch/arm32/ofw/com_ofisa_consolehack.c com_ofisa # XXX
|
||||
file arch/arm32/ofw/if_cs_ofisa_machdep.c cs_ofisa
|
||||
file arch/arm32/ofw/lpt_ofisa_machdep.c lpt_ofisa
|
||||
file arch/arm32/ofw/wdc_ofisa_machdep.c wdc_ofisa
|
||||
file arch/shark/ofw/ofisa_machdep.c ofisa
|
||||
file arch/shark/ofw/com_ofisa_machdep.c com_ofisa
|
||||
file arch/shark/ofw/com_ofisa_consolehack.c com_ofisa # XXX
|
||||
file arch/shark/ofw/if_cs_ofisa_machdep.c cs_ofisa
|
||||
file arch/shark/ofw/lpt_ofisa_machdep.c lpt_ofisa
|
||||
file arch/shark/ofw/wdc_ofisa_machdep.c wdc_ofisa
|
||||
|
||||
# Glue for OFW ISA device attachment
|
||||
device ofisapc {}
|
||||
attach ofisapc at ofbus
|
||||
file arch/arm32/ofw/ofisapc.c pc
|
||||
file arch/shark/ofw/ofisapc.c pc
|
||||
device ofisascr {}
|
||||
attach ofisascr at ofisa
|
||||
file arch/arm32/ofw/ofisascr.c scr
|
||||
file arch/shark/ofw/ofisascr.c scr
|
||||
|
||||
device ofrom
|
||||
attach ofrom at ofbus
|
||||
file arch/arm32/ofw/ofrom.c ofrom needs-flag
|
||||
file arch/shark/ofw/ofrom.c ofrom needs-flag
|
||||
|
||||
# Memory disk driver
|
||||
file arch/arm32/dev/md_hooks.c md & memory_disk_hooks
|
||||
file arch/shark/dev/md_hooks.c md & memory_disk_hooks
|
||||
major {md = 18}
|
||||
|
||||
# RAIDframe
|
||||
|
@ -90,13 +90,13 @@ define spckbd { [irq = -1], [port = -1] }
|
|||
|
||||
# PS/2 mouse device
|
||||
device opms: tty
|
||||
file arch/arm32/shark/pms.c opms needs-flag
|
||||
file arch/shark/shark/pms.c opms needs-flag
|
||||
|
||||
attach opms at spckbd with opms
|
||||
|
||||
device todclock
|
||||
attach todclock at todservice
|
||||
file arch/arm32/dev/todclock.c todclock needs-count
|
||||
file arch/shark/dev/todclock.c todclock needs-count
|
||||
|
||||
#
|
||||
# Machine-independent SCSI drivers
|
||||
|
@ -107,8 +107,8 @@ major {sd = 24}
|
|||
major {cd = 26}
|
||||
|
||||
# Generic MD files
|
||||
file arch/arm32/arm32/autoconf.c
|
||||
file arch/arm32/arm32/conf.c
|
||||
file arch/shark/shark/autoconf.c
|
||||
file arch/shark/shark/conf.c
|
||||
|
||||
file arch/arm/arm/disksubr.c disk
|
||||
file arch/arm/arm/disksubr_acorn.c disk
|
||||
|
@ -118,34 +118,34 @@ file arch/arm/arm32/intr.c
|
|||
file arch/arm/arm32/spl.S
|
||||
|
||||
# Shark specific files
|
||||
file arch/arm32/shark/shark_machdep.c shark
|
||||
file arch/arm32/shark/sequoia.c shark
|
||||
file arch/arm32/shark/shark_fiq.S shark
|
||||
file arch/arm32/shark/hat.c shark
|
||||
file arch/arm32/isa/isa_irqhandler.c shark
|
||||
file arch/arm32/isa/clock.c shark
|
||||
file arch/arm32/isa/isa_irq.S shark
|
||||
file arch/arm32/isa/isa_shark_machdep.c shark
|
||||
file arch/arm32/isa/isa_io.c shark | isa
|
||||
file arch/arm32/isa/isa_io_asm.S shark | isa
|
||||
file arch/shark/shark/shark_machdep.c shark
|
||||
file arch/shark/shark/sequoia.c shark
|
||||
file arch/shark/shark/shark_fiq.S shark
|
||||
file arch/shark/shark/hat.c shark
|
||||
file arch/shark/isa/isa_irqhandler.c shark
|
||||
file arch/shark/isa/clock.c shark
|
||||
file arch/shark/isa/isa_irq.S shark
|
||||
file arch/shark/isa/isa_shark_machdep.c shark
|
||||
file arch/shark/isa/isa_io.c shark | isa
|
||||
file arch/shark/isa/isa_io_asm.S shark | isa
|
||||
|
||||
# National Semiconductor PC97307VUL SuperIO chip configuration routines
|
||||
define nsio
|
||||
file arch/arm32/shark/ns87307.c nsio & shark
|
||||
file arch/shark/shark/ns87307.c nsio & shark
|
||||
|
||||
# 8042 microcontroller routines for keyboard and mouse
|
||||
define i8042
|
||||
file arch/arm32/shark/i8042.c i8042
|
||||
file arch/shark/shark/i8042.c i8042
|
||||
|
||||
defpseudo profiler: disk
|
||||
file arch/arm32/shark/profile.c profiler needs-flag
|
||||
file arch/shark/shark/profile.c profiler needs-flag
|
||||
|
||||
# SHARK pc console
|
||||
device pc: tty, spckbd, i8042
|
||||
attach pc at ofisapc
|
||||
file arch/arm32/shark/pccons.c pc needs-flag
|
||||
file arch/shark/shark/pccons.c pc needs-flag
|
||||
|
||||
# Smart Card Reader
|
||||
device scr: tty
|
||||
file arch/arm32/shark/scr.c scr needs-flag
|
||||
file arch/shark/shark/scr.c scr needs-flag
|
||||
attach scr at ofisascr
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: std.ofwgencfg,v 1.1 2002/02/06 21:30:29 thorpej Exp $
|
||||
# $NetBSD: std.ofwgencfg,v 1.1 2002/02/10 01:57:04 thorpej Exp $
|
||||
#
|
||||
# Configuration options for generic OpenFirmware configurations.
|
||||
#
|
|
@ -1,8 +1,8 @@
|
|||
# $NetBSD: std.arm32,v 1.15 2002/02/06 21:30:29 thorpej Exp $
|
||||
# $NetBSD: std.shark,v 1.1 2002/02/10 01:57:04 thorpej Exp $
|
||||
#
|
||||
# standard NetBSD/arm32 options
|
||||
# standard NetBSD/shark options
|
||||
|
||||
machine arm32 arm
|
||||
machine shark arm
|
||||
|
||||
options EXEC_AOUT
|
||||
options EXEC_ELF32
|
|
@ -1,7 +1,7 @@
|
|||
# $NetBSD: Makefile,v 1.25 2001/11/26 20:41:43 thorpej Exp $
|
||||
# $NetBSD#
|
||||
|
||||
KDIR= /sys/arch/arm32/include
|
||||
INCSDIR= /usr/include/arm32
|
||||
KDIR= /sys/arch/shark/include
|
||||
INCSDIR= /usr/include/shark
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h \
|
||||
bswap.h bus.h \
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: ansi.h,v 1.1 2002/02/10 01:57:06 thorpej Exp $ */
|
||||
|
||||
#include <arm/ansi.h>
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: aout_machdep.h,v 1.1 2002/02/10 01:57:07 thorpej Exp $ */
|
||||
|
||||
#include <arm/aout_machdep.h>
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: asm.h,v 1.1 2002/02/10 01:57:07 thorpej Exp $ */
|
||||
|
||||
#include <arm/asm.h>
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: beep.h,v 1.3 1997/10/14 09:20:02 mark Exp $ */
|
||||
/* $NetBSD: beep.h,v 1.1 2002/02/10 01:57:08 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) Mark Brinicombe 1995 All rights reserved
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bootconfig.h,v 1.10 2001/03/20 12:48:37 reinoud Exp $ */
|
||||
/* $NetBSD: bootconfig.h,v 1.1 2002/02/10 01:57:08 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Mark Brinicombe.
|
||||
|
@ -42,69 +42,11 @@
|
|||
* Based on kate/boot/bootconfig.h
|
||||
*/
|
||||
|
||||
#include "opt_footbridge.h"
|
||||
|
||||
typedef struct _PhysMem {
|
||||
u_int address;
|
||||
u_int pages;
|
||||
} PhysMem;
|
||||
|
||||
#if defined(_KERNEL) && (defined(RISCPC) || defined(RC7500))
|
||||
|
||||
#define DRAM_BLOCKS 4
|
||||
typedef struct _BootConfig {
|
||||
u_int kernvirtualbase;
|
||||
u_int kernphysicalbase;
|
||||
u_int kernsize;
|
||||
u_int argvirtualbase;
|
||||
u_int argphysicalbase;
|
||||
u_int argsize;
|
||||
u_int scratchvirtualbase;
|
||||
u_int scratchphysicalbase;
|
||||
u_int scratchsize;
|
||||
|
||||
u_int display_start;
|
||||
u_int display_size;
|
||||
u_int width;
|
||||
u_int height;
|
||||
u_int log2_bpp;
|
||||
|
||||
PhysMem dram[DRAM_BLOCKS];
|
||||
PhysMem vram[1];
|
||||
|
||||
u_int dramblocks;
|
||||
u_int vramblocks;
|
||||
u_int pagesize;
|
||||
u_int drampages;
|
||||
u_int vrampages;
|
||||
|
||||
char kernelname[80];
|
||||
|
||||
u_int framerate;
|
||||
u_char machine_id[4];
|
||||
u_int magic;
|
||||
u_int display_phys;
|
||||
} BootConfig;
|
||||
|
||||
#define OLD_BOOTCONFIG_MAGIC 0x42301068
|
||||
#define BOOTCONFIG_MAGIC 0x43112233
|
||||
|
||||
extern BootConfig bootconfig;
|
||||
#endif /* _KERNEL && (RISCPC || RC7500) */
|
||||
|
||||
#if defined(_KERNEL) && defined(FOOTBRIDGE)
|
||||
|
||||
#define DRAM_BLOCKS 1
|
||||
|
||||
typedef struct _BootConfig {
|
||||
PhysMem dram[DRAM_BLOCKS];
|
||||
u_int dramblocks;
|
||||
} BootConfig;
|
||||
|
||||
extern BootConfig bootconfig;
|
||||
#define MAX_BOOT_STRING 255
|
||||
#endif /* _KERNEL && FOOTBRIDGE */
|
||||
|
||||
#if defined(_KERNEL) && defined(OFW)
|
||||
/*
|
||||
* Currently several bootconfig structure members are used
|
||||
|
@ -147,5 +89,3 @@ int get_bootconf_option __P((char *string, char *option, int type, void *result)
|
|||
extern char *boot_args;
|
||||
extern char *boot_file;
|
||||
#endif /* _KERNEL */
|
||||
|
||||
/* End of bootconfig.h */
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: bswap.h,v 1.1 2002/02/10 01:57:09 thorpej Exp $ */
|
||||
|
||||
#include <arm/bswap.h>
|
|
@ -0,0 +1,4 @@
|
|||
/* $NetBSD: bus.h,v 1.1 2002/02/10 01:57:10 thorpej Exp $ */
|
||||
|
||||
#include <arm/bus.h>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: cdefs.h,v 1.1 2002/02/10 01:57:11 thorpej Exp $ */
|
||||
|
||||
#include <arm/cdefs.h>
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: conf.h,v 1.19 2001/03/26 12:33:23 lukem Exp $ */
|
||||
/* $NetBSD: conf.h,v 1.1 2002/02/10 01:57:11 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe.
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: cpu.h,v 1.1 2002/02/10 01:57:12 thorpej Exp $ */
|
||||
|
||||
#include <arm/cpu.h>
|
|
@ -0,0 +1,4 @@
|
|||
/* $NetBSD: db_machdep.h,v 1.1 2002/02/10 01:57:12 thorpej Exp $ */
|
||||
|
||||
#include <arm/db_machdep.h>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: devmap.h,v 1.2 1998/07/08 07:56:13 thorpej Exp $ */
|
||||
/* $NetBSD: devmap.h,v 1.1 2002/02/10 01:57:13 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: disklabel.h,v 1.1 2002/02/10 01:57:14 thorpej Exp $ */
|
||||
|
||||
#include <arm/disklabel.h>
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: elf_machdep.h,v 1.1 2002/02/10 01:57:14 thorpej Exp $ */
|
||||
|
||||
#include <arm/elf_machdep.h>
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: endian.h,v 1.1 2002/02/10 01:57:15 thorpej Exp $ */
|
||||
|
||||
#include <sys/endian.h>
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: endian_machdep.h,v 1.1 2002/02/10 01:57:15 thorpej Exp $ */
|
||||
|
||||
#include <arm/endian_machdep.h>
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: float.h,v 1.1 2002/02/10 01:57:15 thorpej Exp $ */
|
||||
|
||||
#include <arm/float.h>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue