xref: /freebsd/sys/dev/firewire/iec68113.h (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
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  *
37  */
38 
39 #define		DV_BROADCAST_ON (1<<30)
40 #define		oMPR		0x900
41 #define		oPCR		0x904
42 #define		iMPR		0x980
43 #define		iPCR		0x984
44 
45 struct ciphdr {
46 #if BYTE_ORDER == BIG_ENDIAN
47 	uint8_t eoh0:1,		/* 0 */
48 		form0:1,	/* 0 */
49 		src:6;
50 #else
51 	uint8_t src:6,
52 		form0:1,	/* 0 */
53 		eoh0:1;		/* 0 */
54 #endif
55 	uint8_t len;
56 #if BYTE_ORDER == BIG_ENDIAN
57 	uint8_t fn:2,
58 		qpc:3,
59 		sph:1,
60 		:2;
61 #else
62 	uint8_t :2,
63 		sph:1,
64 		qpc:3,
65 		fn:2;
66 #endif
67 	uint8_t dbc;
68 #if BYTE_ORDER == BIG_ENDIAN
69 	uint8_t eoh1:1,		/* 1 */
70 		form1:1,	/* 0 */
71 		fmt:6;
72 #else
73 	uint8_t fmt:6,
74 		form1:1,	/* 0 */
75 		eoh1:1;		/* 1 */
76 #endif
77 #define CIP_FMT_DVCR	0
78 #define CIP_FMT_MPEG	(1<<5)
79 	union {
80 		struct {
81 #if BYTE_ORDER == BIG_ENDIAN
82 			uint8_t fs:1,		/* 50/60 field system
83 								NTSC/PAL */
84 				stype:5,
85 				:2;
86 #else
87 			uint8_t :2,
88 				stype:5,
89 		  		fs:1;		/* 50/60 field system
90 								NTSC/PAL */
91 #endif
92 #define	CIP_STYPE_SD	0
93 #define	CIP_STYPE_SDL	1
94 #define	CIP_STYPE_HD	2
95 	  		uint16_t cyc:16;	/* take care of byte order! */
96 		} __attribute__ ((packed)) dv;
97 		uint8_t bytes[3];
98 	} fdf;
99 
100 };
101 struct dvdbc {
102 #if BYTE_ORDER == BIG_ENDIAN
103 	uint8_t sct:3,		/* Section type */
104 		:1,		/* Reserved */
105 		arb:4;		/* Arbitrary bit */
106 #else
107 	uint8_t arb:4,		/* Arbitrary bit */
108 		:1,		/* Reserved */
109 		sct:3;		/* Section type */
110 #endif
111 #define	DV_SCT_HEADER	0
112 #define	DV_SCT_SUBCODE	1
113 #define	DV_SCT_VAUX	2
114 #define	DV_SCT_AUDIO	3
115 #define	DV_SCT_VIDEO	4
116 #if BYTE_ORDER == BIG_ENDIAN
117 	uint8_t dseq:4,		/* DIF sequence number */
118 		fsc:1,		/* ID of a DIF block in each channel */
119 		:3;
120 #else
121 	uint8_t :3,
122 		fsc:1,		/* ID of a DIF block in each channel */
123 		dseq:4;		/* DIF sequence number */
124 #endif
125 	uint8_t dbn;		/* DIF block number */
126 	uint8_t payload[77];
127 #define	DV_DSF_12	0x80	/* PAL: payload[0] in Header DIF */
128 };
129