1 /* $NetBSD: ieee1394var.h,v 1.20 2003/06/29 22:30:17 fvdl Exp $ */
2
3 /*-
4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by
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 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 #ifndef _DEV_IEEE1394_IEEE1394VAR_H_
40 #define _DEV_IEEE1394_IEEE1394VAR_H_
41
42 struct ieee1394_softc;
43 struct ieee1394_node;
44
45 struct fwiso_header; /* XXX */
46 struct selinfo; /* XXX */
47
48 /* for isochronous receive */
49 typedef void *ieee1394_ir_tag_t;
50
51 /* for isochronous transmit */
52 typedef void *ieee1394_it_tag_t;
53 struct ieee1394_it_datalist;
54
55 /* These buffers have no reference counting. It is assumed that
56 * the upper level buffer (struct buf or struct mbuf) will have the
57 * requisite reference counting.
58 */
59 struct ieee1394_abuf {
60 struct ieee1394_softc *ab_req; /* requestee */
61 u_int32_t *ab_data;
62 struct uio *ab_uio;
63 u_int64_t ab_addr;
64 u_int64_t ab_retaddr;
65 u_int8_t ab_tcode;
66 u_int8_t ab_tlabel;
67 u_int32_t ab_length;
68 u_int32_t ab_retlen; /* length returned from read. */
69 u_int32_t ab_retries;
70 u_int8_t ab_subok;
71
72 void (*ab_cb)(struct ieee1394_abuf *, int);
73 void *ab_cbarg;
74 };
75
76 struct ieee1394_callbacks {
77 void (*sc1394_reset)(struct ieee1394_softc *, void *);
78 void *sc1394_resetarg;
79 int (*sc1394_read)(struct ieee1394_abuf *);
80 int (*sc1394_write)(struct ieee1394_abuf *);
81 int (*sc1394_inreg)(struct ieee1394_abuf *, int);
82 int (*sc1394_unreg)(struct ieee1394_abuf *, int);
83 };
84
85 struct ieee1394_attach_args {
86 char name[7];
87 u_int8_t uid[8];
88 u_int16_t nodeid;
89 };
90
91 struct ieee1394_softc {
92 struct device sc1394_dev;
93 struct device *sc1394_if; /* Move to fwohci level. */
94 struct device *sc1394_iso; /* Move to fwohci level. */
95 void *sc1394_isoarg; /* XXX */
96
97 struct ieee1394_callbacks sc1394_callback; /* Nuke probably. */
98 u_int32_t *sc1394_configrom;
99 u_int32_t sc1394_configrom_len; /* quadlets. */
100 u_int32_t sc1394_max_receive;
101 u_int8_t sc1394_guid[8];
102 u_int8_t sc1394_link_speed; /* IEEE1394_SPD_* */
103 u_int16_t sc1394_node_id; /* my node id in network order */
104
105 int (*sc1394_ifoutput)(struct device *, struct mbuf *,
106 void (*)(struct device *, struct mbuf *)); /* Nuke. */
107 int (*sc1394_ifinreg)(struct device *, u_int32_t, u_int32_t,
108 void (*)(struct device *, struct mbuf *)); /* Nuke */
109 int (*sc1394_ifsetiso)(struct device *, u_int32_t, u_int32_t, u_int32_t,
110 void (*)(struct device *, struct mbuf *)); /* Nuke */
111
112 /* for isochronous receive */
113 ieee1394_ir_tag_t (*sc1394_ir_open)(struct device *, int, int,
114 int, int, int);
115 int (*sc1394_ir_close)(struct device *, ieee1394_ir_tag_t);
116 int (*sc1394_ir_read)(struct device *, ieee1394_ir_tag_t,
117 struct uio *, int, int);
118 int (*sc1394_ir_wait)(struct device *, ieee1394_ir_tag_t,
119 void *, char *);
120 int (*sc1394_ir_select)(struct device *, ieee1394_ir_tag_t,
121 struct proc *);
122
123 /* for isochronous transmission */
124 ieee1394_it_tag_t (*sc1394_it_open)(struct device *, int, int, int);
125 int (*sc1394_it_writedata)(struct device *, int, int,
126 struct ieee1394_it_datalist *, int);
127 int (*sc1394_it_close)(struct device *, ieee1394_it_tag_t);
128
129 LIST_ENTRY(ieee1394_softc) sc1394_node;
130 };
131
132 struct ieee1394_node {
133 struct device node_dev;
134
135 struct ieee1394_softc *node_sc; /* owning bus */
136 u_int32_t *node_configrom;
137 size_t node_configrom_len;
138 };
139
140 int ieee1394_init __P((struct ieee1394_softc *));
141
142
143 struct ieee1394_it_func_t {
144 int (*ieee1394_it_writedata)(ieee1394_it_tag_t, int,
145 struct ieee1394_it_datalist *);
146 };
147
148
149 union ieee1394_it_data {
150 u_int32_t id_data[2];
151 u_int8_t *id_addr;
152 };
153
154 #define IEEE1394_IT_CMD_NUM 4
155
156 struct ieee1394_it_datalist {
157 u_int16_t it_cmd[IEEE1394_IT_CMD_NUM];
158 union ieee1394_it_data it_u[IEEE1394_IT_CMD_NUM];
159 };
160
161 #define IEEE1394_IT_CMD_MASK 0xf000
162 #define IEEE1394_IT_CMD_NOP 0x0000
163 #define IEEE1394_IT_CMD_IMMED 0x1000
164 #define IEEE1394_IT_CMD_PTR 0x2000
165 #define IEEE1394_IT_CMD_SIZE 0x0fff
166
167
168 #define IEEE1394_ARGTYPE_PTR 0
169 #define IEEE1394_ARGTYPE_MBUF 1
170
171 /*
172 * some definitions for 2nd, 3rd and 4th arguments of
173 * sc1394_devsetiso().
174 */
175 #define IEEE1394_ISO_CHANNEL_ANY 64
176 #define IEEE1394_ISO_CHANNEL_MASK 0x3f
177 #define IEEE1394_ISO_TAG0 0x01
178 #define IEEE1394_ISO_TAG1 0x02
179 #define IEEE1394_ISO_TAG2 0x04
180 #define IEEE1394_ISO_TAG3 0x08
181 #define IEEE1394_ISO_DIR_READ 0
182 #define IEEE1394_ISO_DIR_WRITE 1
183
184 #define IEEE1394_IR_NEEDHEADER 0x01
185 #define IEEE1394_IR_TRIGGER_CIP_SYNC 0x02
186 #define IEEE1394_IR_SHORTDELAY 0x04
187
188 #endif /* _DEV_IEEE1394_IEEE1394VAR_H_ */
Cache object: 3af5e7bfbc630997b727e58f083891a3
|