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