Home | History | Annotate | Line # | Download | only in dev
adbvar.h revision 1.12
      1  1.12  christos /*	$NetBSD: adbvar.h,v 1.12 2007/03/04 06:00:10 christos Exp $	*/
      2   1.1    tsubai 
      3   1.1    tsubai /*-
      4   1.1    tsubai  * Copyright (C) 1994	Bradley A. Grantham
      5   1.1    tsubai  * All rights reserved.
      6   1.1    tsubai  *
      7   1.1    tsubai  * Redistribution and use in source and binary forms, with or without
      8   1.1    tsubai  * modification, are permitted provided that the following conditions
      9   1.1    tsubai  * are met:
     10   1.1    tsubai  * 1. Redistributions of source code must retain the above copyright
     11   1.1    tsubai  *    notice, this list of conditions and the following disclaimer.
     12   1.1    tsubai  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1    tsubai  *    notice, this list of conditions and the following disclaimer in the
     14   1.1    tsubai  *    documentation and/or other materials provided with the distribution.
     15   1.1    tsubai  * 3. All advertising materials mentioning features or use of this software
     16   1.1    tsubai  *    must display the following acknowledgement:
     17   1.1    tsubai  *	This product includes software developed by Bradley A. Grantham.
     18   1.1    tsubai  * 4. The name of the author may not be used to endorse or promote products
     19   1.1    tsubai  *    derived from this software without specific prior written permission.
     20   1.1    tsubai  *
     21   1.1    tsubai  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22   1.1    tsubai  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23   1.1    tsubai  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24   1.1    tsubai  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25   1.1    tsubai  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26   1.1    tsubai  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27   1.1    tsubai  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28   1.1    tsubai  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29   1.1    tsubai  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     30   1.1    tsubai  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31   1.1    tsubai  */
     32   1.1    tsubai 
     33   1.1    tsubai #include <machine/adbsys.h>
     34   1.2    tsubai 
     35   1.2    tsubai /*
     36   1.2    tsubai  * Arguments used to attach a device to the Apple Desktop Bus
     37   1.2    tsubai  */
     38   1.2    tsubai struct adb_attach_args {
     39   1.3    tsubai 	int	origaddr;
     40   1.3    tsubai 	int	adbaddr;
     41   1.3    tsubai 	int	handler_id;
     42   1.2    tsubai };
     43   1.1    tsubai 
     44   1.1    tsubai typedef struct adb_trace_xlate_s {
     45   1.1    tsubai 	int     params;
     46   1.1    tsubai 	char   *string;
     47   1.1    tsubai }       adb_trace_xlate_t;
     48   1.1    tsubai 
     49   1.1    tsubai extern adb_trace_xlate_t adb_trace_xlations[];
     50   1.1    tsubai 
     51   1.1    tsubai #ifdef DEBUG
     52   1.1    tsubai #ifndef ADB_DEBUG
     53   1.1    tsubai #define ADB_DEBUG
     54   1.1    tsubai #endif
     55   1.3    tsubai #endif
     56   1.3    tsubai 
     57   1.3    tsubai #ifdef ADB_DEBUG
     58   1.1    tsubai extern int	adb_debug;
     59   1.1    tsubai #endif
     60   1.1    tsubai 
     61  1.12  christos typedef void *Ptr;
     62  1.12  christos typedef void **Handle;
     63   1.1    tsubai 
     64   1.1    tsubai /* ADB Manager */
     65   1.1    tsubai typedef struct {
     66   1.1    tsubai 	Ptr siServiceRtPtr;
     67   1.1    tsubai 	Ptr siDataAreaAddr;
     68   1.1    tsubai } ADBSetInfoBlock;
     69   1.1    tsubai typedef struct {
     70   1.1    tsubai 	unsigned char	devType;
     71   1.1    tsubai 	unsigned char	origADBAddr;
     72   1.1    tsubai 	Ptr		dbServiceRtPtr;
     73   1.1    tsubai 	Ptr		dbDataAreaAddr;
     74   1.1    tsubai } ADBDataBlock;
     75   1.1    tsubai 
     76   1.1    tsubai struct adb_softc {
     77   1.1    tsubai 	struct device sc_dev;
     78   1.1    tsubai 	char *sc_regbase;
     79   1.1    tsubai };
     80   1.6    itojun 
     81  1.12  christos typedef void (adbComp)(void *, volatile int *, int);
     82  1.10   nathanw 
     83   1.6    itojun /* adb_direct.c */
     84   1.6    itojun extern int adbHardware;
     85   1.1    tsubai 
     86   1.1    tsubai /* types of adb hardware that we (will eventually) support */
     87   1.1    tsubai #define ADB_HW_UNKNOWN		0x01	/* don't know */
     88   1.1    tsubai #define ADB_HW_II		0x02	/* Mac II series */
     89   1.1    tsubai #define ADB_HW_IISI		0x03	/* Mac IIsi series */
     90   1.8    briggs #define ADB_HW_PMU		0x04	/* PowerBook series */
     91   1.1    tsubai #define ADB_HW_CUDA		0x05	/* Machines with a Cuda chip */
     92   1.1    tsubai 
     93   1.3    tsubai #define ADB_CMDADDR(cmd)	((u_int8_t)((cmd) & 0xf0) >> 4)
     94   1.3    tsubai #define ADBFLUSH(dev)		((((u_int8_t)(dev) & 0x0f) << 4) | 0x01)
     95   1.3    tsubai #define ADBLISTEN(dev, reg)	((((u_int8_t)(dev) & 0x0f) << 4) | 0x08 | (reg))
     96   1.3    tsubai #define ADBTALK(dev, reg)	((((u_int8_t)(dev) & 0x0f) << 4) | 0x0c | (reg))
     97   1.3    tsubai 
     98   1.9    briggs int	adb_intr __P((void *));
     99   1.1    tsubai int	adb_poweroff __P((void));
    100   1.5      matt void	adb_restart __P((void));
    101   1.5      matt void	adb_cuda_autopoll __P((void));
    102   1.9    briggs int	adb_intr_cuda __P((void *));
    103   1.1    tsubai int	CountADBs __P((void));
    104   1.1    tsubai void	ADBReInit __P((void));
    105   1.1    tsubai int	GetIndADB __P((ADBDataBlock * info, int index));
    106   1.1    tsubai int	GetADBInfo __P((ADBDataBlock * info, int adbAddr));
    107   1.1    tsubai int	SetADBInfo __P((ADBSetInfoBlock * info, int adbAddr));
    108  1.10   nathanw int	ADBOp __P((Ptr buffer, adbComp *compRout, Ptr data, short commandNum));
    109   1.1    tsubai int	adb_read_date_time __P((unsigned long *t));
    110   1.1    tsubai int	adb_set_date_time __P((unsigned long t));
    111   1.4    tsubai 
    112  1.10   nathanw int	adb_op_sync __P((Ptr, adbComp *, Ptr, short));
    113  1.12  christos void	adb_op_comprout __P((void *, volatile int *, int));
    114