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 2002 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_AV_IEC61883_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_AV_IEC61883_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 * IEC 61883 interfaces 34*7c478bd9Sstevel@tonic-gate */ 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 39*7c478bd9Sstevel@tonic-gate extern "C" { 40*7c478bd9Sstevel@tonic-gate #endif 41*7c478bd9Sstevel@tonic-gate 42*7c478bd9Sstevel@tonic-gate /* current interface version */ 43*7c478bd9Sstevel@tonic-gate #define IEC61883_IMPL_MKVER(major, minor) (((major) << 8) | (minor)) 44*7c478bd9Sstevel@tonic-gate #define IEC61883_IMPL_VER_MAJOR(ver) (((ver) >> 8) & 0xff) 45*7c478bd9Sstevel@tonic-gate #define IEC61883_IMPL_VER_MINOR(ver) ((ver) & 0xff) 46*7c478bd9Sstevel@tonic-gate #define IEC61883_V1_0 IEC61883_IMPL_MKVER(1, 0) 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate /* 49*7c478bd9Sstevel@tonic-gate * asyncronous request (ARQ) 50*7c478bd9Sstevel@tonic-gate */ 51*7c478bd9Sstevel@tonic-gate typedef struct iec61883_arq { 52*7c478bd9Sstevel@tonic-gate int arq_type; /* type */ 53*7c478bd9Sstevel@tonic-gate int arq_len; /* length */ 54*7c478bd9Sstevel@tonic-gate union { 55*7c478bd9Sstevel@tonic-gate uint32_t quadlet; 56*7c478bd9Sstevel@tonic-gate uint64_t octlet; 57*7c478bd9Sstevel@tonic-gate uint8_t buf[8]; 58*7c478bd9Sstevel@tonic-gate } arq_data; /* data */ 59*7c478bd9Sstevel@tonic-gate } iec61883_arq_t; 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gate /* ARQ types (arq_type) */ 62*7c478bd9Sstevel@tonic-gate enum { 63*7c478bd9Sstevel@tonic-gate IEC61883_ARQ_FCP_CMD, 64*7c478bd9Sstevel@tonic-gate IEC61883_ARQ_FCP_RESP, 65*7c478bd9Sstevel@tonic-gate IEC61883_ARQ_BUS_RESET 66*7c478bd9Sstevel@tonic-gate }; 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate /* 69*7c478bd9Sstevel@tonic-gate * IEC61883_ISOCH_INIT argument 70*7c478bd9Sstevel@tonic-gate */ 71*7c478bd9Sstevel@tonic-gate typedef struct iec61883_isoch_init { 72*7c478bd9Sstevel@tonic-gate int ii_version; /* interface version */ 73*7c478bd9Sstevel@tonic-gate int ii_pkt_size; /* packet size */ 74*7c478bd9Sstevel@tonic-gate int ii_frame_size; /* packets/frame */ 75*7c478bd9Sstevel@tonic-gate int ii_frame_cnt; /* # of frames */ 76*7c478bd9Sstevel@tonic-gate int ii_direction; /* xfer direction */ 77*7c478bd9Sstevel@tonic-gate int ii_bus_speed; /* bus speed */ 78*7c478bd9Sstevel@tonic-gate uint64_t ii_channel; /* channel mask */ 79*7c478bd9Sstevel@tonic-gate int ii_dbs; /* DBS */ 80*7c478bd9Sstevel@tonic-gate int ii_fn; /* FN */ 81*7c478bd9Sstevel@tonic-gate int ii_rate_n; /* rate numerator */ 82*7c478bd9Sstevel@tonic-gate int ii_rate_d; /* rate denominator */ 83*7c478bd9Sstevel@tonic-gate int ii_ts_mode; /* timestamp mode */ 84*7c478bd9Sstevel@tonic-gate int ii_flags; /* flags */ 85*7c478bd9Sstevel@tonic-gate int ii_handle; /* isoch handle */ 86*7c478bd9Sstevel@tonic-gate int ii_frame_rcnt; /* # of frames */ 87*7c478bd9Sstevel@tonic-gate off_t ii_mmap_off; /* mmap offset */ 88*7c478bd9Sstevel@tonic-gate int ii_rchannel; /* channel */ 89*7c478bd9Sstevel@tonic-gate int ii_error; /* error code */ 90*7c478bd9Sstevel@tonic-gate } iec61883_isoch_init_t; 91*7c478bd9Sstevel@tonic-gate 92*7c478bd9Sstevel@tonic-gate /* xfer directions (ii_direction) */ 93*7c478bd9Sstevel@tonic-gate enum { 94*7c478bd9Sstevel@tonic-gate IEC61883_DIR_RECV, 95*7c478bd9Sstevel@tonic-gate IEC61883_DIR_XMIT 96*7c478bd9Sstevel@tonic-gate }; 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate /* bus speeds (ii_bus_speed) */ 99*7c478bd9Sstevel@tonic-gate enum { 100*7c478bd9Sstevel@tonic-gate IEC61883_S100, 101*7c478bd9Sstevel@tonic-gate IEC61883_S200, 102*7c478bd9Sstevel@tonic-gate IEC61883_S400 103*7c478bd9Sstevel@tonic-gate }; 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate /* special rate coefficients (ii_rate_n, ii_rate_d) */ 106*7c478bd9Sstevel@tonic-gate #define IEC61883_RATE_N_DV_NTSC 1 107*7c478bd9Sstevel@tonic-gate #define IEC61883_RATE_D_DV_NTSC 0 108*7c478bd9Sstevel@tonic-gate #define IEC61883_RATE_N_DV_PAL 2 109*7c478bd9Sstevel@tonic-gate #define IEC61883_RATE_D_DV_PAL 0 110*7c478bd9Sstevel@tonic-gate 111*7c478bd9Sstevel@tonic-gate /* timestamp modes (ii_ts_mode) */ 112*7c478bd9Sstevel@tonic-gate enum { 113*7c478bd9Sstevel@tonic-gate IEC61883_TS_NONE = 0, 114*7c478bd9Sstevel@tonic-gate IEC61883_TS_SYT = 0x0206 115*7c478bd9Sstevel@tonic-gate }; 116*7c478bd9Sstevel@tonic-gate 117*7c478bd9Sstevel@tonic-gate /* error codes (ii_error) */ 118*7c478bd9Sstevel@tonic-gate enum { 119*7c478bd9Sstevel@tonic-gate IEC61883_ERR_NOMEM = 1, 120*7c478bd9Sstevel@tonic-gate IEC61883_ERR_NOCHANNEL, 121*7c478bd9Sstevel@tonic-gate IEC61883_ERR_PKT_SIZE, 122*7c478bd9Sstevel@tonic-gate IEC61883_ERR_VERSION, 123*7c478bd9Sstevel@tonic-gate IEC61883_ERR_INVAL, 124*7c478bd9Sstevel@tonic-gate IEC61883_ERR_OTHER 125*7c478bd9Sstevel@tonic-gate }; 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate /* 128*7c478bd9Sstevel@tonic-gate * data transfer strusture 129*7c478bd9Sstevel@tonic-gate */ 130*7c478bd9Sstevel@tonic-gate typedef struct iec61883_xfer { 131*7c478bd9Sstevel@tonic-gate int xf_empty_idx; /* first empty frame */ 132*7c478bd9Sstevel@tonic-gate int xf_empty_cnt; /* empty frame count */ 133*7c478bd9Sstevel@tonic-gate int xf_full_idx; /* first full frame */ 134*7c478bd9Sstevel@tonic-gate int xf_full_cnt; /* full frame count */ 135*7c478bd9Sstevel@tonic-gate int xf_error; /* error */ 136*7c478bd9Sstevel@tonic-gate } iec61883_xfer_t; 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate /* 139*7c478bd9Sstevel@tonic-gate * IEC61883_RECV argument 140*7c478bd9Sstevel@tonic-gate */ 141*7c478bd9Sstevel@tonic-gate typedef struct iec61883_recv { 142*7c478bd9Sstevel@tonic-gate int rx_handle; /* isoch handle */ 143*7c478bd9Sstevel@tonic-gate int rx_flags; /* flags */ 144*7c478bd9Sstevel@tonic-gate iec61883_xfer_t rx_xfer; /* xfer params */ 145*7c478bd9Sstevel@tonic-gate } iec61883_recv_t; 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate /* 148*7c478bd9Sstevel@tonic-gate * IEC61883_XMIT argument 149*7c478bd9Sstevel@tonic-gate */ 150*7c478bd9Sstevel@tonic-gate typedef struct iec61883_xmit { 151*7c478bd9Sstevel@tonic-gate int tx_handle; /* isoch handle */ 152*7c478bd9Sstevel@tonic-gate int tx_flags; /* flags */ 153*7c478bd9Sstevel@tonic-gate iec61883_xfer_t tx_xfer; /* xfer params */ 154*7c478bd9Sstevel@tonic-gate int tx_miss_cnt; /* missed cycles */ 155*7c478bd9Sstevel@tonic-gate } iec61883_xmit_t; 156*7c478bd9Sstevel@tonic-gate 157*7c478bd9Sstevel@tonic-gate /* 158*7c478bd9Sstevel@tonic-gate * IEC61883_PLUG_INIT argument 159*7c478bd9Sstevel@tonic-gate */ 160*7c478bd9Sstevel@tonic-gate typedef struct iec61883_plug_init { 161*7c478bd9Sstevel@tonic-gate int pi_ver; /* interface version */ 162*7c478bd9Sstevel@tonic-gate int pi_loc; /* plug location */ 163*7c478bd9Sstevel@tonic-gate int pi_type; /* plug type */ 164*7c478bd9Sstevel@tonic-gate int pi_num; /* plug number */ 165*7c478bd9Sstevel@tonic-gate int pi_flags; /* flags */ 166*7c478bd9Sstevel@tonic-gate int pi_handle; /* plug handle */ 167*7c478bd9Sstevel@tonic-gate int pi_rnum; /* plug number */ 168*7c478bd9Sstevel@tonic-gate } iec61883_plug_init_t; 169*7c478bd9Sstevel@tonic-gate 170*7c478bd9Sstevel@tonic-gate /* plug locations (pi_loc) */ 171*7c478bd9Sstevel@tonic-gate enum { 172*7c478bd9Sstevel@tonic-gate IEC61883_LOC_LOCAL, 173*7c478bd9Sstevel@tonic-gate IEC61883_LOC_REMOTE 174*7c478bd9Sstevel@tonic-gate }; 175*7c478bd9Sstevel@tonic-gate 176*7c478bd9Sstevel@tonic-gate /* plug types (pi_type) */ 177*7c478bd9Sstevel@tonic-gate enum { 178*7c478bd9Sstevel@tonic-gate IEC61883_PLUG_IN, 179*7c478bd9Sstevel@tonic-gate IEC61883_PLUG_OUT, 180*7c478bd9Sstevel@tonic-gate IEC61883_PLUG_MASTER_IN, 181*7c478bd9Sstevel@tonic-gate IEC61883_PLUG_MASTER_OUT 182*7c478bd9Sstevel@tonic-gate }; 183*7c478bd9Sstevel@tonic-gate 184*7c478bd9Sstevel@tonic-gate /* special plug number (pi_num) */ 185*7c478bd9Sstevel@tonic-gate enum { 186*7c478bd9Sstevel@tonic-gate IEC61883_PLUG_ANY = -1 187*7c478bd9Sstevel@tonic-gate }; 188*7c478bd9Sstevel@tonic-gate 189*7c478bd9Sstevel@tonic-gate /* 190*7c478bd9Sstevel@tonic-gate * IEC61883_PLUG_REG_READ argument 191*7c478bd9Sstevel@tonic-gate */ 192*7c478bd9Sstevel@tonic-gate typedef struct iec61883_plug_reg_val { 193*7c478bd9Sstevel@tonic-gate int pr_handle; /* plug handle */ 194*7c478bd9Sstevel@tonic-gate uint32_t pr_val; /* register value */ 195*7c478bd9Sstevel@tonic-gate } iec61883_plug_reg_val_t; 196*7c478bd9Sstevel@tonic-gate 197*7c478bd9Sstevel@tonic-gate /* 198*7c478bd9Sstevel@tonic-gate * IEC61883_PLUG_REG_CAS argument 199*7c478bd9Sstevel@tonic-gate */ 200*7c478bd9Sstevel@tonic-gate typedef struct iec61883_plug_reg_lock { 201*7c478bd9Sstevel@tonic-gate int pl_handle; /* plug handle */ 202*7c478bd9Sstevel@tonic-gate uint32_t pl_arg; /* compare arg */ 203*7c478bd9Sstevel@tonic-gate uint32_t pl_data; /* write value */ 204*7c478bd9Sstevel@tonic-gate uint32_t pl_old; /* original value */ 205*7c478bd9Sstevel@tonic-gate } iec61883_plug_reg_lock_t; 206*7c478bd9Sstevel@tonic-gate 207*7c478bd9Sstevel@tonic-gate /* 208*7c478bd9Sstevel@tonic-gate * IEC61883_NODE_GET_TEXT_LEAF argument 209*7c478bd9Sstevel@tonic-gate */ 210*7c478bd9Sstevel@tonic-gate typedef struct iec61883_node_text_leaf { 211*7c478bd9Sstevel@tonic-gate int tl_parent; /* ROM parent */ 212*7c478bd9Sstevel@tonic-gate int tl_num; /* leaf number */ 213*7c478bd9Sstevel@tonic-gate int tl_len; /* buffer length */ 214*7c478bd9Sstevel@tonic-gate uint32_t *tl_data; /* data buffer */ 215*7c478bd9Sstevel@tonic-gate int tl_cnt; /* leaf count */ 216*7c478bd9Sstevel@tonic-gate int tl_rlen; /* real length */ 217*7c478bd9Sstevel@tonic-gate uint32_t tl_spec; /* specifier */ 218*7c478bd9Sstevel@tonic-gate uint32_t tl_lang_id; /* language id */ 219*7c478bd9Sstevel@tonic-gate uint32_t tl_desc_entry; /* entry described by this leaf */ 220*7c478bd9Sstevel@tonic-gate } iec61883_node_text_leaf_t; 221*7c478bd9Sstevel@tonic-gate 222*7c478bd9Sstevel@tonic-gate /* ROM parent types (tl_parent) */ 223*7c478bd9Sstevel@tonic-gate enum { 224*7c478bd9Sstevel@tonic-gate IEC61883_ROM_ROOT, /* leaf in the root directory */ 225*7c478bd9Sstevel@tonic-gate IEC61883_ROM_UNIT /* leaf in the unit directory */ 226*7c478bd9Sstevel@tonic-gate }; 227*7c478bd9Sstevel@tonic-gate 228*7c478bd9Sstevel@tonic-gate /* ioctl codes */ 229*7c478bd9Sstevel@tonic-gate #define IEC61883_IMPL_IOC ('i' << 8) 230*7c478bd9Sstevel@tonic-gate #define IEC61883_IMPL_MKIOC(c) (c | IEC61883_IMPL_IOC) 231*7c478bd9Sstevel@tonic-gate 232*7c478bd9Sstevel@tonic-gate #define IEC61883_ISOCH_INIT IEC61883_IMPL_MKIOC(0x01) 233*7c478bd9Sstevel@tonic-gate #define IEC61883_ISOCH_FINI IEC61883_IMPL_MKIOC(0x02) 234*7c478bd9Sstevel@tonic-gate #define IEC61883_START IEC61883_IMPL_MKIOC(0x03) 235*7c478bd9Sstevel@tonic-gate #define IEC61883_STOP IEC61883_IMPL_MKIOC(0x04) 236*7c478bd9Sstevel@tonic-gate #define IEC61883_RECV IEC61883_IMPL_MKIOC(0x05) 237*7c478bd9Sstevel@tonic-gate #define IEC61883_XMIT IEC61883_IMPL_MKIOC(0x06) 238*7c478bd9Sstevel@tonic-gate #define IEC61883_PLUG_INIT IEC61883_IMPL_MKIOC(0x07) 239*7c478bd9Sstevel@tonic-gate #define IEC61883_PLUG_FINI IEC61883_IMPL_MKIOC(0x08) 240*7c478bd9Sstevel@tonic-gate #define IEC61883_PLUG_REG_READ IEC61883_IMPL_MKIOC(0x09) 241*7c478bd9Sstevel@tonic-gate #define IEC61883_PLUG_REG_CAS IEC61883_IMPL_MKIOC(0x0A) 242*7c478bd9Sstevel@tonic-gate #define IEC61883_ARQ_GET_IBUF_SIZE IEC61883_IMPL_MKIOC(0x0B) 243*7c478bd9Sstevel@tonic-gate #define IEC61883_ARQ_SET_IBUF_SIZE IEC61883_IMPL_MKIOC(0x0C) 244*7c478bd9Sstevel@tonic-gate #define IEC61883_NODE_GET_BUS_NAME IEC61883_IMPL_MKIOC(0x0D) 245*7c478bd9Sstevel@tonic-gate #define IEC61883_NODE_GET_UID IEC61883_IMPL_MKIOC(0x0E) 246*7c478bd9Sstevel@tonic-gate #define IEC61883_NODE_GET_TEXT_LEAF IEC61883_IMPL_MKIOC(0x0F) 247*7c478bd9Sstevel@tonic-gate 248*7c478bd9Sstevel@tonic-gate 249*7c478bd9Sstevel@tonic-gate /* 32-bit structures for the drivers */ 250*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 251*7c478bd9Sstevel@tonic-gate typedef struct iec61883_isoch_init32 { 252*7c478bd9Sstevel@tonic-gate int ii_version; /* interface version */ 253*7c478bd9Sstevel@tonic-gate int ii_pkt_size; /* packet size */ 254*7c478bd9Sstevel@tonic-gate int ii_frame_size; /* packets/frame */ 255*7c478bd9Sstevel@tonic-gate int ii_frame_cnt; /* # of frames */ 256*7c478bd9Sstevel@tonic-gate int ii_direction; /* xfer direction */ 257*7c478bd9Sstevel@tonic-gate int ii_bus_speed; /* bus speed */ 258*7c478bd9Sstevel@tonic-gate uint64_t ii_channel; /* channel mask */ 259*7c478bd9Sstevel@tonic-gate int ii_dbs; /* DBS */ 260*7c478bd9Sstevel@tonic-gate int ii_fn; /* FN */ 261*7c478bd9Sstevel@tonic-gate int ii_rate_n; /* rate numerator */ 262*7c478bd9Sstevel@tonic-gate int ii_rate_d; /* rate denominator */ 263*7c478bd9Sstevel@tonic-gate int ii_ts_mode; /* timestamp mode */ 264*7c478bd9Sstevel@tonic-gate int ii_flags; /* flags */ 265*7c478bd9Sstevel@tonic-gate int ii_handle; /* isoch handle */ 266*7c478bd9Sstevel@tonic-gate int ii_frame_rcnt; /* # of frames */ 267*7c478bd9Sstevel@tonic-gate int32_t ii_mmap_off; /* mmap offset */ 268*7c478bd9Sstevel@tonic-gate int ii_rchannel; /* channel */ 269*7c478bd9Sstevel@tonic-gate int ii_error; /* error code */ 270*7c478bd9Sstevel@tonic-gate } iec61883_isoch_init32_t; 271*7c478bd9Sstevel@tonic-gate 272*7c478bd9Sstevel@tonic-gate typedef struct iec61883_node_text_leaf32 { 273*7c478bd9Sstevel@tonic-gate int tl_parent; /* ROM parent */ 274*7c478bd9Sstevel@tonic-gate int tl_num; /* leaf number */ 275*7c478bd9Sstevel@tonic-gate int tl_len; /* buffer length */ 276*7c478bd9Sstevel@tonic-gate caddr32_t tl_data; /* data buffer */ 277*7c478bd9Sstevel@tonic-gate int tl_cnt; /* leaf count */ 278*7c478bd9Sstevel@tonic-gate int tl_rlen; /* real length */ 279*7c478bd9Sstevel@tonic-gate uint32_t tl_spec; /* specifier */ 280*7c478bd9Sstevel@tonic-gate uint32_t tl_lang_id; /* language id */ 281*7c478bd9Sstevel@tonic-gate uint32_t tl_desc_entry; /* entry described by this leaf */ 282*7c478bd9Sstevel@tonic-gate } iec61883_node_text_leaf32_t; 283*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 284*7c478bd9Sstevel@tonic-gate 285*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 286*7c478bd9Sstevel@tonic-gate } 287*7c478bd9Sstevel@tonic-gate #endif 288*7c478bd9Sstevel@tonic-gate 289*7c478bd9Sstevel@tonic-gate #endif /* _SYS_AV_IEC61883_H */ 290