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