1/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_fs450.h,v 1.1 2002/12/10 15:12:27 alanh Exp $ */
2/*
3 * $Workfile: tv_fs450.h $
4 *
5 * This file defines the common FS450 API.
6 *
7 * NSC_LIC_ALTERNATIVE_PREAMBLE
8 *
9 * Revision 1.0
10 *
11 * National Semiconductor Alternative GPL-BSD License
12 *
13 * National Semiconductor Corporation licenses this software
14 * ("Software"):
15 *
16 *      Durango
17 *
18 * under one of the two following licenses, depending on how the
19 * Software is received by the Licensee.
20 *
21 * If this Software is received as part of the Linux Framebuffer or
22 * other GPL licensed software, then the GPL license designated
23 * NSC_LIC_GPL applies to this Software; in all other circumstances
24 * then the BSD-style license designated NSC_LIC_BSD shall apply.
25 *
26 * END_NSC_LIC_ALTERNATIVE_PREAMBLE */
27
28/* NSC_LIC_BSD
29 *
30 * National Semiconductor Corporation Open Source License for Durango
31 *
32 * (BSD License with Export Notice)
33 *
34 * Copyright (c) 1999-2001
35 * National Semiconductor Corporation.
36 * All rights reserved.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 *
42 *   * Redistributions of source code must retain the above copyright
43 *     notice, this list of conditions and the following disclaimer.
44 *
45 *   * Redistributions in binary form must reproduce the above
46 *     copyright notice, this list of conditions and the following
47 *     disclaimer in the documentation and/or other materials provided
48 *     with the distribution.
49 *
50 *   * Neither the name of the National Semiconductor Corporation nor
51 *     the names of its contributors may be used to endorse or promote
52 *     products derived from this software without specific prior
53 *     written permission.
54 *
55 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
56 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
57 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
58 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
59 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY
60 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
61 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
62 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
63 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
64 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
65 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY
66 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
67 * OF SUCH DAMAGE.
68 *
69 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
70 * YOUR JURISDICTION. It is licensee's responsibility to comply with
71 * any export regulations applicable in licensee's jurisdiction. Under
72 * CURRENT (2001) U.S. export regulations this software
73 * is eligible for export from the U.S. and can be downloaded by or
74 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed
75 * destinations which include Cuba, Iraq, Libya, North Korea, Iran,
76 * Syria, Sudan, Afghanistan and any other country to which the U.S.
77 * has embargoed goods and services.
78 *
79 * END_NSC_LIC_BSD */
80
81/* NSC_LIC_GPL
82 *
83 * National Semiconductor Corporation Gnu General Public License for Durango
84 *
85 * (GPL License with Export Notice)
86 *
87 * Copyright (c) 1999-2001
88 * National Semiconductor Corporation.
89 * All rights reserved.
90 *
91 * Redistribution and use in source and binary forms, with or without
92 * modification, are permitted under the terms of the GNU General
93 * Public License as published by the Free Software Foundation; either
94 * version 2 of the License, or (at your option) any later version
95 *
96 * In addition to the terms of the GNU General Public License, neither
97 * the name of the National Semiconductor Corporation nor the names of
98 * its contributors may be used to endorse or promote products derived
99 * from this software without specific prior written permission.
100 *
101 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
102 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
103 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
104 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
105 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY
106 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
107 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
108 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
109 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
110 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
111 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY
112 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
113 * OF SUCH DAMAGE. See the GNU General Public License for more details.
114 *
115 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
116 * YOUR JURISDICTION. It is licensee's responsibility to comply with
117 * any export regulations applicable in licensee's jurisdiction. Under
118 * CURRENT (2001) U.S. export regulations this software
119 * is eligible for export from the U.S. and can be downloaded by or
120 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed
121 * destinations which include Cuba, Iraq, Libya, North Korea, Iran,
122 * Syria, Sudan, Afghanistan and any other country to which the U.S.
123 * has embargoed goods and services.
124 *
125 * You should have received a copy of the GNU General Public License
126 * along with this file; if not, write to the Free Software Foundation,
127 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
128 *
129 * END_NSC_LIC_GPL */
130
131#ifndef __FS450_H__
132#define __FS450_H__
133
134#ifdef __cplusplus
135extern "C"
136{
137#endif
138
139/* ==========================================================================*/
140/*	Init and cleanup functions*/
141
142   int FS450_init(void);
143   void FS450_cleanup(void);
144   /* call FS450_init at startup to probe for and initialize FS450. */
145   /* returns 0 if successful. */
146
147/* ==========================================================================*/
148/*	TV output on or off*/
149
150   int FS450_get_tv_enable(unsigned int *p_on);
151   int FS450_set_tv_enable(unsigned int on);
152   /* on is 1 for TV on, 0 for off */
153
154/* ==========================================================================*/
155/*	TV standard*/
156
157   int FS450_get_tv_standard(unsigned long *p_standard);
158   int FS450_get_available_tv_standards(unsigned long *p_standards);
159   int FS450_set_tv_standard(unsigned long standard);
160   /* standard is one of the FS450_TV_STANDARD constants */
161   /* standards is a bitmask of zero or more FS450_TV_STANDARD constants */
162
163/* FS450 TV Standard flags*/
164#define FS450_TV_STANDARD_NTSC_M 0x0001
165#define FS450_TV_STANDARD_NTSC_M_J 0x0002
166#define FS450_TV_STANDARD_PAL_B 0x0004
167#define FS450_TV_STANDARD_PAL_D 0x0008
168#define FS450_TV_STANDARD_PAL_H 0x0010
169#define FS450_TV_STANDARD_PAL_I 0x0020
170#define FS450_TV_STANDARD_PAL_M 0x0040
171#define FS450_TV_STANDARD_PAL_N 0x0080
172#define FS450_TV_STANDARD_PAL_G 0x0100
173
174/* ==========================================================================*/
175/*	VGA mode assumed by FS450*/
176
177   int FS450_get_vga_mode(unsigned long *p_vga_mode);
178   int FS450_get_available_vga_modes(unsigned long *p_vga_modes);
179   int FS450_set_vga_mode(unsigned long vga_mode);
180   /* vga_mode is one of the FS450_VGA_MODE constants */
181   /* vga_modes is a bitmask of zero or more FS450_VGA_MODE constants */
182
183/* FS450 VGA Mode flags*/
184#define FS450_VGA_MODE_UNKNOWN 0
185#define FS450_VGA_MODE_640X480 0x0001
186#define FS450_VGA_MODE_720X487 0x0002
187#define FS450_VGA_MODE_720X576 0x0004
188#define FS450_VGA_MODE_800X600 0x0008
189#define FS450_VGA_MODE_1024X768 0x0010
190
191/* ==========================================================================*/
192/*	TVout mode*/
193
194   int FS450_get_tvout_mode(unsigned long *p_tvout_mode);
195   int FS450_set_tvout_mode(unsigned long tvout_mode);
196   /* tvout_mode is a bitmask of FS450_TVOUT_MODE constants */
197
198/* FS450 TVout mode flags*/
199#define FS450_TVOUT_MODE_CVBS 0x0001
200#define FS450_TVOUT_MODE_YC 0x0002
201#define FS450_TVOUT_MODE_RGB 0x0004
202#define FS450_TVOUT_MODE_CVBS_YC (FS450_TVOUT_MODE_CVBS | FS450_TVOUT_MODE_YC)
203
204/* ==========================================================================*/
205/*	Flicker control*/
206
207   int FS450_get_sharpness(int *p_sharpness);
208   int FS450_set_sharpness(int sharpness);
209   /* sharpness is a percentage in tenths of a percent, 0 to 1000 */
210
211   int FS450_get_flicker_filter(int *p_flicker);
212   int FS450_set_flicker_filter(int flicker);
213   /* flicker_filter is a percentage in tenths of a percent, 0 to 1000 */
214
215/* ==========================================================================*/
216/*	Size and Position*/
217
218   int FS450_get_overscan(int *p_x, int *p_y);
219   int FS450_set_overscan(int x, int y);
220   int FS450_get_position(int *p_x, int *p_y);
221   int FS450_set_position(int x, int y);
222   /* x and y are horizontal and vertical adjustments, -1000 to +1000 */
223
224/* ==========================================================================*/
225/*	Visual adjustments*/
226
227   int FS450_get_color(int *p_color);
228   int FS450_set_color(int color);
229   /* color is a percentage, 0 to 100 */
230
231   int FS450_get_brightness(int *p_brightness);
232   int FS450_set_brightness(int brightness);
233   /* brightness is a percentage, 0 to 100 */
234
235   int FS450_get_contrast(int *p_contrast);
236   int FS450_set_contrast(int constrast);
237   /* contrast is a percentage, 0 to 100 */
238
239/* ==========================================================================*/
240/*	Luma and Chroma filter*/
241
242   int FS450_get_yc_filter(unsigned int *p_yc_filter);
243   int FS450_set_yc_filter(unsigned int yc_filter);
244   /* yc_filter is a bitmask of FS450_LUMA_FILTER and/or FS450_CHROMA_FILTER */
245
246/* FS450 Luma and Chroma Filters*/
247#define FS450_LUMA_FILTER 0x0001
248#define FS450_CHROMA_FILTER 0x0002
249
250/* ==========================================================================*/
251/*	Macrovision*/
252
253   int FS450_get_aps_trigger_bits(unsigned int *p_trigger_bits);
254   int FS450_set_aps_trigger_bits(unsigned int trigger_bits);
255   /* trigger_bits is one of the FS450_APS_TRIGGER constants */
256
257/* APS Trigger Bits*/
258#define FS450_APS_TRIGGER_OFF 0
259#define FS450_APS_TRIGGER_AGC_ONLY 1
260#define FS450_APS_TRIGGER_AGC_2_LINE 2
261#define FS450_APS_TRIGGER_AGC_4_LINE 3
262
263/* ==========================================================================*/
264/*	direct access to Houston and platform registers (debug builds only)*/
265/*	The two functions FS450_ReadRegister and FS450_WriteRegister allow access*/
266/*	to device registers.  These functions are intended for debugging purposes*/
267/*	only and should not be included in a shipping product.*/
268
269#ifdef FS450_DIRECTREG
270
271#define SOURCE_HOUSTON 0
272#define SOURCE_GCC 1
273
274   typedef struct _S_REG_INFO
275   {
276      int source;
277      unsigned int size;
278      unsigned long offset;
279      unsigned long value;
280   }
281   S_REG_INFO;
282
283   int FS450_ReadRegister(S_REG_INFO * p_reg);
284   int FS450_WriteRegister(S_REG_INFO * p_reg);
285
286#endif
287
288/* ==========================================================================*/
289/* Error Codes*/
290
291#define ERR_INVALID_PARAMETER			0x1000
292#define ERR_NOT_SUPPORTED				0x1001
293#define ERR_CANNOT_CHANGE_WHILE_TV_ON	0x1002
294
295#define ERR_DRIVER_NOT_FOUND			0x1100
296#define ERR_DRIVER_ERROR				0x1101
297#define ERR_DEVICE_NOT_FOUND			0x1120
298
299#define ERR_I2C_MISSING_DEVICE			0x1200
300#define ERR_I2C_WRITE_FAILED			0x1201
301#define ERR_I2C_READ_FAILED				0x1202
302
303#ifdef __cplusplus
304}
305#endif
306
307#endif
308