Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / macppc / dev / adbvar.h
blob67fef556d81f0157c0d476e0a3cedefeb2fd861f
1 /* $NetBSD: adbvar.h,v 1.13 2009/03/14 14:46:01 dsl Exp $ */
3 /*-
4 * Copyright (C) 1994 Bradley A. Grantham
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #include <machine/adbsys.h>
31 * Arguments used to attach a device to the Apple Desktop Bus
33 struct adb_attach_args {
34 int origaddr;
35 int adbaddr;
36 int handler_id;
39 typedef struct adb_trace_xlate_s {
40 int params;
41 char *string;
42 } adb_trace_xlate_t;
44 extern adb_trace_xlate_t adb_trace_xlations[];
46 #ifdef DEBUG
47 #ifndef ADB_DEBUG
48 #define ADB_DEBUG
49 #endif
50 #endif
52 #ifdef ADB_DEBUG
53 extern int adb_debug;
54 #endif
56 typedef void *Ptr;
57 typedef void **Handle;
59 /* ADB Manager */
60 typedef struct {
61 Ptr siServiceRtPtr;
62 Ptr siDataAreaAddr;
63 } ADBSetInfoBlock;
64 typedef struct {
65 unsigned char devType;
66 unsigned char origADBAddr;
67 Ptr dbServiceRtPtr;
68 Ptr dbDataAreaAddr;
69 } ADBDataBlock;
71 struct adb_softc {
72 struct device sc_dev;
73 char *sc_regbase;
76 typedef void (adbComp)(void *, volatile int *, int);
78 /* adb_direct.c */
79 extern int adbHardware;
81 /* types of adb hardware that we (will eventually) support */
82 #define ADB_HW_UNKNOWN 0x01 /* don't know */
83 #define ADB_HW_II 0x02 /* Mac II series */
84 #define ADB_HW_IISI 0x03 /* Mac IIsi series */
85 #define ADB_HW_PMU 0x04 /* PowerBook series */
86 #define ADB_HW_CUDA 0x05 /* Machines with a Cuda chip */
88 #define ADB_CMDADDR(cmd) ((u_int8_t)((cmd) & 0xf0) >> 4)
89 #define ADBFLUSH(dev) ((((u_int8_t)(dev) & 0x0f) << 4) | 0x01)
90 #define ADBLISTEN(dev, reg) ((((u_int8_t)(dev) & 0x0f) << 4) | 0x08 | (reg))
91 #define ADBTALK(dev, reg) ((((u_int8_t)(dev) & 0x0f) << 4) | 0x0c | (reg))
93 int adb_intr(void *);
94 int adb_poweroff(void);
95 void adb_restart(void);
96 void adb_cuda_autopoll(void);
97 int adb_intr_cuda(void *);
98 int CountADBs(void);
99 void ADBReInit(void);
100 int GetIndADB(ADBDataBlock * info, int index);
101 int GetADBInfo(ADBDataBlock * info, int adbAddr);
102 int SetADBInfo(ADBSetInfoBlock * info, int adbAddr);
103 int ADBOp(Ptr buffer, adbComp *compRout, Ptr data, short commandNum);
104 int adb_read_date_time(unsigned long *t);
105 int adb_set_date_time(unsigned long t);
107 int adb_op_sync(Ptr, adbComp *, Ptr, short);
108 void adb_op_comprout(void *, volatile int *, int);