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