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