| 1 | /* $NetBSD: iec68113.h,v 1.4 2010/03/29 03:05:28 kiyohara Exp $ */ |
| 2 | /*- |
| 3 | * Copyright (c) 2003 Hidetoshi Shimokawa |
| 4 | * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions |
| 9 | * are met: |
| 10 | * 1. Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * 3. All advertising materials mentioning features or use of this software |
| 16 | * must display the acknowledgement as bellow: |
| 17 | * |
| 18 | * This product includes software developed by K. Kobayashi and H. Shimokawa |
| 19 | * |
| 20 | * 4. The name of the author may not be used to endorse or promote products |
| 21 | * derived from this software without specific prior written permission. |
| 22 | * |
| 23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 24 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 26 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
| 27 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 29 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 31 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| 32 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 33 | * POSSIBILITY OF SUCH DAMAGE. |
| 34 | * |
| 35 | * $FreeBSD: /repoman/r/ncvs/src/sys/dev/firewire/iec68113.h,v 1.9 2005/01/06 01:42:41 imp Exp $ |
| 36 | * |
| 37 | */ |
| 38 | |
| 39 | #ifndef _IEC68113_H_ |
| 40 | #define _IEC68113_H_ |
| 41 | |
| 42 | #define DV_BROADCAST_ON (1<<30) |
| 43 | #define oMPR 0x900 |
| 44 | #define oPCR 0x904 |
| 45 | #define iMPR 0x980 |
| 46 | #define iPCR 0x984 |
| 47 | |
| 48 | struct ciphdr { |
| 49 | #if BYTE_ORDER == BIG_ENDIAN |
| 50 | uint8_t eoh0:1, /* 0 */ |
| 51 | form0:1, /* 0 */ |
| 52 | src:6; |
| 53 | #else |
| 54 | uint8_t src:6, |
| 55 | form0:1, /* 0 */ |
| 56 | eoh0:1; /* 0 */ |
| 57 | #endif |
| 58 | uint8_t len; |
| 59 | #if BYTE_ORDER == BIG_ENDIAN |
| 60 | uint8_t fn:2, |
| 61 | qpc:3, |
| 62 | sph:1, |
| 63 | :2; |
| 64 | #else |
| 65 | uint8_t :2, |
| 66 | sph:1, |
| 67 | qpc:3, |
| 68 | fn:2; |
| 69 | #endif |
| 70 | uint8_t dbc; |
| 71 | #if BYTE_ORDER == BIG_ENDIAN |
| 72 | uint8_t eoh1:1, /* 1 */ |
| 73 | form1:1, /* 0 */ |
| 74 | fmt:6; |
| 75 | #else |
| 76 | uint8_t fmt:6, |
| 77 | form1:1, /* 0 */ |
| 78 | eoh1:1; /* 1 */ |
| 79 | #endif |
| 80 | #define CIP_FMT_DVCR 0 |
| 81 | #define CIP_FMT_MPEG (1<<5) |
| 82 | union { |
| 83 | struct { |
| 84 | #if BYTE_ORDER == BIG_ENDIAN |
| 85 | uint8_t fs:1, /* 50/60 field system |
| 86 | NTSC/PAL */ |
| 87 | stype:5, |
| 88 | :2; |
| 89 | #else |
| 90 | uint8_t :2, |
| 91 | stype:5, |
| 92 | fs:1; /* 50/60 field system |
| 93 | NTSC/PAL */ |
| 94 | #endif |
| 95 | #define CIP_STYPE_SD 0 |
| 96 | #define CIP_STYPE_SDL 1 |
| 97 | #define CIP_STYPE_HD 2 |
| 98 | uint16_t cyc:16; /* take care of byte order! */ |
| 99 | } __packed dv; |
| 100 | uint8_t bytes[3]; |
| 101 | } fdf; |
| 102 | |
| 103 | }; |
| 104 | struct dvdbc{ |
| 105 | #if BYTE_ORDER == BIG_ENDIAN |
| 106 | uint8_t sct:3, /* Section type */ |
| 107 | :1, /* Reserved */ |
| 108 | arb:4; /* Arbitrary bit */ |
| 109 | #else |
| 110 | uint8_t arb:4, /* Arbitrary bit */ |
| 111 | :1, /* Reserved */ |
| 112 | sct:3; /* Section type */ |
| 113 | #endif |
| 114 | #define 0 |
| 115 | #define DV_SCT_SUBCODE 1 |
| 116 | #define DV_SCT_VAUX 2 |
| 117 | #define DV_SCT_AUDIO 3 |
| 118 | #define DV_SCT_VIDEO 4 |
| 119 | #if BYTE_ORDER == BIG_ENDIAN |
| 120 | uint8_t dseq:4, /* DIF sequence number */ |
| 121 | fsc:1, /* ID of a DIF block in each channel */ |
| 122 | :3; |
| 123 | #else |
| 124 | uint8_t :3, |
| 125 | fsc:1, /* ID of a DIF block in each channel */ |
| 126 | dseq:4; /* DIF sequence number */ |
| 127 | #endif |
| 128 | uint8_t dbn; /* DIF block number */ |
| 129 | uint8_t payload[77]; |
| 130 | #define DV_DSF_12 0x80 /* PAL: payload[0] in Header DIF */ |
| 131 | }; |
| 132 | |
| 133 | #endif /* _IEC68113_H_ */ |
| 134 | |