adbvar.h revision 1.12.44.2 1 1.12.44.2 yamt /* $NetBSD: adbvar.h,v 1.12.44.2 2010/03/11 15:02:36 yamt 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 *
16 1.1 tsubai * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 1.1 tsubai * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 1.1 tsubai * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 1.1 tsubai * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 1.1 tsubai * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 1.1 tsubai * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 1.1 tsubai * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 1.1 tsubai * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 1.1 tsubai * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 1.1 tsubai * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 1.1 tsubai */
27 1.1 tsubai
28 1.1 tsubai #include <machine/adbsys.h>
29 1.2 tsubai
30 1.2 tsubai /*
31 1.2 tsubai * Arguments used to attach a device to the Apple Desktop Bus
32 1.2 tsubai */
33 1.2 tsubai struct adb_attach_args {
34 1.3 tsubai int origaddr;
35 1.3 tsubai int adbaddr;
36 1.3 tsubai int handler_id;
37 1.2 tsubai };
38 1.1 tsubai
39 1.1 tsubai typedef struct adb_trace_xlate_s {
40 1.1 tsubai int params;
41 1.1 tsubai char *string;
42 1.1 tsubai } adb_trace_xlate_t;
43 1.1 tsubai
44 1.1 tsubai extern adb_trace_xlate_t adb_trace_xlations[];
45 1.1 tsubai
46 1.1 tsubai #ifdef DEBUG
47 1.1 tsubai #ifndef ADB_DEBUG
48 1.1 tsubai #define ADB_DEBUG
49 1.1 tsubai #endif
50 1.3 tsubai #endif
51 1.3 tsubai
52 1.3 tsubai #ifdef ADB_DEBUG
53 1.1 tsubai extern int adb_debug;
54 1.1 tsubai #endif
55 1.1 tsubai
56 1.12 christos typedef void *Ptr;
57 1.12 christos typedef void **Handle;
58 1.1 tsubai
59 1.1 tsubai /* ADB Manager */
60 1.1 tsubai typedef struct {
61 1.1 tsubai Ptr siServiceRtPtr;
62 1.1 tsubai Ptr siDataAreaAddr;
63 1.1 tsubai } ADBSetInfoBlock;
64 1.1 tsubai typedef struct {
65 1.1 tsubai unsigned char devType;
66 1.1 tsubai unsigned char origADBAddr;
67 1.1 tsubai Ptr dbServiceRtPtr;
68 1.1 tsubai Ptr dbDataAreaAddr;
69 1.1 tsubai } ADBDataBlock;
70 1.1 tsubai
71 1.1 tsubai struct adb_softc {
72 1.1 tsubai struct device sc_dev;
73 1.1 tsubai char *sc_regbase;
74 1.1 tsubai };
75 1.6 itojun
76 1.12 christos typedef void (adbComp)(void *, volatile int *, int);
77 1.10 nathanw
78 1.6 itojun /* adb_direct.c */
79 1.6 itojun extern int adbHardware;
80 1.1 tsubai
81 1.1 tsubai /* types of adb hardware that we (will eventually) support */
82 1.1 tsubai #define ADB_HW_UNKNOWN 0x01 /* don't know */
83 1.1 tsubai #define ADB_HW_II 0x02 /* Mac II series */
84 1.1 tsubai #define ADB_HW_IISI 0x03 /* Mac IIsi series */
85 1.8 briggs #define ADB_HW_PMU 0x04 /* PowerBook series */
86 1.1 tsubai #define ADB_HW_CUDA 0x05 /* Machines with a Cuda chip */
87 1.1 tsubai
88 1.3 tsubai #define ADB_CMDADDR(cmd) ((u_int8_t)((cmd) & 0xf0) >> 4)
89 1.3 tsubai #define ADBFLUSH(dev) ((((u_int8_t)(dev) & 0x0f) << 4) | 0x01)
90 1.3 tsubai #define ADBLISTEN(dev, reg) ((((u_int8_t)(dev) & 0x0f) << 4) | 0x08 | (reg))
91 1.3 tsubai #define ADBTALK(dev, reg) ((((u_int8_t)(dev) & 0x0f) << 4) | 0x0c | (reg))
92 1.3 tsubai
93 1.12.44.1 yamt int adb_intr(void *);
94 1.12.44.1 yamt int adb_poweroff(void);
95 1.12.44.1 yamt void adb_restart(void);
96 1.12.44.1 yamt void adb_cuda_autopoll(void);
97 1.12.44.1 yamt int adb_intr_cuda(void *);
98 1.12.44.1 yamt int CountADBs(void);
99 1.12.44.1 yamt void ADBReInit(void);
100 1.12.44.1 yamt int GetIndADB(ADBDataBlock * info, int index);
101 1.12.44.1 yamt int GetADBInfo(ADBDataBlock * info, int adbAddr);
102 1.12.44.1 yamt int SetADBInfo(ADBSetInfoBlock * info, int adbAddr);
103 1.12.44.1 yamt int ADBOp(Ptr buffer, adbComp *compRout, Ptr data, short commandNum);
104 1.12.44.1 yamt int adb_read_date_time(unsigned long *t);
105 1.12.44.1 yamt int adb_set_date_time(unsigned long t);
106 1.4 tsubai
107 1.12.44.1 yamt int adb_op_sync(Ptr, adbComp *, Ptr, short);
108 1.12.44.1 yamt void adb_op_comprout(void *, volatile int *, int);
109