xref: /illumos-gate/usr/src/uts/common/sys/1394/id1394.h (revision 2d6eb4a5e0a47d30189497241345dc5466bb68ab)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_1394_ID1394_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_1394_ID1394_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate /*
31*7c478bd9Sstevel@tonic-gate  * id1394.h
32*7c478bd9Sstevel@tonic-gate  *    Contains enums and structures used for managing a local isochronous
33*7c478bd9Sstevel@tonic-gate  *    DMA resource.
34*7c478bd9Sstevel@tonic-gate  */
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
37*7c478bd9Sstevel@tonic-gate #include <sys/dditypes.h>
38*7c478bd9Sstevel@tonic-gate #include <sys/ddi.h>
39*7c478bd9Sstevel@tonic-gate #include <sys/sunddi.h>
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate #include <sys/1394/ixl1394.h>
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
44*7c478bd9Sstevel@tonic-gate extern "C" {
45*7c478bd9Sstevel@tonic-gate #endif
46*7c478bd9Sstevel@tonic-gate 
47*7c478bd9Sstevel@tonic-gate /*
48*7c478bd9Sstevel@tonic-gate  * t1394_alloc_isoch_dma() is used to allocate a local isochronous
49*7c478bd9Sstevel@tonic-gate  * DMA resource for receiving or for transmitting isochronous data.
50*7c478bd9Sstevel@tonic-gate  * Upon successful allocation, the 1394 Framework returns a handle
51*7c478bd9Sstevel@tonic-gate  * of the type shown below. The target driver passes this handle back to
52*7c478bd9Sstevel@tonic-gate  * the 1394 Framework for all subsequent t1394_*_isoch_dma() calls
53*7c478bd9Sstevel@tonic-gate  * used to control the allocated resource.
54*7c478bd9Sstevel@tonic-gate  */
55*7c478bd9Sstevel@tonic-gate typedef struct isoch_dma_handle	*t1394_isoch_dma_handle_t;
56*7c478bd9Sstevel@tonic-gate 
57*7c478bd9Sstevel@tonic-gate /*
58*7c478bd9Sstevel@tonic-gate  * Target drivers use the id1394_isoch_dma_options_t enumerated type to
59*7c478bd9Sstevel@tonic-gate  * specify to t1394_alloc_isoch_dma() the desired characteristics of
60*7c478bd9Sstevel@tonic-gate  * the requested local isochronous DMA resource.
61*7c478bd9Sstevel@tonic-gate  * ID1394_TALK specifies an isochronous transmit DMA resource.
62*7c478bd9Sstevel@tonic-gate  * ID1394_LISTEN_PKT_MODE specifies an isochronous receive DMA resource in
63*7c478bd9Sstevel@tonic-gate  *    which each packet is received into its own (set of) buffer(s).
64*7c478bd9Sstevel@tonic-gate  * ID1394_LISTEN_BUF_MODE specifies an isochronous receive DMA resource in
65*7c478bd9Sstevel@tonic-gate  *    which packets may be concatenated into a single buffer.
66*7c478bd9Sstevel@tonic-gate  * ID1394_RECV_HEADERS specifies that isochronous packet header data for
67*7c478bd9Sstevel@tonic-gate  *    received isochronous packets are stored into the data buffers along
68*7c478bd9Sstevel@tonic-gate  *    with the packet data (otherwise the packet header is removed).
69*7c478bd9Sstevel@tonic-gate  */
70*7c478bd9Sstevel@tonic-gate typedef enum {
71*7c478bd9Sstevel@tonic-gate 	ID1394_TALK			= (1 << 0),
72*7c478bd9Sstevel@tonic-gate 	ID1394_LISTEN_PKT_MODE		= (1 << 1),
73*7c478bd9Sstevel@tonic-gate 	ID1394_LISTEN_BUF_MODE		= (1 << 2),
74*7c478bd9Sstevel@tonic-gate 	ID1394_RECV_HEADERS		= (1 << 3)
75*7c478bd9Sstevel@tonic-gate } id1394_isoch_dma_options_t;
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate /*
78*7c478bd9Sstevel@tonic-gate  * Enumerated type id1394_isoch_dma_stopped_t is a return argument to
79*7c478bd9Sstevel@tonic-gate  * the target's isoch_dma_stopped() callback.
80*7c478bd9Sstevel@tonic-gate  * Under a variety of circumstances, the local DMA resource may stop running.
81*7c478bd9Sstevel@tonic-gate  * If this occurs (independently of a target driver`s direct call to
82*7c478bd9Sstevel@tonic-gate  * t1394_stop_isoch_dma()), the target driver's isoch_dma_stopped callback is
83*7c478bd9Sstevel@tonic-gate  * invoked.  In this callback, the reason for the stop is indicated in the
84*7c478bd9Sstevel@tonic-gate  * id1394_isoch_dma_stopped_t enumerated type.  ID1394_DONE indicates the
85*7c478bd9Sstevel@tonic-gate  * isochronous DMA resource stopped because it reached the "end."
86*7c478bd9Sstevel@tonic-gate  * ID1394_FAIL indicates the isochronous DMA resource encountered an error.
87*7c478bd9Sstevel@tonic-gate  */
88*7c478bd9Sstevel@tonic-gate typedef enum {
89*7c478bd9Sstevel@tonic-gate 	ID1394_DONE			= 1,
90*7c478bd9Sstevel@tonic-gate 	ID1394_FAIL			= 2
91*7c478bd9Sstevel@tonic-gate } id1394_isoch_dma_stopped_t;
92*7c478bd9Sstevel@tonic-gate 
93*7c478bd9Sstevel@tonic-gate /*
94*7c478bd9Sstevel@tonic-gate  * Targets use id1394_isoch_dmainfo_t with t1394_alloc_isoch_dma() to specify
95*7c478bd9Sstevel@tonic-gate  * the desired characteristics of the local isochronous DMA resource.
96*7c478bd9Sstevel@tonic-gate  *
97*7c478bd9Sstevel@tonic-gate  * ixlp
98*7c478bd9Sstevel@tonic-gate  *	is the kernel virtual address of the first IXL program command.
99*7c478bd9Sstevel@tonic-gate  *	For IXL program command structures, see ixl1394.h.
100*7c478bd9Sstevel@tonic-gate  * channel_num
101*7c478bd9Sstevel@tonic-gate  *	is the isochronous channel number (0-63) for the allocated local
102*7c478bd9Sstevel@tonic-gate  *	isochronous DMA resource.  For an isochronous receive DMA resource,
103*7c478bd9Sstevel@tonic-gate  *	only packets with the specified channel number are received into the
104*7c478bd9Sstevel@tonic-gate  *	provided buffers.  For an isochronous transmit DMA resource, the
105*7c478bd9Sstevel@tonic-gate  *	1394 Framework constructs isochronous transmit packet headers using the
106*7c478bd9Sstevel@tonic-gate  *	specified channel number.
107*7c478bd9Sstevel@tonic-gate  * default_tag
108*7c478bd9Sstevel@tonic-gate  *	are the tag bits for the local isochronous DMA resource.
109*7c478bd9Sstevel@tonic-gate  *	For an isochronous receive DMA resource, only packets with the specified
110*7c478bd9Sstevel@tonic-gate  *	tag bits are received into the provided buffers.  For an isochronous
111*7c478bd9Sstevel@tonic-gate  *	transmit DMA resource, the 1394 Framework constructs isochronous
112*7c478bd9Sstevel@tonic-gate  *	transmit packet headers using the specified tag bits.
113*7c478bd9Sstevel@tonic-gate  * default_sync
114*7c478bd9Sstevel@tonic-gate  *	are the sync bits for the local isochronous DMA resource.  Usage is
115*7c478bd9Sstevel@tonic-gate  *	similar to that of default_tag above.
116*7c478bd9Sstevel@tonic-gate  * it_speed
117*7c478bd9Sstevel@tonic-gate  *	is used only for an isochronous transmit resource and indicates the
118*7c478bd9Sstevel@tonic-gate  *	speed at which the 1394 Framework shall transmit packets.  For valid
119*7c478bd9Sstevel@tonic-gate  *	speeds, see ieee1394.h.
120*7c478bd9Sstevel@tonic-gate  * global_callback_arg
121*7c478bd9Sstevel@tonic-gate  *	is the argument the 1394 Framework provides to the target when invoking
122*7c478bd9Sstevel@tonic-gate  *	a callback specified in an ixl1394_callback_t IXL command or an IXL
123*7c478bd9Sstevel@tonic-gate  *	program. Target drivers can use this to track state or any other
124*7c478bd9Sstevel@tonic-gate  *	information.  See ixl1394.h for IXL command info.
125*7c478bd9Sstevel@tonic-gate  * it_default_skip
126*7c478bd9Sstevel@tonic-gate  *	is used for isochronous transmit DMA resources only and specifies the
127*7c478bd9Sstevel@tonic-gate  *	default skip mode for the resource.  See ixl1394.h for valid skip modes.
128*7c478bd9Sstevel@tonic-gate  * it_default_skiplabel
129*7c478bd9Sstevel@tonic-gate  *	is used for isochronous transmit DMA resources only, and when
130*7c478bd9Sstevel@tonic-gate  *	it_default_skip is IXL1394_SKIP_TO_LABEL.  It contains a pointer to
131*7c478bd9Sstevel@tonic-gate  *	the targetted IXL Label command.
132*7c478bd9Sstevel@tonic-gate  * idma_options
133*7c478bd9Sstevel@tonic-gate  *	is used to specify the overall transmit or receive characteristics
134*7c478bd9Sstevel@tonic-gate  *	of the requested local isochronous DMA resource.
135*7c478bd9Sstevel@tonic-gate  * isoch_dma_stopped
136*7c478bd9Sstevel@tonic-gate  *	is the target driver's callback routine the 1394 Framework is to
137*7c478bd9Sstevel@tonic-gate  *	invoke if the local isochronous DMA resource stops.
138*7c478bd9Sstevel@tonic-gate  * idma_evt_arg
139*7c478bd9Sstevel@tonic-gate  *	is the target driver's callback argument to be handed back to the target
140*7c478bd9Sstevel@tonic-gate  *	driver when the 1394 Framework invokes the isoch_dma_stopped() callback.
141*7c478bd9Sstevel@tonic-gate  */
142*7c478bd9Sstevel@tonic-gate typedef struct id1394_isoch_dmainfo_s {
143*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t		*ixlp;		/* 1st IXL command */
144*7c478bd9Sstevel@tonic-gate 	uint_t				channel_num;	/* isoch channel */
145*7c478bd9Sstevel@tonic-gate 	uint_t				default_tag;	/* tag */
146*7c478bd9Sstevel@tonic-gate 	uint_t				default_sync;	/* sync */
147*7c478bd9Sstevel@tonic-gate 	uint_t				it_speed;	/* speed - xmit only */
148*7c478bd9Sstevel@tonic-gate 	void				*global_callback_arg;
149*7c478bd9Sstevel@tonic-gate 	ixl1394_skip_t			it_default_skip; /* skip - xmit only */
150*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t		*it_default_skiplabel;
151*7c478bd9Sstevel@tonic-gate 	id1394_isoch_dma_options_t	idma_options;	/* I/O type */
152*7c478bd9Sstevel@tonic-gate 
153*7c478bd9Sstevel@tonic-gate 	void	(*isoch_dma_stopped)(t1394_isoch_dma_handle_t t1394_idma_hdl,
154*7c478bd9Sstevel@tonic-gate 		    opaque_t idma_evt_arg,
155*7c478bd9Sstevel@tonic-gate 		    id1394_isoch_dma_stopped_t idma_stop_args);
156*7c478bd9Sstevel@tonic-gate 	opaque_t			idma_evt_arg;
157*7c478bd9Sstevel@tonic-gate } id1394_isoch_dmainfo_t;
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate /*
160*7c478bd9Sstevel@tonic-gate  * Target drivers supply the id1394_isoch_dma_ctrlinfo_t structure to the
161*7c478bd9Sstevel@tonic-gate  * t1394_start_isoch_dma() call to indicate the cycle at which the local
162*7c478bd9Sstevel@tonic-gate  * isochronous DMA resource is to start receiving or transmitting packets.
163*7c478bd9Sstevel@tonic-gate  */
164*7c478bd9Sstevel@tonic-gate typedef struct id1394_isoch_dma_ctrlinfo_s {
165*7c478bd9Sstevel@tonic-gate 	uint_t				start_cycle;
166*7c478bd9Sstevel@tonic-gate } id1394_isoch_dma_ctrlinfo_t;
167*7c478bd9Sstevel@tonic-gate 
168*7c478bd9Sstevel@tonic-gate /*
169*7c478bd9Sstevel@tonic-gate  * t1394_start_isoch_dma() flags.
170*7c478bd9Sstevel@tonic-gate  * ID1394_START_ON_CYCLE - if specified, this flag indicates that the local
171*7c478bd9Sstevel@tonic-gate  *    isochronous DMA resource is to start receiving or transmitting packets
172*7c478bd9Sstevel@tonic-gate  *    at the cycle time specified in id1394_isoch_dma_ctrlinfo_t.
173*7c478bd9Sstevel@tonic-gate  *    If not specified, the isochronous DMA resource starts receiving or
174*7c478bd9Sstevel@tonic-gate  *    transmitting packets as soon as possible.
175*7c478bd9Sstevel@tonic-gate  */
176*7c478bd9Sstevel@tonic-gate #define	ID1394_START_ON_CYCLE	    0x00000001	/* start on specified cycle */
177*7c478bd9Sstevel@tonic-gate 
178*7c478bd9Sstevel@tonic-gate /*
179*7c478bd9Sstevel@tonic-gate  * Target drivers use the id1394_isoch_dma_updateinfo_t structure to provide
180*7c478bd9Sstevel@tonic-gate  * information to t1394_update_isoch_dma(), which dynamically updates an IXL
181*7c478bd9Sstevel@tonic-gate  * program for an allocated local isochronous DMA resource.  See ixl1394.h
182*7c478bd9Sstevel@tonic-gate  * for information on IXL program commands.
183*7c478bd9Sstevel@tonic-gate  * temp_ixlp
184*7c478bd9Sstevel@tonic-gate  *	points to the first new IXL command used to update an existing IXL
185*7c478bd9Sstevel@tonic-gate  *	command.
186*7c478bd9Sstevel@tonic-gate  * orig_ixlp
187*7c478bd9Sstevel@tonic-gate  *	points to the original IXL command to be updated.
188*7c478bd9Sstevel@tonic-gate  * ixl_count
189*7c478bd9Sstevel@tonic-gate  *	is the number of IXL commands to be updated.
190*7c478bd9Sstevel@tonic-gate  */
191*7c478bd9Sstevel@tonic-gate typedef struct id1394_isoch_dma_updateinfo_s {
192*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t		*temp_ixlp; /* first new IXL cmd */
193*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t		*orig_ixlp; /* first updated IXL cmd */
194*7c478bd9Sstevel@tonic-gate 	uint_t				ixl_count;  /* length of update chain */
195*7c478bd9Sstevel@tonic-gate } id1394_isoch_dma_updateinfo_t;
196*7c478bd9Sstevel@tonic-gate 
197*7c478bd9Sstevel@tonic-gate 
198*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
199*7c478bd9Sstevel@tonic-gate }
200*7c478bd9Sstevel@tonic-gate #endif
201*7c478bd9Sstevel@tonic-gate 
202*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_1394_ID1394_H */
203