Home | History | Annotate | Line # | Download | only in dev
adbvar.h revision 1.7
      1  1.7  thorpej /*	$NetBSD: adbvar.h,v 1.7 2003/04/09 01:55:14 thorpej 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.1   tsubai typedef caddr_t Ptr;
     62  1.1   tsubai typedef caddr_t *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.6   itojun /* adb_direct.c */
     82  1.6   itojun extern int adbHardware;
     83  1.1   tsubai 
     84  1.1   tsubai /* types of adb hardware that we (will eventually) support */
     85  1.1   tsubai #define ADB_HW_UNKNOWN		0x01	/* don't know */
     86  1.1   tsubai #define ADB_HW_II		0x02	/* Mac II series */
     87  1.1   tsubai #define ADB_HW_IISI		0x03	/* Mac IIsi series */
     88  1.1   tsubai #define ADB_HW_PB		0x04	/* PowerBook series */
     89  1.1   tsubai #define ADB_HW_CUDA		0x05	/* Machines with a Cuda chip */
     90  1.1   tsubai 
     91  1.3   tsubai #define ADB_CMDADDR(cmd)	((u_int8_t)((cmd) & 0xf0) >> 4)
     92  1.3   tsubai #define ADBFLUSH(dev)		((((u_int8_t)(dev) & 0x0f) << 4) | 0x01)
     93  1.3   tsubai #define ADBLISTEN(dev, reg)	((((u_int8_t)(dev) & 0x0f) << 4) | 0x08 | (reg))
     94  1.3   tsubai #define ADBTALK(dev, reg)	((((u_int8_t)(dev) & 0x0f) << 4) | 0x0c | (reg))
     95  1.3   tsubai 
     96  1.5     matt void	adb_intr __P((void));
     97  1.1   tsubai int	adb_poweroff __P((void));
     98  1.5     matt void	adb_restart __P((void));
     99  1.5     matt void	adb_cuda_autopoll __P((void));
    100  1.1   tsubai int	CountADBs __P((void));
    101  1.1   tsubai void	ADBReInit __P((void));
    102  1.1   tsubai int	GetIndADB __P((ADBDataBlock * info, int index));
    103  1.1   tsubai int	GetADBInfo __P((ADBDataBlock * info, int adbAddr));
    104  1.1   tsubai int	SetADBInfo __P((ADBSetInfoBlock * info, int adbAddr));
    105  1.1   tsubai int	ADBOp __P((Ptr buffer, Ptr compRout, Ptr data, short commandNum));
    106  1.1   tsubai int	adb_read_date_time __P((unsigned long *t));
    107  1.1   tsubai int	adb_set_date_time __P((unsigned long t));
    108  1.4   tsubai 
    109  1.4   tsubai int	adb_op_sync __P((Ptr, Ptr, Ptr, short));
    110  1.4   tsubai void	adb_op_comprout __P((caddr_t, caddr_t, int));
    111