1 /*        $NetBSD: zz9kvar.h,v 1.1 2023/05/03 13:49:30 phx Exp $ */
2 
3 /*
4  * Copyright (c) 2020 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Alain Runa.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *        notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *        notice, this list of conditions and the following disclaimer in the
17  *        documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef ZZ9KVAR_H
32 #define ZZ9KVAR_H
33 
34 #include <sys/types.h>                                      /* size_t, char */
35 #include <sys/bus.h>                                        /* bus_space_xxx, bus_addr_t */
36 #include <sys/device.h>                                     /* device_t */
37 #include <amiga/dev/zbusvar.h>                              /* zbus_args */
38 
39 #define ZZREG_R(r)  bus_space_read_2(sc->sc_iot, sc->sc_regh, (r))
40 #define ZZREG_W(r, v)         bus_space_write_2(sc->sc_iot, sc->sc_regh, (r), (v))
41 
42 struct zz9k_softc {
43           device_t sc_dev;
44           struct bus_space_tag sc_bst;
45           bus_space_tag_t sc_iot;
46           bus_space_handle_t sc_regh;
47 
48           size_t sc_zsize;
49 };
50 
51 struct zz9kbus_attach_args {
52           char                zzaa_name[32];
53           bus_addr_t          zzaa_base;
54 };
55 
56 #endif /* ZZ9KVAR_H */
57