1/*-
2 * Copyright (c) 1994, 1995, 1996.  FreeBSD(98) porting team.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer as
10 *    the first lines of this file unmodified.
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. The name of the author may not be used to endorse or promote products
15 *    derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD$
29 */
30
31#ifndef __PC98_PC98_30LINE_H__
32#define __PC98_PC98_30LINE_H__
33
34#define	LINE30_ROW	30
35#define	_HS	1 + 1
36#define	_VS	2
37#define	_HFP	3 + 1
38#define	_HBP	14 + 1
39#define	_VFP	11
40#define	_VBP	44
41
42#define	_CR	80
43#define _LF	LINE30_ROW*16
44
45#define	_GDC_RESET	0x00
46#define _GDC_SYNC	0x0e
47#define _GDC_MASTER	0x6f
48#define _GDC_SLAVE	0x6e
49#define _GDC_START	0x0d
50#define _GDC_STOP	0x0c
51#define _GDC_SCROLL	0x70
52#define _GDC_PITCH	0x47
53
54#define GDC_CR	0
55#define GDC_VS	1
56#define GDC_HS	2
57#define GDC_HFP	3
58#define GDC_HBP	4
59#define GDC_VFP	5
60#define GDC_VBP	6
61#define GDC_LF	7
62
63
64#define _24KHZ	0
65#define _31KHZ	1
66
67#define _2_5MHZ	0
68#define _5MHZ	1
69
70#define _25L		0
71#define _30L		1
72
73#define T25_G400	0
74#define T30_G400	1
75#define T30_G480	2
76
77static void master_gdc_cmd(unsigned int);
78static void master_gdc_prm(unsigned int);
79static void master_gdc_word_prm(unsigned int);
80#ifdef LINE30
81static void master_gdc_fifo_empty(void);
82#endif
83static void master_gdc_wait_vsync(void);
84
85static void gdc_cmd(unsigned int);
86#ifdef LINE30
87static void gdc_prm(unsigned int);
88static void gdc_word_prm(unsigned int);
89static void gdc_fifo_empty(void);
90#endif
91static void gdc_wait_vsync(void);
92
93#ifdef LINE30
94static int check_gdc_clock(void);
95
96static int gdc_INFO = _25L;
97#endif
98static int gdc_FH = _24KHZ;
99static void initialize_gdc(unsigned int, int);
100
101#ifdef LINE30
102static unsigned int master_param[2][2][8] = {
103{{78,	 8,	7,	9,	7,	7,	25,	400},	/* 400/24k */
104 {_CR-2, _VS,	_HS-1,	_HFP-1,	_HBP-1,	_VFP,	_VBP,	_LF}},	/* 480/24k */
105{{78,	 2,	7,	3,	7,	13,	34,	400},	/* 400/31k */
106 {78,	 2,	11,	3,	3,	6,	37,	480}}};	/* 480/31k */
107
108static unsigned int slave_param[2][6][8] = {
109{{38,	8,	3,	4,	3,	7,	25,	400},	/* normal */
110 {78,	8,	7,	9,	7,	7,	25,	400},
111 {_CR/2-2,	_VS,	(_HS)/2-1,	(_HFP)/2-1,	(_HBP)/2-1,
112  _VFP+(_LF-400)/2+8,	_VBP+(_LF-400)/2-8,	400},		/* 30 & 400 */
113 {_CR-2,	_VS,	_HS-1,	_HFP-1,	_HBP-1,
114  _VFP+(_LF-400)/2+8,	_VBP+(_LF-400)/2-8,	400},
115 {_CR/2-2,	_VS,	(_HS)/2-1,	(_HFP)/2-1,	(_HBP)/2-1,
116  _VFP,	_VBP,	_LF},						/* 30 & 480 */
117 {_CR-2,	_VS,	_HS-1,	_HFP-1,	_HBP-1,	_VFP,	_VBP,	_LF}},
118{{38,	2,	3,	1,	3,	13,	34,	400},	/* normal */
119 {78,	2,	7,	3,	7,	13,	34,	400},
120 {38,	2,	5,	1,	1,	6+48,	37+32,	400},	/* 30 & 400 */
121 {78,	2,	11,	3,	3,	6+48,	37+32,	400},
122 {38,	2,	5,	1,	1,	6,	37,	480},	/* 30 & 480 */
123 {78,	2,	11,	3,	3,	6,	37,	480}}};
124
125static int SlavePCH[2] = {40,80};
126static int MasterPCH = 80;
127static int SlaveScrlLF[3] = {400,400,_LF};
128#endif
129
130#endif /* __PC98_PC98_30LINE_H__ */
131