av1394_isoch.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_1394_TARGETS_AV1394_ISOCH_H
#define _SYS_1394_TARGETS_AV1394_ISOCH_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* isoch module definitions
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* isoch DMA memory management: segments and pools
*
* isoch segment - a contiguous chunk of kernel memory
*/
typedef struct av1394_isoch_seg_s {
int is_size; /* segment size */
/*
* isoch pool - a set of one or more isoch segments
*/
typedef struct av1394_isoch_pool_s {
int ip_nsegs; /* # of valid segments */
int ip_alloc_size; /* array alloc'd size */
int ip_size; /* total pool size */
int ip_umem_size; /* total alloc'd memory size */
/*
* many members are protected because they are modified during channel
* single-threaded processes. after that these members remain read-only.
*/
/*
* IXL receive data block (one or more RECV_BUF commands will follow the label)
*/
typedef struct av1394_ir_ixl_data_s {
/*
* isoch receive structure
*/
typedef struct av1394_ir_s {
/* IXL */
int ir_ixl_nbufs; /* # of commands in array */
/* xfer */
int ir_nfull; /* # of full frames */
int ir_first_full; /* first full frame */
int ir_nempty; /* # of empty frames */
int ir_last_empty; /* last produced frame */
int ir_hiwat; /* high water mark */
int ir_lowat; /* low water mark */
int ir_overflow_idx; /* overflow frame index */
/* read() support */
int ir_read_idx; /* first full frame */
int ir_read_cnt; /* number of full frames */
} av1394_ir_t;
}))
/*
* IXL transmit begin block, used to get a starting point for timestamping
*/
enum { AV1394_IT_IXL_BEGIN_NPOST = 3 };
typedef struct av1394_it_ixl_begin_s {
/*
* common part of transmit commands that are in a linked list
*/
typedef struct av1394_it_ixl_common_s {
int tc_size; /* structure size */
/*
* IXL transmit data block
*/
typedef struct av1394_it_ixl_buf_s {
int tb_flags;
int tb_framenum; /* frame number */
struct av1394_ic_s *tb_icp;
/* tb_flags */
enum {
};
/*
* empty CIP
*/
typedef struct av1394_it_ixl_empty_cip_s {
/*
* per-frame information
*/
typedef struct av1394_it_frame_info_s {
int fi_ncycs; /* # of bus cycles */
/*
* timestamp type
*/
typedef union av1394_it_ts {
/*
* isoch transmit structure
*/
typedef struct av1394_it_s {
/* IXL */
/* xfer */
int it_first_empty; /* first empty frame # */
int it_nempty; /* # of empty frames */
int it_last_full; /* last full frame # */
int it_nfull; /* # of full frames */
int it_hiwat; /* high water mark */
int it_lowat; /* low water mark */
int it_start_thre; /* xfer start threshold */
/* underrun data */
int it_underrun_idx; /* underrun frame index */
/* write() support */
int it_write_idx; /* first empty frame */
int it_write_cnt; /* # of empty frames */
} av1394_it_t;
}))
/* misc channel parameters */
typedef struct av1394_ic_param_s {
int cp_bus_speed; /* bus speed */
int cp_dbs; /* DBS */
int cp_fn; /* FN */
int cp_n; /* rate numerator */
int cp_d; /* rate denominator */
int cp_ts_mode; /* timestamp mode */
/* channel state */
typedef enum {
AV1394_IC_IDLE, /* nothing happens */
AV1394_IC_STARTED, /* channel has been started */
AV1394_IC_DMA, /* DMA transfer is in progress */
AV1394_IC_SUSPENDED /* transfer on the channel suspended */
/*
* isoch channel structure, common for both recv and xmit
*/
typedef struct av1394_ic_s {
int ic_num; /* channel # */
int ic_dir; /* xfer direction */
int ic_pktsz; /* packet size */
int ic_nframes; /* # of frames */
int ic_preq; /* postponed request */
} av1394_ic_t;
}))
/* xfer directions */
enum {
};
/* CIP type */
enum {
};
/* misc constants */
enum {
/* 57344 is ptob(btop(65535)) */
};
/* private ISOCH_INIT flag */
#define IEC61883_PRIV_ISOCH_NOALLOC 0x40000000
/*
* autoxmit (isoch xmit via write(2)) support
*/
typedef struct av1394_isoch_autoxmit_s {
int ax_fmt; /* data format */
/* autoxmit formats */
enum {
AV1394_ISOCH_AUTOXMIT_DV = 0x10,
};
/*
* User processes calling mmap(2) pass the 'offset' and 'len' arguments,
* returned by IEC61883_ISOCH_INIT ioctl. These arguments uniquely identify
* the DMA buffer associated with a channel. For each isochronous channel
* a part of this "address space" should be allocated to prevent conflicts
* with other channels.
*/
typedef struct av1394_as_s {
} av1394_as_t;
/*
* CMP (Connection Management Procedures)
*
* PCR address map (Ref: IEC 61883-1 Fig 14)
*/
#define AV1394_PCR_ADDR_START 0xFFFFF0000900
#define AV1394_PCR_ADDR_OMPR 0xFFFFF0000900
#define AV1394_PCR_ADDR_OPCR0 0xFFFFF0000904
#define AV1394_PCR_ADDR_NOPCR 31
#define AV1394_PCR_ADDR_IMPR 0xFFFFF0000980
#define AV1394_PCR_ADDR_IPCR0 0xFFFFF0000984
#define AV1394_PCR_ADDR_NIPCR 31
/* initial values and bus reset masks (Ref: IEC 61883-1 Fig 10-13) */
#define AV1394_OMPR_INIT_VAL 0xBFFFFF00
#define AV1394_IMPR_INIT_VAL 0x80FFFF00
#define AV1394_OPCR_BR_CLEAR_MASK 0x7FC03C00
#define AV1394_IPCR_BR_CLEAR_MASK 0x7FC0FFFF
/*
* local plug control register
*/
typedef struct av1394_pcr_s {
} av1394_pcr_t;
enum {
AV1394_OMPR_IDX = 0, /* oMPR index */
};
/* plug handle manipulation */
enum {
AV1394_PCR_REMOTE = 0x40000000
};
/*
* per-instance CMP structure
*/
typedef struct av1394_cmp_s {
} av1394_cmp_t;
/*
* per-instance soft state structure
*/
typedef struct av1394_isoch_s {
int i_nopen; /* number of opens */
}))
/* postponed request types */
enum {
AV1394_PREQ_IR_OVERFLOW = 0x01,
AV1394_PREQ_IT_UNDERRUN = 0x02
};
/* TNF probes */
#define AV1394_TNF_CMP "1394 av1394 cmp "
#define AV1394_TNF_CMP_STACK "1394 av1394 cmp stacktrace "
#define AV1394_TNF_CMP_ERROR "1394 av1394 cmp error "
#define AV1394_TNF_ISOCH "1394 av1394 isoch "
#define AV1394_TNF_ISOCH_STACK "1394 av1394 isoch stacktrace "
#define AV1394_TNF_ISOCH_ERROR "1394 av1394 isoch error "
/* isoch channel */
int av1394_ic_open(struct av1394_inst_s *, int);
int av1394_ic_close(struct av1394_inst_s *, int);
av1394_ic_t **icpp);
int mincnt);
/* isoch receive */
/* isoch transmit */
/* address space for mmap(2) */
/* CMP */
int av1394_ioctl_plug_init(struct av1394_inst_s *, void *, int);
int av1394_ioctl_plug_fini(struct av1394_inst_s *, void *, int);
int av1394_ioctl_plug_reg_read(struct av1394_inst_s *, void *, int);
int av1394_ioctl_plug_reg_cas(struct av1394_inst_s *, void *, int);
/* isoch common */
int av1394_isoch_attach(struct av1394_inst_s *);
void av1394_isoch_detach(struct av1394_inst_s *);
int av1394_isoch_cpr_suspend(struct av1394_inst_s *);
int av1394_isoch_cpr_resume(struct av1394_inst_s *);
void av1394_isoch_bus_reset(struct av1394_inst_s *);
void av1394_isoch_disconnect(struct av1394_inst_s *);
void av1394_isoch_reconnect(struct av1394_inst_s *);
int av1394_isoch_open(struct av1394_inst_s *, int);
int av1394_isoch_close(struct av1394_inst_s *, int);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_1394_TARGETS_AV1394_ISOCH_H */