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