da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER START
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The contents of this file are subject to the terms of the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Common Development and Distribution License, Version 1.0 only
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * (the "License"). You may not use this file except in compliance
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * with the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * or http://www.opensolaris.org/os/licensing.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * See the License for the specific language governing permissions
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and limitations under the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * When distributing Covered Code, include this CDDL HEADER in each
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If applicable, add the following below this CDDL HEADER, with the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * fields enclosed by brackets "[]" replaced with your own identifying
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * information: Portions Copyright [yyyy] [name of copyright owner]
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER END
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
b1352070d318187b41b088da3533692976f3f225Alan Wright/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * All rights reserved.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#ifndef _SYS_1394_ID1394_H
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define _SYS_1394_ID1394_H
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#pragma ident "%Z%%M% %I% %E% SMI"
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * id1394.h
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Contains enums and structures used for managing a local isochronous
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * DMA resource.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#include <sys/types.h>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#include <sys/dditypes.h>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#include <sys/ddi.h>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#include <sys/sunddi.h>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#include <sys/1394/ixl1394.h>
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#ifdef __cplusplus
3db3f65c6274eb042354801a308c8e9bc4994553amwextern "C" {
3db3f65c6274eb042354801a308c8e9bc4994553amw#endif
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * t1394_alloc_isoch_dma() is used to allocate a local isochronous
8d7e41661dc4633488e93b13363137523ce59977jose borrego * DMA resource for receiving or for transmitting isochronous data.
8d7e41661dc4633488e93b13363137523ce59977jose borrego * Upon successful allocation, the 1394 Framework returns a handle
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * of the type shown below. The target driver passes this handle back to
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * the 1394 Framework for all subsequent t1394_*_isoch_dma() calls
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * used to control the allocated resource.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef struct isoch_dma_handle *t1394_isoch_dma_handle_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Target drivers use the id1394_isoch_dma_options_t enumerated type to
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * specify to t1394_alloc_isoch_dma() the desired characteristics of
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the requested local isochronous DMA resource.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ID1394_TALK specifies an isochronous transmit DMA resource.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ID1394_LISTEN_PKT_MODE specifies an isochronous receive DMA resource in
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * which each packet is received into its own (set of) buffer(s).
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ID1394_LISTEN_BUF_MODE specifies an isochronous receive DMA resource in
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * which packets may be concatenated into a single buffer.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ID1394_RECV_HEADERS specifies that isochronous packet header data for
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * received isochronous packets are stored into the data buffers along
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * with the packet data (otherwise the packet header is removed).
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef enum {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ID1394_TALK = (1 << 0),
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ID1394_LISTEN_PKT_MODE = (1 << 1),
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ID1394_LISTEN_BUF_MODE = (1 << 2),
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ID1394_RECV_HEADERS = (1 << 3)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw} id1394_isoch_dma_options_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Enumerated type id1394_isoch_dma_stopped_t is a return argument to
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the target's isoch_dma_stopped() callback.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Under a variety of circumstances, the local DMA resource may stop running.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If this occurs (independently of a target driver`s direct call to
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * t1394_stop_isoch_dma()), the target driver's isoch_dma_stopped callback is
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * invoked. In this callback, the reason for the stop is indicated in the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * id1394_isoch_dma_stopped_t enumerated type. ID1394_DONE indicates the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * isochronous DMA resource stopped because it reached the "end."
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ID1394_FAIL indicates the isochronous DMA resource encountered an error.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef enum {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ID1394_DONE = 1,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ID1394_FAIL = 2
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw} id1394_isoch_dma_stopped_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Targets use id1394_isoch_dmainfo_t with t1394_alloc_isoch_dma() to specify
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the desired characteristics of the local isochronous DMA resource.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ixlp
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * is the kernel virtual address of the first IXL program command.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * For IXL program command structures, see ixl1394.h.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * channel_num
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * is the isochronous channel number (0-63) for the allocated local
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * isochronous DMA resource. For an isochronous receive DMA resource,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * only packets with the specified channel number are received into the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * provided buffers. For an isochronous transmit DMA resource, the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 1394 Framework constructs isochronous transmit packet headers using the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * specified channel number.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * default_tag
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * are the tag bits for the local isochronous DMA resource.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * For an isochronous receive DMA resource, only packets with the specified
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * tag bits are received into the provided buffers. For an isochronous
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * transmit DMA resource, the 1394 Framework constructs isochronous
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * transmit packet headers using the specified tag bits.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * default_sync
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * are the sync bits for the local isochronous DMA resource. Usage is
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * similar to that of default_tag above.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * it_speed
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * is used only for an isochronous transmit resource and indicates the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * speed at which the 1394 Framework shall transmit packets. For valid
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * speeds, see ieee1394.h.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * global_callback_arg
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * is the argument the 1394 Framework provides to the target when invoking
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * a callback specified in an ixl1394_callback_t IXL command or an IXL
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * program. Target drivers can use this to track state or any other
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * information. See ixl1394.h for IXL command info.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * it_default_skip
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * is used for isochronous transmit DMA resources only and specifies the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * default skip mode for the resource. See ixl1394.h for valid skip modes.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * it_default_skiplabel
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * is used for isochronous transmit DMA resources only, and when
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * it_default_skip is IXL1394_SKIP_TO_LABEL. It contains a pointer to
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the targetted IXL Label command.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * idma_options
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * is used to specify the overall transmit or receive characteristics
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * of the requested local isochronous DMA resource.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * isoch_dma_stopped
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * is the target driver's callback routine the 1394 Framework is to
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * invoke if the local isochronous DMA resource stops.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * idma_evt_arg
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * is the target driver's callback argument to be handed back to the target
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * driver when the 1394 Framework invokes the isoch_dma_stopped() callback.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef struct id1394_isoch_dmainfo_s {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ixl1394_command_t *ixlp; /* 1st IXL command */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint_t channel_num; /* isoch channel */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint_t default_tag; /* tag */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint_t default_sync; /* sync */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint_t it_speed; /* speed - xmit only */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw void *global_callback_arg;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ixl1394_skip_t it_default_skip; /* skip - xmit only */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ixl1394_command_t *it_default_skiplabel;
8d7e41661dc4633488e93b13363137523ce59977jose borrego id1394_isoch_dma_options_t idma_options; /* I/O type */
8d7e41661dc4633488e93b13363137523ce59977jose borrego
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw void (*isoch_dma_stopped)(t1394_isoch_dma_handle_t t1394_idma_hdl,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw opaque_t idma_evt_arg,
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright id1394_isoch_dma_stopped_t idma_stop_args);
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright opaque_t idma_evt_arg;
8d7e41661dc4633488e93b13363137523ce59977jose borrego} id1394_isoch_dmainfo_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Target drivers supply the id1394_isoch_dma_ctrlinfo_t structure to the
8d7e41661dc4633488e93b13363137523ce59977jose borrego * t1394_start_isoch_dma() call to indicate the cycle at which the local
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * isochronous DMA resource is to start receiving or transmitting packets.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef struct id1394_isoch_dma_ctrlinfo_s {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint_t start_cycle;
8d7e41661dc4633488e93b13363137523ce59977jose borrego} id1394_isoch_dma_ctrlinfo_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
8d7e41661dc4633488e93b13363137523ce59977jose borrego/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * t1394_start_isoch_dma() flags.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ID1394_START_ON_CYCLE - if specified, this flag indicates that the local
8d7e41661dc4633488e93b13363137523ce59977jose borrego * isochronous DMA resource is to start receiving or transmitting packets
8d7e41661dc4633488e93b13363137523ce59977jose borrego * at the cycle time specified in id1394_isoch_dma_ctrlinfo_t.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If not specified, the isochronous DMA resource starts receiving or
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * transmitting packets as soon as possible.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define ID1394_START_ON_CYCLE 0x00000001 /* start on specified cycle */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Target drivers use the id1394_isoch_dma_updateinfo_t structure to provide
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * information to t1394_update_isoch_dma(), which dynamically updates an IXL
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * program for an allocated local isochronous DMA resource. See ixl1394.h
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * for information on IXL program commands.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * temp_ixlp
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * points to the first new IXL command used to update an existing IXL
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * command.
8d7e41661dc4633488e93b13363137523ce59977jose borrego * orig_ixlp
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * points to the original IXL command to be updated.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ixl_count
8d7e41661dc4633488e93b13363137523ce59977jose borrego * is the number of IXL commands to be updated.
8d7e41661dc4633488e93b13363137523ce59977jose borrego */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef struct id1394_isoch_dma_updateinfo_s {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ixl1394_command_t *temp_ixlp; /* first new IXL cmd */
8d7e41661dc4633488e93b13363137523ce59977jose borrego ixl1394_command_t *orig_ixlp; /* first updated IXL cmd */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint_t ixl_count; /* length of update chain */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw} id1394_isoch_dma_updateinfo_t;
8d7e41661dc4633488e93b13363137523ce59977jose borrego
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#ifdef __cplusplus
8d7e41661dc4633488e93b13363137523ce59977jose borrego}
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#endif
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
8d7e41661dc4633488e93b13363137523ce59977jose borrego#endif /* _SYS_1394_ID1394_H */
8d7e41661dc4633488e93b13363137523ce59977jose borrego