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