nvtv-0.4.7/0000777000175000001440000000000010041244623006254 5nvtv-0.4.7/Makefile.in0000644000175000001440000002713010041244621010236 # Makefile.in generated automatically by automake 1.4-p6 from Makefile.am # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : CC = @CC@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ MAKEINFO = @MAKEINFO@ OBJS_BACKEND = @OBJS_BACKEND@ OBJS_EXTRA = @OBJS_EXTRA@ OBJS_GUI = @OBJS_GUI@ PACKAGE = @PACKAGE@ PKG_CONFIG = @PKG_CONFIG@ PROGRAM = @PROGRAM@ VERSION = @VERSION@ WX_CFLAGS = @WX_CFLAGS@ WX_CFLAGS_ONLY = @WX_CFLAGS_ONLY@ WX_CONFIG_PATH = @WX_CONFIG_PATH@ WX_CPPFLAGS = @WX_CPPFLAGS@ WX_CXXFLAGS = @WX_CXXFLAGS@ WX_CXXFLAGS_ONLY = @WX_CXXFLAGS_ONLY@ WX_LIBS = @WX_LIBS@ WX_LIBS_STATIC = @WX_LIBS_STATIC@ WX_VERSION = @WX_VERSION@ SUBDIRS = src man test doc_extra = ANNOUNCE BUGS FAQ doc doc_bincopy = AUTHORS COPYING ChangeLog INSTALL NEWS $(doc_extra) doc_bin = README $(doc_bincopy) EXTRA_DIST = $(doc_extra) # bin distribution distbindir = $(distdir)-bin ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ./src/config.h CONFIG_CLEAN_FILES = DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ Makefile.in NEWS TODO aclocal.m4 config.guess config.sub configure \ configure.in install-sh ltmain.sh missing mkinstalldirs src/config.h.in \ src/stamp-h.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best all: all-redirect .SUFFIXES: $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status $(ACLOCAL_M4): configure.in cd $(srcdir) && $(ACLOCAL) config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) src/config.h: src/stamp-h @if test ! -f $@; then \ rm -f src/stamp-h; \ $(MAKE) src/stamp-h; \ else :; fi src/stamp-h: $(srcdir)/src/config.h.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES= CONFIG_HEADERS=src/config.h \ $(SHELL) ./config.status @echo timestamp > src/stamp-h 2> /dev/null $(srcdir)/src/config.h.in: $(srcdir)/src/stamp-h.in @if test ! -f $@; then \ rm -f $(srcdir)/src/stamp-h.in; \ $(MAKE) $(srcdir)/src/stamp-h.in; \ else :; fi $(srcdir)/src/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOHEADER) @echo timestamp > $(srcdir)/src/stamp-h.in 2> /dev/null mostlyclean-hdr: clean-hdr: distclean-hdr: -rm -f src/config.h maintainer-clean-hdr: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. @SET_MAKE@ all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive \ check-recursive installcheck-recursive info-recursive dvi-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev="$$subdir $$rev"; \ test "$$subdir" != "." || dot_seen=yes; \ done; \ test "$$dot_seen" = "no" && rev=". $$rev"; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ here=`pwd` && cd $(srcdir) \ && mkid -f$$here/ID $$unique $(LISP) TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) mostlyclean-tags: clean-tags: distclean-tags: -rm -f TAGS ID maintainer-clean-tags: distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist -rm -rf $(distdir) GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz mkdir $(distdir)/=build mkdir $(distdir)/=inst dc_install_base=`cd $(distdir)/=inst && pwd`; \ cd $(distdir)/=build \ && ../configure --srcdir=.. --prefix=$$dc_install_base \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) dist -rm -rf $(distdir) @banner="$(distdir).tar.gz is ready for distribution"; \ dashes=`echo "$$banner" | sed s/./=/g`; \ echo "$$dashes"; \ echo "$$banner"; \ echo "$$dashes" dist: distdir -chmod -R a+r $(distdir) GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) -rm -rf $(distdir) dist-all: distdir -chmod -R a+r $(distdir) GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) -rm -rf $(distdir) distdir: $(DISTFILES) -rm -rf $(distdir) mkdir $(distdir) -chmod 777 $(distdir) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done for subdir in $(SUBDIRS); do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ chmod 777 $(distdir)/$$subdir; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ || exit 1; \ fi; \ done info-am: info: info-recursive dvi-am: dvi: dvi-recursive check-am: all-am check: check-recursive installcheck-am: installcheck: installcheck-recursive install-exec-am: install-exec: install-exec-recursive install-data-am: install-data: install-data-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-recursive uninstall-am: uninstall: uninstall-recursive all-am: Makefile all-redirect: all-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: installdirs-recursive installdirs-am: mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic mostlyclean: mostlyclean-recursive clean-am: clean-hdr clean-tags clean-generic mostlyclean-am clean: clean-recursive distclean-am: distclean-hdr distclean-tags distclean-generic clean-am distclean: distclean-recursive -rm -f config.status maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \ maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-recursive -rm -f config.status .PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ install-data-recursive uninstall-data-recursive install-exec-recursive \ uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ all-recursive check-recursive installcheck-recursive info-recursive \ dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ install-exec install-data-am install-data install-am install \ uninstall-am uninstall all-redirect all-am all installdirs-am \ installdirs mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean # tar aliases tarball: tar-bin tar-src tar-src: dist tar-bin: dist-bin distdir-bin: src/nvtv src/nvtvd -rm -rf $(distbindir) mkdir $(distbindir) -chmod 777 $(distbindir) ln -s `pwd`/README.binary $(distbindir)/README @for f in $(doc_bincopy) ; do \ ln -s `pwd`/$$f $(distbindir) ; \ done ; @for f in nvtv nvtvd ; do \ cp -p src/$$f $(distbindir)/ ; \ strip $(distbindir)/$$f ; \ done dist-bin: distdir-bin -chmod -R a+r $(distbindir) GZIP=$(GZIP_ENV) $(TAR) chozf $(distbindir).tar.gz $(distbindir) -rm -rf $(distbindir) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: nvtv-0.4.7/README0000644000175000001440000000202307547514036007064 This is an alpha release of nv-tv-out. It is a program to control the TV chips on NVidia cards under Linux, in order to get tv-out with a wide range of resolutions and sizes. This program is protected by the Gnu Public License (GPL). See LICENSE for details. As an alpha release, there are probably still many bugs, and many things are unfinished. Don't expect to much. Use it carefully. It is in theory possible to damage your hardware. No responsibility will be taken by the programmers in that (unlikely) case. Again, see LICENSE for details. For installation notes, read INSTALL. For a list of supported TV encoder chips, see doc/chips.txt If you run into problems and want help, look at the FAQ or BUGS. If you want to contribute in any way, with settings for special modes, support for new encoder chips, new functionality, or a package for your preferred Linux distribution, have a look at the Sorceforge homepage http://sourceforge.net/projects/nv-tv-out/ And now enjoy the program. Dirk Thierbach nvtv-0.4.7/AUTHORS0000644000175000001440000000123007666701706007257 Authors and contributors ------------------------ Main programming: Dirk Thierbach GeForce4 testing: Markus Schneider Philips testing, modes and some code: Harri Salokorpi Conexant testing, modes and some code: Arne Morten Kvarving Rudolf Cornelissen Some XBox code: Milosch Meriac Initial GTK2 support: Adrian Reber Bugfixes: Roderick Colenbrander Salvador Eduardo Tropea Mode data contributions: Henrik Harmsen Xine & client library Mattias Eriksson Matthias Hopf Donations: Reinhard Mantey (GeForce 4 MX) nvtv-0.4.7/COPYING0000644000175000001440000004311007327031717007235 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. nvtv-0.4.7/ChangeLog0000644000175000001440000003116310041244334007745 2004-04-20 RELEASE alpha version 0.4.7 * Added life testing against simulated hardware. * Made own package for lib subdirectory * Fixed missing include in nvtv.c * Allow close before open. 2004-03-08 RELEASE alpha version 0.4.6 * FreeBSD patch by Samuel Tardieu. (sed instead of expr in configure, opl() and ioperm() compatibility functions for FreeBSD.) * Added PCI ids. Changed arch setup in back_nvidia. * Moved port permissions to mmio.c (not tested for NetBSD). * Debugging messages enabled by option instead of define. * Fixed missing getHeadDev dispatch in nvtvd.c * Removed Chrontel power settings warning. * Added Chrontel-2 modes. * Renamed PAL 800x600,640x480 and NTSC 640x480,640x400,720x400 'Large' Chrontel-1 modes to 'Huge' for consistency with Chrontel-2 * Added some FAQ entries. * Start of i865 support. * Disable NX support temporarily for release. * Fixed excess 1 encoding for i810 registers. * Added --list option. * Only setup and clamp for TV modes in back_*. * Fixed missing devFlags for ACTION_TVOFF * Start of i830/i845/CH2 support. * I2C bus for i845. * RAISE for messages, -q option for nvtvd, syslog. * Fixed Debian boot script FAQ. * I2C busses don't use X screen index any longer. * Fixed Philips detection bug in tv_common. * Use CARD8/16/32 as base types. * 3 NX modes; NX is partly working. * New CX/TW detection (again). CX is tested, TW will be soon. * NetBSD patch by Quentin Garnier * Added PCI IDs from 1.0-4363 * Included PAL-X patch 727924 by Joe Cotroneo (joecotroneo). * Start of nx (GeForce4 internal) support (not working yet). * Fixed missing head in bnv_updateCrt in back_nvidia. 2003-06-02 Dirk Thierbach RELEASE alpha version 0.4.5 * Changed FBAS and SVHS to COMPOSITE and SVIDEO. * Moved nvtvsimple files to own directory, with own configure. * Adapted man directory for automake. * Changed x_includes to X_CFLAGS in configure.in, to fix Debian bug 192455. * Added nvtvsimple files from Mattias Eriksson. * Added automake files. Renamed LICENSE -> COPYING, main.[ch] -> nvtv.[ch], server.c -> nvtvd.c. * Updated xine info in FAQ. * Card argument for setup, proper mux setup for Voodoo3. * Added another Voodoo3 BT connector status detection. * Added PAL-M and NTSC-J converter for Brooktree/Conexant. * Added extra bus for I830. * Dump for i830 in probeCard. * Added CH7009 (Model2) detection and preleminary support. * Fixed devMem in nvdump. * Check if NV Timer is active before using it. * WxWin configure stuff (no WxWin files yet). * Fixed missing 'methods' in TvNull. * Support NVidia driver 1.0-4349. * Special init also for NV17, NV18, NV25, NV30. * Refactored identify mapping into card_direct. 2003-03-14 Dirk Thierbach RELEASE alpha version 0.4.4 * Fixed configure/local.h bug for different GTK versions. * FAQ update Q 3.5, 2.6, 2.1. * Set bit 8 in PRAMDAC 0x8c0 for non-TV head, as driver does. * Reset bit 8 in PRAMDAC 0x8c0 on both heads for GF4. * Can now write registers with nvdump. * Split CH Reg Page, POUTP flag, PCLK_POLARITY now for m/s*, Colorfix for Chrontel, updated USAGE and FAQ. * Implemented findByOverscan (no calculation of new modes) * Power down flags for Chrontel page. * String pool in client to eliminate space leak. * Implemented listModes in all backends but client. * Updated docs, error messages in back_mswin. * Added fallback VESA modelines in data_vesa. * PH calc for SAA7104. * Implemented split in rest of nvtv. * Split tv_ph in tv_ph1_saa7102, tv_ph2_saa7104 * GetPort, GetRegs in tv_*.c; Fetch, Bypass in GUI. * Added forgotten phase_off in tv_bt.c * Now compiler under cygwin (command line only). Add back_mswin, back_unix, xf86_ansic.h, config.h.in; changed Makefile and configure; extended role of local.h, removed lots of xfree.h includes. 2003-02-01 Dirk Thierbach RELEASE alpha version 0.4.3 * Fixed settings available flag after setChip in nv/i810/tdfx. * Fixed partly pipe transmission of size and spec strings. * Refactored error messages in error.h (not complete) * Support NVidia driver 1.0-4191 including versioning magic. * PH Calc also does overscan and init. * Numbered and sorted FAQ entries. * Tried to improve NVSetTvHead safeguard. * More Philips SAA7104 support. * Bugfix in server.c (getHeadDev and getHeads were mixed.) * PMR_SCART flag for Chrontel. No RGB mode in Setup yet. * More PCI ids. Kernel 4191 versioning warning. * Fix in bnv_initHeads, and NVSetTvHead. * Bool optionally declared in local.h. * Removed null backend references from client backend. * NV Delay routine using NV timer (will also work under Windows). * Refactored probe and create chain, only include correctly detected chips for TVProbeCreateKnown. * New detection method, including TW decoder (tested). * FAQ update. * Fixed bug in option settings processing. * Updated config.sub and config.guess from automake 1.4-p6 (Debian Woody) * Excluded all X header files and libraries, including configure checks, for -without-x. * Split actions.c into X actions and printing actions in print.c * Updated doc. * Specify encoder bus and address with --chip option. * Shared nv/xbox backend, moved iopl to card_direct.c * Port page has format, CARD_XBOX, data_xbox.{c,h} * PORT_FORMAT and PORT_XBOX, XBox BIOS mode. * XBox patch, fp registers, print routine. 2002-11-08 Dirk Thierbach RELEASE alpha version 0.4.2 * BT PAL 768x576 Huge mode, thanks to Henrik Harmsen * Generic NV architecture from bootmask. * Bugfix: Scan higher numbered I2C busses first, and don't look for opt_tv_chip in gui_device_init if it is TV_NO_CHIP. This will avoid TV encoder chips which are on the EDID channel of a TV card. * Now also GTK 2.0 supported (GTK 1.2 still available). Thanks to Adrian Reber * Attempt to get GeForce2 Go working. * Double scan. * Extra CRTC bits for NV11+, NV17+. * EnableDVO (may fix GF4 problems). * Query command line option. Updated USAGE and manpage. * Carrier FreeRun and CFRB,CVBW,ACIV flags for Chrontel. * Chrontel PAL-60 modes (don't work properly). * More additions on manpage. * Card pci addr option, updated manpage. * Bugfix in head_update_cb. * Added MMIO RANGE checks for debugging. * Bugfix in NVSetVideoPointOut. * Updated for NVidia driver structure 1.0-3123. * Bugfix in NVInitTvHead. * Included Debian manpages into doc/man, and updated them. * First attempt of TV only overlay. Doesn't work yet, and unsafe. * INSTALL notes about nvdump program. * Fixed (hopefully) non-standard X include path issue in configure. 2002-09-12 Dirk Thierbach RELEASE alpha version 0.4.1-pre1 * Moved configure stuff to main dir, included versioning. * Server FIFO director configure option. * For NV4/5, set data/comp source. This hopefully fixes the pink strip bug. * Port page, test a BT async mode. * CONFIG define for GeForce Go cards. * Added Chrontel NTSC-J modes (untested). * Refactored database for different cards. Added data_tdfx, data_i810. * Voodoo3 modes. * 3dfx cleanup, Philips 7104 bugfix. Added gui_tdfx, gui_i810. * Removed Distort setting flags, added ColorFix. Philips edge flag. * Added philips connector setup and detection. * Cleanup in tv_nv * Architecture info; init crt 53/54 for NV25 * Slave Chrontel modes work now; config option in debug.h * Split card_direct from back_direct, added nvdump * Extended FAQ * Added mmio.h, renamed nv_tv to tv_nv * Host and encoder ports, first attempt at slave modes * Internal: Changed data structures, split gui_nv, data_nv * Internal: Encoder object * Philips 7104/05 support attempt. FIXME: Guard it * Bugfix CX/BT status page. * Accelerator to switch X modes. * PAL-60 modes. * CLists now sort with descending order on second click. * NVidia driver structure 1.0-2960 added. 2002-05-23 Dirk Thierbach RELEASE alpha version 0.4.0 * Commandline settings for flags * Probe both 0x42 and 0x40 to detect SAA7108/09 * FAQ changes * Bugfix in server/client for heads. * Bugfix in server/client, thanks to Salvador Eduardo Tropea * Fix to accept changed data structures in newer kernel modules. * Conexant settings. * Centered Conexant 3:2 modes, thanks to Arne Morten Kvarving. * Brooktree/Conexant calc now also does 3:2 clock modes and pixel character clock modes (which seem to work). * Conexant timing reset, thanks to Rudolf Cornelissen. * Philips macrovision (untested). * Brooktree/Conexant CONVERT also for DACB. * Dualhead documentation. * Different method to disable monitor in non-dualview mode. * Philips settings, flc & phres fields, and modes. * Dualhead commandline control. * Chrontel: NTSC 'No dot crawl', PAL-M, and PAL-N modes. * Database 'diff' data specification. * Updated overview.txt with new structure. * Rearranged GUI. * New settings. * Start of 3dfx support. * Start of i810 support, including i810 PCI ids. * Notebook menu now on left side. * Window adjust button. * Secam modes for Conexant. * Dualhead support. * Conexant 3:2 autoconfig modes. Untested. * Settings command-line switches. * Display architecture instead of I/O base. * Philips support works with a few more or less stable modes. * Split nv_tv into serveral files, renamed common structures. * Started special Conexant support. * More PCI Ids, including GeForce2Go. * Brooktree DVD modes. * System probe reimplemented. * Both state and regs in nv_tv routines. * Special Conexant gui, data, and i2c routines. * BT en_async flag. 2002-02-17 Dirk Thierbach * GUI now respects chiptype option. * Started Philips chip support. 2002-02-11 Dirk Thierbach RELEASE alpha version 0.3.0 * Added bandwidth setting. * Major internal structure change, now frontend/backend architecture. * Different switchback to monitor method (reads current crt settings from hardware). * SyncStart and SyncEnd affect CRT as in NVidia driver (not as in X 'nv' driver); data tables updated. * Rewrote detection code, added detection for Philips and Conexant chips. Conexant should not go in Brooktree mode. * Added -f flicker filter option * Added -N option, updated INSTALL and BUGS * Rewrote option processing. * Client backend, and server. * Resized spin buttons based on very rough estimate of font size. * Adapt flicker filter to scaler value for Brooktree. * Better sync calculation for Brooktree. * Completed Pär Aronsson's special FCSI values (PAL-X). * Reordered Chrontel modes. 2002-01-17 Dirk Thierbach RELEASE alpha version 0.2.3 to CVS * For non-root usage, /dev/nv* support * Bugfix: sizeof (CardPtr *) in pci.c * If already in TV, don't init TV chips, no colorbars. * PAL-X Pseudo TV System for corrected FSCI values * FAQ update (Riva128 not supported) * SuSE 7.2 and Mandrake INSTALL notes. * Only write known CRT register values. * More checks in configure, flag errors for missing files. * Extra Makefile in topdir for tarballs etc. * Check for root privileges. * Added Roderick Colenbrander's BT 720x480 Normal mode. 2002-01-06 Dirk Thierbach RELEASE alpha version 0.2.2 to CVS * Added Chrontel DVD modes * Accelerator for 'Reset'-buttons * Improved commandline switchback to monitor (uses vidmode) * Bugfix: Switchback to monitor only now works, thanks to Roderick Colenbrander * Bugfix: Correct FSCI value for 640x480 PAL Tiny (Mode 15) * Bugfix: Corrected BT 800x600 PAL Large mode * Bugfix: Corrected print_crt_regs * Bugfix: HSkew for BT modes * Fixed some BT modes * Finished Chrontel Macrovision (as far as possible) * Reworked Macrovision code 2001-12-27 Dirk Thierbach RELEASE alpha version 0.2.1 to CVS * Status page for Chrontel * ACIV, CIVH, VBW registers in Chrontel * Bugfix: Use twin spinbutton for 32bit values (FSCI and MSC) * Bugfix: Bits for pll_n/pll_m in gui_ch * Bugfix: init data in main * Bugfix: Reset for chip registers * Version in about page 2001-12-16 Dirk Thierbach Many changes, including: * Chrontel support with all NTSC and PAL modes. * Handle all the I2C busses at once; so the 'access' routines are obsolete. * Include the tertiary I2C bus in scan. * New connector setting to support Brooktree chips with 'simple' S-VHS to composite (FBAS,VHS) connector. * Keyboard accelerators now listed and unified. * Renamed mode sizes into Tiny/Small/Normal/Large/Huge modes. Changed Brooktree mode names accordingly. * Rework of the 'Settings' page, together with * Introduction of the data init/setup/clamp scheme. * Added 'about' page. 2001-12-05 Dirk Thierbach * Alpha version 0.10 in CVS. nvtv-0.4.7/INSTALL0000644000175000001440000001426610037021237007231 For many distributions, for example Debian, Suse, and Gentoo, nvtv is now available as a package. (I would appreciate it if the package maintainers would drop me an email when they package nvtv, so I can update the documentation.) There is a basic configure script, however, it has not been tested on many systems yet. BASIC INSTALLATION ------------------ Type "./configure", then "cd src", and then "make". Copy the executables "nvtv" and "nvtvd" to your favorite bin directory. See USAGE about how to run the program. You can optionally make a program "nvdump" by typing "make nvdump". This program dumps parts of the NVidia register space and can be used for troubleshooting. It is normally not required. If anything goes wrong, first try to figure out if a library is missing. The configure script should stop in this case with a message like "library xyz required" or "header 'xyz' required". These libraries and their header files should then be installed in a place where they can be found by the compiler. Libraries needed are libpci, libXmu, libXxf86vm and gtk (1.2 or 2.0) The pciutils library is not installed by default on many systems, though it is available for most of them as a package. If not, you can download it from http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml CONFIGURE OPTIONS ----------------- Additional configure options are --enable-debug [default] --disable-debug Add debugging information (-g), or optimize instead (-O2). --with-gtk [default] --with-gtk=gtk1 --with-gtk=gtk2 --without-gtk Allows you to choose the GTK version (1.2 vs. 2.0), or to build completely without the GTK graphical user interface. In that case, you are restricted to command line invocation. If GTK cannot be found on your system, the build is automatically restricted; so if you can only use the command line, that is the probable reason. If no options are given, configure checks first for GTK 1.2, and then for GTK 2.0 (because some parts of the GUI still have wrong sizes under GTK 2.0). --with-fifo-path=[PATH] The path for the two named pipes (fifos) that the server and the client use to communicate with each other. Default is /var/run. If this directory is not available on your system, use another one, for example /tmp. Make sure that the directory really exists, and has correct permissions. DEBIAN ------ On Debian, you need the packages pciutils-dev, xlibs, xlibs-dev, libgtk1.2 and libgtk1.2-dev or libgtk2.0 and libgtk2.0-dev. SUSE 7.1 -------- For installing Nvtv on Suse 7.1 you need to get the pciutils (see above) After installing pciutils you'll have to copy some files from the pciutils-xyz/lib directory manually (as root) to /usr: cd pciutils-xys/lib mkdir /usr/include/pci cp *.h /usr/include/pci cp libpci.a /usr/lib Then do: ldconfig Now you are ready to run Nvtv's configure-script. Be sure you have the other needed packages installed! (See above) SUSE 7.2 -------- The SuSE 7.2 series zq has now the source package pciutils_spm (v2.1.8). Installing it with YaST copies the sources and diffs into the directory /usr/src/packages/SOURCES. Use 'bzip2 -d pciutils-2.1.8.tar.bz2' to extract the files into pciutils-2.1.8/lib. After a 'cd' into this directory and './configure' followed by './make', follow the procedure above for SuSE 7.1 including the final 'ldconfig' to install the package properly. After this, nvtv compiles without any problems. MANDRAKE -------- Nvtv works fine under Linux Mandrake 8.1 without doing any pre-installation copy. Use the rpmdrake (mandrake's rpm installing utility) or KPackage to install pciutil-devel. This is enough to compile it. The X libraries are already installed if you selected the 'developer' profile while configuring mandrake. SLACKWARE --------- Here is a way to install pciutils for Slackware (7.1). Used the source file provided from: http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml I chose to install it to: /opt/libpci but you can install it to wherever you want to. Did not care about the man-files or the binaries. Make some temporary directory, and cd into it. tar -xzf pciutils-2.1.9.tar.gz cd pciutils-2.1.9 make cd lib install -d /opt/libpci/include/pci cp *.h /opt/libpci/include/pci install -d /opt/libpci/lib cp *.a /opt/libpci/lib export C_INCLUDE_PATH=/opt/libpci/include export LIBRARY_PATH=/opt/libpci/lib After you set the include-path and library-path you do your ./configure for nvtv, and compile. If you want, you can also install the pciutils binaries: install -d /opt/libpci/sbin cd .. cp setpci /opt/libpci/sbin cp lspci /opt/libpci/sbin GENTOO LINUX ------------ Do the following to install nvtvd (apperently it is prepacked): emerge nvtv rc-update add nvtv default OTHER LINUX DISTRIBUTIONS ------------------------- If you have a different linux distribution (Red Hat, ...) please drop me a mail at and explain how to find the packages above in your distribution, so I can include this information in the documentation. (No, I cannot answer questions how to install this program on distributions other than Debian). FreeBSD ------- There are reports that it is possible to use nvtv under FreeBSD by putting the gtk libraries and piclib into the 'compatible' directory. I don't have any concret step by step recipe; feel free to write one and send it to me. WINDOWS/CYGWIN -------------- It is now possible to compile nvtv under Windows, with help of Cygwin. Calling configure sets up everything the right way. However, the GUI will be disabled, and switching back to the monitor mode will only work with the fallback VESA modes ('nvtv -m -s 800x600@56' or similar, see USAGE). Switching to the previously used mode does not work because the available monitor modes cannot yet be accessed without X. So usability is a bit limited (but fetching and printing the current TV mode works). Also, you will need the NVidia video driver. In theory it would be possible to compile the GTK sources and then run nvtv with a GUI inside the X provided by Cygwin, but I haven't tried this. THE 'SIMPLE' LIBRARY -------------------- There is now a 'simple' library that allows other programs (e.g. totem) to use nvtv. It can be found in the lib/ subdirectory, and must be configured and compiled seperately. nvtv-0.4.7/Makefile.am0000644000175000001440000000170710041214173010226 ## Process this file with automake to produce Makefile.in ## Used automake 1.4 SUBDIRS = src man test doc_extra = ANNOUNCE BUGS FAQ doc doc_bincopy = AUTHORS COPYING ChangeLog INSTALL NEWS $(doc_extra) doc_bin = README $(doc_bincopy) EXTRA_DIST = $(doc_extra) # tar aliases tarball: tar-bin tar-src tar-src: dist tar-bin: dist-bin # bin distribution ## FIXME: Maybe use install-strip and make DESTDIR=... features? ## Maybe use dist-hook? (See info doc). distbindir = $(distdir)-bin distdir-bin: src/nvtv src/nvtvd -rm -rf $(distbindir) mkdir $(distbindir) -chmod 777 $(distbindir) ln -s `pwd`/README.binary $(distbindir)/README @for f in $(doc_bincopy) ; do \ ln -s `pwd`/$$f $(distbindir) ; \ done ; @for f in nvtv nvtvd ; do \ cp -p src/$$f $(distbindir)/ ; \ strip $(distbindir)/$$f ; \ done dist-bin: distdir-bin -chmod -R a+r $(distbindir) GZIP=$(GZIP_ENV) $(TAR) chozf $(distbindir).tar.gz $(distbindir) -rm -rf $(distbindir) nvtv-0.4.7/NEWS0000644000175000001440000000040307666655663006721 New in 0.4.5: * PAL-M and NTSC-J modes for Brooktree/Conexant (untested) * Voodoo3 autodetect's another CONVERT situation. * Changed FBAS and SVHS to COMPOSITE and SVIDEO. * Support NVidia driver 1.0-4349. * A few bugfixes. * Some internal rearrangements. nvtv-0.4.7/TODO0000644000175000001440000000707210023316646006673 Urgent: * Check close before open (problem probably found). * Second launching problem. * Second head does not initialize properly with 'nv' driver. Test: Do it after having run 'nvidia' driver. * Does GetPort/Regs on second head with twinview. Rest: * Fix permission bits of "missing" in CVS. * Make list of all NVidia drivers, update card_direct * FIX segfault when no I2C devices at all are probed. -- not reproducible * Use listMode API call. Maybe change API? (parametrize with card->type, chip->type including defaults) * Delayed initialisation of encoder chips (including delayed probing). * Don't set active chip on init in backend; set that somewhere else. Reason: system probe: Don't init encoder regs. * New port/path model (in 0.5.0) * Memory leak in robs dump. * Basic overview in docs. * CX/TW detection. CX: ok (stefan.asserhall@telia.com) TW: TODO. * Error and alloc wrapper, as in Autobook. * Verify Jochen's info. Talk with him about NV17. * XML format for modes, using "template"-like back-references. Use flexml? Or libxml2? --> store tree internally. * Hardware survey (beyond TVTools database) * XRandR extension. Duplicate X access in "Position" panel (with current sizes on the right?) * Add WinIo (with pcituils). Refactor in card_direct. * Complete Philips calc page (reset on mode change, ...) * Options to set position on commandline * Limit the image movement in Settings so strange things don't happen. * Find out how CRTC timings really work in TV mode, and modify recalc accordingly. Adjust status pages (ignore HTotal and VTotal), and fix TV and Monitor position in setup. * Add EnumDisplayA and ChangeDisplayA, and maybe more windows actions. * Consider switch to wxWindows GUI (works with GTK/unix, Windows/cygwin) * Add FAQ entry how to use it on windows. * Entangle the DEBUG_PROBE stuff properly for the lib. Remove xfree.h's * BT colorbars cause crash with TwinView using MetaModes both with and without TV, after switching. Solution: Test image not by default? * switch fuer PMR bei Chrontel (done), bei Settings fuer RGB. * Print registers properly. * Maybe the right way is to refactor XBox stuff, and add CARD_XBOX. This will give special modes, etc. * URLs for chipdocs. * Disallow mode switching for 'nv' driver, and maybe also for 'nvidia' driver while TV is active. * 'Validate' backend function, init arch specific values in back_nvidia. * Monochrome on Brooktree/composite with mux. * Service for command line. * Carrier flag. (Distort flag?) * Invalidate viewport position etc. unless Shared view is enabled. * Apply and Settings should be dealt with in Test-Image mode. * Split registers into timing and non-timing registers. Change interface accordingly, so a timing-reset can be done after changing timing register. * Brooktree/Conexant timing reset (for mode changes only?) * Chrontel Macrovision for all modes (if someone can find out how to do that). * Philips macrovision (partly done). * Options for settings/flags, that are respected by GUI. (Request: dualview command line option for GUI) * Allocation layer. (Look for malloc, xalloc, , etc.) * Someone whose English is better than mine should write some docs. * Huge modes for Brooktree (overscan for nearly all tv's), fix bad modes. (800x600 Normal NTSC, 800x600 Huge NTSC, ...) * Fix overscan values for Chrontel. * Implement interlace and doublescan. * Proper error handling, including I2C Bus Errors. * Reset does not AutoApply. * Accelerator page. Configurable root window keyboard accelerators at least for tv on/off, center. nvtv-0.4.7/aclocal.m40000644000175000001440000007503010037020556010037 dnl aclocal.m4 generated automatically by aclocal 1.4-p6 dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. # serial 1 dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) VERSION=[$2] AC_SUBST(VERSION) dnl test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi ifelse([$3],, AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) AC_REQUIRE([AM_SANITY_CHECK]) AC_REQUIRE([AC_ARG_PROGRAM]) dnl FIXME This is truly gross. missing_dir=`cd $ac_aux_dir && pwd` AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir) AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir) AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) AC_REQUIRE([AC_PROG_MAKE_SET])]) # Copyright 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.4-p6])]) # # Check to make sure that the build environment is sane. # AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftestfile # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "[$]*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "[$]*" != "X $srcdir/configure conftestfile" \ && test "[$]*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "[$]2" = conftestfile ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi rm -f conftest* AC_MSG_RESULT(yes)]) dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. AC_DEFUN([AM_MISSING_PROG], [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if ($2 --version) < /dev/null > /dev/null 2>&1; then $1=$2 AC_MSG_RESULT(found) else $1="$3/missing $2" AC_MSG_RESULT(missing) fi AC_SUBST($1)]) # serial 1 # @defmac AC_PROG_CC_STDC # @maindex PROG_CC_STDC # @ovindex CC # If the C compiler in not in ANSI C mode by default, try to add an option # to output variable @code{CC} to make it so. This macro tries various # options that select ANSI C on some system or another. It considers the # compiler to be in ANSI C mode if it handles function prototypes correctly. # # If you use this macro, you should check after calling it whether the C # compiler has been set to accept ANSI C; if not, the shell variable # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source # code in ANSI C, you can make an un-ANSIfied copy of it by using the # program @code{ansi2knr}, which comes with Ghostscript. # @end defmac AC_DEFUN([AM_PROG_CC_STDC], [AC_REQUIRE([AC_PROG_CC]) AC_BEFORE([$0], [AC_C_INLINE]) AC_BEFORE([$0], [AC_C_CONST]) dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require dnl a magic option to avoid problems with ANSI preprocessor commands dnl like #elif. dnl FIXME: can't do this because then AC_AIX won't work due to a dnl circular dependency. dnl AC_BEFORE([$0], [AC_PROG_CPP]) AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) AC_CACHE_VAL(am_cv_prog_cc_stdc, [am_cv_prog_cc_stdc=no ac_save_CC="$CC" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" AC_TRY_COMPILE( [#include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; ], [ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ], [am_cv_prog_cc_stdc="$ac_arg"; break]) done CC="$ac_save_CC" ]) if test -z "$am_cv_prog_cc_stdc"; then AC_MSG_RESULT([none needed]) else AC_MSG_RESULT($am_cv_prog_cc_stdc) fi case "x$am_cv_prog_cc_stdc" in x|xno) ;; *) CC="$CC $am_cv_prog_cc_stdc" ;; esac ]) # Configure paths for GTK+ # Owen Taylor 97-11-3 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS dnl AC_DEFUN(AM_PATH_GTK, [dnl dnl Get the cflags and libraries from the gtk-config script dnl AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], gtk_config_prefix="$withval", gtk_config_prefix="") AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], , enable_gtktest=yes) for module in . $4 do case "$module" in gthread) gtk_config_args="$gtk_config_args gthread" ;; esac done if test x$gtk_config_exec_prefix != x ; then gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config fi fi if test x$gtk_config_prefix != x ; then gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_prefix/bin/gtk-config fi fi AC_PATH_PROG(GTK_CONFIG, gtk-config, no) min_gtk_version=ifelse([$1], ,0.99.7,$1) AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) no_gtk="" if test "$GTK_CONFIG" = "no" ; then no_gtk=yes else GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_gtktest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" dnl dnl Now check if the installed GTK is sufficiently new. (Also sanity dnl checks the results of gtk-config to some extent dnl rm -f conf.gtktest AC_TRY_RUN([ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gtktest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } if ((gtk_major_version != $gtk_config_major_version) || (gtk_minor_version != $gtk_config_minor_version) || (gtk_micro_version != $gtk_config_micro_version)) { printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If gtk-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); printf("*** before re-running configure\n"); } #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) else if ((gtk_major_version != GTK_MAJOR_VERSION) || (gtk_minor_version != GTK_MINOR_VERSION) || (gtk_micro_version != GTK_MICRO_VERSION)) { printf("*** GTK+ header files (version %d.%d.%d) do not match\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gtk_major_version, gtk_minor_version, gtk_micro_version); } #endif /* defined (GTK_MAJOR_VERSION) ... */ else { if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); printf("*** correct copy of gtk-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gtk" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$GTK_CONFIG" = "no" ; then echo "*** The gtk-config script installed by GTK could not be found" echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the GTK_CONFIG environment variable to the" echo "*** full path to gtk-config." else if test -f conf.gtktest ; then : else echo "*** Could not run GTK test program, checking why..." CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" AC_TRY_LINK([ #include #include ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK or finding the wrong" echo "*** version of GTK. If it is not finding GTK, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" echo "***" echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" echo "*** came with the system with the command" echo "***" echo "*** rpm --erase --nodeps gtk gtk-devel" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GTK was incorrectly installed" echo "*** or that you have moved GTK since it was installed. In the latter case, you" echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GTK_CFLAGS="" GTK_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) rm -f conf.gtktest ]) # Configure paths for GTK+ # Owen Taylor 1997-2001 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, dnl pass to pkg-config dnl AC_DEFUN(AM_PATH_GTK_2_0, [dnl dnl Get the cflags and libraries from pkg-config dnl AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program], , enable_gtktest=yes) pkg_config_args=gtk+-2.0 for module in . $4 do case "$module" in gthread) pkg_config_args="$pkg_config_args gthread-2.0" ;; esac done no_gtk="" AC_PATH_PROG(PKG_CONFIG, pkg-config, no) if test x$PKG_CONFIG != xno ; then if pkg-config --atleast-pkgconfig-version 0.7 ; then : else echo *** pkg-config too old; version 0.7 or better required. no_gtk=yes PKG_CONFIG=no fi else no_gtk=yes fi min_gtk_version=ifelse([$1], ,2.0.0,$1) AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version) if test x$PKG_CONFIG != xno ; then ## don't try to run the test against uninstalled libtool libs if $PKG_CONFIG --uninstalled $pkg_config_args; then echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" enable_gtktest=no fi if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then : else no_gtk=yes fi fi if test x"$no_gtk" = x ; then GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_gtktest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" dnl dnl Now check if the installed GTK+ is sufficiently new. (Also sanity dnl checks the results of pkg-config to some extent) dnl rm -f conf.gtktest AC_TRY_RUN([ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gtktest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } if ((gtk_major_version != $gtk_config_major_version) || (gtk_minor_version != $gtk_config_minor_version) || (gtk_micro_version != $gtk_config_micro_version)) { printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If pkg-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); printf("*** to point to the correct configuration files\n"); } else if ((gtk_major_version != GTK_MAJOR_VERSION) || (gtk_minor_version != GTK_MINOR_VERSION) || (gtk_micro_version != GTK_MICRO_VERSION)) { printf("*** GTK+ header files (version %d.%d.%d) do not match\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gtk_major_version, gtk_minor_version, gtk_micro_version); } else { if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); printf("*** correct copy of pkg-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gtk" = x ; then AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$PKG_CONFIG" = "no" ; then echo "*** A new enough version of pkg-config was not found." echo "*** See http://pkgconfig.sourceforge.net" else if test -f conf.gtktest ; then : else echo "*** Could not run GTK+ test program, checking why..." ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" AC_TRY_LINK([ #include #include ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK+ or finding the wrong" echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GTK_CFLAGS="" GTK_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) rm -f conf.gtktest ]) dnl --------------------------------------------------------------------------- dnl Macros for wxWindows detection. Typically used in configure.in as: dnl dnl AC_ARG_ENABLE(...) dnl AC_ARG_WITH(...) dnl ... dnl AM_OPTIONS_WXCONFIG dnl ... dnl ... dnl AM_PATH_WXCONFIG(2.3.3, wxWin=1) dnl if test "$wxWin" != 1; then dnl AC_MSG_ERROR([ dnl wxWindows must be installed on your system dnl but wx-config script couldn't be found. dnl dnl Please check that wx-config is in path, the directory dnl where wxWindows libraries are installed (returned by dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or dnl equivalent variable and wxWindows version is 2.3.3 or above. dnl ]) dnl fi dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY" dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY" dnl dnl LDFLAGS="$LDFLAGS $WX_LIBS" dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- dnl AM_OPTIONS_WXCONFIG dnl dnl adds support for --wx-prefix, --wx-exec-prefix and --wx-config dnl command line options dnl --------------------------------------------------------------------------- AC_DEFUN(AM_OPTIONS_WXCONFIG, [ AC_ARG_WITH(wx-prefix, [ --with-wx-prefix=PREFIX Prefix where wxWindows is installed (optional)], wx_config_prefix="$withval", wx_config_prefix="") AC_ARG_WITH(wx-exec-prefix,[ --with-wx-exec-prefix=PREFIX Exec prefix where wxWindows is installed (optional)], wx_config_exec_prefix="$withval", wx_config_exec_prefix="") AC_ARG_WITH(wx-config,[ --with-wx-config=CONFIG wx-config script to use (optional)], wx_config_name="$withval", wx_config_name="") ]) dnl --------------------------------------------------------------------------- dnl AM_PATH_WXCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl dnl Test for wxWindows, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC dnl (the latter is for static linking against wxWindows). Set WX_CONFIG_NAME dnl environment variable to override the default name of the wx-config script dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this dnl case the macro won't even waste time on tests for its existence. dnl --------------------------------------------------------------------------- dnl dnl Get the cflags and libraries from the wx-config script dnl AC_DEFUN(AM_PATH_WXCONFIG, [ dnl do we have wx-config name: it can be wx-config or wxd-config or ... if test x${WX_CONFIG_NAME+set} != xset ; then WX_CONFIG_NAME=wx-config fi if test "x$wx_config_name" != x ; then WX_CONFIG_NAME="$wx_config_name" fi dnl deal with optional prefixes if test x$wx_config_exec_prefix != x ; then wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix" WX_LOOKUP_PATH="$wx_config_exec_prefix/bin" fi if test x$wx_config_prefix != x ; then wx_config_args="$wx_config_args --prefix=$wx_config_prefix" WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin" fi dnl don't search the PATH if WX_CONFIG_NAME is absolute filename if test -x "$WX_CONFIG_NAME" ; then AC_MSG_CHECKING(for wx-config) WX_CONFIG_PATH="$WX_CONFIG_NAME" AC_MSG_RESULT($WX_CONFIG_PATH) else AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no, "$WX_LOOKUP_PATH:$PATH") fi if test "$WX_CONFIG_PATH" != "no" ; then WX_VERSION="" no_wx="" min_wx_version=ifelse([$1], ,2.2.1,$1) AC_MSG_CHECKING(for wxWindows version >= $min_wx_version) WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args" WX_VERSION=`$WX_CONFIG_WITH_ARGS --version` wx_config_major_version=`echo $WX_VERSION | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` wx_config_minor_version=`echo $WX_VERSION | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` wx_config_micro_version=`echo $WX_VERSION | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` wx_requested_major_version=`echo $min_wx_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` wx_requested_minor_version=`echo $min_wx_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` wx_requested_micro_version=`echo $min_wx_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` wx_ver_ok="" if test $wx_config_major_version -gt $wx_requested_major_version; then wx_ver_ok=yes else if test $wx_config_major_version -eq $wx_requested_major_version; then if test $wx_config_minor_version -gt $wx_requested_minor_version; then wx_ver_ok=yes else if test $wx_config_minor_version -eq $wx_requested_minor_version; then if test $wx_config_micro_version -ge $wx_requested_micro_version; then wx_ver_ok=yes fi fi fi fi fi if test "x$wx_ver_ok" = x ; then no_wx=yes else WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs` WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs` dnl starting with version 2.2.6 wx-config has --cppflags argument wx_has_cppflags="" if test $wx_config_major_version -gt 2; then wx_has_cppflags=yes else if test $wx_config_major_version -eq 2; then if test $wx_config_minor_version -gt 2; then wx_has_cppflags=yes else if test $wx_config_minor_version -eq 2; then if test $wx_config_micro_version -ge 6; then wx_has_cppflags=yes fi fi fi fi fi if test "x$wx_has_cppflags" = x ; then dnl no choice but to define all flags like CFLAGS WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags` WX_CPPFLAGS=$WX_CFLAGS WX_CXXFLAGS=$WX_CFLAGS WX_CFLAGS_ONLY=$WX_CFLAGS WX_CXXFLAGS_ONLY=$WX_CFLAGS else dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags` WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags` WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags` WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"` WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"` fi fi if test "x$no_wx" = x ; then AC_MSG_RESULT(yes (version $WX_VERSION)) ifelse([$2], , :, [$2]) else if test "x$WX_VERSION" = x; then dnl no wx-config at all AC_MSG_RESULT(no) else AC_MSG_RESULT(no (version $WX_VERSION is not new enough)) fi WX_CFLAGS="" WX_CPPFLAGS="" WX_CXXFLAGS="" WX_LIBS="" WX_LIBS_STATIC="" ifelse([$3], , :, [$3]) fi fi AC_SUBST(WX_CPPFLAGS) AC_SUBST(WX_CFLAGS) AC_SUBST(WX_CXXFLAGS) AC_SUBST(WX_CFLAGS_ONLY) AC_SUBST(WX_CXXFLAGS_ONLY) AC_SUBST(WX_LIBS) AC_SUBST(WX_LIBS_STATIC) AC_SUBST(WX_VERSION) ]) # Like AC_CONFIG_HEADER, but automatically create stamp file. AC_DEFUN([AM_CONFIG_HEADER], [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) dnl When config.status generates a header, we must update the stamp-h file. dnl This file resides in the same directory as the config header dnl that is generated. We must strip everything past the first ":", dnl and everything past the last "/". AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, <>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, <>; do case " <<$>>CONFIG_HEADERS " in *" <<$>>am_file "*<<)>> echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx ;; esac am_indx=`expr "<<$>>am_indx" + 1` done<<>>dnl>>) changequote([,]))]) nvtv-0.4.7/config.guess0000755000175000001440000011310607571652564010537 #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. timestamp='2002-03-20' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi dummy=dummy-$$ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int dummy(){}" > $dummy.c ; for c in cc gcc c89 c99 ; do ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; if test $? = 0 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; rm -f $dummy.c $dummy.o $dummy.rel ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s .data \$Lformat: .byte 37,100,45,37,120,10,0 # "%d-%x\n" .text .globl main .align 4 .ent main main: .frame \$30,16,\$26,0 ldgp \$29,0(\$27) .prologue 1 .long 0x47e03d80 # implver \$0 lda \$2,-1 .long 0x47e20c21 # amask \$2,\$1 lda \$16,\$Lformat mov \$0,\$17 not \$1,\$18 jsr \$26,printf ldgp \$29,0(\$26) mov 0,\$16 jsr \$26,exit .end main EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then case `./$dummy` in 0-0) UNAME_MACHINE="alpha" ;; 1-0) UNAME_MACHINE="alphaev5" ;; 1-1) UNAME_MACHINE="alphaev56" ;; 1-101) UNAME_MACHINE="alphapca56" ;; 2-303) UNAME_MACHINE="alphaev6" ;; 2-307) UNAME_MACHINE="alphaev67" ;; 2-1307) UNAME_MACHINE="alphaev68" ;; esac fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:3*) echo i386-pc-interix3 exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i386-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` rm -f $dummy.c test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` rm -f $dummy.c test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: nvtv-0.4.7/config.sub0000755000175000001440000007054307571652604010204 #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. timestamp='2002-03-07' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ | d10v | d30v | dsp16xx \ | fr30 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | m32r | m68000 | m68k | m88k | mcore \ | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el | mips64vr4300 \ | mips64vr4300el | mips64vr5000 | mips64vr5000el \ | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ | mipsisa32 | mipsisa64 \ | mn10200 | mn10300 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armv*-* \ | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c54x-* \ | clipper-* | cydra-* \ | d10v-* | d30v-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | m32r-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i686-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3d) basic_machine=alpha-cray os=-unicos ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; windows32) basic_machine=i386-pc os=-windows32-msvcrt ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh3eb | sh4eb) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; c4x*) basic_machine=c4x-none os=-coff ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto*) os=-nto-qnx ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: nvtv-0.4.7/configure0000755000175000001440000073130310037020563010106 #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for nvtv 0.4.7. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='nvtv' PACKAGE_TARNAME='nvtv-0.4.7' PACKAGE_VERSION='0.4.7' PACKAGE_STRING='nvtv 0.4.7' PACKAGE_BUGREPORT='' # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE PROGRAM CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS GTK_CONFIG GTK_CFLAGS GTK_LIBS PKG_CONFIG WX_CONFIG_PATH WX_CPPFLAGS WX_CFLAGS WX_CXXFLAGS WX_CFLAGS_ONLY WX_CXXFLAGS_ONLY WX_LIBS WX_LIBS_STATIC WX_VERSION OBJS_GUI OBJS_EXTRA OBJS_BACKEND EGREP LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures nvtv 0.4.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of nvtv 0.4.7:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-debug disable debugging info --disable-gtktest Do not try to compile and run a test GTK program --disable-gtktest do not try to compile and run a test GTK+ program Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-x use the X Window System --with-gtk use GTK 1.2 or 2.0 (force one with 'gtk1' or 'gtk2') --with-gtk-prefix=PFX Prefix where GTK is installed (optional) --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional) --with-wx-prefix=PREFIX Prefix where wxWindows is installed (optional) --with-wx-exec-prefix=PREFIX Exec prefix where wxWindows is installed (optional) --with-wx-config=CONFIG wx-config script to use (optional) --with-winio Use WinIo --with-client-backend Use client backend (default) --with-xbox compile for XBox --with-fifo-path=PATH path for the server/client fifo pipes (/var/run) Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF nvtv configure 0.4.7 generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by nvtv $as_me 0.4.7, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core core.* *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6 if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_target_alias=$target_alias test "x$ac_cv_target_alias" = "x" && ac_cv_target_alias=$ac_cv_host_alias ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6 target=$ac_cv_target target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version="1.4" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftestfile # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "$*" != "X $srcdir/configure conftestfile" \ && test "$*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftestfile ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest* echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi PACKAGE=nvtv VERSION=0.4.7 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF missing_dir=`cd $ac_aux_dir && pwd` echo "$as_me:$LINENO: checking for working aclocal-${am__api_version}" >&5 echo $ECHO_N "checking for working aclocal-${am__api_version}... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then ACLOCAL=aclocal-${am__api_version} echo "$as_me:$LINENO: result: found" >&5 echo "${ECHO_T}found" >&6 else ACLOCAL="$missing_dir/missing aclocal-${am__api_version}" echo "$as_me:$LINENO: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi echo "$as_me:$LINENO: checking for working autoconf" >&5 echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoconf --version) < /dev/null > /dev/null 2>&1; then AUTOCONF=autoconf echo "$as_me:$LINENO: result: found" >&5 echo "${ECHO_T}found" >&6 else AUTOCONF="$missing_dir/missing autoconf" echo "$as_me:$LINENO: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi echo "$as_me:$LINENO: checking for working automake-${am__api_version}" >&5 echo $ECHO_N "checking for working automake-${am__api_version}... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (automake-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then AUTOMAKE=automake-${am__api_version} echo "$as_me:$LINENO: result: found" >&5 echo "${ECHO_T}found" >&6 else AUTOMAKE="$missing_dir/missing automake-${am__api_version}" echo "$as_me:$LINENO: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi echo "$as_me:$LINENO: checking for working autoheader" >&5 echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoheader --version) < /dev/null > /dev/null 2>&1; then AUTOHEADER=autoheader echo "$as_me:$LINENO: result: found" >&5 echo "${ECHO_T}found" >&6 else AUTOHEADER="$missing_dir/missing autoheader" echo "$as_me:$LINENO: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi echo "$as_me:$LINENO: checking for working makeinfo" >&5 echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (makeinfo --version) < /dev/null > /dev/null 2>&1; then MAKEINFO=makeinfo echo "$as_me:$LINENO: result: found" >&5 echo "${ECHO_T}found" >&6 else MAKEINFO="$missing_dir/missing makeinfo" echo "$as_me:$LINENO: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi PROGRAM="nvtv nvtvd" withdef_x=yes withdef_gtk=yes host_flag=unix withdef_client_backend=yes withdef_winio=no case $host in *-*-mingw32* | *-*-cygwin* | *-*-windows*) echo "$as_me:$LINENO: result: Setting defaults for Windows" >&5 echo "${ECHO_T}Setting defaults for Windows" >&6 PROGRAM="nvtv" host_flag=windows withdef_gtk=no withdef_x=no with_client_backend=no ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for ${CC-cc} option to accept ANSI C" >&5 echo $ECHO_N "checking for ${CC-cc} option to accept ANSI C... $ECHO_C" >&6 if test "${am_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else am_cv_prog_cc_stdc=no ac_save_CC="$CC" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then am_cv_prog_cc_stdc="$ac_arg"; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done CC="$ac_save_CC" fi if test -z "$am_cv_prog_cc_stdc"; then echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 else echo "$as_me:$LINENO: result: $am_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$am_cv_prog_cc_stdc" >&6 fi case "x$am_cv_prog_cc_stdc" in x|xno) ;; *) CC="$CC $am_cv_prog_cc_stdc" ;; esac # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi CFLAGS="" echo "$as_me:$LINENO: checking for debugging info" >&5 echo $ECHO_N "checking for debugging info... $ECHO_C" >&6 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" else enable_debug=yes fi; if test "$enable_debug" = yes; then CFLAGS="$CFLAGS -g" echo "$as_me:$LINENO: result: enabled" >&5 echo "${ECHO_T}enabled" >&6 else CFLAGS="$CFLAGS -O2" echo "$as_me:$LINENO: result: disabled (optimizing on)" >&5 echo "${ECHO_T}disabled (optimizing on)" >&6 fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then withval="$with_x" fi; # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then # Both variables are already set. have_x=yes else if test "${ac_cv_have_x+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -fr conftest.dir if mkdir conftest.dir; then cd conftest.dir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat >Imakefile <<'_ACEOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' _ACEOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -fr conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Intrinsic.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # We can compile using X headers with no special include directory. ac_x_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Intrinsic.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lXt $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XtMalloc (0) ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$ac_save_LIBS for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r $ac_dir/libXt.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then echo "$as_me:$LINENO: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6 no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. cat >>confdefs.h <<\_ACEOF #define X_DISPLAY_MISSING 1 _ACEOF X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else if test -n "$x_includes"; then X_CFLAGS="$X_CFLAGS -I$x_includes" fi # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . case `(uname -sr) 2>/dev/null` in "SunOS 5"*) echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5 echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6 ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_nospace=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_nospace=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test $ac_R_nospace = yes; then echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_space=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_space=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test $ac_R_space = yes; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 X_LIBS="$X_LIBS -R $x_libraries" else echo "$as_me:$LINENO: result: neither works" >&5 echo "${ECHO_T}neither works" >&6 fi fi LIBS=$ac_xsave_LIBS esac fi # Check for system-dependent libraries X programs must link with. # Do this before checking for the system-independent R6 libraries # (-lICE), since we may need -lsocket or whatever for X linking. if test "$ISC" = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" else # Martyn Johnson says this is needed for Ultrix, if the X # libraries were built with DECnet support. And Karl Berry says # the Alpha needs dnet_stub (dnet does not exist). ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XOpenDisplay (); int main () { XOpenDisplay (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_dnet_ntoa=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_stub_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_stub_dnet_ntoa=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) # needs -lnsl. # The nsl library prevents programs from opening the X display # on Irix 5.2, according to T.E. Dickey. # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. echo "$as_me:$LINENO: checking for gethostbyname" >&5 echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 if test "${ac_cv_func_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) choke me #else char (*f) () = gethostbyname; #endif #ifdef __cplusplus } #endif int main () { return f != gethostbyname; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_gethostbyname=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 if test $ac_cv_func_gethostbyname = no; then echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 if test $ac_cv_lib_nsl_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5 echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bsd_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_gethostbyname=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 if test $ac_cv_lib_bsd_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi fi fi # lieder@skyler.mavd.honeywell.com says without -lsocket, # socket/setsockopt and other routines are undefined under SCO ODT # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary # on later versions), says Simon Leinen: it contains gethostby* # variants that don't use the name server (or something). -lsocket # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. echo "$as_me:$LINENO: checking for connect" >&5 echo $ECHO_N "checking for connect... $ECHO_C" >&6 if test "${ac_cv_func_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_connect) || defined (__stub___connect) choke me #else char (*f) () = connect; #endif #ifdef __cplusplus } #endif int main () { return f != connect; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_connect=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 echo "${ECHO_T}$ac_cv_func_connect" >&6 if test $ac_cv_func_connect = no; then echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); int main () { connect (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_connect=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 if test $ac_cv_lib_socket_connect = yes; then X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi fi # Guillermo Gomez says -lposix is necessary on A/UX. echo "$as_me:$LINENO: checking for remove" >&5 echo $ECHO_N "checking for remove... $ECHO_C" >&6 if test "${ac_cv_func_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_remove) || defined (__stub___remove) choke me #else char (*f) () = remove; #endif #ifdef __cplusplus } #endif int main () { return f != remove; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_remove=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5 echo "${ECHO_T}$ac_cv_func_remove" >&6 if test $ac_cv_func_remove = no; then echo "$as_me:$LINENO: checking for remove in -lposix" >&5 echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 if test "${ac_cv_lib_posix_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); int main () { remove (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_posix_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_posix_remove=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5 echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 if test $ac_cv_lib_posix_remove = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo "$as_me:$LINENO: checking for shmat" >&5 echo $ECHO_N "checking for shmat... $ECHO_C" >&6 if test "${ac_cv_func_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shmat) || defined (__stub___shmat) choke me #else char (*f) () = shmat; #endif #ifdef __cplusplus } #endif int main () { return f != shmat; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shmat=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5 echo "${ECHO_T}$ac_cv_func_shmat" >&6 if test $ac_cv_func_shmat = no; then echo "$as_me:$LINENO: checking for shmat in -lipc" >&5 echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 if test "${ac_cv_lib_ipc_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); int main () { shmat (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ipc_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ipc_shmat=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5 echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 if test $ac_cv_lib_ipc_shmat = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi fi fi # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS=$LDFLAGS test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # John Interrante, Karl Berry echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5 echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char IceConnectionNumber (); int main () { IceConnectionNumber (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ICE_IceConnectionNumber=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi LDFLAGS=$ac_save_LDFLAGS fi CPPFLAGS="$CPPFLAGS $X_CFLAGS -I/usr/local/include" if test "${with_x+set}" != set; then with_x="$withdef_x" fi # Check whether --with-gtk or --without-gtk was given. if test "${with_gtk+set}" = set; then withval="$with_gtk" else with_gtk="$withdef_gtk" fi; have_gtk=no if test ${with_x} = no ; then echo "$as_me:$LINENO: result: X disabled as requested." >&5 echo "${ECHO_T}X disabled as requested." >&6 fi if test ${with_gtk} = no ; then echo "$as_me:$LINENO: result: GTK disabled as requested." >&5 echo "${ECHO_T}GTK disabled as requested." >&6 fi if test ${have_gtk} = no ; then if test ${with_gtk} = yes -o ${with_gtk} = gtk1 ; then # Check whether --with-gtk-prefix or --without-gtk-prefix was given. if test "${with_gtk_prefix+set}" = set; then withval="$with_gtk_prefix" gtk_config_prefix="$withval" else gtk_config_prefix="" fi; # Check whether --with-gtk-exec-prefix or --without-gtk-exec-prefix was given. if test "${with_gtk_exec_prefix+set}" = set; then withval="$with_gtk_exec_prefix" gtk_config_exec_prefix="$withval" else gtk_config_exec_prefix="" fi; # Check whether --enable-gtktest or --disable-gtktest was given. if test "${enable_gtktest+set}" = set; then enableval="$enable_gtktest" else enable_gtktest=yes fi; for module in . do case "$module" in gthread) gtk_config_args="$gtk_config_args gthread" ;; esac done if test x$gtk_config_exec_prefix != x ; then gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config fi fi if test x$gtk_config_prefix != x ; then gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_prefix/bin/gtk-config fi fi # Extract the first word of "gtk-config", so it can be a program name with args. set dummy gtk-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_GTK_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $GTK_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GTK_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_GTK_CONFIG" && ac_cv_path_GTK_CONFIG="no" ;; esac fi GTK_CONFIG=$ac_cv_path_GTK_CONFIG if test -n "$GTK_CONFIG"; then echo "$as_me:$LINENO: result: $GTK_CONFIG" >&5 echo "${ECHO_T}$GTK_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi min_gtk_version=1.2.0 echo "$as_me:$LINENO: checking for GTK - version >= $min_gtk_version" >&5 echo $ECHO_N "checking for GTK - version >= $min_gtk_version... $ECHO_C" >&6 no_gtk="" if test "$GTK_CONFIG" = "no" ; then no_gtk=yes else GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_gtktest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" rm -f conf.gtktest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gtktest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } if ((gtk_major_version != $gtk_config_major_version) || (gtk_minor_version != $gtk_config_minor_version) || (gtk_micro_version != $gtk_config_micro_version)) { printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If gtk-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); printf("*** before re-running configure\n"); } #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) else if ((gtk_major_version != GTK_MAJOR_VERSION) || (gtk_minor_version != GTK_MINOR_VERSION) || (gtk_micro_version != GTK_MICRO_VERSION)) { printf("*** GTK+ header files (version %d.%d.%d) do not match\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gtk_major_version, gtk_minor_version, gtk_micro_version); } #endif /* defined (GTK_MAJOR_VERSION) ... */ else { if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); printf("*** correct copy of gtk-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_gtk=yes fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gtk" = x ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 have_gtk=gtk1 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test "$GTK_CONFIG" = "no" ; then echo "*** The gtk-config script installed by GTK could not be found" echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the GTK_CONFIG environment variable to the" echo "*** full path to gtk-config." else if test -f conf.gtktest ; then : else echo "*** Could not run GTK test program, checking why..." CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK or finding the wrong" echo "*** version of GTK. If it is not finding GTK, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" echo "***" echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" echo "*** came with the system with the command" echo "***" echo "*** rpm --erase --nodeps gtk gtk-devel" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GTK was incorrectly installed" echo "*** or that you have moved GTK since it was installed. In the latter case, you" echo "*** may want to edit the gtk-config script: $GTK_CONFIG" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GTK_CFLAGS="" GTK_LIBS="" : fi rm -f conf.gtktest fi fi if test ${have_gtk} = no ; then if test ${with_gtk} = yes -o ${with_gtk} = gtk2 ; then # Check whether --enable-gtktest or --disable-gtktest was given. if test "${enable_gtktest+set}" = set; then enableval="$enable_gtktest" else enable_gtktest=yes fi; pkg_config_args=gtk+-2.0 for module in . do case "$module" in gthread) pkg_config_args="$pkg_config_args gthread-2.0" ;; esac done no_gtk="" # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 echo "${ECHO_T}$PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test x$PKG_CONFIG != xno ; then if pkg-config --atleast-pkgconfig-version 0.7 ; then : else echo *** pkg-config too old; version 0.7 or better required. no_gtk=yes PKG_CONFIG=no fi else no_gtk=yes fi min_gtk_version=2.0.0 echo "$as_me:$LINENO: checking for GTK+ - version >= $min_gtk_version" >&5 echo $ECHO_N "checking for GTK+ - version >= $min_gtk_version... $ECHO_C" >&6 if test x$PKG_CONFIG != xno ; then ## don't try to run the test against uninstalled libtool libs if $PKG_CONFIG --uninstalled $pkg_config_args; then echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" enable_gtktest=no fi if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then : else no_gtk=yes fi fi if test x"$no_gtk" = x ; then GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_gtktest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" rm -f conf.gtktest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gtktest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } if ((gtk_major_version != $gtk_config_major_version) || (gtk_minor_version != $gtk_config_minor_version) || (gtk_micro_version != $gtk_config_micro_version)) { printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If pkg-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); printf("*** to point to the correct configuration files\n"); } else if ((gtk_major_version != GTK_MAJOR_VERSION) || (gtk_minor_version != GTK_MINOR_VERSION) || (gtk_micro_version != GTK_MICRO_VERSION)) { printf("*** GTK+ header files (version %d.%d.%d) do not match\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gtk_major_version, gtk_minor_version, gtk_micro_version); } else { if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); printf("*** correct copy of pkg-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_gtk=yes fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gtk" = x ; then echo "$as_me:$LINENO: result: yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)" >&5 echo "${ECHO_T}yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)" >&6 have_gtk=gtk2 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test "$PKG_CONFIG" = "no" ; then echo "*** A new enough version of pkg-config was not found." echo "*** See http://pkgconfig.sourceforge.net" else if test -f conf.gtktest ; then : else echo "*** Could not run GTK+ test program, checking why..." ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK+ or finding the wrong" echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GTK+ is incorrectly installed." fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GTK_CFLAGS="" GTK_LIBS="" : fi rm -f conf.gtktest fi fi if test ${have_gtk} = no ; then if test ${with_gtk} = yes -o ${with_gtk} = gtk1 ; then { echo "$as_me:$LINENO: WARNING: Cannot find GTK 1.2.0 or higher (Is gtk-config in path?)" >&5 echo "$as_me: WARNING: Cannot find GTK 1.2.0 or higher (Is gtk-config in path?)" >&2;} fi if test ${with_gtk} = yes -o ${with_gtk} = gtk2 ; then { echo "$as_me:$LINENO: WARNING: Cannot find GTK 2.0.0 or higher (Is pkg-config in path?)" >&5 echo "$as_me: WARNING: Cannot find GTK 2.0.0 or higher (Is pkg-config in path?)" >&2;} fi if test ${with_gtk} != no ; then { echo "$as_me:$LINENO: WARNING: GTK disabled." >&5 echo "$as_me: WARNING: GTK disabled." >&2;} with_gtk=no fi else LIBS="$LIBS $GTK_LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" fi have_wxwin=no with_wxwin=no if test ${with_gtk} = no ; then # Check whether --with-wx-prefix or --without-wx-prefix was given. if test "${with_wx_prefix+set}" = set; then withval="$with_wx_prefix" wx_config_prefix="$withval" else wx_config_prefix="" fi; # Check whether --with-wx-exec-prefix or --without-wx-exec-prefix was given. if test "${with_wx_exec_prefix+set}" = set; then withval="$with_wx_exec_prefix" wx_config_exec_prefix="$withval" else wx_config_exec_prefix="" fi; # Check whether --with-wx-config or --without-wx-config was given. if test "${with_wx_config+set}" = set; then withval="$with_wx_config" wx_config_name="$withval" else wx_config_name="" fi; if test x${WX_CONFIG_NAME+set} != xset ; then WX_CONFIG_NAME=wx-config fi if test "x$wx_config_name" != x ; then WX_CONFIG_NAME="$wx_config_name" fi if test x$wx_config_exec_prefix != x ; then wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix" WX_LOOKUP_PATH="$wx_config_exec_prefix/bin" fi if test x$wx_config_prefix != x ; then wx_config_args="$wx_config_args --prefix=$wx_config_prefix" WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin" fi if test -x "$WX_CONFIG_NAME" ; then echo "$as_me:$LINENO: checking for wx-config" >&5 echo $ECHO_N "checking for wx-config... $ECHO_C" >&6 WX_CONFIG_PATH="$WX_CONFIG_NAME" echo "$as_me:$LINENO: result: $WX_CONFIG_PATH" >&5 echo "${ECHO_T}$WX_CONFIG_PATH" >&6 else # Extract the first word of "$WX_CONFIG_NAME", so it can be a program name with args. set dummy $WX_CONFIG_NAME; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_WX_CONFIG_PATH+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $WX_CONFIG_PATH in [\\/]* | ?:[\\/]*) ac_cv_path_WX_CONFIG_PATH="$WX_CONFIG_PATH" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_dummy=""$WX_LOOKUP_PATH:$PATH"" for as_dir in $as_dummy do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_WX_CONFIG_PATH="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_WX_CONFIG_PATH" && ac_cv_path_WX_CONFIG_PATH="no" ;; esac fi WX_CONFIG_PATH=$ac_cv_path_WX_CONFIG_PATH if test -n "$WX_CONFIG_PATH"; then echo "$as_me:$LINENO: result: $WX_CONFIG_PATH" >&5 echo "${ECHO_T}$WX_CONFIG_PATH" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test "$WX_CONFIG_PATH" != "no" ; then WX_VERSION="" no_wx="" min_wx_version=2.3.0 echo "$as_me:$LINENO: checking for wxWindows version >= $min_wx_version" >&5 echo $ECHO_N "checking for wxWindows version >= $min_wx_version... $ECHO_C" >&6 WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args" WX_VERSION=`$WX_CONFIG_WITH_ARGS --version` wx_config_major_version=`echo $WX_VERSION | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` wx_config_minor_version=`echo $WX_VERSION | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` wx_config_micro_version=`echo $WX_VERSION | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` wx_requested_major_version=`echo $min_wx_version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` wx_requested_minor_version=`echo $min_wx_version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` wx_requested_micro_version=`echo $min_wx_version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` wx_ver_ok="" if test $wx_config_major_version -gt $wx_requested_major_version; then wx_ver_ok=yes else if test $wx_config_major_version -eq $wx_requested_major_version; then if test $wx_config_minor_version -gt $wx_requested_minor_version; then wx_ver_ok=yes else if test $wx_config_minor_version -eq $wx_requested_minor_version; then if test $wx_config_micro_version -ge $wx_requested_micro_version; then wx_ver_ok=yes fi fi fi fi fi if test "x$wx_ver_ok" = x ; then no_wx=yes else WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs` WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs` wx_has_cppflags="" if test $wx_config_major_version -gt 2; then wx_has_cppflags=yes else if test $wx_config_major_version -eq 2; then if test $wx_config_minor_version -gt 2; then wx_has_cppflags=yes else if test $wx_config_minor_version -eq 2; then if test $wx_config_micro_version -ge 6; then wx_has_cppflags=yes fi fi fi fi fi if test "x$wx_has_cppflags" = x ; then WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags` WX_CPPFLAGS=$WX_CFLAGS WX_CXXFLAGS=$WX_CFLAGS WX_CFLAGS_ONLY=$WX_CFLAGS WX_CXXFLAGS_ONLY=$WX_CFLAGS else WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags` WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags` WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags` WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"` WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"` fi fi if test "x$no_wx" = x ; then echo "$as_me:$LINENO: result: yes (version $WX_VERSION)" >&5 echo "${ECHO_T}yes (version $WX_VERSION)" >&6 have_wxwin=yes else if test "x$WX_VERSION" = x; then echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 else echo "$as_me:$LINENO: result: no (version $WX_VERSION is not new enough)" >&5 echo "${ECHO_T}no (version $WX_VERSION is not new enough)" >&6 fi WX_CFLAGS="" WX_CPPFLAGS="" WX_CXXFLAGS="" WX_LIBS="" WX_LIBS_STATIC="" : fi fi if test ${have_wxwin} = no ; then if test ${with_wxwin} = yes ; then { echo "$as_me:$LINENO: WARNING: Cannot find wxWindows 2.3.0 or higher" >&5 echo "$as_me: WARNING: Cannot find wxWindows 2.3.0 or higher" >&2;} fi else CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY" CFLAGS="$CFLAGS $WX_CFLAGS_ONLY" LDFLAGS="$LDFLAGS $WX_LIBS" fi fi OBJS_GUI="" OBJS_EXTRA="" OBJS_BACKEND="" if test ${with_x} = yes ; then cat >>confdefs.h <<\_ACEOF #define HAVE_X 1 _ACEOF OBJS_EXTRA="$OBJS_EXTRA actions.o" if test ${have_gtk} != no ; then have_gtk_version=`echo ${have_gtk} | sed -e 's/^gtk\(.\).*/\1/'` cat >>confdefs.h <<\_ACEOF #define HAVE_GTK 1 _ACEOF cat >>confdefs.h <<_ACEOF #define HAVE_GTK_VERSION ${have_gtk_version} _ACEOF OBJS_GUI="gui.o gui_bt.o gui_cx.o gui_ch.o gui_ph.o gui_nx.o gui_nv.o gui_tdfx.o gui_i810.o" fi if test ${have_gtk} != gtk1 ; then LIBS="$LIBS $X_LIBS" echo "$as_me:$LINENO: checking for XOpenDisplay in -lX11" >&5 echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6 if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XOpenDisplay (); int main () { XOpenDisplay (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_X11_XOpenDisplay=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_X11_XOpenDisplay=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_X11_XOpenDisplay" >&5 echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6 if test $ac_cv_lib_X11_XOpenDisplay = yes; then LIBS="$LIBS -lX11" else { { echo "$as_me:$LINENO: error: X11 library required" >&5 echo "$as_me: error: X11 library required" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: checking for XMissingExtension in -lXext" >&5 echo $ECHO_N "checking for XMissingExtension in -lXext... $ECHO_C" >&6 if test "${ac_cv_lib_Xext_XMissingExtension+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXext $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XMissingExtension (); int main () { XMissingExtension (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xext_XMissingExtension=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xext_XMissingExtension=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XMissingExtension" >&5 echo "${ECHO_T}$ac_cv_lib_Xext_XMissingExtension" >&6 if test $ac_cv_lib_Xext_XMissingExtension = yes; then LIBS="$LIBS -lXext" else { { echo "$as_me:$LINENO: error: Xext library required" >&5 echo "$as_me: error: Xext library required" >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: checking for main (direct) backend" >&5 echo $ECHO_N "checking for main (direct) backend... $ECHO_C" >&6 # Check whether --with-winio or --without-winio was given. if test "${with_winio+set}" = set; then withval="$with_winio" else with_winio="$withdef_winio" fi; case ${host_flag} in unix) echo "$as_me:$LINENO: result: unix" >&5 echo "${ECHO_T}unix" >&6 cat >>confdefs.h <<\_ACEOF #define USE_UNIX_BACKEND 1 _ACEOF OBJS_BACKEND="$OBJS_BACKEND card_direct.o back_unix.o" ;; windows) if test ${with_winio} = yes ; then echo "$as_me:$LINENO: result: windows/winio" >&5 echo "${ECHO_T}windows/winio" >&6 OBJS_BACKEND="$OBJS_BACKEND card_direct.o back_winio.o" cat >>confdefs.h <<\_ACEOF #define HAVE_WINIO 1 _ACEOF else echo "$as_me:$LINENO: result: windows/nvdll" >&5 echo "${ECHO_T}windows/nvdll" >&6 OBJS_BACKEND="$OBJS_BACKEND back_mswin.o" fi cat >>confdefs.h <<\_ACEOF #define USE_MSWIN_BACKEND 1 _ACEOF ;; esac echo "$as_me:$LINENO: checking for client backend" >&5 echo $ECHO_N "checking for client backend... $ECHO_C" >&6 # Check whether --with-client-backend or --without-client-backend was given. if test "${with_client_backend+set}" = set; then withval="$with_client_backend" else with_client_backend="$withdef_client_backend" fi; if test ${with_client_backend} = yes ; then echo "$as_me:$LINENO: result: enabled" >&5 echo "${ECHO_T}enabled" >&6 cat >>confdefs.h <<\_ACEOF #define USE_CLIENT_BACKEND 1 _ACEOF OBJS_BACKEND="$OBJS_BACKEND back_client.o" else echo "$as_me:$LINENO: result: disabled" >&5 echo "${ECHO_T}disabled" >&6 fi echo "$as_me:$LINENO: checking for sin in -lm" >&5 echo $ECHO_N "checking for sin in -lm... $ECHO_C" >&6 if test "${ac_cv_lib_m_sin+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char sin (); int main () { sin (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_m_sin=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_m_sin=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_m_sin" >&5 echo "${ECHO_T}$ac_cv_lib_m_sin" >&6 if test $ac_cv_lib_m_sin = yes; then LIBS="$LIBS -lm" else { { echo "$as_me:$LINENO: error: math library required" >&5 echo "$as_me: error: math library required" >&2;} { (exit 1); exit 1; }; } fi case ${host} in *-*-netbsd*) echo "$as_me:$LINENO: checking for i386_iopl in -li386" >&5 echo $ECHO_N "checking for i386_iopl in -li386... $ECHO_C" >&6 if test "${ac_cv_lib_i386_i386_iopl+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-li386 $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char i386_iopl (); int main () { i386_iopl (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_i386_i386_iopl=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_i386_i386_iopl=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_i386_i386_iopl" >&5 echo "${ECHO_T}$ac_cv_lib_i386_i386_iopl" >&6 if test $ac_cv_lib_i386_i386_iopl = yes; then LIBS="$LIBS -li386" else { { echo "$as_me:$LINENO: error: NetBSD i386 library required" >&5 echo "$as_me: error: NetBSD i386 library required" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: checking for pcibus_conf_read in -lpci" >&5 echo $ECHO_N "checking for pcibus_conf_read in -lpci... $ECHO_C" >&6 if test "${ac_cv_lib_pci_pcibus_conf_read+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpci $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pcibus_conf_read (); int main () { pcibus_conf_read (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_pci_pcibus_conf_read=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pci_pcibus_conf_read=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_pci_pcibus_conf_read" >&5 echo "${ECHO_T}$ac_cv_lib_pci_pcibus_conf_read" >&6 if test $ac_cv_lib_pci_pcibus_conf_read = yes; then LIBS="$LIBS -lpci" else { { echo "$as_me:$LINENO: error: NetBSD pci library required" >&5 echo "$as_me: error: NetBSD pci library required" >&2;} { (exit 1); exit 1; }; } fi ;; *-*-freebsd*) echo "$as_me:$LINENO: checking for getopt_long in -lgnugetopt" >&5 echo $ECHO_N "checking for getopt_long in -lgnugetopt... $ECHO_C" >&6 if test "${ac_cv_lib_gnugetopt_getopt_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgnugetopt $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getopt_long (); int main () { getopt_long (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_gnugetopt_getopt_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_gnugetopt_getopt_long=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_gnugetopt_getopt_long" >&5 echo "${ECHO_T}$ac_cv_lib_gnugetopt_getopt_long" >&6 if test $ac_cv_lib_gnugetopt_getopt_long = yes; then LIBS="$LIBS -lgnugetopt" else { { echo "$as_me:$LINENO: error: FreeBSD gnugetopt library required" >&5 echo "$as_me: error: FreeBSD gnugetopt library required" >&2;} { (exit 1); exit 1; }; } fi ;; esac if test ${with_winio} = yes ; then echo "$as_me:$LINENO: checking for winio_init in -lwinio" >&5 echo $ECHO_N "checking for winio_init in -lwinio... $ECHO_C" >&6 if test "${ac_cv_lib_winio_winio_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lwinio $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char winio_init (); int main () { winio_init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_winio_winio_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_winio_winio_init=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_winio_winio_init" >&5 echo "${ECHO_T}$ac_cv_lib_winio_winio_init" >&6 if test $ac_cv_lib_winio_winio_init = yes; then LIBS="$LIBS -lwinio" else { { echo "$as_me:$LINENO: error: winio wrapper library required" >&5 echo "$as_me: error: winio wrapper library required" >&2;} { (exit 1); exit 1; }; } fi fi if test ${host_flag} = unix -o ${with_winio} = yes ; then echo "$as_me:$LINENO: checking for pci_init in -lpci" >&5 echo $ECHO_N "checking for pci_init in -lpci... $ECHO_C" >&6 if test "${ac_cv_lib_pci_pci_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpci $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pci_init (); int main () { pci_init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_pci_pci_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pci_pci_init=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_pci_pci_init" >&5 echo "${ECHO_T}$ac_cv_lib_pci_pci_init" >&6 if test $ac_cv_lib_pci_pci_init = yes; then LIBS="$LIBS -lpci" pciutils_libname="pci" else echo "$as_me:$LINENO: checking for pci_init in -lpciutils" >&5 echo $ECHO_N "checking for pci_init in -lpciutils... $ECHO_C" >&6 if test "${ac_cv_lib_pciutils_pci_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpciutils $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pci_init (); int main () { pci_init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_pciutils_pci_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pciutils_pci_init=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_pciutils_pci_init" >&5 echo "${ECHO_T}$ac_cv_lib_pciutils_pci_init" >&6 if test $ac_cv_lib_pciutils_pci_init = yes; then LIBS="$LIBS -lpciutils" pciutils_libname="pciutils" else { { echo "$as_me:$LINENO: error: pci library required" >&5 echo "$as_me: error: pci library required" >&2;} { (exit 1); exit 1; }; } fi fi fi if test ${with_x} = yes ; then echo "$as_me:$LINENO: checking for XF86VidModeQueryVersion in -lXxf86vm" >&5 echo $ECHO_N "checking for XF86VidModeQueryVersion in -lXxf86vm... $ECHO_C" >&6 if test "${ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXxf86vm $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XF86VidModeQueryVersion (); int main () { XF86VidModeQueryVersion (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion" >&5 echo "${ECHO_T}$ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion" >&6 if test $ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion = yes; then LIBS="$LIBS -lXxf86vm" else { { echo "$as_me:$LINENO: error: Xxf86vm video mode extension library required" >&5 echo "$as_me: error: Xxf86vm video mode extension library required" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: checking for XmuClientWindow in -lXmu" >&5 echo $ECHO_N "checking for XmuClientWindow in -lXmu... $ECHO_C" >&6 if test "${ac_cv_lib_Xmu_XmuClientWindow+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXmu $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XmuClientWindow (); int main () { XmuClientWindow (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xmu_XmuClientWindow=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xmu_XmuClientWindow=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_Xmu_XmuClientWindow" >&5 echo "${ECHO_T}$ac_cv_lib_Xmu_XmuClientWindow" >&6 if test $ac_cv_lib_Xmu_XmuClientWindow = yes; then LIBS="$LIBS -lXmu" else { { echo "$as_me:$LINENO: error: Xmu library required" >&5 echo "$as_me: error: Xmu library required" >&2;} { (exit 1); exit 1; }; } fi fi ac_config_headers="$ac_config_headers src/config.h" ac_config_commands="$ac_config_commands default-1" echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/io.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test ${host_flag} = unix -o ${with_winio} = yes ; then as_ac_Header=`echo "ac_cv_header_${pciutils_libname}/pci.h" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for ${pciutils_libname}/pci.h" >&5 echo $ECHO_N "checking for ${pciutils_libname}/pci.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking ${pciutils_libname}/pci.h usability" >&5 echo $ECHO_N "checking ${pciutils_libname}/pci.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <${pciutils_libname}/pci.h> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking ${pciutils_libname}/pci.h presence" >&5 echo $ECHO_N "checking ${pciutils_libname}/pci.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <${pciutils_libname}/pci.h> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: ${pciutils_libname}/pci.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: ${pciutils_libname}/pci.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: ${pciutils_libname}/pci.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: ${pciutils_libname}/pci.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: ${pciutils_libname}/pci.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: ${pciutils_libname}/pci.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: ${pciutils_libname}/pci.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: ${pciutils_libname}/pci.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: ${pciutils_libname}/pci.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: ${pciutils_libname}/pci.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for ${pciutils_libname}/pci.h" >&5 echo $ECHO_N "checking for ${pciutils_libname}/pci.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then : else { echo "$as_me:$LINENO: WARNING: pci library header \'${pciutils_libname}/pci.h\' required" >&5 echo "$as_me: WARNING: pci library header \'${pciutils_libname}/pci.h\' required" >&2;} fi cat >>confdefs.h <<\_ACEOF #define HAVE_PCI 1 _ACEOF if test ${pciutils_libname} = pciutils ; then cat >>confdefs.h <<\_ACEOF #define HAVE_PCIUTILS 1 _ACEOF fi fi if test ${with_winio} = yes ; then if test "${ac_cv_header_winio_h+set}" = set; then echo "$as_me:$LINENO: checking for winio.h" >&5 echo $ECHO_N "checking for winio.h... $ECHO_C" >&6 if test "${ac_cv_header_winio_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_winio_h" >&5 echo "${ECHO_T}$ac_cv_header_winio_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking winio.h usability" >&5 echo $ECHO_N "checking winio.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking winio.h presence" >&5 echo $ECHO_N "checking winio.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: winio.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: winio.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: winio.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: winio.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: winio.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: winio.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: winio.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: winio.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: winio.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: winio.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for winio.h" >&5 echo $ECHO_N "checking for winio.h... $ECHO_C" >&6 if test "${ac_cv_header_winio_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_winio_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_winio_h" >&5 echo "${ECHO_T}$ac_cv_header_winio_h" >&6 fi if test $ac_cv_header_winio_h = yes; then : else { { echo "$as_me:$LINENO: error: winio wrapper library header 'winio.h' required" >&5 echo "$as_me: error: winio wrapper library header 'winio.h' required" >&2;} { (exit 1); exit 1; }; } fi fi if test ${with_x} = yes ; then if test "${ac_cv_header_X11_Xmu_WinUtil_h+set}" = set; then echo "$as_me:$LINENO: checking for X11/Xmu/WinUtil.h" >&5 echo $ECHO_N "checking for X11/Xmu/WinUtil.h... $ECHO_C" >&6 if test "${ac_cv_header_X11_Xmu_WinUtil_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xmu_WinUtil_h" >&5 echo "${ECHO_T}$ac_cv_header_X11_Xmu_WinUtil_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking X11/Xmu/WinUtil.h usability" >&5 echo $ECHO_N "checking X11/Xmu/WinUtil.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking X11/Xmu/WinUtil.h presence" >&5 echo $ECHO_N "checking X11/Xmu/WinUtil.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: X11/Xmu/WinUtil.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: X11/Xmu/WinUtil.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: X11/Xmu/WinUtil.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: X11/Xmu/WinUtil.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: X11/Xmu/WinUtil.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: X11/Xmu/WinUtil.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: X11/Xmu/WinUtil.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: X11/Xmu/WinUtil.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: X11/Xmu/WinUtil.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: X11/Xmu/WinUtil.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for X11/Xmu/WinUtil.h" >&5 echo $ECHO_N "checking for X11/Xmu/WinUtil.h... $ECHO_C" >&6 if test "${ac_cv_header_X11_Xmu_WinUtil_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_X11_Xmu_WinUtil_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xmu_WinUtil_h" >&5 echo "${ECHO_T}$ac_cv_header_X11_Xmu_WinUtil_h" >&6 fi if test $ac_cv_header_X11_Xmu_WinUtil_h = yes; then : else { { echo "$as_me:$LINENO: error: X11 header 'X11/Xmu/WinUtil.h' required" >&5 echo "$as_me: error: X11 header 'X11/Xmu/WinUtil.h' required" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: checking for X11/extensions/xf86vmode.h presence" >&5 echo $ECHO_N "checking for X11/extensions/xf86vmode.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: X11 header 'X11/extensions/xf86vmode.h' required" >&5 echo "$as_me: error: X11 header 'X11/extensions/xf86vmode.h' required" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_ext fi echo "$as_me:$LINENO: checking for XBox support" >&5 echo $ECHO_N "checking for XBox support... $ECHO_C" >&6 # Check whether --with-xbox or --without-xbox was given. if test "${with_xbox+set}" = set; then withval="$with_xbox" else with_xbox=no fi; if test ${with_xbox} = yes ; then echo "$as_me:$LINENO: result: enabled" >&5 echo "${ECHO_T}enabled" >&6 cat >>confdefs.h <<\_ACEOF #define XBOX_SUPPORT 1 _ACEOF OBJS_EXTRA="$OBJS_EXTRA xbox.o" else echo "$as_me:$LINENO: result: disabled" >&5 echo "${ECHO_T}disabled" >&6 fi # Check whether --with-fifo-path or --without-fifo-path was given. if test "${with_fifo_path+set}" = set; then withval="$with_fifo_path" with_fifo_path="$withval" else with_fifo_path="/var/run" fi; cat >>confdefs.h <<_ACEOF #define CONFIG_PIPE_PATH "${with_fifo_path}" _ACEOF echo "$as_me:$LINENO: result: path to use for fifo pipes... ${with_fifo_path}" >&5 echo "${ECHO_T}path to use for fifo pipes... ${with_fifo_path}" >&6 ac_config_files="$ac_config_files Makefile src/Makefile man/Makefile test/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by nvtv $as_me 0.4.7, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ nvtv config.status 0.4.7 configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "man/Makefile" ) CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; "src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@target@,$target,;t t s,@target_cpu@,$target_cpu,;t t s,@target_vendor@,$target_vendor,;t t s,@target_os@,$target_os,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@PROGRAM@,$PROGRAM,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@X_CFLAGS@,$X_CFLAGS,;t t s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t s,@X_LIBS@,$X_LIBS,;t t s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t s,@GTK_CONFIG@,$GTK_CONFIG,;t t s,@GTK_CFLAGS@,$GTK_CFLAGS,;t t s,@GTK_LIBS@,$GTK_LIBS,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@WX_CONFIG_PATH@,$WX_CONFIG_PATH,;t t s,@WX_CPPFLAGS@,$WX_CPPFLAGS,;t t s,@WX_CFLAGS@,$WX_CFLAGS,;t t s,@WX_CXXFLAGS@,$WX_CXXFLAGS,;t t s,@WX_CFLAGS_ONLY@,$WX_CFLAGS_ONLY,;t t s,@WX_CXXFLAGS_ONLY@,$WX_CXXFLAGS_ONLY,;t t s,@WX_LIBS@,$WX_LIBS,;t t s,@WX_LIBS_STATIC@,$WX_LIBS_STATIC,;t t s,@WX_VERSION@,$WX_VERSION,;t t s,@OBJS_GUI@,$OBJS_GUI,;t t s,@OBJS_EXTRA@,$OBJS_EXTRA,;t t s,@OBJS_BACKEND@,$OBJS_BACKEND,;t t s,@EGREP@,$EGREP,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in default-1 ) test -z "$CONFIG_HEADERS" || echo timestamp > src/stamp-h ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi nvtv-0.4.7/configure.in0000755000175000001440000002072610023315715010514 dnl Process this file with autoconf to produce a configure script. dnl Used autoconf 2.53-5. dnl Process it with aclocal to create aclocal.m4. dnl Package, Version, Bugreport, Tarname AC_INIT(nvtv,0.4.7,,nvtv-0.4.7) AC_PREREQ(2.53) dnl FIXME: dnl AC_CONFIG_AUX_DIR(config) dnl dnl Check system type dnl AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) dnl dnl Configuration defaults dnl AC_SUBST(PROGRAM) PROGRAM="nvtv nvtvd" dnl dnl Defaults and host matching dnl withdef_x=yes withdef_gtk=yes host_flag=unix withdef_client_backend=yes withdef_winio=no case $host in *-*-mingw32* | *-*-cygwin* | *-*-windows*) AC_MSG_RESULT(Setting defaults for Windows) PROGRAM="nvtv" host_flag=windows withdef_gtk=no withdef_x=no with_client_backend=no ;; esac dnl dnl Checks for programs. dnl AM_PROG_CC_STDC AC_PROG_INSTALL AC_PROG_MAKE_SET dnl dnl Debugging enables, CFLAGS dnl dnl Clear -g -O2 from CFLAGS CFLAGS="" AC_MSG_CHECKING(for debugging info) AC_ARG_ENABLE(debug, [ --disable-debug disable debugging info ],,enable_debug=yes) if test "$enable_debug" = yes; then CFLAGS="$CFLAGS -g" AC_MSG_RESULT(enabled) else CFLAGS="$CFLAGS -O2" AC_MSG_RESULT(disabled (optimizing on)) fi dnl dnl Check for X dnl AC_PATH_XTRA dnl Add X include dir to preprocessor flags (not done automatically), so dnl the extra X include checks down below work. This seems to be required dnl for some systems, though it shouldn't. Also add /usr/local/include dnl for libpci under FreeBSD. CPPFLAGS="$CPPFLAGS $X_CFLAGS -I/usr/local/include" if test "${with_x+set}" != set; then with_x="$withdef_x" fi dnl dnl Checks for GTK 1.2 or 2.0 dnl AC_ARG_WITH(gtk, [ --with-gtk use GTK 1.2 or 2.0 (force one with 'gtk1' or 'gtk2')], ,with_gtk="$withdef_gtk") have_gtk=no if test ${with_x} = no ; then dnl with_gtk=no AC_MSG_RESULT(X disabled as requested.) fi if test ${with_gtk} = no ; then AC_MSG_RESULT(GTK disabled as requested.) fi if test ${have_gtk} = no ; then if test ${with_gtk} = yes -o ${with_gtk} = gtk1 ; then AM_PATH_GTK(1.2.0, have_gtk=gtk1) fi fi if test ${have_gtk} = no ; then if test ${with_gtk} = yes -o ${with_gtk} = gtk2 ; then AM_PATH_GTK_2_0(2.0.0, have_gtk=gtk2) fi fi if test ${have_gtk} = no ; then if test ${with_gtk} = yes -o ${with_gtk} = gtk1 ; then AC_MSG_WARN(Cannot find GTK 1.2.0 or higher (Is gtk-config in path?)) fi if test ${with_gtk} = yes -o ${with_gtk} = gtk2 ; then AC_MSG_WARN(Cannot find GTK 2.0.0 or higher (Is pkg-config in path?)) fi if test ${with_gtk} != no ; then AC_MSG_WARN(GTK disabled.) with_gtk=no fi else LIBS="$LIBS $GTK_LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" fi dnl dnl Check for wxWindows 2.3 or higher dnl have_wxwin=no with_wxwin=no if test ${with_gtk} = no ; then AM_OPTIONS_WXCONFIG AM_PATH_WXCONFIG(2.3.0, have_wxwin=yes) if test ${have_wxwin} = no ; then if test ${with_wxwin} = yes ; then AC_MSG_WARN(Cannot find wxWindows 2.3.0 or higher) fi else CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY" CFLAGS="$CFLAGS $WX_CFLAGS_ONLY" LDFLAGS="$LDFLAGS $WX_LIBS" fi fi dnl dnl Adjust sources dnl AC_SUBST(OBJS_GUI) AC_SUBST(OBJS_EXTRA) AC_SUBST(OBJS_BACKEND) OBJS_GUI="" OBJS_EXTRA="" OBJS_BACKEND="" dnl Use sed instead of expr for for increased portability ("expr substr" dnl does not exist on some versions of "expr", including the FreeBSD one). dnl have_gtk_version=`expr ${have_gtk} : 'gtk\([[12]]\)'` if test ${with_x} = yes ; then AC_DEFINE(HAVE_X,1,[Define to 1 if X is available and used.]) OBJS_EXTRA="$OBJS_EXTRA actions.o" if test ${have_gtk} != no ; then have_gtk_version=`echo ${have_gtk} | sed -e 's/^gtk\(.\).*/\1/'` AC_DEFINE(HAVE_GTK,1,[Define to 1 if GTK is available and used.]) AC_DEFINE_UNQUOTED(HAVE_GTK_VERSION,${have_gtk_version},[Define to 1/2 for GTK major version.]) OBJS_GUI="gui.o gui_bt.o gui_cx.o gui_ch.o gui_ph.o gui_nx.o gui_nv.o gui_tdfx.o gui_i810.o" fi if test ${have_gtk} != gtk1 ; then LIBS="$LIBS $X_LIBS" AC_CHECK_LIB(X11,XOpenDisplay,LIBS="$LIBS -lX11", AC_MSG_ERROR(X11 library required)) AC_CHECK_LIB(Xext,XMissingExtension,LIBS="$LIBS -lXext", AC_MSG_ERROR(Xext library required)) fi fi dnl dnl Check for backend usage dnl AC_MSG_CHECKING(for main (direct) backend) AC_ARG_WITH(winio, [ --with-winio Use WinIo], ,with_winio="$withdef_winio") dnl FIXME check for WinIo availability case ${host_flag} in unix) AC_MSG_RESULT(unix) AC_DEFINE(USE_UNIX_BACKEND,1,[Define to 1 if Unix backend is used.]) OBJS_BACKEND="$OBJS_BACKEND card_direct.o back_unix.o" ;; windows) if test ${with_winio} = yes ; then AC_MSG_RESULT(windows/winio) OBJS_BACKEND="$OBJS_BACKEND card_direct.o back_winio.o" AC_DEFINE(HAVE_WINIO,1,[Define to 1 if WinIo is used.]) else AC_MSG_RESULT(windows/nvdll) OBJS_BACKEND="$OBJS_BACKEND back_mswin.o" fi AC_DEFINE(USE_MSWIN_BACKEND,1,[Define to 1 if MS-Windows backend is used.]) ;; esac AC_MSG_CHECKING(for client backend) AC_ARG_WITH(client-backend, [ --with-client-backend Use client backend (default)], ,with_client_backend="$withdef_client_backend") if test ${with_client_backend} = yes ; then AC_MSG_RESULT(enabled) AC_DEFINE(USE_CLIENT_BACKEND,1,[Define to 1 if client backend is used.]) OBJS_BACKEND="$OBJS_BACKEND back_client.o" else AC_MSG_RESULT(disabled) fi dnl dnl Check for other libraries dnl dnl (must check for winio before pci) dnl AC_CHECK_LIB(m,sin,LIBS="$LIBS -lm", AC_MSG_ERROR(math library required)) case ${host} in *-*-netbsd*) AC_CHECK_LIB(i386,i386_iopl,LIBS="$LIBS -li386", AC_MSG_ERROR(NetBSD i386 library required)) AC_CHECK_LIB(pci,pcibus_conf_read,LIBS="$LIBS -lpci", AC_MSG_ERROR(NetBSD pci library required)) ;; *-*-freebsd*) AC_CHECK_LIB(gnugetopt,getopt_long,LIBS="$LIBS -lgnugetopt", AC_MSG_ERROR(FreeBSD gnugetopt library required)) ;; esac if test ${with_winio} = yes ; then AC_CHECK_LIB(winio,winio_init,LIBS="$LIBS -lwinio", AC_MSG_ERROR(winio wrapper library required)) fi if test ${host_flag} = unix -o ${with_winio} = yes ; then AC_CHECK_LIB(pci,pci_init,LIBS="$LIBS -lpci" pciutils_libname="pci", AC_CHECK_LIB(pciutils,pci_init,LIBS="$LIBS -lpciutils" pciutils_libname="pciutils", AC_MSG_ERROR(pci library required))) fi dnl dnl Check for other X libraries dnl if test ${with_x} = yes ; then AC_CHECK_LIB(Xxf86vm,XF86VidModeQueryVersion,LIBS="$LIBS -lXxf86vm", AC_MSG_ERROR(Xxf86vm video mode extension library required)) AC_CHECK_LIB(Xmu,XmuClientWindow,LIBS="$LIBS -lXmu", AC_MSG_ERROR(Xmu library required)) fi dnl dnl Check for header files dnl AM_CONFIG_HEADER(src/config.h) AC_HEADER_STDC AC_CHECK_HEADERS(sys/io.h) if test ${host_flag} = unix -o ${with_winio} = yes ; then AC_CHECK_HEADER(${pciutils_libname}/pci.h,, AC_MSG_WARN(pci library header \'${pciutils_libname}/pci.h\' required)) AC_DEFINE(HAVE_PCI,1,[Define to 1 if pciutils available and used.]) if test ${pciutils_libname} = pciutils ; then AC_DEFINE(HAVE_PCIUTILS,1,[Define to 1 if pciutils library is named 'pciutils'.]) fi fi if test ${with_winio} = yes ; then AC_CHECK_HEADER(winio.h,, AC_MSG_ERROR(winio wrapper library header 'winio.h' required)) fi dnl dnl Check for X header files dnl if test ${with_x} = yes ; then AC_CHECK_HEADER(X11/Xmu/WinUtil.h,, AC_MSG_ERROR(X11 header 'X11/Xmu/WinUtil.h' required)) AC_MSG_CHECKING(for X11/extensions/xf86vmode.h presence) AC_TRY_CPP([#include ],[ AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) AC_MSG_ERROR(X11 header 'X11/extensions/xf86vmode.h' required)]) fi dnl dnl Check for XBox option dnl AC_MSG_CHECKING(for XBox support) AC_ARG_WITH(xbox, [ --with-xbox compile for XBox],,with_xbox=no) if test ${with_xbox} = yes ; then AC_MSG_RESULT(enabled) AC_DEFINE(XBOX_SUPPORT,1,[Define to 1 if XBox support is used.]) OBJS_EXTRA="$OBJS_EXTRA xbox.o" else AC_MSG_RESULT(disabled) fi dnl dnl Process other options dnl AC_ARG_WITH(fifo-path, [ --with-fifo-path=PATH path for the server/client fifo pipes (/var/run)], with_fifo_path="$withval", with_fifo_path="/var/run") AC_DEFINE_UNQUOTED(CONFIG_PIPE_PATH, "${with_fifo_path}", [Path to client/server fifo pipes]) AC_MSG_RESULT(path to use for fifo pipes... ${with_fifo_path}) dnl dnl Create files dnl AC_OUTPUT([Makefile src/Makefile man/Makefile test/Makefile]) nvtv-0.4.7/install-sh0000644000175000001440000000000007376221653010176 nvtv-0.4.7/ltmain.sh0000644000175000001440000043051307665162513010035 # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" # Parse our command line options once, thoroughly. while test $# -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" exit 0 ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 exit 0 ;; --debug) echo "$progname: enabling shell trace mode" set -x ;; --dry-run | -n) run=: ;; --features) echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit 0 ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit 1 ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then case $nonopt in *cc | *++ | gcc* | *-gcc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit 1 fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= prev= lastarg= srcfile="$nonopt" suppress_output= user_target=no for arg do case $prev in "") ;; xcompiler) # Aesthetically quote the previous argument. prev= lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac # Add the previous argument to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else base_compile="$base_compile $lastarg" fi continue ;; esac # Accept any command-line options. case $arg in -o) if test "$user_target" != "no"; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit 1 fi user_target=next ;; -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; -Xcompiler) prev=xcompiler continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else base_compile="$base_compile $lastarg" fi continue ;; esac case $user_target in next) # The next one is the -o target name user_target=yes continue ;; yes) # We got the output file user_target=set libobj="$arg" continue ;; esac # Accept the current argument as the source file. lastarg="$srcfile" srcfile="$arg" # Aesthetically quote the previous argument. # Backslashify any backslashes, double quotes, and dollar signs. # These are the only characters that are still specially # interpreted inside of double-quoted scrings. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $lastarg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac # Add the previous argument to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else base_compile="$base_compile $lastarg" fi done case $user_target in set) ;; no) # Get the name of the library object. libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; *) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit 1 ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSfmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit 1 ;; esac if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit 1 fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $libobj" else removelist="$libobj" fi $run $rm $removelist trap "$run $rm $removelist; exit 1" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit 1" 1 2 15 else need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$0" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then # All platforms use -DPIC, to notify preprocessed assembler code. command="$base_compile $srcfile $pic_flag -DPIC" else # Don't build PIC code command="$base_compile $srcfile" fi if test "$build_old_libs" = yes; then lo_libobj="$libobj" dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$libobj"; then dir="$objdir" else dir="$dir/$objdir" fi libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` if test -d "$dir"; then $show "$rm $libobj" $run $rm $libobj else $show "$mkdir $dir" $run $mkdir $dir status=$? if test $status -ne 0 && test ! -d $dir; then exit $status fi fi fi if test "$compiler_o_lo" = yes; then output_obj="$libobj" command="$command -o $output_obj" elif test "$compiler_c_o" = yes; then output_obj="$obj" command="$command -o $output_obj" fi $run $rm "$output_obj" $show "$command" if $run eval "$command"; then : else test -n "$output_obj" && $run $rm $removelist exit 1 fi if test "$need_locks" = warn && test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed, then go on to compile the next one if test x"$output_obj" != x"$libobj"; then $show "$mv $output_obj $libobj" if $run $mv $output_obj $libobj; then : else error=$? $run $rm $removelist exit $error fi fi # If we have no pic_flag, then copy the object into place and finish. if (test -z "$pic_flag" || test "$pic_mode" != default) && test "$build_old_libs" = yes; then # Rename the .lo from within objdir to obj if test -f $obj; then $show $rm $obj $run $rm $obj fi $show "$mv $libobj $obj" if $run $mv $libobj $obj; then : else error=$? $run $rm $removelist exit $error fi xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` # Now arrange that obj and lo_libobj become the same file $show "(cd $xdir && $LN_S $baseobj $libobj)" if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then # Unlock the critical section if it was locked if test "$need_locks" != no; then $run $rm "$lockfile" fi exit 0 else error=$? $run $rm $removelist exit $error fi fi # Allow error messages only from the first compilation. suppress_output=' >/dev/null 2>&1' fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $srcfile" else # All platforms use -DPIC, to notify preprocessed assembler code. command="$base_compile $srcfile $pic_flag -DPIC" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" output_obj="$obj" fi # Suppress compiler output if we already did a PIC compilation. command="$command$suppress_output" $run $rm "$output_obj" $show "$command" if $run eval "$command"; then : else $run $rm $removelist exit 1 fi if test "$need_locks" = warn && test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed if test x"$output_obj" != x"$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Create an invalid libtool object if no PIC, so that we do not # accidentally link it into a program. if test "$build_libtool_libs" != yes; then $show "echo timestamp > $libobj" $run eval "echo timestamp > \$libobj" || exit $? else # Move the .lo from within objdir $show "$mv $libobj $lo_libobj" if $run $mv $libobj $lo_libobj; then : else error=$? $run $rm $removelist exit $error fi fi fi # Unlock the critical section if it was locked if test "$need_locks" != no; then $run $rm "$lockfile" fi exit 0 ;; # libtool link mode link | relink) modename="$modename: link" case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invokation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args="$nonopt" compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= # We need to know -static, to get the right output filenames. for arg do case $arg in -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test $# -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit 1 fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n $prev prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit 1 fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | no/*-*-nonstopux*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 exit 1 fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -o) prev=output ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.lo | *.$objext) # A library or standard object. if test "$prev" = dlfiles; then # This file was specified with -dlopen. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $arg" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` prev= else case $arg in *.lo) libobjs="$libobjs $arg" ;; *) objs="$objs $arg" ;; esac fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d $output_objdir; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test $status -ne 0 && test ! -d $output_objdir; then exit $status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit 1 ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit 1 ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test $linkmode = prog; then # Determine which files to process case $pass in dlopen) libs="$dlfiles" save_deplibs="$deplibs" # Collect dlpreopened libraries deplibs= ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi for deplib in $libs; do lib= found=no case $deplib in -l*) if test $linkmode = oldlib && test $linkmode = obj; then $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 continue fi if test $pass = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do # Search the libtool library lib="$searchdir/lib${name}.la" if test -f "$lib"; then found=yes break fi done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test $pass = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test $pass = conv; then deplibs="$deplib $deplibs" continue fi if test $pass = scan; then deplibs="$deplib $deplibs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test $pass = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test $pass = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) if test "$deplibs_check_method" != pass_all; then echo echo "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not used here." else echo echo "*** Warning: Linking the shared library $output against the" echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test $pass != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test $found = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 exit 1 fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variable installed. installed=yes # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test $linkmode = oldlib && test $linkmode = obj; }; then # Add dl[pre]opened files of deplib test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test $pass = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit 1 fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test $linkmode != prog && test $linkmode != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit 1 fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit 1 fi # This library was specified with -dlopen. if test $pass = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit 1 fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. dlprefiles="$dlprefiles $lib" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test $pass = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit 1 fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test $linkmode = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" fi continue fi if test $linkmode = prog && test $pass != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test $linkalldeplibs = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # Link against this shared library if test "$linkmode,$pass" = "prog,link" || { test $linkmode = lib && test $hardcode_into_libs = yes; }; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac if test $linkmode = prog; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi fi fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' eval cmds=\"$extract_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' eval cmds=\"$old_archive_from_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n $old_archive_from_expsyms_cmds if test $linkmode = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\/]*) add_dir="-L$inst_prefix_dir$libdir $add_dir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit 1 fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test $linkmode = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test $linkmode = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\/]*) add_dir="-L$inst_prefix_dir$libdir $add_dir" ;; esac fi add="-l$name" fi if test $linkmode = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test $linkmode = prog; then if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi # Try to link the static library # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo echo "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test $linkmode = lib; then if test -n "$dependency_libs" && { test $hardcode_into_libs != yes || test $build_old_libs = yes || test $link_static = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test $link_all_deplibs != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="-L$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit 1 fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="-L$absdir" fi ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test $pass = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test $pass != dlopen; then test $pass != scan && dependency_libs="$newdependency_libs" if test $pass != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do case $deplib in -L*) new_libs="$deplib $new_libs" ;; *) case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi if test "$pass" = "conv" && { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then libs="$deplibs" # reset libs deplibs= fi done # for pass if test $linkmode = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit 1 fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit 1 else echo echo "*** Warning: Linking the shared library $output against the non-libtool" echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test $# -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. libext=al oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit 1 fi current="$2" revision="$3" age="$4" # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac if test $age -gt $current; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test $loop != 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test $loop != 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= verstring="0.0" case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring="" ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs. $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test $hardcode_into_libs != yes || test $build_old_libs = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. ;; *) # Add libc to deplibs on all other systems if necessary. if test $build_libtool_need_lc = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behaviour. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done if test -n "$a_deplib" ; then droppeddeps=yes echo echo "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then echo "*** with $libname but no candidates were found. (...for file magic test)" else echo "*** with $libname and none of the candidates passed a file format test" echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check below in file_magic test if eval echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | egrep "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done if test -n "$a_deplib" ; then droppeddeps=yes echo echo "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then echo "*** with $libname but no candidates were found. (...for regex pattern test)" else echo "*** with $libname and none of the candidates passed a file format test" echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | grep . >/dev/null; then echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" echo "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test $allow_undefined = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test $hardcode_into_libs = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi test -z "$dlname" && dlname=$soname lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Ensure that we have .o objects for linkers which dislike .lo # (e.g. aix) in case we are running --disable-static for obj in $libobjs; do xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` if test ! -f $xdir/$oldobj; then $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? fi done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols eval cmds=\"$export_symbols_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` done fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval cmds=\"$archive_expsym_cmds\" else save_deplibs="$deplibs" for conv in $convenience; do tmp_deplibs= for test_deplib in $deplibs; do if test "$test_deplib" != "$conv"; then tmp_deplibs="$tmp_deplibs $test_deplib" fi done deplibs="$tmp_deplibs" done eval cmds=\"$archive_cmds\" deplibs="$save_deplibs" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? exit 0 fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit 1 fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` done fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" eval cmds=\"$reload_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit 0 fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. $show "echo timestamp > $libobj" $run eval "echo timestamp > $libobj" || exit $? exit 0 fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" eval cmds=\"$reload_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" else # Just create a symlink. $show $rm $libobj $run $rm $libobj xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$libobj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` $show "(cd $xdir && $LN_S $oldobj $baseobj)" $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit 0 ;; prog) case $host in *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval 'echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DPIC";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit 1 ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test $need_relink = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit 0 fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $0 --fallback-echo"; then case $0 in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; *) qecho="$SHELL `pwd`/$0 --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe ;; *) exeext= ;; esac $rm $output trap "$rm $output; exit 1" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 ${SED} $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # win32 systems need to use the prog path for dll # lookup to work *-*-cygwin* | *-*-pw32*) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ # Export the path to the program. PATH=\"\$progdir:\$PATH\" export PATH exec \$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit 0 ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" # Add in members from convenience archives. for xlib in $addlibs; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` done fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then eval cmds=\"$old_archive_from_new_cmds\" else # Ensure that we have .o objects in place in case we decided # not to build a shared library, and have fallen back to building # static libs even though --disable-static was passed! for oldobj in $oldobjs; do if test ! -f $oldobj; then xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$oldobj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` $show "(cd $xdir && ${LN_S} $obj $baseobj)" $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? fi done eval cmds=\"$old_archive_cmds\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit 1 fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test $need_relink = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit 0 ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit 1 fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test $# -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit 1 fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit 1 fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit 1 fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test $# -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" eval cmds=\"$postinstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit 0 ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $wrapper ;; *) . ./$wrapper ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit 1 fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $wrapper ;; *) . ./$wrapper ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : else $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in /usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. eval cmds=\"$old_postinstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $0 --finish$current_libdirs' else exit 0 fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. eval cmds=\"$finish_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = ":" && exit 0 echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do echo " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" echo "more information, such as the ld(1) and ld.so(8) manual pages." echo "----------------------------------------------------------------------" exit 0 ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit 1 fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit 1 fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit 1 fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved enviroment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit 0 fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit 1 fi rmdirs= for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$objdir" else objdir="$dir/$objdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test $mode = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test $mode = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test $mode = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. eval cmds=\"$postuninstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" if test $? != 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. eval cmds=\"$old_postuninstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" if test $? != 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) if test "$build_old_libs" = yes; then oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` rmfiles="$rmfiles $dir/$oldobj" fi ;; *) # Do a test to see if this is a libtool program. if test $mode = clean && (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$file rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit 1 ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit 1 fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit 1 fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE." exit 0 ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac echo $echo "Try \`$modename --help' for more information about other modes." exit 0 # Local Variables: # mode:shell-script # sh-indentation:2 # End: nvtv-0.4.7/missing0000755000175000001440000001452010021046620007564 #! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997, 2001, 2002 Free Software Foundation, Inc. # Franc,ois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.in; then configure_ac=configure.ac else configure_ac=configure.in fi case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing - GNU libit 0.0" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`$configure_ac'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`$configure_ac'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`$configure_ac'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' $configure_ac` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`$configure_ac'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 nvtv-0.4.7/mkinstalldirs0000644000175000001440000000133007665163367011017 #! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.1 2003/05/28 16:42:31 dthierbach Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here nvtv-0.4.7/ANNOUNCE0000644000175000001440000000303007547514036007334 This is an announcement for an open-source tool to use the TV-Out capabilities of NVidia graphic cards on Linux. The closed-source drivers by NVidia already allow TV-Out, but only in a limited way: Only two resolutions are supported, overscan compensation (the size of the image on the TV) cannot be adjusted, the video overlay does not work on the TV, and there is no way to control the flicker filters and other image processing capabilities the TV encoder chip offers. This tool was written to overcome these limitations, inspired by TV-Tool (http://www.tvtool.de/) that offers a similar functionality for Windows. Features include: * Arbitray resolutions, as far as the encoder chips supports them. * Arbitray overscan compensation, with the same restriction. * Multiple TV encoder chip support (So far Brooktree, Conexant, Chrontel and Philips chips, and other chipsets can be added easily). * Autodetection of TV encoder chip and PCI card. * Control display parameters like brightness, saturation, contrast, flicker filter, or bandwidth. * Graphical user interface and command line support. * Switching X video modes. * Centering and resizing an X window on the X virtual viewport. * Control downto direct register access. The project is in the alpha stage, so there may be still bugs, and some features need more work. However, since it is open source, you may contribute to fix bugs and add functionality. The project is located at Sourceforge. If you are interested, have a look at http://sourceforge.net/projects/nv-tv-out/ nvtv-0.4.7/BUGS0000644000175000001440000000521607443726221006672 Bugreports ---------- The program has been tested on a Debian Linux system with an GeForce2 MX card and Brooktree 869 chip. If you run into trouble with a different system, first look at the 'Config' page. Compare the PCI Card and TV chip values with those of your system. (Either look directly onto the card and read the chip labels, or examine the XFree logfile with the closed source NVidia driver activated). When reporting a bug, mention these values and please state exactly what does not work and what happens when you try it. So far, only Brooktree and Chrontel chips are supported; Chipsets other than Brooktree or Chrontel (Philips, for example) could in principle also be supported; contributions are welcome. (Note: 'Unknown chips' in the I2C range A0-AF are EDID monitor addresses and not TV chips). Known Bugs ---------- Probably many, including: * If you start with the -N or --nvdev option, and there is no running closed source 'nvidia' X driver present, the system will crash due to a bug in the NVidia kernel driver. * Switching to TV mode might need several attempts, especially for the large and huge Brooktree NTSC modes, and if the open-source 'nv' X driver is active. * The Chrontel PAL modes have a significant distortion on the right edge. Sometimes the whole right edge seems to be missing. The NTSC modes are a lot better (also with respect to overscan size). I have no idea if this is a fault of my Chrontel chip, the Macrovision distortion, or wrong register programming. * Not all of the predefined Brooktree modes work well. It should be possible for all modes, except PAL 640x480 Large & Huge, to be displayed as dualview on the monitor. * Especially in the Brooktree Huge modes, there are CRT values that allow doubleview, but there is not enough time to draw the hardware cursor in these cases. That may cause a system freeze. (Disabling the hardware cursor in XF86Config helps in those cases). Even without hardware cursor, sometimes the system freezes. * There are similar problems with the Chrontel PAL 800x600 Large mode: I have sometimes experienced a system freeze, and the TV color flickers since it seems not to be able to produce the data in time, so the color information is shifted for half a pixel. (Color data is latched on two subsequent clocks). * The calculated Brooktree overscan compensation on the Status page sometimes differs slightly from the one used in the calculation. I have no idea why. * The Chrontel overscan values are completely wrong. The calculations have to be done in a different way. * If the server dies, the client segfaults (should check eof condition everywhere). nvtv-0.4.7/FAQ0000644000175000001440000006614310007406574006543 FREQUENTLY ASKED QUESTIONS ~~~~~~~~~~~~~~~~~~~~~~~~~~ 1. GENERAL TROUBLESHOOTING 1.1 When switching the TV on, I can see only part of my screen. 1.2 When I switch my DVD player into fullscreen mode, only part of the image appears on the TV. 1.3 When my application switches X modes while the TV is active, the screen gets messed up. 1.4 I don't get an image on the TV at all. 1.5 I can see an image on the TV, but no image on the monitor in some or in all modes, even though I have dualview enabled. 1.6 The image on my TV is only black and white. How can I get color? 1.7 While using TV-out, after some time (10, 20 or 30 minutes) something happens to the image: There may be some disturbances (black lines), or the image may even disappear completely. What's wrong here? 1.8 When switching back to the monitor, I see 'waves' on the screen, or only half of the screen. 1.9 The computer freezes after some time, the cursor disappears, or there are strange patterns on the screen.This happen especially in modes with low overscan. 1.10 When I switch back to the monitor, the image is slightly horizontally shifted. 1.11 Can I connect a SCART connector and get real RGB? 2. ISSUES WITH SOME CARD TYPES 2.1 I have a GeForce4 MX, GeForce4 GO or GeForce MX GPU card, and nvtv doesn't work. 2.2 I have a Voodoo3 card, and the image "tilts" when I move the cursor as soon as I have enabled TV out. What's wrong? 2.3 I have a Riva128, and nothing works. Are these cards not supported? 2.4 Can I use nvtv on my Laptop with an LCD display/flatpanel? 2.5 I have a TNT2 card, and the border of the TV image is pink. 2.6 I have a GeForce4 card, and with Twinview activated, there is no image at all on the TV. 3. ISSUES WITH SOME ENCODER CHIPS 3.1 I have a Chrontel chip, and the image on the screen is either too large, or too small. 3.2 I have the Chrontel chip, and the "Macrovision" button on the Settings page is grayed and off. Why can't I enable Macrovision? 3.3 I have a Philips chip, and the colors are all wrong. 3.4 I have a Chrontel chip, and on some resolutions, the color flickers (e.g. between blue and red). 3.5 The colors are wrong (e.g. purple background), and I have a Brookree or Conexant chip, or the suggestions to the questions above didn't help. 4. THE DEMON, PLUGINS, AND OTHER ACCESS ISSUES 4.1 The new version of nvtv doesn't work with the xine plugin. What can I do? 4.2 I am using the closed source 'nvidia' driver, but the -N option doesn't work. 4.3 How can I automatically run nvtvd after booting? 5. CUSTOMIZING AND SPECIAL USAGE 5.1 Can I use two X servers, one for the TV, and one for the monitor, and switch between them by switching between the virtual terminals? 5.2 It's tiring to always have to start nvtv, pick a mode, and switch on the tv, and then to start an application. Can I automatize that? 5.3 Can I have true dualhead view with one image on the monitor and a different image on the TV? 5.4 My TV can show images in true 16:9 widescreen format. How can I use this feature, for example to view DVDs in this format? 5.5 I am using a second graphics card, and nvtv is not able to detect it. 5.6 I have trouble getting a stable TV image while trying my own settings, and I do not want to reboot all the time. 5.7 I need to adjust the position, the color carrier frequency or something else that is not covered by the command line switches. How can I automate thus? 5.8 When I try to watch videos on the TV, the aspect ration is distorted. 6. CONTRIBUTING 6.1 I have one of the cards that are not fully supported by nvtv. How can I help? 6.2 How can I include a new mode or a modefied mode into the database? 7. RESSOURCES 7.1 Are any other web ressources available? 7.2 Is there a list of cards together with the encoder type they use, so I can make a choice before I buy a new card? ====================================================================== 1.1 When switching the TV on, I can see only part of my screen. The reason is probably that your X screen has a much larger 'virtual' resolution than what is displayed on the TV. This is a 'feature' of X; even if you switch X modes, the overall size of the screen stays the same. There are several things you can do: 1) If you have modes for smaller resolutions in your XF86Config file, you can switch to those with the 'X Video mode' button *before* enabling TV out. This will allow you to move the visible part of the screen on your TV. If the application you want to use on the TV uses a window (recommended), you can resize and center this window on the TV with the nvtv GUI or command line options, or of course with the command line options of the application. Don't try to switch to 'fullscreen', it will be too large. The documentation about XFree explains how to make a mode with a special resolution. Resolutions like 800x600 or 640x480 are often preconfigured, or can be selected with the setup programs of XFree. This is the recommended way that I use myself. 2) Change you XF86Config file so that it doesn't contain any resolutions larger than the mode you want to use. If you want to keep higher resolutions, you can use a second X server, and switch between both servers with the keyboard. ---------------------------------------------------------------------- 1.2 When I switch my DVD player into fullscreen mode, only part of the image appears on the TV. To understand this, you have to keep in mind that X always has the same 'maximal' resolution (which corresponds to the size of the virtual screen). So 'fullscreen' does not mean 'all that is visible' but 'all that is drawable in the video memory' (see question 1.1 above). Solution: Don't use fullscreen mode, but resize the window to the correct size instead, either using nvtv or the command line options of your player program. ---------------------------------------------------------------------- 1.3 When my application switches X modes while the TV is active, the screen gets messed up. Don't switch X modes while TV out is active. This is a no-no, Nvtv was not designed to support that. Switch X modes *before* you enable the TV, either with your application, or with Nvtv from the GUI or command line. Some applications like mplayer under some circumstances (e.g. with vesa fb driver) seem to insist on switching video modes. The only way to fix that is to patch the application (or to add a command line switch) to prevent them from switching. If you cannot program yourself, send a support request to the developers of that application. ---------------------------------------------------------------------- 1.4 I don't get an image on the TV at all. Maybe the connector autodetection doesn't work for you, because the line is not properly terminated in your TV. Switch the connector to 'both', and try again. Of course, there may be lots of different reasons, like a damaged connector cable, etc. ---------------------------------------------------------------------- 1.5 I can see an image on the TV, but no image on the monitor in some or in all modes, even though I have dualview enabled. Some monitors don't like the low frequencies (50 Hz/60 Hz vertical for PAL/NTSC, and 30-40 kHz horizontal) the dual view mode has to use. If you cannot get an image on the monitor in nearly all modes, you should disable dualview completely. (Remember, if you destroy your monitor, it's your responsibility, not mine). However, most modern monitors should cope with that. The second reason is that in some modes, especially those with large overscan (i.e., small overscan percantage, and a large image) don't leave the monitor enough time to 'retrace'. In that case, if you really need dualview, you should use a different mode (or even make a new one if you have the Brooktree chip). ---------------------------------------------------------------------- 1.6 The image on my TV is only black and white. How can I get color? There are many possible reasons for this. (a) You have chosen the wrong color encoding system (PAL/NTSC/...), or your TV uses a color encoding system that is not supported yet. (b) You have a SVideo (S-VHS) to Composite connector that uses only the luminance (Y) line of the SVideo connection. If you have a Brooktree chip, try selecting 'Convert' on the 'Config'-page as connector setting. This will output the composite (FBAS) signal on the Y-line. If you have a Chrontel chip, however, this setting will not help; 'Convert' in this case is the same as the 'SVideo' setting. You will need a proper connector that 'mixes' both the Y-line and the C-line of the SVideo output. See http://tvtool.info/english/cablefaq3_e.htm for some details. Other helpful links may be http://www.hut.fi/Misc/Electronics/circuits/svideo2cvideo.html or the schematics for a couple of converters from sandberg http://www.sandberg.it/img/prod/autocad/502-34.pdf http://www.sandberg.it/img/prod/autocad/503-65.pdf (c) The cable connecting your TV with your computer is too long, or external electrical signals interfere with the color signal. (d) On some systems, especially with Chrontel encoders, the frequency of the color carrier is wrong. You can change this frequency with the two 'fsci' spinbuttons on the Chrontel register page, and similarly with the 'msc' spinbuttons on the Brooktree register page. Don't forget to 'Apply' or 'AutoApply' your changes. If you need to change this value and find ones that work for you, please mail me the mode and the values. There is also a 'pseudo' TV system called 'PAL-X' which has a few modes with different color carrier. Maybe those work for you, maybe they don't. ---------------------------------------------------------------------- 1.7 While using TV-out, after some time (10, 20 or 30 minutes) something happens to the image: There may be some disturbances (black lines), or the image may even disappear completely. What's wrong here? This is probably the X screen saver. You can disable it with 'xset -dpms s off'. Don't forget to enable it later on if you need it. Read the manpage for details. ---------------------------------------------------------------------- 1.8 When switching back to the monitor, I see 'waves' on the screen, or only half of the screen. Try switch to the virtual text console and back. With the closed source 'nvidia' driver, this should help; with the 'nv' driver, it might. The reason for this effect is probably that the newer cards (like GeForce3 or GeForce4) use some additional registers that are not programmed correctly. If anybody finds out what these registers are, please send me an email (I don't have any of those cards, I cannot test it.) ---------------------------------------------------------------------- 1.9 The computer freezes after some time, the cursor disappears, or there are strange patterns on the screen. This happen especially in modes with low overscan. The NVidia cards need some time during the vertical refresh phase. If this time is too short, the above effects may happen, especially if you have a somewhat slower system (I have observed this on a 700MHz AMD K6). You can use a software cursor instead of a hardware cursor by using the options "SWCursor" or "HWCursor" in your XF86Config file as described in the README of the NVidia driver, or use the open source 'nv' driver instead of the closed source 'nvidia' driver. If this does not help, use a different mode with more overscan (or make your own). ---------------------------------------------------------------------- 1.10 When I switch back to the monitor, the image is slightly horizontally shifted. The 'nvidia' and the 'nv' driver don't agree on the way they interpret the X modeline. Nvtv interprets it the way 'nvidia' does (because I supposed they would be doing it correctly); so compared to the 'nv' driver it will be always shifted. You can correct that by switching X modes, e.g with CTRL-+ followed by CTRL-- on the numberpad. (This will of course only work if you have more than one valid modeline). ---------------------------------------------------------------------- 1.11 Can I connect a SCART connector and get real RGB? In principle, yes. It depends on the encoder chip, and in most cases you will have to solder additional connectors to the board. For the Chrontel chip, for example, have a look at http://tvtool.info/english/rgb_chrontel_e.htm Nvtv has not setting yet to enable RGB, but if you enable 'Bypass', you can for example enable the RGB mode by setting the 'scart' flag on the CH Regs1 page. Please contact me if you have modified your hardware and want an additional setting to make it easier to use. ---------------------------------------------------------------------- 2.1 I have a GeForce4 MX card, and nvtv doesn't work. The GeForce4 MX, GeForce4 GO and GeForce4 MX GPU cards sometimes use an internal TV encoder chip (which shows up as 'NVIDIA', 'NV17' or 'NV18' as the name of the TV encoder in the XFree log). This encoder is not supported at all by nvtv yet, and without the hardware it's impossible to figure out how to do it. But even if there is an external encoder chip on the card, the GeForce4 MX might use some extra registers, which need to be configured to make TV work. You can try cheating by activating TV with the nvidia driver, and then using nvtv. Or, even better, if someone helps finding those extra registers, we can include support in nvtv. (The GeForce4 support was done in that way.) The GeForce4 GO card has not been tested at all, and may very likely crash the program. ---------------------------------------------------------------------- 2.2 I have a Voodoo3 card, and the image "tilts" when I move the cursor as soon as I have enabled TV out. What's wrong? If you are using a X mode with a large resolution (dot clock greater than 135 MHz, i.e. a horizontal resolution of 1024 or 1280 etc.) and a hardware cursor, the X driver will write a wrong value into a register when it shows or hides the cursor. Solution: Either disable the hardware cursor with the "SWCursor" option in your XF86Config file, or switch to a smaller X mode before enabling TV out. ---------------------------------------------------------------------- 2.3 I have a Riva128, and nothing works. Are these cards not supported? The Riva128 card uses a completely different way to produce TV-out. Also, as far as I know, it can send a picture either to the monitor or to the TV, but not both, because it uses the same chip pins to supply the data, and decides which one to choose at power-on time. So if someone can figure out a way to switch between TV and monitor output later, I'd be happy to hear about it, but at the moment it seems it just won't work. ---------------------------------------------------------------------- 2.4 Can I use nvtv on my Laptop with an LCD display/flatpanel? In principle, yes. But be careful: The program does not know how to control the flatpanel. It tries to disable it, if it is one the same head that is used for tv-out, but it might completely turn it off. Also, switching the TV head when the flatpanel is active will currently probably not work. It might help if you connect your Laptop to an external monitor, and disable the flatpanel before starting nvtv. Generally speaking, nvtv doesn't work very well on Laptops/GeForce2 GO cards at the moment. I got it working with TwinView on a laptop, but I didn't have the laptop long enough to try different ways. Experiments are at your own risk. ---------------------------------------------------------------------- 2.5 I have a TNT2 card, and the border of the TV image is pink. This happens on some cards for unknown reasons. I tried to zero every register I can think of that could influence the color, but I haven't found the right one yet, and without the card this is not so easy. If someone figures out which registers to change, please tell me. ---------------------------------------------------------------------- 2.6 I have a GeForce4 card, and with Twinview activated, there is no image at all on the TV. Try "TV on", "TV off", and then again "TV on". Yes, that is probably a bug, and might be fixed in the next release. ---------------------------------------------------------------------- 3.1 I have a Chrontel chip, and the image on the screen is either too large, or too small. The Chrontel encoder chip only has a limited number of modes; all of them are accessible with nvtv. So if you really want an image that exactly fits on your TV, you need another encoder chip. (However, remember that for 'normal' TV, the image is always too large, and you don't notice that at all). If you *really* want fine control over the size of the image, you can cheat a bit. Take a mode that is too large for your screen, reduce the Display CRTC values, and adjust the Sync and Total values until the image is centered again. You will end up with a non-standard resolution, but the image will fit. (This is how the 768x576 modes were made). ---------------------------------------------------------------------- 3.2 I have the Chrontel chip, and the "Macrovision" button on the Settings page is grayed and off. Why can't I enable Macrovision? It is not possible to enable Macrovision in all modes, because we do not have enough information how to do that. Therefore, the Macrovision button will be insensitive and off for those modes, and sensitive (and also off by default) for the others. Since most people do not want Macrovision anyway, this is not a serious drawback. ---------------------------------------------------------------------- 3.3 I have a Philips chip, and the colors are all wrong. Try the colorfix setting. ---------------------------------------------------------------------- 3.4 I have a Chrontel chip, and on some resolutions, the color flickers (e.g. between blue and red). Try the colorfix setting. ---------------------------------------------------------------------- 3.5 The colors are wrong (e.g. purple background), and I have a Brookree or Conexant chip, or the suggestions to the questions above didn't help. Try moving the image horizontally. Activate AutoApply, and change HTotal, HSyncStart, and HSyncEnd on the NV Regs page, or h_blanki and hsynoffset on the BT or CX pages. First try setting hsynoffset to zero; then play with the other values to center your image. ---------------------------------------------------------------------- 4.1 The new version of nvtv doesn't work with the xine plugin. What can I do? The xine plugin is contained in the xine source tree and uses the client backend of the nvtv source, but it has to connect to the nvtv server demon (nvtvd). If the latter changes (which happens from time to time; remember that nvtv is still alpha), they won't work together. So choose one: a) Use the version of nvtv for which the xine plugin was compiled; b) Get the xine source, replace the nvtv client file in src/xine-engine/nvtv with the newer files from the nvtv source, and compile xine; c) Wait until the xine plugin updates to the new nvtv version. ---------------------------------------------------------------------- 4.2 I am using the closed source 'nvidia' driver, but the -N option doesn't work. NVidia changed and may keep chainging the internal data structures of the driver. Currently, nvtv should work with version upto 1.0-3123, but the next change by NVidia might break this again, of course. ---------------------------------------------------------------------- 4.3 How can I automatically run nvtvd after booting? Unfortunately, this varies wildy for different Linux distributions. On Debian, you should copy /etc/init.d/skeleton into /etc/init.d/nvtvd. Replace the appropiate variables in the top of the file with the path to nvtvd. Add the --make-pidfile option to the lines beginning with start-stop-daemon --start Then run "/usr/sbin/upate-rc.d nvtvd defaults 80". For other systems, look for /etc/init.d/boot.local, or S99Local in /etc/rc.d/rc.local, or something similar. Read your distribution's documentation, or ask in a newsgroup related to this distribution. (If you have any detailed information how this works in other distributions, please drop me an email.) ---------------------------------------------------------------------- 5.1 Can I use two X servers, one for the TV, and one for the monitor, and switch between them by switching between the virtual terminals? Not really. The open source 'nv' X driver doesn't know that the card is in TV mode, and therefore does not save all the state that is necessary. With the closed source 'nvidia' driver, you can do this, but the driver will reprogram the encoder chip every time, so you'll have to run nvtv again after each switch. The only way to get this to work properly is to integrate nvtv in the XFree server (which is a long term goal). ---------------------------------------------------------------------- 5.2 It's tiring to always have to start nvtv, pick a mode, and switch on the tv, and then to start an application. Can I automatize that? You can use the command line options. For example, nvtv -r 800,600 -s Normal -t switches to 800x600 tv mode with 'Normal' overscan size. Type 'nvtv -?' to see all the command line options. Write a simple shell script that swicthes to tv mode, runs your application, and switches back to monitor mode. There are some examples in doc/scripts.txt. ---------------------------------------------------------------------- 5.3 Can I have true dualhead view with one image on the monitor and a different image on the TV? Yes, if you have a GeForce2 MX/Quadro2 MX/GeForce2 GO card (NV11 architecture). These cards have two heads, and you can choose which one to use on the 'Head' GUI page, or with the command line switches. However, the video overlay will only work on one of those heads, and there are some other restrictions on the usage. It is also possible on a TNT2 to display the video overlay on the TV, while keeping the normal framebuffer display on the monitor, but this has not been implemented yet. ---------------------------------------------------------------------- 5.4 My TV can show images in true 16:9 widescreen format. How can I use this feature, for example to view DVDs in this format? You should be able to switch your TV manually in the 16:9 mode. It will then take the normal TV signal and display it in widescreen. To make this work with DVD player programs, you have to prevent the program from scaling the anamorphic DVD, or for true widescreen formats, you have to horizontally scale down the image, in both cases by a factor of 1.3333. The xine subdirectory contains a patch to xine which allows you to do this with the --display-ratio command line switch. ---------------------------------------------------------------------- 5.5 I am using a second graphics card, and nvtv is not able to detect it. The problem might be that the I/O memory of the card is not enabled. You can try enabling it with setpci. However, this won't initialize the card, so it might not work. First, use lspci to find out what PCI bus address your card is on, for this example 0:0a.0. Then do something like $ setpci -s 0:0a.0 command $ setpci -s 0:0a.0 command=1237 where the last digit should be replaced by 7 if it was 0-7, and by f if it was 8,9, or a-f. (In other words, logically or 0x7 to it). ---------------------------------------------------------------------- 5.6 I have trouble getting a stable TV image while trying my own settings, and I do not want to reboot all the time. The keyboard accelerators are really helpful in this case. Pressing F2 should restore the normal settings. If this doesn't help, and you are using the closed source NVidia driver, you can also try to switch X modes (Ctrl-Alt and + and - on the keypad) or virtual consoles. ---------------------------------------------------------------------- 5.7 I need to adjust the position, the color carrier frequency or something else that is not covered by the command line switches. How can I automate thus? You need to create a new mode (or modify an existing one) and include it in the database. See question 6.2. ---------------------------------------------------------------------- 5.8 When I try to watch videos on the TV, the aspect ration is distorted. There is a number of possible reasons. All of them are not related to nvtv. 1) You don't use the video overlay, but (for example) shared memory access. Run xvinfo to find out if your X server supports a video overlay at all; if it doesn't, setup the X server properly. Read the docs to find out how to force the program to use the video overlay (e.g. -vo xv for mplayer, -V xv for xine). 2) The playback program chooses the wrong aspect, for example because your X mode or virtual desktop is not 4:3. Read to docs to find out how to force the correct aspect (e.g. -monitoraspect 4:3 for mplayer) ---------------------------------------------------------------------- 6.1 I have one of the cards that are not fully supported by nvtv. How can I help? The easiest way to support new card types for me is to have the card in front of me, so I can test everything myself. This has worked in most cases so far. So consider making the card available to me in some way or other. (I also thought about organizing some way of collecting money so I can *buy* the card. If everybody who wants nvtv to support a GeForce4 donates about 5 EUR, say, I'd have enough money to do this. But I haven't tried that seriously yet.) I have found it very difficult to do 'remote debugging', so I am reluctant to try it again (it's just too slow). Besides the problem with NV17 encoder chip, what's wrong most often are just some uninitialized registers. So if you can get it to work with the closed source nvidia driver, or otherwise, try to compare the register dumps (you can get those with 'nvtv -P'). Then try changing the existing writeCrtNv calls in tv_nv.c (or insert new ones). This file also contains most of the information about what is known about the registers (as C code, of course). Additionally, you can compile the program 'nvdump' from the source release, which can dump all the NVidia registers (besides the CRTC). You can use it if you suspect there might be register changes that are to output with 'nvtv -P'. If you succeed in any way, please tell me about your results. ---------------------------------------------------------------------- 6.2 How can I include a new mode or a modefied mode into the database? See 'Inserting a new mode in the database' in doc/USAGE. ---------------------------------------------------------------------- 7.1 Are any other web ressources available? I recommend the TVTool web-site, which hosts the corresponding tool for Windows. The archive can be found here: http://tvtool.info/english/archive_e.htm ---------------------------------------------------------------------- 7.2 Is there a list of cards together with the encoder type they use, so I can make a choice before I buy a new card? Yes, there's a card database at the website of TVTool: http://tvtool.info/cardbase.htm ---------------------------------------------------------------------- nvtv-0.4.7/doc/0000755000175000001440000000000010024303550007011 5nvtv-0.4.7/doc/chips.txt0000644000175000001440000000555410006447464010626 TV Encoder chips currently supported ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Chrontel 7003-7008 supported. 7009 not supported, not detected, but documentation available. Brooktree Bt868/Bt869 supported. Brooktree Bt870/Bt871 supported. Conexant CX25870/871 same as above. Philips SAA7102/03 supported. SAA7108/09 same as above. SAA7104/05 support code is written, but not tested. SAA7108A/09A same as above. If your TV chip is not detected by this program and you want to know its type, start the NVidia XFree driver with TV enabled (see NVidia docs) and have a look at the log file. Common I2C Addresses ~~~~~~~~~~~~~~~~~~~~ A0 - AE: Monitor (or flatpanel) EDID EA,EC: TV out encoder chips (Chrontel) 88,8A TV out encoder chips (Brooktree/Conexant/Philips) 88,8A TV in decoder chips (TW98) 86 TV in decoder chips (VPX32xx) 40,42: TV in decoder chips (Philips: SAA7108E, SAA7114H) 48,4A: TV in decoder chips (Philips: SAA7111A, SAA7113H) Documention for TV chips ~~~~~~~~~~~~~~~~~~~~~~~~ The documentation for the TV chips has several megabytes, and is for this reason not included here. However, using Google (http://www.google.com), up-to-date documentation is easy to find. The following URLs might be interesting: Chrontel: http://www.chrontel.com/products/7003.htm http://www.chrontel.com/products/7007.htm http://www.chrontel.com/products/7008.htm http://www.chrontel.com/products/7009.htm http://www.chrontel.com/pdf/7007.pdf http://www.chrontel.com/pdf/ch7007_an47.pdf http://www.chrontel.com/pdf/ch7007_tb29.pdf.gz Conexant (Brooktree): http://www.conexant.com bt869-datasheet.pdf.gz bt869_appnote.pdf.gz bt869_dvd.pdf.gz bt869_other_res.pdf.gz Philips: http://www.semiconductors.philips.com/pip/SAA7102H/V4 http://www.semiconductors.philips.com/pip/SAA7111AH/03 Intel I810/I830: http://www.intel.com/design/chipsets/manuals/index.htm http://www.intel.com/design/chipsets/810/ (I810) http://www.intel.com/design/chipsets/datashts/298338.htm (I830 general info) Programmer's Reference Manual I810 http://www.intel.com/design/chipsets/manuals/298026.htm Programmer's Reference Manual I815 http://www.intel.com/design/chipsets/manuals/298237.htm Programmer's Reference Manual I810/I815 overview http://www.intel.com/design/chipsets/manuals/index.htm?iid=ipp_810chpst+info_ref& Datasheet: Graphics and Memory Controller Hub (82830 GMCH-M) http://developer.intel.com/design/chipsets/datashts/298338.htm Datasheet: Graphics and Memory Controller Hub (82845G/GL/GV GMCH) http://www.intel.com/design/chipsets/datashts/29074602.pdf Datasheet: Graphics and Memory Controller Hub (82865G/GV GMCH) http://www.intel.com/design/chipsets/datashts/25251404.pdf DVI interface: Digital Visual Interface (DVI) Specification, Revision 1.0 http://www.ddwg.org/register/download.htm nvtv-0.4.7/doc/USAGE0000644000175000001440000006265410005304370007535 USING NVTV ========== There are three ways to run nvtv: * Run nvtv as root. If you want, you can use sudo, or change the owner of the binary to root and set the set UID bit with chmod. * If there is a running closed source "nvidia" X driver present, you may start as non-root with option -N or --nvdev, and use the /dev/nv* devices for accessing the card. This seems only to work upto version 1.0-2840. WARNING! If there is no running closed source "nvidia" X driver, for example if you have switched to the open source "nv" driver, this will cause a SYSTEM CRASH due to a bug in the NVidia kernel driver! Don't blame me if that happens. * Run the server nvtvd as root, for example on startup by including it in rc.S, and run nvtv as normal user. After starting nvtv, you will see a notebook with a number of different pages, which you can select on the left hand side. The Mode page ------------- The "Mode" page allows you to select one of the predefined modes. You should choose your TV system (it defaults to PAL), the resolution and the size. As a general rule, "Small" and "Tiny" are underscan modes, and "Large" and "Huge" are overscan modes. "Normal" just fits the visible surface of my TV, though this will probably be different for your TV. If you are not satisfied with the predefined modes and have the Brooktree or Conexant encoder chip (look at the Config page to find out if you do), then you can make your own modes, as many as you like. The buttons on the bottom are available on every page. "TV on" will switch the tv-out mode on, "TV off" will switch it off again. If you want to change anything while in tv-on mode, the changes will only take effect after pressing "Apply", or by enabling "AutoApply". Finally, there is some additional functionality on the "Mode" page: "X Mode" switches to an X mode that is equal or somehwat larger than the resolution you have chosen. "X Select" selects an X window. If there is an selected window, its name is displayed. "X Center" centers a window on the X virtual viewport (of course only if the maximal X resolution is bigger than your current X video mode resolution). "X Resize" resizes the selected window to the resolution. Pressing both "center" and "resize" will therefore give you a "fullscreen" effect for that window. Note on the overscan compensation values (often just labeled overscan): These values give the percentage of the full image that remains unused. The larger the overscan compensation value, the smaller the image. Usually, TV sets have an overscan compensation value of about 10%, which means that 10% of the image of every normal TV source is not visible on the TV set by design. That means a mode with overscan compensation of 10% will be fully visible on the TV screen. Note on the Chrontel PAL-60 modes: These modes do not comply fully to the standard (the color burst start is different), because the Chrontel encoder chip was never designed to support PAL-60. Therefore, they may not work satisfactory. Special DVD modes ----------------- For the Chrontel chip, there are special convenience modes for DVD. All of them require the NVidia video scaler, which is available with the NVidia X driver, and is used by most DVD playing programs. A DVD (with 720x576 data) scales to 768x576 in 4:3 mode and to 800x405 in anamorphic 16:9 mode, so you should use these sizes for your video window and as a mode. For a PAL TV, both "Large" and "Small" are available, since the "Large" mode has color flickers on my system, though it would be the better choice. For an NTSC TV, there is only the "Large" mode. All these modes are based on the 800x600 modes, and just cut off the extra pixels. For a NTSC DVD (with 720x480 data), scale it to 640x480 in 4:3 mode and again to 800x480 in anamorphic 16:9 mode. If your TV supports widescreen, you can also use an anamorphic 16:9 DVD as if it was in 4:3, and than switch your TV manually to widescreen. This will give better results than the 800x405 mode, but it is only possible if your DVD playing program gives you full control about the window size. Some programs like Xine without patches restrict the aspect to the aspect of the DVD. The rationale behind using this modes is that on the one hand, the number of lines will not be changed in the scaling process, and if you use the "Large" modes it won't be changed when displaying it on the TV, either. So no vertical distortion that is introduced by the scaler can occur. Since the Chrontel chip cannot be programmed to scale in horizontal direction, the horizontal scaling cannot be avoided. On the other hand, the lower number lines compared to the 800x600 modes will enlarge the vertical blanking interval, and will give the driver more time to complete the things it has to do in this interval. Similarly, there are special DVD modes for the Brooktree chip. Both the 720x576 Pal DVD mode and the 720x480 NTSC DVD mode have very little overscan an no vertical scaling, but a different aspect than the usual 4:3. So to use it, you should be able to control the window size without aspect restrictions. More special modes ------------------ For the Chrontel encoder chip, modes ending with '#' are 'no-dot-crawl' modes. They will attempt to reduce the 'dot-crawl'-effect seen in NTSC. Otherwise, they are the same as the correspending mode without '#'. Another suffix used is '+' for the 3:2 modes that are available with the Conexant encoder. For example, there are two 800x600 Small PAL modes with different overscan compensation. The Position page ----------------- With this page, you can adjust the position of the image on the TV and the monitor. These changes are not visible in the register pages, and will only take effect when "applied" or "auto applied". Adjusting these positions only works to some extent, and large values will probably give strange results. You can also move and resize the X window you have selected on the mode page, in case your window manager doesn't allow precise numbers for these changes. The Settings page ----------------- The "Settings" page allows you to modify some register settings in an intuitive way. Like above, these changes are not visible in the register pages, and will only take effect when "applied" or "auto applied". Settings include: * Contrast and saturation of the TV image, from -100% to 100%. 0% is the default value. These settings may not be always available, depending on the encoder chip used, but if available, they should be preferred, because they don't distort the TV signal. * Brightness#, contrast# and saturation#, from -50% to 50%. This directly influences the way the TV signal is generated, and should be used with care. Extreme values might give strange results and should be avoided. * Phase. The phase of the color carrier in degrees. If the color in the image "jumps" or is otherwise distorted, you can try to compensate it with this setting. * Hue. Only available for Conexant encoder chips. This settings adjusts the hue, that is, the way different colors are encoded. Settings is in degrees, large values give a false-colors effect. * Flicker filter. Will control the anti-flicker filter feature of the encoder chip, that compensates for the flicker caused by small horizontal lines in the interlaced image. Filtering trades off vertical resolution against flicker. You should use small values for movies etc, and medium to high values for text output (together with a high sharpness setting). The left slider is for the main anti-flicker filter, the right slider is for the adaptive anti-flicker filter available with Conexant encoders. * Bandwidth. It controls the horizontal bandwidth of the luminance (left) and chromance (right) signal by selecting the appropriate low pass filters of the TV chip. The default value is 100%. Changes are usually not visible. * Sharpness. The left slider controls the text enhancement filter (which makes text sharper and easier to read), the right slider controls cross color reduction. Both settings again may not always be available, depending on the encoder chip. * Dualview. This option will show the image on both the TV and the monitor. There are modes where it seems to be impossible to get a monitor image, or at least I could not find proper CRTC values; for these modes (esp. the "Huge" ones) Dualview will be off by default. Don't confuse "dual view" with "dual head": The first outputs the same image on both the monitor and the TV, driving the monitor at a low frequency. The second outputs two different images (usually different in size, but not necessarily different in content), one on the monitor with a higher frequency, and one the TV. So they have similar effects, but are quite different. Dualhead mode is described below. * Macrovision. By default, nvtv will turn macrovision off, if it can. If you want it for some reason, set this option. For Chrontel chips, it is not possible to enable Macrovision in all modes. * Free carrier. Allows a free running color subcarrier generator, which is not reset every frame or every few frames (not implemented yet). * Non-interlace. Only generate the first half-frame. Looses vertical resolution, but increases sharpness a lot. Only available for Brooktree and Conexant encoder chips. * Colorfix. If the colors on the TV are very strange (Philips) or flickering (Chrontel), try this button. The Config page --------------- The "Config" page shows in the "Hardware" frame your PCI card and type. Here you can also select one card if you have more than one NVidia card installed. It also shows all TV encoder chips found on all I2C busses of the current card. If it cannot find a known TV encoder chip, it will list all devices found by bus address, so you can try to identify your chip, find a datasheet somewhere and write some support routines for new chips (if you want to). In the "Connector" frame, you can probe if your TV is connected to the card by the Composite (also called "FBAS" or "CVBS") line or by the SVideo (Super VHS, S-VHS) line, and you may change the output format if the autodetction values are wrong. On this page there is also a list of all keyboard acceleraters (hotkeys). The "Color bars" button in the "Test Image" frame will show the same test image you get when starting up the program, if the encoder chip supports it. The Heads page -------------- This page will only be available if you have a card with NV11 architecture that has two heads, e.g. GeForce2 MX/Quadro2 MX/GeForce2 GO and similar cards. If your card has two heads, but you don't see this page, send me an email. To enable the second head, the TV head number (usually 2) should be different from the Monitor head number (usually 1). On the GeForce2 GO, this might be different, but has not been tested yet. You can select the TV head either on this page or with the command line options -1 and -2. There are two basic ways to use the second head: * Without Twinview. You have to enable "Shared view" to use the second head. In this case, the image on the monitor will be a copy of some part of the image of the screen. The "Viewport position" lets you choose which part to use. You can automatically adjust the viewport, either "by Cursor", which will move the viewport whenever the cursor leaves the visible part, and/or "by Monitor", which will move the viewport whenever the X viewport on the Monitor is moved. * With Twinview. In this case, nvtv will automatically use the second head for any mode changes, so selecting a mode and pressing "TV on" can be used to get rid of the black borders and make the image larger. Additionally, you can enable "Shared view" like above, and choose freely the part of the virtual screen you'd like to see on the TV. To handle the cursor correctly, there are again two cases, depending on your preferences in your XF86Config file: * Software cursor. This cursor will always be correcly displayed. * Hardware cursor. If you are using Twinview (and did not enable Shared view), the cursor will behave properly. Otherwise, to be able to see and move the cursor, you have to select "Adjust cursor". If Twinview was active, both the nvidia driver and nvtv will try to move the cursor, so sometimes the cursor might jump for a quick time to the wrong place. Finally, the most important thing: The video overlay. If Twinview is enabled, the nvidia driver uses the NV05 Video Blitter, which will always display the video correctly (though not as efficiently as it could). Otherwise, both the closed source and the open source driver use the NV10 Hardware Overlay. This will only work on one head, which you can choose by setting the "video head" field. Moreover, the position of the overlay is determined by the driver and cannot be controlled by nvtv. That means that the video window on the TV should have the same relative position as on the monitor, otherwise only part of it will be visible. To enforce this behavior, you should select "Adjust viewport by Monitor", and also switch to an X mode that has the same or a similar resolution as the TV mode. Encoder chip dependent pages ============================ The next few pages depend on your TV chip. You will normally use them only if you have at least read the datasheet of the chip and know what you are doing. The BT (and CX) Calc page ------------------------- On the "BT Calc" page, you can calculate your own modes for the Brooktree and the Conexant chip. Enter the desired horizontal and vertical resolution, together with a range for possible overscan percentage. The overscan percentage determines the fraction of the image that is blank. As on every TV some amount of the full image is "outside" the visible screen, and not shown, for a "desktop" display the overscan values should be large enough to avoid cutting off the edges of the image. For movies, you want the picture as big as possible, and it does not matter if the edge is missing, so you can use larger values. Not all overscan percentages are possible, so press "List" to see a list of valid ones. Badness shows how far they are away from the desired overscan value (the center of the range), and Aspect is the relative aspect of the image, that is, the ratio of the actual horizontal size divided by the vertical size of the resulting image with respect to the full screen (which itself has an absolute aspect ratio of 4:3). If this is too difficult to understand, just remember that the (relative) aspect ratio should be close to 1; the closer, the better. The note field has in "8" if this is a character clock mode (preferred), otherwise an "1" for a pixel clock mode, and an additional "+" if it is an 3:2 clock mode. You can sort any of the columns by clicking on the table heading. Now choose a possible overscan value line, and then press "Calc" to calculate the corresponding register settings. All modes calculated in that way need some finishing: The image is very probably not correcetly centered, because the HSync and VSync values are just estimates. Go to the CRT and modify those values until the results look allright. You can use the test image in tclkt/cross.tk to help you with the centering. The PH Calc page ---------------- Not documented yet. FIXME. Register pages -------------- The "CH Regs", "BT Regs", "CX Regs", "PH Regs" and "CRTC Regs" pages give you direct access to the registers of the Chrontel chip, the Brooktree chip, the Conexant chip, the Philips chip and the CRT-Controller chip, respectively. You should read the documentation of the tv encoder chip before touching anything on these pages. Some of the values are overriden by the "Settings" page values. However, the CRTC register might need some adjustment to center the image on your TV and your monitor. See timing.txt for the effects of changing some of those values. The Status page --------------- Finally, the "Status" page shows some frequencies for the monitor (be sure your monitor can handle those, otherwise unselect the "Dualview" option), and the status of the TV chip. For the Brooktree chip, if a FIFO overrun/underun is indicated, chances are good that your tv image is not very nice and you need to change the register values. For the Chrontel chip, you may use the CIV value as the color frequency value (FSCI). Command line options ~~~~~~~~~~~~~~~~~~~~ You can get a list of all options with the option -?, -h or --help. Here are some examples how to use them. Specify a TV mode by size, and switch the TV on: nvtv -t -r 800,600 -s Large Specify a TV mode by overscan (not implemented yet), and switch TV on: nvtv -t -r 720,576 -o 11.3,5.4 As a normal non-root user, specify a TV mode by size and chip, and print the mode (as root, you can drop the -n, and the chip will be detected): nvtv -n -p -r 640,480 -s Small --chip Brooktree If for some reason the TV is already active, you can use -F in conjunction with -p to print the current mode: nvtv -F -p Switch TV off, using last X mode if available. nvtv -m Switch TV off, using the first available 800x600 modeline, and do an X mode switch to the same modeline afterwards (just in case). nvtv -m -X -r 800,600 Switch TV off, and use the specifed VESA mode as monitor mode. nvtv -m -s '800x600@75' Note: Switching the TV off by commandline will always fail without the XVidMode extension present, unless you give a VESA mode as above. But this should only be used as a last resort, or under Windows, because the video driver will not be properly initialized. Switch to the first available 1024x768 modeline (and fail otherwise), as normal non-root user: nvtv -X -r 1024,768 Center window, also as non-root user: nvtv -n -w "xine video output" -c Switch X mode, then switch TV on with the specified mode, and center the window: nvtv -t -X -r 800,600 -s Large -w "xine video output" -c If the TV is off, display color bars and the tv, and keep the monitor as it is. If the TV is on, do nothing. nvtv -b Switch the TV on, use the default 800x600 resolution in "Large" size, and set the connector to "convert" to use a luminance-only SVideo to Composite converter cable (see FAQ): nvtv -t -s Large -C convert Moreover, there are some options that take only effect when switching the TV on. The first ones are the settings, that have the general form nvtv -t --set : where is the same name as given on the settings page, and must be inside the valid range. For example, to switch the TV on, with same mode as above, and set flicker filter to 25 percent (for example for watching DVDs): nvtv -s Large --set flicker:25 This also works when the TV is already on if you want to change the flicker filter setting, but it will change the resolution and size if you specifiy a mode different than the current one. It is not possible to omit resolution (it will default to 800x600) or size. In the same way, you can set the boolean options on both the settings and the head page. For example, nvtv --set dualview:off --set viewportmonitor:on starts the GUI with dualview disabled and adjusting the tv viewport by the monitor viewport enabled. For dualhead cards, there are the switches -1 and -2 to select the apropriate head. If you have multiple cards in your system, you can use the -A or --card-addr option to select the card you want to the command line. Give the address in the format :., for example nvtv -A 1:0.0 to select your AGP card. Similarly, if you have multiple encoders reachable through the I2C busses, you can select the encoder with --chip :, for example nvtv --chip 1:8a Instead of the bus address, you can also just use the encoder type (brooktree, chrontel, conexant, philips). If for some reason you cannot use the GUI, or you want to use nvtv in a script, you can also get a list of available modes with --list or -l. For example, nvtv -l -T brooktree lists all Brooktree modes, even if you cannot access the hardware. If you omit the -T or --chip option, it will list the modes for the hardware that is found. Finally, you can query the state of the specified head with the -q option. This is useful in a shell script. Nvtv both prints the result to stdout and sets the exit code. The values are 0 Display disabled (not detected properly yet) 1 Monitor only 2 TV only 3 Monitor and TV (Dualview) 4 Flatpanel only The exit code is 100 plus the above value (smaller exit codes denote errors.) Making a new mode ~~~~~~~~~~~~~~~~~ Here's a brief step by step description how to create a new mode for the Brooktree chip. Choose the "BT Calc" page, enter the resolution (say, 768x576), choose an overscan range, and press "List". Pick a line (say 10.5% horizontal and 4.2% vertical), and press "Calc". Now press "TV on" or "Apply" (unless you have AutoApply enabled). Switch to the "CRTC Regs" page, and adjust the horizontal and vertical "SyncStart" values until the image is more or less centered on the monitor. Make sure that "SyncEnd" has a reasonable value (my monitor seems to ignore the end of the sync pulse, but yours may not). Adjust the "Total" registers in a similar way to center the image on the TV. The "hoffset" register on the "BT Regs" page can also be used to move the TV image horizontally. Finally, press "Print" on the appropriate page(s) to print the register settings to stdout. You can include them in the data.c file, if you like. The initial CRT values may be way off, or may be so bad that you don't even get a picture. Switching X video modes (CTRL-ALT + and - keys on the numpad) *might* bring at least the TV image back. You're down to trial and error in this case. See timings.txt for some details. Also, especially for NTSC and PAL-60, not all the modes listed will work, because underflow or overflow cannot be avoided. Check the value of h_blanki; if it is very low or zero, you may be in trouble. Finally, I recommend to fine tune your mode by adjusting h_blanki, to make sure the complete image is displayed. You have to observe the borders of the image to do this. As they are sometimes outside the visible part of the TV, first temporarily reduce both HorizDisplay and h_active to the same number to bring the right border well within the right visible part of the TV screen. Then increase h_blanko to make the left border also visible. Now, change h_blanki and watch the image. While you decrease it, the image will move right, while on the left border new pixel appear and the right border just moves. At some point, the right border will start to disappear, while the left border will show nothing new. This value is the right value for h_blanki. A similar procedure can be used to adjust *HBlankStart for Voodoo cards. Inserting a new mode in the database ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All the modes are stored in the data*.c files. There is no per-user or per-system database in seperate files yet, if you want to contribute it, feel free to send in a patch. Let's assume you have made or modified a mode for the Brooktree chip on an NVidia card. The Brooktree encoder data is found in data_bt.c, the NVidia related in data_nv.c. In data_bt.c, you'll find lot's of TVBtRegs declarations, sorted by TV system and resolution. Pick the appropriate place and include your mode. The naming scheme is bt___, but you can of course pick your own name. You'll also have to add a corresponding 'extern' declaration in data_bt.h. In data_nv.c, first look for the part the deals with BT modes (marked by double lines == BT ==). Then, add a TvNvRegs declaration in a similar way as above. Finally, you'll have to add a template entry that contains the mode specification (system, resolution, size string, aspect string, and amount of overscan), pointers to the BT and NV data, the host and encoder port flags (normally, just use PORT_NVIDIA), description flags (use TV_DEF_BT_DUAL if it works with dualview, and TV_DEF_BT otherwise), and additional parameters (in this case, hsynoffset, see below). Remake the source, and the mode should now be available. Other encoder/graphic card combinations work in a similar way. Some special cases in this scheme: BT/NV: The hsynoffset information is in the template. This register sometimes causes trouble, though it is essential to keep both the TV and the monitor image more or less centered. Hence you can adjust this value without having to include BT or NV data. CX/NV: The BT/NV templates are also used, the CX/NV template contains just additional modes. Also, PAL modes are autoconverted to SECAM modes. CH/NV: The templates contain a pointer to multiple FSCI values. For 50Hz modes, they are for PAL, PAL-N, and PAL-X (which is a pseudo system since some TVs seem to need different values.) For 60Hz modes, they are for NTSC, NTSC with no dot crawl, PAL-M, and PAL-60. The PAL-60 modes don't work on my TV, however. If you have successfully created a new mode, and you think others would like it to use as well, please send an email to dthierbach@gmx.de, preferably in diff -uw format. In any case, include the encoder and CRTC registers, resolution, overscan, and a brief visual description (e.g., "on my Panasonic XYZ TV it touches just the edges and is perfect. On the monitor, it's just ugly.") of this mode. I probably won't be able to answer your email, but I might include this mode in a database for the next release, so other people can use it as well. Laptops with LCD Displays ~~~~~~~~~~~~~~~~~~~~~~~~~ FIXME Plugins for other programs ~~~~~~~~~~~~~~~~~~~~~~~~~~ The server makes it easy to write plugins for other programs, for example xine, that allow those program to switch to TV out without having to run them as root. However, none of the plugins have been written yet, but the possibility is there. nvtv-0.4.7/doc/man/0000755000175000001440000000000010041242514007565 5nvtv-0.4.7/doc/overview.txt0000644000175000001440000001471107533753241011365 This document wants to give a rough overview over the modules of the source, so you can get an idea where to look if you want to make changes. How to produce TV-Out ~~~~~~~~~~~~~~~~~~~~~ The NVidia-card contains access to several I2C-Busses. These are slow two-line busses used to communicate with peripherie. The TV-chip is connected to one of those busses. To access this chip, the program has to memory map the PCI-I/O-range of the card into its address space. Then it can read and write the card's registers, control the I2C-Bus and setup the registers of the TV-chip. Finally, it has to change a few registers of the card to enable or disable tv-out. That's all there is to it. Structure of the program ~~~~~~~~~~~~~~~~~~~~~~~~ There are three "layers" in nvtv: The "frontend" layer, where the user interacts with the system, the "backend" layer, that encapsulates different forms of access, and the "hardware" layer, where the video hardware is accessed. The backend layer itself is split into to parts, a card independent access part, and a card dependent part. Frontend Backend (Access) Backend (Card) Hardware ............+-------------+ +-------------+ . | NVidia |....| NVidia | +---------------+ ..+-------------+ +-------------+ | Direct/nvdev | . ...| (/dev/nv*) | . +-------------+ +-------------+ +---------------+ . +---------------+ ..| Intel I810 |....| Intel I810 | | Main |... | Direct/root | . +-------------+ +-------------+ | (Commandline) | ...| (/dev/mem) |.. +---------------+ . +---------------+ . +-------------+ +-------------+ | . ..| 3DFX Voodoo |....| 3DFX Voodoo | V . +-------------+ +-------------+ +---------------- . | GUI | . +-----------------+---------------+ | (GTK) |.....| Null | | +---------------+ . | (for testing) | | | . +-----------------+---------------+ V . +---------------+ . +-----------------+---------------+ | 4 GUI parts | ...| Client | | | (bt,cx,ch,ph) | . | (named pipe) | | +---------------+ . +-----------------+---------------+ . +---------------- . +-----------------+---------------+ +-----------+ | Server |.....| XVidMode | |....| X Server | | (named pipe) | | (planned) | | | | +---------------+ +-----------------+---------------+ +-----------+ There are four different backends at the moment. If the program is run with root permissions, it can use /dev/mem to access the card. Alternatively, even without root permissions, it can use the /dev/nv* devices of the closed source NVidia kernel module for the access. However, this only works when the NVidia X driver is using the kernel module, due to a bug in the kernel module. Both these backends are in 'back_direct.c' The third backend in 'back_none.c' is an empty 'stub' backend, that however contains all four possible tv chips, used for testing or calculating. The fourth backend in 'back_client.c' uses the server, if it is available. For communication with each other, both server and client use 'pipe.c'. One of the front end is the server 'server.c', which is a standalone program that just communicates with clients and passes the commands on to one of the direct backends or the null backend. This frontend makes up 'nvtvd'. The other two frontends are combined in 'nvtv'. The commandline interface is completely in 'main.c'. If nvtv is built with GTK, the gui part is also available. The main gui routines are in 'gui.c' together with common subroutines. The encoder specific GUI for the Brooktree, the Conexant, the Chrontel and the Philips encoder are in 'gui_bt.c', 'gui_cx.c', 'gui_ch.c' and 'gui_ph.c', respectively. These are used depending on the tv chip detected/selected. The last two backends use 'actions.c', which contains some X related actions (changing the video mode, centering, selecting a window). Besides these three layers, there is the data for the TV modes of all four encoder types in 'data_bt.c', 'data_cx.c', 'data_ph.c' and 'data_ch.c'. This is where you can include your own modes, if you want. For the Brooktree chip, the mode calculation for arbitrary overscan compensation values takes place in 'calc_bt.c'. The hardware layer is seperated because it is eventually meant to become a part of the XFree server. All the files belonging to it start with 'tv_', except the X I2C Bus routines in 'xf86i2c.c', which are copied verbatim from the X server source. It has the following structure: Hardware TV Encoder I2C Bus +---------------+ ...| Brooktree |... . +---------------+ . . . +-------------+ . +---------------+ . +------------+ | NVidia |.....| Conexant |... | X I2C Bus | +-------------+ . +---------------+ . | routines | . . +------------+ +-------------+ . +---------------+ . ^ | Intel I810 |.....| Chrontel |... | +-------------+ . +---------------+ . +------------+ . .....| I2C Bus | +-------------+ . +---------------+ . | access | | 3DFX Voodoo |.....| Philips |... +------------+ +-------------+ . +---------------+ ^ . | . +---------------+ +-------------------+ ...| Null | | Common | . | (for testing) | | (Detection, etc.) | . +---------------+ +-------------------+ . . .................................. Finally, there is 'libc_wrapper.c', which contains a few wrapper routines from the XFree server, and 'xf86PciInfo.h', which is a slightly extended copy of the XFree server PCI id information. nvtv-0.4.7/doc/timing.txt0000644000175000001440000002213307624405103010773 Here are some details about the host interface of the encoder chips and their timings. There are several ways the encoder chip and the host CRTC can interact. * In clock master mode, the encoder synthesizes the pixel clock, which is fed into the host. The host then returns this clock together with the pixel data to the encoder, possibly after some internal delay. * In clock slave mode, the host synthesizes the pixel clock. Unless this clock is very accurate, this may cause worse color quality, because the encoder has to adapt its color subcarrier frequency to the external clock. * In sync master mode, the encoder chip produces HSYNC* and VSYNC* signals, which force these syncs upon the host. * In sync slave mode, the host chip is responsible for these signals. Here is an illustration of the resulting three interface modes (clock slave/sync master is usually not used). The encoder chip is on the left, the host on the right: clock master/ clock master/ clock slave/ sync master sync slave sync slave CLKO E ] -->-- [.. E ] -->-- [ .. E ] -* [ N ] [ V N ] [ V N ] [ CLKI C ] --<-- [.. H C ] --<-- [ .. H C ] --<-- [ H O ] [ O O ] [ O O ] [ O HSYNC* D ] -->-- [ S D ] --<-- [ S D ] --<-- [ S E ] [ T E ] [ T E ] [ T VSYNC* R ] -->-- [ R ] --<-- [ R ] --<-- [ Often the encoder chips have extra blank, frame, or data request signals. These seem to be unused. In the clock master modes, the host CRTC has to genlock onto the pixel clock. This is controlled by bit 7 of CRTC Register 0x28. The HSYNC* and VSYNC* signals are active high for the NV host, but it might be possible to change this in register 680700 (TV_SETUP). In sync master mode, the relationship between the CRTC sync signals and the interface sync signals is a bit tricky. It is explained below for the Brooktree encoder. For the sync slave mode on card with two heads it looks like both heads must be in sync slave mode; otherwise the image is not stable. BROOKTREE ========= HORIZONTAL TIMING ~~~~~~~~~~~~~~~~~ Analog Signal (tv chip out) DDDDDDDDDDDD ___ ____BBBB____| |_____ __ |____| |____| a b c d e f g (Example Timings for PAL 800x600) a) 0 us Start of hsync pulse (always at 0 clocks) b) 4.70 us End of hsync pulse (at HSYNC_WIDTH clocks) c) 5.60 us Start of burst (at HBURST_BEGIN clocks) d) 7.58 us End of burst (at HBURST_END + 128 clocks) e) 10.5 us Start of analog data (at HBLANK_O clocks) f) ?? us End of analog data (at HBLANK_O + 2 * HACTIVE clocks) g) 64 us End of line (at H_CLKO clocks) Digital Signal (tv chip in) _ _ HSYNC* ____| |___________________________| |______ ______________ _______________ BLANK* |____________| DATA ______________XXXXXXXXXXXXXX_______________ HSYNC ____ __________________________ _____ |__| |__| _ _______________________ _____ HSYNC' |__X__| |__X__| BT a b c d e CRTC r' r s t u r' r (Example timings for 800x600 PAL "Normal") a) 0 clocks b) 2 clocks (at HSYNWIDTH) c) 140 clocks (at H_BLANKI) d) 940 clocks (at H_BLANKI + H_ACTIVE) e) 960 clocks (at H_CLKI) Note that HSYNC stands for the monitor horizontal sync signal. The CRTC seems to set its internal counters at the HSYNC* signal to the HSyncStart value. This is necessary because unlike the BT chip, the CRTC normally starts at 0 when the digital data is output. r) 824 clocks (at HSyncStart) s) 880 clocks (at HSyncEnd) t) 960 clocks (at HTotal = HCLK_I) t) 0 clocks (counter reset) u) 800 clocks (at HDisplay = H_ACTIVE) That means that increasing HTotal will move the image to the right (both in the monitor and the TV), while increasing HSyncStart will move it to the left. However, if HTotal is less then HCLK_I, the monitor sync signal will be generated before the HSYNC* signal (r' in HSYNC' in the diagram above). When the HSYNC* signal arrives, the internal counter is set to HSyncStart again, effectively lengthening the monitor sync pulse. But the distance between r and s remains the same. That means the image on the monitor will not move, while the image on the TV may be adjusted, because s occurs now earlier relative to the HSYNC* signal. But if the width of the monitor sync pulse is too small, two sync pulses may be generated (as shown by the X in the HSYNC' diagram above). This should be avoided. As the TV image can be adjusted with HSYNOFFSET, it is not necessary to have HTotal < HCLK_I. Note that the lowest bit of HSYNOFFSET has strange effects (see below). BLANK INPUT ~~~~~~~~~~~ If BLANK* is enabled as input (EN_BLANKO=0, EN_DOT=0), then H_BLANKI seems to denote extra blank cycles after the falling flank before the data is accepted. (Increasing H_BLANKI moves the image to the left, decreasing moves it to the right). VERTICAL SCALING ~~~~~~~~~~~~~~~~ The BT chip is able to subsample 1 to 3 input lines into one (interlaced) output line. Therefore the input lines can arrive faster than than output lines are produced, and horizontal timing for TV and monitor are (nearly) independent of each other. There is a FIFO between the vertical scaling engine of the chip and the digital/analog converter to decouple these parts. If, however, the horizontal timings are too different, this FIFO may overrun or underrun. To be precise, one output line corresponds to 1 + (V_SCALE / 4096) input lines. The first and last line are always output, so roughly V_ACTIVEO = VACTIVE_I / (1 + V_SCALE / 4096) + 2. VERTICAL TIMING ~~~~~~~~~~~~~~~ Digital Signal (in) HSYNC* ___|__|__|__|__|__|__ ... __|__|__|__|__|__|__ _ _ VSYNC* ___| |_______________________________| |______ LINES _____________XX_XX_XX ... XX_XX_XX____________ _____ ______________________________ __ VSYNC |__| |__| BT a b c d (Example timings for 800x600 PAL) a) 0 lines b) 95 lines (at V_BLANKI) c) 695 lines (at V_BLANKI + V_ACTIVEI) d) 750 lines (at V_LINESI) The vertical timing for the CRTC seems to be similar to the horizontal timing (same effects if VTotal < V_LINESI). However, as vertical sync pulses are short (a few lines), and VTotal < V_LINESI is true in nearly all modes in data_bt, one would expect a "double sync pulse" effect. But I have not seen this with my Multisync monitor. Effects of changing CRTC/BT Registers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Register Increase Decrease VSync mon/tv up mon/tv down VTotal tv down tv up HSync mon/tv left mon/tv right HTotal tv right tv left hblanki tv left tv right hblanko tv right tv left vblanki tv cut top vblanko tv cut top hsynoffset tv right tv left vactivei tv cut bottom If HTotal > h_clki, then the monitor image also moves right when changing HTotal. Similar for VTotal and v_linesi. Sometimes hoffset has different effects if it is even/odd, so the image seems to jump. CHRONTEL ======== Timing is much less flexible with the Chrontel encoder chip. The M and N values modify the phased locked loop (PLL) to produce the pixel clock. Each data pixel requires two clocks. The lower bit of the VOS register switches between NTSC and PAL. For each of those, the value of the SR registers determines the number of total lines (which roughly correspond to the scale factor). The scale factor also stretches the pixels horizontally. In this way, the number of total pixels/line can be calculated from the fixed horizontal frequency for PAL/NTSC, the pixel clock and the scaling factor. I have seen no register to provide this number directly. This is a bit strange, since the chip must produce a hsync signal after one complete line. Maybe that frequency is just determined by VOS and otherwise fixed. Changing the dot clock frequency causes the image on the TV to become unstable outside a small range, while the image on the monitor just widens or shortens, as expected. I am not sure what conclusions to draw from this. An additional feature of the Chrontel chip is that it can calculate the color frequency value (FSCI) by itself, upto the lowest 6 bits. This value is called CIV, and may be inspected on the status page. The chip can automatically transfer this value to the FSCI register if ACIV is enabled. On some systems, this seens ti produce bad values, so ACIV is disabled by default. nvtv-0.4.7/doc/scripts.txt0000644000175000001440000000504507540203550011175 From Russell Sears, sears@users.sourceforge.net: The FAQ suggests that users write a shell script to automate the TV-Out setup for video playback on their setup. This would seem to be a pretty simple task, but there are some subtleties to it, such as switching the video mode properly, and moving the mouse pointer to the upper left corner of the screen for Mplayer. Since Mplayer's -fs option causes it to read the current physical resolution from the X server when xv is the output program, all we need to do is switch to 640x480 (or 800x600), move the cursor to the upper left corner of the screen, activate tv-out, run MPlayer, turn off tv-out, and finally, switch back to the original mode. Usage: script [additional mplayer arguments] For example: script -dvd 1 or script file.avi (It will prompt you for the root password.) Installation: 1) Use the xv output (-vo xv) option for mplayer. (Other output types may work) Put a line like vo=xv in your mplayer.conf once you've tested this. 2) Make sure you have xwarppointer (see section after script) 3) Find a good mode for nvtv for your setup, and edit the script to reflect it. This script makes two assumptions about your X setup. 1) You are in the highest resolution mode when the script is run. 2) The lowest resolution mode that is setup for your X server is the mode you want to use for TV out. If these assumptions are wrong, you can either find a better program for mode switching than XVidTune, or alter the number of times it is called. Note that: 'xvidtune -prev' is equivalent to --- and 'xvidtune -next' is equivalent to --+ Here's the perl script. (You'll need to edit it if you aren't using MPlayer, or if you need to change your nvtv resolution.) --- Begin Script --- #! /usr/bin/perl -w use strict; $| = 1; my $command = "mplayer -fs " . join " ", @ARGV; system( "su -p -c \"" . "xvidtune -prev; " . "xwarppointer 0 0; " . "nvtv -r 640,480 -s Large -t -S NTSC; " . "$command; " . "nvtv -m; xvidtune -next\"" ); --- End Script --- All the helper programs are pretty standard, except for xwarppointer, which you can get here: http://razorback.yi.org/xwarppointer/ (I had to change the library path on the homepage from /usr/X11/lib to /usr/X11R6/lib on debian 3.0 to compile it) The two things this script is really missing are a setuid nvtv, and a better way to switch X modes. nvtv-0.4.7/src/0000777000175000001440000000000010041244623007043 5nvtv-0.4.7/src/Makefile.in0000644000175000001440000004453010041244622011031 # Makefile.in generated automatically by automake 1.4-p6 from Makefile.am # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : CC = @CC@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ MAKEINFO = @MAKEINFO@ OBJS_BACKEND = @OBJS_BACKEND@ OBJS_EXTRA = @OBJS_EXTRA@ OBJS_GUI = @OBJS_GUI@ PACKAGE = @PACKAGE@ PKG_CONFIG = @PKG_CONFIG@ PROGRAM = @PROGRAM@ VERSION = @VERSION@ WX_CFLAGS = @WX_CFLAGS@ WX_CFLAGS_ONLY = @WX_CFLAGS_ONLY@ WX_CONFIG_PATH = @WX_CONFIG_PATH@ WX_CPPFLAGS = @WX_CPPFLAGS@ WX_CXXFLAGS = @WX_CXXFLAGS@ WX_CXXFLAGS_ONLY = @WX_CXXFLAGS_ONLY@ WX_LIBS = @WX_LIBS@ WX_LIBS_STATIC = @WX_LIBS_STATIC@ WX_VERSION = @WX_VERSION@ EXTRA_PROGRAMS = nvdump bin_PROGRAMS = nvtv nvtvd GUI_SOURCES = gui.c gui_bt.c gui_cx.c gui_ch.c gui_ph.c gui_nx.c gui_nv.c gui_tdfx.c gui_i810.c EXTRA_SOURCES = back_unix.c back_winio.c back_mswin.c back_client.c card_direct.c actions.c xbox.c EXTRA_nvtv_SOURCES = $(EXTRA_SOURCES) $(GUI_SOURCES) EXTRA_nvtvd_SOURCES = $(EXTRA_SOURCES) SRCS_COMMON = libc_wrapper.c xf86i2c.c pipe.c mmio.c tv_common.c tv_nv.c tv_tdfx.c tv_i810.c tv_i2c.c tv_null.c tv_bt.c tv_cx.c tv_nx.c tv_ch1_7007.c tv_ch2_7009.c tv_ph1_saa7102.c tv_ph2_saa7104.c data.c data_bt.c data_cx.c data_ch.c data_ph.c data_nx.c data_nv.c data_tdfx.c data_i810.c data_xbox.c data_vesa.c calc_bt.c back_direct.c back_nvidia.c back_tdfx.c back_i810.c back_null.c noinst_HEADERS = actions.h back_client.h back_direct.h backend.h back_i810.h back_mswin.h back_null.h back_nvidia.h back_tdfx.h back_unix.h bitmask.h calc_bt.h card_direct.h data.h data_bt.h data_ch.h data_cx.h data_ph.h data_nx.h data_i810.h data_nv.h data_tdfx.h data_vesa.h data_xbox.h debug.h error.h local.h miscstruct.h mmio.h xbox.h gui.h gui_bt.h gui_cx.h gui_ch.h gui_ph.h gui_nx.h gui_i810.h gui_nv.h gui_tdfx.h nvtv.h pipe.h print.h i810_type.h nv_type.h tdfx_type.h tv_chip.h tv_common.h tv_i2c.h tv_null.h tv_nv.h tv_i810.h tv_tdfx.h tv_bt.h tv_cx.h tv_ch1_7007.h tv_ch2_7009.h tv_ph1_saa7102.h tv_ph2_saa7104.h tv_nx.h xf86_ansic.h xf86i2c.h xf86PciInfo.h xf86str.h xfree.h LDADD_COMMON = $(OBJS_BACKEND) $(OBJS_EXTRA) LDADD_GUI = $(OBJS_GUI) nvtv_SOURCES = nvtv.c print.c $(SRCS_COMMON) nvtv_DEPENDENCIES = $(LDADD_COMMON) $(LDADD_GUI) nvtv_LDADD = $(LDADD_COMMON) $(LDADD_GUI) $(X_PRE_LIBS) $(X_LIBS) $(X_EXTRA_LIBS) $(GTK_LIBS) nvtvd_SOURCES = nvtvd.c $(SRCS_COMMON) nvtvd_DEPENDENCIES = $(LDADD_COMMON) nvtvd_LDADD = $(LDADD_COMMON) nvdump_SOURCES = nvdump.c card_direct.c mmio.c mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = PROGRAMS = $(bin_PROGRAMS) DEFS = @DEFS@ -I. -I$(srcdir) -I. CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ nvdump_OBJECTS = nvdump.o card_direct.o mmio.o nvdump_LDADD = $(LDADD) nvdump_DEPENDENCIES = nvdump_LDFLAGS = nvtv_OBJECTS = nvtv.o print.o libc_wrapper.o xf86i2c.o pipe.o mmio.o \ tv_common.o tv_nv.o tv_tdfx.o tv_i810.o tv_i2c.o tv_null.o tv_bt.o \ tv_cx.o tv_nx.o tv_ch1_7007.o tv_ch2_7009.o tv_ph1_saa7102.o \ tv_ph2_saa7104.o data.o data_bt.o data_cx.o data_ch.o data_ph.o \ data_nx.o data_nv.o data_tdfx.o data_i810.o data_xbox.o data_vesa.o \ calc_bt.o back_direct.o back_nvidia.o back_tdfx.o back_i810.o \ back_null.o nvtv_LDFLAGS = nvtvd_OBJECTS = nvtvd.o libc_wrapper.o xf86i2c.o pipe.o mmio.o \ tv_common.o tv_nv.o tv_tdfx.o tv_i810.o tv_i2c.o tv_null.o tv_bt.o \ tv_cx.o tv_nx.o tv_ch1_7007.o tv_ch2_7009.o tv_ph1_saa7102.o \ tv_ph2_saa7104.o data.o data_bt.o data_cx.o data_ch.o data_ph.o \ data_nx.o data_nv.o data_tdfx.o data_i810.o data_xbox.o data_vesa.o \ calc_bt.o back_direct.o back_nvidia.o back_tdfx.o back_i810.o \ back_null.o nvtvd_LDFLAGS = CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ HEADERS = $(noinst_HEADERS) DIST_COMMON = ./stamp-h.in Makefile.am Makefile.in config.h.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best SOURCES = $(nvdump_SOURCES) $(nvtv_SOURCES) $(EXTRA_nvtv_SOURCES) $(nvtvd_SOURCES) $(EXTRA_nvtvd_SOURCES) OBJECTS = $(nvdump_OBJECTS) $(nvtv_OBJECTS) $(nvtvd_OBJECTS) all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .o .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status config.h: stamp-h @if test ! -f $@; then \ rm -f stamp-h; \ $(MAKE) stamp-h; \ else :; fi stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES= CONFIG_HEADERS=src/config.h \ $(SHELL) ./config.status @echo timestamp > stamp-h 2> /dev/null $(srcdir)/config.h.in: $(srcdir)/stamp-h.in @if test ! -f $@; then \ rm -f $(srcdir)/stamp-h.in; \ $(MAKE) $(srcdir)/stamp-h.in; \ else :; fi $(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOHEADER) @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null mostlyclean-hdr: clean-hdr: distclean-hdr: -rm -f config.h maintainer-clean-hdr: mostlyclean-binPROGRAMS: clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) distclean-binPROGRAMS: maintainer-clean-binPROGRAMS: install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) list='$(bin_PROGRAMS)'; for p in $$list; do \ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ done .c.o: $(COMPILE) -c $< .s.o: $(COMPILE) -c $< .S.o: $(COMPILE) -c $< mostlyclean-compile: -rm -f *.o core *.core clean-compile: distclean-compile: -rm -f *.tab.c maintainer-clean-compile: nvdump: $(nvdump_OBJECTS) $(nvdump_DEPENDENCIES) @rm -f nvdump $(LINK) $(nvdump_LDFLAGS) $(nvdump_OBJECTS) $(nvdump_LDADD) $(LIBS) nvtv: $(nvtv_OBJECTS) $(nvtv_DEPENDENCIES) @rm -f nvtv $(LINK) $(nvtv_LDFLAGS) $(nvtv_OBJECTS) $(nvtv_LDADD) $(LIBS) nvtvd: $(nvtvd_OBJECTS) $(nvtvd_DEPENDENCIES) @rm -f nvtvd $(LINK) $(nvtvd_LDFLAGS) $(nvtvd_OBJECTS) $(nvtvd_LDADD) $(LIBS) tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ here=`pwd` && cd $(srcdir) \ && mkid -f$$here/ID $$unique $(LISP) TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP)) mostlyclean-tags: clean-tags: distclean-tags: -rm -f TAGS ID maintainer-clean-tags: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = src distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done actions.o: actions.c local.h config.h debug.h error.h actions.h \ tv_chip.h data.h back_client.o: back_client.c local.h config.h debug.h error.h backend.h \ tv_chip.h tv_common.h xf86i2c.h miscstruct.h back_client.h \ pipe.h back_direct.o: back_direct.c local.h config.h debug.h error.h backend.h \ tv_chip.h tv_common.h xf86i2c.h miscstruct.h back_direct.h \ data.h back_nvidia.h back_tdfx.h back_i810.h tv_i2c.h back_i810.o: back_i810.c local.h config.h debug.h error.h xfree.h \ miscstruct.h mmio.h bitmask.h backend.h tv_chip.h tv_common.h \ xf86i2c.h card_direct.h back_direct.h data.h back_null.h \ back_i810.h tv_i810.h i810_type.h xf86PciInfo.h xf86str.h back_null.o: back_null.c local.h config.h debug.h error.h backend.h \ tv_chip.h tv_common.h xf86i2c.h miscstruct.h back_null.h data.h back_nvidia.o: back_nvidia.c local.h config.h debug.h error.h xfree.h \ miscstruct.h mmio.h bitmask.h backend.h tv_chip.h tv_common.h \ xf86i2c.h card_direct.h back_direct.h data.h back_nvidia.h \ nv_type.h tv_nv.h tv_i2c.h xf86PciInfo.h xf86str.h back_tdfx.o: back_tdfx.c local.h config.h debug.h error.h xfree.h \ miscstruct.h bitmask.h mmio.h backend.h tv_chip.h tv_common.h \ xf86i2c.h card_direct.h back_direct.h data.h back_null.h \ back_tdfx.h tv_tdfx.h tdfx_type.h back_unix.o: back_unix.c local.h config.h debug.h error.h backend.h \ tv_chip.h tv_common.h xf86i2c.h miscstruct.h back_direct.h \ data.h card_direct.h calc_bt.o: calc_bt.c local.h config.h debug.h error.h tv_chip.h \ calc_bt.h card_direct.o: card_direct.c local.h config.h debug.h error.h backend.h \ tv_chip.h tv_common.h xf86i2c.h miscstruct.h card_direct.h \ xfree.h xf86PciInfo.h xf86str.h data.o: data.c local.h config.h debug.h error.h data.h tv_chip.h \ data_bt.h data_cx.h data_ch.h data_ph.h data_nv.h data_tdfx.h \ data_i810.h data_xbox.h data_bt.o: data_bt.c data_bt.h tv_chip.h data.h data_nv.h data_ch.o: data_ch.c local.h config.h debug.h error.h nv_type.h xfree.h \ miscstruct.h xf86i2c.h tv_common.h tv_chip.h data_ch.h data.h data_cx.o: data_cx.c local.h config.h debug.h error.h data_bt.h \ tv_chip.h data.h data_cx.h data_nv.h data_i810.o: data_i810.c data_i810.h tv_chip.h data.h data_ch.h data_nv.o: data_nv.c local.h config.h debug.h error.h data_bt.h \ tv_chip.h data.h data_cx.h data_ch.h data_ph.h data_nx.h \ data_nv.h calc_bt.h data_nx.o: data_nx.c data_nx.h tv_chip.h data.h data_nv.h data_ph.o: data_ph.c local.h config.h debug.h error.h data_ph.h \ tv_chip.h data.h data_nv.h data_tdfx.o: data_tdfx.c data_tdfx.h tv_chip.h data.h data_bt.h \ calc_bt.h data_vesa.o: data_vesa.c local.h config.h debug.h error.h data.h \ tv_chip.h data_vesa.h data_xbox.o: data_xbox.c local.h config.h debug.h error.h data_bt.h \ tv_chip.h data.h data_cx.h data_ch.h data_ph.h data_xbox.h \ calc_bt.h gui.o: gui.c local.h config.h debug.h error.h tv_chip.h nvtv.h backend.h \ tv_common.h xf86i2c.h miscstruct.h data.h data_bt.h data_ch.h \ gui.h gui_bt.h gui_cx.h nv_type.h xfree.h gui_ch.h gui_ph.h \ gui_nx.h gui_nv.h gui_tdfx.h gui_i810.h actions.h print.h gui_bt.o: gui_bt.c local.h config.h debug.h error.h gui.h backend.h \ tv_chip.h tv_common.h xf86i2c.h miscstruct.h data.h gui_bt.h \ calc_bt.h data_bt.h gui_ch.o: gui_ch.c local.h config.h debug.h error.h gui.h backend.h \ tv_chip.h tv_common.h xf86i2c.h miscstruct.h data.h gui_ch.h \ nv_type.h xfree.h data_ch.h gui_cx.o: gui_cx.c local.h config.h debug.h error.h gui.h backend.h \ tv_chip.h tv_common.h xf86i2c.h miscstruct.h data.h gui_bt.h \ gui_cx.h nv_type.h xfree.h gui_i810.o: gui_i810.c local.h config.h debug.h error.h gui.h backend.h \ tv_chip.h tv_common.h xf86i2c.h miscstruct.h data.h gui_i810.h gui_nv.o: gui_nv.c local.h config.h debug.h error.h gui.h backend.h \ tv_chip.h tv_common.h xf86i2c.h miscstruct.h data.h gui_nv.h gui_nx.o: gui_nx.c local.h config.h debug.h error.h gui.h backend.h \ tv_chip.h tv_common.h xf86i2c.h miscstruct.h data.h gui_nx.h gui_ph.o: gui_ph.c local.h config.h debug.h error.h gui.h backend.h \ tv_chip.h tv_common.h xf86i2c.h miscstruct.h data.h gui_ph.h \ nv_type.h xfree.h data_ph.h gui_tdfx.o: gui_tdfx.c local.h config.h debug.h error.h gui.h backend.h \ tv_chip.h tv_common.h xf86i2c.h miscstruct.h data.h gui_tdfx.h libc_wrapper.o: libc_wrapper.c local.h config.h debug.h error.h mmio.o: mmio.c local.h config.h debug.h error.h nvtv.o: nvtv.c local.h config.h debug.h error.h gui.h backend.h \ tv_chip.h tv_common.h xf86i2c.h miscstruct.h data.h back_null.h \ back_unix.h back_client.h nvtv.h print.h data_vesa.h actions.h \ back_direct.h tv_nv.h nv_type.h xfree.h nvtvd.o: nvtvd.c local.h config.h debug.h error.h pipe.h backend.h \ tv_chip.h tv_common.h xf86i2c.h miscstruct.h back_unix.h \ back_null.h pipe.o: pipe.c local.h config.h debug.h error.h pipe.h print.o: print.c local.h config.h debug.h error.h print.h tv_chip.h tv_bt.o: tv_bt.c local.h config.h debug.h error.h xf86_ansic.h bitmask.h \ xf86i2c.h miscstruct.h tv_i2c.h tv_bt.h tv_chip.h tv_common.h tv_ch1_7007.o: tv_ch1_7007.c local.h config.h debug.h error.h \ xf86_ansic.h xf86i2c.h miscstruct.h bitmask.h tv_i2c.h \ tv_ch1_7007.h tv_chip.h tv_common.h tv_ch2_7009.o: tv_ch2_7009.c local.h config.h debug.h error.h \ xf86_ansic.h xf86i2c.h miscstruct.h bitmask.h tv_i2c.h \ tv_ch2_7009.h tv_chip.h tv_common.h tv_common.o: tv_common.c local.h config.h debug.h error.h tv_i2c.h \ xf86i2c.h miscstruct.h tv_common.h tv_chip.h tv_bt.h tv_cx.h \ tv_ch1_7007.h tv_ch2_7009.h tv_ph1_saa7102.h tv_ph2_saa7104.h \ tv_nx.h tv_null.h tv_cx.o: tv_cx.c local.h config.h debug.h error.h xf86_ansic.h bitmask.h \ xf86i2c.h miscstruct.h tv_i2c.h tv_cx.h tv_chip.h tv_common.h \ tv_bt.h tv_i2c.o: tv_i2c.c local.h config.h debug.h error.h xf86i2c.h \ miscstruct.h tv_i2c.h tv_i810.o: tv_i810.c local.h config.h debug.h error.h xfree.h \ miscstruct.h mmio.h bitmask.h tv_i2c.h xf86i2c.h tv_i810.h \ i810_type.h tv_common.h tv_chip.h tv_null.o: tv_null.c local.h config.h debug.h error.h xf86i2c.h \ miscstruct.h tv_null.h tv_chip.h tv_common.h tv_nv.o: tv_nv.c local.h config.h debug.h error.h xfree.h miscstruct.h \ xf86_ansic.h mmio.h bitmask.h xf86i2c.h tv_nv.h tv_chip.h \ nv_type.h tv_common.h tv_i2c.h tv_nx.o: tv_nx.c local.h config.h debug.h error.h xfree.h miscstruct.h \ mmio.h bitmask.h tv_nx.h tv_common.h xf86i2c.h tv_chip.h \ nv_type.h tv_ph1_saa7102.o: tv_ph1_saa7102.c local.h config.h debug.h error.h \ bitmask.h tv_chip.h tv_i2c.h xf86i2c.h miscstruct.h \ tv_ph1_saa7102.h tv_common.h tv_ph2_saa7104.o: tv_ph2_saa7104.c local.h config.h debug.h error.h \ bitmask.h tv_chip.h tv_i2c.h xf86i2c.h miscstruct.h \ tv_ph1_saa7102.h tv_common.h tv_ph2_saa7104.h tv_tdfx.o: tv_tdfx.c local.h config.h debug.h error.h xfree.h \ miscstruct.h xf86_ansic.h mmio.h bitmask.h tv_i2c.h xf86i2c.h \ tv_tdfx.h tdfx_type.h tv_common.h tv_chip.h xf86i2c.o: xf86i2c.c local.h config.h debug.h error.h xfree.h \ miscstruct.h xf86_ansic.h xf86i2c.h info-am: info: info-am dvi-am: dvi: dvi-am check-am: all-am check: check-am installcheck-am: installcheck: installcheck-am all-recursive-am: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive install-exec-am: install-binPROGRAMS install-exec: install-exec-am install-data-am: install-data: install-data-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-am uninstall-am: uninstall-binPROGRAMS uninstall: uninstall-am all-am: Makefile $(PROGRAMS) $(HEADERS) config.h all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: $(mkinstalldirs) $(DESTDIR)$(bindir) mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \ mostlyclean-compile mostlyclean-tags \ mostlyclean-generic mostlyclean: mostlyclean-am clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \ clean-generic mostlyclean-am clean: clean-am distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \ distclean-tags distclean-generic clean-am distclean: distclean-am maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \ maintainer-clean-compile maintainer-clean-tags \ maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-am .PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile tags mostlyclean-tags distclean-tags \ clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ check-am installcheck-am installcheck all-recursive-am install-exec-am \ install-exec install-data-am install-data install-am install \ uninstall-am uninstall all-redirect all-am all installdirs \ mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: nvtv-0.4.7/src/stamp-h.in0000644000175000001440000000001210041242443010647 timestamp nvtv-0.4.7/src/Makefile.am0000644000175000001440000000371710023065172011023 ## Process this file with automake to produce Makefile.in ## Used automake 1.4 EXTRA_PROGRAMS = nvdump bin_PROGRAMS = nvtv nvtvd GUI_SOURCES = gui.c gui_bt.c gui_cx.c gui_ch.c gui_ph.c gui_nx.c \ gui_nv.c gui_tdfx.c gui_i810.c EXTRA_SOURCES = back_unix.c back_winio.c back_mswin.c back_client.c \ card_direct.c actions.c xbox.c EXTRA_nvtv_SOURCES = $(EXTRA_SOURCES) $(GUI_SOURCES) EXTRA_nvtvd_SOURCES = $(EXTRA_SOURCES) SRCS_COMMON = libc_wrapper.c xf86i2c.c pipe.c mmio.c \ tv_common.c tv_nv.c tv_tdfx.c tv_i810.c tv_i2c.c \ tv_null.c tv_bt.c tv_cx.c tv_nx.c tv_ch1_7007.c tv_ch2_7009.c \ tv_ph1_saa7102.c tv_ph2_saa7104.c \ data.c data_bt.c data_cx.c data_ch.c data_ph.c data_nx.c \ data_nv.c data_tdfx.c data_i810.c data_xbox.c data_vesa.c calc_bt.c \ back_direct.c back_nvidia.c back_tdfx.c back_i810.c back_null.c noinst_HEADERS = actions.h back_client.h back_direct.h backend.h \ back_i810.h back_mswin.h back_null.h back_nvidia.h back_tdfx.h \ back_unix.h bitmask.h calc_bt.h card_direct.h \ data.h data_bt.h data_ch.h data_cx.h data_ph.h data_nx.h \ data_i810.h data_nv.h data_tdfx.h data_vesa.h data_xbox.h \ debug.h error.h local.h miscstruct.h mmio.h xbox.h \ gui.h gui_bt.h gui_cx.h gui_ch.h gui_ph.h gui_nx.h \ gui_i810.h gui_nv.h gui_tdfx.h \ nvtv.h pipe.h print.h i810_type.h nv_type.h tdfx_type.h \ tv_chip.h tv_common.h tv_i2c.h tv_null.h tv_nv.h tv_i810.h tv_tdfx.h \ tv_bt.h tv_cx.h tv_ch1_7007.h tv_ch2_7009.h \ tv_ph1_saa7102.h tv_ph2_saa7104.h tv_nx.h \ xf86_ansic.h xf86i2c.h xf86PciInfo.h xf86str.h xfree.h LDADD_COMMON = $(OBJS_BACKEND) $(OBJS_EXTRA) LDADD_GUI = $(OBJS_GUI) nvtv_SOURCES = nvtv.c print.c $(SRCS_COMMON) nvtv_DEPENDENCIES = $(LDADD_COMMON) $(LDADD_GUI) nvtv_LDADD = $(LDADD_COMMON) $(LDADD_GUI) $(X_PRE_LIBS) $(X_LIBS) $(X_EXTRA_LIBS) $(GTK_LIBS) nvtvd_SOURCES = nvtvd.c $(SRCS_COMMON) nvtvd_DEPENDENCIES = $(LDADD_COMMON) nvtvd_LDADD = $(LDADD_COMMON) nvdump_SOURCES = nvdump.c card_direct.c mmio.c nvtv-0.4.7/src/config.h.in0000644000175000001440000000436207671676713011037 /* src/config.h.in. Generated from configure.in by autoheader. */ /* Path to client/server fifo pipes */ #undef CONFIG_PIPE_PATH /* Define to 1 if GTK is available and used. */ #undef HAVE_GTK /* Define to 1/2 for GTK major version. */ #undef HAVE_GTK_VERSION /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if pciutils available and used. */ #undef HAVE_PCI /* Define to 1 if pciutils library is named 'pciutils'. */ #undef HAVE_PCIUTILS /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if WinIo is used. */ #undef HAVE_WINIO /* Define to 1 if X is available and used. */ #undef HAVE_X /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if client backend is used. */ #undef USE_CLIENT_BACKEND /* Define to 1 if MS-Windows backend is used. */ #undef USE_MSWIN_BACKEND /* Define to 1 if Unix backend is used. */ #undef USE_UNIX_BACKEND /* Version number of package */ #undef VERSION /* Define to 1 if XBox support is used. */ #undef XBOX_SUPPORT /* Define to 1 if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING nvtv-0.4.7/src/nvdump.c0000644000175000001440000002602610024302613010435 /* NVTV dumper -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id$ * * Contents: * * Register dump utility. * */ #include "local.h" /* before everything else */ #include #include #ifdef HAVE_UNISTD_H #include #endif #include #include "xfree.h" #include "mmio.h" #include "card_direct.h" /* -------- -------- */ int opt_two = 0; int opt_all = 0; int opt_regs = 0; int opt_inc = -1; int opt_set = 0; int opt_addr = 0; char opt_what = ' '; static const char *short_options = "?2i::arA:C:M:S:"; static struct option long_options[] = { {NULL, 0, NULL, 0} }; /* -------- */ void usage (void) { fprintf (stderr, "usage: nvdump [-ar2] [-i [incr]] ...\n"); fprintf (stderr, "usage: nvdump -MACS ...\n\n"); fprintf (stderr, "where options include:\n"); fprintf (stderr, " -a all default ranges\n"); fprintf (stderr, " -r well-known registers (NV11)\n"); fprintf (stderr, " -M set main registers\n"); fprintf (stderr, " -A set attribute registers\n"); fprintf (stderr, " -C set CRTC registers\n"); fprintf (stderr, " -S set sequencer registers\n"); fprintf (stderr, " -2 two head\n"); } /* -------- -------- */ /* Inc normal = 0x20 */ void dump (char *title, void *mem, CARD32 from, CARD32 to, int inc) { CARD32 i; int j; if (inc == -1) inc = 0x20; if (title) printf (title, from, to); for (i = from; i < to; i += inc) { printf ("%06lX:", i); for (j = 0x00; j < inc; j += 4) { printf (" %08lX", MMIO_IN32(mem, i+j)); } printf ("\n"); } } /* 00d220, 00d224 index/data dword */ /* 6013d4, 6013d5 index/data byte */ void dump_tv (char *title, void *mem, CARD32 from, CARD32 to) { int inc = 0x10; int index = 0xd220; int data = 0xd224; CARD32 i; int j; if (title) printf (title, from, to); for (i = from; i < to; i += inc) { printf ("T %02lX:", i); for (j = 0x00; j < inc; j ++) { MMIO_OUT32(mem, index, i+j); if ((j % 8) == 0) printf (" "); printf (" %02lX", MMIO_IN32(mem, data)); } printf ("\n"); } } static long regs_nv11[] = { /* PMC */ 0x000000, 0x000004, 0x000100, 0x000140, 0x000160, 0x000200, /* PBUS */ 0x001080, 0x001084, 0x001088, 0x00108c, 0x001090, /* 0x001094, */ 0x00109c, 0x0010a0, 0x0010a4, 0x0010a8, 0x0010ac, 0x0010b0, 0x0010b4, 0x0010b8, 0x0010bc, 0x0010c0, 0x0010c4, 0x0010c8, 0x0010cc, 0x0010d0, 0x0010d4, 0x0010d8, 0x0010e0, 0x0010e4, 0x0010f0, 0x001100, 0x001140, 0x001200, 0x001800, 0x001804, 0x001808, 0x00180c, 0x001810, 0x001814, 0x001818, 0x00181c, 0x001820, 0x001824, 0x001828, 0x00182c, 0x001830, 0x001834, 0x001838, 0x00183c, 0x001840, 0x001844, 0x001848, 0x00184c, 0x001850, 0x001854, 0x001858, 0x00185c, 0x001860, 0x001864, 0x001868, 0x00186c, 0x001870, 0x001874, 0x001878, 0x00187c, 0x001880, 0x001884, 0x001888, 0x00188c, 0x001890, 0x001894, 0x001898, 0x00189c, 0x0018a0, 0x0018a4, 0x0018a8, 0x0018ac, 0x0018b0, 0x0018b4, 0x0018b8, 0x0018bc, 0x0018c0, 0x0018c4, 0x0018c8, 0x0018cc, 0x0018d0, 0x0018d4, 0x0018d8, 0x0018dc, 0x0018e0, 0x0018e4, 0x0018e8, 0x0018ec, 0x0018f0, 0x0018f4, 0x0018f8, 0x0018fc, /* PEXTDEV */ 0x101000, /* PCRTC */ 0x600100, 0x600140, 0x600800, 0x600804, /* 0x600808, */ 0x60080c, 0x600810, 0x600814, 0x600818, 0x60081c, 0x600830, 0x600834, 0x600838, /* 0x600840, 0x600844, 0x600848, 0x60084c, */ 0x600860, /* PCRTC2 */ 0x602100, 0x602140, 0x602800, 0x602804, /* 0x602808, */ 0x60280c, 0x602810, 0x602814, 0x602818, 0x60281c, 0x602830, 0x602834, 0x602838, /* 0x602840, 0x602844, 0x602848, 0x60284c, */ 0x602860, /* PRAMDAC */ 0x680500, 0x680504, 0x680508, 0x68050c, 0x680510, 0x680514, /* 0x680518, */ 0x68051c, 0x680520, 0x680524, 0x680528, 0x68052c, 0x680530, 0x680534, 0x680538, 0x68053c, 0x680600, /* 0x680604, */ 0x680608, 0x68060c, 0x680610, 0x680614, 0x680618, 0x68061c, 0x680620, 0x680624, 0x680628, 0x68062c, 0x680630, 0x680634, 0x680638, 0x68063c, 0x680700, 0x680704, 0x680708, 0x68070c, 0x680710, 0x680714, 0x680718, 0x68071c, 0x680720, 0x680724, 0x680728, 0x68072c, 0x680730, 0x680734, 0x680738, 0x68073c, 0x680800, 0x680804, 0x680808, 0x68080c, 0x680810, 0x680814, 0x680818, 0x68081c, 0x680820, 0x680824, 0x680828, 0x68082c, 0x680830, 0x680834, 0x680838, 0x68083c, 0x680840, 0x680844, 0x680848, 0x68084c, 0x680850, 0x680854, 0x680858, 0x68085c, 0x680860, 0x680864, 0x680868, 0x68086c, 0x680870, 0x680874, 0x680878, 0x68087c, 0x680880, 0x680884, 0x680888, 0x68088c, 0x680890, 0x680894, 0x680898, 0x68089c, /* PRAMDAC2 */ 0x682500, 0x682504, 0x682508, 0x68250c, 0x682510, 0x682514, 0x682518, 0x68251c, 0x682520, 0x682524, 0x682528, 0x68252c, 0x682530, 0x682534, 0x682538, 0x68253c, 0x682600, /* 0x682604, */ 0x682608, 0x68260c, 0x682610, 0x682614, 0x682618, 0x68261c, 0x682620, 0x682624, 0x682628, 0x68262c, 0x682630, 0x682634, 0x682638, 0x68263c, 0x682700, 0x682704, 0x682708, 0x68270c, 0x682710, 0x682714, 0x682718, 0x68271c, 0x682720, 0x682724, 0x682728, 0x68272c, 0x682730, 0x682734, 0x682738, 0x68273c, 0x682800, 0x682804, 0x682808, 0x68280c, 0x682810, 0x682814, 0x682818, 0x68281c, 0x682820, 0x682824, 0x682828, 0x68282c, 0x682830, 0x682834, 0x682838, 0x68283c, 0x682840, 0x682844, 0x682848, 0x68284c, 0x682850, 0x682854, 0x682858, 0x68285c, 0x682860, 0x682864, 0x682868, 0x68286c, 0x682870, 0x682874, 0x682878, 0x68287c, 0x682880, 0x682884, 0x682888, 0x68288c, 0x682890, 0x682894, 0x682898, 0x68289c, /* -- end -- */ -1 }; void dump_regs (void *mem) { long *p; for (p = regs_nv11; *p != -1; p++) { dump (NULL, mem, (*p), (*p) + 4, 4); } } void dump_all (void *mem) { dump ("---- PMC %06lX-%06lX\n", mem, 0x000000, 0x001000, opt_inc); dump ("---- PBUS %06lX-%06lX\n", mem, 0x001000, 0x002000, opt_inc); dump ("---- PEXTDEV %06lX-%06lX\n", mem, 0x101000, 0x102000, opt_inc); dump ("---- PCRTC %06lX-%06lX\n", mem, 0x600000, 0x601000, opt_inc); if (opt_two) { dump ("---- PCRTC2 %06lX-%06lX\n", mem, 0x602000, 0x603000, opt_inc); } dump ("---- PRAMDAC X %06lX-%06lX\n", mem, 0x680300, 0x6808a0, opt_inc); dump ("---- PRAMDAC Y %06lX-%06lX\n", mem, 0x6808c0, 0x681000, opt_inc); if (opt_two) { dump ("---- PRAMDAC2 X %06lX-%06lX\n", mem, 0x682300, 0x6828a0, opt_inc); dump ("---- PRAMDAC2 Y %06lX-%06lX\n", mem, 0x6828c0, 0x683000, opt_inc); } } void dump_arg (void *mem, int argc, char *argv[]) { CARD32 from, to; while (argc >= 1) { if (strcmp (argv[0], "T") == 0) { dump_tv ("---- NV17 PTV\n", mem, 0x00, 0x7f); argv += 1; argc -= 1; } else { if (argc < 2) break; from = strtoul (argv[0], NULL, 16); to = strtoul (argv[1], NULL, 16); dump ("---- %06lX-%06lX\n", mem, from, to, opt_inc); argv += 2; argc -= 2; } } } void set_main_args (void *mem, CARD32 addr, int argc, char *argv[]) { CARD32 val; int inc = opt_inc; if (inc == -1) inc = 0x04; while (argc >= 1) { val = strtoul (*argv, NULL, 16); printf ("%06lX=%08lX ", addr, val); fflush (stdout); MMIO_OUT32 (mem, addr, val); addr += inc; argv++; argc--; } printf ("\n"); } void set_crtc_args (void *mem, CARD32 addr, int argc, char *argv[]) { CARD8 val, old; int inc = opt_inc; if (inc == -1) inc = 0x01; old = MMIO_IN8 (mem, 0x6013d4); while (argc >= 1) { val = strtoul (*argv, NULL, 16); printf ("%02lX=%02lX ", addr, val); fflush (stdout); MMIO_OUT8 (mem, 0x6013d4, addr); MMIO_OUT8 (mem, 0x6013d5, val); addr += inc; argv++; argc--; } MMIO_OUT8 (mem, 0x6013d4, old); printf ("\n"); } void set_seq_args (void *mem, CARD32 addr, int argc, char *argv[]) { CARD8 val, old; int inc = opt_inc; if (inc == -1) inc = 0x01; old = MMIO_IN8 (mem, 0x6013c4); while (argc >= 1) { val = strtoul (*argv, NULL, 16); printf ("%02lX=%02lX ", addr, val); fflush (stdout); MMIO_OUT8 (mem, 0x0c03c4, addr); MMIO_OUT8 (mem, 0x0c03c5, val); addr += inc; argv++; argc--; } MMIO_OUT8 (mem, 0x6013c4, old); printf ("\n"); } void set_attr_args (void *mem, CARD32 addr, int argc, char *argv[]) { CARD8 val, tmp; int inc = opt_inc; if (inc == -1) inc = 0x01; tmp = MMIO_IN8 (mem, 0x6013da); /* reset */ while (argc >= 1) { val = strtoul (*argv, NULL, 16); printf ("%02lX=%02lX ", addr, val); fflush (stdout); MMIO_OUT8 (mem, 0x6013c0, addr); MMIO_OUT8 (mem, 0x6013c0, val); addr += inc; argv++; argc--; } printf ("\n"); } int main (int argc, char *argv[]) { CardPtr main_list; CardPtr card; int fd; void *mem; int c = '?'; int optc = 0; opterr = 0; while ((c = getopt_long (argc, argv, short_options, long_options, NULL)) != EOF) { switch (c) { case 'h': case '?': usage (); exit (0); break; case '2': opt_two = 1; optc++; break; case 'a': opt_all = 1; optc++; break; case 'r': opt_regs = 1; optc++; break; case 'i': opt_inc = 0x04; optc++; if (optarg) opt_inc = (int) strtol (optarg, NULL, 16); break; case 'M': case 'A': case 'C': case 'S': opt_what = c; optc++; opt_addr = (int) strtoul (optarg, NULL, 16); break; } } main_list = NULL; scan_cards_pci (&main_list, DEV_MEM); for (card = main_list; card; card = card->next) { if (card->type == CARD_NVIDIA) { printf ("%s (%04X) io=0x%08lX\n", card->name, card->pci_id, card->reg_base); fd = openDevMem (card); mem = mapDevMem (card, fd, card->reg_base, 0x1000000); if (opt_what != ' ') { switch (opt_what) { case 'M': set_main_args (mem, opt_addr, argc - optind, argv + optind); break; case 'A': set_attr_args (mem, opt_addr, argc - optind, argv + optind); break; case 'C': set_crtc_args (mem, opt_addr, argc - optind, argv + optind); break; case 'S': set_seq_args (mem, opt_addr, argc - optind, argv + optind); break; } } else if (opt_all || argc - optc <= 1) { dump_all (mem); } else if (opt_regs) { dump_regs (mem); } else { dump_arg (mem, argc - optind, argv + optind); } unmapDevMem (card, card->reg_base, 0x1000000); closeDevMem (card, fd); } } return 0; } nvtv-0.4.7/src/card_direct.c0000644000175000001440000004054510020723072011373 /* NVTV direct card access -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: card_direct.c,v 1.18 2004/03/01 21:08:10 dthierbach Exp $ * * Contents: * * Access the graphics card directly (via mmaps) * */ #include "local.h" /* before everything else */ #include #include #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #include #include #ifdef HAVE_PCI #ifdef HAVE_PCIUTILS #include #else #include #endif #endif #include #include #ifdef HAVE_SYS_IO_H #include #endif #include "backend.h" #include "card_direct.h" #include "xfree.h" /* for xf86PciInfo.h */ #define INIT_PCI_VENDOR_INFO #undef VENDOR_INCLUDE_NONVIDEO #include "xf86PciInfo.h" #ifdef HAVE_WINIO #include "winio.h" #endif /* -------- mmap on devices -------- */ /* originally from os-support/linux/lnx_video.c */ int openDevMem (CardPtr card) { int fd; if (!card->dev) return -1; #ifdef HAVE_WINIO if (strcmp (card->dev, "winio") == 0) { if (winio_init ()) { RAISE (MSG_ERROR, "%s", winio_error ()); return -1; } return 1; } else #endif /* HAVE_WINIO */ { #ifndef FAKE_CARD_MMAP if ((fd = open(card->dev, O_RDWR)) < 0) { fprintf(stderr, "mapDevMem: failed to open %s (%s)\n", card->dev, strerror(errno)); exit(1); } #else fd = -1; #endif /* FAKE_CARD_MMAP */ #ifdef TEST_HOOKS card->reg_mapped = mmap((caddr_t)0, card->reg_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, (off_t)card->reg_base); #else card->reg_mapped = NULL; #endif return fd; } } void closeDevMem (CardPtr card, int fd) { if (!card->dev) return; #ifdef HAVE_WINIO if (strcmp (card->dev, "winio") == 0) { if (fd < 0) return; winio_exit (); } else #endif /* HAVE_WINIO */ { if (card->reg_mapped) { munmap ((caddr_t) card->reg_mapped, card->reg_size); card->reg_mapped = NULL; } close (fd); } } void *mapDevMem (CardPtr card, int fd, unsigned long phys, unsigned long Size) { void* virt; int mapflags = MAP_SHARED; if (!card->dev) return (void *) phys; if (card->reg_mapped) return card->reg_mapped + (phys - card->reg_base); #ifdef HAVE_WINIO if (strcmp (card->dev, "winio") == 0) { if (fd < 0) return NULL; virt = winio_mmap ((caddr_t) phys, Size); return virt; } else #endif /* HAVE_WINIO */ { #ifdef FAKE_MMIO return (void *) (0xff000000 | (phys & 0xffffff)); #else /* FAKE_MMIO */ #ifndef FAKE_CARD_MMAP virt = mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE, mapflags, fd, (off_t)phys); return virt; #else /* FAKE_CARD_MMAP */ return xcalloc (1, Size); #endif /* FAKE_CARD_MMAP */ #endif /* FAKE_MMIO */ } } void unmapDevMem (CardPtr card, unsigned long phys, unsigned long Size) { unsigned long alignOff; #ifdef HAVE_WINIO int i; #endif /* HAVE_WINIO */ if (!card->dev) return; if (card->reg_mapped) return; #ifdef HAVE_WINIO if (strcmp (card->dev, "winio") == 0) { winio_munmap ((caddr_t) phys, Size); } else #endif /* HAVE_WINIO */ { #ifndef FAKE_MMIO #ifndef FAKE_CARD_MMAP alignOff = phys - (phys & ~(getpagesize() - 1)); munmap((caddr_t)(phys - alignOff), (Size + alignOff)); #endif /* FAKE_CARD_MMAP */ #endif /* FAKE_MMIO */ } } /* -------- Common -------- */ /* TODO: Allocation layer */ /* * Test if card is supported, and create entry for it if it is. */ void test_card (CardPtr *card_list, char *dev_name, int vendor_id, int device_id, CARD32 base0, CARD32 size0, CARD32 base1, CARD32 size1, int addr_bus, int addr_slot, int addr_func, char *format, ...) { pciVendorDeviceInfo *vinfo; struct pciDevice *dinfo; CardPtr card; CardType type; va_list ap; CARD32 reg_base, reg_size; int pio_base; char s[40]; pio_base = 0; switch (vendor_id) { case PCI_VENDOR_NVIDIA: case PCI_VENDOR_NVIDIA_SGS: type = CARD_NVIDIA; if (device_id == PCI_CHIP_GEFORCE3_MCPX) { type = CARD_XBOX; /* FIXME get PIO base from device w/ id 01B4 (SMBus controller) */ pio_base = 0xC000; mmio_port_perm (pio_base, /* FIXME */ 0x4000, 1); } reg_base = base0; reg_size = size0; break; case PCI_VENDOR_3DFX: type = CARD_TDFX; reg_base = base0; reg_size = size0; pio_base = 0x300; /* maybe also base2 */ mmio_port_perm (pio_base + 0xb0, 0x30, 1); break; case PCI_VENDOR_INTEL: type = CARD_I810; reg_base = base1; reg_size = size1; break; default: type = CARD_NONE; reg_base = 0; break; } if (type != CARD_NONE) { va_start (ap, format); for (vinfo = xf86PCIVendorInfoData; vinfo->VendorID; vinfo++) { if (vinfo->VendorID == vendor_id) { for (dinfo = vinfo->Device; dinfo->DeviceID; dinfo++) if (dinfo->DeviceID == device_id) { card = (CardPtr) malloc (sizeof (CardInfo)); card->next = *card_list; *card_list = card; card->name = (char *) malloc (40 * sizeof (char)); vsnprintf (s, 38, format, ap); snprintf (card->name, 38, "%s (%s)", dinfo->DeviceName, s); card->type = type; card->dev = dev_name; card->reg_mapped = NULL; card->reg_base = reg_base; card->reg_size = reg_size; card->pio_base = pio_base; card->pci_id = device_id; card->chips = NULL; card->arch = ""; card->addr_bus = addr_bus; card->addr_slot = addr_slot; card->addr_func = addr_func; break; } break; } } va_end (ap); } } /* -------- Root backend -------- */ #if HAVE_PCI void scan_cards_pci (CardPtr *card_root_list, char *devname) { struct pci_access *acc; struct pci_dev *dev; acc = pci_alloc (); acc->method = PCI_ACCESS_AUTO; pci_init(acc); pci_scan_bus (acc); #ifdef FAKE_CARD test_card (card_root_list, "", FAKE_CARD_VENDOR, FAKE_CARD_DEVICE, 0, 0, 0, 0, 0, 0, 0, "Fake"); #else /* FAKE_CARD */ for (dev = acc->devices; dev; dev = dev->next) { pci_fill_info (dev, PCI_FILL_IDENT); pci_fill_info (dev, PCI_FILL_BASES); test_card (card_root_list, devname, dev->vendor_id, dev->device_id, dev->base_addr[0] & PCI_ADDR_IO_MASK, dev->size[0], dev->base_addr[1] & PCI_ADDR_IO_MASK, dev->size[1], dev->bus, dev->dev, dev->func, "%02x:%02x.%02x", dev->bus, dev->dev, dev->func); } /* FIXME: pci_cleanup (acc); segfaults ... but avoid memory leak here. */ #endif /* FAKE_CARD */ } #endif /* HAVE_PCI */ /* -------- nvdev backend -------- */ /* FIXME: Sort out unix/nvdev, unix/root, windows/nvdll, windows/winio backends */ #ifdef USE_UNIX_BACKEND typedef unsigned int NvU32; /* 0 to 4294967295 */ typedef unsigned char NvU8; #define NV_MAX_DEVICES 8 /* was 4 */ #define NV_IOCTL_CARD_INFO_FLAG_PRESENT 0x0001 #define NV_IOCTL_CARD_INFO_FLAG_NEED_MSYNC 0x0002 #define NV_MMAP_REG_OFFSET (0) #define NV_MMAP_REG_SIZE 0x800000 #define NV_MMAP_FB_OFFSET (256 * 1024 * 1024) #define NV_MMAP_ALLOCATION_OFFSET (1 * 1024 * 1024 * 1024) #define NV_MMAP_AGP_OFFSET ((unsigned long)(2)*(1024 * 1024 * 1024)) #define NVIDIA_IOCTL_MAGIC 'F' #if 0 #define NVIDIA_IOCTL_CARD_INFO _IOWR(NVIDIA_IOCTL_MAGIC, 2, sizeof(void *)) #endif #define NVIDIA_IOCTL_CARD_INFO \ _IOWR(NVIDIA_IOCTL_MAGIC, 2, NvU8[NV_MAX_DEVICES*sizeof(nv_new_ci)]) static char *dev_nvcard [NV_MAX_DEVICES] = { "/dev/nvidia0", "/dev/nvidia1", "/dev/nvidia2", "/dev/nvidia3" "/dev/nvidia4", "/dev/nvidia5", "/dev/nvidia6", "/dev/nvidia7" }; /* 1.0-2314 and older */ typedef struct { int flags; /* see below */ int bus; /* bus number (PCI, AGP, etc) */ int slot; /* card slot */ int vendor_id; /* PCI vendor id */ int device_id; int interrupt_line; } nv_old_ci; /* 1.0-2802 */ typedef struct { int flags; /* see below */ int bus; /* bus number (PCI, AGP, etc) */ int slot; /* card slot */ int vendor_id; /* PCI vendor id */ int device_id; int interrupt_line; unsigned int reg_address; /* register aperture */ unsigned int reg_size; unsigned int fb_address; /* framebuffer aperture */ unsigned int fb_size; } nv_2802_ci; /* 1.0-2880, 1.0-3123, 1.0-4191, 1.0-4349, 1.0-4497, 1.0-5328, 1.0-5336 */ typedef struct { NvU32 flags; /* see below */ NvU32 bus; /* bus number (PCI, AGP, etc) */ NvU32 slot; /* card slot */ NvU32 vendor_id; /* PCI vendor id */ NvU32 device_id; NvU32 interrupt_line; NvU32 reg_address; /* register aperture */ NvU32 reg_size; NvU32 fb_address; /* framebuffer aperture */ NvU32 fb_size; } nv_new_ci; /* 1.0-2960 */ typedef struct { int flags; /* see below */ int bus; /* bus number (PCI, AGP, etc) */ int slot; /* card slot */ int vendor_id; /* PCI vendor id */ int device_id; int interrupt_line; unsigned int reg_address; /* register aperture */ unsigned int reg_size; unsigned int fb_address; /* framebuffer aperture */ unsigned int fb_size; } nv_2960_ci; typedef struct { NvU32 magic; NvU32 version; NvU32 major; NvU32 minor; NvU32 patch; } nv_api_version; #define NVIDIA_IOCTL_VERSION _IOWR(NVIDIA_IOCTL_MAGIC, 6, nv_api_version) #define NVIDIA_VERSION_MAGIC_REQ 0x9797fade #define NVIDIA_VERSION_MAGIC_REP 0xbead2929 #define NVIDIA_VERSION 1 #define MAX_VER 4349 /* TODO 1.0-4496 -- API version 5 */ /* TODO 1.0-5328, 1.0-5336 -- API version 6 */ #define NV_IOCTL_BASE 200 #define NV_ESC_CARD_INFO (NV_IOCTL_BASE + 0) #define NV_ESC_RM_API_VERSION (NV_IOCTL_BASE + 3) #define NV_IOCTL_CARD_INFO _IOWR(NV_IOCTL_MAGIC, NV_ESC_CARD_INFO, NvU8[NV_MAX_DEVICES*sizeof(nv_ioctl_card_info_t)]) #define NV_IOCTL_RM_API_VERSION _IOWR(NV_IOCTL_MAGIC, NV_ESC_RM_API_VERSION, nv_ioctl_rm_api_version_t) /* ---------------------------------------- */ void scan_cards_nvdev (CardPtr *card_nvdev_list) { int fd, error; nv_old_ci ci_old [NV_MAX_DEVICES]; nv_2802_ci ci_2802 [NV_MAX_DEVICES]; nv_2960_ci ci_2960 [NV_MAX_DEVICES]; nv_new_ci ci_new [NV_MAX_DEVICES]; nv_api_version ver_api; int ver; int ver_major, ver_minor, ver_patch; FILE *f; int i; /* FIXME: Must check /proc/driver/nvidia/version which version, use correct info struct */ if ((f = fopen ("/proc/driver/nvidia/version", "r"))) { ver = -1; /* poor man's parsing ... */ while (!feof (f)) { if (fgetc (f) != 'K') continue; if (fgetc (f) != 'e') continue; if (fgetc (f) != 'r') continue; if (fgetc (f) != 'n') continue; if (fgetc (f) != 'e') continue; if (fgetc (f) != 'l') continue; if (fgetc (f) != ' ') continue; if (fgetc (f) != 'M') continue; if (fgetc (f) != 'o') continue; if (fgetc (f) != 'd') continue; if (fgetc (f) != 'u') continue; if (fgetc (f) != 'l') continue; if (fgetc (f) != 'e') continue; if (fscanf (f, " %i.%i-%i", &ver_major, &ver_minor, &ver_patch) == 3) { fprintf (stderr, "Found NVidia Kernel module version %i.%i-%i\n", ver_major, ver_minor, ver_patch); ver = ver_patch; break; } } if (ver == -1) { fprintf (stderr, "Warning: Cannot determine NVidia Kernel module version.\n"); fprintf (stderr, " If NVidia has changed the data structures in the kernel module, nvtv might\n"); fprintf (stderr, " fail or even core dump. In this case, run nvtv as root.\n"); ver = MAX_VER; } if (ver > MAX_VER) { fprintf (stderr, "Warning: The NVidia kernel module is newer than the versions nvtv have been\n"); fprintf (stderr, " tested with. If NVidia has changed the data structures in the kernel\n"); fprintf (stderr, " module, nvtv might fail, or even core dump. In this case, run nvtv as root.\n"); } fclose (f); } else { ver = 0; } fd = open(DEV_NVCTL, O_RDWR, 0); if (fd < 0) { *card_nvdev_list = NULL; return; } switch (ver) { case 0: /* 1.0-2314 and older */ error = ioctl (fd, NVIDIA_IOCTL_CARD_INFO, ci_old); if (error < 0) { close(fd); *card_nvdev_list = NULL; return; } for (i = 0; i < NV_MAX_DEVICES; i++) { if ((ci_old[i].flags & NV_IOCTL_CARD_INFO_FLAG_PRESENT) == 0) { continue; } test_card (card_nvdev_list, dev_nvcard[i], ci_old[i].vendor_id, ci_old[i].device_id, NV_MMAP_REG_OFFSET, NV_MMAP_REG_SIZE, 0, 0, ci_old[i].bus, ci_old[i].slot, 0, "%02x:%02x", ci_old[i].bus, ci_old[i].slot); } break; case 2802: error = ioctl (fd, NVIDIA_IOCTL_CARD_INFO, ci_2802); if (error < 0) { close(fd); *card_nvdev_list = NULL; return; } for (i = 0; i < NV_MAX_DEVICES; i++) { if ((ci_2802[i].flags & NV_IOCTL_CARD_INFO_FLAG_PRESENT) == 0) { continue; } test_card (card_nvdev_list, dev_nvcard[i], ci_2802[i].vendor_id, ci_2802[i].device_id, NV_MMAP_REG_OFFSET, NV_MMAP_REG_SIZE, 0, 0, ci_2802[i].bus, ci_2802[i].slot, 0, "%02x:%02x", ci_2802[i].bus, ci_2802[i].slot); } break; case 2960: error = ioctl (fd, NVIDIA_IOCTL_CARD_INFO, ci_2960); if (error < 0) { close(fd); *card_nvdev_list = NULL; return; } for (i = 0; i < NV_MAX_DEVICES; i++) { if ((ci_2960[i].flags & NV_IOCTL_CARD_INFO_FLAG_PRESENT) == 0) { continue; } test_card (card_nvdev_list, dev_nvcard[i], ci_2960[i].vendor_id, ci_2960[i].device_id, NV_MMAP_REG_OFFSET, NV_MMAP_REG_SIZE, 0, 0, ci_2960[i].bus, ci_2960[i].slot, 0, "%02x:%02x", ci_2960[i].bus, ci_2960[i].slot); } break; case 2880: case 3123: error = ioctl (fd, NVIDIA_IOCTL_CARD_INFO, ci_new); if (error < 0) { close(fd); *card_nvdev_list = NULL; return; } for (i = 0; i < NV_MAX_DEVICES; i++) { if ((ci_new[i].flags & NV_IOCTL_CARD_INFO_FLAG_PRESENT) == 0) { continue; } test_card (card_nvdev_list, dev_nvcard[i], ci_new[i].vendor_id, ci_new[i].device_id, NV_MMAP_REG_OFFSET, NV_MMAP_REG_SIZE, 0, 0, ci_new[i].bus, ci_new[i].slot, 0, "%02x:%02x", ci_new[i].bus, ci_new[i].slot); } break; case 4191: case 4349: default: error = ioctl (fd, NVIDIA_IOCTL_VERSION, &ver_api); if (error < 0) { close(fd); *card_nvdev_list = NULL; return; } if (ver_api.version != 1 || ver_api.major != 1 || ver_api.minor != 0 || ver_api.patch != ver) { fprintf (stderr, "Version control mismatch (found %i / %i.%i-%i)\n", ver_api.version, ver_api.major, ver_api.minor, ver_api.patch); close(fd); *card_nvdev_list = NULL; return; } ver_api.magic = NVIDIA_VERSION_MAGIC_REQ; *((nv_api_version *) &ci_new) = ver_api; error = ioctl (fd, NVIDIA_IOCTL_CARD_INFO, ci_new); if (error < 0) { close(fd); *card_nvdev_list = NULL; return; } for (i = 0; i < NV_MAX_DEVICES; i++) { if ((ci_new[i].flags & NV_IOCTL_CARD_INFO_FLAG_PRESENT) == 0) { continue; } test_card (card_nvdev_list, dev_nvcard[i], ci_new[i].vendor_id, ci_new[i].device_id, ci_new[i].reg_address, ci_new[i].reg_size, ci_new[i].fb_address, ci_new[i].fb_size, ci_new[i].bus, ci_new[i].slot, 0, "%02x:%02x", ci_new[i].bus, ci_new[i].slot); } break; case 5328: /* api version 6, new iocontrol base */ break; } } #endif /* USE_UNIX_BACKEND */ nvtv-0.4.7/src/mmio.c0000644000175000001440000000631510021571430010066 /* NVTV mmio/port wrapper -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: mmio.c,v 1.3 2004/03/04 09:12:56 dthierbach Exp $ * * Contents: * * Wrapper for mmio/port access for different OS * */ #include "local.h" /* before everything else */ #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_IO_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef __FreeBSD__ /* FIXME: Are these and sys/stat.h really needed? */ #include #include /* FreeBSD does not have ioperm() and iopl() but can easily emulate them */ #define ioperm i386_set_ioperm /* /dev/io is a controlled security hole. Any FreeBSD process that holds a * file descriptor on /dev/io open will get its IOPL bits in the flag * register set, thus allowing it to perform direct I/O operations. */ static int iopl (int level) { static int desc = -1; if (desc == -1 && level > 0) { if ((desc = open ("/dev/io", O_RDWR)) == -1) return EPERM; } return 0; } #endif /* __FreeBSD__ */ #ifdef __NetBSD__ static int ioperm(from, num, turn_on) unsigned long from; unsigned long num; int turn_on; { u_long *bitmap, mask, value; int r = -1; int first_index, last_index, i; if((bitmap = (u_long *)malloc(1024*sizeof(u_long))) == NULL) return -1; if(i386_get_ioperm(bitmap) != 0) goto ioperm_fail; first_index = from / 32; last_index = (from + num) / 32; /* First set */ mask = 0xffffffff << (from % 32); if(turn_on) bitmap[first_index] |= mask; else bitmap[first_index] &= ~mask; /* Last set */ mask = 0xffffffff >> (31 - (from + num) % 32); if(turn_on) bitmap[last_index] |= mask; else bitmap[last_index] &= ~mask; if(last_index > first_index + 1) { /* Complete sets */ value = turn_on ? 0xffffffff : 0; for(i = first_index+1; i= 0x400) { #ifdef __NetBSD__ /* FIXME: Limit is 0x8000 for NetBSD ?? */ if (turn_on) i386_iopl (3); else i386_iopl (0); #else if (turn_on) iopl (3); else iopl (0); #endif } else { ioperm (from, num, turn_on); } } #endif /* HAVE_WINIO */ nvtv-0.4.7/src/nvtv.c0000644000175000001440000010070010041234725010120 /* NVTV main -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: nvtv.c,v 1.7 2004/03/01 21:08:10 dthierbach Exp $ * * Contents: * * Main routine. Parse options, execute actions or call gui. * */ #include "local.h" /* before everything else */ #include #include #include #include #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_X #include #endif #ifdef HAVE_GTK #include #include #include "gui.h" #endif #include "backend.h" #include "back_null.h" #ifdef USE_UNIX_BACKEND #include "back_unix.h" #endif #ifdef USE_MSWIN_BACKEND #include "back_mswin.h" #endif #ifdef USE_CLIENT_BACKEND #include "back_client.h" #endif #include "nvtv.h" #include "print.h" #include "data_vesa.h" #ifdef HAVE_X #include "actions.h" #endif #ifdef DEBUG_PROBE #include "back_direct.h" #endif /* Debug: */ #include "tv_nv.h" /* -------- Global options -------- */ Bool opt_debug = FALSE; Bool opt_no_root = FALSE; Bool opt_nvdev = FALSE; int opt_res_x = -1, opt_res_y = -1; float opt_hoc = -1.0, opt_voc = -1.0; int opt_head = -1; char *opt_size = NULL; char *opt_dpy = NULL; char *opt_window_name = NULL; BackAccessPtr back_access = NULL; /* global backend */ BackCardPtr back_card = NULL; int opt_tv_bus = -1, opt_tv_addr = -1; TVChip opt_tv_chip = TV_NO_CHIP; TVSystem opt_system = TV_SYSTEM_NONE; TVConnect opt_connect = CONNECT_AUTO; #if HAVE_X Window opt_window = None; #endif int opt_service_flags = 0; int opt_service_mask = 0; int opt_mode_flags = 0; int opt_mode_mask = 0; int opt_pci_bus = -1; int opt_pci_slot = -1; int opt_pci_func = -1; TVSettings opt_set; static const char *short_options = "?12bcdf:ghlmno:pqr:s:tw:A:C:FNPS:T:W:X"; static struct option long_options[] = {{"tv-bars", no_argument, NULL, 'b'}, {"center", no_argument, NULL, 'c'}, {"debug", no_argument, NULL, 'd'}, {"set-flicker", required_argument, NULL, 'f'}, {"gui", no_argument, NULL, 'g'}, {"help", no_argument, NULL, 'h'}, {"list", no_argument, NULL, 'l'}, {"tv-off", no_argument, NULL, 'm'}, {"no-root", no_argument, NULL, 'n'}, {"overscan", required_argument, NULL, 'o'}, {"print", no_argument, NULL, 'p'}, {"query", no_argument, NULL, 'q'}, {"resolution", required_argument, NULL, 'r'}, {"size", required_argument, NULL, 's'}, {"tv-on", no_argument, NULL, 't'}, {"win-name", required_argument, NULL, 'w'}, {"card-addr", required_argument, NULL, 'A'}, {"connector", required_argument, NULL, 'C'}, {"display", required_argument, NULL, 'D'}, {"fetch", no_argument, NULL, 'F'}, {"nvdev", no_argument, NULL, 'N'}, {"probe", no_argument, NULL, 'P'}, {"system", required_argument, NULL, 'S'}, {"chip", required_argument, NULL, 'T'}, {"win-id", required_argument, NULL, 'W'}, {"switch-mode", no_argument, NULL, 'X'}, {"set", required_argument, NULL, 300}, {"sync", no_argument, NULL, '.'}, {"no-xshm", no_argument, NULL, '.'}, {"name", required_argument, NULL, '.'}, {"class", required_argument, NULL, '.'}, {NULL, 0, NULL, 0} }; OptIntVal *opt_set_act = NULL; #define SET_FIELD(f) addr:&opt_set.f static OptIntDecl opt_set_list [] = { {"Contrast", min:-100, max:100, SET_FIELD(contrast)}, {"Saturation", min:-100, max:100, SET_FIELD(saturation)}, {"Brightness#", min: -50, max: 50, SET_FIELD(brightness_sig)}, {"Contrast#", min: -50, max: 50, SET_FIELD(contrast_sig)}, {"Saturation#", min: -50, max: 50, SET_FIELD(saturation_sig)}, {"Phase", min: -60, max: 60, SET_FIELD(phase)}, {"Hue", min: -60, max: 60, SET_FIELD(hue)}, {"Flicker", min: 0, max:100, SET_FIELD(flicker)}, {"AdaptFlicker", min: 0, max:100, SET_FIELD(flicker_adapt)}, {"LumaBandwidth", min: 0, max:100, SET_FIELD(luma_bandwidth)}, {"ChromaBandwidth", min: 0, max:100, SET_FIELD(chroma_bandwidth)}, {"Sharpness", min: 0, max:100, SET_FIELD(sharpness)}, {"CrossColor", min: 0, max:100, SET_FIELD(cross_color)}, {NULL} }; #define SET_FLAG(x) addr_val:&opt_##x##_flags, addr_mask:&opt_##x##_mask static OptFlagDecl opt_flag_list [] = { {"Dualview", mask: TV_DESC_DUALVIEW, SET_FLAG(mode)}, {"Monochrome", mask: TV_DESC_MONOCHROME, SET_FLAG(mode)}, {"Non-Interlaced", mask: TV_DESC_NONINTERLACED, SET_FLAG(mode)}, {"Macrovision", mask: TV_DESC_MACROVISION, SET_FLAG(mode)}, {"FreeCarrier", mask: TV_DESC_CARRIER_LOCK, SET_FLAG(mode)}, {"Colorfix", mask: TV_DESC_COLORFIX, SET_FLAG(mode)}, {"AdjustCursor", mask: BACK_SERVICE_CURSOR, SET_FLAG(service)}, {"ViewportCursor", mask: BACK_SERVICE_VIEW_CURSOR, SET_FLAG(service)}, {"ViewportMonitor", mask: BACK_SERVICE_VIEW_MAIN, SET_FLAG(service)}, {NULL} }; /* -------- Actions -------- */ typedef enum { ACTION_NONE = 0, ACTION_PRINT = 1, ACTION_GUI = 2, ACTION_TVON = 3, ACTION_TVOFF = 4, ACTION_TVBARS = 5, ACTION_DEBUG = 6, ACTION_PROBE = 7, ACTION_QUERY = 8, ACTION_LIST = 9, } ActionMain; typedef enum { ACTION_CENTER = (1 << 0), ACTION_XMODE = (1 << 1), ACTION_FETCH = (1 << 2), } ActionAux; /* -------- Error handling -------- */ void raise_msg (int class, char *format, ...) { va_list args; if (class >= MSG_DEBUG && !opt_debug) return; switch (class) { case MSG_ABORT: fprintf (stderr, "Fatal: "); break; case MSG_WARNING: fprintf (stderr, "Warning: "); break; } va_start(args, format); vfprintf (stderr, format, args); va_end(args); if (class != MSG_DEBUG_NL) fprintf (stderr, "\n"); if (class == MSG_ABORT) exit (1); } /* -------- Usage -------- */ void usage (void) { OptIntDecl *p; OptFlagDecl *r; int i; fprintf (stderr, "NVTV version " PACKAGE_VERSION "\n\n"); fprintf (stderr, "Usage: nvtv [-options ...]\n\n"); fprintf (stderr, "where options include:\n"); fprintf (stderr, " -h --help print this message\n"); fprintf (stderr, " --display hst:scrn X server to contact\n"); fprintf (stderr, " -m --tv-off TV off, switch to monitor\n"); fprintf (stderr, " -t --tv-on TV on\n"); fprintf (stderr, " -b --tv-bars Color bars\n"); fprintf (stderr, " -p --print calculate and print register values\n"); fprintf (stderr, " -F --fetch fetch current mode (use only for printing)\n"); fprintf (stderr, " -l --list list available modes on stdout\n"); fprintf (stderr, " -r --resolution x,y Resolution\n"); fprintf (stderr, " -o --overscan x,y Overscan percentage (as float)\n"); fprintf (stderr, " -s --size Size (for predefined modes)\n"); fprintf (stderr, " -S --system NTSC,NTSC-J,PAL,PAL-60,PAL-NC,PAL-M,PAL-M60,PAL-X,SECAM\n"); fprintf (stderr, " -C --connector AUTO,COMPOSITE,SVIDEO,BOTH,CONVERT\n"); fprintf (stderr, " -T --chip BROOKTREE,CONEXANT,NVIDIA,CHRONTEL1,CHRONTEL2,\n"); fprintf (stderr, " PHILIPS1,PHILIPS2,NVIDIA or :\n"); fprintf (stderr, " -A --card-addr video card pci address as :.\n"); fprintf (stderr, " -W --win-id id select window by numerical id\n"); fprintf (stderr, " -w --win-name name select window by name\n"); fprintf (stderr, " -c --center center selected window\n"); fprintf (stderr, " -X --switch-mode switch X mode\n"); fprintf (stderr, " -1 use first head\n"); fprintf (stderr, " -2 use second head (if available)\n"); fprintf (stderr, " -q --query query status of display (monitor, TV, flatpanel)\n"); fprintf (stderr, " -P --probe probe and print system information\n"); fprintf (stderr, " -N --nvdev enable usage of /dev/nv* devices\n"); fprintf (stderr, " -g --gui always use gui\n"); fprintf (stderr, " -n --no-root (only for debugging)\n"); fprintf (stderr, " -d --debug (only for debugging)\n"); fprintf (stderr, " --set name:val Specify setting\n"); fprintf (stderr, "\nThe following settings are available:\n"); for (i = 0, p = opt_set_list; p->name; i++, p++) { fprintf (stderr, " %-20s (%4i to %4i)", p->name, p->min, p->max); if (i % 2) { fprintf (stderr, "\n"); } else { fprintf (stderr, " "); } } if (i % 2) fprintf (stderr, "\n"); for (i = 0, r = opt_flag_list; r->name; i++, r++) { fprintf (stderr, " %-20s (flag) %4s", r->name, ""); if (i % 2) { fprintf (stderr, "\n"); } else { fprintf (stderr, " "); } } if (i % 2) fprintf (stderr, "\n"); exit (1); } /* -------- -------- */ ChipPtr findDefOptChip (CardPtr card) { ChipPtr c, ca; ca = card->chips; if (opt_tv_chip != TV_NO_CHIP) { for (c = card->chips; c; c = c->next) { if (c->type == opt_tv_chip) { ca = c; break; } } } return ca; } void printRegs (TVMode *mode, CardType card, TVChip chip) { printf ("*** Resolution %03i x %03i Overscan %06.3f x %06.3f\n", mode->spec.res_x, mode->spec.res_y, mode->spec.hoc, mode->spec.voc); print_tv_regs (&mode->regs.enc, chip); print_crt_regs (&mode->regs.crtc, card); } int doQuery (int head) { int dev; if (head == -1) head = 1; back_card->getHeadDev (head, &dev); printf ("%i", dev); return dev + 100; /* exit code */ } int doList (CardPtr card) { ChipPtr chip; DataFunc *func; TVMode *m; static char* sys[] = { "NTSC", "NTSC-J", "PAL", "PAL-60", "PAL-N", "PAL-Nc", "PAL-M", "PAL-M60", "PAL-X", "SECAM" }; /* TODO FIXME: Use card->listModes */ /* Hm. Must set chip for that, which does init ... */ #if 1 chip = findDefOptChip (card); if (!chip) RAISE (MSG_ABORT, "No encoder chip found, and none specified.\n"); func = data_func (card->type, chip->type); m = func->modes (); printf ("Modes for %s on %s\n", chip->name, card->name); if (m) { while (m->spec.system != TV_SYSTEM_NONE) { if (opt_system == TV_SYSTEM_NONE || m->spec.system == opt_system) { printf ("%s\t%4i,%4i\t%s\t%05.2f,%05.2f\t%s\n", sys[m->spec.system], m->spec.res_x, m->spec.res_y, m->spec.size, m->spec.hoc, m->spec.voc, m->spec.aspect); } m++; } } #else back_card->setChip(, FALSE); /* FIXME change listModes to use card->type, chip->type ? */ n = back_card->listModes (opt_system, &modes); printf ("Modes for %s on %s\n", chip->name, card->name); for (m = modes, i = 1; i <= n; i++, m++) { printf ("%s\t%4i,%4i\t%s\t%05.2f,%05.2f\t%s\n", sys[m->spec.system], m->spec.res_x, m->spec.res_y, m->spec.size, m->spec.hoc, m->spec.voc, m->spec.aspect); } xfree (modes); #endif return 0; /* exit code */ } void doDebug (void) { CardPtr card; #ifdef USE_UNIX_BACKEND #if 1 if (! back_root_avail ()) { printf ("No root backend\n"); exit (1); } card = back_root_init (); #else if (! back_client_avail ()) { printf ("No client backend\n"); exit (1); } card = back_client_init (); #endif #endif /* USE_UNIX_BACKEND */ #ifdef USE_MSWIN_BACKEND if (! back_win_avail ()) { printf ("No nvidia driver backend\n"); exit (1); } card = back_win_init (); #endif /* USE_MSWIN_BACKEND */ printf ("Backend is open, card=%s\n", card->name); back_access->openCard (card); printf ("Card is open\n"); #if 0 { int i, n; TVMode *modes, *m; n = back_card->listModes (TV_SYSTEM_NTSC, &modes); for (m = modes, i = 1; i <= n; i++, m++) { printf ("%ix%i_%s ", m->spec.res_x, m->spec.res_y, m->spec.size); } printf ("\n"); xfree (modes); } #endif { TVMode mode; if (back_card->findByOverscan (TV_SYSTEM_NTSC, 800, 600, 8.0, 8.0, &mode)) { printf ("found %03i x %03i (%06.3f x %06.3f) %s\n", mode.spec.res_x, mode.spec.res_y, mode.spec.hoc, mode.spec.voc, mode.spec.size); } } back_access->closeCard (); } void modifySet (TVSettings *s, OptIntVal *m) { int i; while (m) { i = (char *) m->addr - (char *) s; if (i < 0 || i > sizeof(TVSettings)) { RAISE (MSG_ABORT, "Wrong settings to modify"); } *(m->addr) = m->val; m = m->link; } } Bool processOptSet (char *opt, OptIntVal **head, OptIntVal **tail) { char *s; char *name; int val; OptIntDecl *p; OptIntVal *q; OptFlagDecl *r; if (!opt) return FALSE; name = opt; s = strchr(opt, ':'); if (!s) { RAISE (MSG_ERROR, "Illegal setting: %s", opt); return FALSE; } *s++ = '\0'; RAISE (MSG_DEBUG_NL, "process settings %s", name); for (p = opt_set_list; p->name; p++) { if (strcasecmp (name, p->name) == 0) break; } if (p->name) { if (sscanf (s, "%i", &val) != 1) { RAISE (MSG_ERROR, "Illegal setting: %s", opt); return FALSE; } RAISE (MSG_DEBUG, " = %i", val); if (val < p->min || val > p->max) { RAISE (MSG_ERROR, "Setting %s out of range (%i to %i)", p->name, p->min, p->max); return FALSE; } q = (OptIntVal *) xalloc (sizeof (OptIntVal)); q->addr = p->addr; q->link = NULL; q->val = val; if (*tail) (*tail)->link = q; *tail = q; if (!(*head)) *head = q; return TRUE; } for (r = opt_flag_list; r->name; r++) { if (strcasecmp (name, r->name) == 0) break; } if (r->name) { if (strcasecmp (s, "false") == 0) val = 0; else if (strcasecmp (s, "off") == 0) val = 0; else if (strcasecmp (s, "0") == 0) val = 0; else if (strcasecmp (s, "true") == 0) val = 1; else if (strcasecmp (s, "on") == 0) val = 1; else if (strcasecmp (s, "1") == 0) val = 1; else { RAISE (MSG_DEBUG, ""); RAISE (MSG_ERROR, "Illegal flag value: %s", s); return FALSE; } RAISE (MSG_DEBUG, " = %s", val ? "true" : "false"); *(r->addr_mask) |= r->mask; if (val) { *(r->addr_val) |= r->mask; } else { *(r->addr_val) &= ~r->mask; } return TRUE; } RAISE (MSG_ERROR, "Unknown setting %s", name); return FALSE; } /* * Find card specified by opt_pci_* */ CardPtr findCard (CardPtr list) { CardPtr card; for (card = list; card; card = card->next) { if ((opt_pci_bus == -1 || opt_pci_bus == card->addr_bus) && (opt_pci_slot == -1 || opt_pci_slot == card->addr_slot) && (opt_pci_func == -1 || opt_pci_func == card->addr_func)) { return card; } } return card; } #ifdef TEST_HOOKS #define main xmain #endif int main (int argc, char *argv[]) { CardPtr main_card_list, main_card = NULL; int c = '?'; ActionMain act_main = ACTION_NONE; ActionMain act_next; ActionAux act_aux = 0; #if HAVE_X Display *main_dpy = NULL; int main_screen = 0; #endif TVMode main_mode; TVRegs main_regs; int main_head; OptIntVal *opt_set_tail = NULL; opterr = 0; while ((c = getopt_long (argc, argv, short_options, long_options, NULL)) != EOF) { act_next = ACTION_NONE; switch(c) { case 'h': /* Print usage */ case '?': usage(); break; case 'D': opt_dpy = optarg; break; case '.': /* Gtk/Gdk option, ignore */ break; case 'n': opt_no_root = TRUE; break; case 'r': if (!optarg || sscanf (optarg, "%i,%i", &opt_res_x, &opt_res_y) != 2) usage (); break; case 'o': if (!optarg || sscanf (optarg, "%f,%f", &opt_hoc, &opt_voc) != 2) usage (); break; case 'd': opt_debug = TRUE; break; case 'm': act_next = ACTION_TVOFF; break; case 't': act_next = ACTION_TVON; break; case 'b': act_next = ACTION_TVBARS; break; case 'p': act_next = ACTION_PRINT; break; case 'P': act_next = ACTION_PROBE; break; case 'g': act_next = ACTION_GUI; break; case 'q': act_next = ACTION_QUERY; break; case 'l': act_next = ACTION_LIST; break; case 's': if (optarg) opt_size = optarg; break; case 'S': if (optarg && strcasecmp (optarg, "ntsc") == 0) opt_system = TV_SYSTEM_NTSC; else if (optarg && strcasecmp (optarg, "ntsc-j") == 0) opt_system = TV_SYSTEM_NTSC_J; else if (optarg && strcasecmp (optarg, "pal") == 0) opt_system = TV_SYSTEM_PAL; else if (optarg && strcasecmp (optarg, "pal-60") == 0) opt_system = TV_SYSTEM_PAL_60; else if (optarg && strcasecmp (optarg, "pal-n") == 0) opt_system = TV_SYSTEM_PAL_N; else if (optarg && strcasecmp (optarg, "pal-nc") == 0) opt_system = TV_SYSTEM_PAL_NC; else if (optarg && strcasecmp (optarg, "pal-m") == 0) opt_system = TV_SYSTEM_PAL_M; else if (optarg && strcasecmp (optarg, "pal-m60") == 0) opt_system = TV_SYSTEM_PAL_M60; else if (optarg && strcasecmp (optarg, "pal-x") == 0) opt_system = TV_SYSTEM_PAL_X; else if (optarg && strcasecmp (optarg, "secam") == 0) opt_system = TV_SYSTEM_SECAM; else usage (); break; case 'C': if (optarg && strcasecmp (optarg, "auto") == 0) opt_connect = CONNECT_AUTO; else if (optarg && strcasecmp (optarg, "fbas") == 0) opt_connect = CONNECT_COMPOSITE; else if (optarg && strcasecmp (optarg, "composite") == 0) opt_connect = CONNECT_COMPOSITE; else if (optarg && strcasecmp (optarg, "svhs") == 0) opt_connect = CONNECT_SVIDEO; else if (optarg && strcasecmp (optarg, "svideo") == 0) opt_connect = CONNECT_SVIDEO; else if (optarg && strcasecmp (optarg, "both") == 0) opt_connect = CONNECT_BOTH; else if (optarg && strcasecmp (optarg, "convert") == 0) opt_connect = CONNECT_CONVERT; else usage (); break; case 'T': if (optarg && strcasecmp (optarg, "brooktree") == 0) opt_tv_chip = TV_BROOKTREE; else if (optarg && strcasecmp (optarg, "conexant") == 0) opt_tv_chip = TV_CONEXANT; else if (optarg && strcasecmp (optarg, "chrontel1") == 0) opt_tv_chip = TV_CHRONTEL_MODEL1; else if (optarg && strcasecmp (optarg, "chrontel2") == 0) opt_tv_chip = TV_CHRONTEL_MODEL2; else if (optarg && strcasecmp (optarg, "chrontel") == 0) opt_tv_chip = TV_CHRONTEL_MODEL1; else if (optarg && strcasecmp (optarg, "philips1") == 0) opt_tv_chip = TV_PHILIPS_MODEL1; else if (optarg && strcasecmp (optarg, "philips2") == 0) opt_tv_chip = TV_PHILIPS_MODEL2; else if (optarg && strcasecmp (optarg, "philips") == 0) opt_tv_chip = TV_PHILIPS_MODEL1; else if (optarg && strcasecmp (optarg, "nvidia") == 0) opt_tv_chip = TV_NVIDIA; else if (optarg && sscanf (optarg, "%i:%x", &opt_tv_bus, &opt_tv_addr) == 2) opt_tv_chip = TV_CHIP_BY_ADDR; else usage (); break; case 'A': if (!optarg || sscanf (optarg, "%x:%x.%x", &opt_pci_bus, &opt_pci_slot, &opt_pci_func) < 2) usage (); break; case 'w': opt_window_name = optarg; break; #if HAVE_X case 'W': if (sscanf (optarg, "0x%lx", &opt_window) != 1) opt_window = None; if (opt_window == None) { if (sscanf (optarg, "%ld", &opt_window) != 1) opt_window = None; } if (opt_window == None) RAISE (MSG_ERROR, "Invalid window id format: %s.", optarg); break; #endif case 'c': act_aux |= ACTION_CENTER; break; case 'X': act_aux |= ACTION_XMODE; break; case 'F': act_aux |= ACTION_FETCH; break; case 'N': opt_nvdev = TRUE; break; case '1': opt_head = 1; break; case '2': opt_head = 2; break; case 300: if (!processOptSet (optarg, &opt_set_act, &opt_set_tail)) usage (); break; } if (act_next != ACTION_NONE) { if (act_main != ACTION_NONE) { RAISE (MSG_WARNING, "More than one action. Choosing last one."); } act_main = act_next; } } /* Do the probing right away, without processing any other options. */ if (act_main == ACTION_PROBE) { #ifdef DEBUG_PROBE #ifdef USE_UNIX_BACKEND if (back_root_avail ()) { main_card_list = back_root_init (); } else if (opt_nvdev && back_nvdev_avail (TRUE)) { main_card_list = back_nvdev_init (); } #endif #ifdef USE_MSWIN_BACKEND if (back_win_avail ()) { main_card_list = back_win_init (); } #endif else { main_card_list = NULL; } if (!main_card_list) { RAISE (MSG_ABORT, "Either you are not root, or no NVidia card found."); } main_card = findCard (main_card_list); bdir_probeSystem (main_card); return 0; #else RAISE (MSG_ABORT, "No probing enabled in this built."); #endif } /* Start to process the options. First, if -s/-o is specified, default -r and -S, and assume -g if no main action is present. */ if (opt_size || opt_hoc >= 0.0 || opt_voc >= 0.0) { if (opt_system == TV_SYSTEM_NONE) { RAISE (MSG_INFO, "Defaulting to PAL TV system."); opt_system = TV_SYSTEM_PAL; } if (opt_res_x <= 0) { opt_res_x = 800; RAISE (MSG_INFO, "Defaulting to x resolution %i", opt_res_x); } if (opt_res_y <= 0) { opt_res_y = 600; RAISE (MSG_INFO, "Defaulting to y resolution %i", opt_res_y); } if (act_main == ACTION_NONE) { act_main = ACTION_GUI; } } if (act_main == ACTION_NONE && !act_aux) { act_main = ACTION_GUI; } /* Next, choose the backend. If a main action is present, always try to get a backend. If -n is specified, force the null backend. For the list of modes and printing, we can get away with having the null backend, as well, unless we have to fetch the mode. */ if (act_main != ACTION_NONE) { if (opt_no_root) { RAISE (MSG_DEBUG, "init null"); main_card = main_card_list = back_null_init (); } else { #ifdef USE_UNIX_BACKEND if (back_root_avail ()) { RAISE (MSG_DEBUG, "init root"); main_card_list = back_root_init (); } #endif #ifdef USE_MSWIN_BACKEND if (back_win_avail ()) { RAISE (MSG_DEBUG, "init root"); main_card_list = back_win_init (); } #endif #ifdef USE_CLIENT_BACKEND else if (back_client_avail ()) { RAISE (MSG_DEBUG, "init client"); main_card_list = back_client_init (); } #endif #ifdef USE_UNIX_BACKEND else if (opt_nvdev && back_nvdev_avail (TRUE)) { RAISE (MSG_DEBUG, "init nvdev"); main_card_list = back_nvdev_init (); } #endif else if (act_main == ACTION_PRINT && ! (act_aux & ACTION_FETCH) || act_main == ACTION_LIST && (opt_tv_chip != TV_NO_CHIP)) { RAISE (MSG_DEBUG, "init null"); main_card_list = back_null_init (); } else { RAISE (MSG_ABORT, "%s%s", "Cannot access video cards. Either you " "are not root, or the\nNVidia devices are not accessible.", (act_main == ACTION_LIST) ? "\n(For a list of modes, please " "specify the encoder chip in this case.)" : ""); } } if (!main_card_list) { RAISE (MSG_ABORT, "No supported video card found."); } main_card = findCard (main_card_list); if (!main_card) { RAISE (MSG_ABORT, "No supported video card found at specified address."); } } /* Next, open the card specified by --card-addr (or the first one), unless the main action is none or the gui. Find the right chip, if specified. Note: If printing, we can find all tv chip types in the null backend. */ if (act_main != ACTION_NONE && act_main != ACTION_GUI && act_main != ACTION_DEBUG) { back_access->openCard (main_card); if (opt_head != -1 && (act_main == ACTION_TVON || act_main == ACTION_TVOFF)) { back_card->getHeads (&main_head, NULL, NULL, NULL); back_card->setHeads (-1, opt_head, opt_head); if (act_main == ACTION_TVON && opt_head != main_head && ! back_card->getTwinView (NULL, NULL)) { back_card->initSharedView (NULL, NULL); } } if (opt_tv_chip != TV_NO_CHIP) { ChipPtr chip; for (chip = main_card->chips; chip; chip = chip->next) { if (opt_tv_chip == chip->type || (opt_tv_chip == TV_CHIP_BY_ADDR && opt_tv_bus == chip->bus && opt_tv_addr == chip->addr)) break; } if (chip) { if (opt_tv_chip == TV_CHIP_BY_ADDR) { opt_tv_chip = chip->type; } back_card->setChip (chip, TRUE); /* FIXME: Should set head here */ } else { RAISE (MSG_ABORT, "Cannot find specified chip."); } } } /* Next, find the mode for printing -p and tv-on -t. This is required, fail if no mode is found. */ if ((act_aux & ACTION_FETCH) && act_main != ACTION_PRINT) { RAISE (MSG_WARNING, "Can only fetch mode for printing. Ignoring option."); } if (act_main == ACTION_TVON || act_main == ACTION_PRINT) { if (opt_size) { if (! back_card->findBySize (opt_system, opt_res_x, opt_res_y, opt_size, &main_mode)) { RAISE (MSG_ABORT, "Cannot find '%s' mode %i x %i \n" "Please specify as e.g. -r 800,600 -s Large\n", opt_size, opt_res_x, opt_res_y); } } else if (opt_hoc >= 0.0 || opt_voc >= 0.0) { if (opt_hoc < 0.0) opt_hoc = 0.10; if (opt_voc < 0.0) opt_voc = 0.10; /* FIXME: Defaulting message */ /* FIXME: findByOverscan */ RAISE (MSG_ABORT, "Specifying modes by overscan is not implemented yet."); } else if (act_main == ACTION_PRINT && (act_aux & ACTION_FETCH)) { back_card->getMode (&main_mode.regs); main_mode.spec.system = TV_SYSTEM_NONE; main_mode.spec.res_x = 0; main_mode.spec.res_y = 0; main_mode.spec.size = "Fetch"; main_mode.spec.aspect = ""; main_mode.spec.hoc = 0.0; main_mode.spec.voc = 0.0; main_mode.descFlags = 0; } else { RAISE (MSG_ABORT, "No mode specified.\n" "Please specify as e.g. -r 800,600 -s Large"); } } /* For tv-off, the auxiliary actions or the gui, we need a display */ if (act_main == ACTION_GUI || act_main == ACTION_TVOFF || act_aux) { #if HAVE_GTK /* For some reason, just XOpenDisplay is not enough if GDK is linked in / to be used later. */ gdk_init (&argc, &argv); #if HAVE_X main_dpy = gdk_display; main_screen = my_gdk_screen; #endif #else #if HAVE_X main_dpy = XOpenDisplay (opt_dpy); main_screen = DefaultScreen (main_dpy); #endif #endif } /* For tv-off, we need a monitor mode. Get it with the XVidMode extension, and default resolution, if necessary. */ if (act_main == ACTION_TVOFF) { main_regs.devFlags = DEV_MONITOR; #if HAVE_X if (opt_res_x > 0 && opt_res_y > 0) { find_vidmode (main_dpy, main_screen, opt_res_x, opt_res_y, &main_regs.crtc, data_card_func(main_card->type)->make); } else if (get_vidmode (main_dpy, main_screen, &opt_res_x, &opt_res_y, &main_regs.crtc, data_card_func(main_card->type)->make)) { } else #endif if (opt_size && data_vesa_mode (opt_size, &main_regs.crtc, data_card_func(main_card->type)->make)) { } else { RAISE (MSG_ABORT, "No monitor mode to switch tv off. " "You need the XVidMode extension.\n"); } /* NOTE: There must be a valid mode in main_crt here */ } /* If there is still no resolution (i.e., opt_res both -1), then we cannot switch the X mode, even if requested, so disable that */ if ((act_aux & ACTION_XMODE) && ((opt_res_x < 0) || (opt_res_y < 0))) { act_aux &= ~ACTION_XMODE; RAISE (MSG_WARNING, "No resolution found. Switching X mode disabled."); } /* Finally, modify the settings, unless the main action is none, gui, query, list, or tv off. */ if (act_main != ACTION_NONE && act_main != ACTION_GUI && act_main != ACTION_DEBUG && act_main != ACTION_QUERY && act_main != ACTION_TVOFF && act_main != ACTION_LIST && back_card) { back_card->getSettings (&opt_set); if (opt_connect > CONNECT_NONE) { opt_set.connector = opt_connect; } else { opt_set.connector = CONNECT_BOTH; } modifySet (&opt_set, opt_set_act); opt_set.flags = opt_mode_flags; /* FIXME: Should probe if CONNECT_AUTO */ } /* Now we start executing the actions. Printing, color bars and debugging ignore the auxiliary actions, and are handled first. */ switch (act_main) { case ACTION_TVBARS: back_card->setTestImage (NULL, &opt_set); return 0; case ACTION_PRINT: printRegs (&main_mode, main_card->type, (opt_tv_chip == TV_NO_CHIP && main_card->chips) ? main_card->chips->type : opt_tv_chip); return 0; case ACTION_DEBUG: doDebug (); return 0; case ACTION_QUERY: return doQuery (opt_head); case ACTION_LIST: return doList (main_card); default: break; } /* If we reached this point, we have to process the auxiliary options. If the action is tv-off, we should execute the action first, so switching the X mode comes afterwards. There must be valid monitor mode in main_crt at this point. */ if (act_main == ACTION_TVOFF) { back_card->setMode (&main_regs); } /* Now, switch the X mode */ #if HAVE_X if (act_aux & ACTION_XMODE) { switch_vidmode (main_dpy, main_screen, opt_res_x, opt_res_y); XSync (main_dpy, False); } #endif /* Next, look for the window. */ #if HAVE_X if (opt_window_name) { opt_window = Window_With_Name (main_dpy, RootWindow(main_dpy, main_screen), opt_window_name); if (opt_window == None) { RAISE (MSG_ERROR, "No window with name '%s' exists.", opt_window_name); } } #endif /* Next, center the window, with respect to the resolution, if given. */ #if HAVE_X if (act_aux & ACTION_CENTER) { if (opt_window != None) { center_window (main_dpy, main_screen, opt_window, opt_res_x, opt_res_y); } else { RAISE (MSG_ABORT, "No window specified."); } } #endif /* Next, switch tv mode on. The main_mode must be a valid tv mode at this point. */ if (act_main == ACTION_TVON) { main_mode.regs.devFlags = DEV_MONITOR | DEV_TELEVISION; if (opt_mode_mask & TV_DESC_DUALVIEW) { if (! (opt_mode_flags & TV_DESC_DUALVIEW)) main_mode.regs.devFlags = DEV_TELEVISION; } back_card->setModeSettings (&main_mode.regs, &opt_set); } /* Finally, start the gui. */ if (act_main == ACTION_GUI) { #ifdef HAVE_GTK gui_main (argc, argv, main_card); #else RAISE (MSG_ABORT, "Compiled without gui"); #endif } return 0; } /* ------------------------------------------------------------------- Table of options/action: mode backend card head none -r -X -c no no ignore no gui -g -r -X -s/-o -S -c -C/-f opt yes ignore no on -t -r -X -s/-o -S -c -C/-f -1/2 yes yes open yes off -m -r -X -c -1/2 no yes open yes bars -b -C/-f no yes open no prt -p -r -F -s/-o -S yes yes/none open no qry -q -1/2 no yes open yes -P -d Rules: If only -s/-o is given, -r and -S are defaulted, regardless of action. If -s/-o is specified and no action given, assume -g. For -g, only auxiliary options are executed. No mode search, no settings. Mode search is only done for -t and -p, and aborts if none is found/specified. If card is opened, --chip will be respected. ---------------------------------------------------------------------- xine --display-ratio 0.979 # for 768x576 Large Not implemented yet: -x --x-options standard x options follow GDK Options: + --display + --sync + --no-xshm + --name + --class --gxid_host --gxid_port --xim-preedit --xim-status GTK Options --gtk-module --g-fatal-warnings */ nvtv-0.4.7/src/print.c0000644000175000001440000002170607671624133010302 /* NVTV actions -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * Contents: Printing actions. * */ #include "local.h" /* before everything else */ #include #include "print.h" /* -------- Print actions -------- */ /* FIXME TODO print_nv_fp_regs */ void print_nv_regs (TVNvRegs *m) { printf ("*** CRT Registers\n"); printf (" Clock : %li,\n", m->clock); printf (" HDisplay : %i,\n", m->HDisplay); printf (" HSyncStart : %i,\n", m->HSyncStart); printf (" HSyncEnd : %i,\n", m->HSyncEnd); printf (" HTotal : %i,\n", m->HTotal); printf (" HBlankStart : %i,\n", m->HBlankStart); printf (" HBlankEnd : %i,\n", m->HBlankEnd); printf (" VDisplay : %i,\n", m->VDisplay); printf (" VSyncStart : %i,\n", m->VSyncStart); printf (" VSyncEnd : %i,\n", m->VSyncEnd); printf (" VTotal : %i,\n", m->VTotal); printf (" VBlankStart : %i,\n", m->VBlankStart); printf (" VBlankEnd : %i,\n", m->VBlankEnd); printf (" Latency : %i,\n", m->latency); } void print_nv_fp_regs (TVNvFpRegs *m) { printf ("*** FP Registers\n"); printf (" HDisplay : %i,\n", m->HDisplay); printf (" HSyncStart : %i,\n", m->HSyncStart); printf (" HSyncEnd : %i,\n", m->HSyncEnd); printf (" HTotal : %i,\n", m->HTotal); printf (" HValidStart : %i,\n", m->HValidStart); printf (" HValidEnd : %i,\n", m->HValidEnd); printf (" HCrtc : %i,\n", m->HCrtc); printf (" VDisplay : %i,\n", m->VDisplay); printf (" VSyncStart : %i,\n", m->VSyncStart); printf (" VSyncEnd : %i,\n", m->VSyncEnd); printf (" VTotal : %i,\n", m->VTotal); printf (" VValidStart : %i,\n", m->VValidStart); printf (" VValidEnd : %i,\n", m->VValidEnd); printf (" VCrtc : %i,\n", m->VCrtc); } void print_crt_regs (TVCrtcRegs *m, CardType card) { switch (card) { case CARD_NVIDIA: case CARD_XBOX: print_nv_regs (&m->nv); break; default: break; } } void print_fp_regs (TVCrtcRegs *m, CardType card) { switch (card) { case CARD_NVIDIA: case CARD_XBOX: print_nv_fp_regs (&m->nv.fp); break; default: break; } } void print_nx_regs (TVNxRegs *r) { printf ("*** NVidia internal registers\n"); printf (" filter : %i,\n", r->filter); printf (" scaler_h : %i,\n", r->img.scaler_h); printf (" scaler_v : %i,\n", r->img.scaler_v); printf (" overscan : %i,\n", r->img.overscan); printf (" vip1 : %i,\n", r->img.vip1); printf (" vip2 : %i,\n", r->img.vip2); printf (" fsub : %li,\n", r->ind.fsub); printf (" reg04 : %i,\n", r->ind.nxreg04); printf (" reg08 : %i,\n", r->ind.nxreg08); printf (" reg09 : %i,\n", r->ind.nxreg09); printf (" reg0a : %i,\n", r->ind.nxreg0a); printf (" reg0b : %i,\n", r->ind.nxreg0b); printf (" reg0c : %i,\n", r->ind.nxreg0c); printf (" reg0e : %i,\n", r->ind.nxreg0e); printf (" reg10 : %i,\n", r->ind.nxreg10); printf (" reg17 : %i,\n", r->ind.nxreg17); printf (" reg1e : %i,\n", r->ind.nxreg1e); printf (" reg20 : %i,\n", r->ind.nxreg20); printf (" reg22 : %i,\n", r->ind.nxreg22); printf (" reg29 : %i,\n", r->ind.nxreg29); printf (" reg2c : %i,\n", r->ind.nxreg2c); printf (" reg31 : %i,\n", r->ind.nxreg31); printf (" reg35 : %i,\n", r->ind.nxreg35); printf (" reg3c : %i,\n", r->ind.nxreg3c); printf (" sys12 : %i,\n", r->ind.nxsys12); } void print_bt_regs (TVBtRegs *b) { printf ("*** Brooktree Registers\n"); printf (" hsynoffset : %i,\n", b->hsynoffset); printf (" vsynoffset : %i,\n", b->vsynoffset); printf (" hsynwidth : %i,\n", b->hsynwidth); printf (" vsynwidth : %i,\n", b->vsynwidth); printf (" h_active : %i,\n", b->h_active); printf (" h_blanki : %i,\n", b->h_blanki); printf (" h_clki : %i,\n", b->h_clki); printf (" h_fract : %i,\n", b->h_fract); printf (" h_blanko : %i,\n", b->h_blanko); printf (" h_clko : %i,\n", b->h_clko); printf (" v_activei : %i,\n", b->v_activei); printf (" v_blanki : %i,\n", b->v_blanki); printf (" v_linesi : %i,\n", b->v_linesi); printf (" v_activeo : %i,\n", b->v_activeo); printf (" v_blanko : %i,\n", b->v_blanko); printf (" v_scale : %i,\n", b->v_scale); printf (" pll_fract : %i,\n", b->pll_fract); printf (" pll_int : %i,\n", b->pll_int); printf (" sync_amp : %i,\n", b->sync_amp); printf (" bst_amp : %i,\n", b->bst_amp); printf (" hsync_width : %i,\n", b->hsync_width); printf (" hburst_begin : %i,\n", b->hburst_begin); printf (" hburst_end : %i,\n", b->hburst_end); printf (" mcr : %i,\n", b->mcr); printf (" mcb : %i,\n", b->mcb); printf (" my : %i,\n", b->my); printf (" msc : %li,\n", b->msc); /* FIXME TODO flags */ } void print_ch1_regs (TVChRegs *r) { printf ("*** Chrontel Registers\n"); printf (" dmr_ir : %i,\n", r->dmr_ir); printf (" dmr_vs : %i,\n", r->dmr_vs); printf (" dmr_sr : %i,\n", r->dmr_sr); printf (" sav : %i,\n", r->sav); printf (" hpr : %i,\n", r->hpr); printf (" vpr : %i,\n", r->vpr); printf (" pll_m : %i,\n", r->pll_m); printf (" pll_n : %i,\n", r->pll_n); printf (" pllcap : %i,\n", r->pllcap); printf (" dacg : %i,\n", r->dacg); printf (" fsci : %li,\n", r->fsci); printf (" ffr_fc : %i,\n", r->ffr_fc); printf (" ffr_fy : %i,\n", r->ffr_fy); printf (" ffr_ft : %i,\n", r->ffr_ft); printf (" blr : %i,\n", r->blr); printf (" ce : %i,\n", r->ce); printf (" vbw_flff : %i,\n", r->vbw_flff); printf (" vbw_cbw : %i,\n", r->vbw_cbw); printf (" vbw_ypeak : %i,\n", r->vbw_ypeak); printf (" vbw_ysv : %i,\n", r->vbw_ysv); printf (" vbw_ycv : %i,\n", r->vbw_ycv); /* FIXME TODO flags */ } void print_ch2_regs (TVChRegs *r) { } void print_ph1_regs (TVPh1Regs *r) { printf ("adwhs : %i,\n", r->adwhs); printf ("adwhe : %i,\n", r->adwhe); printf ("xofs : %i,\n", r->xofs); printf ("xpix : %i,\n", r->xpix); printf ("xinc : %i,\n", r->xinc); printf ("hlen : %i,\n", r->hlen); printf ("fal : %i,\n", r->fal); printf ("lal : %i,\n", r->lal); printf ("yinc : %i,\n", r->yinc); printf ("yskip : %i,\n", r->yskip); printf ("yofso : %i,\n", r->yofso); printf ("yofse : %i,\n", r->yofse); printf ("ypix : %i,\n", r->ypix); printf ("yiwgto : %i,\n", r->yiwgto); printf ("yiwgte : %i,\n", r->yiwgte); printf ("pcl : %li,\n", r->pcl); printf ("fsc : %li,\n", r->fsc); printf ("idel : %i,\n", r->idel); printf ("bs : %i,\n", r->bs); printf ("be : %i,\n", r->be); printf ("bsta : %i,\n", r->bsta); printf ("blckl : %i,\n", r->blckl); printf ("blnnl : %i,\n", r->blnnl); printf ("chps : %i,\n", r->chps); printf ("gy : %i,\n", r->gy); printf ("gcd : %i,\n", r->gcd); printf ("bcy : %i,\n", r->bcy); printf ("bcu : %i,\n", r->bcu); printf ("bcv : %i,\n", r->bcv); printf ("ccrs : %i,\n", r->ccrs); printf ("gainu : %i,\n", r->gainu); printf ("gainv : %i,\n", r->gainv); /* FIXME flags1, flags2; */ } void print_ph2_regs (TVPh2Regs *r) { print_ph1_regs (&r->super); printf ("yfil : %i,\n", r->yfil); printf ("fili : %i,\n", r->fili); printf ("pcle : %i,\n", r->pcle); printf ("pcli : %i,\n", r->pcli); /* FIXME flags3; */ } void print_tv_regs (TVEncoderRegs *c, TVChip type) { switch (type & TV_ENCODER) { case TV_BROOKTREE: case TV_CONEXANT: print_bt_regs (&c->bt); break; case TV_CHRONTEL_MODEL1: print_ch1_regs (&c->ch); break; case TV_CHRONTEL_MODEL2: print_ch2_regs (&c->ch); break; case TV_PHILIPS_MODEL1: print_ph1_regs (&c->ph1); break; case TV_PHILIPS_MODEL2: print_ph2_regs (&c->ph2); break; case TV_NVIDIA: print_nx_regs (&c->nx); default: break; } } nvtv-0.4.7/src/libc_wrapper.c0000644000175000001440000000423707624210641011610 /* Excerpt from: */ /* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.70 2000/09/26 15:57:20 tsi Exp $ */ /* * Copyright 1997 by The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of Orest Zborowski and David Wexelblat * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. Orest Zborowski * and David Wexelblat make no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * THE XFREE86 PROJECT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID WEXELBLAT BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #include "local.h" #include #ifdef HAVE_UNISTD_H #include #endif #include /* Misc functions. Some are ANSI C, some are not. */ /* FIXME might use nanosleep (POSIX) here. */ /* resolution of 1/HZ s (i.e, 10 ms on Linux/i386 and 1 ms on Linux/Alpha). */ /* If the process is scheduled under a real-time policy like SCHED_FIFO or SCHED_RR, then pauses of up to 2 ms will be performed as busy waits with microsecond precision. */ void xf86usleep(usec) unsigned long usec; { #if (defined(SYSV) || defined(SVR4)) && !defined(sun) syscall(3112, (usec) / 1000 + 1); #else usleep(usec); #endif } void xf86getsecs(long * secs, long * usecs) { struct timeval tv; gettimeofday(&tv, NULL); *secs = tv.tv_sec; *usecs= tv.tv_usec; return; } nvtv-0.4.7/src/xf86i2c.c0000644000175000001440000005241107617540267010341 /* * Copyright (C) 1998 Itai Nahshon, Michael Schimek * * The original code was derived from and inspired by * the I2C driver from the Linux kernel. * (c) 1998 Gerd Knorr */ /* $XFree86: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c,v 1.6 1999/06/12 15:37:08 dawes Exp $ */ #include "local.h" #include "xfree.h" #include "xf86_ansic.h" #include #if 0 #define NULL ((void *)0) #include "misc.h" #include "xf86.h" #include "xf86_ansic.h" #include "xf86_OSproc.h" #include "X.h" #include "Xproto.h" #include "scrnintstr.h" #include "regionstr.h" #include "windowstr.h" #include "pixmapstr.h" #include "validate.h" #include "resource.h" #include "gcstruct.h" #include "dixstruct.h" /* #else */ typedef int Bool; typedef void *Pointer; #define TRUE 1 #define FALSE 0 #endif #include "xf86i2c.h" #define I2C_TIMEOUT(x) /*(x)*/ /* Report timeouts */ #define I2C_TRACE(x) /*(x)*/ /* Report progress */ /* Set which OSs have bad gettimeofday resolution. */ #if defined(SVR4) && !defined(sun) #define BAD_GETTIMEOFDAY_RESOLUTION #endif /* This is the default I2CUDelay function if not supplied by the driver. * High level I2C interfaces implementing the bus protocol in hardware * should supply this function too. * * Delay execution at least usec microseconds. * All values 0 to 1e6 inclusive must be expected. */ #ifdef BAD_GETTIMEOFDAY_RESOLUTION /* * This is temporary until a better, portable * way is found. Adjust bogo_usec to match CPU speed. */ static int bogo_usec = 500; static void I2CUDelay(I2CBusPtr b, int usec) { volatile long i; if (usec > 0) for (i = usec * bogo_usec; i > 0; i--) /* (perhaps hw delay action) */; } #else static void I2CUDelay(I2CBusPtr b, int usec) { long b_secs, b_usecs; long a_secs, a_usecs; long d_secs, d_usecs; long diff; if (usec > 0) { xf86getsecs(&b_secs, &b_usecs); do { /* It would be nice to use {xf86}usleep, * but usleep (1) takes >10000 usec ! */ xf86getsecs(&a_secs, &a_usecs); d_secs = (a_secs - b_secs); d_usecs = (a_usecs - b_usecs); diff = d_secs*1000000 + d_usecs; } while (diff>0 && diff< (usec + 1)); } } #endif /* Most drivers will register just with GetBits/PutBits functions. * The following functions implement a software I2C protocol * by using the promitive functions given by the driver. * ================================================================ * * It is assumed that there is just one master on the I2C bus, therefore * there is no explicit test for conflits. */ #define RISEFALLTIME 2 /* usec, actually 300 to 1000 ns according to the i2c specs */ /* Some devices will hold SCL low to slow down the bus or until * ready for transmission. * * This condition will be noticed when the master tries to raise * the SCL line. You can set the timeout to zero if the slave device * does not support this clock synchronization. */ static Bool I2CRaiseSCL(I2CBusPtr b, int sda, int timeout) { int i, scl; b->I2CPutBits(b, 1, sda); b->I2CUDelay(b, b->RiseFallTime); for (i = timeout; i > 0; i -= b->RiseFallTime) { b->I2CGetBits(b, &scl, &sda); if (scl) break; b->I2CUDelay(b, b->RiseFallTime); } if (i <= 0) { I2C_TIMEOUT(ErrorF("[I2CRaiseSCL(<%s>, %d, %d) timeout]", b->BusName, sda, timeout)); return FALSE; } return TRUE; } /* Send a start signal on the I2C bus. The start signal notifies * devices that a new transaction is initiated by the bus master. * * The start signal is always followed by a slave address. * Slave addresses are 8+ bits. The first 7 bits identify the * device and the last bit signals if this is a read (1) or * write (0) operation. * * There may be more than one start signal on one transaction. * This happens for example on some devices that allow reading * of registers. First send a start bit followed by the device * address (with the last bit 0) and the register number. Then send * a new start bit with the device address (with the last bit 1) * and then read the value from the device. * * Note this is function does not implement a multiple master * arbitration procedure. */ static Bool I2CStart(I2CBusPtr b, int timeout) { int i, scl, sda; b->I2CPutBits(b, 1, 1); b->I2CUDelay(b, b->RiseFallTime); for (i = timeout; i > 0; i -= b->RiseFallTime) { b->I2CGetBits(b, &scl, &sda); if (scl) break; b->I2CUDelay(b, b->RiseFallTime); } if (i <= 0) { I2C_TIMEOUT(ErrorF("\ni2c: <[I2CStart(<%s>, %d) timeout]", b->BusName, timeout)); return FALSE; } b->I2CPutBits(b, 1, 0); b->I2CUDelay(b, b->HoldTime); b->I2CPutBits(b, 0, 0); b->I2CUDelay(b, b->HoldTime); I2C_TRACE(ErrorF("\ni2c: <")); return TRUE; } /* This is the default I2CStop function if not supplied by the driver. * * Signal devices on the I2C bus that a transaction on the * bus has finished. There may be more than one start signal * on a transaction but only one stop signal. */ static void I2CStop(I2CDevPtr d) { I2CBusPtr b = d->pI2CBus; b->I2CPutBits(b, 0, 0); b->I2CUDelay(b, b->RiseFallTime); b->I2CPutBits(b, 1, 0); b->I2CUDelay(b, b->HoldTime); b->I2CPutBits(b, 1, 1); b->I2CUDelay(b, b->HoldTime); I2C_TRACE(ErrorF(">\n")); } /* Write/Read a single bit to/from a device. * Return FALSE if a timeout occurs. */ static Bool I2CWriteBit(I2CBusPtr b, int sda, int timeout) { Bool r; b->I2CPutBits(b, 0, sda); b->I2CUDelay(b, b->RiseFallTime); r = I2CRaiseSCL(b, sda, timeout); b->I2CUDelay(b, b->HoldTime); b->I2CPutBits(b, 0, sda); b->I2CUDelay(b, b->HoldTime); return r; } static Bool I2CReadBit(I2CBusPtr b, int *psda, int timeout) { Bool r; int scl; r = I2CRaiseSCL(b, 1, timeout); b->I2CUDelay(b, b->HoldTime); b->I2CGetBits(b, &scl, psda); b->I2CPutBits(b, 0, 1); b->I2CUDelay(b, b->HoldTime); return r; } /* This is the default I2CPutByte function if not supplied by the driver. * * A single byte is sent to the device. * The function returns FALSE if a timeout occurs, you should send * a stop condition afterwards to reset the bus. * * A timeout occurs, * if the slave pulls SCL to slow down the bus more than ByteTimeout usecs, * or slows down the bus for more than BitTimeout usecs for each bit, * or does not send an ACK bit (0) to acknowledge the transmission within * AcknTimeout usecs, but a NACK (1) bit. * * AcknTimeout must be at least b->HoldTime, the other timeouts can be * zero according to the comment on I2CRaiseSCL. */ static Bool I2CPutByte(I2CDevPtr d, I2CByte data) { Bool r; int i, scl, sda; I2CBusPtr b = d->pI2CBus; if (!I2CWriteBit(b, (data >> 7) & 1, d->ByteTimeout)) return FALSE; for (i = 6; i >= 0; i--) if (!I2CWriteBit(b, (data >> i) & 1, d->BitTimeout)) return FALSE; b->I2CPutBits(b, 0, 1); b->I2CUDelay(b, b->RiseFallTime); r = I2CRaiseSCL(b, 1, b->HoldTime); if (r) { for (i = d->AcknTimeout; i > 0; i -= b->HoldTime) { b->I2CUDelay(b, b->HoldTime); b->I2CGetBits(b, &scl, &sda); if (sda == 0) break; } if (i <= 0) { I2C_TIMEOUT(ErrorF("[I2CPutByte(<%s>, 0x%02x, %d, %d, %d) timeout]", b->BusName, data, d->BitTimeout, d->ByteTimeout, d->AcknTimeout)); r = FALSE; } I2C_TRACE(ErrorF("W%02x%c ", (int) data, sda ? '-' : '+')); } b->I2CPutBits(b, 0, 1); b->I2CUDelay(b, b->HoldTime); return r; } /* This is the default I2CGetByte function if not supplied by the driver. * * A single byte is read from the device. * The function returns FALSE if a timeout occurs, you should send * a stop condition afterwards to reset the bus. * * A timeout occurs, * if the slave pulls SCL to slow down the bus more than ByteTimeout usecs, * or slows down the bus for more than b->BitTimeout usecs for each bit. * * ByteTimeout must be at least b->HoldTime, the other timeouts can be * zero according to the comment on I2CRaiseSCL. * * For the byte in a sequence the acknowledge bit NACK (1), * otherwise ACK (0) will be sent. */ static Bool I2CGetByte(I2CDevPtr d, I2CByte *data, Bool last) { int i, sda; I2CBusPtr b = d->pI2CBus; b->I2CPutBits(b, 0, 1); b->I2CUDelay(b, b->RiseFallTime); if (!I2CReadBit(b, &sda, d->ByteTimeout)) return FALSE; *data = (sda > 0) << 7; for (i = 6; i >= 0; i--) if (!I2CReadBit(b, &sda, d->BitTimeout)) return FALSE; else *data |= (sda > 0) << i; if (!I2CWriteBit(b, last ? 1 : 0, d->BitTimeout)) return FALSE; I2C_TRACE(ErrorF("R%02x%c ", (int) *data, last ? '+' : '-')); return TRUE; } /* This is the default I2CAddress function if not supplied by the driver. * * It creates the start condition, followed by the d->SlaveAddr. * Higher level functions must call this routine rather than * I2CStart/PutByte because a hardware I2C master may not be able * to send a slave address without a start condition. * * The same timeouts apply as with I2CPutByte and additional a * StartTimeout, similar to the ByteTimeout but for the start * condition. * * In case of a timeout, the bus is left in a clean idle condition. * I. e. you *must not* send a Stop. If this function succeeds, you *must*. * * The slave address format is 16 bit, with the legacy _8_bit_ slave address * in the least significant byte. This is, the slave address must include the * R/_W flag as least significant bit. * * The most significant byte of the address will be sent _after_ the LSB, * but only if the LSB indicates: * a) an 11 bit address, this is LSB = 1111 0xxx. * b) a 'general call address', this is LSB = 0000 000x - see the I2C specs * for more. */ static Bool I2CAddress(I2CDevPtr d, I2CSlaveAddr addr) { if (I2CStart(d->pI2CBus, d->StartTimeout)) { if (I2CPutByte(d, addr & 0xFF)) { if ((addr & 0xF8) != 0xF0 && (addr & 0xFE) != 0x00) return TRUE; if (I2CPutByte(d, (addr >> 8) & 0xFF)) return TRUE; } I2CStop(d); } return FALSE; } /* These are the hardware independent I2C helper functions. * ======================================================== */ /* Function for probing. Just send the slave address * and return true if the device responds. The slave address * must have the lsb set to reflect a read (1) or write (0) access. * Don't expect a read- or write-only device will respond otherwise. */ Bool xf86I2CProbeAddress(I2CBusPtr b, I2CSlaveAddr addr) { int r; I2CDevRec d; d.DevName = "Probing"; d.BitTimeout = b->BitTimeout; d.ByteTimeout = b->ByteTimeout; d.AcknTimeout = b->AcknTimeout; d.StartTimeout = b->StartTimeout; d.SlaveAddr = addr; d.pI2CBus = b; d.NextDev = NULL; r = b->I2CAddress(&d, addr); if (r) b->I2CStop(&d); return r; } /* All functions below are related to devices and take the * slave address and timeout values from an I2CDevRec. They * return FALSE in case of an error (presumably a timeout). */ /* General purpose read and write function. * * 1st, if nWrite > 0 * Send a start condition * Send the slave address (1 or 2 bytes) with write flag * Write n bytes from WriteBuffer * 2nd, if nRead > 0 * Send a start condition [again] * Send the slave address (1 or 2 bytes) with read flag * Read n bytes to ReadBuffer * 3rd, if a Start condition has been successfully sent, * Send a Stop condition. * * The functions exits immediately when an error occures, * not proceeding any data left. However, step 3 will * be executed anyway to leave the bus in clean idle state. */ Bool xf86I2CWriteRead(I2CDevPtr d, I2CByte *WriteBuffer, int nWrite, I2CByte *ReadBuffer, int nRead) { Bool r = TRUE; I2CBusPtr b = d->pI2CBus; int s = 0; if (r && nWrite > 0) { r = b->I2CAddress(d, d->SlaveAddr & ~1); if (r) { for (; nWrite > 0; WriteBuffer++, nWrite--) if (!(r = b->I2CPutByte(d, *WriteBuffer))) break; s++; } } if (r && nRead > 0) { r = b->I2CAddress(d, d->SlaveAddr | 1); if (r) { for (; nRead > 0; ReadBuffer++, nRead--) if (!(r = b->I2CGetByte(d, ReadBuffer, nRead == 1))) break; s++; } } if (s) b->I2CStop(d); return r; } /* Read a byte, the only readable register of a device. */ Bool xf86I2CReadStatus(I2CDevPtr d, I2CByte *pbyte) { return xf86I2CWriteRead(d, NULL, 0, pbyte, 1); } /* Read a byte from one of the registers determined by its sub-address. */ Bool xf86I2CReadByte(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte) { return xf86I2CWriteRead(d, &subaddr, 1, pbyte, 1); } /* Read bytes from subsequent registers determined by the * sub-address of the first register. */ Bool xf86I2CReadBytes(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte, int n) { return xf86I2CWriteRead(d, &subaddr, 1, pbyte, n); } /* Read a word (high byte, then low byte) from one of the registers * determined by its sub-address. */ Bool xf86I2CReadWord(I2CDevPtr d, I2CByte subaddr, unsigned short *pword) { I2CByte rb[2]; if (!xf86I2CWriteRead(d, &subaddr, 1, rb, 2)) return FALSE; *pword = (rb[0] << 8) | rb[1]; return TRUE; } /* Write a byte to one of the registers determined by its sub-address. */ Bool xf86I2CWriteByte(I2CDevPtr d, I2CByte subaddr, I2CByte byte) { I2CByte wb[2]; wb[0] = subaddr; wb[1] = byte; return xf86I2CWriteRead(d, wb, 2, NULL, 0); } /* Write bytes to subsequent registers determined by the * sub-address of the first register. */ Bool xf86I2CWriteBytes(I2CDevPtr d, I2CByte subaddr, I2CByte *WriteBuffer, int nWrite) { I2CBusPtr b = d->pI2CBus; Bool r = TRUE; if (nWrite > 0) { r = b->I2CAddress(d, d->SlaveAddr & ~1); if (r){ if ((r = b->I2CPutByte(d, subaddr))) for (; nWrite > 0; WriteBuffer++, nWrite--) if (!(r = b->I2CPutByte(d, *WriteBuffer))) break; b->I2CStop(d); } } return r; } /* Write a word (high byte, then low byte) to one of the registers * determined by its sub-address. */ Bool xf86I2CWriteWord(I2CDevPtr d, I2CByte subaddr, unsigned short word) { I2CByte wb[3]; wb[0] = subaddr; wb[1] = word >> 8; wb[2] = word & 0xFF; return xf86I2CWriteRead(d, wb, 3, NULL, 0); } /* Write a vector of bytes to not adjacent registers. This vector is, * 1st byte sub-address, 2nd byte value, 3rd byte sub-address asf. * This function is intended to initialize devices. Note this function * exits immediately when an error occurs, some registers may * remain uninitialized. */ Bool xf86I2CWriteVec(I2CDevPtr d, I2CByte *vec, int nValues) { I2CBusPtr b = d->pI2CBus; Bool r = TRUE; int s = 0; if (nValues > 0) { for (; nValues > 0; nValues--, vec += 2) { if (!(r = b->I2CAddress(d, d->SlaveAddr & ~1))) break; s++; if (!(r = b->I2CPutByte(d, vec[0]))) break; if (!(r = b->I2CPutByte(d, vec[1]))) break; } if (s > 0) b->I2CStop(d); } return r; } /* Administrative functions. * ========================= */ /* Allocates an I2CDevRec for you and initializes with propper defaults * you may modify before calling xf86I2CDevInit. Your I2CDevRec must * contain at least a SlaveAddr, and a pI2CBus pointer to the bus this * device shall be linked to. * * See function I2CAddress for the slave address format. Always set * the least significant bit, indicating a read or write access, to zero. */ I2CDevPtr xf86CreateI2CDevRec(void) { return xcalloc(1, sizeof(I2CDevRec)); } /* Unlink an I2C device. If you got the I2CDevRec from xf86CreateI2CDevRec * you should set to free it. */ void xf86DestroyI2CDevRec(I2CDevPtr d, Bool unalloc) { if (d) { I2CDevPtr *p; /* Remove this from the list of active I2C devices. */ for (p = &d->pI2CBus->FirstDev; *p != NULL; p = &(*p)->NextDev) if (*p == d) { *p = (*p)->NextDev; break; } if (d->pI2CBus->scrnIndex >= 0) xf86DrvMsg(d->pI2CBus->scrnIndex, X_INFO, "I2C device \"%s:%s\" removed.\n", d->pI2CBus->BusName, d->DevName); else xf86Msg(X_INFO, "I2C device \"%s:%s\" removed.\n", d->pI2CBus->BusName, d->DevName); if (unalloc) xfree(d); } } /* I2C transmissions are related to an I2CDevRec you must link to a * previously registered bus (see xf86I2CBusInit) before attempting * to read and write data. You may call xf86I2CProbeAddress first to * see if the device in question is present on this bus. * * xf86I2CDevInit will not allocate an I2CBusRec for you, instead you * may enter a pointer to a statically allocated I2CDevRec or the (modified) * result of xf86CreateI2CDevRec. * * If you don't specify timeouts for the device (n <= 0), it will inherit * the bus-wide defaults. The function returns TRUE on success. */ Bool xf86I2CDevInit(I2CDevPtr d) { I2CBusPtr b; if (d == NULL || (b = d->pI2CBus) == NULL || (d->SlaveAddr & 1) || xf86I2CFindDev(b, d->SlaveAddr) != NULL) return FALSE; if (d->BitTimeout <= 0) d->BitTimeout = b->BitTimeout; if (d->ByteTimeout <= 0) d->ByteTimeout = b->ByteTimeout; if (d->AcknTimeout <= 0) d->AcknTimeout = b->AcknTimeout; if (d->StartTimeout <= 0) d->StartTimeout = b->StartTimeout; d->NextDev = b->FirstDev; b->FirstDev = d; if(b->scrnIndex >= 0) xf86DrvMsg(b->scrnIndex, X_INFO, "I2C device \"%s:%s\" registered.\n", b->BusName, d->DevName); else xf86Msg(X_INFO, "I2C device \"%s:%s\" registered.\n", b->BusName, d->DevName); return TRUE; } I2CDevPtr xf86I2CFindDev(I2CBusPtr b, I2CSlaveAddr addr) { I2CDevPtr d; if (b) { for (d = b->FirstDev; d != NULL; d = d->NextDev) if (d->SlaveAddr == addr) return d; } return NULL; } static I2CBusPtr I2CBusList; /* Allocates an I2CBusRec for you and initializes with propper defaults * you may modify before calling xf86I2CBusInit. Your I2CBusRec must * contain at least a BusName, a scrnIndex (or -1), and a complete set * of either high or low level I2C function pointers. You may pass * bus-wide timeouts, otherwise inplausible values will be replaced * with safe defaults. */ I2CBusPtr xf86CreateI2CBusRec(void) { I2CBusPtr b; b = (I2CBusPtr) xcalloc(1, sizeof(I2CBusRec)); if (b != NULL) { b->scrnIndex = -1; b->HoldTime = 5; /* 100 kHz bus */ b->BitTimeout = 5; b->ByteTimeout = 5; b->AcknTimeout = 5; b->StartTimeout = 5; b->RiseFallTime = RISEFALLTIME; } return b; } /* Unregister an I2C bus. If you got the I2CBusRec from xf86CreateI2CBusRec * you should set to free it. If you set , the function * xf86DestroyI2CDevRec will be called for all devices linked to the bus * first, passing down the option. */ void xf86DestroyI2CBusRec(I2CBusPtr b, Bool unalloc, Bool devs_too) { if (b) { I2CBusPtr *p; /* Remove this from the list of active I2C busses. */ for (p = &I2CBusList; *p != NULL; p = &(*p)->NextBus) if (*p == b) { *p = (*p)->NextBus; break; } if (b->FirstDev != NULL) { if (devs_too) { I2CDevPtr d; while ((d = b->FirstDev) != NULL) xf86DestroyI2CDevRec(d, unalloc); } else { if (unalloc) { xf86Msg(X_ERROR, "i2c bug: Attempt to remove I2C bus \"%s\", " "but device list is not empty.\n", b->BusName); return; } } } if (b->scrnIndex >= 0) xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" removed.\n", b->BusName); else xf86Msg(X_INFO, "I2C bus \"%s\" removed.\n", b->BusName); if (unalloc) xfree(b); } } /* I2C masters have to register themselves using this function. * It will not allocate an I2CBusRec for you, instead you may enter * a pointer to a statically allocated I2CBusRec or the (modified) * result of xf86CreateI2CBusRec. Returns TRUE on success. * * At this point there won't be any traffic on the I2C bus. */ Bool xf86I2CBusInit(I2CBusPtr b) { /* I2C busses must be identified by a unique scrnIndex * and name. If scrnIndex is unspecified (a negative value), * then the name must be unique throughout the server. */ if (b->BusName == NULL || xf86I2CFindBus(b->scrnIndex, b->BusName) != NULL) return FALSE; /* If the high level functions are not * supplied, use the generic functions. * In this case we need the low-level * function. */ if (b->I2CPutBits == NULL || b->I2CGetBits == NULL) { if (b->I2CPutByte == NULL || b->I2CGetByte == NULL || b->I2CAddress == NULL || b->I2CStop == NULL) return FALSE; } else { b->I2CPutByte = I2CPutByte; b->I2CGetByte = I2CGetByte; b->I2CAddress = I2CAddress; b->I2CStop = I2CStop; } if (b->I2CUDelay == NULL) b->I2CUDelay = I2CUDelay; if (b->HoldTime < 2) b->HoldTime = 5; if (b->BitTimeout <= 0) b->BitTimeout = b->HoldTime; if (b->ByteTimeout <= 0) b->ByteTimeout = b->HoldTime; if (b->AcknTimeout <= 0) b->AcknTimeout = b->HoldTime; if (b->StartTimeout <= 0) b->StartTimeout = b->HoldTime; /* Put new bus on list. */ b->NextBus = I2CBusList; I2CBusList = b; if (b->scrnIndex >= 0) xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" initialized.\n", b->BusName); else xf86Msg(X_INFO, "I2C bus \"%s\" initialized.\n", b->BusName); return TRUE; } I2CBusPtr xf86I2CFindBus(int scrnIndex, char *name) { I2CBusPtr p; if (name != NULL) for (p = I2CBusList; p != NULL; p = p->NextBus) if (scrnIndex < 0 || p->scrnIndex == scrnIndex) if (!strcmp(p->BusName, name)) return p; return NULL; } nvtv-0.4.7/src/pipe.c0000644000175000001440000001540607741555571010112 /* NVTV pipe -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: pipe.c,v 1.12 2003/10/10 16:16:57 dthierbach Exp $ * * Contents: * * Routines to access the named pipe for server/client communication * */ #include "local.h" /* before everything else */ #include #include #include #include #include "pipe.h" /* * The communication will always include sizes and number of elements * sent, so even if there are version mismatches, the other end will be * able to properly synchronize. * A message consists of * - the command * - the number of arguments * - the size of each argument, followed by the argument itself */ /* * Read a command from a pipe */ PipeCmd pipeReadCmd (FILE *pipe) { PipeCmd cmd; RAISE (MSG_DEBUG, "pipe read cmd"); fread (&cmd, sizeof(PipeCmd), 1, pipe); RAISE (MSG_DEBUG, "pipe read cmd, got %i", cmd); return cmd; } /* * Write a command to a pipe */ void pipeWriteCmd (FILE *pipe, PipeCmd cmd) { RAISE (MSG_DEBUG, "pipe write cmd %i", cmd); fwrite (&cmd, sizeof(PipeCmd), 1, pipe); fflush (pipe); RAISE (MSG_DEBUG, "pipe write cmd done"); } /* * Write arguments to a pipe. Ellipsis paramaters are: * size1, pointer1, size2, pointer2, ..., 0 * Ignore zero size of null pointer arguments. */ void pipeWriteArgs (FILE *pipe, int n, ...) { va_list ap; int i, s; void *p; RAISE (MSG_DEBUG, "pipe write args"); fwrite (&n, sizeof(n), 1, pipe); va_start(ap, n); for (i = 0; i < n; i++) { s = va_arg(ap, int); p = va_arg(ap, void *); if (!p) s = 0; fwrite (&s, sizeof(s), 1, pipe); if (s != 0) { fwrite (p, s, 1, pipe); } } fflush (pipe); va_end(ap); } /* * Implements the three following read routines. Allocate elements * with zero size, and optionally set results. */ int pipeReadArgsMulti (FILE *pipe, int res, int n, va_list ap) { int i, j; int m, s, t, r; void *p; void **q; int ok; r = 0; fread (&m, sizeof(m), 1, pipe); ok = (m == n); for (i = 0; i < m; i++) { fread (&t, sizeof(t), 1, pipe); s = va_arg(ap, int); p = va_arg(ap, void *); if (ok) { if (s != 0 && t != 0 && s != t) ok = 0; } if (ok) { r++; } else { p = NULL; } if (t == 0) p = NULL; if (s == 0 && p) { /* alloc zero size */ q = (void **) p; p = malloc (t); *q = p; } if (res) { /* store result pointer */ q = va_arg(ap, void **); if (q) *q = p; } if (p) { fread (p, t, 1, pipe); } else { for (j = 0; j < t; j++) fgetc (pipe); } } return r; } /* * Read arguments from a pipe. Ellipsis parameters are: * size_1, pointer_1, size_2, pointer_2, ..., size_n, pointer_n * Ignore null pointer arguments, and allocate arguments with zero size. * Return number of initial arguments that matched input stream. */ int pipeReadArgs (FILE *pipe, int n, ...) { va_list ap; int r; RAISE (MSG_DEBUG, "pipe read args"); va_start(ap, n); r = pipeReadArgsMulti (pipe, 0, n, ap); va_end(ap); return r; } /* * Read optional arguments from a pipe. Ellipsis parameters are: * size_1, pointer_1, result_1, ..., size_n, pointer_n, result_n * Ignore zero size or null pointer data. Return number of initial * arguments that matched input stream, and set each result either to * NULL or to pointer. */ int pipeReadArgsOpt (FILE *pipe, int n, ...) { va_list ap; int r; RAISE (MSG_DEBUG, "pipe read args opt"); va_start(ap, n); r = pipeReadArgsMulti (pipe, 1, n, ap); va_end(ap); return r; } /* * Read list from a pipe, alloc elements, and return pointer to first * element. The elements MUST contain the next field as first entry, * and a string as second entry. */ void* pipeReadList (FILE *pipe, int size) { void *root, *p, *q; int i, j, n, t; char *s; RAISE (MSG_DEBUG, "pipe read list"); root = p = NULL; fread (&n, sizeof(n), 1, pipe); n /= 2; for (i = 0; i < n; i++) { fread (&t, sizeof(t), 1, pipe); if (t == size) { q = malloc (t); fread (q, t, 1, pipe); if (p) { * (void **) p = q; } else { root = q; } p = q; } else { q = NULL; for (j = 0; j < t; j++) fgetc (pipe); } fread (&t, sizeof(t), 1, pipe); if (q) { s = NULL; if (t != 0) { s = malloc (t); fread (s, sizeof(char), t, pipe); } * (((char **) q) + 1) = s; } else { for (j = 0; j < t; j++) fgetc (pipe); } } return root; } /* * Write list to a pipe. The elements MUST contain the next field as * first entry, and a string as second entry. */ void pipeWriteList (FILE *pipe, int size, void *list) { void *l; char *s; int n, k; RAISE (MSG_DEBUG, "pipe write list"); n = 0; for (l = list; l; l = * (void **) l) n++; n *= 2; fwrite (&n, sizeof(n), 1, pipe); for (l = list; l; l = * (void **) l) { fwrite (&size, sizeof(size), 1, pipe); fwrite (l, size, 1, pipe); s = * (((char **) l) + 1); if (s) { k = strlen(s) + 1; fwrite (&k, sizeof(k), 1, pipe); fwrite (s, sizeof(char), k, pipe); } else { k = 0; fwrite (&k, sizeof(k), 1, pipe); } } fflush (pipe); } /* * Read an array with 'nelem' elements. The elements themselves are * written by their own pipeWrite commands to allow the transfer of * embedded strings. */ void pipeReadArray (FILE *pipe, int *nelem) { int n; RAISE (MSG_DEBUG, "pipe read array ["); fread (&n, sizeof(n), 1, pipe); fread (nelem, sizeof(int), 1, pipe); RAISE (MSG_DEBUG, "] %i (%i)", *nelem, n); } /* * Write an array with 'nelem' elements, each of which has 'nsub' elements * of size 'size' to the pipe. The elements themselves are written * by their own pipeWrite commands to allow the transfer of embedded * strings. */ void pipeWriteArray (FILE *pipe, int nelem, int nsub) { int n; RAISE (MSG_DEBUG, "pipe write array %i * %i", nelem, nsub); n = nelem * nsub + 1; fwrite (&n, sizeof(n), 1, pipe); fwrite (&nelem, sizeof(nelem), 1, pipe); fflush (pipe); } nvtv-0.4.7/src/tv_common.c0000644000175000001440000002417710005515125011135 /* NVTV TV common routines -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_common.c,v 1.24 2004/01/27 17:05:25 dthierbach Exp $ * * Contents: * * Header: Common tv-related routines. * */ #include "local.h" /* before everything else */ #include #include #include #include "tv_i2c.h" #include "tv_common.h" #include "tv_bt.h" #include "tv_cx.h" #include "tv_ch1_7007.h" #include "tv_ch2_7009.h" #include "tv_ph1_saa7102.h" #include "tv_ph2_saa7104.h" #include "tv_nx.h" #include "tv_null.h" /* -------- */ TVState tvState = TV_UNKNOWN; /* -------- */ /* * Detect devices that share the 0x88/0x8a address, i.e. BT/CX/PH/TW * */ TVChip TVDetectDeviceA (I2CDevPtr dev) { I2CByte x1, x2, y; RAISE (MSG_DEBUG, "TVDetectDeviceA (%1s:%02X)", I2C_ID(dev)); #ifdef FAKE_PROBE_ID return FAKE_PROBE_ID; #endif tvBusOk = TRUE; TVWriteBus (dev, 0xff, 0x00); RAISE (MSG_DEBUG, " check LUT (%s)", tvBusOk ? "ok" : "err"); if (!tvBusOk) return TV_BROOKTREE; /* So it's not a BT, but may be an CX, in either read mode, or a PH or TW. * Check register 01. It's read only for CX/TW, and reserved for PH, * with default value 00. Although it seems to be used for Macrovision, * it's either not writeable or not readable. */ TVWriteBus (dev, 0x01, 0x00); TVReadBus (dev, 0x00, &x1); TVReadBus (dev, 0x01, &y); TVReadBus (dev, 0x00, &x2); RAISE (MSG_DEBUG, " a %02X/%02X %02X (%s)", x1, x2, y, tvBusOk ? "ok" : "err"); if (!tvBusOk) return TV_BROOKTREE; if (y == 0x00) { /* It's a PH, TW, or CX in status mode. * For PH or TW, reg 0x00 is never zero, so it must be a CX. * Otherwise, test register 1a, which is msm threshold for PH, and * a status register for the TW, with at least the lower 4 bits r/o. */ if (x1 == 0x00 || x2 == 0x00) return TV_CONEXANT; TVReadBus (dev, 0x1a, &x1); x2 = x1 ^ 0x0f; TVWriteBus (dev, 0x1a, x2); TVReadBus (dev, 0x1a, &y); TVWriteBus (dev, 0x1a, x1); RAISE (MSG_DEBUG, " b %02X/%02X %02X (%s)", x1, x2, y, tvBusOk ? "ok" : "err"); if (!tvBusOk) return TV_NO_CHIP; if (y == x2) return TV_PHILIPS; return TV_NO_CHIP; } else { /* It's a TW or CX in read mode. Check register 04 bit 1. For * the CX, this is the PAL status flag (r/o), which shouldn't * change frequently. However, the other bits may change. For * both TW98 and TW99, it is the horizontal sync length HSLEN. * Changing it slightly and then resetting it shouldn't hurt. */ TVReadBus (dev, 0x04, &y); TVWriteBus (dev, 0x04, y ^ 0x02); /* Bit 2, CX: PAL, TW: HSLEN */ TVReadBus (dev, 0x04, &x1); TVWriteBus (dev, 0x04, y); TVReadBus (dev, 0x04, &x2); RAISE (MSG_DEBUG, " c %02X/%02X/%02X (%s)", y, x1, x2, tvBusOk ? "ok" : "err"); if (!tvBusOk) return TV_NO_CHIP; if (x1 == (y ^ 0x02) && x2 == y) return TV_NO_CHIP; return TV_CONEXANT; } return TV_NO_CHIP; } /* * Detect devices that share the 0xEA/0xEC address, i.e. CH types * */ TVChip TVDetectDeviceB (I2CDevPtr dev) { I2CByte x1, x2; RAISE (MSG_DEBUG, "TVDetectDeviceB (%1s:%02X)", I2C_ID(dev)); #ifdef FAKE_PROBE_ID return FAKE_PROBE_ID; #endif tvBusOk = TRUE; TVReadBus (dev, 0xc0|0x0a, &x1); TVWriteBus (dev, 0xc0|0x0a, x1 ^ 1); TVReadBus (dev, 0xc0|0x0a, &x2); TVWriteBus (dev, 0xc0|0x0a, x1); if (x1 == x2) { return TV_CHRONTEL_MODEL2; } else { return TV_CHRONTEL_MODEL1; } } /* Write to 0x4a/0x4b. (0x0a is hpr for 7007). 7009: Won't change 7007: Will change, so write original values back. */ /* -------- */ I2CChainPtr TVFindDevice (I2CChainPtr root, TVChip chip_type) { I2CChainPtr chain; for (chain = root; chain; chain = chain->next) { if (chain->type == chip_type) return chain; } return NULL; } /* FIXME: NVFindTvDevice -> TVFindDevice (pNv->TvChain, ...) */ I2CChainPtr TVAllocChainEntry (I2CChainPtr root, I2CDevPtr dev, TVChip chip_type, char* name) { I2CChainPtr chain; chain = xcalloc (1, sizeof (I2CChainRec)); chain->dev = dev; chain->next = root; chain->type = chip_type; chain->name = xalloc (strlen(name)+1); strcpy (chain->name, name); return chain; } /* * Create chain of tv chips from list of devices on busses. * Process higher numbered busses first. FIXME?? * If 'all' is true, include all * devices, otherwise only correctly detected ones. */ I2CChainPtr TVCreateChain (I2CBusPtr busses[], int nbus, I2CChainPtr chain, Bool all) { int bus; I2CDevPtr dev; I2CChainPtr root; char version[50]; char *s; TVChip chip; RAISE (MSG_DEBUG, "TVCreateChain %i %i", nbus, all); root = chain; for (bus = 0; bus < nbus; bus++) { for (dev = busses[bus]->FirstDev; dev; dev = dev->NextDev) { s = NULL; chip = TV_NO_CHIP; switch (dev->SlaveAddr) { case 0x88: case 0x8a: /* FIXME: For test only */ chip = TVDetectDeviceA (dev); break; case 0xea: case 0xec: chip = TVDetectDeviceB (dev); break; } switch (chip & TV_ENCODER) { case TV_CHRONTEL_MODEL1: s = TVDetectChrontel1 (dev, &chip); break; case TV_CHRONTEL_MODEL2: s = TVDetectChrontel2 (dev, &chip); break; case TV_PHILIPS: s = TVDetectPhilips (dev, &chip); break; case TV_CONEXANT: s = TVDetectConexant (dev, &chip); break; case TV_BROOKTREE: s = TVDetectBrooktree (dev, &chip, tvState); break; default: if (!all) break; snprintf (version, 50, "Unknown chip (%1s:%02X)", I2C_ID(dev)); s = version; } if (s) root = TVAllocChainEntry (root, dev, chip, s); } } return root; } void TVProbeDevice (I2CBusPtr bus, I2CSlaveAddr addr, char *format, ...) { I2CDevPtr dev; char *s; va_list ap; #ifndef FAKE_PROBE_ALL #ifndef FAKE_PROBE_ADDR if (TVProbeBus (bus, addr)) #else if (addr == FAKE_PROBE_ADDR) #endif #endif { dev = xf86CreateI2CDevRec(); s = xalloc (8); va_start (ap, format); vsnprintf (s, 7, format, ap); va_end (ap); dev->DevName = s; dev->SlaveAddr = addr; dev->pI2CBus = bus; if (!xf86I2CDevInit(dev)) { xfree (dev->DevName); xf86DestroyI2CDevRec(dev, TRUE); } } } void TVProbeKnownDevices (I2CBusPtr busses[], int nbus) { int bus; for (bus = 0; bus < nbus; bus++) { TVProbeDevice (busses[bus], 0x88, "%i:%02X", bus, 0x88); TVProbeDevice (busses[bus], 0x8A, "%i:%02X", bus, 0x8A); TVProbeDevice (busses[bus], 0xEA, "%i:%02X", bus, 0xEA); TVProbeDevice (busses[bus], 0xEC, "%i:%02X", bus, 0xEC); } } void TVProbeAllDevices (I2CBusPtr busses[], int nbus) { I2CSlaveAddr addr; int bus; for (bus = 0; bus < nbus; bus++) { for (addr = 0x00; addr < 0x100; addr += 2) { TVProbeDevice (busses[bus], addr, "%1i:%02X", bus, addr); } } } void TVCheckChain (I2CChainPtr chain) { if (chain) RAISE (MSG_WARNING, "TVCheckChain: Memory leak."); } I2CChainPtr TVProbeCreateAll (I2CBusPtr busses[], int nbus, I2CChainPtr chain) { TVProbeAllDevices (busses, nbus); return TVCreateChain (busses, nbus, chain, TRUE); } I2CChainPtr TVProbeCreateKnown (I2CBusPtr busses[], int nbus, I2CChainPtr chain) { TVProbeKnownDevices (busses, nbus); chain = TVCreateChain (busses, nbus, chain, FALSE); #ifdef PROBE_ALL_UNKNOWN /* if no dev's found, scan all addresses */ if (!chain) { TVProbeAllDevices (busses, nbus); chain = TVCreateChain (busses, nbus, NULL, TRUE); } #endif return chain; } /* ---- destroy routines ---- */ // NVDestroyDevices == devices & chain // NVDestroyBusses (NVPtr pNv) == devices, chain, all busses void TVDestroyDevices (I2CBusPtr busses[], int nbus) { I2CDevPtr dev; int bus; for (bus = 0; bus < nbus; bus++) { if (busses[bus]) { while ((dev = busses[bus]->FirstDev) != NULL) { xfree (dev->DevName); xf86DestroyI2CDevRec(dev, TRUE); } } } } /* * Free the chain of tv chips */ void TVDestroyChain (I2CChainPtr root) { I2CChainPtr chain; while (root) { xfree (root->name); chain = root->next; xfree (root); root = chain; } } void TVDestroyChainDevices (I2CChainPtr *chain, I2CBusPtr busses[], int nbus) { if (*chain) TVDestroyChain (*chain); *chain = NULL; TVDestroyDevices (busses, nbus); } void TVDestroyBus (I2CBusPtr bus) { if (bus) { xfree (bus->DriverPrivate.ptr); xf86DestroyI2CBusRec (bus, TRUE, FALSE); } } void TVDestroyBusses (I2CBusPtr busses[], int nbus) { int i; for (i = 0; i < nbus; i++) { TVDestroyBus (busses[i]); busses[i] = NULL; } } void TVDestroyAll (I2CChainPtr *chain, I2CBusPtr busses[], int nbus) { TVDestroyChainDevices (chain, busses, nbus); TVDestroyBusses (busses, nbus); } /* ---- ---- */ void TVSetTvEncoder (TVEncoderObj *encoder, I2CChainPtr chain, void* extra) { void* ctrl = (void *) chain->dev; switch (chain->type & TV_ENCODER) { case TV_BROOKTREE: *encoder = tvBtTemplate; break; case TV_CONEXANT: *encoder = tvCxTemplate; break; case TV_CHRONTEL_MODEL1: *encoder = tvCh1Template; break; case TV_CHRONTEL_MODEL2: *encoder = tvCh2Template; break; case TV_PHILIPS_MODEL1: *encoder = tvPh1Template; break; case TV_PHILIPS_MODEL2: *encoder = tvPh2Template; break; case TV_NVIDIA: *encoder = tvNxTemplate; ctrl = extra; break; default: *encoder = tvNullTemplate; break; } encoder->Create (encoder, chain->type, ctrl); } nvtv-0.4.7/src/tv_nv.c0000644000175000001440000016436710023065657010310 /* NVTV NV TV-I2C access -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_nv.c,v 1.32 2004/03/08 12:48:47 dthierbach Exp $ * * Contents: * * Routines to control the TV and the I2C bus on a NVidia card, as well * as other CRT/TV mode related register programming. * * Xbox Support added -- Milosch Meriac * */ #include "local.h" /* before everything else */ #include "xfree.h" #include "xf86_ansic.h" #include #include #include "mmio.h" #include "bitmask.h" #include "xf86i2c.h" #include "tv_nv.h" #include "tv_i2c.h" #include "nv_type.h" #ifdef XBOX_SUPPORT #include #include "xbox.h" #endif /*XBOX_SUPPORT*/ /* -------- Crt access -------- */ /* these should go to driver/nv/nv_setup.c in the XFree driver; maybe they should be unified with the direct use of VGA_* elsewhere in the driver */ CARD8 readCrtNv (NVPtr pNv, int head, int reg) { #ifndef FAKE_CRTC MMIO_OUT8(pNv->riva.PCIO, CRT_INDEX(head), reg); return MMIO_IN8(pNv->riva.PCIO, CRT_DATA(head)); #else RAISE (MSG_DEBUG_NL, "%02x? ", reg); return 0; #endif } void writeCrtNv (NVPtr pNv, int head, int reg, CARD8 val) { #ifdef FAKE_CRTC if (reg == 0x1f) { #endif MMIO_OUT8(pNv->riva.PCIO, CRT_INDEX(head), reg); MMIO_OUT8(pNv->riva.PCIO, CRT_DATA(head), val); #ifdef FAKE_CRTC } RAISE (MSG_DEBUG_NL, "%02x=%02x ", reg, val); #endif } void orCrtNv (NVPtr pNv, int head, int reg, CARD8 val) { #ifndef FAKE_CRTC register CARD8 tmp; MMIO_OUT8(pNv->riva.PCIO, CRT_INDEX(head), reg); tmp = MMIO_IN8(pNv->riva.PCIO, CRT_DATA(head)); MMIO_OUT8(pNv->riva.PCIO, CRT_DATA(head), tmp | val); #else RAISE (MSG_DEBUG_NL, "%02x|%02x ", reg, val); #endif } void andCrtNv (NVPtr pNv, int head, int reg, CARD8 val) { #ifndef FAKE_CRTC register CARD8 tmp; MMIO_OUT8(pNv->riva.PCIO, CRT_INDEX(head), reg); tmp = MMIO_IN8(pNv->riva.PCIO, CRT_DATA(head)); MMIO_OUT8(pNv->riva.PCIO, CRT_DATA(head), tmp & val); #else RAISE (MSG_DEBUG_NL, "%02x&%02x ", reg, val); #endif } void andOrCrtNv (NVPtr pNv, int head, int reg, CARD8 and, CARD8 or) { #ifndef FAKE_CRTC register CARD8 tmp; MMIO_OUT8(pNv->riva.PCIO, CRT_INDEX(head), reg); tmp = MMIO_IN8(pNv->riva.PCIO, CRT_DATA(head)); MMIO_OUT8(pNv->riva.PCIO, CRT_DATA(head), (tmp & and) | or); #else RAISE (MSG_DEBUG_NL, "%02x&%02x|%02x ", reg, and, or); #endif } inline void unlockCrtNv (NVPtr pNv, int head) { #ifndef FAKE_CRTC writeCrtNv (pNv, head, 0x1f, 0x57); /* unlock extended registers */ #endif } inline void lockCrtNv (NVPtr pNv, int head) { #ifndef FAKE_CRTC #if 0 /**/ writeCrtNv (pNv, head, 0x1f, 0x99); /* lock extended registers */ #endif #endif } /* the following routines are from nv_setup.c, but they take an NVPtr instead of a vgaHWPtr. */ void NVWriteGr(NVPtr pNv, CARD8 index, CARD8 value) { MMIO_OUT8(pNv->riva.PVIO, VGA_GRAPH_INDEX, index); MMIO_OUT8(pNv->riva.PVIO, VGA_GRAPH_DATA, value); } CARD8 NVReadGr(NVPtr pNv, CARD8 index) { MMIO_OUT8(pNv->riva.PVIO, VGA_GRAPH_INDEX, index); return (MMIO_IN8(pNv->riva.PVIO, VGA_GRAPH_DATA)); } void NVWriteSeq(NVPtr pNv, CARD8 index, CARD8 value) { MMIO_OUT8(pNv->riva.PVIO, VGA_SEQ_INDEX, index); MMIO_OUT8(pNv->riva.PVIO, VGA_SEQ_DATA, value); } CARD8 NVReadSeq(NVPtr pNv, CARD8 index) { MMIO_OUT8(pNv->riva.PVIO, VGA_SEQ_INDEX, index); return (MMIO_IN8(pNv->riva.PVIO, VGA_SEQ_DATA)); } void NVWriteAttr(NVPtr pNv, int head, CARD8 index, CARD8 value) { volatile CARD8 tmp; tmp = MMIO_H_IN8(pNv->riva.PCIO, head, VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); #if 0 if (pVga->paletteEnabled) index &= ~0x20; else #endif index |= 0x20; MMIO_H_OUT8(pNv->riva.PCIO, head, VGA_ATTR_INDEX, index); MMIO_H_OUT8(pNv->riva.PCIO, head, VGA_ATTR_DATA_W, value); } CARD8 NVReadAttr(NVPtr pNv, int head, CARD8 index) { volatile CARD8 tmp; tmp = MMIO_H_IN8(pNv->riva.PCIO, head, VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); #if 0 if (pVga->paletteEnabled) index &= ~0x20; else #endif index |= 0x20; MMIO_H_OUT8(pNv->riva.PCIO, head, VGA_ATTR_INDEX, index); return MMIO_H_IN8(pNv->riva.PCIO, head, VGA_ATTR_DATA_R); } void NVWriteMiscOut(NVPtr pNv, CARD8 value) { MMIO_OUT8(pNv->riva.PVIO, VGA_MISC_OUT_W, value); } CARD8 NVReadMiscOut(NVPtr pNv) { return (MMIO_IN8(pNv->riva.PVIO, VGA_MISC_OUT_R)); } void NVDisablePalette (NVPtr pNv, int head) { volatile CARD8 tmp; tmp = MMIO_IN8(pNv->riva.PCIO + head * HEAD, VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); MMIO_OUT8(pNv->riva.PCIO + head * HEAD, VGA_ATTR_INDEX, 0x20); } void NVDacDelay (NVPtr pNv, int head) { volatile CARD8 tmp; tmp = MMIO_IN8(pNv->riva.PCIO + head * HEAD, VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); tmp = MMIO_IN8(pNv->riva.PCIO + head * HEAD, VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); } void NVWriteDacMask (NVPtr pNv, int head, CARD8 value) { MMIO_OUT8(pNv->riva.PDIO + head * HEAD, VGA_DAC_MASK, value); } CARD8 NVReadDacMask (NVPtr pNv, int head) { return (MMIO_IN8(pNv->riva.PDIO + head * HEAD, VGA_DAC_MASK)); } void NVWriteDacReadAddr (NVPtr pNv, int head, CARD8 value) { MMIO_OUT8(pNv->riva.PDIO + head * HEAD, VGA_DAC_READ_ADDR, value); } void NVWriteDacWriteAddr (NVPtr pNv, int head, CARD8 value) { MMIO_OUT8(pNv->riva.PDIO + head * HEAD, VGA_DAC_WRITE_ADDR, value); } void NVWriteDacData (NVPtr pNv, int head, CARD8 value) { MMIO_OUT8(pNv->riva.PDIO + head * HEAD, VGA_DAC_DATA, value); } CARD8 NVReadDacData (NVPtr pNv, int head) { return (MMIO_IN8(pNv->riva.PDIO + head * HEAD, VGA_DAC_DATA)); } /* -------- I2C Driver Routines -------- */ /* -------- I2C XBOX ---- */ #ifdef XBOX_SUPPORT /* FIXME TODO: Make this a proper I2C driver with local state */ /* It seems like the XBox always needs the subaddress to transmit or receive a byte. This may break some things, and makes it difficult to access some part of the PH encoder ... - Dirk */ static unsigned char XboxCmdBuffer; static int XboxCmdIdx=0; static int XboxAddr; static Bool XBoxI2CPutByte(I2CDevPtr d, I2CByte data) { int res; /* DPRINTF("I2C: put addr=0x%02x data=0x%02x\n",XboxAddr,data); */ switch(XboxCmdIdx) { case 0: XboxCmdBuffer=data; XboxCmdIdx++; return TRUE; case 1: res=I2CTransmitCmdData(XboxAddr,XboxCmdBuffer,data,FALSE); if(res<0) fprintf(stdout,"I2C: transmit error (0x%08x)\n",res); XboxCmdBuffer=0; XboxCmdIdx=0; return res>=0; default: fprintf(stdout,"I2C: output error !\n"); XboxCmdBuffer=0; XboxCmdIdx=0; return FALSE; } return FALSE; } static Bool XBoxI2CGetByte(I2CDevPtr d, I2CByte *data, Bool last) { int res; /* DPRINTF("I2C: get addr=0x%02x\n",XboxAddr); */ if(XboxCmdIdx==1) { res=I2CTransmitCmdGetReturn(XboxAddr,XboxCmdBuffer); *data = res>=0 ? res : 0xFF; if(res<0) fprintf(stdout,"I2C: recv error (0x%08x)\n",res); else { /* DPRINTF("I2C: recv data=0x%02x\n",*data); */ } } else { RAISE (MSG_ERROR, "I2C: unexpected data index=%i\n", XboxCmdIdx); res=-1; } XboxCmdIdx=0; XboxCmdBuffer=0; return res>=0; } static void XBoxI2CStop(I2CDevPtr d) { /* DPRINTF("I2C: stop\n"); */ XboxCmdBuffer=0; XboxCmdIdx=0; } /* FIXME Why is this necessary? Because of the former multiple busses? If yes, then it can go away now. - Dirk */ static Bool XBoxI2CAddress(I2CDevPtr d, I2CSlaveAddr addr) { XboxAddr=addr&~1; return (XboxAddr==0x8A)&&(d->pI2CBus->BusName[2]=='0'); } XBoxBusCreate (char *name) { I2CBusPtr I2CPtr; I2CPtr = xf86CreateI2CBusRec(); if (I2CPtr) { I2CPtr->BusName = name; I2CPtr->scrnIndex = -1; I2CPtr->I2CPutByte = XBoxI2CPutByte; I2CPtr->I2CGetByte = XBoxI2CGetByte; I2CPtr->I2CAddress = XBoxI2CAddress; I2CPtr->I2CStop = XBoxI2CStop; I2CPtr->AcknTimeout = 5; I2CPtr->DriverPrivate.ptr = NULL; /* FIXME TODO private state */ } if (I2CPtr && xf86I2CBusInit (I2CPtr)) { return I2CPtr; } if (I2CPtr) { RAISE (MSG_ERROR, "Bus %s is not unique.", name); } else { RAISE (MSG_ERROR, "Out of memory."); } TVDestroyBus (I2CPtr); return NULL; } Bool XBoxBusInit (NVPtr pNv) { pNv->TvChain = NULL; pNv->TvHead = 0; /* Must be named XB0, XB1, etc.; otherwise I2C_ID won't work */ pNv->TvMaxBus = 1; pNv->TvBusses[0] = XBoxBusCreate ("XB0"); return pNv->TvBusses[0]; } #else /* XBOX_SUPPORT */ Bool XBoxBusInit (NVPtr pNv) { return FALSE; } #endif /* XBOX_SUPPORT */ /* -------- I2C NVIDIA ---- */ typedef struct { NVPtr pNv; CARD8 reg; } NVTvI2CRec, *NVTvI2CPtr; /* FIXME: These depend on TvHead */ static void NVTvI2CGetBits(I2CBusPtr b, int *clock, int *data) { NVTvI2CPtr priv = (NVTvI2CPtr) b->DriverPrivate.ptr; NVPtr pNv = priv->pNv; unsigned char val; /* Get the result. */ MMIO_OUT8(pNv->riva.PCIO, CRT_INDEX(pNv->TvHead), priv->reg); val = MMIO_IN8(pNv->riva.PCIO, CRT_DATA(pNv->TvHead)); *clock = (val & DDC_SCL_READ_MASK) != 0; *data = (val & DDC_SDA_READ_MASK) != 0; } static void NVTvI2CPutBits(I2CBusPtr b, int clock, int data) { NVTvI2CPtr priv = (NVTvI2CPtr) b->DriverPrivate.ptr; NVPtr pNv = priv->pNv; unsigned char val; MMIO_OUT8(pNv->riva.PCIO, CRT_INDEX(pNv->TvHead), priv->reg+1); val = MMIO_IN8(pNv->riva.PCIO, CRT_DATA(pNv->TvHead)) & 0xf0; if (clock) val |= DDC_SCL_WRITE_MASK; else val &= ~DDC_SCL_WRITE_MASK; if (data) val |= DDC_SDA_WRITE_MASK; else val &= ~DDC_SDA_WRITE_MASK; MMIO_OUT8(pNv->riva.PCIO, CRT_INDEX(pNv->TvHead), priv->reg+1); MMIO_OUT8(pNv->riva.PCIO, CRT_DATA(pNv->TvHead), val | 0x1); } static void NVTvI2CUDelay (I2CBusPtr b, int usec) { NVTvI2CPtr priv = (NVTvI2CPtr) b->DriverPrivate.ptr; NVPtr pNv = priv->pNv; CARD32 h1, h2, l1, l2; #ifdef FAKE_MMIO return; #endif l1 = MMIO_IN32 (pNv->riva.PTIMER, 0x400); h1 = MMIO_IN32 (pNv->riva.PTIMER, 0x410); l2 = l1 + usec * 1000; h2 = h1; if (l2 < l1) h2++; /* overflow */ do { l1 = MMIO_IN32 (pNv->riva.PTIMER, 0x400); h1 = MMIO_IN32 (pNv->riva.PTIMER, 0x410); } while (h1 < h2 || (h1 == h2 && l1 < l2)); } Bool NVIsTimerActive (NVPtr pNv) { CARD32 h1, h2, l1, l2; #ifdef TEST_HOOKS return FALSE; #endif /* FIXME check PMC device enable? Maybe enable it during run? */ l1 = MMIO_IN32 (pNv->riva.PTIMER, 0x400); h1 = MMIO_IN32 (pNv->riva.PTIMER, 0x410); l2 = MMIO_IN32 (pNv->riva.PTIMER, 0x400); h2 = MMIO_IN32 (pNv->riva.PTIMER, 0x410); if (l1 != l2 || h1 != h2) { RAISE (MSG_DEBUG, "NVIsTimerActive: TRUE"); return TRUE; } RAISE (MSG_DEBUG, "NVIsTimerActive: FALSE"); return FALSE; } I2CBusPtr NVTvBusCreate (NVPtr pNv, char *name, CARD8 reg) { I2CBusPtr I2CPtr; NVTvI2CPtr priv; I2CPtr = xf86CreateI2CBusRec(); priv = xcalloc (1, sizeof (NVTvI2CRec)); if (priv) { priv->pNv = pNv; priv->reg = reg; } if (I2CPtr) { I2CPtr->BusName = name; I2CPtr->scrnIndex = -1; I2CPtr->I2CPutBits = NVTvI2CPutBits; I2CPtr->I2CGetBits = NVTvI2CGetBits; if (NVIsTimerActive (pNv)) { I2CPtr->I2CUDelay = NVTvI2CUDelay; } I2CPtr->AcknTimeout = 5; I2CPtr->DriverPrivate.ptr = priv; } if (I2CPtr && priv && xf86I2CBusInit (I2CPtr)) { return I2CPtr; } if (I2CPtr && priv) { RAISE (MSG_ERROR, "Bus %s is not unique.", name); } else { RAISE (MSG_ERROR, "Out of memory."); } TVDestroyBus (I2CPtr); return NULL; } Bool NVTvBusInit (NVPtr pNv) { pNv->TvChain = NULL; pNv->TvHead = 0; /* Must be named TV0, TV1, etc.; otherwise I2C_ID won't work */ pNv->TvMaxBus = 3; pNv->TvBusses[0] = NVTvBusCreate (pNv, "TV0", 0x3e); pNv->TvBusses[1] = NVTvBusCreate (pNv, "TV1", 0x36); pNv->TvBusses[2] = NVTvBusCreate (pNv, "TV2", 0x50); return pNv->TvBusses[0] && pNv->TvBusses[1] && pNv->TvBusses[2]; } /* -------- CRT -------- */ /* The crt register settings are verified to be the same as the NVidia driver settings, at least for the GeForce2 MX. This includes +1 instead of +0 (as in the X 'nv' driver) for horizSync. I do not know if all this works for older/newer cards, since the bitranges might be different. */ /* FIXME: May use disp_end_skew to horizontal move image? */ void NVSetCrtRegs (NVPtr pNv, int head, TVNvRegs *r) { int horizDisplay = (r->HDisplay/8) - 1; int horizBlankStart = (r->HBlankStart/8) - 1; int horizSyncStart = (r->HSyncStart/8) + 1; /* verified */ int horizSyncEnd = (r->HSyncEnd/8) + 1; /* verified */ int horizBlankEnd = (r->HBlankEnd/8) - 1; int horizTotal = (r->HTotal/8) - 5; int vertDisplay = r->VDisplay - 1; int vertBlankStart = r->VBlankStart - 1; int vertSyncStart = r->VSyncStart - 1; int vertSyncEnd = r->VSyncEnd - 1; int vertBlankEnd = r->VBlankEnd - 1; int vertTotal = r->VTotal - 2; #ifdef FAKE_CRTC RAISE (MSG_DEBUG_NL, "crt ["); #endif unlockCrtNv (pNv, head); writeCrtNv (pNv, head, 0x00, Set8Bits(horizTotal) ); writeCrtNv (pNv, head, 0x01, Set8Bits(horizDisplay)); writeCrtNv (pNv, head, 0x02, Set8Bits(horizBlankStart)); writeCrtNv (pNv, head, 0x03, SetBitField(horizBlankEnd,4:0,4:0) | SetBit(7)); /* index 03; 6:5 disp_end_skew = 0; 7 vert_retrace_acces = 1 */ writeCrtNv (pNv, head, 0x04, Set8Bits(horizSyncStart)); writeCrtNv (pNv, head, 0x05, SetBitField(horizBlankEnd,5:5,7:7) | SetBitField(horizSyncEnd,4:0,4:0)); writeCrtNv (pNv, head, 0x06, Set8Bits(vertTotal)); writeCrtNv (pNv, head, 0x07, SetBitField(vertTotal,8:8,0:0) | SetBitField(vertDisplay,8:8,1:1) | SetBitField(vertSyncStart,8:8,2:2) | SetBitField(vertDisplay,8:8,3:3) | SetBit(4) /* line_compare_8 */ | SetBitField(vertTotal,9:9,5:5) | SetBitField(vertDisplay,9:9,6:6) | SetBitField(vertSyncStart,9:9,7:7)); writeCrtNv (pNv, head, 0x08, 0x00); writeCrtNv (pNv, head, 0x09, SetBitField(vertBlankStart,9:9,5:5) | SetBit(6) /* line_compare_9 */ | SetBitFlag(r->flags,NV_FLAG_DOUBLE_SCAN,7)); /* index 09: 4:0 multi_scan (num of lines-1) */ writeCrtNv (pNv, head, 0x10, Set8Bits(vertSyncStart)); writeCrtNv (pNv, head, 0x11, SetBitField(vertSyncEnd,3:0,3:0) #if 0 /* FIXME TEST */ | SetBit(5)); /* index 11: 5 disable_irq2 */ #else ); #endif writeCrtNv (pNv, head, 0x12, Set8Bits(vertDisplay)); writeCrtNv (pNv, head, 0x14, 0x00); /* underline, double word */ #if 0 /* FIXME TEST */ /* FIXME: 0x15, 0x16, different */ writeCrtNv (pNv, head, 0x15, Set8Bits(vertBlankStart)); writeCrtNv (pNv, head, 0x16, Set8Bits(vertBlankEnd)); /* FIXME */ /* orCrtNv (pNv, head, 0x17, 0xc3); */ /* mode control */ #endif writeCrtNv (pNv, head, 0x18, 0xff); /* line_compare_7_0 */ writeCrtNv (pNv, head, 0x1a, 0x00 | (r->HDisplay < 1280) ? 0x04 : 0x00); /* NV: 38, 3c / bc */ /* 1c ?? */ /* 28 framebuffer format !! */ /* FIXME TODO: Arbitration 0 (0x1b), 1 (0x20) */ andOrCrtNv (pNv, head, 0x25, 0x1f, SetBitField(vertTotal,10:10,0:0) | SetBitField(vertDisplay,10:10,1:1) | SetBitField(vertSyncStart,10:10,2:2) | SetBitField(vertBlankStart,10:10,3:3) | SetBitField(horizBlankEnd,6:6,4:4)); /* index 25, bit 5: offset_11 */ andOrCrtNv (pNv, head, 0x2D, ~0x18, /* bit 5-4 */ SetBitField(horizTotal,8:8,0:0) | SetBitField(horizDisplay,8:8,1:1) | SetBitField(horizBlankStart,8:8,2:2) | SetBitField(horizSyncStart,8:8,3:3)); switch (pNv->arch.exact) { case 0x11: case 0x20: case 0x2a: writeCrtNv (pNv, head, 0x41, SetBitField(vertTotal, 11:11,0:0) | SetBitField(vertDisplay, 11:11,2:2) | SetBitField(vertSyncStart, 11:11,4:4) | SetBitField(vertBlankStart,11:11,6:6)); break; case 0x17: case 0x18: case 0x25: case 0x28: case 0x1f: case 0x30: writeCrtNv (pNv, head, 0x41, SetBitField(vertTotal, 12:11,0:0) | SetBitField(vertDisplay, 12:11,2:2) | SetBitField(vertSyncStart, 12:11,4:4) | SetBitField(vertBlankStart,12:11,6:6)); writeCrtNv (pNv, head, 0x55, SetBitField(horizTotal, 9:9,0:0) | SetBitField(horizDisplay, 9:9,2:2) | SetBitField(horizBlankStart,9:9,4:4) | SetBitField(horizBlankEnd, 7:7,6:6)); writeCrtNv (pNv, head, 0x56, SetBitField(horizSyncStart, 9:9,0:0) | SetBitField(horizSyncEnd, 5:5,2:2) | SetBitField(vertBlankEnd, 8:8,4:4)); /* FIXME bit 7 ?? */ break; } lockCrtNv (pNv, head); #ifdef FAKE_CRTC RAISE (MSG_DEBUG, "]"); #endif } void NVGetCrtRegs (NVPtr pNv, int head, TVNvRegs *r) { int horizDisplay; int horizBlankStart; int horizSyncStart; int horizSyncEnd; int horizBlankEnd; int horizTotal; int vertDisplay; int vertBlankStart; int vertSyncStart; int vertSyncEnd; int vertBlankEnd; int vertTotal; int bit; #ifdef FAKE_CRTC RAISE (MSG_DEBUG_NL, "crt ["); #endif unlockCrtNv (pNv, head); horizTotal = Set8Bits(readCrtNv(pNv, head, 0x00)) | SetBitField(readCrtNv(pNv, head, 0x2d),0:0,8:8); horizDisplay = Set8Bits(readCrtNv(pNv, head, 0x01)) | SetBitField(readCrtNv(pNv, head, 0x2d),1:1,8:8); horizBlankStart = Set8Bits(readCrtNv(pNv, head, 0x02)) | SetBitField(readCrtNv(pNv, head, 0x2d),2:2,8:8); horizBlankEnd = SetBitField(readCrtNv(pNv, head, 0x03),4:0,4:0) | SetBitField(readCrtNv(pNv, head, 0x05),7:7,5:5) | SetBitField(readCrtNv(pNv, head, 0x25),4:4,6:6); horizSyncStart = Set8Bits(readCrtNv(pNv, head, 0x04)) | SetBitField(readCrtNv(pNv, head, 0x2d),3:3,8:8); horizSyncEnd = SetBitField(readCrtNv(pNv, head, 0x05),4:0,4:0); vertTotal = Set8Bits(readCrtNv(pNv, head, 0x06)) | SetBitField(readCrtNv(pNv, head, 0x07),0:0,8:8) | SetBitField(readCrtNv(pNv, head, 0x07),5:5,9:9) | SetBitField(readCrtNv(pNv, head, 0x25),0:0,10:10); vertDisplay = Set8Bits(readCrtNv(pNv, head, 0x12)) | SetBitField(readCrtNv(pNv, head, 0x07),1:1,8:8) | SetBitField(readCrtNv(pNv, head, 0x07),6:6,9:9) | SetBitField(readCrtNv(pNv, head, 0x25),1:1,10:10); vertBlankStart = Set8Bits(readCrtNv(pNv, head, 0x15)) | SetBitField(readCrtNv(pNv, head, 0x07),3:3,8:8) | SetBitField(readCrtNv(pNv, head, 0x09),5:5,9:9) | SetBitField(readCrtNv(pNv, head, 0x25),3:3,10:10); vertBlankEnd = Set8Bits(readCrtNv(pNv, head, 0x16)); vertSyncStart = Set8Bits(readCrtNv(pNv, head, 0x10)) | SetBitField(readCrtNv(pNv, head, 0x07),2:2,8:8) | SetBitField(readCrtNv(pNv, head, 0x07),7:7,9:9) | SetBitField(readCrtNv(pNv, head, 0x25),2:2,10:10); vertSyncEnd = SetBitField(readCrtNv(pNv, head, 0x11),3:0,3:0); bit = 0; switch (pNv->arch.exact) { case 0x11: case 0x20: case 0x2a: vertTotal |= SetBitField(readCrtNv (pNv, head, 0x41),0:0,11:11); vertDisplay |= SetBitField(readCrtNv (pNv, head, 0x41),2:2,11:11); vertSyncStart |= SetBitField(readCrtNv (pNv, head, 0x41),4:4,11:11); vertBlankStart |= SetBitField(readCrtNv (pNv, head, 0x41),6:6,11:11); break; case 0x17: case 0x18: case 0x25: case 0x28: case 0x1f: case 0x30: vertTotal |= SetBitField(readCrtNv (pNv, head, 0x41),0:0,12:11); vertDisplay |= SetBitField(readCrtNv (pNv, head, 0x41),2:2,12:11); vertSyncStart |= SetBitField(readCrtNv (pNv, head, 0x41),4:4,12:11); vertBlankStart |= SetBitField(readCrtNv (pNv, head, 0x41),6:6,12:11); horizTotal |= SetBitField(readCrtNv (pNv, head, 0x55),0:0,9:9); horizDisplay |= SetBitField(readCrtNv (pNv, head, 0x55),2:2,9:9); horizBlankStart |= SetBitField(readCrtNv (pNv, head, 0x55),4:4,9:9); horizBlankEnd |= SetBitField(readCrtNv (pNv, head, 0x55),6:6,7:7); horizSyncStart |= SetBitField(readCrtNv (pNv, head, 0x56),0:0,9:9); horizSyncEnd |= SetBitField(readCrtNv (pNv, head, 0x56),2:2,5:5); vertBlankEnd |= SetBitField(readCrtNv (pNv, head, 0x56),4:4,8:8); bit++; break; } /* It is not clear if blank end is relative to blank start or total. I have chosen total here, since blank end is equal to total normally, anyway. */ horizBlankEnd |= SetBitField (horizTotal,8:7,8:7); while (horizBlankEnd < horizTotal) horizBlankEnd += SetBit (7+bit); horizSyncEnd |= SetBitField (horizSyncStart,8:5,8:5); while (horizSyncEnd < horizSyncStart) horizSyncEnd += SetBit (5+bit); vertBlankEnd |= SetBitField (vertTotal,10:8,10:8); while (vertBlankEnd < vertTotal) vertBlankEnd += SetBit (8+bit); vertSyncEnd |= SetBitField (vertSyncStart,10:4,10:4); while (vertSyncEnd < vertSyncStart) vertSyncEnd += SetBit (4); r->HDisplay = (horizDisplay + 1) * 8; r->HBlankStart = (horizBlankStart + 1) * 8; r->HBlankEnd = (horizBlankEnd + 1) * 8; r->HSyncStart = (horizSyncStart - 1) * 8; r->HSyncEnd = (horizSyncEnd - 1) * 8; r->HTotal = (horizTotal + 5) * 8; r->VDisplay = vertDisplay + 1; r->VBlankStart = vertBlankStart + 1; r->VBlankEnd = vertBlankEnd + 1; r->VSyncStart = vertSyncStart + 1; r->VSyncEnd = vertSyncEnd + 1; r->VTotal = vertTotal + 2; r->clock = 0; lockCrtNv (pNv, head); #ifdef FAKE_CRTC RAISE (MSG_DEBUG, "]"); #endif } void NVGetTvRegs (NVPtr pNv, int head, TVNvRegs *r) { unlockCrtNv (pNv, head); r->latency = SetBitField(readCrtNv(pNv, head, 0x28),5:3,2:0); r->slave.VTotal = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x720); r->slave.VSyncStart = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x724); r->slave.VSyncEnd = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x728); r->slave.HTotal = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x72c); r->slave.HSyncStart = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x730); r->slave.HSyncEnd = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x734); r->slave.Unknown = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x738); /* FIXME: VTotal only bits 10-0, HTotal only bits 10-0/11-0 */ lockCrtNv (pNv, head); } void NVSetTvRegs (NVPtr pNv, int head, TVNvRegs *r) { /* don't set latency */ MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x720, r->slave.VTotal); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x724, r->slave.VSyncStart); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x728, r->slave.VSyncEnd); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x72c, r->slave.HTotal); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x730, r->slave.HSyncStart); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x734, r->slave.HSyncEnd); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x738, r->slave.Unknown); } void NVGetFpRegs (NVPtr pNv, int head, TVNvFpRegs *r) { r->HDisplay = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x820); r->HSyncStart = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x82c); r->HSyncEnd = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x830); r->HTotal = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x824); r->HValidStart = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x834); r->HValidEnd = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x838); r->HCrtc = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x828); r->VDisplay = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x800); r->VSyncStart = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x80c); r->VSyncEnd = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x810); r->VTotal = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x804); r->VValidStart = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x814); r->VValidEnd = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x818); r->VCrtc = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x808); } void NVSetFpRegs (NVPtr pNv, int head, TVNvFpRegs *r) { MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x820, r->HDisplay); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x82c, r->HSyncStart); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x830, r->HSyncEnd); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x824, r->HTotal); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x834, r->HValidStart); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x838, r->HValidEnd); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x828, r->HCrtc); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x800, r->VDisplay); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x80c, r->VSyncStart); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x810, r->VSyncEnd); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x804, r->VTotal); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x814, r->VValidStart); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x818, r->VValidEnd); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x808, r->VCrtc); } /* FIXME: Hack: Using SyncRegs for TV BlankRegs */ void NVSetBlankRegs (NVPtr pNv, int head, TVNvRegs *r) { RAISE (MSG_DEBUG, "nv blank h=%i-%i v=%i-%i", r->HSyncStart, r->HSyncEnd, r->VSyncStart, r->VSyncEnd); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x704, r->VSyncStart); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x708, r->VSyncEnd); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x70c, r->HSyncStart); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x710, r->HSyncEnd); MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x714, 0x00000000); } /* All registers (except actual "switching") */ void NVGetAllRegs (NVPtr pNv, int head, TVRegs *r) { r->devFlags = NVGetDevFlags (pNv, head); NVGetCrtRegs (pNv, head, &r->crtc.nv); r->crtc.nv.clock = NVGetClock (pNv, head); NVGetTvRegs (pNv, head, &r->crtc.nv); } void NVSetAllRegs (NVPtr pNv, int head, TVRegs *r) { NVSetCrtRegs (pNv, head, &r->crtc.nv); NVModifyClock (pNv, head, r->crtc.nv.clock); if (r->devFlags & DEV_TELEVISION) NVSetTvRegs (pNv, head, &r->crtc.nv); } void NVSetCrtLayout (NVPtr pNv, int head, int addr, int ofs) { unlockCrtNv (pNv, head); /* crt offset (= crt line increment)? in 0x13,8bit 0x19,10:8,5:7 */ writeCrtNv (pNv, head, 0x0c, SetBitField(addr,15:8,7:0)); writeCrtNv (pNv, head, 0x0d, Set8Bits(addr)); writeCrtNv (pNv, head, 0x13, Set8Bits(ofs)); writeCrtNv (pNv, head, 0x19, SetBitField(addr,20:16,4:0) | SetBitField(ofs,10:8,7:5)); #if 0 /* FIXME */ andOrCrtNv (pNv, head, 0x25, ~0xd0); /* VERTICAL_EXTRA */ andOrCrtNv (pNv, head, 0x2d, ~0xd0); /* HORIZONTAL_EXTRA */ writeCrtNv (pNv, head, 0x42, ); /* START_ADDR */ #else andCrtNv (pNv, head, 0x25, (CARD8) ~0xd0); /* VERTICAL_EXTRA */ andCrtNv (pNv, head, 0x2d, (CARD8) ~0xd0); /* HORIZONTAL_EXTRA */ andCrtNv (pNv, head, 0x42, (CARD8) ~0x0f); #endif lockCrtNv (pNv, head); } void NVGetCrtLayout (NVPtr pNv, int head, int *paddr, int *pofs) { int addr, ofs; unlockCrtNv (pNv, head); addr = Set8Bits(readCrtNv (pNv, head, 0x0d)) | SetBitField(readCrtNv (pNv, head, 0x0c),7:0,15:8) | SetBitField(readCrtNv (pNv, head, 0x19),4:0,20:16) | SetBitField(readCrtNv (pNv, head, 0x2d),7:5,25:23) | SetBitField(readCrtNv (pNv, head, 0x25),7:6,27:26) | SetBitField(readCrtNv (pNv, head, 0x42),3:0,31:28); ofs = Set8Bits(readCrtNv (pNv, head, 0x13)) | SetBitField(readCrtNv (pNv, head, 0x19),7:5,10:8) | SetBitField(readCrtNv (pNv, head, 0x25),5:5,11:11); lockCrtNv (pNv, head); if (paddr) *paddr = addr; if (pofs) *pofs = ofs; } /* -------- Clock / PLL -------- */ long NVCalcMNP (NVArch *arch, long targetFreq, int *mOut, int *nOut, int *pOut) { long bestFreq; long bestDelta; long delta; int minVco, maxVco; int maxM; int n, m, p; long realFreq; /* FIXME TODO: adjust minVco and maxVco, if maxVco != 2 * minVco */ minVco = arch->minVco; maxVco = arch->maxVco; for (n = 0; arch->freqM[n] != 0 && targetFreq >= arch->freqM[n]; n++); maxM = arch->maxM[n]; bestDelta = -1; bestFreq = 0; for (p = 0; p <= arch->maxP; p++) { if ((targetFreq << p) >= minVco && (targetFreq << p) <= maxVco) { for (m = arch->minM; m <= maxM; m++) { /* round both n and p during divisions */ n = (((targetFreq << p) * m + arch->crystalFreq/2) / arch->crystalFreq); if (n > 255) continue; realFreq = (((arch->crystalFreq * n + m/2) / m) + ((1 << p) >> 1)) >> p; if (realFreq > targetFreq) delta = realFreq - targetFreq; else delta = targetFreq - realFreq; if (bestDelta == -1 || delta < bestDelta) { *mOut = m; *nOut = n; *pOut = p; bestDelta = delta; bestFreq = realFreq; /* Accept immediately within 0.5% relative error if above freqM limit, to keep m as low as possible */ if (delta == 0 || (targetFreq >= arch->freqM[0] && (targetFreq / delta > 200))) { return bestFreq; } } } } } return bestFreq; } void NVProgClock (NVPtr pNv, int head, int m, int n, int p) { int reg; register CARD32 val; RAISE (MSG_DEBUG, "nv set mnp %i m=%i n=%i p=%i", head, m, n, p); /* Modify post divisor only after PLL has settled */ reg = (head==1) ? 0x520 : 0x508; val = MMIO_IN32 (pNv->riva.PRAMDAC, reg); val &= ~SetBitField(-1,15:0,15:0); val |= SetBitField(m,7:0,7:0) | SetBitField(n,7:0,15:8); MMIO_OUT32 (pNv->riva.PRAMDAC, reg, val); xf86usleep (1); /* 1 us */ val &= ~SetBitField(-1,18:16,18:16); val |= SetBitField(p,2:0,18:16); MMIO_OUT32 (pNv->riva.PRAMDAC, reg, val); } long NVGetClock (NVPtr pNv, int head) { int n, m, p; register CARD32 l; register long clock; #ifdef FAKE_MMIO return 25000; #endif l = MMIO_IN32 (pNv->riva.PRAMDAC, (head==1) ? 0x520 : 0x508); m = SetBitField (l,7:0,7:0); if (m == 0) return 0; n = SetBitField (l,15:8,7:0); p = SetBitField (l,18:16,2:0); clock = (((pNv->arch.crystalFreq * n + m/2) / m) + ((1 << p) >> 1)) >> p; RAISE (MSG_DEBUG, "nv get clock pll=%08X, m=%i n=%i p=%i, Fref=%li Fclk=%li kHz", l, m, n, p, pNv->arch.crystalFreq, clock); return clock; } long NVSetClock (NVPtr pNv, int head, long clock) { int m, n, p; RAISE (MSG_DEBUG, "nv set clock %li", clock); if (clock == 0) return 0; clock = NVCalcMNP (&pNv->arch, clock, &m, &n, &p); NVProgClock (pNv, head, m, n, p); return clock; } long NVModifyClock (NVPtr pNv, int head, long clock) { long oldClock, newClock; int m, n, p; RAISE (MSG_DEBUG, "nv mod clock %li", clock); if (clock == 0) return 0; oldClock = NVGetClock (pNv, head); newClock = NVCalcMNP (&pNv->arch, clock, &m, &n, &p); RAISE (MSG_DEBUG, "nv mod old=%li new=%li", oldClock, newClock); /* FIXME */ /* first check against old pll frequency. If better than newly calc'd frequency, don't change (may have different limits). */ NVProgClock (pNv, head, m, n, p); return newClock; } /* -------- Device enable/disable -------- */ int NVGetDevFlags (NVPtr pNv, int head) { int devFlags; RAISE (MSG_DEBUG_NL, "nv get devflags %i [", head); unlockCrtNv (pNv, head); devFlags = 0; /* FIXME: Check that display is enabled at all */ if (readCrtNv (pNv, head, 0x28) & 0x80) { /* CRTC is slaved. */ if (readCrtNv (pNv, head, 0x33) & 0x01) { devFlags |= DEV_FLATPANEL; } else { devFlags |= DEV_TELEVISION; } if ((pNv->arch.exact == 0x17 || pNv->arch.exact == 0x18) && ((readCrtNv (pNv, head, 0x53) & 0xc0) == 0x40)) { devFlags |= DEV_INTERNAL; } } if ((MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x608) & 0x00010000) == 0) { devFlags |= DEV_MONITOR; } /* FIXME: Check data_src instead */ /* if ((MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x608) & 0x00010000) == 0) { devFlags |= DEV_OVERLAY; } */ lockCrtNv (pNv, head); RAISE (MSG_DEBUG, "] = %02X", devFlags); return devFlags; } void NVEnableMonitor (NVPtr pNv, int head, Bool state) { if (state) { RAISE (MSG_DEBUG, "nv enable monitor"); #if 0 /* FIXME experimental */ /* reset attr ff */ MMIO_H_IN8 (pNv->riva.PCIO, pNv->TvHead, 0x3da); /* enable disp */ MMIO_H_OUT8 (pNv->riva.PCIO, pNv->TvHead, 0x3c0, 0x10 | 0x20); #endif #if 1 /* FIXME experimental */ /* TEST_CONTROL Pwrdown DAC */ MMIO_H_AND32 (pNv->riva.PRAMDAC, head, 0x608, ~0x00010000); #endif #if 1 /* FIXME standard */ andCrtNv (pNv, pNv->TvHead, 0x1A, 0x3f); /* Enable vsync, hsync */ #endif } else { RAISE (MSG_DEBUG, "nv disable monitor"); #if 1 /* TEST_CONTROL Pwrdown DAC */ MMIO_H_OR32 (pNv->riva.PRAMDAC, head, 0x608, 0x00010000); #endif #if 0 /* reset attr ff */ MMIO_H_IN8 (pNv->riva.PCIO, pNv->TvHead, 0x3da); /* disable disp */ MMIO_H_OUT8 (pNv->riva.PCIO, pNv->TvHead, 0x3c0, 0x00); #endif #if 0 /* turns both off */ RAISE (MSG_DEBUG, "Seq 0x01=%02X", NVReadSeq (pNv, 0x01)); NVWriteSeq (pNv, 0x01, NVReadSeq (pNv, 0x01) | 0x20); /* display off */ #endif #if 1 /* FIXME standard */ orCrtNv (pNv, pNv->TvHead, 0x1A, 0x80); /* disable hsync */ #endif } } /* -------- Device routines -------- */ void NVUpdateTvState (NVPtr pNv); void NVSetTvDevice (NVPtr pNv, I2CChainPtr chain, Bool init) { RAISE (MSG_DEBUG, "nv set dev %p %s", chain, init ? "init" : "no init"); TVSetTvEncoder (&pNv->tvEncoder, chain, (void *) pNv); if (init) { unlockCrtNv (pNv, pNv->TvHead); if (readCrtNv (pNv, pNv->TvHead, 0x28) & 0x80) { /* Already in TV mode, don't init */ tvState = TV_ON; } else { tvBusOk = TRUE; /* FIXME: Use real port mode. (For Nx, the port mode is ignored by the encoder, anyway. */ pNv->tvEncoder.InitRegs (&pNv->tvEncoder, PORT_NVIDIA); if (!tvBusOk) RAISE (MSG_ERROR, "I2C Bus error."); } lockCrtNv (pNv, pNv->TvHead); } } void NVProbeTvDevices (NVPtr pNv) { if (!pNv) return; unlockCrtNv (pNv, pNv->TvHead); NVUpdateTvState (pNv); TVCheckChain (pNv->TvChain); pNv->TvChain = NULL; #if 0 /* FIXME: Different lists for I2C devices/encoders. Have probe for I2C and other encoders. NV17 internal is detected by valid TV mode in FBA_BOOT0 0x101000 */ if (pNv->arch.exact == 0x17) { pNv->TvChain = TVAllocChainEntry (pNv->TvChain, NULL, TV_NVIDIA, "NV Internal A (NV17)"); } #endif pNv->TvChain = TVProbeCreateKnown (pNv->TvBusses, pNv->TvMaxBus, pNv->TvChain); } /* -------- Multiple heads -------- */ void NVAssocFeature (NVPtr pNv, int head, int mask) { int h; RAISE (MSG_DEBUG, "NVAssoc %i %08X", head, mask); MMIO_H_OR32 (pNv->riva.PCRTC, head, 0x860, mask); for (h = 0; h < pNv->arch.heads; h++) { if (h != head) { MMIO_H_AND32 (pNv->riva.PCRTC, h, 0x860, ~mask); } } } void NVSetVideoHead (NVPtr pNv, int head) { if (pNv->arch.heads == 1) return; NVAssocFeature (pNv, head, 0x00001000); /* Video Scaler */ } int NVSetTvHead (NVPtr pNv, int head) { int h; int tv; RAISE (MSG_DEBUG, "NVSetTvHead %i", head); if (pNv->arch.heads == 1) return head; /* FIXME: Don't set if one head is in TV mode ... test this on FP */ /* FIXME: This should be checked somewhere else... */ tv = -1; for (h = 0; h < pNv->arch.heads; h++) { unlockCrtNv (pNv, h); if (((readCrtNv (pNv, h, 0x28) & 0x80) != 0) && ((readCrtNv (pNv, h, 0x33) & 0x01) == 0)) tv = h; lockCrtNv (pNv, h); } if (tv >= 0) { tvState = TV_ON; pNv->TvHead = tv; } else { tvState = TV_OFF; pNv->TvHead = head; NVAssocFeature (pNv, head, 0x00000110); /* TV & DDC */ } return pNv->TvHead; } void NVCopyHead (NVPtr pNv, int fromHead, int toHead) { RAISE (MSG_DEBUG, "NVCopyHead %i -> %i %08lX %08lX", fromHead, toHead, MMIO_H_IN32 (pNv->riva.PCRTC, fromHead, 0x800), MMIO_H_IN32 (pNv->riva.PCRTC, fromHead, 0x804)); /* NV_PCRTC_START */ MMIO_H_OUT32 (pNv->riva.PCRTC, toHead, 0x800, MMIO_H_IN32 (pNv->riva.PCRTC, fromHead, 0x800)); /* NV_PCRTC_CONFIG */ MMIO_H_OUT32 (pNv->riva.PCRTC, toHead, 0x804, MMIO_H_IN32 (pNv->riva.PCRTC, fromHead, 0x804)); MMIO_H_OUT32 (pNv->riva.PRAMDAC, toHead, 0x600, MMIO_H_IN32 (pNv->riva.PRAMDAC, fromHead, 0x600)); MMIO_H_OUT32 (pNv->riva.PRAMDAC, toHead, 0x848, MMIO_H_IN32 (pNv->riva.PRAMDAC, fromHead, 0x848)); MMIO_H_OR32 (pNv->riva.PRAMDAC, toHead, 0x880, 0x10000000); /* FIXME !! */ MMIO_H_OUT32 (pNv->riva.PRAMDAC, toHead, 0x814, MMIO_H_IN32 (pNv->riva.PRAMDAC, fromHead, 0x814)); MMIO_H_OUT32 (pNv->riva.PRAMDAC, toHead, 0x818, MMIO_H_IN32 (pNv->riva.PRAMDAC, fromHead, 0x818)); unlockCrtNv (pNv, fromHead); unlockCrtNv (pNv, toHead); #if 0 writeCrtNv (pNv, toHead, 0x44, 0x03); /* FIXME Test */ writeCrtNv (pNv, toHead, 0x21, 0xfa); /* FIXME Test */ writeCrtNv (pNv, toHead, 0x26, 0x14); /* FIXME Test */ writeCrtNv (pNv, toHead, 0x22, readCrtNv (pNv, fromHead, 0x22)); writeCrtNv (pNv, toHead, 0x23, readCrtNv (pNv, fromHead, 0x23)); #endif andOrCrtNv (pNv, toHead, 0x28, ~0x3, 0x3 & readCrtNv (pNv, fromHead, 0x28)); /* FIXME LCD off */ writeCrtNv (pNv, toHead, 0x33, 0x00); lockCrtNv (pNv, fromHead); lockCrtNv (pNv, toHead); } void NVCopyGrSeq (NVPtr pNv, int fromHead, int toHead) { RAISE (MSG_DEBUG, "NVCopyGrSeq %i -> %i", fromHead, toHead); } void NVInitGrSeq (NVPtr pNv) { NVWriteSeq(pNv, 0x01, 0x01); /* reenable display */ NVWriteSeq(pNv, 0x02, 0x0f); /* if depth != 1 */ NVWriteSeq(pNv, 0x03, 0x00); NVWriteSeq(pNv, 0x04, 0x0E); /* if depth < 8 */ NVWriteSeq(pNv, 0x00, 0x03); /* End Reset */ NVWriteGr(pNv, 0x00, 0x00); NVWriteGr(pNv, 0x01, 0x00); NVWriteGr(pNv, 0x02, 0x00); NVWriteGr(pNv, 0x03, 0x00); NVWriteGr(pNv, 0x04, 0x00); /* depth != 1 */ NVWriteGr(pNv, 0x05, 0x40); /* depth != 1 && depth != 4 */ NVWriteGr(pNv, 0x06, 0x05); NVWriteGr(pNv, 0x07, 0x0f); NVWriteGr(pNv, 0x08, 0xff); } void NVInitDac (NVPtr pNv, int head) { int i; NVWriteDacMask (pNv, head, 0xFF); NVWriteDacWriteAddr (pNv, head, 0x00); for (i = 0; i < 256; i++) { NVWriteDacData (pNv, head, i); NVDacDelay (pNv, head); NVWriteDacData (pNv, head, i); NVDacDelay (pNv, head); NVWriteDacData (pNv, head, i); NVDacDelay (pNv, head); } NVDisablePalette (pNv, head); } void NVInitAttr (NVPtr pNv, int head) { int i; RAISE (MSG_DEBUG, "NVInitAttr"); /* reset attr ff */ MMIO_H_IN8 (pNv->riva.PCIO, head, 0x3da); for (i = 0; i <= 0x0f; i++) { MMIO_H_OUT8 (pNv->riva.PCIO, head, 0x3c0, i | 0x20); MMIO_H_OUT8 (pNv->riva.PCIO, head, 0x3c0, i); } MMIO_H_OUT8 (pNv->riva.PCIO, head, 0x3c0, 0x10 | 0x20); /* enable disp */ MMIO_H_OUT8 (pNv->riva.PCIO, head, 0x3c0, 0x41); /* mode control */ MMIO_H_OUT8 (pNv->riva.PCIO, head, 0x3c0, 0x11 | 0x20); MMIO_H_OUT8 (pNv->riva.PCIO, head, 0x3c0, 0x00); /* overscan value */ MMIO_H_OUT8 (pNv->riva.PCIO, head, 0x3c0, 0x12 | 0x20); MMIO_H_OUT8 (pNv->riva.PCIO, head, 0x3c0, 0x0f); /* plane enable */ MMIO_H_OUT8 (pNv->riva.PCIO, head, 0x3c0, 0x13 | 0x20); MMIO_H_OUT8 (pNv->riva.PCIO, head, 0x3c0, 0x00); /* pel panning */ MMIO_H_OUT8 (pNv->riva.PCIO, head, 0x3c0, 0x14 | 0x20); MMIO_H_OUT8 (pNv->riva.PCIO, head, 0x3c0, 0x00); /* color select */ } void NVCopyCursor (NVPtr pNv, int fromHead, int toHead) { RAISE (MSG_DEBUG, "NVCopyCursor %i -> %i", fromHead, toHead); /* NV_PCRTC_CURSOR */ MMIO_H_OUT32 (pNv->riva.PCRTC, toHead, 0x80c, MMIO_H_IN32 (pNv->riva.PCRTC, fromHead, 0x80c)); /* NV_PCRTC_CURSOR_CONFIG */ MMIO_H_OUT32 (pNv->riva.PCRTC, toHead, 0x810, MMIO_H_IN32 (pNv->riva.PCRTC, fromHead, 0x810)); /* CURSOR_CNTRL */ MMIO_H_OUT32 (pNv->riva.PRAMDAC, toHead, 0x320, MMIO_H_IN32 (pNv->riva.PRAMDAC, fromHead, 0x320)); /* CURSOR_DATA */ MMIO_H_OUT32 (pNv->riva.PRAMDAC, toHead, 0x324, MMIO_H_IN32 (pNv->riva.PRAMDAC, fromHead, 0x324)); /* CURSOR_DATA */ MMIO_H_OUT32 (pNv->riva.PRAMDAC, toHead, 0x328, MMIO_H_IN32 (pNv->riva.PRAMDAC, fromHead, 0x328)); unlockCrtNv (pNv, fromHead); unlockCrtNv (pNv, toHead); writeCrtNv (pNv, toHead, 0x2f, readCrtNv (pNv, fromHead, 0x2f)); writeCrtNv (pNv, toHead, 0x30, readCrtNv (pNv, fromHead, 0x30)); writeCrtNv (pNv, toHead, 0x31, readCrtNv (pNv, fromHead, 0x31)); lockCrtNv (pNv, fromHead); lockCrtNv (pNv, toHead); } void NVSetCursorPos (NVPtr pNv, int head, int x, int y) { MMIO_H_OUT32 (pNv->riva.PRAMDAC, head, 0x300, SetBitField(x,11:0,11:0) | SetBitField(y,11:0,27:16)); } void NVGetCursorPos (NVPtr pNv, int head, int *x, int *y) { register int v; v = MMIO_H_IN32 (pNv->riva.PRAMDAC, head, 0x300); *x = SetBitField(v,11:0,11:0); *y = SetBitField(v,27:16,11:0); } void NVSetVideoPointOut (NVPtr pNv, int x, int y) { MMIO_OUT32 (pNv->riva.PRAMDAC, 0x948, SetBitField(x,11:0,11:0) | SetBitField(y,11:0,27:16)); MMIO_OUT32 (pNv->riva.PRAMDAC, 0x94C, SetBitField(x,11:0,11:0) | SetBitField(y,11:0,27:16)); } void NVGetVideoPointOut (NVPtr pNv, int *x, int *y) { register int v; v = MMIO_IN32 (pNv->riva.PRAMDAC, 0x948); *x = SetBitField(v,11:0,11:0); *y = SetBitField(v,27:16,11:0); } Bool NVVertIntrEnabled (NVPtr pNv, int head) { if (MMIO_H_IN32 (pNv->riva.PCRTC, head, 0x140) & SetBit(0)) { return TRUE; } else { return FALSE; } } void NVCopyArb (NVPtr pNv, int fromHead, int toHead) { /* copy aribtration registers */ unlockCrtNv (pNv, fromHead); unlockCrtNv (pNv, toHead); writeCrtNv (pNv, toHead, 0x20, readCrtNv (pNv, fromHead, 0x2f)); writeCrtNv (pNv, toHead, 0x1b, readCrtNv (pNv, fromHead, 0x30)); lockCrtNv (pNv, fromHead); lockCrtNv (pNv, toHead); } /* -------- Digital Video Output (DVO) Ports -------- */ /* This seems to be wildly different for different architectures. Some seem to be able to use both DVO ports on the same head? Also, it seems necessary to associate the second TV port. */ void NVEnableDVO_NV17 (NVPtr pNv, int head, int path) { int h; for (h = 0; h < pNv->arch.heads; h++) { unlockCrtNv (pNv, h); if (h == head) { orCrtNv (pNv, h, 0x59, 0x01); if (path & 0x1) { orCrtNv (pNv, h, 0x33, 0x10); } } else { andCrtNv (pNv, h, 0x59, ~0x01); if (path & 0x1) { andCrtNv (pNv, h, 0x33, ~0x10); } } lockCrtNv (pNv, h); } } void NVEnableDVO_NV18 (NVPtr pNv, int head, int path) { int h; for (h = 0; h < pNv->arch.heads; h++) { unlockCrtNv (pNv, h); if (h == head) { if (path & 0x1) { orCrtNv (pNv, h, 0x33, 0x10); // ??? orCrtNv (pNv, h, 0x59, 0x01); } else { andCrtNv (pNv, h, 0x59, ~0x01); } if (path & 0x2) { orCrtNv (pNv, h, 0x33, 0x20); // ??? orCrtNv (pNv, h, 0x9f, 0x10); } else { andCrtNv (pNv, h, 0x9f, ~0x10); } } else { if (path & 0x1) { andCrtNv (pNv, h, 0x59, ~0x01); } if (path & 0x2) { } else { andCrtNv (pNv, h, 0x9f, ~0x10); } } lockCrtNv (pNv, h); } } void NVEnableDVO_NV25 (NVPtr pNv, int head, int path) { int h; for (h = 0; h < pNv->arch.heads; h++) { unlockCrtNv (pNv, h); if (h == head) { orCrtNv (pNv, h, 0x59, 0x01); if (path & 0x1) { orCrtNv (pNv, h, 0x33, 0x10); } else { andCrtNv (pNv, h, 0x33, ~0x10); } if (path & 0x2) { orCrtNv (pNv, h, 0x33, 0x20); } else { andCrtNv (pNv, h, 0x33, ~0x20); } } else { if (path & 0x1) { andCrtNv (pNv, h, 0x33, ~0x10); } else { orCrtNv (pNv, h, 0x33, 0x10); } if (path & 0x2) { andCrtNv (pNv, h, 0x33, ~0x20); } else { orCrtNv (pNv, h, 0x33, 0x20); } } lockCrtNv (pNv, h); } } void NVEnableDVO_NVX (NVPtr pNv, int head, int path) { int h; for (h = 0; h < pNv->arch.heads; h++) { unlockCrtNv (pNv, h); if (h == head) { orCrtNv (pNv, h, 0x59, 0x01); if (path & 0x1) { orCrtNv (pNv, h, 0x33, 0x10); } if (path & 0x2) { orCrtNv (pNv, h, 0x33, 0x20); } } else { if (path & 0x1) { andCrtNv (pNv, h, 0x33, ~0x10); } if (path & 0x2) { andCrtNv (pNv, h, 0x33, ~0x20); } } lockCrtNv (pNv, h); } } void NVEnableDVO (NVPtr pNv, int head, int path) { switch (pNv->arch.exact) { case 0x17: NVEnableDVO_NV17 (pNv, head, path); break; case 0x18: NVEnableDVO_NV18 (pNv, head, path); break; case 0x25: case 0x28: NVEnableDVO_NV25 (pNv, head, path); break; case 0x1f: case 0x30: NVEnableDVO_NVX (pNv, head, path); break; case 0x2a: break; } } void NVDisableDVO (NVPtr pNv, int head, int path) { unlockCrtNv (pNv, head); switch (pNv->arch.exact) { case 0x17: case 0x20: /* FIXME ??? */ case 0x25: case 0x28: andCrtNv (pNv, head, 0x59, ~0x01); break; case 0x18: case 0x1f: case 0x30: if (path & 0x1) andCrtNv (pNv, head, 0x59, ~0x01); if (path & 0x2) andCrtNv (pNv, head, 0x9f, ~0x10); break; case 0x2a: break; case 0x11: /* FIXME ??? */ default: andCrtNv (pNv, head, 0x33, ~0x10); break; } lockCrtNv (pNv, head); } /* -------- Get Port / Encoder Registers -------- */ void NVGetEncRegsPort (NVPtr pNv, TVEncoderRegs *r, int *port) { tvBusOk = TRUE; pNv->tvEncoder.GetPort (&pNv->tvEncoder, port); pNv->tvEncoder.GetRegs (&pNv->tvEncoder, r); if (!tvBusOk) RAISE (MSG_ERROR, "I2C Bus error."); } void NVGetPort (NVPtr pNv, int *port) { register CARD32 tv_setup; *port |= PORT_VSYNC_HIGH | PORT_HSYNC_HIGH | PORT_BLANK_LOW | PORT_BLANK_OUT | PORT_PCLK_HIGH | PORT_PCLK_MASTER | PORT_FORMAT_RGB; tv_setup = MMIO_H_IN32 (pNv->riva.PRAMDAC, pNv->TvHead, 0x700); *port |= (GetBit(tv_setup,0) ? PORT_SYNC_MASTER : PORT_SYNC_SLAVE); } /* -------- -------- */ /* Intermediate interface to TV. This might not be needed for the * XFree driver, and should be moved to a different file in that case. */ static int nvCrtIntr; inline void prepCrtNv (NVPtr pNv, int head) { // unlockCrtNv (pNv, head); nvCrtIntr = readCrtNv (pNv, head, 0x11) & 0x10; // andCrtNv (pNv, head, 0x11, 0xef); /* disable vert intr */ // orCrtNv (pNv, head, 0x21, 0x80); /* "virtual" changes */ writeCrtNv (pNv, head, 0x21, 0xfa); } inline void commitCrtNv (NVPtr pNv, int head) { // andCrtNv (pNv, head, 0x21, 0x7f); /* commit changes */ // orCrtNv (pNv, head, 0x11, nvCrtIntr); /* enable vert intr again */ } /* FIXME merge this with dev flags and flat panel stuff */ void NVUpdateTvState (NVPtr pNv) { if (tvState != TV_UNKNOWN) return; /* FIXME remove */ if (readCrtNv (pNv, pNv->TvHead, 0x28) & 0x80) { tvState = TV_ON; } else { if (tvState != TV_BARS) tvState = TV_OFF; } } void NVSetTestImage (NVPtr pNv, TVEncoderRegs *r) { /* FIXME chip registers ... */ RAISE (MSG_DEBUG, "nv tv testimage"); unlockCrtNv (pNv, pNv->TvHead); if (! (readCrtNv (pNv, pNv->TvHead, 0x28) & 0x80)) { /* Only do bars if not in tv-mode */ pNv->tvEncoder.SetState (&pNv->tvEncoder, r, TV_BARS); } lockCrtNv (pNv, pNv->TvHead); } /* FIXME Internal for now in its own routine. */ /* TODO: crt 53 bit 7-6 to 0x40 crt 54 to 0 PLL coeff = 30000F00 31000F00 TODO: smarter version: only stop and start again if timing changes... */ void NVSetTvModeInternal (NVPtr pNv, TVRegs *r, TVState newstate) { RAISE (MSG_DEBUG, " INTERNAL "); NVSetCrtRegs (pNv, pNv->TvHead, &r->crtc.nv); /* FIXME clock ??? */ pNv->tvEncoder.SetPort (&pNv->tvEncoder, r->portEnc); pNv->tvEncoder.SetRegs (&pNv->tvEncoder, &r->enc, newstate); #if 0 prepCrtNv (pNv, pNv->TvHead); andCrtNv (pNv, pNv->TvHead, 0x28, 0x7f); commitCrtNv (pNv, pNv->TvHead); xf86usleep (2000); /* 2ms */ prepCrtNv (pNv, pNv->TvHead); andOrCrtNv (pNv, pNv->TvHead, 0x28, (CARD8) ~0xf8, (CARD8) (0x80 | SetBitField(r->crtc.nv.latency,2:0,5:3))); commitCrtNv (pNv, pNv->TvHead); #endif RAISE (MSG_DEBUG, "}"); } /* FIXME: Check that if not changing mode, only registers are set, i.e. crt/tv regs in tv-mode and crt regs in non-tv mode Use a "safe mode" flag to avoid switching devices if the kernel controls them? */ /* FIXME: Cleanup and split state to support overlay */ /* For NV11, the DATA_SRC fields does not seem to be supported. It is possible to "turn off" the overlay with COMP_SRC, but the PCLK and the DAC data seem always to be routed to the TV port, even if crt 28 is not set. This is strange, because it should be at least possible to switch to the VIP. */ void NVSetTvMode (NVPtr pNv, TVRegs *r) { TVState newstate; RAISE (MSG_DEBUG, "NVSetTvMode { "); /* FIXME: Don't switch state if not necessary */ NVUpdateTvState (pNv); /* FIXME: Just convert to old 'state' for now */ newstate = (r->devFlags & DEV_TELEVISION) ? TV_ON : TV_OFF; RAISE (MSG_DEBUG, "nv tv %02X state %i -> %i", r->devFlags, tvState, newstate); /* FIXME: Handle internal display in own routine for now */ if (r->devFlags & DEV_INTERNAL) { NVSetTvModeInternal (pNv, r, newstate); return; } unlockCrtNv (pNv, pNv->TvHead); /* FIXME Test this */ if (pNv->TvHead == 1 && tvState != TV_ON) { RAISE (MSG_DEBUG, "init 2nd "); unlockCrtNv (pNv, 0); writeCrtNv (pNv, 0, 0x44, 0x03); /* FIXME enable video subsystem */ // MMIO_OUT8(pNv->riva.PVIO, 0x3c3, 1); // PRMVIO_VSE2 NVInitGrSeq (pNv); NVInitDac (pNv, pNv->TvHead); writeCrtNv (pNv, 0, 0x44, 0x00); NVCopyArb (pNv, 0, pNv->TvHead); NVInitAttr (pNv, pNv->TvHead); } #if 0 /* FIXME experimental NV4 blank color */ MMIO_H_OUT32 (pNv->riva.PRAMDAC, pNv->TvHead, 0x714, 0x00000000); #endif #if 1 /* FIXME experimental NV3/NV4 overscan color */ /* crt index 2a */ #endif #if 0 /* FIXME experimental */ /* FIXME Head ... doesn't work yet ... */ /* Experimental: Wait for vert retrace... */ MMIO_H_OUT8 (pNv->riva.PCIO, pNv->TvHead, 0x3c4, 0x01); MMIO_H_OUT8 (pNv->riva.PCIO, pNv->TvHead, 0x3c5, 0x01); /* Wait until in image */ while (MMIO_H_IN8 (pNv->riva.PCIO, pNv->TvHead, 0x3da) & 0x08); /* Wait until retrace starts */ while (! MMIO_H_IN8 (pNv->riva.PCIO, pNv->TvHead, 0x3da) & 0x08); #if 0 /* Wait until again in image */ while (MMIO_H_IN8 (pNv->riva.PCIO, pNv->TvHead, 0x3da) & 0x08); #endif #endif /* FIXME */ tvBusOk = TRUE; if (tvState == TV_ON && newstate != TV_ON) { register CARD32 coeff; prepCrtNv (pNv, pNv->TvHead); andCrtNv (pNv, pNv->TvHead, 0x28, 0x7f); commitCrtNv (pNv, pNv->TvHead); coeff = MMIO_IN32 (pNv->riva.PRAMDAC, 0x50C); switch (pNv->TvHead) { case 0: coeff &= ~0x00030000; /* VS_PCLK_TV = None */ break; case 1: coeff &= ~0x000c0000; /* VS_PCLK_TV2 = None */ break; default: /* FIXME error */ break; } MMIO_OUT32 (pNv->riva.PRAMDAC, 0x50C, coeff); /* PLL Coeff Sel */ /* Reset data path */ MMIO_H_AND32 (pNv->riva.PRAMDAC, pNv->TvHead, 0x700, ~0x00001270); NVEnableMonitor (pNv, pNv->TvHead, TRUE); #if 1 /* FIXME experimental */ { int tmp; int i; CARD32 a, b; /* FIXME Head ... */ /* Disable slave CRTC mode */ tmp = readCrtNv (pNv, pNv->TvHead, 0x28) & 0x7b; writeCrtNv (pNv, pNv->TvHead, 0x28, tmp); for (i = 0; i < 25; i++) { /* NV_PCRTC_RASTER */ a = MMIO_H_IN32 (pNv->riva.PCRTC, pNv->TvHead, 0x808); xf86usleep (2000); /* 2ms */ b = MMIO_H_IN32 (pNv->riva.PCRTC, pNv->TvHead, 0x808); RAISE (MSG_DEBUG, "off %08x %08x", a, b); if (a == b) { writeCrtNv (pNv, pNv->TvHead, 0x28, tmp | 0x80); xf86usleep (1000); /* 2ms */ writeCrtNv (pNv, pNv->TvHead, 0x28, tmp); } else { break; } } } #endif } if (newstate != TV_OFF) { register CARD32 tv_setup; /* power down flatpanel */ /* FIXME this is a guess */ if (pNv->arch.heads == 1) { /* For one head, power down FPClk and TMDS */ MMIO_H_OR32 (pNv->riva.PRAMDAC, pNv->TvHead, 0x880, 0x30000000); } else { /* For multiple heads, power down FPClk only */ /* Powering down TMDS even on the other head causes problems */ MMIO_H_OR32 (pNv->riva.PRAMDAC, pNv->TvHead, 0x880, 0x10000000); } /* TV_SETUP: At least for NV11, other head *must* be in same mode */ /* This might cause problems with the flatpanel ... */ /* FIXME: If changing sync polarity, should do it the right way round, and allow a delay to let the lines become tristate */ tv_setup = 0 | ((r->devFlags & DEV_OVERLAY) ? 0x1110 : 0) /* FIXME test this below */ /* | ((r->portHost & PORT_VSYNC_POLARITY) ? 0 : SetBit(4)) | ((r->portHost & PORT_HSYNC_POLARITY) ? 0 : SetBit(3)) */ | ((r->portHost & PORT_SYNC_DIR) ? 0 : SetBit(0)); MMIO_H_OUT32 (pNv->riva.PRAMDAC, pNv->TvHead, 0x700, tv_setup); if (pNv->arch.heads == 2) { MMIO_H_OUT32 (pNv->riva.PRAMDAC, pNv->TvHead ^ 1, 0x700, tv_setup); } pNv->tvEncoder.SetPort (&pNv->tvEncoder, r->portEnc); pNv->tvEncoder.SetRegs (&pNv->tvEncoder, &r->enc, newstate); } if (tvState != newstate) { pNv->tvEncoder.SetState (&pNv->tvEncoder, &r->enc, newstate); } prepCrtNv (pNv, pNv->TvHead); if (r->devFlags & DEV_OVERLAY) { NVSetBlankRegs (pNv, pNv->TvHead, &r->crtc.nv); } else { NVSetAllRegs (pNv, pNv->TvHead, r); } /* FIXME disable DVO ? */ if (newstate == TV_ON) { register CARD32 coeff; andCrtNv (pNv, pNv->TvHead, 0x33, ~0x01); NVEnableDVO (pNv, pNv->TvHead, 0x1); /* 1st DVO port */ /* For NV17orBetter, i.e. NV17, NV18, NV25, NV30: */ /* crt 53, crt 54, 6808c0 */ if ((pNv->arch.exact >= 0x17 && pNv->arch.exact < 0x20) || (pNv->arch.exact >= 0x25 && pNv->arch.exact < 0x2A) || (pNv->arch.exact >= 0x30)) { writeCrtNv (pNv, pNv->TvHead, 0x53, 0x00); writeCrtNv (pNv, pNv->TvHead, 0x54, 0x00); /* Bit 8 of 68x8c0 must be zero on the TV head. It is unclear what this bit means, so we set it to one on the other head (like the resulting driver settings). */ MMIO_H_AND32 (pNv->riva.PRAMDAC, pNv->TvHead, 0x8c0, ~SetBit(8)); MMIO_H_OR32 (pNv->riva.PRAMDAC, pNv->TvHead ^ 1, 0x8c0, SetBit(8)); } if (pNv->arch.exact == 0x25) { /* FIXME only in slave mode?? */ writeCrtNv (pNv, pNv->TvHead, 0x52, 0x00); /* FIXME Not sure, maybe 0x44 ?? */ writeCrtNv (pNv, pNv->TvHead, 0x58, 0x83); /* FIXME Test this */ } /* Check for proper clock frequency if PORT_PCLK_SLAVE */ if ((r->portHost & PORT_PCLK_MODE) != PORT_PCLK_MASTER) { long clock = NVGetClock (pNv, pNv->TvHead); if (clock < pNv->tvEncoder.minClock || clock > pNv->tvEncoder.maxClock) { RAISE (MSG_ERROR, "NVSetTvMode: slave clock out of range."); r->portHost &= ~PORT_PCLK_MODE; /* Master mode */ } } /* FIXME TODO: Only one display is driven by the external clock. This will probably not work for flatpanels. */ coeff = MMIO_IN32 (pNv->riva.PRAMDAC, 0x50C); coeff &= ~0x011f0000; /* TVCLK_SRC=Ext, VS_PCLK_TV 1&2, TV_CLK_RATIO=DB1 */ /* FIXME: DoublePix doesn't work yet */ coeff |= SetBitFlag(r->crtc.nv.flags,NV_FLAG_DOUBLE_PIX,24); switch (pNv->TvHead) { case 0: coeff &= ~0x10000000; /* VCLK_RATIO = DB1 */ if ((r->portHost & PORT_PCLK_MODE) == PORT_PCLK_MASTER) { if (r->devFlags & DEV_OVERLAY) { coeff |= 0x00010000; /* VS_PCLK_TV = VSCLK */ } else { coeff |= 0x00030000; /* VS_PCLK_TV = BOTH */ } } break; case 1: coeff &= ~0x20000000; /* VCLK2_RATIO = DB1 */ if ((r->portHost & PORT_PCLK_MODE) == PORT_PCLK_MASTER) { if (r->devFlags & DEV_OVERLAY) { coeff |= 0x00040000; /* VS_PCLK_TV2 = VSCLK */ } else { coeff |= 0x000c0000; /* VS_PCLK_TV2 = BOTH */ } } break; default: /* FIXME error */ break; } MMIO_OUT32 (pNv->riva.PRAMDAC, 0x50C, coeff); /* PLL Coeff Sel */ if (! (r->devFlags & DEV_OVERLAY)) { andOrCrtNv (pNv, pNv->TvHead, 0x28, (CARD8) ~0xf8, (CARD8) (0x80 | SetBitField(r->crtc.nv.latency,2:0,5:3))); if (! (r->devFlags & DEV_MONITOR)) NVEnableMonitor (pNv, pNv->TvHead, FALSE); } } commitCrtNv (pNv, pNv->TvHead); if (!tvBusOk) RAISE (MSG_ERROR, "I2C Bus error."); tvState = newstate; lockCrtNv (pNv, pNv->TvHead); RAISE (MSG_DEBUG, "} NVSetTvMode"); } /* This is a much simpler version for the XBox. There is no state, just the crtc/fp/encoder registers are changed. */ void XBoxSetTvMode (NVPtr pNv, TVRegs *r) { RAISE (MSG_DEBUG, "XBoxSetTvMode { "); if (r->devFlags == (DEV_TELEVISION | DEV_FLATPANEL)) { tvState = TV_ON; unlockCrtNv (pNv, pNv->TvHead); tvBusOk = TRUE; pNv->tvEncoder.SetPort (&pNv->tvEncoder, r->portEnc); pNv->tvEncoder.SetRegs (&pNv->tvEncoder, &r->enc, TV_ON); if (!tvBusOk) RAISE (MSG_ERROR, "I2C Bus error."); prepCrtNv (pNv, pNv->TvHead); NVSetCrtRegs (pNv, pNv->TvHead, &r->crtc.nv); NVSetFpRegs (pNv, pNv->TvHead, &r->crtc.nv.fp); commitCrtNv (pNv, pNv->TvHead); lockCrtNv (pNv, pNv->TvHead); } RAISE (MSG_DEBUG, "} XBoxSetTvMode"); } long NVGetTvStatus (NVPtr pNv, int index) { long result; unlockCrtNv (pNv, pNv->TvHead); NVUpdateTvState (pNv); tvBusOk = TRUE; result = pNv->tvEncoder.GetStatus (&pNv->tvEncoder, index); if (!tvBusOk) RAISE (MSG_ERROR, "I2C Bus error"); lockCrtNv (pNv, pNv->TvHead); return result; } TVConnect NVGetTvConnect (NVPtr pNv) { TVConnect result; unlockCrtNv (pNv, pNv->TvHead); NVUpdateTvState (pNv); tvBusOk = TRUE; result = pNv->tvEncoder.GetConnect (&pNv->tvEncoder); if (!tvBusOk) RAISE (MSG_ERROR, "I2C Bus error"); lockCrtNv (pNv, pNv->TvHead); return result; } /* head TVCLK VCLK VCLK2 <=400 0 DB2 DB1 1 DB2 DB1 >400 0 DB1 DB1 1 DB1 DB1 TVCLK doubles pixels. */ /* CIO: 0x3c0: ARX index data_write 0x3c1: AR data data_read 0x3c2: INP0 0x3da: INP0_WRITE (MONO/COLOR) ; w: reset ARX to write 0x3ca: INP0_READ VIO: 0x102: VSE1 0x3c2: MISC_WR 0x3c3: VSE2 0x3c4: SRX index 0x3c5: SR data 0x3cc: MISC_RD 0x3ce: GRX index 0x3cf: GR data 3c2.w bit 1: MISC enable cpu access to vidmem 3c2.w bit 1: MISC enable/disable display RAM 3c2.w bit 4: MISC disable video 3c3 bit 0: VGA enable/disable Description: Disables access to display memmory and the other VGA's ports 3c4.01 bit 5: display off -- also TV disp off (only show b/w vertical lines) */ /* 1 port for NV11, NV20, NV17 2 ports for NV25, NV18, NV1F, NV30 DVO ports: [NV17 or better] = NV17, NV18, NV25, NV30 Q: When to initialize the second head? A: Not when it's already in TV mode. */ nvtv-0.4.7/src/tv_tdfx.c0000644000175000001440000006454010005515126010611 /* NVTV 3dfx TV-I2C access -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_tdfx.c,v 1.22 2004/01/27 17:05:26 dthierbach Exp $ * * Contents: * * Routines to control the TV and the I2C bus on a 3dfx (Voodoo) card. * */ #include "local.h" /* before everything else */ #include "xfree.h" #include "xf86_ansic.h" #include "mmio.h" #include "bitmask.h" #include "tv_i2c.h" #include "tv_tdfx.h" #include "xf86i2c.h" /* -------- Documentation -------- */ /* Additional: vgainit0 vidcfg SST_VIDEO_2X_MODE_EN vidpll dacmode SST_DAC_MODE2X screensize stride cursloc startaddr clip0/1min/max src/dstbaseaddr FIXME: bt mux (S-VHS: connect a0) (currently uses CONNECT_CONVERT) auto apply */ /* Registers: * * Reg 10 miscInit0 Register - includes TV blank/sync delay adjust * * ... * 10:8 TV blank signal delay, in flops clocked by the 2x clock. The * objective is to synchronize the blank signal with the data output * by matching the CLUT delay. Default is 0x0. * 000 = 2 flops; 001 = 3 flops; ...... 111 = 9 flops * 13:11 TV vsync and hsync delay, like above. Default is 0x0. * 16:14 Monitor vsync and hsync delay, like above. Default is 0x0. * ... * * Reg 14 miscInit1 Register * * ... * 7 Power Down CLUT. Default is 0x0. * 8 Power Down DAC. Default is 0x0. * 9 Power Down Video PLL. Default is 0x0. * 10 Power Down Graphics PLL. Default is 0x0. * 11 Power Down Memory PLL. Default is 0x0. * ... * * Reg 24 tmuGbeInit Register - includes TV Out clock delay adjust * * ... * 15 tv_out_clk_inv - invert delayed clock. Default = 0. * 19:16 tv_out_clk_del_adj - choose between 16 values of delay. * Default = 0. * ... * * Reg 28 vgaInit0 Register (0x28) * * ... * 1 Use external video timing. This bit is used to retrieve * SYNC information through the normal VGA mechanism when the * VGA CRTC is not providing timing control. * ... * Reg 2c vgaInit1 Register (0x2C) * * ... * 21 Lock Horizontal Timing - 3B4/3D4 index 0,1,2,3,4,5,1a * 22 Lock Vertical Timing -3B4/3D4 index 6,7 (bit 7,5,3,2 and 0), * 9 10, 11 (bits 3:0), 15,16,1b. * 23 Lock H2 - 0x3B4/0x3D4 index 17, bit 2 * ... * * Reg 3c vidTvOutBlankVCount TV Out Vertical Active Start/End * 10: 0 tv_hsync leading edges after leading edge of tv_vsync before * vertical active region starts. * 15:11 reserved * 26:16 tv_hsync leading edges after leading edge of tv_vsync before * vertical active region ends. * 31:27 reserved * * Reg 5c vidProcCfg * * ... * 0 Mode: (0=Video Processor off, VGA mode on, * 1=Video Processor on, VGA mode off). * Clear and set to re-enable video processor. * ... * 4 Half mode (1: enabled). Set for vertical double scan. * ... * 26 Clock 2X mode: Two pixels per video clock. Should halve horizontal * crt values if set. (0:1x, 1:2x) * ... * * Reg 70 vidInFormat Video in format * 3: 1 VMI Video in data format Y/Cb/Cr * (100=4:1:1, 101=YUYV 4:2:2, 110=UYVY 4:2:2) * 4 VMI Video in deinterlacing mode (0=off, 1=weave interlacing) * 5 VMI vmi_vsync_in polarity (1=active low) * 6 VMI vmi_hsync_in polarity (1=active low) * 7 VMI vmi_vactive_in polarity (1=active low) * 8 TV posedge: (1=Brooktree, 0=Chrontel) * (0 = rising /falling edge for G3B5G1B3 / R5G3R3G1 data, * 1 = falling/ rising edge for same data.) * 10: 9 VMI Video in buffering mode (00=single, 01=double, 10=triple buffer) * 11 VMI Video in buffer space type (0=linear, 1=tile) * 12 TV tv_vsync_in polarity (1=active low) * 13 TV tv_hsync_in polarity (1=active low) * 14 VMI interface enable * 15 TV out interface enable * 16 VMI/TV Genlock enable (0=off/slave mode, 1=on/master mode) * 17 VMI/TV Timing signal source (0=vga, 1=generate from device) * Signals are: vert_extra, display_ena, vfrontporch_active, * vbackporch_active, vblank, vga_blank_n, vga_vsync, vga_hsync. * Generated from: vmi_vsync, vmi_hsync or tv_vsync, tv_hsync * Always input: vmi_vactive_in * Always output (?): tv(out)_blank * 18 VMI/TV Genlock source (0=VMI, 1=TV) * 19 TV Select. 0=vga_blank, 1=display_en used to drive output video (?) * 20 VMI Video in horizontal decimation mode (1=on) * 21 VMI Video in vertical decimation mode (1=on) * 31:22 reserved * * Reg 74 vidTvOutBlankHCount TV Out Horizontal Active Start/End * 10: 0 pixel clock cycles after leading edge of tv_hsync before * horizontal active region starts. * 15:11 reserved * 26:16 pixel clock cycles after leading edge of tv_vsync before * horizontal active region ends. * 31:27 reserved * * Reg 7c vidInDecimDeltas == vidTvOutBlankHCount ?? * * Reg 78 vidSerialParallelPort Port control, including DDC/I2C * 0 out VMI parallel interface (1=enable) * 1 out VMI chip selects (CS_N) * 2 out VMI Mode A: Data strobe (DS_N) Mode B: Read (RD_N) * 3 out VMI Mode A: Read/Write (RW_N) Mode B: Write (WR_N) * 4 in VMI Mode A: Data ack (DTACK_N) Mode B: Data ready (RDY) * 5 out VMI Data output enable (0=enabled/out, 1=disabled/in) * 13: 6 i/o VMI Data bus (both input and output) * 17:14 out VMI Address * 18 out DDC port enable (1=enable, 0=disabled (default)) * 19 out DDC clock write (0=DCK low, 1=DCK tristate) * 20 out DDC data write (0=DDA low, 1=DCK tristate) * 21 in DDC clock state * 22 in DDC data state * 23 out TV port enable (1=enable, 0=disabled (default)) * 24 out TV clock write (0=DCK low, 1=DCK tristate) * 25 out TV data write (0=DDA low, 1=DCK tristate) * 26 in TV clock state * 27 in TV data state * 28 out VMI reset (0=reset) * 29 out GPIO pin 1 output * 30 in GPIO pin 2 input * 31 out TV out reset (1=normal, 0=reset (default)) * * Reg 98 vidScreenSize * 11: 0 Width of screen in pixels. * 23:12 Height of screen in lines. * Whenever this is changed, re-enable video processor via vidProcCfg. * This is displayed screen size, not virtual screen size. * */ /* CRTC: HTotal --- --- 1A[0] 0[7] 0[6] 0[5] 0[4] 0[3] 0[2] 0[1] 0[0] HDisplay --- --- 1A[2] 1[7] 1[6] 1[5] 1[4] 1[3] 1[2] 1[1] 1[0] HStartBlank --- --- 1A[4] 2[7] 2[6] 2[5] 2[4] 2[3] 2[2] 2[1] 2[0] HEndBlank --- --- --- --- 1A[5] 5[7] 3[4] 3[3] 3[2] 3[1] 3[0] HStartSync --- --- 1A[6] 4[7] 4[6] 4[5] 4[4] 4[3] 4[2] 4[1] 4[0] HEndSync --- --- --- --- --- 1A[7] 5[4] 5[3] 5[2] 5[1] 5[0] VTotal 1B[0] 7[5] 7[0] 6[7] 6[6] 6[5] 6[4] 6[3] 6[2] 6[1] 6[0] VActiveEnd 1B[3] 7[6] 7[1] 12[7] 12[6] 12[5] 12[4] 12[3] 12[2] 12[1] 12[0] VBlankStart 1B[4] 9[5] 7[3] 15[7] 15[6] 15[5] 15[4] 15[3] 15[2] 15[1] 15[0] VBlankEnd --- --- --- 16[7] 16[6] 16[5] 16[4] 16[3] 16[2] 16[1] 16[0] VSyncStart --- 7[7] 7[2] 10[7] 10[6] 10[5] 10[4] 10[3] 10[2] 10[1] 10[0] VSyncEnd --- --- --- --- --- --- --- 11[3] 11[2] 11[1] 11[0] */ /* -------- Crt access -------- */ /* This is copied from vgaHW.c; and should be moved somewhere else */ /* TODO: Make this uniform with NV stuff */ #define CRT_OFFSET 0xd0 #define TDFX_WR32(p,i,d) MMIO_OUT32(((p)->MMIOBase[0]), (i), (d)) #define TDFX_RD32(p,i) MMIO_IN32(((p)->MMIOBase[0]), (i)) #define TDFX_AND32(p,i,d) MMIO_AND32(((p)->MMIOBase[0]), (i), (d)) #define TDFX_OR32(p,i,d) MMIO_OR32(((p)->MMIOBase[0]), (i), (d)) #define TDFX_WR8(p,i,d) MMIO_OUT8(((p)->MMIOBase[0]), (i), (d)) #define TDFX_RD8(p,i) MMIO_IN8(((p)->MMIOBase[0]), (i)) /* FIXME: variable port addr */ CARD8 readCrtTdfx (TDFXPtr hwp, CARD8 index) { OUTB (hwp->PIOBase[0] + hwp->IOBase + VGA_CRTC_INDEX_OFFSET, index); return INB (hwp->PIOBase[0] + hwp->IOBase + VGA_CRTC_DATA_OFFSET); } void writeCrtTdfx (TDFXPtr hwp, CARD8 index, CARD8 value) { OUTB (hwp->PIOBase[0] + hwp->IOBase + VGA_CRTC_INDEX_OFFSET, index); OUTB (hwp->PIOBase[0] + hwp->IOBase + VGA_CRTC_DATA_OFFSET, value); } /* from vgaHW.c, but with a TDFXPtr, not a vgaHWPtr */ static void TDFXWriteSeq (TDFXPtr hwp, CARD8 index, CARD8 value) { OUTB(hwp->PIOBase[0] - 0x300 + VGA_SEQ_INDEX, index); OUTB(hwp->PIOBase[0] - 0x300 + VGA_SEQ_DATA, value); } static CARD8 TDFXReadSeq (TDFXPtr hwp, CARD8 index) { OUTB(hwp->PIOBase[0] - 0x300 + VGA_SEQ_INDEX, index); return INB(hwp->PIOBase[0] - 0x300 + VGA_SEQ_DATA); } /* -------- I2C Driver Routines -------- */ #define VIDINFORMAT 0x70 /* lm_sensor: REG2 */ #define VIDSERIALPARALLELPORT 0x78 /* lm_sensor: REG */ /* bit locations in the register */ #define DDC_ENAB 0x00040000 #define DDC_SCL_OUT 0x00080000 #define DDC_SDA_OUT 0x00100000 #define DDC_SCL_IN 0x00200000 #define DDC_SDA_IN 0x00400000 #define I2C_ENAB 0x00800000 #define I2C_SCL_OUT 0x01000000 #define I2C_SDA_OUT 0x02000000 #define I2C_SCL_IN 0x04000000 #define I2C_SDA_IN 0x08000000 /* delays */ #define CYCLE_DELAY 10 #define TIMEOUT 50 /* Bus private structure. Necessary, even though it has only one element, because unified destruction won't work otherwise. */ typedef struct { TDFXPtr pTdfx; } TDFXTvI2CRec, *TDFXTvI2CPtr; static void TDFXTvI2CGetBits(I2CBusPtr b, int *clock, int *data) { TDFXTvI2CPtr priv = (TDFXTvI2CPtr) b->DriverPrivate.ptr; TDFXPtr pTdfx = priv->pTdfx; register CARD32 val; val = TDFX_RD32(pTdfx, VIDSERIALPARALLELPORT); *clock = (val & I2C_SCL_IN) != 0; *data = (val & I2C_SDA_IN) != 0; } static void TDFXTvI2CPutBits(I2CBusPtr b, int clock, int data) { TDFXTvI2CPtr priv = (TDFXTvI2CPtr) b->DriverPrivate.ptr; TDFXPtr pTdfx = priv->pTdfx; register CARD32 val; val = TDFX_RD32(pTdfx, VIDSERIALPARALLELPORT); if (clock) val |= I2C_SCL_OUT; else val &= ~I2C_SCL_OUT; if (data) val |= I2C_SDA_OUT; else val &= ~I2C_SDA_OUT; TDFX_WR32(pTdfx, VIDSERIALPARALLELPORT, val); } I2CBusPtr TDFXTvBusCreate (TDFXPtr pTdfx, char *name) { I2CBusPtr I2CPtr; TDFXTvI2CPtr priv; I2CPtr = xf86CreateI2CBusRec(); priv = xcalloc (1, sizeof (TDFXTvI2CRec)); if (priv) { priv->pTdfx = pTdfx; } if (I2CPtr) { I2CPtr->BusName = name; I2CPtr->scrnIndex = -1; I2CPtr->I2CPutBits = TDFXTvI2CPutBits; I2CPtr->I2CGetBits = TDFXTvI2CGetBits; /* Not sure about the delays. lm_sensors has udelay = mdelay = CYCLE = 10, * and timeout = TIMEOUT = 50. udelay is used after each bit changes, * mdelay is used after bytes are send, and timeout is used when trying * to set the clk high. The values used are about 10x larger than the * default, so it should work, hopefully. */ /* FIXME: Make these shorter, and see if it still works */ I2CPtr->AcknTimeout = 50; /* usec, default: 5 */ I2CPtr->HoldTime = 10; /* usec, default: 5 */ I2CPtr->BitTimeout = 50; /* usec, default: 5 */ I2CPtr->ByteTimeout = 50; /* usec, default: 5 */ I2CPtr->AcknTimeout = 50; /* usec, default: 5 */ I2CPtr->StartTimeout = 50; /* usec, default: 5 */ I2CPtr->RiseFallTime = 10; /* usec, default: 2 */ I2CPtr->DriverPrivate.ptr = priv; } if (I2CPtr && priv && xf86I2CBusInit (I2CPtr)) { return I2CPtr; } if (I2CPtr && priv) { RAISE (MSG_ERROR, "Bus %s is not unique", name); } else { RAISE (MSG_ERROR, "Out of memory"); } TVDestroyBus (I2CPtr); return NULL; } Bool TDFXTvBusInit (TDFXPtr pTdfx) { pTdfx->TvChain = NULL; /* Must be named TV0, TV1, etc.; otherwise I2C_ID won't work */ pTdfx->TvBus = TDFXTvBusCreate (pTdfx, "TV0"); return (pTdfx->TvBus != NULL); } void TDFXTvBusConfig (TDFXPtr pTdfx) { register CARD32 val; RAISE (MSG_DEBUG, "tdfx bus config"); val = TDFX_RD32(pTdfx, VIDINFORMAT); val &= ~SetBit(12) /* TV vsync active high (as for nv) */ & ~SetBit(13) /* TV hsync active high (as for nv) */ & ~SetBit(15) /* TV interface disable */ & ~SetBit(16) /* Genlock disable */ & ~SetBit(17) /* VGA signals */ & ~SetBit(19); /* Select vga_blank instead of display_ena */ val |= SetBit(8); /* Posedge = Brooktree mode */ // | SetBit(19); /* Select display_ena instead of vga_blank */ TDFX_WR32(pTdfx, VIDINFORMAT, val); val = TDFX_RD32(pTdfx, VIDSERIALPARALLELPORT); val |= SetBit(23) /* I2C port enable */ | SetBit(24) /* SCK tri state */ | SetBit(25) /* SDA tri state */ | SetBit(31); /* TV out reset disable */ TDFX_WR32(pTdfx, VIDSERIALPARALLELPORT, val); } /* -------- CRT -------- */ void TDFXSetCrtRegs (TDFXPtr pTdfx, TVTdfxRegs *r) { int horizDisplay = (r->HDisplay/8) - 1; int horizBlankStart = (r->HBlankStart/8) - 1; int horizSyncStart = (r->HSyncStart/8) ; int horizSyncEnd = (r->HSyncEnd/8) ; int horizBlankEnd = (r->HBlankEnd/8) - 1; int horizTotal = (r->HTotal/8) - 5; int vertDisplay = r->VDisplay - 1; int vertBlankStart = r->VBlankStart - 1; int vertSyncStart = r->VSyncStart ; int vertSyncEnd = r->VSyncEnd ; int vertBlankEnd = r->VBlankEnd - 1; int vertTotal = r->VTotal - 2; /* horizSkew = (r->HSkew/8) + 1; */ RAISE (MSG_DEBUG, "TDFXSetCrtRegs %i %i", r->HDisplay, r->VDisplay); #ifdef FAKE_CRTC FPRINTF ("\ncrt["); #endif /* Unlock */ writeCrtTdfx (pTdfx, 0x11, readCrtTdfx (pTdfx, 0x11) | 0x80); writeCrtTdfx (pTdfx, 0x00, Set8Bits(horizTotal)); writeCrtTdfx (pTdfx, 0x01, Set8Bits(horizDisplay)); writeCrtTdfx (pTdfx, 0x02, Set8Bits(horizBlankStart)); writeCrtTdfx (pTdfx, 0x03, SetBitField(horizBlankEnd,4:0,4:0) | 0 /* SetBitField(horizSkew,1:0,6:5) */ | SetBit(7)); /* index 03; 7 vert_retrace_acces = 1 */ writeCrtTdfx (pTdfx, 0x04, Set8Bits(horizSyncStart)); writeCrtTdfx (pTdfx, 0x05, SetBitField(horizBlankEnd,5:5,7:7) | SetBitField(horizSyncEnd,4:0,4:0)); writeCrtTdfx (pTdfx, 0x06, Set8Bits(vertTotal)); writeCrtTdfx (pTdfx, 0x07, SetBitField(vertTotal,8:8,0:0) | SetBitField(vertDisplay,8:8,1:1) | SetBitField(vertSyncStart,8:8,2:2) | SetBitField(vertDisplay,8:8,3:3) | SetBit(4) /* line_compare_8 */ | SetBitField(vertTotal,9:9,5:5) | SetBitField(vertDisplay,9:9,6:6) | SetBitField(vertSyncStart,9:9,7:7)); writeCrtTdfx (pTdfx, 0x08, 0x00); writeCrtTdfx (pTdfx, 0x09, SetBitField(vertBlankStart,9:9,5:5) | SetBit(6) /* line_compare_9 */ | 0 /* SetBitField(VScan-1,4:0,4:0) */ | 0 /* ((r->flags & V_DBLSCAN) ? SetBit(7) : 0x00) */ ); /* index 09: 4:0 multi_scan (num of lines-1) */ writeCrtTdfx (pTdfx, 0x10, Set8Bits(vertSyncStart)); writeCrtTdfx (pTdfx, 0x11, SetBitField(vertSyncEnd,3:0,3:0) | SetBit(5) /* disable vert retrace intr */ | SetBit(8) /* keep it unlocked */); writeCrtTdfx (pTdfx, 0x12, Set8Bits(vertDisplay)); writeCrtTdfx (pTdfx, 0x14, 0x00); /* underline, double word */ writeCrtTdfx (pTdfx, 0x15, Set8Bits(vertBlankStart)); writeCrtTdfx (pTdfx, 0x16, Set8Bits(vertBlankEnd)); writeCrtTdfx (pTdfx, 0x18, 0xff); /* line_compare_7_0 */ writeCrtTdfx (pTdfx, 0x1a, SetBitField(horizTotal,8:8,0:0) | SetBitField(horizDisplay,8:8,2:2) | SetBitField(horizBlankStart,8:8,4:4) | SetBitField(horizBlankEnd,6:6,5:5) | SetBitField(horizSyncStart,8:8,6:6) | SetBitField(horizSyncEnd,5:5,7:7)); writeCrtTdfx (pTdfx, 0x1b, SetBitField(vertTotal,10:10,0:0) | SetBitField(vertDisplay,10:10,2:2) | SetBitField(vertBlankStart,10:10,4:4) | SetBitField(vertSyncStart,10:10,6:6)); #ifdef FAKE_CRTC FPRINTF ("]\n"); #endif } void TDFXGetCrtRegs (TDFXPtr pTdfx, TVTdfxRegs *r) { int horizDisplay; int horizBlankStart; int horizSyncStart; int horizSyncEnd; int horizBlankEnd; int horizTotal; int vertDisplay; int vertBlankStart; int vertSyncStart; int vertSyncEnd; int vertBlankEnd; int vertTotal; RAISE (MSG_DEBUG, "TDFXGetCrtRegs ["); horizTotal = Set8Bits(readCrtTdfx(pTdfx, 0x00)) | SetBitField(readCrtTdfx(pTdfx, 0x1a),0:0,8:8); horizDisplay = Set8Bits(readCrtTdfx(pTdfx, 0x01)) | SetBitField(readCrtTdfx(pTdfx, 0x1a),2:2,8:8); horizBlankStart = Set8Bits(readCrtTdfx(pTdfx, 0x02)) | SetBitField(readCrtTdfx(pTdfx, 0x1a),4:4,8:8); horizBlankEnd = SetBitField(readCrtTdfx(pTdfx, 0x03),4:0,4:0) | SetBitField(readCrtTdfx(pTdfx, 0x05),7:7,5:5) | SetBitField(readCrtTdfx(pTdfx, 0x1a),5:5,6:6); horizSyncStart = Set8Bits(readCrtTdfx(pTdfx, 0x04)) | SetBitField(readCrtTdfx(pTdfx, 0x1a),6:6,8:8); horizSyncEnd = SetBitField(readCrtTdfx(pTdfx, 0x05),4:0,4:0) | SetBitField(readCrtTdfx(pTdfx, 0x1a),7:7,5:5); vertTotal = Set8Bits(readCrtTdfx(pTdfx, 0x06)) | SetBitField(readCrtTdfx(pTdfx, 0x07),0:0,8:8) | SetBitField(readCrtTdfx(pTdfx, 0x07),5:5,9:9) | SetBitField(readCrtTdfx(pTdfx, 0x1b),0:0,10:10); vertDisplay = Set8Bits(readCrtTdfx(pTdfx, 0x12)) | SetBitField(readCrtTdfx(pTdfx, 0x07),1:1,8:8) | SetBitField(readCrtTdfx(pTdfx, 0x07),6:6,9:9) | SetBitField(readCrtTdfx(pTdfx, 0x1b),3:3,10:10); vertBlankStart = Set8Bits(readCrtTdfx(pTdfx, 0x15)) | SetBitField(readCrtTdfx(pTdfx, 0x07),3:3,8:8) | SetBitField(readCrtTdfx(pTdfx, 0x09),5:5,9:9) | SetBitField(readCrtTdfx(pTdfx, 0x1b),4:4,10:10); vertBlankEnd = Set8Bits(readCrtTdfx(pTdfx, 0x16)); vertSyncStart = Set8Bits(readCrtTdfx(pTdfx, 0x10)) | SetBitField(readCrtTdfx(pTdfx, 0x07),2:2,8:8) | SetBitField(readCrtTdfx(pTdfx, 0x07),7:7,9:9); vertSyncEnd = SetBitField(readCrtTdfx(pTdfx, 0x11),3:0,3:0); /* It is not clear if blank end is relative to blank start or total. I have chosen total here, since blank end is equal to total normally, anyway. */ horizBlankEnd |= SetBitField (horizTotal,8:7,8:7); while (horizBlankEnd < horizTotal) horizBlankEnd += SetBit (7); horizSyncEnd |= SetBitField (horizSyncStart,8:6,8:6); while (horizSyncEnd < horizSyncStart) horizSyncEnd += SetBit (6); vertBlankEnd |= SetBitField (vertTotal,10:8,10:8); while (vertBlankEnd < vertTotal) vertBlankEnd += SetBit (8); while (vertSyncStart < vertDisplay) vertSyncStart += SetBit (10); vertSyncEnd |= SetBitField (vertSyncStart,10:4,10:4); while (vertSyncEnd < vertSyncStart) vertSyncEnd += SetBit (4); r->HDisplay = (horizDisplay + 1) * 8; r->HBlankStart = (horizBlankStart + 1) * 8; r->HBlankEnd = (horizBlankEnd + 1) * 8; r->HSyncStart = (horizSyncStart ) * 8; r->HSyncEnd = (horizSyncEnd ) * 8; r->HTotal = (horizTotal + 5) * 8; r->VDisplay = vertDisplay + 1; r->VBlankStart = vertBlankStart + 1; r->VBlankEnd = vertBlankEnd + 1; r->VSyncStart = vertSyncStart ; r->VSyncEnd = vertSyncEnd ; r->VTotal = vertTotal + 2; r->clock = 0; RAISE (MSG_DEBUG, "%i %i %i %i, %i %i %i %i]", r->HDisplay, r->HSyncStart, r->HSyncEnd, r->HTotal, r->VDisplay, r->VSyncStart, r->VSyncEnd, r->VTotal); } void TDFXSetTvRegs (TDFXPtr pTdfx, TVTdfxRegs *r) { register CARD32 val; RAISE (MSG_DEBUG, "tdfx set extra v=%i/%i h=%i/%i", r->tvVBlankStart, r->tvVBlankEnd, r->tvHBlankStart, r->tvHBlankEnd); TDFX_WR32(pTdfx, 0x3c, SetBitField (r->tvVBlankStart,10:0,10:0) | SetBitField (r->tvVBlankEnd,10:0,26:16)); TDFX_WR32(pTdfx, 0x74, SetBitField (r->tvHBlankStart,10:0,10:0) | SetBitField (r->tvHBlankEnd,10:0,26:16)); val = TDFX_RD32 (pTdfx, 0x10); /* miscInit0 */ val &= ~SetBitField (-1,5:0,13:8); val |= SetBitField (r->tvBlankDelay,2:0,10:8) | SetBitField (r->tvSyncDelay,2:0,13:11); TDFX_WR32 (pTdfx, 0x10, val); val = TDFX_RD32(pTdfx, 0x24); /* tmuGbeInit */ val &= ~SetBitField (-1,3:0,19:16);; val |= SetBitField (r->tvLatency,3:0,19:16); TDFX_WR32(pTdfx, 0x24, val); } void TDFXGetTvRegs (TDFXPtr pTdfx, TVTdfxRegs *r) { RAISE (MSG_DEBUG, "tdfx get extra"); r->tvVBlankStart = SetBitField (TDFX_RD32 (pTdfx, 0x3c),10:0,10:0); r->tvVBlankEnd = SetBitField (TDFX_RD32 (pTdfx, 0x3c),26:16,10:0); r->tvHBlankStart = SetBitField (TDFX_RD32 (pTdfx, 0x74),10:0,10:0); r->tvHBlankEnd = SetBitField (TDFX_RD32 (pTdfx, 0x74),26:16,10:0); r->tvBlankDelay = SetBitField (TDFX_RD32 (pTdfx, 0x10),10:8,2:0); r->tvSyncDelay = SetBitField (TDFX_RD32 (pTdfx, 0x10),13:11,2:0); r->tvLatency = SetBitField (TDFX_RD32 (pTdfx, 0x24),19:16,3:0); } void TDFXSetAllRegs (TDFXPtr pTdfx, TVRegs *r) { /* Maybe CRT regs are not needed for TV ? */ if ((r->devFlags & DEV_MONITOR) || ((r->portHost & PORT_SYNC_DIR) == PORT_SYNC_IN)) { TDFXSetCrtRegs (pTdfx, &r->crtc.tdfx); } if (r->devFlags & DEV_TELEVISION) { TDFXSetTvRegs (pTdfx, &r->crtc.tdfx); } #if 0 { register CARD8 val; val = TDFXReadSeq (pTdfx, 0x1); if (r->crtc.tdfx.flags & TDFX_FLAG_DOUBLE_PIX) { val |= SetBit (3); } else { val |= ~SetBit (3); } TDFXWriteSeq (pTdfx, 0x1, val); } #endif TDFX_WR32(pTdfx, 0x98, SetBitField (r->crtc.tdfx.HScreenSize,11:0,11:0) | SetBitField (r->crtc.tdfx.VScreenSize,11:0,23:12)); if (r->crtc.tdfx.flags & TDFX_FLAG_HALF_MODE) { TDFX_OR32 (pTdfx, 0x5c, SetBit(4)); } else { TDFX_AND32 (pTdfx, 0x5c, ~SetBit(4)); } if (r->crtc.tdfx.flags & TDFX_FLAG_CLOCK2X) { TDFX_OR32 (pTdfx, 0x5c, SetBit(26)); TDFX_OR32 (pTdfx, 0x4c, SetBit(0)); } else { TDFX_AND32 (pTdfx, 0x5c, ~SetBit(26)); TDFX_AND32 (pTdfx, 0x4c, ~SetBit(0)); } } void TDFXGetAllRegs (TDFXPtr pTdfx, TVRegs *r) { TDFXGetCrtRegs (pTdfx, &r->crtc.tdfx); TDFXGetTvRegs (pTdfx, &r->crtc.tdfx); r->crtc.tdfx.HScreenSize = SetBitField (TDFX_RD32 (pTdfx, 0x98),11:0,11:0); r->crtc.tdfx.VScreenSize = SetBitField (TDFX_RD32 (pTdfx, 0x98),23:12,11:0); r->crtc.tdfx.flags = 0; if (GetBit(TDFX_RD32 (pTdfx, 0x5c), 26)) r->crtc.tdfx.flags |= TDFX_FLAG_CLOCK2X; } /* -------- Device enable/disable -------- */ int TDFXGetDevFlags (TDFXPtr pTdfx) { if (GetBit (readCrtTdfx (pTdfx, 0x70), 15)) { return DEV_TELEVISION; } else { return DEV_MONITOR; } } /* -------- Device routines -------- */ void TDFXSetTvDevice (TDFXPtr pTdfx, I2CChainPtr chain, Bool init) { RAISE (MSG_DEBUG, "tdfx set dev %p %i", chain, init); TVSetTvEncoder (&pTdfx->tvEncoder, chain, NULL); tvBusOk = TRUE; pTdfx->tvEncoder.InitRegs (&pTdfx->tvEncoder, PORT_TDFX); } void TDFXProbeTvDevices (TDFXPtr pTdfx) { if (!pTdfx) return; /* TDFXUpdateTvState (pTdfx); */ tvState = TV_OFF; TVCheckChain (pTdfx->TvChain); pTdfx->TvChain = TVProbeCreateKnown (&pTdfx->TvBus, 1, NULL); } /* -------- -------- */ void TDFXUpdateTvState (TDFXPtr pTdfx) { #ifndef FAKE_MMIO if (GetBit (TDFX_RD32(pTdfx, VIDINFORMAT), 15)) { tvState = TV_ON; } else { if (tvState != TV_BARS) tvState = TV_OFF; } #endif } void TDFXSetTestImage (TDFXPtr pTdfx, TVEncoderRegs *r) { /* FIXME chip registers ... */ RAISE (MSG_DEBUG, "tdfx tv testimage"); TDFXUpdateTvState (pTdfx); if (tvState != TV_ON) { /* Only do bars if not in tv-mode */ pTdfx->tvEncoder.SetState (&pTdfx->tvEncoder, r, TV_BARS); } } void TDFXSetTvMode (TDFXPtr pTdfx, TVRegs *r) { register CARD32 val; TVState oldState, newState; /* hack for now, FIXME */ TDFXUpdateTvState (pTdfx); oldState = tvState; newState = (r->devFlags & DEV_TELEVISION) ? TV_ON : TV_OFF; RAISE (MSG_DEBUG, "tdfx set tv mode %i -> %i", oldState, newState); if (oldState == TV_ON && newState != TV_ON) { RAISE (MSG_DEBUG, "tdfx set tv off"); val = TDFX_RD32(pTdfx, VIDINFORMAT); val &= ~SetBit(15) /* TV interface enable off */ & ~SetBit(16) /* Genlock enable off */ & ~SetBit(17) /* Timing from device */ & ~SetBit(18); /* Genlock source TV */ TDFX_WR32(pTdfx, VIDINFORMAT, val); } if (oldState != newState) { pTdfx->tvEncoder.SetState (&pTdfx->tvEncoder, &r->enc, newState); } TDFXSetAllRegs (pTdfx, r); if (newState != TV_OFF) { pTdfx->tvEncoder.SetPort (&pTdfx->tvEncoder, r->portEnc); pTdfx->tvEncoder.SetRegs (&pTdfx->tvEncoder, &r->enc, newState); } if (oldState != TV_ON && newState == TV_ON) { RAISE (MSG_DEBUG, "tdfx set tv on %08lX", val); val = TDFX_RD32(pTdfx, VIDINFORMAT); val |= SetBit(15) /* TV interface enable on */ | SetBit(16) /* Genlock enable on */ | SetBit(18); /* Genlock source TV */ /* FIXME: If changing sync polarity, should do it the right way round, and allow a delay to let the lines become tristate */ if ((r->portHost & PORT_SYNC_DIR) == PORT_SYNC_IN) { val &= ~SetBit(17); /* Timing from vga */ } else { val |= SetBit(17); /* Timing from device */ } TDFX_WR32(pTdfx, VIDINFORMAT, val); val = TDFX_RD32(pTdfx, 0x24); /* tmuGbeInit */ if ((r->portHost & PORT_PCLK_POLARITY) == PORT_PCLK_LOW) { val |= SetBit(15); /* invert tv_out_clk */ } else { val &= ~SetBit(15); /* normal tv_out_clk */ } TDFX_WR32(pTdfx, 0x24, val); } tvState = newState; /* Reset video processor */ TDFX_AND32 (pTdfx, 0x5c, ~SetBit(0)); xf86usleep(1000); /* guess */ TDFX_OR32 (pTdfx, 0x5c, SetBit(0)); } long TDFXGetTvStatus (TDFXPtr pTdfx, int index) { long result; TDFXUpdateTvState (pTdfx); tvBusOk = TRUE; result = pTdfx->tvEncoder.GetStatus (&pTdfx->tvEncoder, index); return result; } TVConnect TDFXGetTvConnect (TDFXPtr pTdfx) { TVConnect result; TDFXUpdateTvState (pTdfx); tvBusOk = TRUE; result = pTdfx->tvEncoder.GetConnect (&pTdfx->tvEncoder); return result; } nvtv-0.4.7/src/tv_i810.c0000644000175000001440000006516510005765315010340 /* NVTV i810 TV-I2C access -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_i810.c,v 1.24 2004/01/28 17:01:01 dthierbach Exp $ * * Contents: * * Routines to control the TV and the I2C bus on Intel i810 etc. cards. * */ #include "local.h" /* before everything else */ #include "xfree.h" #include "mmio.h" #include "bitmask.h" #include "tv_i2c.h" #include "tv_i810.h" #include "xf86i2c.h" /* -------- Registers -------- */ #define I810_WR32(p,i,d) MMIO_OUT32(((p)->MMIOBase), (i), (d)) #define I810_RD32(p,i) MMIO_IN32(((p)->MMIOBase), (i)) #define I810_H_RD32(p,h,i) MMIO_IN32(((p)->MMIOBase), ((i)+0x1000*(h))) #define I810_H_WR32(p,h,i,d) MMIO_OUT32(((p)->MMIOBase), ((i)+0x1000*(h)), (d)) #define I810_GPIOA 0x05010 #define I810_GPIOB 0x05014 #define I830_GPIOC 0x05018 /* M_I2C */ #define I845_GPIOD 0x0501c /* Not sure if it is used */ #define I845_GPIOE 0x05020 /* */ #define I810_DCLK(i) (0x06000 + (i)*4) #define I810_DCLK_0D 0x06000 #define I810_DCLK_1D 0x06004 #define I810_DCLK_2D 0x06008 #define I810_LCD_CLKD 0x0600c #define I810_DCLK_0DS 0x06010 #define I810_PWR_CLKC 0x06014 #define I810_LCDTV_C 0x60018 #define I810_OVRACT 0x6001c #define I810_BCLRPAT 0x60020 #define I810_LCD_CLKD 0x0600c /* This is an attempt to explain the i830 registers as far as I can * guess them. Some of it may be severely wrong. * * The i845 seems to be similar enough. DVO port A is gone, there is * only one pipe, and plane B seems to be gone as well. Available planes * are primary, cursor, and overlay. There is now a video engine which * extends/replaces the motion compensation block. * * The i845 can support synchronous display on two devices, unless one of * them is a TV (because of the low clock?), or both are digital devices. * The overlay engine can also use an external capture device as source. * * The i865 also has only one pipe, one plane, and no DVO port A. * DVO ports are each capable of driving a 165 MHz pixel clock. Each * port is capable of driving a digital display up to 1600x1200 @ * 60Hz. When in dual-channel mode, the GMCH can drive a flat panel * up to 2048x1536 @ 60Hz or dCRT/HDTV up to 1920x1080 @ 85Hz. * * The multiplexed digital display interface uses the MDVI_CLK and * MDVI_DATA signals to interrogate the panel. The i865 supports the * DDC2B protocol to initiate the transfer of EDID data. The * multiplexed digital display interface uses the M_I2C bus to * interrogate the external transmitter. A third set of signals * (MDDC_CLK and MDDC_DATA) is available for a variety of * purposes. They can be used as a second DDC pair when two TMDS * transmitters are used, or as a second I2C pair if there are * multiple devices (e.g., PROM and DVO device) that need I2C and * there is a speed or addressing conflict. * * Since the i865 has several display ports available for its single * pipe, it can support a synchronous display on 2 or 3 displays, * unless one of the displays is a TV. No synchronous display is * available when a TV is in use. The i865 cannot drive multiple * displays concurrently (different data or timings). In addition, * the i865 cannot operate in parallel with an external AGP device. * * 1. Architecture overview * * The i830 emulates two PCI cards. The register of the PCI cards seem * to shadow each other, and the X driver only uses the first card. * * There are several parts used for graphic output: * * Display planes A,B,C --> Pipes A,B --> Analog/Digital Ports * I2C control for TV encoder. * * Some registers may be double buffered, and may need a write to another * register to commit. * * Here are some definitions from the i845G data sheet: * * A PLANE consists of a rectangular shaped image that has * characteristics such as source, size, position, method, and * format. These planes get attached to source surfaces that are * rectangular memory surfaces with a similar set of characteristics. * They are also associated with a destination pipe. * * A PIPE consists of a set of combined planes and a timing generator. * * * 2. I2C control * * Chipset I2C lines Known TV * i810 DDC; LTV GPIOB ('TV0') = LTV * i830 DDC1, I2C, DDC2; M_DDC, M_I2C GPIOC ('TV1') = M_I2C * i845 DDC_A; MI2C, MDVI, MDDC GPIOE ('TV2') * i865 DDC_A; MI2C, MDVI, MDDC GPIOE ('TV2') = M_I2C * * On the i830, DVO port A uses DDC2 or I2C, DVO ports B/C use M_I2C * or M_DDC. The DDC ports are used for EDID display information * transfer from the monitor (typically at address 0xA0) or flat * panel. On the I2C port (nvtv bus 0) there is a device at 0x04, * probably a flat panel controller. * * The i865 implements a hardware GMBus controller that can be used * to control these signals. This allows higher speed transactions * (up to 400 kHz) on theses lines than was allowed with previous * software centric `bit-bashing' techniques. * * 0x05010 GPIOA General purpose I/O A, one of the DDC ports. * 0x05014 GPIOB General purpose I/O B, I2C port. * 0x05018 GPIOC General purpose I/O C, M_I2C port. * 0x05020 GPIOE General purpose I/O E (for i845) * 31:13 reserved * 12 GPIO1 data in * 11 GPIO1 data value * 10 GPIO1 data mask (1=write data) * 9 GPIO1 direction value (0=input, 1=output) * 8 GPIO1 direction mask (1=write direction) * 7: 5 reserved * 4 GPIO0 data in * 3 GPIO0 data value * 2 GPIO0 data mask * 1 GPIO0 direction value * 0 GPIO0 direction mask * * GPIO1 is the data pin, GPIO0 is the clock pin. Maybe there are even * more GPIO registers? * * 3. Display planes * * There are (at least) 3 display planes: * * A primary display plane * B 'sprite' plane (for specific laptop display information?) * C overlay plane (can also be directly sent in YUV format to DVO) * * The datasheet diagram shows overlay, sprite, two cursor, and primary and * secondary display units. Maybe those correspond to the planes. The * datasheet also meantions a popup plane for mobile applications. * The single overlay plane can only displayed on "single-pipe simultanious * displays" for multi-monitors. (For the i810, 0x70008 PIXCONF * has some of the functions used here.) For the i865, these registers * seem to be somewhere else. * * 0x70180 DSPACTRL Display plane A control * 0x71180 DSPBCTRL Display plane B control * 31 plane enable (1=enabled) * 30 gamma correction enable (0=bypass, 1=enabled) * 29:26 pixformat (2=8BPP, 4=15_16BPP, 5=16BPP, 6=32BPP_NO_ALPHA, 7=32BPP) * 25 stereo enable (1=enabled) * 24 select pipe (0=A, 1=B) * 23 reserved * 22 source key enable (1=enabled) * 21:20 pixel multiplicity (0=normal, 1=doubleline, 2=3=reserved) * 19 reserved * 18 stereo polarity (0=first, 1=second) * 17-16 reserved * 15 alpha transfer mode (1=enabled) ; B only * 14- 1 reserved * 0 sprite_above (0=display A, 1=overlay) ; B only * * Note: 8BPP is indexed, 15_16BPP is 5-5-5, 16BPP is 5-6-5, * 32BPP_NO_ALPHA is X:8:8:8, and 32BPP is 8:8:8:8. * * Note: Stereo requires two start (base) addresses, at least for plane B. * * I don't understand why a display plane has to connect to a pipe, * unless the display plane cannot be read by both pipes simultaniosly * (which would be bad, because it would mean no "TwinView" feature.) * * 0x70184 DSPABASE Display plane A base address * 0x71184 DSPBBASE Display plane B base address * * 0x70188 DSPASTRIDE Display plane A stride (= pitch) * 0x71188 DSPBSTRIDE Display plane B stride (= pitch) * 31-16 UNKNOWN, 15CF/0001 * ?- 0 stride * * 4. Pipes * * There are two pipes, which control the timing. * * 0x60000 HTOTAL_A * 0x60004 HBLANK_A * 0x60008 HSYNC_A * 0x6000c VTOTAL_A * 0x60010 VBLANK_A * 0x60014 VSYNC_A * 0x6001c PIPEASRC * 26:16 horizontal (= HTOTAL displayed) * 10: 0 vertical (= VTOTAL displayed) * 0x60020 BCLRPAT border color pattern * * Identical registers for pipe B at 0x61000-0x61020 * On the i810, there also was the LCDTV_C register, which is probably * not any longer supported. * * 0x60018 LCDTV_C LCD/TV-Out control register * * 0x70008 PIPEACONF (PIXCONF for i810) * 31 enable (1=enabled) * 30 width (1=double, 0=single) * 29:27 reserved * 25 lock (1=locked) ; unclear * 24 (0=palette, 1=gamma) * 23: 0 reserved * 0x71008 PIPEBCONF * 31 enable (1=enabled) * 30:25 reserved * 24 (0=palette, 1=gamma) * 23: 0 reserved * * 0x71400 UNKNOWN (= 0020008e) * * 5. Analog/Digital Ports * * There are three dedicated Digital Video Ports and one Analog Port. * DVOB and C are multixplexed with the AGP pins. The local flat panel * (LFP) is normally connected to DVOA. DVOB and DVOC may be combined * into one 24bit wide port. DVO port signals are: * * CLK/CLK# differental clock output up to 165 MHz * D[11:0] 12bit data * HSYNC outgoing HSync with programmable polarity * VSYNC outgoing VSync with programmable polarity * BLANK# outgoing blank period or border period signal * INTR incoming interrupt (DVOA and DVOBC) * CLKINT incoming clock or second interrupt (DVOA and DVOBC) * FLD/STL incoming TV field (to synchronize overlay) or FP stall signal * * The DPLL registers control the phase locked loops that convert the * incoming to the outgoing clock, or possibly some internal clock to * the outgoing clock. They are associated to the corresponding pipe. * * 0x06014 DPLL_A * 0x06018 DPLL_B * 31:28 UNKNOWN (M or N ?) (=0xd for TFT and TV; 8,9 for mon) * 27:24 reserved * 23 post divisor (loop divide flag?) * 22 reserved * 21:16 post divisor (P ?) * 15 reserved * 14:13 UNKNOWN (=0 for LCD/mon, =2 for TV ?) * 12: 0 reserved * * 0x61100 ADPA * 31 DAC enable (1=enabled) (=monitor enabled) * 30 Pipe select (0=A, 1=B) [maybe doesn't work] * 29:16 reserved * 15 Use_VGA_HVPolarity (0=Sets HVPolarity) * 14:12 UNKNOWN * 11 VSync control disable (1=disabled) * 10 HSync control disable (1=disabled) * 9: 5 reserved * 4 VSync active (0=low, 1=high) * 3 HSync active (0=low, 1=high) * 2: 0 reserved * * For the 3 DVO ports, only the enable bit is known. Other bits may * include interrupt handling, polarity control for blank and sync signals, * configuration of clock vs. second interrupt and field vs. stall. * * 0x61120 DVOA * 0x61140 DVOB * 0x61160 DVOC * 31 DVO enable (1=enabled) * 30 Pipe select [?] (0=A, 1=B) * 29 UNKNOWN, set for Monitor/LFP xinerama * 15: 0 UNKNOWN (maybe identical to ADPA??) * 14 UNKNOWN, set for LFP1 * 8 UNKNOWN, clear LFP, set for TV * 7 UNKNOWN, set for LFP1 and TV * 6 UNKNOWN, clear for LFP, set for TV (external clock?) * 4 UNKNOWN, set for LFP12 (VSync active high?) clear for TV * 3 UNKNOWN, set for LFP12 (HSync active high?) clear for TV * 2 UNKNOWN, set for LFP12 TV * * 0x61180 LVDS meaning unknown (not needed ?) (used in i855 instead of DVO) * * Here LFPx refer to flat panel dumps. [?] Means a guess. * * 0x61124 DVOA_SRCDIM * 0x61144 DVOB_SRCDIM * 0x61164 DVOC_SRCDIM * 23:12 (not needed ?) * 11: 0 (not needed ?) * * FIXME: What about 0x61104 ADPA_SRCDIM? and 0x61184 LVDS_SRCDIM? * Maybe used for centering? * * 6. Other registers * * 0x020cc UNKNOWN = 000c000c / 0000004c * * There are now two watermark registers, with a format different from * the I810 FW_BLC register. * * 0x020d8 Watermark/Burst = 01080108 * 0x020dc Watermark/Burst = 00000108 * 31:27 reserved * 26:24 Burst B * 23:21 reserved * 20:16 Watermark B * 15:12 reserved * 11: 8 Burst A * 7: 6 reserved * 5: 0 Watermark A * * Software Flags (= scratch registers): * * 0x71410 SWF0 * 0x71414 SWF1 (amount of video memory available) * 0x71418 SWF2 * 0x7141c SWF3 * 0x71420 SWF4 * 0x71424 SWF5 * 0x71428 SWF6 * */ /* -------- I2C Driver Routines -------- */ /* bit locations in the register */ #define I2C_SCL_IN (1 << 4) #define I2C_SDA_IN (1 << 12) typedef struct { I810Ptr pI810; CARD32 port; } I810TvI2CRec, *I810TvI2CPtr; static void I810TvI2CGetBits(I2CBusPtr b, int *clock, int *data) { I810TvI2CPtr priv = (I810TvI2CPtr) b->DriverPrivate.ptr; I810Ptr pI810 = priv->pI810; register CARD32 val; I810_WR32 (pI810, priv->port, 0x0); val = I810_RD32 (pI810, priv->port); *clock = (val & I2C_SCL_IN) != 0; *data = (val & I2C_SDA_IN) != 0; } static void I810TvI2CPutBits(I2CBusPtr b, int clock, int data) { I810TvI2CPtr priv = (I810TvI2CPtr) b->DriverPrivate.ptr; I810Ptr pI810 = priv->pI810; if (clock) { I810_WR32 (pI810, priv->port, 0x5); I810_WR32 (pI810, priv->port, 0x4); } else { I810_WR32 (pI810, priv->port, 0x7); I810_WR32 (pI810, priv->port, 0x6); } if (data) { I810_WR32 (pI810, priv->port, 0x500); I810_WR32 (pI810, priv->port, 0x400); } else { I810_WR32 (pI810, priv->port, 0x700); I810_WR32 (pI810, priv->port, 0x600); } } I2CBusPtr I810TvBusCreate (I810Ptr pI810, char *name, CARD32 port) { I2CBusPtr I2CPtr; I810TvI2CPtr priv; I2CPtr = xf86CreateI2CBusRec(); priv = xcalloc (1, sizeof (I810TvI2CRec)); if (priv) { } if (priv) { priv->pI810 = pI810; priv->port = port; } if (I2CPtr) { I2CPtr->BusName = name; I2CPtr->scrnIndex = -1; I2CPtr->I2CPutBits = I810TvI2CPutBits; I2CPtr->I2CGetBits = I810TvI2CGetBits; /* Not sure about the delays. Matthew's code has HOLD_TIME = 100, and * uses that for all timings. The values used are about 100x larger * than the default, so it should work, hopefully. */ /* FIXME: Make these shorter, and see if it still works */ I2CPtr->AcknTimeout = 500; /* usec, default: 5 */ I2CPtr->HoldTime = 100; /* usec, default: 5 */ I2CPtr->BitTimeout = 500; /* usec, default: 5 */ I2CPtr->ByteTimeout = 500; /* usec, default: 5 */ I2CPtr->AcknTimeout = 500; /* usec, default: 5 */ I2CPtr->StartTimeout = 500; /* usec, default: 5 */ I2CPtr->RiseFallTime = 100; /* usec, default: 2 */ I2CPtr->DriverPrivate.ptr = priv; } if (I2CPtr && priv && xf86I2CBusInit (I2CPtr)) { return I2CPtr; } if (I2CPtr && priv) { RAISE (MSG_ERROR, "Bus %s is not unique.", name); } else { RAISE (MSG_ERROR, "Out of memory."); } TVDestroyBus (I2CPtr); return NULL; } Bool I810TvBusInit (I810Ptr pI810) { pI810->TvChain = NULL; pI810->TvDev = NULL; /* Must be named TV0, TV1, etc.; otherwise I2C_ID won't work */ switch (pI810->arch.major) { case 0x65: /* i865 */ case 0x45: /* i845 FIXME include GPIOD ??? */ pI810->TvMaxBus = 3; pI810->TvBusses[0] = I810TvBusCreate (pI810, "TV0", I810_GPIOB); pI810->TvBusses[1] = I810TvBusCreate (pI810, "TV1", I830_GPIOC); pI810->TvBusses[2] = I810TvBusCreate (pI810, "TV2", I845_GPIOE); return (pI810->TvBusses[0] && pI810->TvBusses[1] && pI810->TvBusses[2]); case 0x30: /* i830 */ pI810->TvMaxBus = 2; pI810->TvBusses[0] = I810TvBusCreate (pI810, "TV0", I810_GPIOB); pI810->TvBusses[1] = I810TvBusCreate (pI810, "TV1", I830_GPIOC); return (pI810->TvBusses[0] && pI810->TvBusses[1]); case 0x10: default: pI810->TvMaxBus = 1; pI810->TvBusses[0] = I810TvBusCreate (pI810, "TV0", I810_GPIOB); return (pI810->TvBusses[0] != NULL); } } /* -------- CRT -------- */ void I810SetTvRegs (I810Ptr pI810, int head, TVI810Regs *r) { I810_H_WR32 (pI810,head,0x60000, SetBitField (r->tvHDisplay-1,10:0,10:0) | SetBitField (r->tvHTotal-1,11:0,27:16)); I810_H_WR32 (pI810,head,0x60004, SetBitField (r->tvHBlankStart-1,11:0,11:0) | SetBitField (r->tvHBlankEnd-1,11:0,27:16)); I810_H_WR32 (pI810,head,0x60008, SetBitField (r->tvHSyncStart-1,11:0,11:0) | SetBitField (r->tvHSyncEnd-1,11:0,27:16)); I810_H_WR32 (pI810,head,0x6000C, SetBitField (r->tvVDisplay-1,10:0,10:0) | SetBitField (r->tvVTotal-1,11:0,27:16)); I810_H_WR32 (pI810,head,0x60010, SetBitField (r->tvVBlankStart-1,11:0,11:0) | SetBitField (r->tvVBlankEnd-1,11:0,27:16)); I810_H_WR32 (pI810,head,0x60014, SetBitField (r->tvVSyncStart-1,11:0,11:0) | SetBitField (r->tvVSyncEnd-1,11:0,27:16)); } void I830SetTvRegs (I810Ptr pI810, int head, TVI810Regs *r) { I810SetTvRegs (pI810, head, r); I810_H_WR32 (pI810, head, 0x6001c, SetBitField (r->tvVDisplay-1,10:0,10:0) | SetBitField (r->tvHDisplay-1,10:0,26:16)); } void I810GetTvRegs (I810Ptr pI810, int head, TVI810Regs *r) { r->tvHDisplay = SetBitField(I810_H_RD32(pI810,head,0x60000),10: 0,10:0)+1; r->tvHTotal = SetBitField(I810_H_RD32(pI810,head,0x60000),27:16,11:0)+1; r->tvHBlankStart = SetBitField(I810_H_RD32(pI810,head,0x60004),11: 0,11:0)+1; r->tvHBlankEnd = SetBitField(I810_H_RD32(pI810,head,0x60004),27:16,11:0)+1; r->tvHSyncStart = SetBitField(I810_H_RD32(pI810,head,0x60008),11: 0,11:0)+1; r->tvHSyncEnd = SetBitField(I810_H_RD32(pI810,head,0x60008),27:16,11:0)+1; r->tvVDisplay = SetBitField(I810_H_RD32(pI810,head,0x6000C),10: 0,10:0)+1; r->tvVTotal = SetBitField(I810_H_RD32(pI810,head,0x6000C),27:16,11:0)+1; r->tvVBlankStart = SetBitField(I810_H_RD32(pI810,head,0x60010),11: 0,11:0)+1; r->tvVBlankEnd = SetBitField(I810_H_RD32(pI810,head,0x60010),27:16,11:0)+1; r->tvVSyncStart = SetBitField(I810_H_RD32(pI810,head,0x60014),11: 0,11:0)+1; r->tvVSyncEnd = SetBitField(I810_H_RD32(pI810,head,0x60014),27:16,11:0)+1; } void I810SetClock (I810Ptr pI810, int index, int m, int n, int p, int vco) { register CARD32 val; I810_WR32 (pI810, I810_DCLK(index), SetBitField (n,9:0,25:16) | SetBitField (m,9:0,9:0)); /* FIXME for index 3, bit 0 of lcdtv_c must be zero */ val = I810_RD32 (pI810, I810_DCLK_0DS); val &= ~ (0x7c << index * 8); val |= (p & 0x7) << (index * 8 + 4) | (vco & 0x1) << (index * 8 + 2); I810_WR32 (pI810, I810_DCLK_0DS, val); } /* -------- Device enable/disable -------- */ int I810GetDevFlags (I810Ptr pI810) { if (GetBit (I810_RD32(pI810, I810_LCDTV_C), 31)) { /* FIXME: may also be flat panel */ return DEV_TELEVISION; } else { return DEV_MONITOR; } } int I830GetDevFlags (I810Ptr pI810, int head) { static int dev[4] = {DEV_MONITOR, DEV_FLATPANEL, 0, DEV_TELEVISION}; int res = 0; int i; /* Check ADPA, DVOA and DVOC for Monitor, Flatpanel, and TV */ /* FIXME: This assumes a FP on DVOA and a TV on DVOC. Should check clock slave mode or something like this ... */ for (i = 0; i < 4; i++) { register CARD32 tmp = I810_H_RD32 (pI810,head,0x61100 + 0x20 * i); if (GetBit (tmp, 31) && GetBit (tmp, 30) == head) res |= dev[i]; } return res; } int IntelGetDevFlags (I810Ptr pI810, int head) { switch (pI810->arch.major) { case 0x10: return I810GetDevFlags (pI810); case 0x30: return I830GetDevFlags (pI810, head); case 0x45: case 0x65: return I830GetDevFlags (pI810, 0); default: return 0; } } /* -------- Device routines -------- */ void I810SetTvDevice (I810Ptr pI810, I2CChainPtr chain, Bool init) { RAISE (MSG_DEBUG, "i810 set dev %p %i", chain, init); TVSetTvEncoder (&pI810->tvEncoder, chain, NULL); tvBusOk = TRUE; pI810->tvEncoder.InitRegs (&pI810->tvEncoder, PORT_I810); } void I810ProbeTvDevices (I810Ptr pI810) { if (!pI810) return; I810UpdateTvState (pI810); tvState = TV_OFF; TVCheckChain (pI810->TvChain); pI810->TvChain = TVProbeCreateKnown (pI810->TvBusses, pI810->TvMaxBus, NULL); /* FIXME: Is below necessary? */ pI810->TvDev = pI810->TvChain ? pI810->TvChain->dev : NULL; } /* -------- I810 -------- */ void I810UpdateTvState (I810Ptr pI810) { #ifndef FAKE_MMIO if (GetBit (I810_RD32(pI810, I810_LCDTV_C), 31)) { tvState = TV_ON; } else { if (tvState != TV_BARS) tvState = TV_OFF; } #endif } void I810SetTestImage (I810Ptr pI810, TVEncoderRegs *r) { /* FIXME chip registers ... */ I810UpdateTvState (pI810); if (tvState != TV_ON) { /* Only do bars if not in tv-mode */ pI810->tvEncoder.SetState (&pI810->tvEncoder, r, TV_BARS); } } void I810SetTvMode (I810Ptr pI810, TVRegs *r) { TVState oldState, newState; /* hack for now, FIXME */ RAISE (MSG_DEBUG, "i810 set tvmode\n"); I810UpdateTvState (pI810); oldState = tvState; newState = (r->devFlags & DEV_TELEVISION) ? TV_ON : TV_OFF; RAISE (MSG_DEBUG, "i810 set tv mode %i -> %i", oldState, newState); if (oldState == TV_ON && newState != TV_ON) { I810_WR32 (pI810, I810_PWR_CLKC, 0x103); I810_WR32 (pI810, I810_LCDTV_C, 0x20000006); /* turn off tv */ } if (oldState != newState) { pI810->tvEncoder.SetState (&pI810->tvEncoder, &r->enc, newState); } if (newState != TV_OFF) { pI810->tvEncoder.SetPort (&pI810->tvEncoder, r->portEnc); pI810->tvEncoder.SetRegs (&pI810->tvEncoder, &r->enc, newState); } if (oldState != TV_ON && newState == TV_ON) { /* border enable flag in lcdtv_c */ I810SetTvRegs (pI810, 0, &r->crtc.i810); I810SetClock (pI810, 3, 10, 1, 3, 0); /* m=10 n=1 p=3 vco=0 -> f=1 */ I810_WR32 (pI810, I810_PWR_CLKC, 0x102); I810_WR32 (pI810, I810_LCDTV_C, 0xa0000007); /* turn on tv, turn off crt */ } tvState = newState; } long I810GetTvStatus (I810Ptr pI810, int index) { long result; I810UpdateTvState (pI810); tvBusOk = TRUE; result = pI810->tvEncoder.GetStatus (&pI810->tvEncoder, index); return result; } TVConnect I810GetTvConnect (I810Ptr pI810) { TVConnect result; I810UpdateTvState (pI810); tvBusOk = TRUE; result = pI810->tvEncoder.GetConnect (&pI810->tvEncoder); return result; } #if 0 /* i810 stuff... */ { register long l; /* LCD/TV clock: m=10, n=1, p=3 (/8) just reflects clock from DVO */ /* Intel PLL: Fclk = 4 * (Fref * (m+2)/(n+2)) >> p */ /* I810CalcVCLK in xfree/.../driver/i810_driver.c */ [0x60018/4] = ; /* lcdtv_c control */ /* 0xa0000007 -> turn on tv, turn off crt */ /* 0x20000006 -> turn off tv */ /* vsync, hsync active low. blank# active high */ /* bit7: border enable */ [0x6001c/4] /* ovract overlay active start/end -- not used */ [0x60020/4] /* bclrpat border color */ [0x600c/4] = n << 16 | m; /* lcd_clkd */ l = [0x6010/4]; /* dclk_0ds */ l &= ~0x7c000000; l |= p << 28 | 0 << 26; /* vco=0 -> divide by 4*m */ [0x6010/4] = l; /* dclk_0ds */ [0x6014/4] = ?; /* pwr_clkc */ /* 0x102; -> turn on tv, turn off crt */ /* 0x103; -> if crt_enable */ } #endif /* -------- I830/I845 -------- */ void I830SetTvMode (I810Ptr pI810, TVRegs *r) { RAISE (MSG_DEBUG, "i830 set tvmode dev=%i\n", r->devFlags); if (!(r->devFlags & DEV_TELEVISION)) return; /* TODO: fill in slowly, and test */ pI810->tvEncoder.SetRegs (&pI810->tvEncoder, &r->enc, TV_ON); I830SetTvRegs (pI810, 0, &r->crtc.i810); /* Need global var for pipe/plane to use */ #if 0 if (newstate != oldstate) { * Deactivate Monitor/FP/TV (old state): * - disable ADPA/DVOA/DVOC * Setup pipe, including SRC, with I830SetTvRegs * Set encoder if newstate has TV * Activate Monitor/FP/TV (new state): * - enable ADPA/DVOA/DVOC, switch to current pipe * - setup DVO_SRCDIM ??? * - setup DPLL (of pipe) * * Watermarks?? } #endif } void IntelSetTvMode (I810Ptr pI810, TVRegs *r) { switch (pI810->arch.major) { case 0x10: I810SetTvMode (pI810, r); return; case 0x30: case 0x45: case 0x65: I830SetTvMode (pI810, r); return; default: return; } } /* -------- -------- */ /* 06=C0/3F cfrb=1 m/s*=1 0D=80/0F only 0E=0B/F0 00=60/00 01=80/3F 02=6C/00 04=45/30 05=2E/00 06=C0/3F 07=64/00 08=18/03 0C=33/00 0D=80/0F 0E=40/3F 0F=22/C0 10=00/0F 11=00/07 12=00/00 13=40/18 14=0D/00 15=14/00 16=38/00 17=40/3F 18=13/00 19=A0/00 1A=20/00 1B=0A/F0 1C=0E/C0 1D=07/F0 1E=0C/F0 1F=04/F0 20=10/EF 21=00/FE 2A=40/80 2B=10/00 2C=84/00 2D=84/00 2E=BB/00 2F=9B/00 30=64/00 31=0A/00 32=EE/00 33=26/80 34=2A/80 35=7E/00 36=9A/00 37=3F/80 38=E0/00 39=06/80 3A=04/00 3B=FE/00 3C=7E/00 3D=00/F8 0A=19/00 08=00/FD 0B=30/00 08=01/FE */ /* DCLK0 25.175 MHz n=3 m=19 p= /16 vco= /4m DCLK1 28.322 MHz n=16 m=83 p= /16 vco= /4m */ /* I830: All but DDC1 are explicitely said to be a GMBUS (form of SMBUS ?) DVOA uses DDC2/I2C DVOB/C use M_DDC, M_I2C 05014 GPIOB controls probably I2C, with a device at 0x04 (LFP ?) 00006000= 00021207 ? DCLK_0D 00006004= 00031406 ? DCLK_1D 00006010= 0000888b ? DCLK_0DS 00006040= 00021207 FPA0 00006044= 00021207 FPA1 00006014= 808b0000 DPLL_A 00006048= 00021207 ? FPA2/FPA0_B (for second pipe/plane/whatever) 0000604c= 00021207 ? FPA3/FPA1_B (for second pipe/plane/whatever) 00006018= 808b0000 DPLL_B 00070080= 00000000 00070180= 00000000 DSPACTRL (= pipe A) 00071180= 01000000 DSPBCTRL (= pipe B) 00071280= 00000000 00071400= 80000000 00060000= 031f027f HTOTAL_A 800,640 00060004= 03170287 HBLANK_A 00060008= 02ef028f HSYNC_A 0006000c= 020c01df VTOTAL_A 525,480 00060010= 020401e7 VBLANK_A 00060014= 01eb01e9 VSYNC_A 0006001c= 027f01df PIPEASRC 640x480 00061000= 031f027f HTOTAL_B 800,640 00061004= 03170287 HBLANK_B 00061008= 02ef028f HSYNC_B 0006100c= 020c01df VTOTAL_B 525,480 00061010= 020401e7 VBLANK_B 00061014= 01eb01e9 VSYNC_B 0006101c= 027f01df PIPEBSRC 640x480 000020d8= 01080108 ? FW_BLC Fifo Watermark/Burst Length Control 000020dc= 00000108 ? pipe B watermark 000020cc= 000c000c 00070030= 00017e5f ? 00070008= 80000000 PIPEACONF (enable, no gamma) 00071008= 80000000 PIPEBCONF (enable, no gamma) 00071400= 0020008e 00061100= 80008018 ADPA (enable, pipe_a, vga_hvpol, sync_enable, ...) (at least dump those registers...) */ nvtv-0.4.7/src/tv_i2c.c0000644000175000001440000000503310005515125010310 /* NVTV I2C wrapper -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_i2c.c,v 1.10 2004/01/27 17:05:25 dthierbach Exp $ * * Contents: * * I2C wrapper for the TV-I2C routines. All I2C access go through this * wrapper, for error bookkeeping and to allow testing. No file should * access xf86i2c routines directly. * */ #include "local.h" /* before everything else */ #include #include "xf86i2c.h" #include "tv_i2c.h" /* -------- */ Bool tvBusOk = TRUE; /* -------- I2C bus access -------- */ Bool TVProbeBus (I2CBusPtr bus, I2CSlaveAddr addr) { return xf86I2CProbeAddress(bus, addr); } void TVWriteBus (I2CDevPtr d, I2CByte subaddr, I2CByte data) { #ifndef FAKE_I2C if (!xf86I2CWriteByte (d, subaddr, data)) tvBusOk = FALSE; #else FPRINTF (" %02x=%02x", subaddr, data); #endif } void TVWriteSeqBus (I2CDevPtr d, I2CByte subaddr, I2CByte *buf, int len) { #ifndef FAKE_I2C if (!xf86I2CWriteBytes (d, subaddr, buf, len)) tvBusOk = FALSE; #else FPRINTF (" %02x=[%i]", subaddr, len); #endif } void TVReadBus (I2CDevPtr d, I2CByte subaddr, I2CByte *data) { #ifndef FAKE_I2C if (!xf86I2CReadByte (d, subaddr, data)) tvBusOk = FALSE; #else FPRINTF (" %02x?", subaddr); data = 0x00; #endif } void TVReadSeqBus (I2CDevPtr d, I2CByte subaddr, I2CByte *data, int len) { #ifndef FAKE_I2C if (!xf86I2CWriteRead (d, &subaddr, 1, data, len)) tvBusOk = FALSE; #else FPRINTF (" %02x/%i?", subaddr, len); data = 0x00; #endif } void TVStatusBus (I2CDevPtr d, I2CByte *data) { #ifndef FAKE_I2C if (!xf86I2CReadStatus(d, data)) tvBusOk = FALSE; #else FPRINTF (" ss?"); data = 0x00; #endif } void TVStatusSeqBus (I2CDevPtr d, I2CByte *buf, int len) { #ifndef FAKE_I2C if (!xf86I2CWriteRead (d, NULL, 0, buf, len)) tvBusOk = FALSE; #else FPRINTF (" ss%i?", len); #endif } nvtv-0.4.7/src/tv_null.c0000644000175000001440000000507210005515125010610 /* NVTV Null TV-I2C access -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_null.c,v 1.11 2004/01/27 17:05:25 dthierbach Exp $ * * Contents: * * Routines to fake null I2C access if no chip is found. * */ #include "local.h" /* before everything else */ #include "xf86i2c.h" #include "tv_null.h" /* -------- Null chip -------- */ /* This is just to make sure nothing crashes if no chip can be detected. */ void TVNullCreate (TVEncoderObj *this, TVChip chip_type, void* ctrl) { RAISE (MSG_ERROR, "Null chip: create"); this->type = chip_type; this->ctrl = ctrl; this->hwconfig = 0; } void TVNullInitRegs (TVEncoderObj *this, int flags) { RAISE (MSG_ERROR, "Null chip: Init"); } void TVNullSetRegs (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { RAISE (MSG_ERROR, "Null chip: SetRegs"); } void TVNullGetRegs (TVEncoderObj *this, TVEncoderRegs *r) { RAISE (MSG_ERROR, "Null chip: GetRegs"); } void TVNullSetPort (TVEncoderObj *this, int port) { RAISE (MSG_ERROR, "Null chip: SetPort"); } void TVNullGetPort (TVEncoderObj *this, int *port) { RAISE (MSG_ERROR, "Null chip: GetPort"); } void TVNullSetState (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { RAISE (MSG_ERROR, "Null chip: SetState"); } TVConnect TVNullGetConnect (TVEncoderObj *this) { RAISE (MSG_ERROR, "Null chip: Connect"); return CONNECT_NONE; } long TVNullGetStatus (TVEncoderObj *this, int index) { RAISE (MSG_ERROR, "Null chip: Status"); return 0; } TVEncoderObj tvNullTemplate = { type: TV_NO_CHIP, ctrl: NULL, minClock: 0, maxClock: 0, Create: TVNullCreate, InitRegs: TVNullInitRegs, SetRegs: TVNullSetRegs, GetRegs: TVNullGetRegs, SetPort: TVNullSetPort, GetPort: TVNullGetPort, SetState: TVNullSetState, GetConnect: TVNullGetConnect, GetStatus: TVNullGetStatus }; nvtv-0.4.7/src/tv_bt.c0000644000175000001440000003504510005515125010246 /* NVTV Brooktree TV-I2C access -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_bt.c,v 1.20 2004/01/27 17:05:25 dthierbach Exp $ * * Contents: * * Routines to access the Brooktree chip registers via the I2C bus. * */ #include "local.h" /* before everything else */ #include "xf86_ansic.h" #include "bitmask.h" #include "xf86i2c.h" #include "tv_i2c.h" #include "tv_bt.h" /* -------- Brooktree -------- */ /* I have no idea what registers 0xda-0xfc do, but mode 0 is supposed * to disable Macrovision. However, on my card Macrovision does not * seem to work anyway, so it improves just image quality :-) */ static I2CByte tvBtNtscMacro0 [] = { 0x0f,0xfc,0x20,0xd0,0x6f,0x0f,0x00,0x00,0x0c,0xf3,0x09, 0xbd,0x67,0xb5,0x90,0xb2,0x7d,0x00,0x00}; static I2CByte tvBtNtscMacro1 [] = { 0x0f,0xfc,0x20,0xd0,0x6f,0x0f,0x00,0x00,0x0c,0xf3,0x09, 0xbd,0x67,0xb5,0x90,0xb2,0x7d,0x63,0x00}; static I2CByte tvBtNtscMacro2 [] = { 0x0f,0xfc,0x20,0xd0,0x6f,0x0f,0x00,0x00,0x0c,0xf3,0x09, 0xbd,0x6c,0x31,0x92,0x32,0xdd,0xe3,0x00}; static I2CByte tvBtNtscMacro3 [] = { 0x0f,0xfc,0x20,0xd0,0x6f,0x0f,0x00,0x00,0x0c,0xf3,0x09, 0xbd,0x66,0xb5,0x90,0xb2,0x7d,0xe3,0x00}; static I2CByte tvBtPalMacro0 [] = { 0x05,0x57,0x20,0x40,0x6e,0x7e,0xf4,0x51,0x0f,0xf1,0x05, 0xd3,0x78,0xa2,0x25,0x54,0xa5,0x00,0x00}; static I2CByte tvBtPalMacro1 [] = { 0x05,0x57,0x20,0x40,0x6e,0x7e,0xf4,0x51,0x0f,0xf1,0x05, 0xd3,0x78,0xa2,0x25,0x54,0xa5,0x63,0x00}; void TVBtMacroMode (TVEncoderObj *this, TVEncoderRegs *r) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; RAISE (MSG_DEBUG, "tv macro bt %i", r->bt.macro); switch (r->bt.macro) { case 0: /* NTSC APS 0 */ TVWriteSeqBus (dev, 0xda, tvBtNtscMacro0, sizeof (tvBtNtscMacro0)); break; case 1: /* NTSC APS 1 */ TVWriteSeqBus (dev, 0xda, tvBtNtscMacro1, sizeof (tvBtNtscMacro1)); break; case 2: /* NTSC APS 2 */ TVWriteSeqBus (dev, 0xda, tvBtNtscMacro2, sizeof (tvBtNtscMacro2)); break; case 3: /* NTSC APS 3 */ TVWriteSeqBus (dev, 0xda, tvBtNtscMacro3, sizeof (tvBtNtscMacro3)); break; case 4: /* PAL APS 0 */ TVWriteSeqBus (dev, 0xda, tvBtPalMacro0, sizeof (tvBtPalMacro0)); break; case 5: /* PAL APS 1 */ case 6: case 7: TVWriteSeqBus (dev, 0xda, tvBtPalMacro1, sizeof (tvBtPalMacro1)); break; } } void TVBtCreate (TVEncoderObj *this, TVChip chip_type, void *ctrl) { RAISE (MSG_DEBUG, "tv create bt"); this->type = chip_type; this->ctrl = ctrl; this->hwconfig = 0; /* No hardware config for BT */ this->hwstate = 0x00; /* Assume DACs are enabled, till init */ } /* All DACs off, clock output disabled. */ /* * B8-3 en_pincfg * B8-2:0 config * BA-7 sreset = 0 (default) * BA-6 check_stat * BA-5 slaver = 0 (master mode) * BA-4 dacoff * BA-2:0 dacdis c-a * C4-7:6 estatus * C4-5 eccf2 * C4-4 eccf1 * C4-3 eccgate * C4-2 ecbar * C4-1 dchroma * C4-0 en_out * C6-7 en_blanko = 1 (default) (no blank) * C6-6 en_dot = 0 (default) (internal blanking) * C6-5 fieldi * C6-4 vsynci = 1 (active high) (default 0) (ok for nv) * C6-3 hsynci = 1 (active high) (default 0) (ok for nv) * C6-2:0 in_mode = 0 (24-bit RGB multiplexed) * CE out_mux c-a * D4-7 mode2x = 0 (default) * D4-6 div2 * D4-5 en_async = 0 (default) * D4-4:0 (ccr stuff) * D6-3:2 out_mode = 0 (default: CVBS/Y/C/Y_DLY) * D6-1:0 lumadly = 0 (default) */ void TVBtSetPort (TVEncoderObj *this, int port) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; RAISE (MSG_DEBUG, "tv port bt %08X", port); if ((port & PORT_FORMAT_MASK) != PORT_FORMAT_RGB) { RAISE (MSG_ABORT, "TVBtSetPort: Only RGB multiplex format supported."); } if ((port & PORT_BLANK_POLARITY) != PORT_BLANK_LOW) { RAISE (MSG_ABORT, "TVBtSetPort: Only active low blank supported."); } if ((port & PORT_PCLK_MODE) != PORT_PCLK_MASTER) { RAISE (MSG_ABORT, "TVBtSetPort: Only clock master mode supported."); } if ((port & PORT_SYNC_DIR) == PORT_SYNC_SLAVE) { this->hwstate |= SetBit (5); } else { this->hwstate &= ~SetBit (5); } TVWriteBus (dev, 0xba, this->hwstate); TVWriteBus (dev, 0xc6, 0x00 /* in_mode */ | ((port & PORT_BLANK_DIR) ? ((port & PORT_BLANK_MODE) ? SetBit(6) : 0) : SetBit (7)) | ((port & PORT_VSYNC_POLARITY) ? SetBit(4) : 0) | ((port & PORT_HSYNC_POLARITY) ? SetBit(3) : 0)); } void TVBtGetPort (TVEncoderObj *this, int *port) { RAISE (MSG_ERROR, "TVBtGetPort not supported."); } void TVBtInitRegs (TVEncoderObj *this, int port) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; RAISE (MSG_DEBUG, "tv init bt"); this->hwstate = 0x17; TVBtSetPort (this, port); TVWriteBus (dev, 0xb8, 0x03); TVWriteBus (dev, 0xc4, 0x00); TVWriteBus (dev, 0xce, 0x18); /* out_mux */ TVWriteBus (dev, 0xd4, 0x00); /* Mode2x=0 */ TVWriteBus (dev, 0xd6, 0x00); /* Out_Mode */ } void TVBtUpdate (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { this->hwstate &= ~0x1f; if (state == TV_OFF) { this->hwstate |= 0x17; } else { this->hwstate |= r->bt.flags3 & BT_FLAG3_DAC; } RAISE (MSG_DEBUG, "tv bt update %02X", this->hwstate); } void TVBtSetRegs (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; RAISE (MSG_DEBUG, "tv set bt"); TVWriteBus (dev, 0x6e, Set8Bits(r->bt.hsynoffset)); TVWriteBus (dev, 0x70, SetBitField(r->bt.hsynoffset,9:8,7:6) | SetBitField(r->bt.hsynwidth,5:0,5:0)); TVWriteBus (dev, 0x72, Set8Bits(r->bt.vsynoffset)); TVWriteBus (dev, 0x74, SetBitField(r->bt.vsynoffset,10:8,5:3) | SetBitField(r->bt.vsynwidth,2:0,2:0)); TVWriteBus (dev, 0x76, Set8Bits(r->bt.h_clko)); TVWriteBus (dev, 0x78, Set8Bits(r->bt.h_active)); TVWriteBus (dev, 0x7a, Set8Bits(r->bt.hsync_width)); TVWriteBus (dev, 0x7c, Set8Bits(r->bt.hburst_begin)); TVWriteBus (dev, 0x7e, Set8Bits(r->bt.hburst_end)); TVWriteBus (dev, 0x80, Set8Bits(r->bt.h_blanko)); TVWriteBus (dev, 0x82, Set8Bits(r->bt.v_blanko)); TVWriteBus (dev, 0x84, Set8Bits(r->bt.v_activeo)); TVWriteBus (dev, 0x86, SetBitField(r->bt.v_activeo,8:8,7:7) | SetBitField(r->bt.h_active,10:8,6:4) | SetBitField(r->bt.h_clko,11:8,2:0)); /* FIMXE: BT h_active only 9:8 -> 5:4 */ TVWriteBus (dev, 0x88, Set8Bits(r->bt.h_fract)); TVWriteBus (dev, 0x8a, Set8Bits(r->bt.h_clki)); TVWriteBus (dev, 0x8c, Set8Bits(r->bt.h_blanki)); TVWriteBus (dev, 0x8e, SetBitField(r->bt.h_blanki,8:8,3:3) | SetBitField(r->bt.h_clki,10:8,2:0)); /* FIXME: v_blank_dly */ TVWriteBus (dev, 0x90, Set8Bits(r->bt.v_linesi)); TVWriteBus (dev, 0x92, Set8Bits(r->bt.v_blanki)); TVWriteBus (dev, 0x94, Set8Bits(r->bt.v_activei)); TVWriteBus (dev, 0x96, SetBitField(r->bt.clpf,1:0,7:6) | SetBitField(r->bt.ylpf,1:0,5:4) | SetBitField(r->bt.v_activei,9:8,3:2) | SetBitField(r->bt.v_linesi,9:8,1:0)); TVWriteBus (dev, 0x98, Set8Bits(r->bt.v_scale)); TVWriteBus (dev, 0x9a, SetBitField(r->bt.h_blanko,9:8,7:6) | SetBitField(r->bt.v_scale,13:8,5:0)); TVWriteBus (dev, 0x9c, Set8Bits(r->bt.pll_fract)); TVWriteBus (dev, 0x9e, Set8Bits(r->bt.pll_fract >> 8)); TVWriteBus (dev, 0xa0, 0 /* en_xclk, by_pll */ | SetBitField(r->bt.pll_int,5:0,5:0)); TVWriteBus (dev, 0xa2, Set8Bits(r->bt.flags1)); TVWriteBus (dev, 0xa4, Set8Bits(r->bt.sync_amp)); TVWriteBus (dev, 0xa6, Set8Bits(r->bt.bst_amp)); TVWriteBus (dev, 0xa8, Set8Bits(r->bt.mcr)); TVWriteBus (dev, 0xaa, Set8Bits(r->bt.mcb)); TVWriteBus (dev, 0xac, Set8Bits(r->bt.my)); TVWriteBus (dev, 0xae, Set8Bits(r->bt.msc)); TVWriteBus (dev, 0xb0, Set8Bits(r->bt.msc >> 8)); TVWriteBus (dev, 0xb2, Set8Bits(r->bt.msc >> 16)); TVWriteBus (dev, 0xb4, Set8Bits(r->bt.msc >> 24)); TVWriteBus (dev, 0xb6, Set8Bits(r->bt.phase_off)); TVBtUpdate (this, r, state); TVWriteBus (dev, 0xba, this->hwstate); TVWriteBus (dev, 0xc8, SetBitFlag(r->bt.flags2,BT_FLAG2_DIS_YFLPF,7) | SetBitFlag(r->bt.flags2,BT_FLAG2_DIS_FFILT,6) | SetBitField(r->bt.f_selc,2:0,5:3) | SetBitField(r->bt.f_sely,2:0,2:0)); TVWriteBus (dev, 0xca, SetBitFlag(r->bt.flags2,BT_FLAG2_DIS_GMUSHY,7) | SetBitFlag(r->bt.flags2,BT_FLAG2_DIS_GMSHY,6) | SetBitField(r->bt.ycoring,2:0,5:3) | SetBitField(r->bt.yattenuate,2:0,2:0)); TVWriteBus (dev, 0xcc, SetBitFlag(r->bt.flags2,BT_FLAG2_DIS_GMUSHC,7) | SetBitFlag(r->bt.flags2,BT_FLAG2_DIS_GMSHC,6) | SetBitField(r->bt.ccoring,2:0,5:3) | SetBitField(r->bt.cattenuate,2:0,2:0)); TVWriteBus (dev, 0xce, SetBitField(r->bt.out_muxa,1:0,1:0) | SetBitField(r->bt.out_muxb,1:0,3:2) | SetBitField(r->bt.out_muxc,1:0,5:4) | SetBitField(r->bt.out_muxd,1:0,7:6)); /* out_muxd only available for the conexant chip */ TVWriteBus (dev, 0xd4, SetBitFlag(r->bt.flags1,BT_FLAG1_EN_ASYNC,5) | 0x00 /* rest all 0 */ ); TVBtMacroMode (this, r); } void TVBtGetRegs (TVEncoderObj *this, TVEncoderRegs *r) { RAISE (MSG_ERROR, "TVBtGetRegs not supported."); } void TVBtSetState (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; RAISE (MSG_DEBUG, "tv state bt %i", state); tvState = state; TVBtUpdate (this, r, state); switch (state) { case TV_OFF: TVWriteBus (dev, 0xc4, 0x00); /* FIXME DIS_CHROMA */ TVWriteBus (dev, 0xd4, 0x00); TVWriteBus (dev, 0xba, this->hwstate); break; case TV_BARS: TVWriteBus (dev, 0xc4, 0x05); /* FIXME DIS_CHROMA */ TVWriteBus (dev, 0xd4, 0x00); TVWriteBus (dev, 0xba, this->hwstate); break; case TV_ON: TVWriteBus (dev, 0xc4, 0x01); /* FIXME DIS_CHROMA */ TVWriteBus (dev, 0xd4, SetBitFlag(r->bt.flags1,BT_FLAG1_EN_ASYNC,5) | 0x00 /* rest all 0 */ ); TVWriteBus (dev, 0xba, this->hwstate); break; default: break; } xf86usleep(1000); /* BT871 doc says: 1ms minimum */ /* FIXME: Don't do that always */ TVWriteBus (dev, 0x6c, 0x86); /* timing reset, en_reg_rd=0 */ xf86usleep(1000); /* not necessary, but won't hurt ... */ } int TVBtRead (TVEncoderObj *this, int index) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte status; tvBusOk = TRUE; switch (tvState) { case TV_OFF: TVWriteBus (dev, 0xc4, 0x00 | SetBitField(index,1:0,7:6)); break; case TV_BARS: TVWriteBus (dev, 0xc4, 0x05 | SetBitField(index,1:0,7:6)); break; case TV_ON: TVWriteBus (dev, 0xc4, 0x01 | SetBitField(index,1:0,7:6)); break; default: return -1; } TVStatusBus (dev, &status); if (!tvBusOk) return -1; else return status; } long TVBtGetStatus (TVEncoderObj *this, int index) { return TVBtRead (this, 2) | ((tvState == TV_ON) ? 0x100 : 0); } TVConnect TVBtGetConnect (TVEncoderObj *this) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; int status; /* Enable all DACS and set check_stat */ TVWriteBus (dev, 0xba, 0x40); xf86usleep(50000); /* BT871 doc says: 20ms - 50ms */ status = TVBtRead (this, 1); RAISE (MSG_DEBUG, "bt conn %02x (%s)", status, tvBusOk ? "ok" : "err"); /* BT871 doc says we should reset check_stat */ TVWriteBus (dev, 0xba, this->hwstate); if (status >= 0) { switch (status & 0xe0) { case 0x80: return CONNECT_COMPOSITE; break; case 0x60: return CONNECT_SVIDEO; break; case 0x20: case 0x40: case 0xa0: /* Voodoo3 - only DAC_C via SVideo converter? */ case 0xc0: /* Voodoo3 - only DAC_B, via internal converter (really) */ return CONNECT_CONVERT; break; default: RAISE (MSG_WARNING, "Strange Brooktree connection status %02x.", status & 0xe0); case 0xe0 : return CONNECT_BOTH; break; } } else { return CONNECT_NONE; } } /* * Check for Brooktree chip on device dev. Return version string if found, * NULL otherwise. Don't use ReadBt. */ char *TVDetectBrooktree (I2CDevPtr dev, TVChip *encoder, TVState state) { I2CByte status; char *chip; static char version [50]; #ifdef FAKE_PROBE_BROOKTREE *encoder = TV_BROOKTREE; snprintf (version, 50, "Brooktree Fake (%1s:%02X)", I2C_ID(dev)); return version; #else #ifdef FAKE_I2C return NULL; #endif #endif tvBusOk = TRUE; if (state != TV_OFF) { TVWriteBus (dev, 0xc4, 0x01); } else { TVWriteBus (dev, 0xc4, 0x00); } TVWriteBus (dev, 0x6c, 0x06); /* disable en_reg_rd, just in case */ TVStatusBus (dev, &status); RAISE (MSG_DEBUG, "bt check (%i) %02x (%s)", state, status, tvBusOk ? "ok" : "err"); if (!tvBusOk) return NULL; *encoder = TV_BROOKTREE; switch (status & 0xe0) { case 0x00 : chip = "868"; break; case 0x20 : chip = "869"; break; case 0x40 : chip = "870"; break; case 0x60 : chip = "871"; break; default : chip = NULL; break; } if (chip) { snprintf (version, 50, "Brooktree BT%s Rev %i (%1s:%02X)", chip, status & 0x1f, I2C_ID(dev)); return version; } else { return NULL; } } TVEncoderObj tvBtTemplate = { type: TV_BROOKTREE, ctrl: NULL, minClock: 0, maxClock: 40500, Create: TVBtCreate, InitRegs: TVBtInitRegs, SetRegs: TVBtSetRegs, GetRegs: TVBtGetRegs, SetPort: TVBtSetPort, GetPort: TVBtGetPort, SetState: TVBtSetState, GetConnect: TVBtGetConnect, GetStatus: TVBtGetStatus }; /* Voodoo3 connectors: DACA 0=CVBS (but seems to be pulled up internally; always detected) DACB 1=Y (or CVBS via SVideo converter type 1) DACC 2=C (or CVBS via SVideo converter type 2) lmsensors: Clock slave/Sync slave NVidia connectors: DACA 0=CVBS DACB 2=C DACC 1=Y FIXME: Must setup differently according to *card* backend. */ nvtv-0.4.7/src/tv_cx.c0000644000175000001440000004647110005515125010260 /* NVTV Conexant TV-I2C access -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_cx.c,v 1.22 2004/01/27 17:05:25 dthierbach Exp $ * * Contents: * * Routines to access the Conexant chip registers via the I2C bus. * */ #include "local.h" /* before everything else */ #include "xf86_ansic.h" #include "bitmask.h" #include "xf86i2c.h" #include "tv_i2c.h" #include "tv_cx.h" #include "tv_bt.h" /* -------- Conexant -------- */ /* Read hardware config on object creation. * * 32-6:5 drvs = 0 (default) * 3a-4 14318_xtal = 0 (default) */ void TVCxCreate (TVEncoderObj *this, TVChip chip_type, void *ctrl) { register I2CDevPtr dev = (I2CDevPtr) ctrl; I2CByte result; RAISE (MSG_DEBUG, "tv create cx"); this->type = chip_type; this->ctrl = ctrl; tvBusOk = TRUE; TVReadBus (dev, 0x32, &result); this->hwconfig = SetBitField(result,6:5,6:5); TVReadBus (dev, 0x3a, &result); this->hwconfig |= SetBitField(result,4:4,4:4); if (!tvBusOk) { fprintf (stderr, "Critical: Error reading Conexant hardware config\n"); exit (1); } if (GetBF(this->hwconfig,6:5) != 0) { RAISE (MSG_WARNING, "Conexant in low voltage configuration."); } if (GetBF(this->hwconfig,4:4) != 0) { RAISE (MSG_ERROR, "14.318 MHz crystal detected; timings will be wrong."); } } /* All DACs off, clock output disabled. */ /* 2E-7 hdtv_en = 0 (default) * 2E-6 rgb2prpb = 0 (default) (hdtv mode) * 2E-5 rpr_sync_dis = 0 (default) (hdtv mode) * 2E-4 gy_sync_dis = 0 (default) (hdtv mode) * 2E-3 bpb_sync_dis = 0 (default) (hdtv mode) * 2E-2 hd_sync_edge = 0 (default) (hdtv mode) * 2E-1:0 raster_sel = 0 (default) (hdtv mode) * 30-7 sleep_en = 0 (default) (FIXME: Use for TV-Off ?) * 30-6 xtal_pad_dis = 0 (default) * 30-5 xtal_bfo_dis = 0 (default) (FIXME: Not needed?) * 30-4 pll_keep_alive = 0 (default) * 30-3 dis_clki = 0 (default) * 30-2 dis_pll = 0 (default) * 30-1 dis_clko = 0 (default) (slave mode) * 32-7 auto_chk = 1 (default 0) * 32-6:5 drvs = 0 (default) (better don't touch) * 32-4 setup_hold_adj = 0 (default) * 32-3 in_mode[3] = 0/1 (24-bit RGB multiplexed, or YCrCb Alt) * 32-2 datdly_re = 0 (default) * 32-1 offset_rgb = 0 (default) (hdtv mode) * 32-0 csc_sel = 0 (default) (hdtv mode) * 6C-7 timing_rst = 0 (default) * 6C-6 en_reg_rd = 1 (default 0) * 6C-4 blnk_ignore = 0 (default) (ccir mode) * 6C-3 en_scart = 0 (default) (vga out_mode) * 6C-1:0 fld_mode = 0 (default 2) (slave mode, interlaced input) * BA-7 sreset = 0 (default) * BA-5 slaver = 0 (master mode) * C4-7:6 estatus * C4-5 eccf2 * C4-4 eccf1 * C4-3 eccgate * C4-2 ecbar * C4-1 dchroma * C4-0 en_out * C6-7 en_blanko = 1 (default) (no blank) * C6-6 en_dot = 0 (default) (internal blanking) * C6-5 fieldi * C6-4 vsynci = 1 (active high) (default 0) (ok for nv) * C6-3 hsynci = 1 (active high) (default 0) (ok for nv) * C6-2:0 in_mode[2:0] = 0/4 (24-bit RGB multiplexed, or YCrCb Alt) * CE out_mux d-a * D4-7 mode2x = 0 (default) * D4-6 div2 * D4-5 en_async = 0 (default) * D4-4:0 (ccr stuff) * D6-6 e656 = 0 (default) * D6-5 blanki = 0 (active low) (default) * D6-4 eblue = 0 (default) * D6-3:2 out_mode = 0 (default: CVBS/Y/C/Y_DLY) * D6-1:0 lumadly = 0 (default) * D8-7 chroma_bw = 0 (default) (USER) * D8-6 by_yccr = 0 (default) (USER) * D8-5:4 pkfil_sel = 0 (default) (USER) * D8-3 field_id = 0 (defualt) * D8-2 cvbsd_inv = 0 (default) * D8-1 sc_pattern = 0 (default) (USER) * D8-0 prog_sc = 0 (default) (USER) */ void TVCxSetPort (TVEncoderObj *this, int port) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; RAISE (MSG_DEBUG, "tv port cx %08X", port); if ((port & PORT_PCLK_MODE) != PORT_PCLK_MASTER) { RAISE (MSG_ABORT, "TVCxSetPort: Only clock master mode supported."); } if ((port & PORT_SYNC_DIR) == PORT_SYNC_SLAVE) { this->hwstate |= SetBit (5); } else { this->hwstate &= ~SetBit (5); } TVWriteBus (dev, 0xba, this->hwstate); TVWriteBus (dev, 0xc6, 0x00 /* fieldi = 0 */ | ((port & PORT_FORMAT_MASK_COLOR) ? 0x4 : 0x0) /* in_mode */ | ((port & PORT_BLANK_DIR) ? ((port & PORT_BLANK_MODE) ? SetBit(6) : 0) : SetBit (7)) | ((port & PORT_VSYNC_POLARITY) ? SetBit(4) : 0) | ((port & PORT_HSYNC_POLARITY) ? SetBit(3) : 0)); TVWriteBus (dev, 0x32, SetBit(7) /* enable auto_chk */ | ((port & PORT_FORMAT_MASK_ALT) ? SetBit(3) : 0) | SetBitField(this->hwconfig,6:5,6:5)); TVWriteBus (dev, 0xd6, 0x00 /* Out_Mode */ | ((port & PORT_BLANK_POLARITY) ? SetBit(5) : 0)); } /* FIXME: See TVBtSetPort, additional BLANK_POLARITY */ void TVCxGetPort (TVEncoderObj *this, int *port) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte res; RAISE (MSG_DEBUG, "tv get port cx"); *port = PORT_PCLK_MASTER | PORT_PCLK_HIGH; TVReadBus (dev, 0xba, &res); *port |= (GetBit(res,5) ? PORT_SYNC_SLAVE : PORT_SYNC_MASTER); TVReadBus (dev, 0xc6, &res); *port |= (GetBF(res,2:0) == 4 ? PORT_FORMAT_MASK_COLOR : 0) | (GetBit(res,4) ? PORT_VSYNC_HIGH : PORT_VSYNC_LOW) | (GetBit(res,3) ? PORT_HSYNC_HIGH : PORT_HSYNC_LOW) | (GetBit(res,7) ? (PORT_BLANK_OUT | PORT_BLANK_REGION) : GetBit(res,6) ? (PORT_BLANK_IN | PORT_BLANK_DOTCLK) : (PORT_BLANK_IN | PORT_BLANK_REGION)); TVReadBus (dev, 0x32, &res); *port |= (GetBit(res,3) ? PORT_FORMAT_MASK_ALT : 0); TVReadBus (dev, 0xd6, &res); *port |= (GetBit(res,5) ? PORT_BLANK_HIGH : PORT_BLANK_LOW); } void TVCxInitRegs (TVEncoderObj *this, int port) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; RAISE (MSG_DEBUG, "tv init cx"); TVCxSetPort (this, port); TVWriteBus (dev, 0xba, 0x17); TVWriteBus (dev, 0xc4, 0x00); TVWriteBus (dev, 0xc6, 0x98); /* En_Blank0, Sync Polarity */ TVWriteBus (dev, 0xce, 0x18); TVWriteBus (dev, 0xd4, 0x00); /* Mode2x=0 */ TVWriteBus (dev, 0xd8, 0x00); /* Disable Secam */ TVWriteBus (dev, 0x2e, 0x00); TVWriteBus (dev, 0x30, 0x00); TVWriteBus (dev, 0x6c, 0x00); } void TVCxSetRegs (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; RAISE (MSG_DEBUG, "tv set cx"); TVBtSetRegs (this, r, state); TVWriteBus (dev, 0x34, SetBitFlag(r->cx.flags5,CX_FLAG5_ADPT_FF,7) | SetBitField(r->cx.c_altff,1:0,4:3) | SetBitField(r->cx.y_altff,1:0,1:0)); TVWriteBus (dev, 0x36, SetBitFlag(r->cx.flags5,CX_FLAG5_FFRTN,7) | SetBitFlag(r->cx.flags5,CX_FLAG5_YSELECT,6) | SetBitField(r->cx.c_thresh,2:0,5:3) | SetBitField(r->cx.y_thresh,2:0,2:0)); TVWriteBus (dev, 0x38, SetBitFlag(r->cx.flags5,CX_FLAG5_PIX_DOUBLE,6) | SetBitFlag(r->cx.flags5,CX_FLAG5_PLL_32CLK,5) | SetBitFlag(r->cx.flags5,CX_FLAG5_DIV2,4) | SetBitField(r->cx.bt.hburst_end,8:8,3:3) | SetBitField(r->cx.bt.hburst_begin,8:8,2:2) | SetBitField(r->cx.bt.v_linesi,10:10,1:1) | SetBitField(r->cx.bt.h_blanki,9:9,0:0)); TVWriteBus (dev, 0x3c, Set8Bits(r->cx.mcompy)); TVWriteBus (dev, 0x3e, Set8Bits(r->cx.mcompu)); TVWriteBus (dev, 0x40, Set8Bits(r->cx.mcompv)); TVWriteBus (dev, 0x42, Set8Bits(r->cx.msc_db)); TVWriteBus (dev, 0x44, Set8Bits(r->cx.msc_db >> 8)); TVWriteBus (dev, 0x46, Set8Bits(r->cx.msc_db >> 16)); TVWriteBus (dev, 0x48, Set8Bits(r->cx.msc_db >> 24)); TVWriteBus (dev, 0x4a, Set8Bits(r->cx.dr_limitp)); TVWriteBus (dev, 0x4c, Set8Bits(r->cx.dr_limitn)); TVWriteBus (dev, 0x4e, SetBitField(r->cx.dr_limitn,10:8,5:3) | SetBitField(r->cx.dr_limitp,10:8,2:0)); TVWriteBus (dev, 0x50, Set8Bits(r->cx.db_limitp)); TVWriteBus (dev, 0x52, Set8Bits(r->cx.db_limitn)); TVWriteBus (dev, 0x54, SetBitField(r->cx.db_limitn,10:8,5:3) | SetBitField(r->cx.db_limitp,10:8,2:0)); TVWriteBus (dev, 0x56, Set8Bits(r->cx.filincr)); /* fil4286incr */ TVWriteBus (dev, 0x58, SetBitField(r->cx.filfsconv,5:0,5:0)); TVWriteBus (dev, 0x5a, Set8Bits(r->cx.y_off)); TVWriteBus (dev, 0x5c, Set8Bits(r->cx.hue_adj)); TVWriteBus (dev, 0x60, SetBitFlag(r->cx.flags5,CX_FLAG5_EWSSF2,7) | SetBitFlag(r->cx.flags5,CX_FLAG5_EWSSF1,6) | SetBitField(r->cx.wsdat,4:1,3:0)); TVWriteBus (dev, 0x62, SetBitField(r->cx.wsdat,12:5,7:0)); TVWriteBus (dev, 0x64, SetBitField(r->cx.wsdat,20:13,7:0)); /* wsdat bit 0 seems not to be used anywhere */ TVWriteBus (dev, 0x66, Set8Bits(r->cx.wssinc)); TVWriteBus (dev, 0x68, Set8Bits(r->cx.wssinc >> 8)); TVWriteBus (dev, 0x6a, SetBitField(r->cx.wssinc,19:16,3:0)); TVWriteBus (dev, 0xd8, (r->cx.flags4 & CX_FLAG4_MASK) | SetBitField(r->cx.pkfil_sel,1:0,5:4)); TVBtMacroMode (this, r); xf86usleep(1000); /* BT871 doc says: 1ms minimum */ /* FIXME: Don't do that always */ TVWriteBus (dev, 0x6c, 0xC6); /* timing reset */ xf86usleep(1000); /* not necessary, but won't hurt ... */ } void TVCxGetRegs (TVEncoderObj *this, TVEncoderRegs *r) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte regs[0x100]; int i; RAISE (MSG_DEBUG, "tv get cx"); for (i = 0x2e; i < 0x100; i += 2) TVReadBus (dev, i, ®s[i]); r->cx.bt.h_active = Set8Bits(regs[0x78]) | SetBitField(regs[0x86],6:4,10:8); /* BT: 5:4, 9:8 */ r->cx.bt.h_blanki = Set8Bits(regs[0x8c]) | SetBitField(regs[0x8e],3:3,8:8) | SetBitField(regs[0x38],0:0,9:9); r->cx.bt.h_clki = Set8Bits(regs[0x8a]) | SetBitField(regs[0x8e],2:0,10:8); r->cx.bt.h_fract = Set8Bits(regs[0x88]); r->cx.bt.h_blanko = Set8Bits(regs[0x80]) | SetBitField(regs[0x9a],7:6,9:8); r->cx.bt.h_clko = Set8Bits(regs[0x76]) | SetBitField(regs[0x86],3:0,11:8); r->cx.bt.v_activei = Set8Bits(regs[0x94]) | SetBitField(regs[0x96],3:2,9:8); r->cx.bt.v_blanki = Set8Bits(regs[0x92]); r->cx.bt.v_linesi = Set8Bits(regs[0x90]) | SetBitField(regs[0x96],1:0,9:8) | SetBitField(regs[0x38],1:1,10:10); r->cx.bt.v_activeo = Set8Bits(regs[0x84]) | SetBitField(regs[0x86],7:7,8:8); r->cx.bt.v_blanko = Set8Bits(regs[0x82]); r->cx.bt.v_scale = Set8Bits(regs[0x98]) | SetBitField(regs[0x9a],5:0,13:8); r->cx.bt.pll_fract = Set8Bits(regs[0x9c]) | Set8Bits(regs[0x9e]) << 8; r->cx.bt.pll_int = SetBitField(regs[0xa0],5:0,5:0); r->cx.bt.hsynoffset = Set8Bits(regs[0x6e]) | SetBitField(regs[0x70],7:6,9:8); r->cx.bt.vsynoffset = Set8Bits(regs[0x72]) | SetBitField(regs[0x74],5:3,10:8); r->cx.bt.hsynwidth = SetBitField(regs[0x70],5:0,5:0); r->cx.bt.vsynwidth = SetBitField(regs[0x74],2:0,2:0); r->cx.bt.hsync_width = Set8Bits(regs[0x7a]); r->cx.bt.hburst_begin = Set8Bits(regs[0x7c]) | SetBitField(regs[0x38],2:2,8:8); r->cx.bt.hburst_end = Set8Bits(regs[0x7e]) | SetBitField(regs[0x38],3:3,8:8); /* r->cx.bt.v_blank_dly = SetBitField(regs[0x8e],4:4,0:0); */ r->cx.bt.sync_amp = Set8Bits(regs[0xa4]); r->cx.bt.bst_amp = Set8Bits(regs[0xa6]); r->cx.bt.mcr = Set8Bits(regs[0xa8]); r->cx.bt.mcb = Set8Bits(regs[0xaa]); r->cx.bt.my = Set8Bits(regs[0xac]); r->cx.bt.msc = (unsigned long) Set8Bits(regs[0xae]) | (unsigned long) Set8Bits(regs[0xb0]) << 8 | (unsigned long) Set8Bits(regs[0xb2]) << 16 | (unsigned long) Set8Bits(regs[0xb4]) << 24; r->cx.bt.phase_off = Set8Bits(regs [0xb6]); r->cx.bt.f_selc = SetBitField(regs [0xc8],5:3,2:0); r->cx.bt.f_sely = SetBitField(regs [0xc8],2:0,2:0); r->cx.bt.ccoring = SetBitField(regs [0xcc],5:3,2:0); r->cx.bt.cattenuate = SetBitField(regs [0xcc],2:0,2:0); r->cx.bt.ycoring = SetBitField(regs [0xca],5:3,2:0); r->cx.bt.yattenuate = SetBitField(regs [0xca],2:0,2:0); r->cx.bt.clpf = SetBitField(regs [0x96],7:6,1:0); r->cx.bt.ylpf = SetBitField(regs [0x96],5:4,1:0); r->cx.bt.out_muxa = SetBitField(regs [0xce],1:0,1:0); r->cx.bt.out_muxb = SetBitField(regs [0xce],3:2,1:0); r->cx.bt.out_muxc = SetBitField(regs [0xce],5:4,1:0); r->cx.bt.out_muxd = SetBitField(regs [0xce],7:6,1:0); r->cx.bt.flags1 = GetBitFlag(regs [0xa2],0,BT_FLAG1_NI_OUT) | GetBitFlag(regs [0xa2],1,BT_FLAG1_SETUP) | GetBitFlag(regs [0xa2],2,BT_FLAG1_625LINE) | GetBitFlag(regs [0xa2],3,BT_FLAG1_VSYNC_DUR) | GetBitFlag(regs [0xa2],4,BT_FLAG1_DIS_SCRESET) | GetBitFlag(regs [0xa2],5,BT_FLAG1_PAL_MD) | GetBitFlag(regs [0xa2],6,BT_FLAG1_ECLIP) | GetBitFlag(regs [0xa2],7,CX_FLAG1_FM); r->cx.bt.flags2 = GetBitFlag(regs [0xc8],7,BT_FLAG2_DIS_YFLPF) | GetBitFlag(regs [0xc8],6,BT_FLAG2_DIS_FFILT) | GetBitFlag(regs [0xca],7,BT_FLAG2_DIS_GMUSHY) | GetBitFlag(regs [0xca],6,BT_FLAG2_DIS_GMSHY) | GetBitFlag(regs [0xcc],7,BT_FLAG2_DIS_GMUSHC) | GetBitFlag(regs [0xcc],6,BT_FLAG2_DIS_GMSHC) | GetBitFlag(regs [0xc4],1,BT_FLAG2_DIS_CHROMA); r->cx.bt.flags3 = SetBitField(regs [0xba],3:0,3:0); r->cx.bt.macro = 0; r->cx.flags4 = regs [0xd8] & CX_FLAG4_MASK; r->cx.flags5 = GetBitFlag(regs [0x38],6,CX_FLAG5_PIX_DOUBLE) | GetBitFlag(regs [0x38],5,CX_FLAG5_PLL_32CLK) | GetBitFlag(regs [0x38],4,CX_FLAG5_DIV2) | GetBitFlag(regs [0x34],7,CX_FLAG5_ADPT_FF) | GetBitFlag(regs [0x36],7,CX_FLAG5_FFRTN) | GetBitFlag(regs [0x36],6,CX_FLAG5_YSELECT) | GetBitFlag(regs [0x60],7,CX_FLAG5_EWSSF2) | GetBitFlag(regs [0x60],6,CX_FLAG5_EWSSF1); r->cx.c_altff = SetBitField(regs [0x34],4:3,1:0); r->cx.y_altff = SetBitField(regs [0x34],1:0,1:0); r->cx.c_thresh = SetBitField(regs [0x36],5:3,2:0); r->cx.y_thresh = SetBitField(regs [0x36],2:0,2:0); r->cx.mcompy = Set8Bits(regs [0x3c]); r->cx.mcompu = Set8Bits(regs [0x3e]); r->cx.mcompv = Set8Bits(regs [0x40]); r->cx.msc_db = (unsigned long) Set8Bits(regs [0x42]) | (unsigned long) Set8Bits(regs[0x44]) << 8 | (unsigned long) Set8Bits(regs[0x46]) << 16 | (unsigned long) Set8Bits(regs[0x48]) << 24; r->cx.dr_limitp = Set8Bits(regs[0x4a]) | SetBitField(regs[0x4e],2:0,10:8); r->cx.dr_limitn = Set8Bits(regs[0x4c]) | SetBitField(regs[0x4e],5:3,10:8); r->cx.db_limitp = Set8Bits(regs[0x50]) | SetBitField(regs[0x54],2:0,10:8); r->cx.db_limitn = Set8Bits(regs[0x52]) | SetBitField(regs[0x54],5:3,10:8); r->cx.filfsconv = SetBitField(regs[0x58],5:0,5:0); r->cx.filincr = Set8Bits(regs[0x56]); r->cx.wsdat = SetBitField(regs[0x60],3:0,4:1) | SetBitField(regs[0x62],7:0,12:5) | SetBitField(regs[0x64],7:0,20:13); r->cx.wssinc = (unsigned long) Set8Bits(regs[0x66]) | (unsigned long) Set8Bits(regs[0x68]) << 8; r->cx.y_off = Set8Bits(regs[0x5a]); r->cx.hue_adj = Set8Bits(regs[0x5c]); r->cx.pkfil_sel = SetBitField(regs[0xd8],5:4,1:0); } void TVCxSetState (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { RAISE (MSG_DEBUG, "tv state cx"); TVBtSetState (this, r, state); /* FIXME: 6c en_reg_rd=1 6c-5 ffcbar */ } long TVCxGetStatus (TVEncoderObj *this, int index) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte result; TVReadBus (dev, 0x28, &result); return result | ((tvState == TV_ON) ? 0x100 : 0); } TVConnect TVCxGetConnect (TVEncoderObj *this) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte result; tvBusOk = TRUE; TVWriteBus (dev, 0xba, 0x40); xf86usleep(50000); /* BT871 doc says: 20ms - 50ms */ TVReadBus (dev, 0x06, &result); RAISE (MSG_DEBUG, "cx conn %02x (%s)", result, tvBusOk ? "ok" : "err"); TVWriteBus (dev, 0xba, 0x00); /* FIXME. (But next SetTVState will write correct values.) */ if (tvBusOk) { switch (result & 0xe0) { case 0x80 : return CONNECT_COMPOSITE; break; case 0x60 : return CONNECT_SVIDEO; break; case 0x20 : return CONNECT_CONVERT; break; case 0x40 : return CONNECT_CONVERT; break; default: RAISE (MSG_WARNING, "Strange Conexant connection status %02x", result & 0xe0); case 0xe0 : return CONNECT_BOTH; break; } } else { return CONNECT_NONE; } } /* * Check for Conexant chip on device dev. Return version string if found, * NULL otherwise. Make sure it cannot be a Philips chip, otherwise * register 0x6c (HTRIG) and register 0x28 might be changed to an illegal * value. */ char *TVDetectConexant (I2CDevPtr dev, TVChip *encoder) { I2CByte result; char *chip; static char version [50]; #ifdef FAKE_PROBE_CONEXANT *encoder = TV_CONEXANT; snprintf (version, 50, "Conexant Fake (%1s:%02X)", I2C_ID(dev)); return version; #else #ifdef FAKE_I2C return NULL; #endif #endif tvBusOk = TRUE; TVWriteBus (dev, 0x6c, 0x46); /* enable reg rd */ TVReadBus (dev, 0x00, &result); RAISE (MSG_DEBUG, "cx check %02x (%s)", result, tvBusOk ? "ok" : "err"); if (!tvBusOk) return NULL; *encoder = TV_CONEXANT; switch (result & 0xe0) { case 0x40 : chip = "25870"; break; /* Accipiter, no MV */ case 0x60 : chip = "25871"; break; /* Accipiter, with MV */ case 0x80 : chip = "25872"; break; /* Aquila Lite, no MV */ case 0xa0 : chip = "25873"; break; /* Aquila Lite, with MV */ case 0xc0 : chip = "25874"; break; /* Aquila, no MV */ case 0xe0 : chip = "25875"; break; /* Aquila, with MV */ default : chip = NULL; break; } if (chip) { snprintf (version, 50, "Conexant CX%s Rev %i (%1s:%02X)", chip, result & 0x1f, I2C_ID(dev)); return version; } else { return NULL; } } /* maxclock is specified for "standard mode", whatever that means */ /* Apparently, in 3:2 mode it can be larger. Maybe in async mode, too? */ TVEncoderObj tvCxTemplate = { type: TV_CONEXANT, ctrl: NULL, minClock: 0, maxClock: 53333, Create: TVCxCreate, InitRegs: TVCxInitRegs, SetRegs: TVCxSetRegs, GetRegs: TVCxGetRegs, SetPort: TVCxSetPort, GetPort: TVCxGetPort, SetState: TVCxSetState, GetConnect: TVCxGetConnect, GetStatus: TVCxGetStatus }; nvtv-0.4.7/src/tv_nx.c0000644000175000001440000002661210005515126010267 /* NVTV NV internal encoder -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_nx.c,v 1.5 2004/01/27 17:05:26 dthierbach Exp $ * * Contents: * * Internal NV17 TV encoder ("Zoran" ??) * */ #include "local.h" /* before everything else */ #include "xfree.h" #include #include #include "mmio.h" #include "bitmask.h" #include "tv_nx.h" #include "nv_type.h" /* -------- Registers -------- */ /* Here's an attempt to guess the meaning of some of the TV registers. * * 00-03 subcarrier frequency (fsub/Hz * 159.07287 = value) * 0c hue-related (phase offset?) * 0e black to white height * 10 hsync height * 31 active pixels*2 (=1440) * 3c vsync height * * The following registers affect the hue, so they are either burst * timings or heights, or other horizontal timings that influence the burst: * * 08,09,0a,0b,0c * */ /* -------- TV indirect access -------- */ CARD32 NVReadTV (NVPtr pNv, int reg) { MMIO_OUT32 (pNv->riva.PTV, 0x220, reg); return MMIO_IN32 (pNv->riva.PTV, 0x224); } void NVWriteTV (NVPtr pNv, int reg, CARD32 val) { MMIO_OUT32 (pNv->riva.PTV, 0x220, reg); MMIO_OUT32 (pNv->riva.PTV, 0x224, val); } void NVAndOrTV (NVPtr pNv, int reg, CARD32 mask, CARD32 val) { CARD32 tmp; MMIO_OUT32 (pNv->riva.PTV, 0x220, reg); tmp = MMIO_IN32 (pNv->riva.PTV, 0x224); tmp &= mask; tmp |= val; MMIO_OUT32 (pNv->riva.PTV, 0x224, val); } /* -------- -------- */ static CARD32 TVNxSetFiltCoeff (int val) { if (val < 0) { return SetBitField (-val,8:0,16:8) | SetBit(31); } else { return SetBitField ( val,8:0,16:8); } } static int TVNxGetFiltCoeff (CARD32 val) { if (val & SetBit(31)) { return - GetBF (val,16:8); } else { return GetBF (val,16:8); } } /* -------- -------- */ void TVNxCreate (TVEncoderObj *this, TVChip chip_type, void *ctrl) { RAISE (MSG_DEBUG, "tv create nx"); this->type = chip_type; this->ctrl = ctrl; this->hwconfig = 0; this->hwstate = 0; } void TVNxSetPort (TVEncoderObj *this, int port) { } void TVNxGetPort (TVEncoderObj *this, int *port) { } void TVNxInitRegs (TVEncoderObj *this, int port) { } void TVNxSetRegs (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { register NVPtr pNv = (NVPtr) this->ctrl; int i; RAISE (MSG_DEBUG, "tv set regs nx"); NVWriteTV (pNv, 0x00, Set8Bits (r->nx.ind.fsub >> 24)); NVWriteTV (pNv, 0x01, Set8Bits (r->nx.ind.fsub >> 16)); NVWriteTV (pNv, 0x02, Set8Bits (r->nx.ind.fsub >> 8)); NVWriteTV (pNv, 0x03, Set8Bits (r->nx.ind.fsub)); NVWriteTV (pNv, 0x04, Set8Bits (r->nx.ind.nxreg04)); NVWriteTV (pNv, 0x08, Set8Bits (r->nx.ind.nxreg08)); NVWriteTV (pNv, 0x09, SetBitField (r->nx.ind.nxreg09, 6:0,6:0)); NVWriteTV (pNv, 0x0a, Set8Bits (r->nx.ind.nxreg0a)); NVWriteTV (pNv, 0x0b, Set8Bits (r->nx.ind.nxreg0b)); NVWriteTV (pNv, 0x0c, Set8Bits (r->nx.ind.nxreg0c)); NVWriteTV (pNv, 0x0e, SetBitField (r->nx.ind.nxreg0e,9:2,7:0)); NVWriteTV (pNv, 0x10, SetBitField (r->nx.ind.nxreg10,9:2,7:0)); NVWriteTV (pNv, 0x17, SetBitField (r->nx.ind.nxreg17,9:2,7:0)); NVWriteTV (pNv, 0x19, 0x00); /* MV off for now */ NVWriteTV (pNv, 0x1e, SetBitField (r->nx.ind.nxreg1e,9:2,7:0)); NVWriteTV (pNv, 0x20, Set8Bits (r->nx.ind.nxreg20)); NVWriteTV (pNv, 0x22, Set8Bits (r->nx.ind.nxreg22)); NVWriteTV (pNv, 0x29, SetBitField (r->nx.ind.nxreg29, 4:0,4:0)); NVWriteTV (pNv, 0x2c, SetBitField (r->nx.ind.nxreg2c, 5:0,5:0)); NVWriteTV (pNv, 0x31, SetBitField (r->nx.ind.nxreg31,10:3,7:0)); NVWriteTV (pNv, 0x35, Set8Bits (r->nx.ind.nxreg35)); NVWriteTV (pNv, 0x3c, SetBitField (r->nx.ind.nxreg3c, 9:2,7:0)); /* 0x06 has connector flags, but is not affected by it? */ NVAndOrTV (pNv, 0x07, ~(SetBit(3)|SetBit(5)), SetBitFlag (r->nx.ind.flags, NX_FLAG_CONN_3, 3) | SetBitFlag (r->nx.ind.flags, NX_FLAG_CONN_5, 5)); NVAndOrTV (pNv, 0x34, ~(SetBit(0)|SetBit(3)|SetBit(6)), SetBitFlag (r->nx.ind.flags, NX_FLAG_SYS_0, 0) | SetBitField (r->nx.ind.nxsys12,1:0,2:1) | SetBitFlag (r->nx.ind.flags, NX_FLAG_SYS_3, 3) | SetBitFlag (r->nx.ind.flags, NX_FLAG_SYS_6, 6)); MMIO_OUT32 (pNv->riva.PTV, 0x204, SetBitField (r->nx.muxa,1:0,1:0) | SetBitField (r->nx.muxb,1:0,5:4) | SetBitField (r->nx.muxc,1:0,9:8) | SetBitFlag (r->nx.flags1, NX_FLAG1_DACA, 12) | SetBitFlag (r->nx.flags1, NX_FLAG1_DACB, 16) | SetBitFlag (r->nx.flags1, NX_FLAG1_DACC, 20)); MMIO_OUT32 (pNv->riva.PTV,0x304,SetBitField (r->nx.img.scaler_h,9:0,25:16)); MMIO_OUT32 (pNv->riva.PTV,0x508,SetBitField (r->nx.img.scaler_v,9:0,25:16)); MMIO_OUT32 (pNv->riva.PTV,0x208,SetBitField (r->nx.img.overscan,10:0,16:6)); /* VIP: or 16:4 ?? */ MMIO_OUT32 (pNv->riva.PTV,0x500,SetBitField (r->nx.img.vip1,15:0,19:4)); MMIO_OUT32 (pNv->riva.PTV,0x504,SetBitField (r->nx.img.vip2,15:0,19:4)); { CARD32 tmp = MMIO_IN32 (pNv->riva.PTV, 0x200); tmp &= ~MASKEXPAND(25:24); tmp |= SetBitField (r->nx.filter,1:0,25:24); MMIO_OUT32 (pNv->riva.PTV, 0x200, tmp); } for (i = 0; i < 7; i++) { MMIO_OUT32(pNv->riva.PTV,0x310+i*4,TVNxSetFiltCoeff(r->nx.filt_x1[0][i])); MMIO_OUT32(pNv->riva.PTV,0x32c+i*4,TVNxSetFiltCoeff(r->nx.filt_x1[1][i])); MMIO_OUT32(pNv->riva.PTV,0x350+i*4,TVNxSetFiltCoeff(r->nx.filt_x1[2][i])); MMIO_OUT32(pNv->riva.PTV,0x36c+i*4,TVNxSetFiltCoeff(r->nx.filt_x1[3][i])); MMIO_OUT32(pNv->riva.PTV,0x390+i*4,TVNxSetFiltCoeff(r->nx.filt_x2[0][i])); MMIO_OUT32(pNv->riva.PTV,0x3ac+i*4,TVNxSetFiltCoeff(r->nx.filt_x2[1][i])); MMIO_OUT32(pNv->riva.PTV,0x3d0+i*4,TVNxSetFiltCoeff(r->nx.filt_x2[2][i])); MMIO_OUT32(pNv->riva.PTV,0x3ec+i*4,TVNxSetFiltCoeff(r->nx.filt_x2[3][i])); MMIO_OUT32(pNv->riva.PTV,0x510+i*4,TVNxSetFiltCoeff(r->nx.filt_y [0][i])); MMIO_OUT32(pNv->riva.PTV,0x52c+i*4,TVNxSetFiltCoeff(r->nx.filt_y [1][i])); MMIO_OUT32(pNv->riva.PTV,0x550+i*4,TVNxSetFiltCoeff(r->nx.filt_y [2][i])); MMIO_OUT32(pNv->riva.PTV,0x56c+i*4,TVNxSetFiltCoeff(r->nx.filt_y [3][i])); } /* d600 ?? d604 system d608 system */ } void TVNxGetRegs (TVEncoderObj *this, TVEncoderRegs *r) { register NVPtr pNv = (NVPtr) this->ctrl; CARD8 regs[0x40]; int i; RAISE (MSG_DEBUG, "tv get nx"); for (i = 0x00; i < 0x40; i++) regs[i] = NVReadTV (pNv, i); r->nx.ind.fsub = (unsigned long) Set8Bits(regs[0x00]) << 24 | (unsigned long) Set8Bits(regs[0x01]) << 16 | (unsigned long) Set8Bits(regs[0x02]) << 8 | (unsigned long) Set8Bits(regs[0x03]); r->nx.ind.nxreg04 = Set8Bits (regs[0x04]); r->nx.ind.nxreg08 = Set8Bits (regs[0x08]); r->nx.ind.nxreg09 = SetBitField (regs[0x09],6:0, 6:0); r->nx.ind.nxreg0a = Set8Bits (regs[0x0a]); r->nx.ind.nxreg0b = Set8Bits (regs[0x0b]); r->nx.ind.nxreg0c = Set8Bits (regs[0x0c]); r->nx.ind.nxreg0e = SetBitField (regs[0x0e],8:0,10:2); r->nx.ind.nxreg10 = SetBitField (regs[0x10],8:0,10:2); r->nx.ind.nxreg17 = SetBitField (regs[0x17],8:0,10:2); r->nx.ind.nxreg1e = SetBitField (regs[0x1e],8:0,10:2); r->nx.ind.nxreg20 = Set8Bits (regs[0x20]); r->nx.ind.nxreg22 = Set8Bits (regs[0x22]); r->nx.ind.nxreg29 = SetBitField (regs[0x29],4:0, 4:0); r->nx.ind.nxreg2c = SetBitField (regs[0x2c],5:0, 5:0); r->nx.ind.nxreg31 = SetBitField (regs[0x31],7:0,10:3); r->nx.ind.nxreg35 = SetBitField (regs[0x35],7:0, 7:0); r->nx.ind.nxreg3c = SetBitField (regs[0x3c],7:0, 9:2); r->nx.ind.flags = 0; { register CARD32 tmp = NVReadTV (pNv, 0x07); r->nx.ind.flags |= GetBitFlag (tmp, 3, NX_FLAG_CONN_3) | GetBitFlag (tmp, 5, NX_FLAG_CONN_5); } { register CARD32 tmp = NVReadTV (pNv, 0x34); r->nx.ind.flags |= GetBitFlag (tmp, 0, NX_FLAG_SYS_0) | GetBitFlag (tmp, 3, NX_FLAG_SYS_3) | GetBitFlag (tmp, 6, NX_FLAG_SYS_6); r->nx.ind.nxsys12 = SetBitField (tmp,2:1,1:0); } { register CARD32 tmp = MMIO_IN32 (pNv->riva.PTV, 0x200); r->nx.filter = SetBitField (tmp,25:24,1:0); } { register CARD32 tmp = MMIO_IN32 (pNv->riva.PTV, 0x204); r->nx.muxa = SetBitField (tmp,1:0,1:0); r->nx.muxb = SetBitField (tmp,5:4,1:0); r->nx.muxc = SetBitField (tmp,9:8,1:0); r->nx.flags1 = GetBitFlag (tmp,12,NX_FLAG1_DACA) | GetBitFlag (tmp,16,NX_FLAG1_DACB) | GetBitFlag (tmp,20,NX_FLAG1_DACC); } r->nx.img.scaler_h = SetBitField(MMIO_IN32(pNv->riva.PTV,0x304),25:16, 9:0); r->nx.img.scaler_v = SetBitField(MMIO_IN32(pNv->riva.PTV,0x508),25:16, 9:0); r->nx.img.overscan = SetBitField(MMIO_IN32(pNv->riva.PTV,0x208), 16:6,10:0); r->nx.img.vip1 = MMIO_IN32(pNv->riva.PTV,0x500) >> 4; r->nx.img.vip2 = MMIO_IN32(pNv->riva.PTV,0x504) >> 4; for (i = 0; i < 7; i++) { r->nx.filt_x1[0][i]=TVNxGetFiltCoeff(MMIO_IN32(pNv->riva.PTV,0x310+i*4)); r->nx.filt_x1[1][i]=TVNxGetFiltCoeff(MMIO_IN32(pNv->riva.PTV,0x32c+i*4)); r->nx.filt_x1[2][i]=TVNxGetFiltCoeff(MMIO_IN32(pNv->riva.PTV,0x350+i*4)); r->nx.filt_x1[3][i]=TVNxGetFiltCoeff(MMIO_IN32(pNv->riva.PTV,0x36c+i*4)); r->nx.filt_x2[0][i]=TVNxGetFiltCoeff(MMIO_IN32(pNv->riva.PTV,0x390+i*4)); r->nx.filt_x2[1][i]=TVNxGetFiltCoeff(MMIO_IN32(pNv->riva.PTV,0x3ac+i*4)); r->nx.filt_x2[2][i]=TVNxGetFiltCoeff(MMIO_IN32(pNv->riva.PTV,0x3d0+i*4)); r->nx.filt_x2[3][i]=TVNxGetFiltCoeff(MMIO_IN32(pNv->riva.PTV,0x3ec+i*4)); r->nx.filt_y [0][i]=TVNxGetFiltCoeff(MMIO_IN32(pNv->riva.PTV,0x510+i*4)); r->nx.filt_y [1][i]=TVNxGetFiltCoeff(MMIO_IN32(pNv->riva.PTV,0x52c+i*4)); r->nx.filt_y [2][i]=TVNxGetFiltCoeff(MMIO_IN32(pNv->riva.PTV,0x550+i*4)); r->nx.filt_y [3][i]=TVNxGetFiltCoeff(MMIO_IN32(pNv->riva.PTV,0x56c+i*4)); } } /* Also: 680608 bit 16 PWRDWN_DAC (always 2nd head???) 680630 bit 1-0 (on:2, off:0) (on head) */ void TVNxSetState (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { register NVPtr pNv = (NVPtr) this->ctrl; switch (state) { case TV_OFF: case TV_BARS: NVWriteTV (pNv, 0x3e, 0x01); break; case TV_ON: NVWriteTV (pNv, 0x3e, 0x00); break; default: break; } } long TVNxGetStatus (TVEncoderObj *this, int index) { return 0; } TVConnect TVNxGetConnect (TVEncoderObj *this) { /* not clear how to do that. Via testpoint?? */ return CONNECT_BOTH; } char* TVDetectNx (TVChip *encoder) { *encoder = TV_NVIDIA; return "NVIDIA internal (NV17)"; /* FIXME check d22c bit 8: 0=NVIDIA-B, 1=NVIDIA-A */ } TVEncoderObj tvNxTemplate = { type: TV_NVIDIA, ctrl: NULL, minClock: 10500, maxClock: 10500, Create: TVNxCreate, InitRegs: TVNxInitRegs, SetRegs: TVNxSetRegs, GetRegs: TVNxGetRegs, SetPort: TVNxSetPort, GetPort: TVNxGetPort, SetState: TVNxSetState, GetConnect: TVNxGetConnect, GetStatus: TVNxGetStatus }; nvtv-0.4.7/src/tv_ch1_7007.c0000644000175000001440000006034410006415006010767 /* NVTV Chrontel TV-I2C access -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_ch1_7007.c,v 1.9 2004/01/30 08:47:02 dthierbach Exp $ * * Contents: * * Routines to access the Chrontel chip registers via the I2C bus. * */ #include "local.h" /* before everything else */ #include "xf86_ansic.h" #include "xf86i2c.h" #include "bitmask.h" #include "tv_i2c.h" #include "tv_ch1_7007.h" /* -------- Chrontel -------- */ static I2CByte nvChDefMacro [0x40] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; static I2CByte nvChPalMacro00APS1 [0x40] = { 0x00,0x80,0x6C,0x00,0x00,0x2E,0x00,0x00, 0x18,0x00,0x00,0x00,0x33,0x80,0x40,0x22, 0xE0,0x00,0x00,0x40,0x00,0x00,0x38,0x00, 0x20,0xA0,0x20,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x40,0x10,0x9F,0x9F,0xBA,0x9B, 0x64,0x0A,0xEE,0x26,0x2A,0x7E,0x9A,0x3F, 0xE0,0x15,0x40,0xFE,0x7E,0x05,0x00,0x00, }; static I2CByte nvChPalMacro08APS1 [0x40] = { 0x00,0x80,0x6C,0x00,0x00,0x37,0x00,0x00, 0x18,0x00,0x00,0x00,0x33,0x80,0x40,0x22, 0xE0,0x00,0x00,0x40,0x00,0x00,0x38,0x00, 0x20,0xA0,0x20,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x4C,0x30,0xBD,0xBD,0xDE,0x9B, 0x64,0x3C,0x1B,0x2E,0x32,0x96,0xB7,0x3F, 0xE0,0x15,0x40,0xFE,0x7E,0x05,0x00,0x00, }; static I2CByte nvChPalMacro14APS1 [0x40] = { 0x00,0x80,0x6C,0x00,0x00,0x3A,0x00,0x00, 0x18,0x00,0x00,0x00,0x33,0x80,0x40,0x22, 0xE0,0x00,0x00,0x40,0x00,0x00,0x38,0x00, 0x20,0xA0,0x20,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x50,0x30,0xC8,0xC8,0xEA,0x9B, 0x64,0x4C,0x29,0x30,0x34,0x9D,0xC0,0x3F, 0xE0,0x15,0x40,0xFE,0x7E,0x05,0x00,0x00, }; static I2CByte nvChPalMacro20APS1 [0x40] = { 0x00,0x80,0x6C,0x00,0x00,0x47,0x00,0x00, 0x18,0x00,0x00,0x00,0x33,0x80,0x40,0x22, 0xE0,0x00,0x00,0x40,0x00,0x00,0x38,0x00, 0x20,0xA0,0x20,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x61,0x38,0xF3,0xF3,0x1C,0x9B, 0x64,0x94,0x6A,0x3B,0x40,0xC0,0xEA,0x3F, 0xE0,0x15,0x40,0xFE,0x7E,0x05,0x00,0x00, }; static I2CByte nvChNtscMacro03APS1 [0x40] = { 0x00,0x80,0x0B,0x00,0x00,0x30,0x00,0x00, 0x30,0x00,0x00,0x00,0x05,0x00,0x40,0x00, 0xE0,0x00,0x00,0x00,0x00,0x00,0x0D,0x00, 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x4A,0x00,0x00,0x00,0x00,0x00, 0x00,0xBD,0xBD,0x37,0x37,0xBD,0xBD,0x0F, 0xF0,0x00,0x00,0x0F,0x0F,0x05,0x00,0x00, }; static I2CByte nvChNtscMacro03APS2 [0x40] = { 0x00,0x80,0x0B,0x00,0x00,0x30,0x00,0x00, 0x30,0x00,0x00,0x00,0x05,0xD0,0x40,0x11, 0xF0,0xC8,0xFF,0x40,0x00,0x00,0x0D,0x00, 0x10,0x50,0x10,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x4A,0x01,0x98,0x98,0xBB,0x9E, 0x2D,0xBD,0xBD,0x37,0x37,0xBD,0xBD,0x0F, 0xF0,0x00,0x00,0x0F,0x0F,0x05,0x00,0x00, }; static I2CByte nvChNtscMacro03APS3 [0x40] = { 0x00,0x80,0x0B,0x00,0x00,0x30,0x00,0x00, 0x30,0x00,0x00,0x00,0x05,0xB0,0x40,0x15, 0xF0,0xC8,0xFF,0x80,0x00,0x00,0x0D,0x00, 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x4A,0x01,0x98,0x98,0xBB,0x98, 0x29,0xBD,0xBD,0x37,0x37,0xBD,0xBD,0x0F, 0xF0,0x00,0x00,0x0F,0x0F,0x05,0x00,0x00, }; static I2CByte nvChNtscMacro11APS1 [0x40] = { 0x00,0x80,0x0B,0x00,0x00,0x3A,0x00,0x00, 0x30,0x00,0x00,0x00,0x05,0x00,0x40,0x00, 0xE0,0x00,0x00,0x00,0x00,0x00,0x0D,0x00, 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x59,0xF0,0x00,0x00,0x00,0x00, 0x00,0x08,0x08,0x42,0x42,0x08,0x08,0x0F, 0xF0,0x00,0x00,0x0F,0x0F,0x05,0x00,0x00, }; static I2CByte nvChNtscMacro11APS2 [0x40] = { 0x00,0x80,0x0B,0x00,0x00,0x3A,0x00,0x00, 0x30,0x00,0x00,0x00,0x05,0xD0,0x40,0x11, 0xF0,0xC8,0xFF,0x40,0x00,0x00,0x0D,0x00, 0x10,0x50,0x10,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x59,0xF1,0x67,0x67,0xE2,0x9E, 0x2D,0x08,0x08,0x42,0x42,0x08,0x08,0x0F, 0xF0,0x00,0x00,0x0F,0x0F,0x05,0x00,0x00, }; static I2CByte nvChNtscMacro11APS3 [0x40] = { 0x00,0x80,0x0B,0x00,0x00,0x3A,0x00,0x00, 0x30,0x00,0x00,0x00,0x05,0xB0,0x40,0x15, 0xF0,0xC8,0xFF,0x80,0x00,0x00,0x0D,0x00, 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x59,0xF1,0x67,0x67,0xE2,0x98, 0x29,0x08,0x08,0x42,0x42,0x08,0x08,0x0F, 0xF0,0x00,0x00,0x0F,0x0F,0x05,0x00,0x00, }; static I2CByte nvChNtscMacro17APS1 [0x40] = { 0x00,0x80,0x0B,0x00,0x40,0x37,0x80,0x00, 0x30,0x00,0x00,0x00,0x05,0x00,0x40,0x00, 0xE0,0x00,0x00,0x00,0x00,0x00,0x0D,0x00, 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x54,0x00,0x00,0x00,0x00,0x00, 0x00,0xFA,0xFA,0x3F,0x3F,0xFA,0xFA,0x0F, 0xF0,0x00,0x00,0x0F,0x0F,0x05,0x00,0x00, }; static I2CByte nvChNtscMacro17APS2 [0x40] = { 0x00,0x80,0x0B,0x00,0x40,0x37,0x80,0x00, 0x30,0x00,0x00,0x00,0x05,0xD0,0x40,0x11, 0xF0,0xC8,0xFF,0x40,0x00,0x00,0x0D,0x00, 0x10,0x50,0x10,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x54,0x01,0xAE,0xAE,0xD6,0x9E, 0x2D,0xFA,0xFA,0x3F,0x3F,0xFA,0xFA,0x0F, 0xF0,0x00,0x00,0x0F,0x0F,0x05,0x00,0x00, }; static I2CByte nvChNtscMacro17APS3 [0x40] = { 0x00,0x80,0x0B,0x00,0x40,0x37,0x80,0x00, 0x30,0x00,0x00,0x00,0x05,0xB0,0x40,0x15, 0xF0,0xC8,0xFF,0x80,0x00,0x00,0x0D,0x00, 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x54,0x01,0xAE,0xAE,0xD6,0x98, 0x29,0xFA,0xFA,0x3F,0x3F,0xFA,0xFA,0x0F, 0xF0,0x00,0x00,0x0F,0x0F,0x05,0x00,0x00, }; static I2CByte nvChNtscMacro24APS1 [0x40] = { 0x00,0x80,0x0B,0x00,0x40,0x40,0x80,0x00, 0x30,0x00,0x00,0x00,0x05,0x00,0x40,0x00, 0xE0,0x00,0x00,0x00,0x00,0x00,0x0D,0x00, 0x50,0x50,0x50,0x0B,0x04,0x01,0x06,0x05, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x6B,0xF0,0x00,0x00,0x00,0x00, 0x00,0x3F,0x3F,0x50,0x50,0x3F,0x3F,0x0F, 0xF0,0x00,0x00,0x0F,0x0F,0x05,0x00,0x00, }; static I2CByte nvChNtscMacro24APS2 [0x40] = { 0x00,0x80,0x0B,0x00,0x40,0x40,0x80,0x00, 0x30,0x00,0x00,0x00,0x05,0xD0,0x40,0x11, 0xF0,0xC8,0xFF,0x40,0x00,0x00,0x0D,0x00, 0x10,0x50,0x10,0x0B,0x04,0x01,0x06,0x05, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x6B,0xF9,0xDD,0xDD,0x11,0x9E, 0x2D,0x3F,0x3F,0x50,0x50,0x3F,0x3F,0x0F, 0xF0,0x00,0x00,0x0F,0x0F,0x05,0x00,0x00, }; static I2CByte nvChNtscMacro24APS3 [0x40] = { 0x00,0x80,0x0B,0x00,0x40,0x40,0x80,0x00, 0x30,0x00,0x00,0x00,0x05,0xB0,0x40,0x15, 0xF0,0xC8,0xFF,0x80,0x00,0x00,0x0D,0x00, 0x50,0x50,0x50,0x0B,0x04,0x01,0x06,0x05, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x6B,0xF9,0xDD,0xDD,0x11,0x98, 0x29,0x3F,0x3F,0x50,0x50,0x3F,0x3F,0x0F, 0xF0,0x00,0x00,0x0F,0x0F,0x05,0x00,0x00, }; /* 00: ---, 7:6, 7:0, ---, 7+4, 7:0, ---, ---, */ /* 08: 7:3, ---, ---, ---, 7:0, 7:4, 7:5, 7:0, */ /* 10: 7:4, 7:3, 7:0, 7:5, ---, ---, 7:0, 7:6, */ /* 18: 7:4, 7:4, 7:4, ---, ---, 7:4, 7:4, 7:4, */ /* 20: 7:6, 7:5, ---, ---, ---, ---, ---, 7:6 */ /* 28: ---, ---, 7:0, 7:0, 7:0, 7:0, 7:0, 7:0 */ /* 30: 7:0, 7:0, 7:0, 7:0, 7:0, 7:0, 7:0, 7:0 */ /* 38: 7:0, 7:0, 7:0, 7:0, 7:0, 7:0, 7:0, --- */ #if 0 /* not needed yet; ignore to prevent warning */ static I2CByte nvChMaskMacro [0x40] = { 0xFF,0x3F,0x00,0xFF,0x7F,0x00,0x7F,0xFF, 0x07,0xFF,0xFF,0xFF,0x00,0x0F,0x3F,0xC0, 0x0F,0x07,0x00,0x1F,0xFF,0xFF,0x00,0xFF, 0x0F,0x0F,0x0F,0xF0,0xF0,0xF0,0xF0,0xF0, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0x80,0xFF,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x80, 0x00,0x80,0x00,0x00,0x00,0xF8,0xFF,0xFF }; #endif typedef struct { int mode; I2CByte *regs[4]; } TVCh1MacroTable; static TVCh1MacroTable nvChMacroTable [] = { { 0, {nvChDefMacro, nvChPalMacro00APS1, nvChPalMacro00APS1, nvChPalMacro00APS1}}, { 3, {nvChDefMacro, nvChNtscMacro03APS1, nvChNtscMacro03APS2, nvChNtscMacro03APS3}}, { 8, {nvChDefMacro, nvChPalMacro08APS1, nvChPalMacro08APS1, nvChPalMacro08APS1}}, {11, {nvChDefMacro, nvChNtscMacro11APS1, nvChNtscMacro11APS2, nvChNtscMacro11APS3}}, {14, {nvChDefMacro, nvChPalMacro14APS1, nvChPalMacro14APS1, nvChPalMacro14APS1}}, {17, {nvChDefMacro, nvChNtscMacro17APS1, nvChNtscMacro17APS2, nvChNtscMacro17APS3}}, {20, {nvChDefMacro, nvChPalMacro20APS1, nvChPalMacro20APS1, nvChPalMacro20APS1}}, {24, {nvChDefMacro, nvChNtscMacro24APS1, nvChNtscMacro24APS2, nvChNtscMacro24APS3}}, {-1, {nvChDefMacro, nvChDefMacro, nvChDefMacro, nvChDefMacro}} }; I2CByte *TVCh1MacroRegs (TVEncoderRegs *r) { TVCh1MacroTable *t; if (!r || r->ch.macro < 0 || r->ch.macro > 3) return nvChDefMacro; for (t = nvChMacroTable; t->mode != -1; t++) { if (r->ch.mode == t->mode) { return t->regs [r->ch.macro]; } } return nvChDefMacro; } /* -------- */ /* Read hardware config on object creation. * * 0: 20-0 mem5v (should be the same as pll5d) * 1: 20-1 pll5va AVDD 5V / ?V * 2: 20-2 pll5vd DVDD 5V / 3.3V * 3: 20-3 plls (should be the same as pll5va) * 5: 1b-5 dvdd2 DVDD2 3.3V / 1.8V * 6: 1b-6 gpioin0 * 7: 1b-7 gpioin1 * 8: 1c-6 goenb0 * 9: 1c-7 goenb1 */ void TVCh1Create (TVEncoderObj *this, TVChip chip_type, void* ctrl) { register I2CDevPtr dev = (I2CDevPtr) ctrl; I2CByte result; this->type = chip_type; this->ctrl = ctrl; this->hwstate = 0x07; tvBusOk = TRUE; TVReadBus (dev, 0x80|0x20, &result); this->hwconfig = SetBitField(result, 3:0, 3:0); TVReadBus (dev, 0x80|0x1b, &result); this->hwconfig |= SetBitField(result, 7:5, 7:5); TVReadBus (dev, 0x80|0x1c, &result); this->hwconfig |= SetBitField(result, 7:6, 9:8); #ifdef FAKE_I2C this->hwconfig = 0x32a; /* power on value of my card */ #endif if (!tvBusOk) { RAISE (MSG_ABORT, "Critical: Error reading Chrontel hardware config\n"); } RAISE (MSG_DEBUG, "create ch hw=%08X", this->hwconfig); } /* Init chrontel register values (all done in SetChRegs) * * - 04-3:0 idf = 5 (12bit mux "I" RBG) * - 06-7 cfrb = 0 (free running clock in master mode) * - 06-6 m/s* = 1 (master mode) * - 06-4 mcp = 0 (latch on negative edge) * - 06-3:2 xcm = 00 (XCLK 1x) * - 06-1:0 pcm = 00 (P-Out 1x) * - aciv = 0 (auto civ off, since it has bad quality) * - 0D-3 des = 0 (no embedded sync) * 2 0D-2 syo = 1! (default 0) (output horizontal and vertical sync) * 1 0D-1 vsp = 1! (default 0) (vertical sync active high) * 0 0D-0 hsp = 1! (default 0) (horizontal sync active high) * - 1B-5 dvdd2 = 1! (default 0) (dvdd2 at 3.3V) * - 1B-4 poutp = 0? (default 0) (P-OUT polarity) (NV=1 ?!) * - 1C-5 dsm = 0 (default 1) (should be 0 if dsen=0) * - 1C-4 dsen = 0 (default 1) (Use hsync for start of active video) */ void TVCh1SetPort (TVEncoderObj *this, int port) { RAISE (MSG_DEBUG, "tv port ch %08X", port); if ((port & PORT_FORMAT_MASK) != PORT_FORMAT_RGB) { RAISE (MSG_ABORT, "TVCh1SetPort: Only RGB multiplex format supported."); } if ((port & PORT_BLANK_POLARITY) != PORT_BLANK_LOW) { RAISE (MSG_ABORT, "TVCh1SetPort: Only active low blank supported."); } if ((port & PORT_BLANK_DIR) != PORT_BLANK_OUT) { RAISE (MSG_ABORT, "TVCh1SetPort: Only blank out supported."); } if ((port & PORT_BLANK_MODE) != PORT_BLANK_REGION) { RAISE (MSG_ABORT, "TVCh1SetPort: Only blank region supported."); } this->hwstate = 0x00 | ((port & PORT_PCLK_POLARITY) ? 0 : SetBit(4)) | ((port & PORT_PCLK_MODE) ? 0 : SetBit(3)) | ((port & PORT_SYNC_DIR) ? 0 : SetBit(2)) | ((port & PORT_VSYNC_POLARITY) ? SetBit(1) : 0) | ((port & PORT_HSYNC_POLARITY) ? SetBit(0) : 0); #if 0 /* FIXME TODO complete */ 1c-4 dsen PORT_BLANK_DIR 1c-5 dsm PORT_BLANK_DIR and setup BCO etc. properly in init! #endif } void TVCh1GetPort (TVEncoderObj *this, int *port) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte res; RAISE (MSG_DEBUG, "tv get port ch"); *port = PORT_FORMAT_RGB | PORT_BLANK_LOW | PORT_BLANK_OUT | PORT_BLANK_REGION; /* FIXME handle at least some of those */ TVReadBus (dev, 0x80|0x06, &res); *port |= (GetBit(res,6) ? PORT_PCLK_MASTER : PORT_PCLK_SLAVE) | (GetBit(res,4) ? PORT_PCLK_LOW : PORT_PCLK_HIGH); TVReadBus (dev, 0x80|0x0d, &res); *port |= (GetBit(res,2) ? PORT_SYNC_OUT : PORT_SYNC_IN) | (GetBit(res,1) ? PORT_VSYNC_HIGH : PORT_VSYNC_LOW) | (GetBit(res,0) ? PORT_HSYNC_HIGH : PORT_HSYNC_LOW); } void TVCh1InitRegs (TVEncoderObj *this, int port) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; TVCh1SetPort (this, port); /* 0x0d will be written again in SetRegs with macro info */ TVWriteBus (dev, 0x80|0x0d, SetBitField(this->hwstate,2:0,2:0)); /* To avoid overclocking (just in case, shouldn't happen anyway). Will be set in TVSetChRegs as well */ TVWriteBus (dev, 0x80|0x06, 0x40); /* master mode clock */ /* FIXME write 0x1B */ /* FIXME compare PCLK_ACTIVE, PCLK_VDD etc with hwconfig */ } /* * Note: * * 0e-3 reset = 1 (must be 1 -- doc is unclear about that) * */ void TVCh1SetRegs (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte *m; int i; RAISE (MSG_DEBUG, "tv regs ch"); #ifdef FAKE_I2C FPRINTF ("\ni2c ["); #endif m = TVCh1MacroRegs (r); TVWriteBus (dev, 0x80|0x00, SetBitField(r->ch.dmr_ir,2:0,7:5) | SetBitField(r->ch.dmr_vs,1:0,4:3) | SetBitField(r->ch.dmr_sr,2:0,2:0)); TVWriteBus (dev, 0x80|0x01, m[0x01] | SetBitField(r->ch.ffr_fc,1:0,5:4) | SetBitField(r->ch.ffr_fy,1:0,3:2) | SetBitField(r->ch.ffr_ft,1:0,1:0)); TVWriteBus (dev, 0x80|0x02, m[0x02]); TVWriteBus (dev, 0x80|0x03, m[0x03] | SetBitField(r->ch.vbw_flff, 0:0,7:7) | SetBitFlag(r->ch.flags,CH_FLAG_CVBW,6) | SetBitField(r->ch.vbw_cbw, 1:0,5:4) | SetBitField(r->ch.vbw_ypeak,0:0,3:3) | SetBitField(r->ch.vbw_ysv, 1:0,2:1) | SetBitField(r->ch.vbw_ycv, 0:0,0:0)); TVWriteBus (dev, 0x80|0x04, m[0x04] | SetBitField(r->ch.dacg,0:0,6:6) | 0x05 /* idf=5 */ ); TVWriteBus (dev, 0x80|0x05, m[0x05]); TVWriteBus (dev, 0x80|0x06, m[0x06] | SetBitField(this->hwstate,4:4,4:4) | SetBitField(this->hwstate,3:3,6:6) | SetBitFlag(r->ch.flags,CH_FLAG_CFRB,7)); TVWriteBus (dev, 0x80|0x07, Set8Bits(r->ch.sav)); TVWriteBus (dev, 0x80|0x08, m[0x08] | SetBitField(r->ch.sav,8:8,2:2) | SetBitField(r->ch.hpr,8:8,1:1) | SetBitField(r->ch.vpr,8:8,0:0)); TVWriteBus (dev, 0x80|0x09, Set8Bits(r->ch.blr)); TVWriteBus (dev, 0x80|0x0a, Set8Bits(r->ch.hpr)); TVWriteBus (dev, 0x80|0x0b, Set8Bits(r->ch.vpr)); TVWriteBus (dev, 0x80|0x0c, m[0x0c]); TVWriteBus (dev, 0x80|0x0d, m[0x0d] | SetBitField(this->hwstate,2:0,2:0)); TVWriteBus (dev, 0x80|0x0e, m[0x0e] | 0x08 | SetBitFlag(r->ch.flags, CH_FLAG_SCART, 4) | ((state != TV_ON) ? 0x05 : SetBitField(r->ch.flags,1:0,CH_FLAG_DAC))); TVWriteBus (dev, 0x80|0x0f, m[0x0f]); TVWriteBus (dev, 0x80|0x10, 0x00 | m[0x10]); /* sense off */ TVWriteBus (dev, 0x80|0x11, m[0x11] | SetBitField(r->ch.ce,2:0,2:0)); TVWriteBus (dev, 0x80|0x12, m[0x12]); TVWriteBus (dev, 0x80|0x13, m[0x13] | SetBitField(r->ch.pll_n,9:8,2:1) | SetBitField(r->ch.pll_m,8:8,0:0)); TVWriteBus (dev, 0x80|0x14, Set8Bits(r->ch.pll_m)); TVWriteBus (dev, 0x80|0x15, Set8Bits(r->ch.pll_n)); TVWriteBus (dev, 0x80|0x16, m[0x16]); TVWriteBus (dev, 0x80|0x17, 0x00 | m[0x17]); /* BCO= 14MHz crystal */ TVWriteBus (dev, 0x80|0x18, m[0x18] | SetBitField(r->ch.fsci,31:28,3:0)); TVWriteBus (dev, 0x80|0x19, m[0x19] | SetBitField(r->ch.fsci,27:24,3:0)); TVWriteBus (dev, 0x80|0x1a, m[0x1a] | SetBitField(r->ch.fsci,23:20,3:0)); TVWriteBus (dev, 0x80|0x1b, SetBitField(r->ch.fsci,19:16,3:0) | SetBitField(this->hwconfig,7:5,7:5) | SetBitFlag(r->ch.flags,CH_FLAG_POUTP,4)); TVWriteBus (dev, 0x80|0x1c, SetBitField(r->ch.fsci,15:12,3:0) | SetBitField(this->hwconfig,9:8,7:6)); TVWriteBus (dev, 0x80|0x1d, m[0x1d] | SetBitField(r->ch.fsci,11:8,3:0)); TVWriteBus (dev, 0x80|0x1e, m[0x1e] | SetBitField(r->ch.fsci,7:4,3:0)); TVWriteBus (dev, 0x80|0x1f, m[0x1f] | SetBitField(r->ch.fsci,3:0,3:0)); TVWriteBus (dev, 0x80|0x20, m[0x20] | SetBitField(r->ch.pllcap,0:0,4:4) | SetBitField(this->hwconfig,3:0,3:0)); TVWriteBus (dev, 0x80|0x21, m[0x21] | SetBitField(r->ch.civh,1:0,2:1) | SetBitFlag(r->ch.flags,CH_FLAG_ACIV,0)); for (i = 0x2a; i <= 0x3d; i++) { TVWriteBus (dev, 0x80|i, m[i]); } #if 0 /* Register 0x26-0x29 reserved for test */ /* mtd, ms, rsa, bst, nst, de, ts */ TVWriteBus (dev, 0x80|0x27, m[0x27] | 0x00 /* FIXME */ | SetBitField(r->ch.ylm,8:8,1:1) | SetBitField(r->ch.clm,8:8,0:0)); TVWriteBus (dev, 0x80|0x28, Set8Bits(r->ch.ylm)); TVWriteBus (dev, 0x80|0x29, Set8Bits(r->ch.clm)); #endif #ifdef FAKE_I2C FPRINTF ("]\n"); #endif } void TVCh1GetRegs (TVEncoderObj *this, TVEncoderRegs *r) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte regs[0x40]; int i; for (i = 0x00; i < 0x40; i++) TVReadBus (dev, 0x80|i, ®s[i]); r->ch.dmr_ir = SetBitField(regs[0x00],7:5,2:0); r->ch.dmr_vs = SetBitField(regs[0x00],4:3,1:0); r->ch.dmr_sr = SetBitField(regs[0x00],2:0,2:0); r->ch.ffr_fc = SetBitField(regs[0x01],5:4,1:0); r->ch.ffr_fy = SetBitField(regs[0x01],3:2,1:0); r->ch.ffr_ft = SetBitField(regs[0x01],1:0,1:0); r->ch.vbw_flff = SetBitField(regs[0x03],7:7,0:0); r->ch.vbw_cbw = SetBitField(regs[0x03],5:4,1:0); r->ch.vbw_ypeak = SetBitField(regs[0x03],3:3,0:0); r->ch.vbw_ysv = SetBitField(regs[0x03],2:1,1:0); r->ch.vbw_ycv = SetBitField(regs[0x03],0:0,0:0); r->ch.dacg = SetBitField(regs[0x04],6:6,0:0); r->ch.sav = Set8Bits(regs[0x07]) | SetBitField(regs[0x08],2:2,8:8); r->ch.blr = Set8Bits(regs[0x09]); r->ch.hpr = Set8Bits(regs[0x0a]) | SetBitField(regs[0x08],1:1,8:8); r->ch.vpr = Set8Bits(regs[0x0b]) | SetBitField(regs[0x08],0:0,8:8); r->ch.ce = SetBitField(regs[0x11],2:0,2:0); r->ch.te = 0; r->ch.pll_n = Set8Bits(regs[0x15]) | SetBitField(regs[0x13],2:1,9:8); r->ch.pll_m = Set8Bits(regs[0x14]) | SetBitField(regs[0x13],0:0,8:8); r->ch.fsci = SetBitField(regs[0x18],3:0,31:28) | SetBitField(regs[0x19],3:0,27:24) | SetBitField(regs[0x1a],3:0,23:20) | SetBitField(regs[0x1b],3:0,19:16) | SetBitField(regs[0x1c],3:0,15:12) | SetBitField(regs[0x1d],3:0,11: 8) | SetBitField(regs[0x1e],3:0, 7: 4) | SetBitField(regs[0x1f],3:0, 3: 0); r->ch.pllcap = SetBitField(regs[0x20],4:4,0:0); r->ch.civh = SetBitField(regs[0x21],2:1,1:0); r->ch.flags = CH_FLAG_BOTH | GetBitFlag(regs[0x03],6,CH_FLAG_CVBW) | GetBitFlag(regs[0x06],7,CH_FLAG_CFRB) | GetBitFlag(regs[0x0e],4,CH_FLAG_SCART) | GetBitFlag(regs[0x1b],4,CH_FLAG_POUTP) | GetBitFlag(regs[0x21],0,CH_FLAG_ACIV); r->ch.macro = 0; r->ch.mode = 0; } void TVCh1SetState (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte *m; RAISE (MSG_DEBUG, "tv state ch %i", state); tvState = state; m = TVCh1MacroRegs (r); switch (state) { case TV_OFF: case TV_BARS: TVWriteBus (dev, 0x80|0x0e, 0x0d); break; case TV_ON: TVWriteBus (dev, 0x80|0x0e, m[0x0e] | 0x08 | SetBitField(r->ch.flags,1:0,CH_FLAG_DAC)); /* FIXME CHECK (former val: 0x0b) */ break; default: break; } } TVConnect TVCh1GetConnect (TVEncoderObj *this) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte power, connect; TVReadBus (dev, 0x80|0x0e, &power); TVWriteBus (dev, 0x80|0x0e, 0x0b); TVWriteBus (dev, 0x80|0x10, 0x01); xf86usleep (10); /* tested */ TVWriteBus (dev, 0x80|0x10, 0x00); xf86usleep (10); /* tested */ TVReadBus (dev, 0x80|0x10, &connect); TVWriteBus (dev, 0x80|0x0e, power); if (tvBusOk) { switch (connect & 0x0e) { case 0x0c: return CONNECT_COMPOSITE; break; case 0x02: return CONNECT_SVIDEO; break; case 0x0a: return CONNECT_CONVERT; break; case 0x0e: return CONNECT_NONE; break; default: RAISE (MSG_WARNING, "Strange Chrontel connection status %02x", connect & 0x0e); case 0x00: return CONNECT_BOTH; break; } } else { return CONNECT_NONE; } } long TVCh1GetStatus (TVEncoderObj *this, int index) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; long civ; I2CByte result; tvBusOk = TRUE; TVReadBus (dev, 0x80|0x21, &result); civ = SetBitField (result,4:3,0:1); TVReadBus (dev, 0x80|0x22, &result); civ = (civ << 8) | result; TVReadBus (dev, 0x80|0x23, &result); civ = (civ << 8) | result; TVReadBus (dev, 0x80|0x24, &result); civ = (civ << 8) | result; if (!tvBusOk) return -1; else return civ; } /* * Check for Chrontel chip on device dev. Return version string if found, * NULL otherwise. */ char *TVDetectChrontel1 (I2CDevPtr dev, TVChip *encoder) { I2CByte result; char *chip; static char version [50]; #ifdef FAKE_PROBE_CHRONTEL *encoder = TV_CHRONTEL_MODEL1; snprintf (version, 50, "Chrontel-1 Fake (%1s:%02X)", I2C_ID(dev)); return version; #else #ifdef FAKE_I2C return NULL; #endif #endif tvBusOk = TRUE; TVReadBus (dev, 0x80|0x25, &result); RAISE (MSG_DEBUG, "ch version %02x (%s)", result, tvBusOk ? "ok" : "err"); if (!tvBusOk) return NULL; *encoder = TV_CHRONTEL_MODEL1; switch (result) { case 0x02: chip = "7003B"; break; /* 00000010 */ case 0x30: chip = "7004A"; break; /* ?? */ case 0x31: chip = "7004B"; break; /* ?? */ case 0x32: chip = "7004C"; break; /* 00110010 */ case 0x38: chip = "7005A"; break; /* ?? */ case 0x39: chip = "7005B"; break; /* ?? */ case 0x3a: chip = "7005C"; break; /* 00111010 */ case 0x28: chip = "7006A"; break; /* ?? */ case 0x29: chip = "7006B"; break; /* ?? */ case 0x2a: chip = "7006C"; break; /* 00101010 */ case 0x50: chip = "7007A"; break; /* 01010000 */ case 0x40: chip = "7008A"; break; /* 01000000 */ default: chip = NULL; break; } if (chip) { snprintf (version, 50, "Chrontel %s (%1s:%02X)", chip, I2C_ID(dev)); } else { snprintf (version, 50, "Chrontel-1 (id = %02X) (%1s:%02X)", result, I2C_ID(dev)); } return version; } /* Clock range is a safe guess based on available modes */ TVEncoderObj tvCh1Template = { type: TV_CHRONTEL_MODEL1, ctrl: NULL, minClock: 20000, maxClock: 40000, Create: TVCh1Create, InitRegs: TVCh1InitRegs, SetRegs: TVCh1SetRegs, GetRegs: TVCh1GetRegs, SetPort: TVCh1SetPort, GetPort: TVCh1GetPort, SetState: TVCh1SetState, GetConnect: TVCh1GetConnect, GetStatus: TVCh1GetStatus }; nvtv-0.4.7/src/tv_ch2_7009.c0000644000175000001440000004014210020723072010765 /* NVTV Chrontel TV-I2C access -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_ch2_7009.c,v 1.10 2004/03/01 21:08:10 dthierbach Exp $ * * Contents: * * Routines to access the Chrontel chip registers via the I2C bus. * * Model2: CH7009, CH7010 (and maybe CH7011, CH7012) * */ #include "local.h" /* before everything else */ #include "xf86_ansic.h" #include "xf86i2c.h" #include "bitmask.h" #include "tv_i2c.h" #include "tv_ch2_7009.h" /* -------- Chrontel -------- */ /* Constant chrontel model 2 register values * * - 01-6 vof = 0 (composite and S-Video) * - 02-6 cfrb = 1 (default, lock to vertical) (FIXME extra field) * - 02-7 vbid = 1 (default, minimum flickering during vertical blanking) */ void TVCh2Create (TVEncoderObj *this, TVChip chip_type, void* ctrl) { this->type = chip_type; this->ctrl = ctrl; RAISE (MSG_ERROR, "TVCh2Create: CH7009 family not yet supported."); } void TVCh2SetPort (TVEncoderObj *this, int port) { RAISE (MSG_ERROR, "TVCh2SetPort: CH7009 family not yet supported."); /* PORT_PCLK_POLARITY -> 1c:2 (and init 1e-0) */ /* PORT_PCLK_MODE -> 1c:3 (and 1e-1) */ /* PORT_SYNC_DIR -> 1f:5 */ /* PORT_VSYNC_POLARITY -> 1f:4 */ /* PORT_HSYNC_POLARITY -> 1f:3 */ /* PORT_FORMAT_MASK -> 1f:2-0 */ /* init 1f-6, 1f-7; 1c-1, 1c-0 */ } void TVCh2GetPort (TVEncoderObj *this, int *port) { RAISE (MSG_ERROR, "TVCh2GetPort: CH7009 family not yet supported."); } void TVCh2InitRegs (TVEncoderObj *this, int port) { RAISE (MSG_ERROR, "TVCh2InitRegs: CH7009 family not yet supported."); } /* * - 00-7:5 ir = * - 00-4:3 vs = * - 00-2:0 sr = * - 01-6 vof * - 01-5:4 * - 01-3:2 * - 01-1:0 * - 02-7 * - 02-6 */ void TVCh2SetRegs (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; // RAISE (MSG_ERROR, "TVCh2SetRegs: CH7009 family not yet supported."); return; RAISE (MSG_DEBUG, "tv regs ch2"); #ifdef FAKE_I2C FPRINTF ("\ni2c ["); #endif TVWriteBus (dev, 0x80|0x00, SetBitField(r->ch.dmr_ir,2:0,7:5) | SetBitField(r->ch.dmr_vs,1:0,4:3) | SetBitField(r->ch.dmr_sr,2:0,2:0)); TVWriteBus (dev, 0x80|0x01, SetBitFlag(r->ch.flags,CH_FLAG_SCART,6) | SetBitField(r->ch.ffr_fc,1:0,5:4) | SetBitField(r->ch.ffr_ft,1:0,3:2) | SetBitField(r->ch.ffr_fy,1:0,1:0)); TVWriteBus (dev, 0x80|0x02, SetBit(7) /* vbid */ | SetBitFlag(r->ch.flags,CH_FLAG_CFRB,6) | SetBitFlag(r->ch.flags,CH_FLAG_CVBW,5) | SetBitField(r->ch.vbw_cbw,0:0,4:4) | SetBitField(r->ch.vbw_ysv,1:0,3:2) | SetBitField(r->ch.vbw_ycv,1:0,1:0)); TVWriteBus (dev, 0x80|0x03, SetBitField(r->ch.sav,8:8,5:5) | SetBitField(r->ch.hpr,8:8,4:4) | SetBitField(r->ch.vpr,8:8,3:3) | SetBitField(r->ch.te, 2:0,2:0)); TVWriteBus (dev, 0x80|0x04, Set8Bits(r->ch.sav)); TVWriteBus (dev, 0x80|0x05, Set8Bits(r->ch.hpr)); TVWriteBus (dev, 0x80|0x06, Set8Bits(r->ch.vpr)); TVWriteBus (dev, 0x80|0x07, Set8Bits(r->ch.blr)); TVWriteBus (dev, 0x80|0x08, SetBitField(r->ch.ce,2:0,2:0)); /* FIXME defaults 0x80 mem=2, ibi=0, pllcpi=0 */ /* observed 0xE0 mem=3, ibi=1, pllcpi=0 */ TVWriteBus (dev, 0x80|0x09, 0xe0 /* mem=2, ibi=0, pllcpi=0 */ | SetBitField(r->ch.pll_n,9:8,4:3) | SetBitField(r->ch.pll_m,8:8,2:2) | SetBitField(r->ch.pllcap,0:0,0:0)); TVWriteBus (dev, 0x80|0x0a, Set8Bits(r->ch.pll_m)); TVWriteBus (dev, 0x80|0x0b, Set8Bits(r->ch.pll_n)); TVWriteBus (dev, 0x80|0x0c, SetBitField(r->ch.fsci,31:24,7:0)); TVWriteBus (dev, 0x80|0x0d, SetBitField(r->ch.fsci,23:16,7:0)); TVWriteBus (dev, 0x80|0x0e, SetBitField(r->ch.fsci,15: 8,7:0)); TVWriteBus (dev, 0x80|0x0f, SetBitField(r->ch.fsci, 7: 0,7:0)); TVWriteBus (dev, 0x80|0x10, 0x00 /* civc_paln = 0 */ | SetBitField(r->ch.civh,1:0,3:2) | SetBitFlag(r->ch.flags,CH_FLAG_ACIV,0)); /* 0x11-0x13 civ -- read only */ /* 0x14-0x1b resverd */ TVWriteBus (dev, 0x80|0x1c, 0x08 /* FIXME m/s etc. hwconfig */ ); /* reserved register ... 0xc0 ?? */ TVWriteBus (dev, 0x80|0x1d, 0xc0 | 0x08 /* xcmd=8 */ ); /* FIXME 0x1e hwconfig */ /* FIXME 0x1f port */ /* 0x20 reserved */ TVWriteBus (dev, 0x80|0x21, 0x00 /* FIXME dacg1 from input format */ | SetBitField(r->ch.dacg,0:0,1:1)); /* 0x23-0x30 reserved */ /* 0x31-0x37 dvi -- not used */ /* 0x38-0x47 reserved */ /* 0x48 test pattern */ /* FIXME 0x49 power management */ /* 0x4a-0x4b version */ /* 0x4c-0x4f reserved */ TVWriteBus (dev, 0x80|0x15, 0x00); /* MV off, APS0 */ #ifdef FAKE_I2C FPRINTF ("]\n"); #endif } void TVCh2GetRegs (TVEncoderObj *this, TVEncoderRegs *r) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte regs[0x50]; int i; RAISE (MSG_ERROR, "TVCh2GetRegs: CH7009 family not yet supported."); return; for (i = 0x00; i < 0x50; i++) TVReadBus (dev, 0x80|i, ®s[i]); r->ch.dmr_ir = SetBitField(regs[0x00],7:5,2:0); r->ch.dmr_vs = SetBitField(regs[0x00],4:3,1:0); r->ch.dmr_sr = SetBitField(regs[0x00],2:0,2:0); r->ch.ffr_fc = SetBitField(regs[0x01],5:4,1:0); r->ch.ffr_ft = SetBitField(regs[0x01],3:2,1:0); r->ch.ffr_fy = SetBitField(regs[0x01],1:0,1:0); r->ch.vbw_flff = 0; r->ch.vbw_cbw = SetBitField(regs[0x02],5:4,1:0); r->ch.vbw_ypeak = 0; r->ch.vbw_ysv = SetBitField(regs[0x02],3:2,1:0); r->ch.vbw_ycv = SetBitField(regs[0x02],1:0,1:0); r->ch.te = SetBitField(regs[0x03],2:0,2:0); r->ch.sav = Set8Bits(regs[0x04]) | SetBitField(regs[0x03],5:5,8:8); r->ch.hpr = Set8Bits(regs[0x05]) | SetBitField(regs[0x03],4:4,8:8); r->ch.vpr = Set8Bits(regs[0x06]) | SetBitField(regs[0x03],3:3,8:8); r->ch.blr = Set8Bits(regs[0x07]); r->ch.ce = SetBitField(regs[0x08],2:0,2:0); r->ch.pllcap = SetBitField(regs[0x09],0:0,0:0); r->ch.pll_m = Set8Bits(regs[0x0a]) | SetBitField(regs[0x09],2:2,8:8); r->ch.pll_n = Set8Bits(regs[0x0b]) | SetBitField(regs[0x09],4:3,9:8); r->ch.fsci = SetBitField(regs[0x0c],7:0,31:24) | SetBitField(regs[0x0d],7:0,23:16) | SetBitField(regs[0x0e],7:0,15: 8) | SetBitField(regs[0x0f],7:0, 7: 0); r->ch.civh = SetBitField(regs[0x10],3:2,1:0); r->ch.dacg = SetBitField(regs[0x21],1:1,0:0); r->ch.flags = CH_FLAG_BOTH | GetBitFlag(regs[0x01],6,CH_FLAG_SCART) | GetBitFlag(regs[0x02],6,CH_FLAG_CFRB) | GetBitFlag(regs[0x02],5,CH_FLAG_CVBW) | GetBitFlag(regs[0x10],0,CH_FLAG_ACIV); /* FIXME CH_FLAG_POUTP */ r->ch.macro = 0; r->ch.mode = 0; } void TVCh2SetState (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { RAISE (MSG_ERROR, "TVCh2SetState: CH7009 family not yet supported."); return; /* FIXME 0x21 dac control, 0x48 test pattern, 0x49 power management */ } TVConnect TVCh2GetConnect (TVEncoderObj *this) { RAISE (MSG_ERROR, "TVCh2GetConnect: CH7009 family not yet supported."); return CONNECT_NONE; } long TVCh2GetStatus (TVEncoderObj *this, int index) { RAISE (MSG_ERROR, "TVCh2GetStatus: CH7009 family not yet supported."); return 0; } /* 2004-02-29 Version ID table */ /* Collected from Chrontel datasheets */ /* Note: all chips have the same did (0x17). */ /* vid chip(s) */ /* 0x03 7012 */ /* 0x82 7301A */ /* 0x83 7009A, 7010A, 7010B, 7011 (this may be a copy and paste */ /* mistake...) */ /* 0x84 ? not found in publicly available Chrontel datasheets */ /* 0x85 7009B */ /* 0x95 7301C */ /* ?? 7303 Chrontel has changed it's policy. */ /* ?? 7304 You must now be a licensed partner to */ /* ?? 7305 access the complete datasheets for these chips. */ /* The newer chips (7015, 7017, 7019, 7205) also requires */ /* licensed partnership to get the full documentation. */ char *TVDetectChrontel2 (I2CDevPtr dev, TVChip *encoder) { I2CByte result; char *chip; static char version [50]; #ifdef FAKE_PROBE_CHRONTEL *encoder = TV_CHRONTEL_MODEL2; snprintf (version, 50, "Chrontel-2 Fake (%1s:%02X)", I2C_ID(dev)); return version; #else #ifdef FAKE_I2C return NULL; #endif #endif tvBusOk = TRUE; TVReadBus (dev, 0x80|0x4a, &result); RAISE (MSG_DEBUG, "ch version %02x (%s)", result, tvBusOk ? "ok" : "err"); if (!tvBusOk) return NULL; *encoder = TV_CHRONTEL_MODEL2; switch (result) { case 0x83: chip = "7009A"; break; /* 7009A vid=0x83 did=0x17 */ case 0x84: chip = "7011A"; break; /* 7011A vid=0x84 did=0x17 */ // case 0x84: chip = "7009A-T"; break; /* verified for a chip marked "7009A-T" */ case 0x85: chip = "7009B"; break; /* not verified */ case 0x03: chip = "7012"; break; /* not verified */ case 0x82: chip = "7301A"; break; /* not verified */ case 0x95: chip = "7301C"; break; /* not verified */ default: chip = NULL; break; } if (chip) { snprintf (version, 50, "Chrontel %s (%1s:%02X)", chip, I2C_ID(dev)); } else { snprintf (version, 50, "Chrontel-2 (id = %02X) (%1s:%02X)", result, I2C_ID(dev)); } return version; } /* Clock range is a safe guess based on available 7009 modes */ /* FIXME */ TVEncoderObj tvCh2Template = { type: TV_CHRONTEL_MODEL2, ctrl: NULL, minClock: 20000, maxClock: 80000, Create: TVCh2Create, InitRegs: TVCh2InitRegs, SetRegs: TVCh2SetRegs, GetRegs: TVCh2GetRegs, SetPort: TVCh2SetPort, GetPort: TVCh2GetPort, SetState: TVCh2SetState, GetConnect: TVCh2GetConnect, GetStatus: TVCh2GetStatus }; /* ---------------------------------------- */ /* APS0: 15 APS1-3: 15 18 19/1f 1a 1b 28 29 2a/0f 2b/3f 2c 2d 2e/3f 2f/3f 40 41 42/7f 43 44/7f 45 Mode: 16/7f 17 38/7f 39/0f 3a 3b 3c/7f 3d/7f 3e 3f APS_Mode 24/07 25 26 27 ch9_APS0: 00000004 0000: 15 00 ff ff ch9_NTSC_APS1: 0000003A 15 5b ff 18 0b ff 19 06 1f 1a 05 ff 1b 0d ff 28 00 ff 29 0d ff 2a 00 0f 2b 00 3f 2c 00 ff 2d 00 ff 2e 15 3f 2f 15 3f 40 0f ff 41 0f ff 42 0f 7f 43 f0 ff 44 00 7f 45 00 ff ff ch9_NTSC_APS2: 0000003A 15 5f ff 18 0b ff 19 06 1f 1a 05 ff 1b 0d ff 28 ff ff 29 47 ff 2a 0d 0f 2b 11 3f 2c 9e ff 2d 2d ff 2e 11 3f 2f 11 3f 40 0f ff 41 0f ff 42 0f 7f 43 f0 ff 44 00 7f 45 00 ff ff ch9_NTSC_APS3: 0000003A 15 5f ff 18 0b ff 19 06 1f 1a 05 ff 1b 0d ff 28 ff ff 29 87 ff 2a 0b 0f 2b 15 3f 2c 98 ff 2d 29 ff 2e 15 3f 2f 15 3f 40 0f ff 41 0f ff 42 0f 7f 43 f0 ff 44 00 7f 45 00 ff ff ch9_NTSC_Mode11: 0000001F 16 25 7f 17 3b ff 38 5a 7f 39 0f 0f 3a 05 ff 3b 05 ff 3c 41 7f 3d 41 7f 3e 05 ff 3f 05 ff ff ch9_NTSC_Mode11_APS1: 00000001 ff ch9_NTSC_Mode11_APS2and3: 0000000D 24 00 07 25 b4 ff 26 b4 ff 27 df ff ff ch9_NTSC_Mode17: 0000001F 16 25 7f 17 38 ff 38 56 7f 39 00 0f 3a fa ff 3b fa ff 3c 3e 7f 3d 3e 7f 3e fa ff 3f fa ff ff ch9_NTSC_Mode17_APS2and3: 0000000D 24 00 07 25 ad ff 26 ad ff 27 d6 ff ff ch9_NTSC_Mode29: 0000001F 16 25 7f 17 48 ff 38 6d 7f 39 0f 0f 3a 3e ff 3b 3e ff 3c 4f 7f 3d 4f 7f 3e 3e ff 3f 3e ff ff ch9_NTSC_Mode29_APS2and3: 0000000D 24 01 07 25 dd ff 26 dd ff 27 11 ff ff ch9_NTSC_Mode35: 0000001F 16 25 7f 17 42 ff 38 64 7f 39 0f 0f 3a 23 ff 3b 23 ff 3c 48 7f 3d 48 7f 3e 23 ff 3f 23 ff ff ch9_NTSC_Mode35_APS2and3: 0000000D 24 00 07 25 c9 ff 26 c9 ff 27 f9 ff ff ch9_PAL_APS1: 0000003A 15 1b ff 18 6c ff 19 03 1f 1a 33 ff 1b 38 ff 28 00 ff 29 40 ff 2a 08 0f 2b 22 3f 2c 9b ff 2d 64 ff 2e 22 3f 2f 22 3f 40 fe ff 41 7e ff 42 3f 7f 43 e0 ff 44 15 7f 45 40 ff ff ch9_PAL_Mode8: 0000002B 16 25 7f 17 38 ff 24 00 07 25 bd ff 26 bd ff 27 dd ff 38 4d 7f 39 0c 0f 3a 3c ff 3b 1b ff 3c 2d 7f 3d 31 7f 3e 95 ff 3f b7 ff ff ch9_PAL_Mode14: 0000002B 16 25 7f 17 3b ff 24 00 07 25 c7 ff 26 c7 ff 27 e9 ff 38 51 7f 39 0c 0f 3a 4c ff 3b 29 ff 3c 30 7f 3d 34 7f 3e 9d ff 3f c0 ff ff ch9_PAL_Mode26: 0000002B 16 25 7f 17 48 ff 24 01 07 25 f2 ff 26 f2 ff 27 1c ff 38 63 7f 39 0c 0f 3a 94 ff 3b 6a ff 3c 3a 7f 3d 3f 7f 3e bf ff 3f ea ff ff ch9_PAL_Mode32: 0000002B 16 25 7f 17 46 ff 24 01 07 25 ed ff 26 ed ff 27 15 ff 38 60 7f 39 0c 0f 3a 89 ff 3b 60 ff 3c 38 7f 3d 3e 7f 3e ba ff 3f e3 ff ff */ /* Registers 00-7:5 dm_ir ch1.dmr_ir 00-4:3 dm_vs ch1.dmr_vs 00-2:0 dm_sr ch1.dmr_sr 01-6 ff_vof CH_FLAG_SCART ?? RGB output, 01-5:4 ff_cff ch1.fft_fc (different setup) 01-3:2 ff_yfft ch1.ffr_ft (different setup) 01-1:0 ff_yffnt ch1.ffr_fy (different setup) 02-7 vbw_vbid ## vertical blanking interval (ff) defeat 02-6 vbw_cfrb CH_FLAG_CFRB 02-5 vbw_cvbwb CH_FLAG_CVBW 02-4 vbw_cbw ch1.vbw_cbw 02-3:2 vbw_ysv ch1.vbw_ysv 02-1:0 vbw_ycv ch1.vbw_ycv 03-5 sav/8 ch1.sav 03-4 hp/8 ch1.hpr 03-3 vp/8 ch1.vpr 03-2:0 te ch1.te (should be ch2.te) 04 sav ch1.sav 05 hp ch1.hpr 06 vp ch1.vpr 07 bl ch1.blr 08-2:0 ce ch1.ce 09-7:6 mem @@ keep 09-5 ibi @@ keep 09-4:3 pll_n/8 ch1.pll_n 09-2 pll_m/8 ch1.pll_m 09-1 pllcpi @@ keep 09-0 pllcap ch1.pllcap (->FLAG ?) 0a pllm ch1.pll_m 0b plln ch1.pll_n 0c-0f fsci ch1.fsci 10-0 civen CH_FLAG_ACIV 10-3:2 civc ch1.civh @@ keep 10-... 1d-3:0 xcmd ## ch2.xcmd delay 1e-0 poutp CH_FLAG_POUTP 1e-... 1f idf @@ init 1f-7 ibs 0 @@ input buffer select 1f-6 des 0 @@ decode embedded sync 1f-5 syo 0 @@ sync direction, 0=in, 1=out 1f-4 vsp 0 @@ vertical sync polarity, 0=active low 1f-3 hsp 0 @@ horizontal sync polarity, 0=active low 1f-2:0 idf 0 @@ input data format 21-1 dacg0 ch1.dacg dac gain/format 49-3:0 dacpd CH_FLAG_DAC_PD[0-3] (additional modes?) civc = civh Additional: tstp/2 0x48 test pattern */ /* Naming scheme: ch for all chrontel ch_a for 7007 family ch_b for 7009 family cx cx_a for bt family cx_b for cx family ph ph_a ph_b numbering in TVChip: conexant bt868 2101 conexant bt869 2102 conexant cx25870 2201 conexant cx25871 2202 conexant cx25872 2203 conexant cx25873 2204 conexant cx25874 2205 conexant cx25875 2206 chrontel ch7003 1103 chrontel ch7004 1104 chrontel ch7005 1105 chrontel ch7006 1106 chrontel ch7007 1107 chrontel ch7008 1108 chrontel ch7009 1201 chrontel ch7010 1202 chrontel ch7011 1203 philips saa7102/08 3102 philips saa7103/09 3103 philips saa7104/08A 3201 philips saa7105/09A 3202 philips: status: iferr. bferr state: dclk, eidiv (but always set?) pcle, pcli, pclsy, ifra, ifbp, fili, cvbsen2, yfil, xint, yupsc, extra filter setting??? (rename adaptive to extra filter) can do upscaling modes, 640 huge, 1024 ..., 1280 ... */ nvtv-0.4.7/src/tv_ph1_saa7102.c0000644000175000001440000006242510005515126011472 /* NVTV Philips TV-I2C access -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_ph1_saa7102.c,v 1.6 2004/01/27 17:05:26 dthierbach Exp $ * * Contents: * * Routines to access the Philips Model1 (SAA7102 etc.) encoder chip * registers via the I2C bus. * */ #include "local.h" /* before everything else */ #include "bitmask.h" #include "tv_chip.h" #include "tv_i2c.h" #include "tv_ph1_saa7102.h" /* -------- Philips Model1 -------- */ typedef struct { int blckl_diff; /* not sure if it is really a difference, but we have */ int blnnl_diff; /* to modify these levels somehow */ int reg01; /* mask c0 */ int reg03; /* mask c0 */ int reg04; /* mask c0 */ int reg05; /* mask 00 */ int reg06; /* mask 00 */ int reg07; /* mask 00 */ int reg08; /* mask fc */ int reg10; /* mask c0 */ int reg11; /* mask 00 */ int reg12; /* mask 00 */ int reg14; /* mask 00 */ int reg15; /* mask 80 */ int reg20; /* mask 40 ! */ int reg21; /* mask 00 */ int reg24; /* mask 00 */ int reg25; /* mask 80 */ int reg30; /* mask c0 */ int reg31; /* mask f8 */ int reg33; /* mask 00 */ int reg36; /* mask 00 */ int reg60; /* mask 80 */ int reg7d; /* mask 16 ! */ } TVPhMacro; TVPhMacro tvPhNtscMacro0 = { blckl_diff:0, blnnl_diff:0, reg7d:0x00 }; TVPhMacro tvPhNtscMacro1 = { blckl_diff: 31, /* 0x1b <- 0x3a */ blnnl_diff: 32, /* 0x0e <- 0x2e */ reg60:0x40, reg7d:0xc8, reg01:0x1e, reg03:0x11, reg04:0x26, reg05:0x0a, reg06:0xc5, reg07:0xff, reg08:0x03, reg10:0x11, reg11:0xad, reg12:0x60, reg14:0x0f, reg15:0x78, reg20:0x9b, reg21:0x04, reg24:0x00, reg25:0x00, reg30:0x1b, reg31:0x04, reg33:0x0f, reg36:0x0f }; TVPhMacro tvPhNtscMacro2 = { blckl_diff: 31, /* 0x1b <- 0x3a */ blnnl_diff: 32, /* 0x0e <- 0x2e */ reg60:0x40, reg7d:0xe8, reg01:0x1e, reg03:0x11, reg04:0x26, reg05:0x0a, reg06:0xc5, reg07:0xff, reg08:0x03, reg10:0x11, reg11:0xad, reg12:0x60, reg14:0x0f, reg15:0x78, reg20:0x9b, reg21:0x04, reg24:0x00, reg25:0x00, reg30:0x1b, reg31:0x04, reg33:0x0f, reg36:0x0f }; TVPhMacro tvPhNtscMacro3 = { blckl_diff: 31, /* 0x1b <- 0x3a */ blnnl_diff: 32, /* 0x0e <- 0x2e */ reg60:0x40, reg7d:0xe8, reg01:0x18, reg03:0x15, reg04:0x22, reg05:0x0a, reg06:0xc5, reg07:0xff, reg08:0x03, reg10:0x15, reg11:0xad, reg12:0x60, reg14:0x0f, reg15:0x78, reg20:0x9b, reg21:0x04, reg24:0x00, reg25:0x00, reg30:0x1b, reg31:0x04, reg33:0x0f, reg36:0x0f }; /* PAL diff: blckl: -0x1C blnnl: -0x1C */ TVPhMacro tvPhPalMacro0 = { blckl_diff:0, blnnl_diff:0, reg7d:0x00 }; TVPhMacro tvPhPalMacro1= { blckl_diff: 28, /* 0x17 <- 0x33 */ blnnl_diff: 28, /* 0x19 <- 0x35 */ reg60:0x40, reg7d:0xc8, reg01:0x1b, reg03:0x22, reg04:0x2b, reg05:0x08, reg06:0x74, reg07:0x55, reg08:0x01, reg10:0x22, reg11:0x15, reg12:0x60, reg14:0x07, reg15:0x7e, reg20:0xbb, reg21:0x72, reg24:0x02, reg25:0x54, reg30:0x2c, reg31:0x04, reg33:0xfe, reg36:0x7e }; TVPhMacro *TVMacroPhRegs (TVEncoderRegs *r) { RAISE (MSG_DEBUG, "tv macro ph %i", r->ph1.macro); switch (r->ph1.macro) { case 0: /* NTSC APS 0 */ return &tvPhNtscMacro0; break; case 1: /* NTSC APS 1 */ return &tvPhNtscMacro1; break; case 2: /* NTSC APS 2 */ return &tvPhNtscMacro2; break; case 3: /* NTSC APS 3 */ return &tvPhNtscMacro3; break; case 4: /* PAL APS 0 */ return &tvPhPalMacro0; break; case 5: /* PAL APS 1 */ case 6: case 7: return &tvPhPalMacro1; break; } return NULL; } void TVPhCreate (TVEncoderObj *this, TVChip chip_type, void *ctrl) { RAISE (MSG_DEBUG, "ph create"); this->type = chip_type; this->ctrl = ctrl; this->hwconfig = 0; /* No hardware config for PH */ this->hwstate = 0; /* pcbn=0, slave=0 */ } /* Registers: ---- 0x16: Common DAC adjust fine - set gain to 0 0x17: Red DAC adjust fine - default 0x18: Green DAC adjust fine - default 0x19: Blue DAC adjust fine - default (max) 0x1a: Monitor sense mode - recommended setting 0x1b: Monitor sense mode off 0x21: Undocumented register in SAA7108E 0x26: Widescreen signal 0x27: Widescreen signal 0x28: Realtime control, burst start 0x29: Sync reset enable, burst end 0x2a: copy gen 0 0x2b: copy gen 1 0x2c: copy gen 2, Copy gen enable (off) 0x2d: Output port control - default connector 0x38: Gain luminance for RGB 0x39: Gain color difference for RGB 0x3a: Input control 1 - 0 0x54: Input cont. 2 (VPS enable) - edge1: falling, edge2: rising 0x6c: Horiz. trigger 0x6d: Horiz. trigger 0x6e: Multi control 0x6f: Closed caption, teletext - ttxen=0 ccen=01 sccln=2 0x75: Composite sync advance - 22h 96-7 efs = 0 FSVGC (FIELD) ignored 96-6 pcbn = 0 NCBO (BLANK) polarity 96-5 slave = 0 97-7 hfs = 0 no hsync from FSVGC (FIELD) 97-6 vfs = 0 no vsync from FSVGC (FIELD) 97-5 ofs = 1 97-4 pfs = 0 fsync polarity (0:high, 1:low) 97-3 ovs = 1 vsync direction (0:in, 1:out) 97-2 pvs = 1 vsync polarity (0:high, 1:low) (why 1 ???) 97-1 ohs = 1 hsync direction (0:in, 1:out) 97-0 phs = 0 hsync polarity (0:high, 1:low) Note: sync polarity varies wildly in different modes. 0xa2: Border color Y 0xa3: Border color U 0xa4: Border color V 0xfc: Vertical hot spot fd-7 lutoff = 1 (bypass LUT) fd-6 cmode = 0 (cursor mode: invert) fd-5 lutl = 0 (LUT loading via input inactive) fd-4:2 if = 110 = 6 (R8G8B8 4:4:4 non-interlaced, special ordering) fd-1 matoff = 0 (RGB -> CrYCb active) fd-0 dfoff = 0 (4:4:4 -> 4:4:2 active) */ void TVPhSetPort (TVEncoderObj *this, int port) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; RAISE (MSG_DEBUG, "ph port %08X", port); if ((port & PORT_FORMAT_MASK) != PORT_FORMAT_RGB) { RAISE (MSG_ABORT, "TVPh1SetPort: Only RGB multiplex format supported."); } if ((port & PORT_PCLK_MODE) != PORT_PCLK_MASTER) { RAISE (MSG_ABORT, "TVPh1SetPort: Only clock master mode supported."); } if ((port & PORT_BLANK_DIR) != PORT_BLANK_OUT) { RAISE (MSG_ABORT, "TVPh1SetPort: Only output blank supported."); } this->hwstate = ((port & PORT_BLANK_POLARITY) ? SetBit(6) : 0) | ((port & PORT_SYNC_DIR) ? SetBit(5) : 0); TVWriteBus (dev, 0x96, SetBitField(this->hwstate,6:5,6:5)); /* FIXME Test sync polarity - this varies wildly in the observed modes. */ TVWriteBus (dev, 0x97, 0x20 /* ofs=1, hfs=vfs=0 */ | ((port & PORT_SYNC_DIR) ? 0 : SetBit(1) | SetBit(3)) | ((port & PORT_VSYNC_POLARITY) ? 0 : SetBit(2)) | ((port & PORT_HSYNC_POLARITY) ? 0 : SetBit(0))); } void TVPh1SetPort (TVEncoderObj *this, int port) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; TVPhSetPort (this, port); if ((port & PORT_PCLK_POLARITY) == PORT_PCLK_HIGH) { TVWriteBus (dev, 0x54, 0x01); /* edge1: falling, edge2: rising */ } else { TVWriteBus (dev, 0x54, 0x02); /* edge1: raising, edge2: falling */ } } void TVPhGetPort (TVEncoderObj *this, int *port) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte res; RAISE (MSG_DEBUG, "ph get port"); *port = PORT_FORMAT_RGB | PORT_PCLK_MASTER | PORT_PCLK_HIGH | PORT_BLANK_OUT; TVReadBus (dev, 0x96, &res); *port |= (GetBit(res,6) ? PORT_BLANK_HIGH : PORT_BLANK_LOW) | (GetBit(res,5) ? PORT_SYNC_SLAVE : PORT_SYNC_MASTER); TVReadBus (dev, 0x97, &res); *port |= ((GetBit(res,1)|GetBit(res,3)) ? PORT_SYNC_OUT : PORT_SYNC_IN) | (GetBit(res,2) ? PORT_VSYNC_LOW : PORT_VSYNC_HIGH) | (GetBit(res,0) ? PORT_HSYNC_LOW : PORT_HSYNC_HIGH); } void TVPh1GetPort (TVEncoderObj *this, int *port) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte res; RAISE (MSG_DEBUG, "ph1 get port"); TVPhGetPort (this, port); TVReadBus (dev, 0x54, &res); *port |= ((res & 0x3) == 0x02 ? PORT_PCLK_LOW : PORT_PCLK_HIGH); } void TVPhInitRegs (TVEncoderObj *this) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; int i; RAISE (MSG_DEBUG, "ph init %04X", this->type); for (i = 0x01; i <= 0x16; i++) { TVWriteBus (dev, i, 0x00); /* NV: 0x01 - 0x16 */ } TVWriteBus (dev, 0x17, 0x1b); /* NV */ TVWriteBus (dev, 0x18, 0x1b); /* NV */ TVWriteBus (dev, 0x19, 0x1f); /* NV */ TVWriteBus (dev, 0x1a, 0x46); /* NV */ TVWriteBus (dev, 0x1b, 0x00); /* NV - monitor sense mode off */ TVWriteBus (dev, 0x21, 0x1b); /* NV does it */ TVWriteBus (dev, 0x26, 0xff); /* NV */ TVWriteBus (dev, 0x27, 0x3f); /* NV */ TVWriteBus (dev, 0x28, 0x19); /* NV */ TVWriteBus (dev, 0x29, 0x1d); /* NV */ TVWriteBus (dev, 0x2a, 0xff); /* NV - copy gen */ TVWriteBus (dev, 0x2b, 0xff); /* NV - copy gen */ TVWriteBus (dev, 0x2c, 0x0f); /* NV - copy gen off */ TVWriteBus (dev, 0x2d, 0xb4); /* NV - default connector */ for (i = 0x2e; i <= 0x36; i++) { TVWriteBus (dev, i, 0x00); /* NV: 0x2e - 0x36*/ } TVWriteBus (dev, 0x38, 0x1a); /* NV */ TVWriteBus (dev, 0x39, 0x1a); /* NV */ TVWriteBus (dev, 0x3a, 0x00); /* NV */ TVWriteBus (dev, 0x55, 0x0f); /* NV */ TVWriteBus (dev, 0x56, 0xc3); /* NV */ TVWriteBus (dev, 0x57, 0x00); /* NV */ TVWriteBus (dev, 0x58, 0x02); /* NV */ TVWriteBus (dev, 0x59, 0x30); /* NV */ TVWriteBus (dev, 0x6c, 0x01); /* NV */ TVWriteBus (dev, 0x6d, 0x20); /* NV */ TVWriteBus (dev, 0x6f, 0x42); /* NV ttxen=0 ccen=01 sccln=2 */ TVWriteBus (dev, 0x75, 0xb0); /* NV - csynca */ TVWriteBus (dev, 0xa2, 0x10); /* NV */ TVWriteBus (dev, 0xa3, 0x80); /* NV */ TVWriteBus (dev, 0xa4, 0x80); /* NV */ TVWriteBus (dev, 0xfc, 0x03); /* NV */ TVWriteBus (dev, 0xfd, 0x98); /* NV */ } void TVPh1InitRegs (TVEncoderObj *this, int port) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; RAISE (MSG_DEBUG, "ph1 init %04X", this->type); TVPh1SetPort (this, port); TVPhInitRegs (this); TVWriteBus (dev, 0x37, 0x00); /* NV */ TVWriteBus (dev, 0x54, 0x01); /* NV - edge1: falling, edge2: rising */ } /* Registers: ---- 0x28: Starting point of burst in clock cycles 0x29: Sync reset enable, burst end 0x2d: Output port control 0x38: Gain luminance for RGB 0x39: Gain color difference for RGB 0x5a: Chrominance phase 0x5b: Gain U 0x5c: Gain V 0x5d: Gain U MSB, black level 0x5e: Gain V MSB, blanking level 0x5f: Blanking level, CCR 0x61: Standard control 0x62: Burst amplitude 0x63: Subcarrier 0 0x64: Subcarrier 1 0x65: Subcarrier 2 0x66: Subcarrier 3 0x6E: Multi Control (Field length FLC, Carrier reset PHRES, ...) 0x70: Active display window horizontal start 0x71: Active display window horizontal end 0x72: Active display window horizontal values MSB 0x7a: First active line 0x7b: Last active line 0x7c: MSBs for fal and lal, teletext mode 0x81: Pixel clock 0 0x82: Pixel clock 1 0x83: Pixel clock 2 0x90: Horizontal offset 0x91: Horizontal pixel count 0x92: Vertical offset (odd) 0x93: Vertical offset (even) 0x94: MSBs for pcl, pixel number and vertical offsets 0x95: Line number (vertical pixel count) 0x96: MSB for line number, Scaler control 0x98: Line length 0x99: Line lenth MSB, Input delay 0x9a: Horizontal increment 0x9b: Vertical increment 0x9c: MSBs for horizontal and vertical increments 0x9d: Weighting factor (odd) 0x9e: Weighting factor (even) 0x9f: Weighting factor MSBs 0xa0: Vertical line skip 0xa1: Vertical line MSB, blank enable 0xa2: Border color luminance 0xa3: Border color chrominance red 0xa4: Border color chrominance blue */ void TVPh1SetRegs (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; TVPhMacro *m; int blckl, blnnl; RAISE (MSG_DEBUG, "nv set ph %04X", this->type); m = TVMacroPhRegs (r); blckl = r->ph1.blckl; blnnl = r->ph1.blnnl; if (m) { blckl -= m->blckl_diff; blnnl -= m->blnnl_diff; if (blckl < 0) blckl = 0; if (blnnl < 0) blnnl = 0; } TVWriteBus (dev, 0x28, SetBitField(r->ph1.bs,5:0,5:0)); TVWriteBus (dev, 0x29, SetBitField(r->ph1.be,5:0,5:0) | 0x00 /* sres=0 ttx pin */ ); TVWriteBus (dev, 0x2d, (r->ph1.flags2 * PH_FLAG2_MASK) | 0x04 /* clk2en=1, encoff=0 */ ); TVWriteBus (dev, 0x38, SetBitField(r->ph1.gy,4:0,4:0)); TVWriteBus (dev, 0x39, SetBitField(r->ph1.gcd,4:0,4:0)); TVWriteBus (dev, 0x5a, Set8Bits(r->ph1.chps)); TVWriteBus (dev, 0x5b, Set8Bits(r->ph1.gainu)); TVWriteBus (dev, 0x5c, Set8Bits(r->ph1.gainv)); TVWriteBus (dev, 0x5d, SetBitField(blckl,5:0,5:0) | SetBitField(r->ph1.gainu,8:8,7:7)); TVWriteBus (dev, 0x5e, SetBitField(blnnl,5:0,5:0) | SetBitField(r->ph1.gainv,8:8,7:7)); TVWriteBus (dev, 0x5f, SetBitField(r->ph1.blnnl,5:0,5:0) /* blnvb */ | SetBitField(r->ph1.ccrs,1:0,7:6)); TVWriteBus (dev, 0x61, Set8Bits(r->ph1.flags1 & PH_FLAG1_MASK)); /* FIXME: State for DOWN flags !! Always up at the moment */ /* #define PH_FLAG1_DOWNA (1 << 6) #define PH_FLAG1_DOWND (1 << 7) */ TVWriteBus (dev, 0x62, SetBitField(r->ph1.bsta,6:0,6:0)); TVWriteBus (dev, 0x63, SetBitField(r->ph1.fsc,7:0,7:0)); TVWriteBus (dev, 0x64, SetBitField(r->ph1.fsc,15:8,7:0)); TVWriteBus (dev, 0x65, SetBitField(r->ph1.fsc,23:16,7:0)); TVWriteBus (dev, 0x66, SetBitField(r->ph1.fsc,31:24,7:0)); TVWriteBus (dev, 0x6e, SetBitField(r->ph1.phres,1:0,5:4) | SetBitField(r->ph1.flc,1:0,1:0) | 0x00 /* blckon, ldel are zero */ ); TVWriteBus (dev, 0x70, Set8Bits(r->ph1.adwhs)); TVWriteBus (dev, 0x71, Set8Bits(r->ph1.adwhe)); TVWriteBus (dev, 0x72, SetBitField(r->ph1.adwhs,10:8,2:0) | SetBitField(r->ph1.adwhe,10:8,6:4)); TVWriteBus (dev, 0x7a, Set8Bits(r->ph1.fal)); TVWriteBus (dev, 0x7b, Set8Bits(r->ph1.lal)); TVWriteBus (dev, 0x7c, SetBitField(r->ph1.fal,8:8,4:4) | SetBitField(r->ph1.lal,8:8,6:6) | 0x00 /* TTX */ ); TVWriteBus (dev, 0x81, SetBitField(r->ph1.pcl,7:0,7:0)); TVWriteBus (dev, 0x82, SetBitField(r->ph1.pcl,15:8,7:0)); TVWriteBus (dev, 0x83, SetBitField(r->ph1.pcl,23:16,7:0)); TVWriteBus (dev, 0x90, Set8Bits(r->ph1.xofs)); TVWriteBus (dev, 0x91, Set8Bits(r->ph1.xpix)); TVWriteBus (dev, 0x92, Set8Bits(r->ph1.yofso)); TVWriteBus (dev, 0x93, Set8Bits(r->ph1.yofse)); TVWriteBus (dev, 0x94, SetBitField(r->ph1.yofse,9:8,7:6) | SetBitField(r->ph1.yofso,9:8,5:4) | SetBitField(r->ph1.xpix,9:8,3:2) | SetBitField(r->ph1.xofs,9:8,1:0)); TVWriteBus (dev, 0x95, Set8Bits(r->ph1.ypix)); TVWriteBus (dev, 0x96, SetBitField(r->ph1.ypix,9:8,1:0) | SetBitFlag(r->ph1.flags1,PH_FLAG1_YFIL,3) | SetBitField(this->hwstate,6:5,6:5) | 0x00 /* rest all zero */ ); TVWriteBus (dev, 0x98, Set8Bits(r->ph1.hlen)); /* hlen extra bit for SAA7104, 0 in SAA7102 */ TVWriteBus (dev, 0x99, SetBitField(r->ph1.hlen,11:8,3:0) | SetBitField(r->ph1.idel,3:0,7:4)); TVWriteBus (dev, 0x9a, Set8Bits(r->ph1.xinc)); TVWriteBus (dev, 0x9b, Set8Bits(r->ph1.yinc)); TVWriteBus (dev, 0x9c, SetBitField(r->ph1.xinc,11:8,3:0) | SetBitField(r->ph1.yinc,11:8,7:4)); TVWriteBus (dev, 0x9d, Set8Bits(r->ph1.yiwgto)); TVWriteBus (dev, 0x9e, Set8Bits(r->ph1.yiwgte)); TVWriteBus (dev, 0x9f, SetBitField(r->ph1.yiwgto,11:8,3:0) | SetBitField(r->ph1.yiwgte,11:8,7:4)); TVWriteBus (dev, 0xa0, Set8Bits(r->ph1.yskip)); TVWriteBus (dev, 0xa1, SetBitField(r->ph1.yskip,11:8,3:0) | 0x00 /* blen=0 */ ); TVWriteBus (dev, 0xa2, Set8Bits(r->ph1.bcy)); TVWriteBus (dev, 0xa3, Set8Bits(r->ph1.bcu)); TVWriteBus (dev, 0xa4, Set8Bits(r->ph1.bcv)); if (m) { TVWriteBus (dev, 0x60, SetBitField(m->reg60,7:0,7:0)); TVWriteBus (dev, 0x7d, Set8Bits(m->reg7d & ~0x16)); TVWriteBus (dev, 0x01, SetBitField(m->reg01,5:0,5:0)); TVWriteBus (dev, 0x03, SetBitField(m->reg03,5:0,5:0)); TVWriteBus (dev, 0x04, SetBitField(m->reg04,5:0,5:0)); TVWriteBus (dev, 0x05, SetBitField(m->reg05,7:0,7:0)); TVWriteBus (dev, 0x06, SetBitField(m->reg06,7:0,7:0)); TVWriteBus (dev, 0x07, SetBitField(m->reg07,7:0,7:0)); TVWriteBus (dev, 0x08, SetBitField(m->reg08,1:0,1:0)); TVWriteBus (dev, 0x10, SetBitField(m->reg10,5:0,5:0)); TVWriteBus (dev, 0x11, SetBitField(m->reg11,7:0,7:0)); TVWriteBus (dev, 0x12, SetBitField(m->reg12,7:0,7:0)); TVWriteBus (dev, 0x14, SetBitField(m->reg14,7:0,7:0)); TVWriteBus (dev, 0x15, SetBitField(m->reg15,6:0,6:0)); TVWriteBus (dev, 0x20, Set8Bits(m->reg20 & ~0x40)); TVWriteBus (dev, 0x21, SetBitField(m->reg21,7:0,7:0)); TVWriteBus (dev, 0x24, SetBitField(m->reg24,7:0,7:0)); TVWriteBus (dev, 0x25, SetBitField(m->reg25,6:0,6:0)); TVWriteBus (dev, 0x30, SetBitField(m->reg30,5:0,5:0)); TVWriteBus (dev, 0x31, SetBitField(m->reg31,3:0,3:0)); TVWriteBus (dev, 0x33, SetBitField(m->reg33,7:0,7:0)); TVWriteBus (dev, 0x36, SetBitField(m->reg36,7:0,7:0)); } } void TVPh1GetRegs (TVEncoderObj *this, TVEncoderRegs *r) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte regs[0x100]; int i; for (i = 0x00; i < 0xa4; i++) TVReadBus (dev, i, ®s[i]); r->ph1.adwhs = Set8Bits(regs[0x70]) | SetBitField(regs[0x72],2:0,10:8); r->ph1.adwhe = Set8Bits(regs[0x71]) | SetBitField(regs[0x72],6:4,10:8); r->ph1.xofs = Set8Bits(regs[0x90]) | SetBitField(regs[0x94],1:0,9:8); r->ph1.xpix = Set8Bits(regs[0x91]) | SetBitField(regs[0x94],3:2,9:8); r->ph1.xinc = Set8Bits(regs[0x9a]) | SetBitField(regs[0x9c],3:0,11:8); r->ph1.hlen = Set8Bits(regs[0x98]) | SetBitField(regs[0x99],2:0,10:8); r->ph1.fal = Set8Bits(regs[0x7a]) | SetBitField(regs[0x7c],4:4,8:8); r->ph1.lal = Set8Bits(regs[0x7b]) | SetBitField(regs[0x7c],6:6,8:8); r->ph1.yinc = Set8Bits(regs[0x9b]) | SetBitField(regs[0x9c],7:4,11:8); r->ph1.yskip = Set8Bits(regs[0xa0]) | SetBitField(regs[0xa1],3:0,11:8); r->ph1.yofso = Set8Bits(regs[0x92]) | SetBitField(regs[0x94],5:4,9:8); r->ph1.yofse = Set8Bits(regs[0x93]) | SetBitField(regs[0x94],7:6,9:8); r->ph1.ypix = Set8Bits(regs[0x95]) | SetBitField(regs[0x96],1:0,9:8); r->ph1.yiwgto = Set8Bits(regs[0x9d]) | SetBitField(regs[0x9f],3:0,11:8); r->ph1.yiwgte = Set8Bits(regs[0x9e]) | SetBitField(regs[0x9f],7:4,11:8); r->ph1.pcl = (unsigned long) Set8Bits(regs[0x81]) | (unsigned long) Set8Bits(regs[0x82]) << 8 | (unsigned long) Set8Bits(regs[0x83]) << 16; r->ph1.fsc = (unsigned long) Set8Bits(regs[0x63]) | (unsigned long) Set8Bits(regs[0x64]) << 8 | (unsigned long) Set8Bits(regs[0x65]) << 16 | (unsigned long) Set8Bits(regs[0x66]) << 24; r->ph1.idel = SetBitField(regs[0x99],7:4,3:0); r->ph1.bs = SetBitField(regs[0x28],5:0,5:0); r->ph1.be = SetBitField(regs[0x29],5:0,5:0); r->ph1.bsta = SetBitField(regs[0x62],6:0,6:0); r->ph1.blckl = SetBitField(regs[0x5d],5:0,5:0); r->ph1.blnnl = SetBitField(regs[0x5e],5:0,5:0); r->ph1.chps = Set8Bits(regs[0x5a]); r->ph1.gy = SetBitField(regs[0x38],4:0,4:0); r->ph1.gcd = SetBitField(regs[0x39],4:0,4:0); r->ph1.bcy = Set8Bits(regs[0xa2]); r->ph1.bcu = Set8Bits(regs[0xa3]); r->ph1.bcv = Set8Bits(regs[0xa4]); r->ph1.ccrs = SetBitField(regs[0x5f],7:6,1:0); r->ph1.gainu = Set8Bits(regs[0x5b]) | SetBitField(regs[0x5d],7:7,8:8); r->ph1.gainv = Set8Bits(regs[0x5c]) | SetBitField(regs[0x5e],7:7,8:8); r->ph1.flc = SetBitField(regs[0x6e],1:0,1:0); r->ph1.phres = SetBitField(regs[0x6e],5:4,1:0); r->ph1.flags1 = (Set8Bits(regs [0x61]) & PH_FLAG1_MASK) | GetBitFlag(regs[0x96],3,PH_FLAG1_YFIL); r->ph1.flags2 = regs[0x2d] & PH_FLAG2_MASK; r->ph1.macro = 0; } void TVPh1SetState (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; /* FIXME */ /* 0x6e blckon, ... */ /* FIXME 0x61 dacoff/chip off ... but need connect state ... always on*/ tvState = state; switch (state) { case TV_OFF: TVWriteBus (dev, 0x3a, 0x80); /* NV */ TVWriteBus (dev, 0x61, Set8Bits(r->ph1.flags1 & PH_FLAG1_MASK)); break; case TV_BARS: TVWriteBus (dev, 0x3a, 0x80); /* NV + cbenb=1 */ TVWriteBus (dev, 0x61, Set8Bits(r->ph1.flags1 & PH_FLAG1_MASK)); break; case TV_ON: TVWriteBus (dev, 0x3a, 0x00); /* NV */ TVWriteBus (dev, 0x61, Set8Bits(r->ph1.flags1 & PH_FLAG1_MASK)); break; default: break; } } long TVPh1GetStatus (TVEncoderObj *this, int index) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte fifo, status; TVReadBus (dev, 0x00, &status); /* FIFO status */ TVReadBus (dev, 0x80, &fifo); /* FIFO status */ return SetBitField (status,1:0,1:0) | SetBitField (fifo,1:0,3:2) | ((tvState == TV_ON) ? 0x100 : 0); } TVConnect TVPh1GetConnect (TVEncoderObj *this) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; TVConnect status = CONNECT_BOTH; I2CByte msense; /* Enable monitor sensing temporarily */ TVWriteBus (dev, 0x1a, 0x2c); /* NV */ TVWriteBus (dev, 0x1b, 0x80); /* Read monitor sense data */ TVReadBus (dev, 0x1b, &msense); /* Monitor sense */ RAISE (MSG_DEBUG, "TVPh1GetConnect %02X", msense); switch (msense & 0x7) { /* 0=active, 1=inactive */ case 0x06: status = CONNECT_COMPOSITE; break; case 0x01: status = CONNECT_SVIDEO; break; case 0x05: status = CONNECT_CONVERT; break; case 0x07: RAISE (MSG_WARNING, "No TV seems to be connected."); /* no break */ default: status = CONNECT_BOTH; break; } /* Disable monitor sensing */ TVWriteBus (dev, 0x1b, 0x00 ); return status; } /* * Check for Philips chip on device dev. Return version string if found, * NULL otherwise. */ char *TVDetectPhilips (I2CDevPtr dev, TVChip *encoder) { I2CByte cid, ver; char *name; static char version [50]; #ifdef FAKE_PROBE_PHILIPS #ifdef FAKE_PROBE_ID *encoder = FAKE_PROBE_ID; #else *encoder = TV_PHILIPS; #endif snprintf (version, 50, "Philips Fake (%1s:%02X)", I2C_ID(dev)); return version; #else #ifdef FAKE_I2C return NULL; #endif #endif tvBusOk = TRUE; TVReadBus (dev, 0x00, &ver); TVReadBus (dev, 0x1c, &cid); ver = (ver & 0xe0 ) >> 5; /* 3 highest bits are version info */ RAISE (MSG_DEBUG, "ph check ver=%01x cid=%02x (%s)", ver, cid, tvBusOk?"ok":"err"); *encoder = TV_PHILIPS; if (ver != 0x2 && ver != 0x5) { snprintf (version, 50, "Unknown Philips #%i (%1s:%02X)", ver, I2C_ID(dev)); return version; } if (!tvBusOk) return NULL; /* Probe addr 0x40 and 0x42 to identify SAA7108, SAA7109 */ if (TVProbeBus (dev->pI2CBus, 0x40) || TVProbeBus (dev->pI2CBus, 0x42)) { switch (cid) { case 0x02: name = "7108"; *encoder = TV_PHILIPS_7108; break; case 0x03: name = "7109"; *encoder = TV_PHILIPS_7109; break; case 0x04: name = "7108A"; *encoder = TV_PHILIPS_7108A; break; case 0x05: name = "7109A"; *encoder = TV_PHILIPS_7109A; break; default: name = NULL; break; } } else { switch (cid) { case 0x02: name = "7102"; *encoder = TV_PHILIPS_7102; break; case 0x03: name = "7103"; *encoder = TV_PHILIPS_7103; break; case 0x04: name = "7104"; *encoder = TV_PHILIPS_7104; break; case 0x05: name = "7105"; *encoder = TV_PHILIPS_7105; break; default: name = NULL; break; } } if (name) { TVReadBus (dev, 0x00, &ver); if (!tvBusOk) return NULL; snprintf (version, 50, "Philips SAA%s (%1s:%02X)", name, I2C_ID(dev)); return version; } else { snprintf (version, 50, "Philips (id = %02X) (%1s:%02X)", cid, I2C_ID(dev)); return version; } } TVEncoderObj tvPh1Template = { type: TV_PHILIPS_MODEL1, ctrl: NULL, minClock: 10000, maxClock: 44000, Create: TVPhCreate, InitRegs: TVPh1InitRegs, SetRegs: TVPh1SetRegs, GetRegs: TVPh1GetRegs, SetPort: TVPh1SetPort, GetPort: TVPh1GetPort, SetState: TVPh1SetState, GetConnect: TVPh1GetConnect, GetStatus: TVPh1GetStatus }; nvtv-0.4.7/src/tv_ph2_saa7104.c0000644000175000001440000001217610005515126011473 /* NVTV Philips Model2 TV-I2C access -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_ph2_saa7104.c,v 1.5 2004/01/27 17:05:26 dthierbach Exp $ * * Contents: * * Routines to access the Philips Model2 (SAA7104 etc.) encoder chip * registers via the I2C bus. * */ #include "local.h" /* before everything else */ #include "bitmask.h" #include "tv_chip.h" #include "tv_i2c.h" #include "tv_ph1_saa7102.h" #include "tv_ph2_saa7104.h" void TVPh2SetPort (TVEncoderObj *this, int port) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; TVPhSetPort (this, port); if ((port & PORT_PCLK_POLARITY) == PORT_PCLK_HIGH) { TVWriteBus (dev, 0x54, 0x02); /* edge1: falling, edge2: rising */ } else { TVWriteBus (dev, 0x54, 0x00); /* edge1: raising, edge2: falling */ } /* FIXME TODO correct polarity with bit 0 */ } void TVPh2GetPort (TVEncoderObj *this, int *port) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte res; RAISE (MSG_DEBUG, "ph1 get port"); TVPhGetPort (this, port); TVReadBus (dev, 0x54, &res); *port |= ((res & 0x3) == 0x00 ? PORT_PCLK_LOW : PORT_PCLK_HIGH); } void TVPh2InitRegs (TVEncoderObj *this, int port) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; RAISE (MSG_DEBUG, "ph2 init %04X", this->type); TVPh2SetPort (this, port); TVPhInitRegs (this); TVWriteBus (dev, 0x37, 0x12); /* NV: 0x37= 0x12 */ TVWriteBus (dev, 0x54, 0x02); /* NV */ } void TVPh2SetRegs (TVEncoderObj *this, TVEncoderRegs *r, TVState state) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; TVPh1SetRegs (this, r, state); TVWriteBus (dev, 0x37, 0x02 /* igain=1 */ | SetBitFlag(r->ph2.flags3,PH_FLAG3_XINT,0) | SetBitFlag(r->ph2.flags3,PH_FLAG3_YUPSC,6) | SetBitField(r->ph2.yfil,1:0,5:4) | SetBitField(r->ph2.pcli,1:0,1:0)); TVWriteBus (dev, 0x84, 0xc0 /* dclk=single, pclsy=sync */ | SetBitFlag(r->ph2.flags3,PH_FLAG3_IFRA,5) | SetBitFlag(r->ph2.flags3,PH_FLAG3_IFBP,4) | SetBitField(r->ph2.pcle,1:0,3:2) | SetBitField(r->ph2.pcli,1:0,1:0)); TVWriteBus (dev, 0x85, SetBitFlag(r->ph2.flags3,PH_FLAG3_EIDIV,7) | SetBitField(r->ph2.fili,3:0,3:0)); } void TVPh2GetRegs (TVEncoderObj *this, TVEncoderRegs *r) { register I2CDevPtr dev = (I2CDevPtr) this->ctrl; I2CByte res; TVPh1GetRegs (this, r); r->ph2.flags3 = 0; TVReadBus (dev, 0x37, &res); r->ph2.flags3 |= GetBitFlag(res,0,PH_FLAG3_XINT) | GetBitFlag(res,6,PH_FLAG3_YUPSC); r->ph2.yfil = SetBitField(res,5:4,1:0); r->ph2.pcli = SetBitField(res,1:0,1:0); TVReadBus (dev, 0x84, &res); r->ph2.flags3 |= GetBitFlag(res,5,PH_FLAG3_IFRA) | GetBitFlag(res,4,PH_FLAG3_IFBP); r->ph2.pcle = SetBitField(res,3:2,1:0); r->ph2.pcli = SetBitField(res,1:0,1:0); TVReadBus (dev, 0x85, &res); r->ph2.flags3 |= GetBitFlag(res,7,PH_FLAG3_EIDIV); r->ph2.fili = SetBitField(res,3:0,3:0); } TVEncoderObj tvPh2Template = { type: TV_PHILIPS_MODEL2, ctrl: NULL, minClock: 10000, maxClock: 44000, Create: TVPhCreate, InitRegs: TVPh2InitRegs, SetRegs: TVPh2SetRegs, GetRegs: TVPh2GetRegs, SetPort: TVPh2SetPort, GetPort: TVPh2GetPort, SetState: TVPh1SetState, GetConnect: TVPh1GetConnect, GetStatus: TVPh1GetStatus }; /* SAA7104: (iferr bferr in status) (edge/slot via port) maxClock 85 MHz PLL between ca. 40 Mhz and 85 Mhz (before divide) PAL/NTSC up to 1280x1024 (1920x1080 interlaced) HDTV up to 1920x1080 interlaced, 1280x720 progressive I2C at 400kHz (also 7102) MV rev 7.01, rev 6.1, rev 1.03 (525p) Anti-Flicker 5 lines 2 FIFOs (one for upsampling) seperate CSYNC pin (also 7102) Different registers: 1b: 6=msa 5=msoe ; automatic monitor sense, ms pin TVD output enable 2d: 2=cvbsen2 ; pin RED... normal or CVBS 37: 6=yupsc 5=yfil1 4=yfil0 2=gzoom 1=igain 0=xint ; Input path control (nv=12: yfil=1 (before), igain=1) 3a: 5=syntv 54: 5=gpval 4=gpen 1=edge 0=slot 61: 5=inpi 62: 7=rtce 6e: 7=nvtrig ; vtrig sign 7c: 5=ttxo 80: 3=iferr 2=bferr ; input fifo overflow, buffer fifo overflow (for yupsc) 84: 7=dclk 6=pclsy 5=ifra 4=ifbp 3=pcle1 2=pcle0 1=pcli1 0=pcli0 (nv=e_: dclk=single, pclsy=sync, ifra=reset, ifbp=active) (nv=_5: e:i=2:2, nv=_0: e:i=1:1) 85: 7=eidiv 3=fili3 2=fili2 1=fili1 0=fili0 (nv=88: input dividers on, threshold=8) 96: 2=hsl is n/a 99: 3=hlen11 d0-dc: hdtv stuff */ nvtv-0.4.7/src/data.c0000644000175000001440000001331707743224066010057 /* NVTV data -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data.c,v 1.27 2003/10/15 10:57:58 dthierbach Exp $ * * Contents: * * Common routines for data access * */ #include "local.h" /* before everything else */ #include #include #include "data.h" #include "data_bt.h" #include "data_cx.h" #include "data_ch.h" #include "data_ph.h" #include "data_nv.h" #include "data_tdfx.h" #include "data_i810.h" #include "data_xbox.h" /* -------- -------- */ inline double dsqr (double arg) { return arg * arg; } /* -------- -------- */ int data_clamp (int val, int size, int ticks[]) { int i; for (i = 0; i <= size; i++) if (i >= size || val <= ticks[i]) break; if (i <= 0) return ticks[0]; if (i >= size) return ticks[size-1]; if (val <= ticks[i-1] + (ticks[i] - ticks[i-1]) / 2) { return ticks[i-1]; } else { return ticks[i]; } } int data_pick (int val, int size, int ticks[]) { int i; for (i = 0; i < size; i++) if (ticks[i] == val) return i; return 0; } /* -------- -------- */ /* * List all modes */ int data_listModes (TVMode *modes, TVSystem system, TVMode *(list[])) { TVMode *m, *r; int c; if (!modes) return 0; c = 0; for (m = modes; m->spec.system != TV_SYSTEM_NONE; m++) { if (system == TV_SYSTEM_NONE || system == m->spec.system) c++; } r = xcalloc (sizeof (TVMode), c); *list = r; for (m = modes; m->spec.system != TV_SYSTEM_NONE; m++) { if (system == TV_SYSTEM_NONE || system == m->spec.system) *r++ = *m; } return c; } /* * find mode by size */ TVMode *data_find (TVMode *modes, TVSystem system, int res_x, int res_y, char *size) { if (!modes) return NULL; while (modes->spec.system != TV_SYSTEM_NONE) { if ((res_x < 0 || modes->spec.res_x == res_x) && (res_y < 0 || modes->spec.res_y == res_y) && (system == modes->spec.system) && strcasecmp (modes->spec.size, size) == 0) break; modes++; } if (modes->spec.system != TV_SYSTEM_NONE) { RAISE (MSG_DEBUG, "found mode"); return modes; } else { RAISE (MSG_DEBUG, "found no mode"); return NULL; } } /* * find nearest mode by overscan (don't calculate new mode for BT/CX) */ TVMode *data_findNearest (TVMode *modes, TVSystem system, int res_x, int res_y, double hoc, double voc) { TVMode *best; double best_dist, dist; if (!modes) return NULL; best = NULL; best_dist = 0.0; while (modes->spec.system != TV_SYSTEM_NONE) { if ((res_x < 0 || modes->spec.res_x == res_x) && (res_y < 0 || modes->spec.res_y == res_y) && (system == modes->spec.system)) { dist = dsqr (modes->spec.hoc - hoc) + dsqr (modes->spec.voc - voc); if (!best || best_dist > dist) { best_dist = dist; best = modes; } } modes++; } return best; } /* -------- Null data object -------- */ TVMode *data_modes_null (void) { return NULL; } void data_default_null (TVSettings *s) { } void data_clamp_null (TVSettings *s, TVRegs *r) { } void data_setup_null (TVSettings *s, TVRegs *r) { } void data_calc_null (TVSystem system, int hres, int vres, double hoc, double voc, TVRegs *r) { } DataFunc null_func = { modes: data_modes_null, defaults: data_default_null, setup: data_setup_null, clamp: data_clamp_null, calc: data_calc_null, }; /* -------- -------- */ void data_make_null (int hdisplay, int hsyncstart, int hsyncend, int htotal, int vdisplay, int vsyncstart, int vsyncend, int vtotal, int dotclock, TVCrtcRegs *crt) { } DataCardFunc null_card_func = { make: data_make_null, }; /* -------- -------- */ DataFunc *data_func (CardType card, TVChip chip) { switch ((chip & TV_ENCODER) | (card << CARD_SHIFT)) { case (CARD_NVIDIA << CARD_SHIFT) | TV_BROOKTREE: return &data_nv_bt_func; case (CARD_NVIDIA << CARD_SHIFT) | TV_CONEXANT: return &data_nv_cx_func; case (CARD_NVIDIA << CARD_SHIFT) | TV_CHRONTEL_MODEL1: return &data_nv_ch1_func; case (CARD_NVIDIA << CARD_SHIFT) | TV_CHRONTEL_MODEL2: return &data_nv_ch2_func; case (CARD_NVIDIA << CARD_SHIFT) | TV_PHILIPS_MODEL1: return &data_nv_ph1_func; case (CARD_NVIDIA << CARD_SHIFT) | TV_PHILIPS_MODEL2: return &data_nv_ph2_func; case (CARD_NVIDIA << CARD_SHIFT) | TV_NVIDIA: return &data_nv_nx_func; case (CARD_XBOX << CARD_SHIFT) | TV_CONEXANT: return &data_xbox_cx_func; case (CARD_TDFX << CARD_SHIFT) | TV_BROOKTREE: return &data_tdfx_bt_func; case (CARD_I810 << CARD_SHIFT) | TV_CHRONTEL_MODEL1: return &data_i810_ch1_func; case (CARD_I810 << CARD_SHIFT) | TV_CHRONTEL_MODEL2: return &data_i810_ch2_func; default: return &null_func; } } DataCardFunc *data_card_func (CardType card) { switch (card) { case CARD_NVIDIA: return &data_nv_func; case CARD_XBOX: return &data_xbox_func; case CARD_TDFX: return &data_tdfx_func; case CARD_I810: return &data_i810_func; default: return &null_card_func; } } nvtv-0.4.7/src/data_bt.c0000644000175000001440000007706107671651575010563 /* NVTV Brooktree encoder data -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_bt.c,v 1.30 2003/06/11 16:06:21 dthierbach Exp $ * * Contents: * * Data tables and routines for the Brooktree (and Conexant) chips. * */ #include #include #include #include "data_bt.h" #include "data_nv.h" /* -------- BT -------- NTSC -------- */ /* -------- 640x480 -------- */ TVBtRegs bt_ntsc_small_a = { /* over comp 13.79 13.58 % (std 0) */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 1792, h_active : 640, hsync_width : 132, hburst_begin : 150, hburst_end : 96, h_blanko : 381, v_blanko : 34, v_activeo : 212, h_fract : 0, h_clki : 784, h_blanki : 126, v_linesi : 600, v_blanki : 75, v_activei : 480, v_scale : 5266, pll_fract : 34830, pll_int : 12, sync_amp : 229, bst_amp : 118, mcr : 121, mcb : 68, my : 133, msc : 545259520, flags1 : BT_FLAG1_NTSC, }; TVBtRegs bt_ntsc_normal_a = { /* over comp 10.59 08.23 % (status voc=08.64) */ hsynoffset : 0, /* NV: 12 */ vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 1728, h_active : 640, hsync_width : 128, hburst_begin : 144, hburst_end : 88, h_blanko : 345, v_blanko : 28, v_activeo : 224, h_fract : 0, h_clki : 800, h_blanki : 140, v_linesi : 567, v_blanki : 58, v_activei : 480, v_scale : 4751, pll_fract : 5499, pll_int : 12, sync_amp : 229, bst_amp : 118, mcr : 121, mcb : 68, my : 133, msc : 565454317, flags1 : BT_FLAG1_NTSC, }; TVBtRegs bt_ntsc_huge_a = { /* over comp 02.46 01.23 % */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 1584, h_active : 640, hsync_width : 118, hburst_begin : 132, hburst_end : 70, h_blanko : 263, v_blanko : 19, v_activeo : 242, h_fract : 0, h_clki : 792, h_blanki : 133, v_linesi : 525, v_blanki : 36, v_activei : 480, v_scale : 4096, pll_fract : 5041, pll_int : 11, sync_amp : 229, bst_amp : 118, mcr : 122, mcb : 68, my : 133, msc : 616859255, flags1 : BT_FLAG1_NTSC, }; /* -------- 800x600 -------- */ TVBtRegs bt_ntsc_small_b = { /* over comp 21.62 11.52 % (std 2) */ hsynoffset : 0, /* NV: -8 */ vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2464, h_active : 800, hsync_width : 182, hburst_begin : 206, hburst_end : 180, h_blanko : 597, v_blanko : 32, v_activeo : 216, h_fract : 0, h_clki : 880, h_blanki : 66, v_linesi : 735, v_blanki : 86, v_activei : 600, v_scale : 7373, pll_fract : 15124, pll_int : 17, sync_amp : 229, bst_amp : 116, mcr : 119, mcb : 67, my : 133, msc : 396552378, flags1 : BT_FLAG1_NTSC, }; TVBtRegs bt_ntsc_normal_b = { /* over comp 11.90 05.35 % */ hsynoffset : 0, /* NV: -62 */ vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2192, h_active : 800, hsync_width : 162, hburst_begin : 182, hburst_end : 146, h_blanko : 445, /* tool: 480 */ v_blanko : 24, v_activeo : 232, h_fract : 0, h_clki : 840, h_blanki : 26, v_linesi : 685, v_blanki : 60, v_activei : 600, v_scale : 6593, pll_fract : 21540, pll_int : 15, sync_amp : 229, bst_amp : 117, mcr : 120, mcb : 67, my : 133, msc : 445759608, flags1 : BT_FLAG1_NTSC, }; TVBtRegs bt_ntsc_huge_b = { /* over comp 07.15 00.004 % */ hsynoffset : 0, /* NV: -60 */ vsynoffset : 0, hsynwidth : 1, vsynwidth : 2, h_clko : 2080, h_active : 800, hsync_width : 154, hburst_begin : 174, hburst_end : 132, h_blanko : 383, /* calc: 383, tool: 400 */ v_blanko : 18, v_activeo : 244, h_fract : 0, h_clki : 840, h_blanki : 26, v_linesi : 650, v_blanki : 42, v_activei : 600, v_scale : 6046, pll_fract : 35747, pll_int : 14, sync_amp : 229, bst_amp : 117, mcr : 120, mcb : 67, my : 133, msc : 469762048, flags1 : BT_FLAG1_NTSC, }; /* -------- 720x480 -------- */ TVBtRegs bt_ntsc_normal_c = { /* Overscan 08.762 x 18.107 */ hsynoffset : 0, /* NV: -4 */ vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2048, h_active : 720, hsync_width : 152, hburst_begin : 170, hburst_end : 128, h_blanko : 445, v_blanko : 34, v_activeo : 212, h_fract : 0, h_clki : 896, h_blanki : 154, v_linesi : 600, v_blanki : 75, v_activei : 480, v_scale : 5266, pll_fract : 21081, pll_int : 14, sync_amp : 229, bst_amp : 117, mcr : 120, mcb : 68, my : 133, msc : 477102080, flags1 : BT_FLAG1_NTSC, }; /* -------- 720x480 DVD -------- */ TVBtRegs bt_ntsc_dvd_a = { /* Overscan 01.245 x 01.235 */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 1760, h_active : 720, hsync_width : 130, hburst_begin : 146, hburst_end : 92, h_blanko : 283, v_blanko : 19, v_activeo : 242, h_fract : 0, h_clki : 880, h_blanki : 140, v_linesi : 525, v_blanki : 36, v_activei : 480, v_scale : 4096, pll_fract : 20165, pll_int : 12, sync_amp : 229, bst_amp : 118, mcr : 121, mcb : 68, my : 133, msc : 555173329, flags1 : BT_FLAG1_NTSC, }; TVBtRegs bt_ntsc_dvd_b = { /* Beos NTSC720 hoc=02.135 voc=01.235 */ hsynoffset : 4, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 1776, h_active : 720, hsync_width : 131, hburst_begin : 152, hburst_end : 94, h_blanko : 296, v_blanko : 24, v_activeo : 242, h_fract : 0, h_clki : 888, h_blanki : 144, v_linesi : 525, v_blanki : 26, v_activei : 480, v_scale : 4096, pll_fract : 28312, pll_int : 12, sync_amp : 229, bst_amp : 117, mcr : 120, mcb : 68, my : 133, msc : 549622076, flags1 : BT_FLAG1_NTSC, }; /* -------- BT -------- PAL -------- */ /* -------- 640x480 -------- */ TVBtRegs bt_pal_def_a = { hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 1888, h_active : 640, hsync_width : 138, hburst_begin : 166, hburst_end : 104, h_blanko : 449, v_blanko : 46, v_activeo : 242, h_fract : 0, h_clki : 944, h_blanki : 266, v_linesi : 625, v_blanki : 90, v_activei : 480, v_scale : 4096, pll_fract : 7282, pll_int : 13, sync_amp : 240, bst_amp : 88, mcr : 129, mcb : 73, my : 140, msc : 645499916, flags1 : BT_FLAG1_PAL_BDGHI, }; TVBtRegs bt_pal_small_a = { /* over comp 16.56 16.67 % (std 1) */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 1888, h_active : 640, hsync_width : 138, hburst_begin : 166, hburst_end : 104, h_blanko : 449, v_blanko : 46, v_activeo : 242, h_fract : 0, h_clki : 944, h_blanki : 266, v_linesi : 625, v_blanki : 90, v_activei : 480, v_scale : 4096, pll_fract : 7282, pll_int : 13, sync_amp : 240, bst_amp : 88, mcr : 129, mcb : 73, my : 140, msc : 645499916, flags1 : BT_FLAG1_PAL_BDGHI, }; TVBtRegs bt_pal_normal_a = { /* over comp 12.87 07.64 % */ hsynoffset : 0, /* ? 208 */ vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 1808, h_active : 640, hsync_width : 132, hburst_begin : 158, hburst_end : 94, h_blanko : 403, /* 416 */ v_blanko : 33, v_activeo : 268, h_fract : 0, h_clki : 1000, h_blanki : 315, v_linesi : 565, v_blanki : 57, v_activei : 480, v_scale : 3310, pll_fract : 36409, pll_int : 12, sync_amp : 240, bst_amp : 88, mcr : 130, mcb : 73, my : 140, msc : 674061860, flags1 : BT_FLAG1_PAL_BDGHI, }; TVBtRegs bt_pal_huge_a = { /* over comp 06.22 00.69 % */ hsynoffset : 0, /* ? 208, */ vsynoffset : 0, hsynwidth : 1, vsynwidth : 1, h_clko : 1680, h_active : 640, hsync_width : 124, hburst_begin : 146, /* 148, */ hburst_end : 78, h_blanko : 331, /* 344, */ v_blanko : 23, v_activeo : 288, h_fract : 0, h_clki : 1000, h_blanki : 299, /* 312, */ v_linesi : 525, v_blanki : 36, v_activei : 480, v_scale : 2785, pll_fract : 43691, pll_int : 11, sync_amp : 240, bst_amp : 89, mcr : 131, mcb : 73, my : 140, msc : 725418954, flags1 : BT_FLAG1_PAL_BDGHI, }; /* -------- 800x600 -------- */ TVBtRegs bt_pal_def_b = { hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2304, h_active : 800, hsync_width : 170, hburst_begin : 202, hburst_end : 154, h_blanko : 525, v_blanko : 41, v_activeo : 252, h_fract : 0, h_clki : 960, h_blanki : 140, v_linesi : 750, v_blanki : 95, v_activei : 600, v_scale : 5734, pll_fract : 0, pll_int : 16, sync_amp : 240, bst_amp : 87, mcr : 128, mcb : 72, my : 140, msc : 528951320, flags1 : BT_FLAG1_PAL_BDGHI, }; TVBtRegs bt_pal_small_b = { /* over comp 14.53 13.19 % (std 3) */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2304, h_active : 800, hsync_width : 170, hburst_begin : 202, hburst_end : 154, h_blanko : 525, /* 530 */ v_blanko : 41, v_activeo : 252, h_fract : 0, h_clki : 960, h_blanki : 135, /* tuned */ /* 140, 141 */ v_linesi : 750, v_blanki : 95, v_activei : 600, v_scale : 5734, pll_fract : 0, pll_int : 16, sync_amp : 240, bst_amp : 87, mcr : 128, mcb : 72, my : 140, msc : 528951320, flags1 : BT_FLAG1_PAL_BDGHI, }; TVBtRegs bt_pal_normal_b = { /* over comp 10.81 05.56 % */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2208, h_active : 800, hsync_width : 162, hburst_begin : 194, hburst_end : 142, h_blanko : 471, /* 478, */ v_blanko : 30, v_activeo : 274, h_fract : 0, h_clki : 1000, h_blanki : 175, /* 100, 140 */ v_linesi : 690, v_blanki : 64, v_activei : 600, v_scale : 4948, pll_fract : 21845, pll_int : 15, sync_amp : 240, bst_amp : 87, mcr : 128, mcb : 72, my : 140, msc : 551949204, flags1 : BT_FLAG1_PAL_BDGHI, }; TVBtRegs bt_pal_large_b = { /* over comp 07.461 x 02.083 */ hsynoffset : 0, /* NV: -8 */ vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2128, h_active : 800, hsync_width : 156, hburst_begin : 186, hburst_end : 134, h_blanko : 425, v_blanko : 25, v_activeo : 284, h_fract : 0, h_clki : 1000, h_blanki : 190, v_linesi : 665, v_blanki : 51, v_activei : 600, v_scale : 4620, pll_fract : 50972, pll_int : 14, sync_amp : 240, bst_amp : 87, mcr : 128, mcb : 72, my : 140, msc : 572699174, flags1 : BT_FLAG1_PAL_BDGHI, }; TVBtRegs bt_pal_huge_b = { /* over comp 00.039 00.00 % (no calc'd mode) */ hsynoffset : 0, /* NV: 14 */ vsynoffset : 0, hsynwidth : 1, vsynwidth : 1, h_clko : 1970, h_active : 800, hsync_width : 144, hburst_begin : 172, hburst_end : 114, h_blanko : 303, v_blanko : 22, v_activeo : 309, h_fract : 0, h_clki : 945, h_blanki : 101, v_linesi : 652, v_blanki : 133, v_activei : 600, v_scale : 4438, pll_fract : 44478, pll_int : 13, sync_amp : 240, bst_amp : 88, mcr : 128, mcb : 72, my : 140, msc : 618715949, flags1 : BT_FLAG1_PAL_BDGHI, }; /* -------- 768x576 -------- */ /* 768 x 576 (720x576 scaled by xine) */ TVBtRegs bt_pal_small_c = { /* hoc = 13.122 voc = 07.986 */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2176, h_active : 768, hsync_width : 160, hburst_begin : 190, hburst_end : 138, h_blanko : 485, v_blanko : 34, v_activeo : 267, h_fract : 0, h_clki : 1000, h_blanki : 203, v_linesi : 680, v_blanki : 71, v_activei : 576, v_scale : 4817, pll_fract : 7282, pll_int : 15, sync_amp : 240, bst_amp : 87, mcr : 128, mcb : 72, my : 140, msc : 560066112, flags1 : BT_FLAG1_PAL_BDGHI, }; TVBtRegs bt_pal_normal_c = { /* hoc = 09.806 voc = 04.514 */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2096, h_active : 768, hsync_width : 154, hburst_begin : 184, hburst_end : 130, h_blanko : 439, v_blanko : 29, v_activeo : 277, h_fract : 0, h_clki : 1000, h_blanki : 203, v_linesi : 655, v_blanki : 58, v_activei : 576, v_scale : 4489, pll_fract : 36409, pll_int : 14, sync_amp : 240, bst_amp : 87, mcr : 128, mcb : 72, my : 140, msc : 581442673, flags1 : BT_FLAG1_PAL_BDGHI, }; TVBtRegs bt_pal_huge_c = { /* hoc = 00.000 voc = 00.000 */ hsynoffset : 2, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 1890, h_active : 768, hsync_width : 138, hburst_begin : 166, hburst_end : 104, h_blanko : 323, v_blanko : 22, v_activeo : 290, h_fract : 0, h_clki : 945, h_blanki : 154, v_linesi : 625, v_blanki : 42, v_activei : 576, v_scale : 4096, pll_fract : 8192, pll_int : 13, sync_amp : 240, bst_amp : 88, mcr : 129, mcb : 73, my : 140, msc : 644816848, flags1 : BT_FLAG1_PAL_BDGHI, }; TVBtRegs bt_pal_normal1_c = { /* hoc = 11.163 voc = 05.903 */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2128, h_active : 768, hsync_width : 156, hburst_begin : 186, hburst_end : 134, h_blanko : 457, v_blanko : 31, v_activeo : 273, h_fract : 0, h_clki : 1000, h_blanki : 203, v_linesi : 665, v_blanki : 63, v_activei : 576, v_scale : 4620, pll_fract : 50972, pll_int : 14, sync_amp : 240, bst_amp : 87, mcr : 128, mcb : 72, my : 140, msc : 572699174, flags1 : BT_FLAG1_PAL_BDGHI, }; /* -------- 800x576 -------- */ /* 800 x 576 (for 1024x576 widescreen scaled by xine) */ TVBtRegs bt_pal_normal_d = { /* hoc = 08.83 voc = 07.29 */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2160, h_active : 800, hsync_width : 158, hburst_begin : 188, hburst_end : 136, h_blanko : 443, v_blanko : 33, v_activeo : 269, h_fract : 0, h_clki : 1000, h_blanki : 175, v_linesi : 675, v_blanki : 69, v_activei : 576, v_scale : 4751, pll_fract : 0, pll_int : 15, sync_amp : 240, bst_amp : 87, mcr : 128, mcb : 72, my : 140, msc : 564214742, flags1 : BT_FLAG1_PAL_BDGHI, }; /* -------- 720x576 DVD -------- */ TVBtRegs bt_pal_dvd_a = { /* NV/Beos DVD, hoc = 00.21, voc = 00.00 */ hsynoffset : 0, /* NV: 4 */ vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 1776, h_active : 720, hsync_width : 130, hburst_begin : 156, hburst_end : 90, h_blanko : 305, v_blanko : 22, v_activeo : 290, h_fract : 0, h_clki : 888, h_blanki : 147, v_linesi : 625, v_blanki : 42, v_activei : 576, v_scale : 4096, pll_fract : 21845, pll_int : 12, sync_amp : 240, bst_amp : 89, mcr : 130, mcb : 73, my : 140, msc : 686207118, flags1 : BT_FLAG1_PAL_BDGHI, }; /* -------- BT -------- PAL-60 -------- */ /* -------- 640x480 -------- */ TVBtRegs bt_pal60_small_a = { /* 16.758 x 14.815 */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 1856, h_active : 640, hsync_width : 138, hburst_begin : 164, hburst_end : 102, h_blanko : 417, v_blanko : 36, v_activeo : 209, h_fract : 0, h_clki : 800, h_blanki : 140, v_linesi : 609, v_blanki : 81, v_activei : 480, v_scale : 5407, pll_fract : 64161, pll_int : 12, sync_amp : 240, bst_amp : 88, mcr : 129, mcb : 73, my : 140, msc : 652069372, flags1 : BT_FLAG1_PAL_60, }; TVBtRegs bt_pal60_normal_a = { /* 10.592 x 08.230 */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 1728, h_active : 640, hsync_width : 128, hburst_begin : 152, hburst_end : 86, h_blanko : 345, v_blanko : 28, v_activeo : 224, h_fract : 0, h_clki : 800, h_blanki : 145, /* tuned */ /* 140, */ v_linesi : 567, v_blanki : 58, v_activei : 480, v_scale : 4751, pll_fract : 5500, pll_int : 12, sync_amp : 240, bst_amp : 89, mcr : 130, mcb : 73, my : 140, msc : 700370807, flags1 : BT_FLAG1_PAL_60, }; TVBtRegs bt_pal60_huge_a = { /* 01.469 x 01.235 */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 1568, h_active : 640, hsync_width : 116, hburst_begin : 138, hburst_end : 66, h_blanko : 255, v_blanko : 19, v_activeo : 242, h_fract : 0, h_clki : 784, h_blanki : 126, v_linesi : 525, v_blanki : 36, v_activei : 480, v_scale : 4096, pll_fract : 63245, pll_int : 10, sync_amp : 240, bst_amp : 90, mcr : 131, mcb : 74, my : 140, msc : 771837216, flags1 : BT_FLAG1_PAL_60, }; /* -------- 800x600 -------- */ TVBtRegs bt_pal60_small_b = { /* 21.623 x 11.523 */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2464, h_active : 800, hsync_width : 182, hburst_begin : 218, hburst_end : 176, h_blanko : 597, v_blanko : 32, v_activeo : 216, h_fract : 0, h_clki : 880, h_blanki : 66, v_linesi : 735, v_blanki : 86, v_activei : 600, v_scale : 7373, pll_fract : 15124, pll_int : 17, sync_amp : 240, bst_amp : 87, mcr : 127, mcb : 72, my : 140, msc : 491169137, flags1 : BT_FLAG1_PAL_60, }; TVBtRegs bt_pal60_normal_b = { /* 11.897 x 05.350 */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2192, h_active : 800, hsync_width : 162, hburst_begin : 194, hburst_end : 142, h_blanko : 445, v_blanko : 24, v_activeo : 232, h_fract : 0, h_clki : 840, h_blanki : 26, v_linesi : 685, v_blanki : 60, v_activei : 600, v_scale : 6593, pll_fract : 21540, pll_int : 15, sync_amp : 240, bst_amp : 87, mcr : 128, mcb : 72, my : 140, msc : 552117133, flags1 : BT_FLAG1_PAL_60, }; TVBtRegs bt_pal60_huge_b = { /* 07.862 x 00.823 */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2096, h_active : 800, hsync_width : 156, hburst_begin : 184, hburst_end : 130, h_blanko : 391, v_blanko : 19, v_activeo : 242, h_fract : 0, h_clki : 840, h_blanki : 26, v_linesi : 655, v_blanki : 44, v_activei : 600, v_scale : 6124, pll_fract : 43080, pll_int : 14, sync_amp : 240, bst_amp : 87, mcr : 128, mcb : 72, my : 140, msc : 577404940, flags1 : BT_FLAG1_PAL_60, }; /* -------- 720x480 DVD -------- */ TVBtRegs bt_pal60_dvd_a = { /* 01.245 x 01.235 */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 1760, h_active : 720, hsync_width : 130, hburst_begin : 156, hburst_end : 90, h_blanko : 283, v_blanko : 19, v_activeo : 242, h_fract : 0, h_clki : 880, h_blanki : 140, v_linesi : 525, v_blanki : 36, v_activei : 480, v_scale : 4096, pll_fract : 20165, pll_int : 12, sync_amp : 240, bst_amp : 89, mcr : 130, mcb : 73, my : 140, msc : 687636792, flags1 : BT_FLAG1_PAL_60, }; /* -------- BT async -------- PAL -------- */ /* -------- 640x480 -------- */ TVBtRegs bt_async_pal_small_a = { /* over comp 16.56 16.67 % (std 1) */ hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 1888, h_active : 640, hsync_width : 138, hburst_begin : 166, hburst_end : 104, h_blanko : 449, v_blanko : 46, v_activeo : 242, h_fract : 0, h_clki : 944, h_blanki : 266, v_linesi : 625, v_blanki : 90, v_activei : 480, v_scale : 4096, pll_fract : 7282, pll_int : 13, sync_amp : 240, bst_amp : 88, mcr : 129, mcb : 73, my : 140, msc : 645499916, flags1 : BT_FLAG1_PAL_BDGHI | BT_FLAG1_EN_ASYNC, }; /* -------- -------- */ #define PI 3.14159265358979323846 static int clamp_attenuate[8] = {-100, -90, -75, -50, -30, -20, -10, 0}; static int clamp_flicker[5] = {0, 25, 50, 75, 100}; static int clamp_luma_bandwidth[4] = {0, 30, 60, 100}; static int clamp_chroma_bandwidth[3] = {0, 50, 100}; /* Convert NTSC to PAL-M. Values copied from calc_bt.c. FIXME refactor? */ /* TODO: Doesn't respect DoublePll / Mode2x */ void data_ntsc_palm_bt (TVBtRegs *r) { double Fxtal = 13500000; double Fclk; double dHCLKO; double dSINX; double dV100; register double f; Fclk = Fxtal * (r->pll_int + r->pll_fract / 65536.0) / 6.0; dHCLKO = r->h_clko; dV100 = 716.1; f = PI * 3575611.88 / Fclk; dSINX = sin (f) / f; r->hburst_begin = (int) ((0.09125874125874 * dHCLKO) + 0.5); r->hburst_end = 2 * (int) ((0.06545454545455 * dHCLKO) + 0.5) - 128; r->sync_amp = 240; r->bst_amp = (int) ((84.84 / dSINX) + 0.5); r->msc = (long) (0x80000000 * (454.5 / dHCLKO) + 0.5); r->mcr = (int) ((dV100 / (5.746659386525 * dSINX)) + 0.5); r->mcb = (int) ((dV100 / (10.22275919266 * dSINX)) + 0.5); r->my = (int) ((dV100 / 5.099501953125) + 0.5); r->flags1 &= ~BT_FLAG1_SYSTEM; r->flags1 |= BT_FLAG1_PAL_M; r->macro = 4; /* FIXME test this */ } void data_default_bt (TVSettings *s) { s->tv_hoffset = s->mon_hoffset = 0; s->tv_voffset = s->mon_voffset = 0; s->brightness_sig = 0; s->contrast_sig = 0; s->saturation_sig = 0; s->contrast = 0; s->saturation = 0; s->phase = 0; s->hue = 0; s->flicker = 75; s->flicker_adapt = 0; s->sharpness = 50; s->cross_color = 100; s->luma_bandwidth = 30; s->chroma_bandwidth = 100; /* FIXME s->flags; */ } void data_clamp_bt (TVSettings *s, TVRegs *r) { if (s->tv_hoffset <= -100) s->tv_hoffset = -100; if (s->tv_hoffset >= 100) s->tv_hoffset = 100; if (s->tv_voffset <= -100) s->tv_voffset = -100; if (s->tv_voffset >= 100) s->tv_voffset = 100; if (s->mon_hoffset <= -100) s->mon_hoffset = -100; if (s->mon_hoffset >= 100) s->mon_hoffset = 100; if (s->mon_voffset <= -100) s->mon_voffset = -100; if (s->mon_voffset >= 100) s->mon_voffset = 100; s->tv_voffset = 0; /* FIXME. Clamp to 0 for now, until some 'VTotal magic' */ s->brightness_sig = 0; if (s->contrast_sig < -50) s->contrast_sig = -50; if (s->contrast_sig > 50) s->contrast_sig = 50; if (s->saturation_sig < -50) s->saturation_sig = -50; if (s->saturation_sig > 50) s->saturation_sig = 50; if (s->phase < -180) s->phase = -180; if (s->phase > 180) s->phase = 180; s->hue = 0; s->contrast = data_clamp (s->contrast, 8, clamp_attenuate); s->saturation = data_clamp (s->saturation, 8, clamp_attenuate); s->sharpness = 50; s->flicker = data_clamp (s->flicker, 5, clamp_flicker); s->flicker_adapt = 0; s->cross_color = 100; s->chroma_bandwidth = data_clamp (s->chroma_bandwidth, 3, clamp_chroma_bandwidth); s->luma_bandwidth = data_clamp (s->luma_bandwidth, 4, clamp_luma_bandwidth); /* FIXME: Operate on mode flags */ } /* The mux setup is different for NV and Voodoo cards, so we have extra routines for that. */ void data_mux_nv_bt (TVBtRegs *r) { r->out_muxa = 0; r->out_muxb = 2; r->out_muxc = 1; r->out_muxd = 0; /* only available for the conexant chip */ } void data_mux_tdfx_bt (TVBtRegs *r) { r->out_muxa = 0; r->out_muxb = 1; r->out_muxc = 2; r->out_muxd = 0; /* only available for the conexant chip */ } /* The init/setup routines without mux setup */ void data_init_nomux_bt (TVSystem system, TVBtRegs *r) { if (!r) return; r->ylpf = 3; r->clpf = 0; r->flags2 = BT_FLAG2_DIS_GM; r->flags3 = 0; r->f_selc = 2; r->f_sely = 2; r->phase_off = 0; /* 1.406 degrees per bit incr */ switch (system) { case TV_SYSTEM_NTSC_J: r->flags1 &= ~BT_FLAG1_SYSTEM; r->flags1 |= BT_FLAG1_NTSC_J; break; case TV_SYSTEM_PAL_M: r->flags1 &= ~BT_FLAG1_SYSTEM; r->flags1 |= BT_FLAG1_PAL_M; break; default: break; } switch (system) { case TV_SYSTEM_NONE: case TV_SYSTEM_NTSC: case TV_SYSTEM_NTSC_J: r->macro = 0; break; case TV_SYSTEM_SECAM: /* makes most sense */ case TV_SYSTEM_PAL: case TV_SYSTEM_PAL_X: case TV_SYSTEM_PAL_60: case TV_SYSTEM_PAL_N: case TV_SYSTEM_PAL_NC: case TV_SYSTEM_PAL_M: /* FIXME test this */ case TV_SYSTEM_PAL_M60: r->macro = 4; break; } } void data_setup_nomux_bt (TVSettings *s, TVRegs *r) { float f; r->enc.bt.hsynoffset += s->tv_hoffset * 2; f = (1.0 + 0.01 * s->contrast_sig) * r->enc.bt.my; if (f < 0.0) f = 0.0; if (f > 255.0) f = 255.0; r->enc.bt.my = (int) f; f = (1.0 + 0.01 * s->saturation_sig) * r->enc.bt.mcr; if (f < 0.0) f = 0.0; if (f > 255.0) f = 255.0; r->enc.bt.mcr = (int) f; f = (1.0 + 0.01 * s->saturation_sig) * r->enc.bt.mcb; if (f < 0.0) f = 0.0; if (f > 255.0) f = 255.0; r->enc.bt.mcb = (int) f; r->enc.bt.yattenuate = 7 - data_pick (s->contrast, 8, clamp_attenuate); r->enc.bt.cattenuate = 7 - data_pick (s->saturation, 8, clamp_attenuate); f = s->phase * 256.0 / 360.0; if (f < 0.0) f += 256.0; if (f < 0.0) f = 0.0; if (f > 255.0) f = 255.0; r->enc.bt.phase_off = (int) f; r->enc.bt.flags2 &= ~BT_FLAG2_DIS_FFILT; switch (data_pick (s->flicker, 5, clamp_flicker)) { case 0: r->enc.bt.flags2 |= BT_FLAG2_DIS_FFILT; break; case 1: r->enc.bt.f_sely = 1; r->enc.bt.f_selc = 1; break; case 2: r->enc.bt.f_sely = 2; r->enc.bt.f_selc = 1; break; case 3: r->enc.bt.f_sely = 3; r->enc.bt.f_selc = 2; break; case 4: r->enc.bt.f_sely = 0; r->enc.bt.f_selc = 4; break; } /* There is a special case here: For v_scale values less then 4096, f_sely = 3 gives bad results, so set it to 2 in this case */ if (r->enc.bt.v_scale < 4096 && r->enc.bt.f_sely == 3) { r->enc.bt.f_sely = 2; } switch (data_pick (s->luma_bandwidth, 4, clamp_luma_bandwidth)) { case 0: r->enc.bt.ylpf = 2; break; case 1: r->enc.bt.ylpf = 3; break; case 2: r->enc.bt.ylpf = 1; break; case 3: r->enc.bt.ylpf = 0; break; } switch (data_pick (s->chroma_bandwidth, 3, clamp_chroma_bandwidth)) { case 0: r->enc.bt.clpf = 2; break; case 1: r->enc.bt.clpf = 3; break; case 2: r->enc.bt.clpf = 0; break; } r->enc.bt.macro = (r->enc.bt.macro & ~0x3) | ((s->flags & TV_DESC_MACROVISION) ? 1 : 0); if (s->flags & TV_DESC_CARRIER_LOCK) { r->enc.bt.flags1 |= BT_FLAG1_DIS_SCRESET; } else { r->enc.bt.flags1 &= ~BT_FLAG1_DIS_SCRESET; } if (s->flags & TV_DESC_NONINTERLACED) { r->enc.bt.flags1 |= BT_FLAG1_NI_OUT; } else { r->enc.bt.flags1 &= ~BT_FLAG1_NI_OUT; } if (s->flags & TV_DESC_MONOCHROME) { r->enc.bt.flags2 |= BT_FLAG2_DIS_CHROMA; } else { r->enc.bt.flags2 &= ~BT_FLAG2_DIS_CHROMA; } r->enc.bt.flags3 &= ~BT_FLAG3_DAC; switch (s->connector) { case CONNECT_COMPOSITE: r->enc.bt.flags3 |= BT_FLAG3_COMPOSITE; break; case CONNECT_SVIDEO: r->enc.bt.flags3 |= BT_FLAG3_SVIDEO; break; case CONNECT_CONVERT: r->enc.bt.flags3 |= BT_FLAG3_CONVERT; r->enc.bt.out_muxa = 0; r->enc.bt.out_muxb = 0; r->enc.bt.out_muxc = 0; break; case CONNECT_BOTH: default: r->enc.bt.flags3 |= BT_FLAG3_BOTH; break; } /* FIXME dualview; */ } /* To be on the safe side, we have init/setup routines defaulting to the NV mux setup */ void data_init_bt (TVSystem system, TVBtRegs *r) { data_mux_nv_bt (r); data_init_nomux_bt (system, r); } void data_setup_bt (TVSettings *s, TVRegs *r) { data_mux_nv_bt (&r->enc.bt); data_setup_nomux_bt (s, r); } /* Setup: Coring = clamp value below threshold X/Y Pos horiz instead of vertical (smaller field) Macrovision mode CH regs/BT Flags Interlace, doublescan -> CRT Regs Async modes: en_async set dis_scrst ??? */ /* PAL-60: 640x480 16x16/13x13 12x7/10x8 6x0/2x1 16.758 x 14.815 10.592 x 08.230 01.469 x 01.235 800x600 14x13/21x11 10x5/11x5 0x0/7x0 16.180 x 13.992 720x480 0x0 */ nvtv-0.4.7/src/data_cx.c0000644000175000001440000004350507660263500010545 /* NVTV Conexant chip data -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_cx.c,v 1.19 2003/05/13 21:44:32 dthierbach Exp $ * * Contents: * * Data tables and routines for the Conexant chip. * */ #include "local.h" /* before everything else */ #include #include #include "data_bt.h" #include "data_cx.h" #include "data_nv.h" /* -------- CX -------- NTSC -------- */ /* FIXME I do not know if all XBoxes have the CX encoder. For now, we keep the one known BIOS mode here. */ /* -------- 640x480 XBox -------- */ TVCxRegs cx_ntsc_xbox = { /* XBox BIOS */ bt : { h_active : 648, h_blanki : 115, h_clki : 776, h_fract : 0, h_blanko : 237, h_clko : 1552, v_activei : 480, v_blanki : 36, v_linesi : 525, v_activeo : 242, v_blanko : 19, v_scale : 4096, pll_fract : 55912, pll_int : 10, hsynoffset : 0, vsynoffset : 0, hsynwidth : 15, vsynwidth : 1, hsync_width : 114, hburst_begin : 133, hburst_end : 68, sync_amp : 228, bst_amp : 124, mcr : 203, mcb : 143, my : 154, msc : 629578002, flags1 : CX_FLAG1_EXT | BT_FLAG1_NTSC, }, flags4 : 0, flags5 : 0, msc_db : 676059667, dr_limitp : 1443, dr_limitn : 1183, db_limitp : 1443, db_limitn : 1183, filfsconv : 0, filincr : 0, wsdat : 196608, wssinc : 19221, }; /* -------- 1024x768 3:2 -------- */ TVCxRegs cx_ntsc_small_a = { /* Mode 10, hoc=15.11 voc=14.81 */ bt : { hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2912, h_active : 1024, hsync_width : 216, hburst_begin : 242, hburst_end : 238, h_blanko : 625, v_blanko : 36, v_activeo : 208, h_fract : 0, h_clki : 1176, h_blanki : 133, v_linesi : 975, v_blanki : 130, v_activei : 768, v_scale : 11118, pll_fract : 35747, pll_int : 30, sync_amp : 229, bst_amp : 116, mcr : 119, mcb : 67, my : 133, msc : 335544320, flags1 : CX_FLAG1_EXT | BT_FLAG1_NTSC }, flags5 : CX_FLAG5_PLL_32CLK }; TVCxRegs cx_ntsc_normal_a = { /* Mode 26, hoc=11.97 voc=11.93 */ bt : { hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2808, h_active : 1024, hsync_width : 208, hburst_begin : 234, hburst_end : 224, h_blanko : 567, v_blanko : 33, v_activeo : 215, h_fract : 0, h_clki : 1170, h_blanki : 127, v_linesi : 945, v_blanki : 115, v_activei : 768, v_scale : 10650, pll_fract : 29789, pll_int : 29, sync_amp : 229, bst_amp : 116, mcr : 119, mcb : 67, my : 133, msc : 347971887, flags1 : CX_FLAG1_EXT | BT_FLAG1_NTSC }, flags5 : CX_FLAG5_PLL_32CLK }; TVCxRegs cx_ntsc_tiny_a = { /* Mode 42, hoc=18.04 voc=18.11 */ bt : { hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 3016, h_active : 1024, hsync_width : 224, hburst_begin : 252, hburst_end : 250, h_blanko : 683, v_blanko : 40, v_activeo : 200, h_fract : 0, h_clki : 1170, h_blanki : 127, v_linesi : 1015, v_blanki : 150, v_activei : 768, v_scale : 11742, pll_fract : 41704, pll_int : 31, sync_amp : 229, bst_amp : 116, mcr : 119, mcb : 67, my : 133, msc : 323973826, flags1 : CX_FLAG1_EXT | BT_FLAG1_NTSC }, flags5 : CX_FLAG5_PLL_32CLK }; /* -------- 800x600 3:2 -------- */ TVCxRegs cx_ntsc_small_b = { /* Mode 18, hoc=13.79 voc=13.58 */ bt : { hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2240, h_active : 800, hsync_width : 166, hburst_begin : 186, hburst_end : 152, h_blanko : 473, v_blanko : 34, v_activeo : 212, h_fract : 0, h_clki : 1176, h_blanki : 329, v_linesi : 750, v_blanki : 94, v_activei : 600, v_scale : 7607, pll_fract : 32539, pll_int : 23, sync_amp : 229, bst_amp : 116, mcr : 120, mcb : 67, my : 133, msc : 436207616, flags1 : CX_FLAG1_EXT | BT_FLAG1_NTSC }, flags5 : CX_FLAG5_PLL_32CLK }; TVCxRegs cx_ntsc_tiny_b = { /* Mode 34, hoc=19.26 voc=19.34 */ bt : { hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2392, h_active : 800, hsync_width : 176, hburst_begin : 200, hburst_end : 172, h_blanko : 557, v_blanko : 42, v_activeo : 197, h_fract : 0, h_clki : 1170, h_blanki : 323, v_linesi : 805, v_blanki : 125, v_activei : 600, v_scale : 8465, pll_fract : 5958, pll_int : 25, sync_amp : 229, bst_amp : 116, mcr : 119, mcb : 67, my : 133, msc : 408488737, flags1 : CX_FLAG1_EXT | BT_FLAG1_NTSC }, flags5 : CX_FLAG5_PLL_32CLK }; TVCxRegs cx_ntsc_mini_b = { /* Mode 40, hoc=15.59 voc=15.64 */ bt : { hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2288, h_active : 800, hsync_width : 170, hburst_begin : 190, hburst_end : 158, h_blanko : 499, v_blanko : 37, v_activeo : 206, h_fract : 0, h_clki : 1170, h_blanki : 323, v_linesi : 770, v_blanki : 105, v_activei : 600, v_scale : 7919, pll_fract : 0, pll_int : 24, sync_amp : 229, bst_amp : 116, mcr : 120, mcb : 67, my : 133, msc : 427056407, flags1 : CX_FLAG1_EXT | BT_FLAG1_NTSC }, flags5 : CX_FLAG5_PLL_32CLK }; /* -------- CX -------- PAL -------- */ /* -------- 1024x768 3:2 -------- */ TVCxRegs cx_pal_small_a = { /* Mode 11, hoc=13.44 voc=14.24 */ bt : { hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 2912, h_active : 1024, hsync_width : 214, hburst_begin : 254, hburst_end : 230, h_blanko : 647, v_blanko : 43, v_activeo : 248, h_fract : 0, h_clki : 1400, h_blanki : 329, v_linesi : 975, v_blanki : 131, v_activei : 768, v_scale : 8684, pll_fract : 21845, pll_int : 30, sync_amp : 240, bst_amp : 86, mcr : 127, mcb : 71, my : 140, msc : 418510935, flags1 : CX_FLAG1_EXT | BT_FLAG1_PAL_BDGHI, }, flags5 : CX_FLAG5_PLL_32CLK }; TVCxRegs cx_pal_mini_a = { /* Mode 43, hoc=16.20 voc=16.67 */ bt : { hsynoffset : 0, vsynoffset : 0, hsynwidth : 2, vsynwidth : 1, h_clko : 3008, h_active : 1024, hsync_width : 220, hburst_begin : 264, hburst_end : 240, h_blanko : 703, v_blanko : 47, v_activeo : 241, h_fract : 0, h_clki : 1410, h_blanki : 337, v_linesi : 1000, v_blanki : 147, v_activei : 768, v_scale : 9011, pll_fract : 21845, pll_int : 31, sync_amp : 240, bst_amp : 86, mcr : 126, mcb : 71, my : 140, msc : 405154203, flags1 : CX_FLAG1_EXT | BT_FLAG1_PAL_BDGHI }, flags5 : CX_FLAG5_PLL_32CLK }; /* -------- -------- */ #define two_to_32 4294967296.0 #define two_to_26 67108864.0 #define two_to_20 1048576.0 #define two_to_13 8192.0 #define PI 3.14159265358979323846 static int clamp_attenuate[8] = {-100, -90, -75, -50, -30, -20, -10, 0}; static int clamp_flicker[5] = {0, 25, 50, 75, 100}; static int clamp_flicker_adapt[6] = {0, 20, 40, 60, 80, 100}; static int clamp_sharpness[4] = {0, 30, 60, 100}; static int clamp_luma_bandwidth[4] = {0, 30, 60, 100}; static int clamp_chroma_bandwidth[3] = {0, 50, 100}; static int clamp_cross_color[2] = {0, 100}; /* Convert PAL to SECAM */ void data_secam_cx (TVCxRegs *r) { double Fxtal = 13500000; double Fclk; double Fsc_r = 4406250; /* Hz, 'for' in Table A-1 */ double Fsc_b = 4250000; /* Hz, 'fob' in Table A-1 */ register double f; register int i; Fclk = Fxtal * (r->bt.pll_int + r->bt.pll_fract / 65536.0) / 6.0; if ((r->bt.flags1 & CX_FLAG1_EXT) && (r->flags5 & CX_FLAG5_PLL_32CLK)) { Fclk *= 2.0/3.0; } f = PI * Fsc_r / Fclk; f = 288036.0 * r->bt.h_clko * sin(f) / f; r->bt.mcr = (int) ((920.26 / f) * two_to_26 + 0.5); f = PI * Fsc_b / Fclk; f = 288036.0 * r->bt.h_clko * sin(f) / f; r->bt.mcb = (int) ((598.15 / f) * two_to_26 + 0.5); r->bt.msc = (unsigned long) ((282.0 / r->bt.h_clko) * two_to_32 + 0.5); r->msc_db = (unsigned long) ((272.0 / r->bt.h_clko) * two_to_32 + 0.5); r->dr_limitp = r->db_limitp = (int) (4.756e6 / Fclk * two_to_13 + 0.5); r->dr_limitn = r->db_limitn = (int) (3.900e6 / Fclk * two_to_13 + 0.5); i = (int) (8192 * 4.286 * 1728 / (27 * r->bt.h_clko) + 0.5); r->filincr = ((i >> 1) & 0xff) ^ 0xff; r->filfsconv = (int) ((27 * r->bt.h_clko * 1.087) / 1728.0 + 0.5); r->bt.flags1 &= ~(BT_FLAG1_PAL_MD | BT_FLAG1_VSYNC_DUR); r->bt.flags1 |= CX_FLAG1_FM; /* FIXME use dis_scrst? */ } void data_init_cx (TVSystem system, TVCxRegs *r, int btmode) { double Fxtal = 13500000; double Fclk; if (!r) return; data_mux_nv_bt (&r->bt); data_init_nomux_bt (system, &r->bt); /* Zero extra stuff if it comes from a BT template */ if (btmode) { r->flags4 = 0; r->flags5 = 0; r->wsdat = 0; } Fclk = Fxtal * (r->bt.pll_int + r->bt.pll_fract / 65536.0) / 6.0; if (r->flags5 & CX_FLAG5_PLL_32CLK) { Fclk *= 2.0/3.0; } r->mcompu = 128; /* default, scale 1.0 */ r->mcompv = 128; /* default, scale 1.0 */ r->mcompy = 128; /* default, scale 1.0 */ if (system != TV_SYSTEM_SECAM) { r->msc_db = 0; r->dr_limitp = 0; r->dr_limitn = 0; r->db_limitp = 0; r->db_limitn = 0; r->filfsconv = 0; r->filincr = 0; } r->y_off = 0; /* default */ r->y_thresh = 0; /* default */ r->hue_adj = 0; if (r->bt.flags1 & BT_FLAG1_625LINE) { /* FIXME: doc says 200E-9 = 0.2E-6, which overflows */ r->wssinc = (int) two_to_20 / (2.000E-6 * Fclk); } else { r->wssinc = (int) two_to_20 / (2.234E-6 * Fclk); } r->c_altff = 0; r->y_altff = 0; r->c_thresh = 0; r->y_thresh = 0; } void data_default_cx (TVSettings *s) { s->tv_hoffset = s->mon_hoffset = 0; s->tv_voffset = s->mon_voffset = 0; s->brightness_sig = 0; s->contrast_sig = 0; s->saturation_sig = 0; s->contrast = 0; s->saturation = 0; s->phase = 0; s->hue = 0; s->flicker = 75; /* FIXME: default depends on mode */ s->flicker_adapt = 0; /* FIXME: default depends on mode */ s->sharpness = 0; s->cross_color = 100; s->luma_bandwidth = 30; s->chroma_bandwidth = 100; /* FIXME s->flags; */ } void data_clamp_cx (TVSettings *s, TVRegs *r) { if (s->tv_hoffset <= -100) s->tv_hoffset = -100; if (s->tv_hoffset >= 100) s->tv_hoffset = 100; if (s->tv_voffset <= -100) s->tv_voffset = -100; if (s->tv_voffset >= 100) s->tv_voffset = 100; if (s->mon_hoffset <= -100) s->mon_hoffset = -100; if (s->mon_hoffset >= 100) s->mon_hoffset = 100; if (s->mon_voffset <= -100) s->mon_voffset = -100; if (s->mon_voffset >= 100) s->mon_voffset = 100; s->tv_voffset = 0; /* FIXME. Clamp to 0 for now, until some 'VTotal magic' */ if (s->brightness_sig < -50) s->brightness_sig = -50; if (s->brightness_sig > 50) s->brightness_sig = 50; if (s->contrast_sig < -50) s->contrast_sig = -50; if (s->contrast_sig > 50) s->contrast_sig = 50; if (s->saturation_sig < -50) s->saturation_sig = -50; if (s->saturation_sig > 50) s->saturation_sig = 50; if (s->phase < -180) s->phase = -180; if (s->phase > 180) s->phase = 180; if (s->hue < -180) s->hue = -180; if (s->hue > 180) s->hue = 180; s->contrast = data_clamp (s->contrast, 8, clamp_attenuate); s->saturation = data_clamp (s->saturation, 8, clamp_attenuate); s->sharpness = data_clamp (s->sharpness, 4, clamp_sharpness); s->flicker = data_clamp (s->flicker, 5, clamp_flicker); s->flicker_adapt = data_clamp (s->flicker_adapt, 6, clamp_flicker_adapt); s->cross_color = data_clamp (s->cross_color, 2, clamp_cross_color); s->chroma_bandwidth = data_clamp (s->chroma_bandwidth, 3, clamp_chroma_bandwidth); s->luma_bandwidth = data_clamp (s->luma_bandwidth, 4, clamp_luma_bandwidth); /* FIXME: Operate on mode flags */ } /* Only for nv, does wrong setup for tdfx */ void data_setup_cx (TVSettings *s, TVRegs *r) { float f; data_mux_nv_bt (&r->enc.bt); data_setup_nomux_bt (s, r); r->enc.cx.y_off = s->brightness_sig & 0xff; f = s->hue * 256.0 / 360.0; if (f < 0.0) f += 256.0; if (f < 0.0) f = 0.0; if (f > 255.0) f = 255.0; r->enc.cx.hue_adj = (int) f; r->enc.cx.flags5 &= ~(CX_FLAG5_ADPT_FF | CX_FLAG5_FFRTN | CX_FLAG5_YSELECT); switch (data_pick (s->flicker_adapt, 6, clamp_flicker_adapt)) { case 0: break; case 1: r->enc.cx.y_altff = 3; /* 4 line */ r->enc.cx.c_altff = 3; /* 4 line */ r->enc.cx.y_thresh = 0; r->enc.cx.c_thresh = 0; r->enc.cx.flags5 |= CX_FLAG5_ADPT_FF | CX_FLAG5_FFRTN | CX_FLAG5_YSELECT; break; case 2: r->enc.cx.y_altff = 3; /* 4 line */ r->enc.cx.c_altff = 3; /* 4 line */ r->enc.cx.y_thresh = 4; r->enc.cx.c_thresh = 4; r->enc.cx.flags5 |= CX_FLAG5_ADPT_FF; break; case 3: r->enc.cx.y_altff = 0; /* 5 line */ r->enc.cx.c_altff = 0; /* 5 line */ r->enc.cx.y_thresh = 2; r->enc.cx.c_thresh = 2; r->enc.cx.flags5 |= CX_FLAG5_ADPT_FF | CX_FLAG5_FFRTN; break; case 4: r->enc.cx.y_altff = 0; /* 5 line */ r->enc.cx.c_altff = 0; /* 5 line */ r->enc.cx.y_thresh = 4; r->enc.cx.c_thresh = 4; r->enc.cx.flags5 |= CX_FLAG5_ADPT_FF | CX_FLAG5_YSELECT; break; case 5: r->enc.cx.y_altff = 0; /* 5 line */ r->enc.cx.c_altff = 0; /* 5 line */ r->enc.cx.y_thresh = 6; r->enc.cx.c_thresh = 6; r->enc.cx.flags5 |= CX_FLAG5_ADPT_FF | CX_FLAG5_FFRTN | CX_FLAG5_YSELECT; break; } r->enc.cx.pkfil_sel = data_pick (s->sharpness, 4, clamp_sharpness); if (s->cross_color) { r->enc.cx.flags4 |= CX_FLAG4_BY_YCCR; } else { r->enc.cx.flags4 &= ~CX_FLAG4_BY_YCCR; } /* FIXME chroma_bandwidth: CX_FLAG4_CHROMA_BW */ } /* Setup: BT CX add. CH PH ------------ --------- ------------- --------- Brightness - y_off blr blckl Contrast yattenuate ce gy (Signal) my - - Saturation cattenuate - gcd (Signal) mcr,mcb - gainu,gainv Phase phase_off - chps Hue - hue_adj - - Flicker f_sely/c, ffr_{fc,fy}, (-) dis_ffilt vbw_flff Adaptive - adpt_ff - - C-Bandwidth clpf chroma_bw cbw scbw Y-Bandwidth ylpf ycv,ysv,ypeak - Sharpness - pkfil_sel ffr_ft yfil CrossColRed - by_yccr - ccrs Noninterlace ni_out - flc Monochrome dis_chroma vbw_cvbw - CarrierReset phres Coring {y,c}_coring - - Ticks: BT CX CH PH Brightness -50-50 - oo oo oo lock to contrast? Contrast -100-100 8 8 4+4 32 (Signal) -50-50 oo oo - - Saturation -100-100 8 8 - 32 (Signal) -50-50 oo oo - oo Phase 360 360 - 360 spin? -180 - 180 Hue - 360 - spin? -180 - 180 Flicker 0-100 5 5 5 (oo) Flicker2 0-100 - 6 - - Chroma-Bandw 0-100 3 3*2 4 2 Luma-Bandw 0-100 4*2 4*2 3*2 - Sharpness 0-100 - 4 3 Cross Color - 2 4 Carrier Reset 2 2 4 Non-Interlace x x - - Monochrome x x x ? Macrovision 2/4 2/4 2/4 2/4 Signals x x - x Coring 7+1 7+1 - - Buttons: Dualview, Macrovision, Non-Interlace, Monochrome, Carrier Reset, Distort (Signals) Not used: * Coring, Clipping (eclip, ycoring, ccoring) * Complete disable: dis_yflpf * Phase: phase_off (0-360), dis_scrst, hue_adj (0-360), * Adaptive flicker * y_off (CX only) Philips: DACF/R,G,BDACC (maybe shouldn't use these) Alternate FF: adpt_ff y_altff >= f_sely c_altff >= f_selc y_thresh c_thresh yselect */ /* Init: SECAM: vsync_dur 0 625line 1 setup 0 pal_md 0 dis_scrst 1 fm 1 verify against modes on p. 1-70 */ nvtv-0.4.7/src/data_ch.c0000644000175000001440000007043710006415005010514 /* NVTV Chrontel chip data -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_ch.c,v 1.33 2004/01/30 08:47:01 dthierbach Exp $ * * Contents: * * Data tables and setup routines for the Chrontel chip. */ #include "local.h" /* before everything else */ #include #include #include #include "nv_type.h" #include "data_ch.h" #define fsci_t unsigned long /* Absolute overscan (CH2 docs have it negative) to name: -4 0 4 6 10 13 14 16 17 18 20 22 25 27 30 33 cjlm abfhn e d f aikn cd ej glm abn fh d e cl bikm g <--Huge----> <----Small---> <--------Tiny---------> TODO: Rename some large to huge modes, and calculate overscan properly FIX calc overscan NTSC 640x480 640x400 720x400 PAL 800x600 640x480 CH1: a = 640x480 b = 800x600 c = 640x400 d = 720x400 e = 512x384 f = DVD (800x600) 768x576 g = DVD (800x600) 800x450 CH2: a = 1024x768 b = 800x600 c = 720x480 d = 720x576 */ /* -------- CH1 -------- NTSC -------- */ /* FSCI: NTSC, NTSC-NDC, PAL-M, PAL-60 */ /* PAL-60 is just scaled up PAL-M */ /* -------- 640x480 -------- */ TVChRegs ch1_ntsc_huge_a = { /* Mode 16: 640x480 1:1 */ dmr_ir : 3, dmr_vs : 1, dmr_sr : 1, sav : 154, /* tvcc: 92 */ hpr : 26, /* tvcc: 31 */ vpr : 0, /* tvcc: 260 */ pll_m : 63, pll_n : 110, pllcap : 0, dacg : 0, mode : 16, }; fsci_t ch1_fsci_ntsc_huge_a [] = {623153737, 623156346, 622468953, 770448543}; TVChRegs ch1_ntsc_small_a = { /* Mode 17: 640x480 7:8 */ dmr_ir : 3, dmr_vs : 1, dmr_sr : 2, sav : 160, /* tvcc: 92 */ hpr : 46, /* tvcc: 47 */ vpr : 0, /* tvcc: 245 */ pll_m : 63, pll_n : 126, pllcap : 0, dacg : 0, mode : 17, }; fsci_t ch1_fsci_ntsc_small_a [] = {545259520, 545261803, 544660334, 674142475}; TVChRegs ch1_ntsc_tiny_a = { /* Mode 18: 640x480 5:6 */ dmr_ir : 3, dmr_vs : 1, dmr_sr : 3, sav : 170, hpr : 54, vpr : 0, pll_m : 89, pll_n : 190, pllcap : 0, dacg : 0, mode : 18, }; fsci_t ch1_fsci_ntsc_tiny_a [] = {508908885, 508911016, 508349645, 629199644}; /* -------- 800x600 -------- */ TVChRegs ch1_ntsc_huge_b = { /* Mode 22: 800x600 5:6 */ dmr_ir : 4, dmr_vs : 1, dmr_sr : 3, sav : 234, hpr : 32, vpr : 258, pll_m : 33, pll_n : 94, pllcap : 1, dacg : 0, mode : 22, }; fsci_t ch1_fsci_ntsc_huge_b [] = {521957831, 521960016, 521384251, 645332967}; TVChRegs ch1_ntsc_large_b = { /* Mode 23: 800x600 3:4 */ dmr_ir : 4, dmr_vs : 1, dmr_sr : 4, sav : 208, /* tvcc: 140 */ hpr : 47, /* tvcc: 47 */ vpr : 0, /* tvcc: 266 */ pll_m : 19, pll_n : 62, pllcap : 1, dacg : 0, mode : 23, }; fsci_t ch1_fsci_ntsc_large_b [] = {469762048, 469764015, 469245826, 580799671}; TVChRegs ch1_ntsc_small_b = { /* Mode 24: 800x600 7:10 */ dmr_ir : 4, dmr_vs : 1, dmr_sr : 5, sav : 216, /* tvcc: 140 */ hpr : 60, /* tvcc: 61 */ vpr : 0, /* tvcc: 257 */ pll_m : 89, pll_n : 302, pllcap : 0, dacg : 0, mode : 24, }; fsci_t ch1_fsci_ntsc_small_b [] = {428554851, 428556645, 428083911, 529852331}; /* -------- 640x400 -------- */ TVChRegs ch1_ntsc_huge_c = { /* Mode 10: 640x400 5:4 */ dmr_ir : 2, dmr_vs : 1, dmr_sr : 0, sav : 150, hpr : 90, vpr : 0, pll_m : 63, pll_n : 94, pllcap : 1, dacg : 0, mode : 10, }; fsci_t ch1_fsci_ntsc_huge_c [] = {646233505, 646236211, 645523358, 798983674}; TVChRegs ch1_ntsc_small_c = { /* Mode 11: 640x400 1:1 */ dmr_ir : 2, dmr_vs : 1, dmr_sr : 1, sav : 194, hpr : 53, vpr : 0, pll_m : 11, pll_n : 22, pllcap : 1, dacg : 0, mode : 11, }; fsci_t ch1_fsci_ntsc_small_c [] = {516986804, 516988968, 516418687, 639186940}; TVChRegs ch1_ntsc_tiny_c = { /* Mode 12: 640x400 7:8 */ dmr_ir : 2, dmr_vs : 1, dmr_sr : 3, sav : 194, hpr : 68, vpr : 0, pll_m : 89, pll_n : 190, pllcap : 0, dacg : 0, mode : 12, }; fsci_t ch1_fsci_ntsc_tiny_c [] = {452363454, 452365347, 451866351, 559288572}; /* -------- 720x400 -------- */ TVChRegs ch1_ntsc_huge_d = { /* Mode 6: 720x400 5:4 */ dmr_ir : 1, dmr_vs : 1, dmr_sr : 0, sav : 210, hpr : 26, vpr : 256, pll_m : 63, pll_n : 106, pllcap : 1, dacg : 0, mode : 6, }; fsci_t ch1_fsci_ntsc_huge_d [] = {574429782, 574432187, 573798541, 710207711}; TVChRegs ch1_ntsc_small_d = { /* Mode 7: 720x400 1:1 */ dmr_ir : 1, dmr_vs : 1, dmr_sr : 1, sav : 208, hpr : 59, vpr : 260, pll_m : 33, pll_n : 70, pllcap : 1, dacg : 0, mode : 7, }; fsci_t ch1_fsci_ntsc_small_d [] = {463962517, 463964459, 463452668, 573629305}; /* -------- 512x384 -------- */ TVChRegs ch1_ntsc_large_e = { /* Mode 2: 512x384 5:4 */ dmr_ir : 0, dmr_vs : 1, dmr_sr : 0, sav : 240, hpr : 27, vpr : 256, pll_m : 89, pll_n : 126, pllcap : 1, dacg : 0, mode : 2, }; fsci_t ch1_fsci_ntsc_large_e [] = {763363328, 763366524, 762524467, 943799465}; TVChRegs ch1_ntsc_small_e = { /* Mode 3: 512x384 1:1 */ dmr_ir : 0, dmr_vs : 1, dmr_sr : 1, sav : 226, hpr : 47, vpr : 0, pll_m : 63, pll_n : 110, pllcap : 0, dacg : 0, mode : 3, }; fsci_t ch1_fsci_ntsc_small_e [] = {623153737, 623156346, 622468953, 770448543}; /* -------- DVD convenience modes -------- */ /* For use with video scaler, 768x576 for 4:3, 800x450 for 16:9, if DVD is in 720x576. For 720x480, use 640x480 modes. Based on 800x600 NTSC Large (Mode 23) */ TVChRegs ch1_ntsc_large_f = { /* Mode 23: 800x600 3:4 */ dmr_ir : 4, dmr_vs : 1, dmr_sr : 4, sav : 208, hpr : 43, vpr : 260, pll_m : 19, pll_n : 62, pllcap : 1, dacg : 0, mode : 23, }; TVChRegs ch1_ntsc_large_g = { /* Mode 23: 800x600 3:4 */ dmr_ir : 4, dmr_vs : 1, dmr_sr : 4, sav : 208, hpr : 45, vpr : 262, pll_m : 19, pll_n : 62, pllcap : 1, dacg : 0, mode : 23, }; /* Use ch1_fsci_ntsc_large_b */ /* -------- 720x{576,480} DVD -------- */ /* Note: Not used yet, crt values not tested */ TVChRegs ch1_ntsc_interl_dvd = { /* Mode 26: 720x480 IL */ dmr_ir : 5, dmr_vs : 1, dmr_sr : 1, sav : 142, hpr : 60, vpr : 0, pll_m : 33, pll_n : 31, pllcap : 1, dacg : 0, fsci : 569408543, /* NDC: 569410927 */ mode : 26, }; /* Note: Mode 26 must use 2X XClk. So need to program that. For CRT, need to use double hscan, and interlace. */ /* -------- CH1 -------- PAL -------- */ /* FSCI: PAL, PAL-N, PAL-X */ /* -------- 640x480 -------- */ TVChRegs ch1_pal_huge_a = { /* Mode 13: 640x480 5:4 */ dmr_ir : 3, dmr_vs : 0, dmr_sr : 0, sav : 142, hpr : 37, vpr : 308, pll_m : 13, pll_n : 20, pllcap : 1, dacg : 1, mode : 13, }; fsci_t ch1_fsci_pal_huge_a [] = {806021060, 651209077, 806120400}; TVChRegs ch1_pal_small_a = { /* Mode 14: 640x480 1:1 */ dmr_ir : 3, dmr_vs : 0, dmr_sr : 1, sav : 110, /* tvcc: 100 */ hpr : 52, /* tvcc: 53 */ vpr : 289, /* tvcc: 291 */ pll_m : 4, pll_n : 9, pllcap : 1, dacg : 1, mode : 14, }; fsci_t ch1_fsci_pal_small_a [] = {644816848, 520967262, 644862000}; TVChRegs ch1_pal_tiny_a = { /* Mode 15: 640x480 5:6 */ dmr_ir : 3, dmr_vs : 0, dmr_sr : 3, sav : 110, hpr : 78, vpr : 4, pll_m : 3, pll_n : 9, pllcap : 1, dacg : 1, mode : 15, }; fsci_t ch1_fsci_pal_tiny_a [] = {537347373, 434139385, 537430027}; /* -------- 800x600 -------- */ TVChRegs ch1_pal_huge_b = { /* Mode 19: 800x600 1:1 */ dmr_ir : 4, dmr_vs : 0, dmr_sr : 1, sav : 176, /* tvcc: 122 */ hpr : 31, /* tvcc: 33 */ vpr : 0, /* tvcc: 308 */ pll_m : 313, pll_n : 647, pllcap : 0, dacg : 1, mode : 19, }; fsci_t ch1_fsci_pal_huge_b [] = {645499916, 521519134, 645527100}; TVChRegs ch1_pal_small_b = { /* Mode 20: 800x600 5:6 */ dmr_ir : 4, dmr_vs : 0, dmr_sr : 3, sav : 166, /* tvcc: 124 */ hpr : 60, /* tvcc: 73 */ vpr : 0, /* tvcc: 296 */ pll_m : 33, pll_n : 86, pllcap : 1, dacg : 1, mode : 20, }; fsci_t ch1_fsci_pal_small_b [] = {528951320, 427355957, 529002000}; TVChRegs ch1_pal_tiny_b = { /* Mode 21: 800x600 3:4 */ dmr_ir : 4, dmr_vs : 0, dmr_sr : 4, sav : 90, hpr : 70, vpr : 0, pll_m : 103, pll_n : 284, pllcap : 0, dacg : 1, mode : 21, }; fsci_t ch1_fsci_pal_tiny_b [] = {488262757, 394482422, 488330000}; /* Note: Mode 21 has 627 PAL lines instead of 625 */ /* -------- 640x400 -------- */ TVChRegs ch1_pal_small_c = { /* Mode 8: 640x400 5:4 */ dmr_ir : 2, dmr_vs : 0, dmr_sr : 0, sav : 226, hpr : 47, vpr : 0, pll_m : 61, pll_n : 108, pllcap : 0, dacg : 1, mode : 8, }; fsci_t ch1_fsci_pal_small_c [] = {677057690, 547015625, 677157690}; TVChRegs ch1_pal_tiny_c = { /* Mode 9: 640x400 1:1 */ dmr_ir : 2, dmr_vs : 0, dmr_sr : 1, sav : 230, hpr : 80, vpr : 0, pll_m : 3, pll_n : 9, pllcap : 1, dacg : 1, mode : 9, }; fsci_t ch1_fsci_pal_tiny_c [] = {537347373, 434139385, 537447373}; /* -------- 720x400 -------- */ TVChRegs ch1_pal_small_d = { /* Mode 4: 720x400 5:4 */ dmr_ir : 1, dmr_vs : 0, dmr_sr : 0, sav : 346, hpr : 53, vpr : 0, pll_m : 26, pll_n : 53, pllcap : 1, dacg : 1, mode : 4, }; fsci_t ch1_fsci_pal_small_d [] = {601829058, 486236111, 601879058}; TVChRegs ch1_pal_tiny_d = { /* Mode 5: 720x400 1:1 */ dmr_ir : 1, dmr_vs : 0, dmr_sr : 1, sav : 322, hpr : 86, vpr : 0, pll_m : 138, pll_n : 339, pllcap : 0, dacg : 1, mode : 5, }; fsci_t ch1_fsci_pal_tiny_d [] = {485346014, 392125896, 485446014}; /* -------- 512x384 -------- */ TVChRegs ch1_pal_small_e = { /* Mode 0: 512x384 5:4 */ dmr_ir : 0, dmr_vs : 0, dmr_sr : 0, sav : 256, hpr : 43, vpr : 0, pll_m : 13, pll_n : 20, pllcap : 1, dacg : 1, mode : 0, }; fsci_t ch1_fsci_pal_small_e [] = {806021060, 651209077, 806121060}; TVChRegs ch1_pal_tiny_e = { /* Mode 1: 512x384 1:1 */ dmr_ir : 0, dmr_vs : 0, dmr_sr : 1, sav : 266, hpr : 69, vpr : 0, pll_m : 4, pll_n : 9, pllcap : 1, dacg : 1, mode : 1, }; fsci_t ch1_fsci_pal_tiny_e [] = {644816848, 520967262, 644916848}; /* -------- DVD convenience modes -------- */ /* For use with video scaler, 768x576 for 4:3, 800x450 for 16:9, if DVD is in 720x576. For 720x480, use 640x480 modes. Based on 800x600 PAL Large (Mode 19) and Small (Mode 20), as the large mode is buggy (color flickers). */ TVChRegs ch1_pal_large_f = { /* Mode 19: 800x600 1:1 */ dmr_ir : 4, dmr_vs : 0, dmr_sr : 1, sav : 176, hpr : 34, vpr : 311, pll_m : 313, pll_n : 647, pllcap : 0, dacg : 1, mode : 19, }; TVChRegs ch1_pal_large_g = { /* Mode 19: 800x600 1:1 */ dmr_ir : 4, dmr_vs : 0, dmr_sr : 1, sav : 176, hpr : 31, vpr : 312, pll_m : 313, pll_n : 647, pllcap : 0, dacg : 1, mode : 19, }; /* Use ch1_fsci_pal_large_b */ TVChRegs ch1_pal_small_f = { /* Mode 20: 800x600 5:6 */ dmr_ir : 4, dmr_vs : 0, dmr_sr : 3, sav : 210, hpr : 68, vpr : 312, pll_m : 33, pll_n : 86, pllcap : 1, dacg : 1, mode : 20, }; TVChRegs ch1_pal_small_g = { /* Mode 20: 800x600 5:6 */ dmr_ir : 4, dmr_vs : 0, dmr_sr : 3, sav : 188, hpr : 64, vpr : 312, pll_m : 33, pll_n : 86, pllcap : 1, dacg : 1, mode : 20, }; /* Use ch1_fsci_pal_small_b */ /* -------- 720x{576,480} DVD -------- */ TVChRegs ch1_pal_interl_dvd = { /* Mode 25: 720x576 IL */ dmr_ir : 5, dmr_vs : 0, dmr_sr : 1, sav : 142, hpr : 60, vpr : 0, pll_m : 33, pll_n : 31, pllcap : 1, dacg : 1, fsci : 705268427, mode : 25, }; /* Note: Mode 25 must use 2X XClk. So need to program that. For CRT, need to use double hscan, and interlace. */ /* -------- CH2 -------- NTSC -------- */ /* Need Modes 19-38; the rest is identical to CH1 modes */ /* Are modes 37/38 interlaced */ #if 0 TVChRegs ch2_ntsc_huge_c = { /* Mode 19: 720x480 / 882x525 1:1 oc 0 */ dmr_ir : 4, dmr_sr : 1, pll_n : 124, pll_m : 63, pllcap : 0, mode : 19 }; TVChRegs ch2_ntsc_small_c = { /* Mode 20: 720x480 / 882x600 7:8 oc -13 */ dmr_ir : 4, dmr_sr : 2, pll_n : 142, pll_m : 63, pllcap : 0, mode : 20 }; TVChRegs ch2_ntsc_tiny_c = { /* Mode 21: 720x480 / 900x630 5:6 oc -18 */ dmr_ir : 4, dmr_sr : 3, pll_n : 214, pll_m : 89, pllcap : 0, mode : 21 }; TVChRegs ch2_ntsc_large_b = { /* Mode 28: 800x600 / 1040x700 3:4 oc -6 */ dmr_ir : 6, dmr_sr : 6, pll_n : 62, pll_m : 19, pllcap : 1, mode : 28 }; TVChRegs ch2_ntsc_small_b = { /* Mode 29: 800x600 / 1064x750 7:10 oc -14 */ dmr_ir : 6, dmr_sr : 7, pll_n : 302, pll_m : 89, pllcap : 0, mode : 29 }; TVChRegs ch2_ntsc_tiny_b = { /* Mode 30: 800x600 / 1040x840 5:8 oc -22 */ dmr_ir : 6, dmr_sr : 5, pll_n : 126, pll_m : 33, pllcap : 1, mode : 30 }; TVChRegs ch2_ntsc_huge_a = { /* Mode 34: 1024x768 / 1160x840 5:8 oc 0 */ dmr_ir : 7, dmr_sr : 5, pll_n : 565, pll_m : 137, pllcap : 0, mode : 34 }; TVChRegs ch2_ntsc_large_a = { /* Mode 35: 1024x768 / 1160x945 5:9 oc -10 */ dmr_ir : 7, dmr_sr : 6, pll_n : 333, pll_m : 71, pllcap : 0, mode : 35 }; TVChRegs ch2_ntsc_tiny_a = { /* Mode 36: 1024x768 / 1168x1050 1:2 oc -20 */ dmr_ir : 7, dmr_sr : 7, pll_n : 917, pll_m : 177, pllcap : 0, mode : 36 }; TVChRegs ch2_ntsc_dvd = { /* Mode 38: 720x480 / 858x525 1:1 oc 0 */ dmr_ir : 4, dmr_sr : 0, pll_n : 31, pll_m : 33, pllcap : 1, mode : 38 }; TVChRegs ch2_pal_huge_d = { /* Mode 22: 720x576 / 882x625 1:1 oc 0 */ dmr_ir : 5, dmr_sr : 1, pll_n : 75, pll_m : 38, pllcap : 1, mode : 22 }; TVChRegs ch2_pal_small_d = { /* Mode 23: 720x576 / 900x750 5:6 oc -18 */ dmr_ir : 5, dmr_sr : 3, pll_n : 31, pll_m : 12, pllcap : 1, mode : 23 }; TVChRegs ch2_pal_tiny_d = { /* Mode 24: 720x576 / 900x875 5:7 oc -30 */ dmr_ir : 5, dmr_sr : 4, pll_n : 9, pll_m : 2, pllcap : 1, mode : 24 }; TVChRegs ch2_pal_huge_b = { /* Mode 25: 800x600 / 944x625 1:1 oc +4 */ dmr_ir : 6, dmr_sr : 1, pll_n : 647, pll_m : 313, pllcap : 0, mode : 25 }; TVChRegs ch2_pal_small_b = { /* Mode 26: 800x600 / 960x750 5:6 oc -14 */ dmr_ir : 6, dmr_sr : 3, pll_n : 86, pll_m : 33, pllcap : 1, mode : 26 }; TVChRegs ch2_pal_tiny_b = { /* Mode 27: 800x600 / 960x875 5:7 oc -27 */ dmr_ir : 6, dmr_sr : 4, pll_n : 42, pll_m : 13, pllcap : 1, mode : 27 }; TVChRegs ch2_pal_huge_a = { /* Mode 31: 1024x768 / 1400x875 5:7 oc -4 */ dmr_ir : 7, dmr_sr : 4, pll_n : 75, pll_m : 16, pllcap : 1, mode : 31 }; TVChRegs ch2_pal_small_a = { /* Mode 32: 1024x768 / 1400x1000 5:8 oc -16 */ dmr_ir : 7, dmr_sr : 5, pll_n : 42, pll_m : 7, pllcap : 1, mode : 32 }; TVChRegs ch2_pal_tiny_a = { /* Mode 33: 1024x768 / 1400x1125 5:9 oc -25 */ dmr_ir : 7, dmr_sr : 6, pll_n : 20, pll_m : 2, pllcap : 1, mode : 33 }; TVChRegs ch2_pal_dvd = { /* Mode 37: 720x576 / 864x625 1:1 oc 0 */ dmr_ir : 5, dmr_sr : 0, pll_n : 31, pll_m : 33, pllcap : 1, mode : 37 }; fsci_t ch2_fsci_ntsc_huge_c [] = {553914433, 553916752, 553305736}; /* 19 */ fsci_t ch2_fsci_ntsc_small_c [] = {484675129, 484677158, 484142519}; /* 20 */ fsci_t ch2_fsci_ntsc_tiny_c [] = {452363454, 452365347, 451866351}; /* 21 */ fsci_t ch2_fsci_ntsc_large_b [] = {469762048, 469764015, 469245826}; /* 28 */ fsci_t ch2_fsci_ntsc_small_b [] = {428554851, 428556645, 428083911}; /* 29 */ fsci_t ch2_fsci_ntsc_tiny_b [] = {391468373, 391470012, 391038188}; /* 30 */ fsci_t ch2_fsci_ntsc_huge_a [] = {526457468, 526459671, 525878943}; /* 34 */ fsci_t ch2_fsci_ntsc_large_a [] = {467962193, 467964152, 467447949}; /* 35 */ fsci_t ch2_fsci_ntsc_tiny_a [] = {418281276, 418283027, 417821626}; /* 36 */ fsci_t ch2_fsci_ntsc_dvd [] = {569408543, 569410927, 568782819}; /* 38 */ fsci_t ch2_fsci_pal_huge_d [] = {690875194, 558179209, 690875194}; /* 22 */ fsci_t ch2_fsci_pal_small_d [] = {564214742, 455846354, 564214742}; /* 23 */ fsci_t ch2_fsci_pal_tiny_d [] = {483612636, 390725446, 483612636}; /* 24 */ fsci_t ch2_fsci_pal_huge_b [] = {645499916, 521519134, 645499916}; /* 25 */ fsci_t ch2_fsci_pal_small_b [] = {528951320, 427355957, 528951320}; /* 26 */ fsci_t ch2_fsci_pal_tiny_b [] = {453386846, 366305106, 453386846}; /* 27 */ fsci_t ch2_fsci_pal_huge_a [] = {621787675, 502361288, 621787675}; /* 31 */ fsci_t ch2_fsci_pal_small_a [] = {544064215, 439566127, 544064215}; /* 32 */ fsci_t ch2_fsci_pal_tiny_a [] = {483612636, 390725446, 483612636}; /* 33 */ fsci_t ch2_fsci_pal_dvd [] = {705268427, 569807942, 705268427}; /* 37 */ #else /* -------- 800x600 -------- */ /* For I845 */ TVChRegs ch2_ntsc_small_b = { /* Mode 29: 800x600 / 1064x750 7:10 */ dmr_ir : 6, dmr_vs : 1, dmr_sr : 7, ffr_fc : 2, ffr_fy : 1, ffr_ft : 3, vbw_flff : 0, vbw_cbw : 3, vbw_ypeak : 0, vbw_ysv : 3, vbw_ycv : 2, te : 5, sav : 132, hpr : 58, vpr : 14, blr : 131, /* i865: 129 */ ce : 3, pllcap : 0, pll_n : 302, pll_m : 89, civh : 0, dacg : 0, mode : 29, }; /* Use ch1_fsci_ntsc_small_b */ /* -------- CH2 -------- PAL -------- */ /* For I845 */ TVChRegs ch2_pal_tiny_b = { /* Mode 27: 800x600 / 960x875 5:7 */ dmr_ir : 6, dmr_vs : 0, dmr_sr : 4, ffr_fc : 2, ffr_fy : 1, ffr_ft : 3, vbw_flff : 0, vbw_cbw : 3, vbw_ypeak : 0, vbw_ysv : 3, vbw_ycv : 2, te : 5, sav : 132, hpr : 90, vpr : 32, blr : 110, ce : 3, pllcap : 1, pll_n : 42, pll_m : 13, civh : 0, dacg : 0, mode : 27, }; /* Different from ch1 with 3:4 instead of 5:7 */ unsigned long ch2_fsci_pal_tiny_b [] = {453386846, 366305106, 453386846}; /* For i830 */ TVChRegs ch2_pal_small_a = { /* Mode 32: 1024x768 / 1400x1000 5:8 */ dmr_ir : 7, dmr_vs : 0, dmr_sr : 5, ffr_fc : 2, ffr_fy : 1, ffr_ft : 3, vbw_flff : 0, vbw_cbw : 3, vbw_ypeak : 0, vbw_ysv : 2, vbw_ycv : 3, te : 7, sav : 190, hpr : 60, vpr : 304, blr : 109, ce : 4, pllcap : 1, pll_n : 42, pll_m : 7, civh : 0, dacg : 1, mode : 32, }; unsigned long ch2_fsci_pal_small_a [] = {544064215, 439566127, 544064215}; #endif /* -------- -------- */ static int clamp_contrast[8] = {-75, -50, -25, 0, 25, 50, 75, 100}; static int clamp_flicker[5] = {0, 25, 50, 75, 100}; static int clamp_sharpness[3] = {0, 50, 100}; static int clamp_luma_bandwidth[5] = {0, 25, 50, 75, 100}; static int clamp_chroma_bandwidth[4] = {0, 50, 75, 100}; void data_init_ch (TVSystem system, TVChRegs *r) { if (!r) return; r->ffr_fc = 2; r->ffr_fy = 1; r->ffr_ft = 2; r->vbw_flff = 0; r->vbw_cbw = 0; /* low bandwidth */ r->vbw_ypeak = 0; /* disabled */ r->vbw_ysv = 0; /* low bandwidth */ r->vbw_ycv = 0; /* low bandwidth */ r->civh = 0; /* civ hysteresis mode = 0 */ r->ce = 3; /* normal contrast */ r->flags = CH_FLAG_BOTH | CH_FLAG_CFRB; /* no ACIV, no CVBW */ } void data_init_ch1 (TVSystem system, TVChRegs *r) { data_init_ch (system, r); switch (system) { case TV_SYSTEM_NTSC: /* additional fsci values for NDC (no dot crawl) */ r->dmr_vs = 1; r->dacg = 0; r->blr = 127; break; case TV_SYSTEM_NTSC_J: r->dmr_vs = 3; r->dacg = 1; r->blr = 100; break; case TV_SYSTEM_NONE: /* to have a default */ case TV_SYSTEM_SECAM: /* makes most sense */ case TV_SYSTEM_PAL: case TV_SYSTEM_PAL_X: case TV_SYSTEM_PAL_N: /* PAL-N has different fsci values */ case TV_SYSTEM_PAL_NC: /* guess */ r->dmr_vs = 0; r->dacg = 1; r->blr = 105; break; case TV_SYSTEM_PAL_M: /* needs different fsci values */ case TV_SYSTEM_PAL_M60: /* guess */ r->dmr_vs = 2; r->dacg = 0; r->blr = 127; break; case TV_SYSTEM_PAL_60: /* modify PAL_M */ r->dmr_vs = 2; r->dacg = 1; r->blr = 105; break; } } void data_init_ch2 (TVSystem system, TVChRegs *r) { data_init_ch (system, r); switch (system) { case TV_SYSTEM_NTSC: /* additional fsci values for NDC (no dot crawl) */ r->dmr_vs = 1; r->dacg = 0; r->blr = 131; break; case TV_SYSTEM_NTSC_J: r->dmr_vs = 3; r->dacg = 1; r->blr = 102; break; case TV_SYSTEM_NONE: /* to have a default */ case TV_SYSTEM_SECAM: /* makes most sense */ case TV_SYSTEM_PAL: case TV_SYSTEM_PAL_X: case TV_SYSTEM_PAL_N: /* PAL-N has different fsci values */ case TV_SYSTEM_PAL_NC: /* guess */ r->dmr_vs = 0; r->dacg = 1; r->blr = 110; break; case TV_SYSTEM_PAL_M: /* needs different fsci values */ case TV_SYSTEM_PAL_M60: /* guess */ r->dmr_vs = 2; r->dacg = 0; r->blr = 131; break; case TV_SYSTEM_PAL_60: /* modify PAL_M */ r->dmr_vs = 2; r->dacg = 1; r->blr = 110; break; } } void data_default_ch (TVSettings *s) { s->tv_hoffset = s->mon_hoffset = 0; s->tv_voffset = s->mon_voffset = 0; s->brightness_sig = 0; s->contrast_sig = 0; s->contrast = 0; s->saturation_sig = 0; s->saturation = 0; s->flicker = 75; s->flicker_adapt = 0; s->luma_bandwidth = 100; s->chroma_bandwidth = 75; s->sharpness = 50; s->cross_color = 0; s->phase = 0; s->hue = 0; /* FIXME flags */ } void data_clamp_ch (TVSettings *s, TVRegs *r) { if (s->tv_hoffset <= -100) s->tv_hoffset = -100; if (s->tv_hoffset >= 100) s->tv_hoffset = 100; if (s->tv_voffset <= -100) s->tv_voffset = -100; if (s->tv_voffset >= 100) s->tv_voffset = 100; if (s->mon_hoffset <= -100) s->mon_hoffset = -100; if (s->mon_hoffset >= 100) s->mon_hoffset = 100; if (s->mon_voffset <= -100) s->mon_voffset = -100; if (s->mon_voffset >= 100) s->mon_voffset = 100; if (s->brightness_sig < -50) s->brightness_sig = -50; if (s->brightness_sig > 50) s->brightness_sig = 50; s->contrast = data_clamp (s->contrast, 8, clamp_contrast); s->saturation = 0; s->contrast_sig = 0; s->saturation_sig = 0; s->phase = 0; s->hue = 0; s->cross_color = 0; s->sharpness = data_clamp (s->sharpness, 3, clamp_sharpness); s->flicker = data_clamp (s->flicker, 5, clamp_flicker); s->flicker_adapt = 0; s->luma_bandwidth = data_clamp (s->luma_bandwidth, 5, clamp_luma_bandwidth); s->chroma_bandwidth = data_clamp (s->chroma_bandwidth, 4, clamp_chroma_bandwidth); /* FIXME: Operate on mode flags */ } void data_setup_ch1 (TVSettings *s, TVRegs *r) { register int i; int vmax; if (r->enc.ch.dmr_vs & 0x01) vmax = 262; else vmax = 312; r->enc.ch.hpr += s->tv_hoffset; if (r->enc.ch.hpr < 0) r->enc.ch.hpr = 0; if (r->enc.ch.hpr > 511) r->enc.ch.hpr = 511; r->enc.ch.vpr -= s->tv_voffset; while (r->enc.ch.vpr < 0) r->enc.ch.vpr += vmax; while (r->enc.ch.vpr > vmax) r->enc.ch.vpr -= vmax; i = s->brightness_sig + r->enc.ch.blr; if (i < 0) i = 0; if (i > 255) i = 255; r->enc.ch.blr = i; r->enc.ch.ce = data_pick (s->contrast, 8, clamp_contrast); switch (data_pick (s->flicker, 5, clamp_flicker)) { case 0: r->enc.ch.ffr_fy = 0; r->enc.ch.ffr_fc = 0; break; case 1: r->enc.ch.ffr_fy = 1; r->enc.ch.ffr_fc = 0; break; case 2: r->enc.ch.ffr_fy = 1; r->enc.ch.ffr_fc = 1; break; case 3: r->enc.ch.ffr_fy = 2; r->enc.ch.ffr_fc = 1; break; case 4: r->enc.ch.ffr_fy = 2; r->enc.ch.ffr_fc = 2; break; } switch (data_pick (s->luma_bandwidth, 5, clamp_luma_bandwidth)) { case 0: r->enc.ch.vbw_ycv = 0; r->enc.ch.vbw_ysv = 0; r->enc.ch.vbw_ypeak = 0; break; case 1: r->enc.ch.vbw_ycv = 0; r->enc.ch.vbw_ysv = 0; r->enc.ch.vbw_ypeak = 1; break; case 2: r->enc.ch.vbw_ycv = 1; r->enc.ch.vbw_ysv = 1; r->enc.ch.vbw_ypeak = 0; break; case 3: r->enc.ch.vbw_ycv = 1; r->enc.ch.vbw_ysv = 1; r->enc.ch.vbw_ypeak = 1; break; case 4: r->enc.ch.vbw_ycv = 1; r->enc.ch.vbw_ysv = 2; r->enc.ch.vbw_ypeak = 1; break; } r->enc.ch.vbw_cbw = data_pick (s->chroma_bandwidth, 4, clamp_chroma_bandwidth); /* FIXME Chroma dot crawl in fc */ /* FIXME vbw_flff=1 for 5 line in 7/10 */ /* FIXME handle CH7003 differently */ r->enc.ch.ffr_ft = 2 - data_pick (s->sharpness, 3, clamp_sharpness); r->enc.ch.macro = (s->flags & TV_DESC_MACROVISION) ? 1 : 0; if (s->flags & TV_DESC_CARRIER_LOCK) { r->enc.ch.flags &= ~CH_FLAG_CFRB; } else { r->enc.ch.flags |= CH_FLAG_CFRB; } if (s->flags & TV_DESC_MONOCHROME) { r->enc.ch.flags |= CH_FLAG_CVBW; } else { r->enc.ch.flags &= ~CH_FLAG_CVBW; } if (s->flags & TV_DESC_COLORFIX) { r->enc.ch.flags |= CH_FLAG_POUTP; } else { r->enc.ch.flags &= ~CH_FLAG_POUTP; } r->enc.ch.flags &= ~CH_FLAG_DAC_MASK; switch (s->connector) { case CONNECT_COMPOSITE: r->enc.ch.flags |= CH_FLAG_COMPOSITE; break; case CONNECT_CONVERT: case CONNECT_SVIDEO: r->enc.ch.flags |= CH_FLAG_SVIDEO; break; case CONNECT_BOTH: default: r->enc.ch.flags |= CH_FLAG_BOTH; break; } } void data_setup_ch2 (TVSettings *s, TVRegs *r) { } /* 4:3 * 4:3 -> 16:9 4/3 = 1.333 16/9 = 1.777 720 / 576 = 1.25 = 5/4 * 4/3 = 5/3 = 1.66 720 / 480 = 1.5 = 3/2 * 4/3 = 2 768 / 576 = 4:3 (800/600, use scaler) 1024 / 576 = 16:9 (only on monitor) 720 / 540 = 4:3 720 / 405 = 16:9 800 / 450 = 16:9 (800/600, use scaler) 800 / 600 = 1.33 = 4/3 640 / 480 = 1.33 = 4/3 640 / 400 = 1.6 = 8/5 720 / 400 = 1.8 = 9/5 512 / 384 = 1.33 = 4/3 Can display more lines by changing CRT, but the ___x400 modes have wrong aspect. So we have to change the aspect for those modes. Changing the PLL coeff's doesn't work. */ /* Special FCSI values (different crystal?) Resolution Tiny; Small; Large; 512x384 (1) 644916848 (0) 806121060 640x400 (9) 537447373 (8) 677157690 640x480 (15) 537430027 (14) 644862000 (13) 806120400 720x400 (5) 485446014 (4) 601879058 768x576 (20) 529051320 (19) 645599916 800x450 (20) 529051320 (19) 645599916 800x600 (21) 488330000 (20) 529002000 (19) 645527100 Differences: PAL-X n m MHz kHz 13: 806120400/806021060: 1.000123247 20/ 13 = 1.466666 21.00 25.00 14: 644862000/644816848: 1.000070022 9/ 4 = 1.833333 26.25 31.25 19: 645527100/645499916: 1.000042113 647/313 = 2.060317 29.50 31.25 20: 529002000/528951320: 1.000095812 86/ 33 = 2.514285 36.00 37.50 Is not linear... */ /* Think arrangement over. Mode -> dmr_ir, dmr_sr, pll_m, pll_n, pllcap, mode System -> dmr_vs (msb), blr, dacg (in init_ch1/2) crt values -> sav, hpr, vpr (those are different for nv/i810 ??) */ nvtv-0.4.7/src/data_ph.c0000644000175000001440000004703207666076337010561 /* NVTV Philips chip data -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_ph.c,v 1.29 2003/05/31 09:58:55 dthierbach Exp $ * * Contents: * * Data tables and setup routines for the Philips chip. * */ #include "local.h" /* before everything else */ #include #include #include "data_ph.h" #include "data_nv.h" /* Variables (see datasheet for more information): --- adwhs: Active display window horizontal start adwhe: Active display window horizontal end xofs: Horizontal offset xpix: Horizontal pixel count (pixels / 2 ) xinc: Horizontal scaling engine incremental fraction (x 4096) hlen: Horizontal length (PIXCLKs / line - 1 ) fal: First active line lal: Last active line yinc: Vertical scaling engine incremental fraction yskip: Vertical line skip yofso: Vectical offset, odd lines yofse: Vertical offset, even lines ypix: Vertical pixel count yiwgto: Weighting factor, odd lines yiwgte: Weighting factor, even lines pcl: Pixel clock value idel: Input delay (don't change, use xofs to adjust hpos) */ #define PH_FLAG3_DEF (PH_FLAG3_EIDIV | PH_FLAG3_IFRA) /* -------- PH -------- NTSC -------- */ /* -------- 640x480 -------- */ TVPh1Regs ph_ntsc_small_a = { /* PH 620x204 Small, Full-Fl, OC 12.67x16.05 */ adwhs : 342, /* hsize: ntsc 620 +0 */ adwhe : 1582, /* hsize: ntsc 620 +0 */ xofs : 159, /* verified, largest possible */ xpix : 320, xinc : 3968, /* 640->620 */ hlen : 799, fal : 37, lal : 241, yinc : 1734, yskip : 0, yofso : 84, yofse : 84, ypix : 480, yiwgto : 2941, yiwgte : 866, pcl : 2309218, idel : 0, }; TVPh1Regs ph_ntsc_medium_a = { /* PH 640x216 +0 Reg, Full-Fl, OC 09.86x11.11 */ adwhs : 326, /* hsize: ntsc 640 +0 */ adwhe : 1606, /* hsize: ntsc 640 +0 */ xofs : 159, /* verified, largest possible */ xpix : 320, xinc : 0, /* 640->640 */ hlen : 799, fal : 31, lal : 247, yinc : 1836, yskip : 0, yofso : 66, yofse : 66, ypix : 480, yiwgto : 2965, yiwgte : 917, pcl : 2178859, idel : 0, }; /* -------- 800x600 -------- */ TVPh1Regs ph_ntsc_small_b = { /* PH 620x204 Small, Full-Fl, OC 12.67x16.05 */ adwhs : 346, /* hsize: ntsc 620 +0 */ adwhe : 1586, /* hsize: ntsc 620 +0 */ xofs : 200, /* test! */ xpix : 400, xinc : 3175, /* 800->620 */ hlen : 1023, fal : 37, lal : 241, yinc : 1389, yskip : 0, yofso : 106, yofse : 106, ypix : 600, yiwgto : 2742, yiwgte : 694, pcl : 3689981, idel : 0, }; TVPh1Regs ph_ntsc_medium_b = { /* PH 640x216 +0 Reg, Full-Fl, OC 09.86x11.11 */ adwhs : 326, /* hsize: ntsc 640 +0 */ adwhe : 1606, /* hsize: ntsc 640 +0 */ xofs : 200, /* test! */ xpix : 400, xinc : 3277, /* 800->640 */ hlen : 1023, fal : 31, lal : 247, yinc : 1470, yskip : 0, yofso : 82, yofse : 82, ypix : 600, yiwgto : 2782, yiwgte : 734, pcl : 3484982, idel : 0, }; TVPh1Regs ph_ntsc_huge_b = { /* PH 710x241 Full, Full-Fl, OC 0.00x00.82 */ adwhs : 256, /* hsize: ntsc 710 +0 */ adwhe : 1676, /* hsize: ntsc 710 +0 */ xofs : 200, /* test! */ xpix : 400, xinc : 3636, /* 800 -> 710 */ hlen : 1023, fal : 18, lal : 259, yinc : 1642, yskip : 0, yofso : 42, yofse : 42, ypix : 600, yiwgto : 2867, yiwgte : 819, pcl : 3122659, idel : 0, }; /* -------- PH -------- PAL -------- */ /* -------- 640x480 -------- */ TVPh1Regs ph_pal_small_a = { /* PH 620x250 Small, Full-Fl, OC 11.68x13.19 */ adwhs : 358, /* hsize: pal 620 +0 */ adwhe : 1598, /* hsize: pal 620 +0 */ xofs : 159, /* verified, largest possible */ xpix : 320, xinc : 3968, /* 640->620 */ hlen : 799, fal : 41, lal : 291, yinc : 2125, yskip : 0, yofso : 76, /* total: 602 */ yofse : 76, ypix : 480, yiwgto : 3110, yiwgte : 1062, pcl : 1870348, idel : 0, }; TVPh1Regs ph_pal_medium_a = { /* PH 640x259 +0 Reg, Full-Fl, OC 08.83x10.07 */ adwhs : 334, /* hsize: pal 640 +0 */ adwhe : 1614, /* hsize: pal 640 +0 */ xofs : 159, /* verified, largest possible */ xpix : 320, xinc : 0, /* 640->640 */ hlen : 799, fal : 37, lal : 296, yinc : 2202, yskip : 0, yofso : 66, yofse : 66, ypix : 480, yiwgto : 3148, yiwgte : 1100, pcl : 1805104, idel : 0, }; /* -------- 800x600 -------- */ TVPh1Regs ph_pal_small_b = { /* PH 620x250 Small, Full-Fl, OC 11.68x13.19 */ adwhs : 364, /* hsize: pal 620 +0 */ adwhe : 1604, /* hsize: pal 620 +0 */ xofs : 223, /* verified, largest possible */ xpix : 400, xinc : 3175, /* 800->620 */ hlen : 1023, fal : 41, lal : 291, yinc : 1701, yskip : 0, yofso : 95, yofse : 95, ypix : 600, yiwgto : 2898, yiwgte : 850, pcl : 2990569, idel : 0, }; TVPh1Regs ph_pal_medium_b = { /* PH 640x259 +0 Reg, Full-Fl, OC 08.83x10.07 */ adwhs : 346, /* hsize: pal 640 +0 */ adwhe : 1626, /* hsize: pal 640 +0 */ xofs : 223, /* verified, largest possible */ xpix : 400, xinc : 3277, /* 800->640 */ hlen : 1023, fal : 37, lal : 296, yinc : 1763, yskip : 0, yofso : 83, yofse : 83, ypix : 600, yiwgto : 2929, yiwgte : 881, pcl : 2887172, idel : 0, }; TVPh1Regs ph_pal_huge_b = { /* PH 702x288 Full, Full-Fl, OC 00.00x00.00 */ adwhs : 284, /* hsize: pal 702 +0 */ adwhe : 1688, /* hsize: pal 702 +0 */ xofs : 200, /* test! */ xpix : 400, xinc : 3595, /* 800 -> 702 */ hlen : 1023, fal : 22, lal : 310, yinc : 1960, yskip : 0, yofso : 43, yofse : 43, ypix : 600, yiwgto : 3027, yiwgte : 979, pcl : 2596864, idel : 0, }; /* -------- SAA7104 Test Master modes -------- */ TVPh2Regs ph_ntsc_test_a = { /* 640x480 NV */ super : { adwhs : 318, adwhe : 1598, xofs : 100, xpix : 320, xinc : 0, hlen : 761, fal : 32, lal : 246, yinc : 1819, yskip : 0, yofso : 69, yofse : 69, ypix : 672, yiwgto : 2957, yiwgte : 909, pcl : 2097152, /* 27.000 MHz */ fsc : 0, idel : 1, }, pcle : 1, pcli : 1, }; TVPh2Regs ph_ntsc_test_b = { /* 800x600 NV */ super : { adwhs : 331, adwhe : 1571, xofs : 98, xpix : 400, xinc : 3175, hlen : 1221, fal : 30, lal : 244, yinc : 1457, yskip : 0, yofso : 81, yofse : 81, ypix : 696, yiwgto : 2776, yiwgte : 728, pcl : 4194304, /* 54.000 MHz */ /* Huh? This is pretty high! */ fsc : 0, idel : 6, }, pcle : 1, pcli : 1, }; TVPh2Regs ph_ntsc_test_c = { /* 1024x768 NV double freq? */ super : { adwhs : 344, adwhe : 1588, xofs : 59, xpix : 512, xinc : 2488, hlen : 1139, fal : 33, lal : 243, yinc : 1120, yskip : 0, yofso : 117, yofse : 117, ypix : 768, yiwgto : 2688, yiwgte : 640, pcl : 2547589, /* 32.799 MHz * 2 = 65.6 MHz */ fsc : 569408543, idel : 0, }, pcle : 0, pcli : 0, }; /* ---- */ TVPh2Regs ph_pal_test_a = { /* 640x480 NV */ super : { adwhs : 385, adwhe : 1625, xofs : 104, xpix : 320, xinc : 3969, hlen : 805, fal : 38, lal : 295, yinc : 2185, yskip : 0, yofso : 69, yofse : 69, ypix : 696, yiwgto : 3139, yiwgte : 1091, pcl : 1835008, /* 23.625 MHz */ idel : 5, }, pcle : 1, pcli : 1, }; TVPh2Regs ph_pal_test_b = { /* 800x600 NV */ super : { adwhs : 349, adwhe : 1617, xofs : 102, xpix : 400, xinc : 3247, hlen : 1031, fal : 36, lal : 297, yinc : 1778, yskip : 0, yofso : 80, yofse : 80, ypix : 696, yiwgto : 2935, yiwgte : 887, pcl : 2883584, /* 37.125 MHz */ idel : 5, }, pcle : 1, pcli : 1, }; TVPh2Regs ph_pal_test_c = { /* 1024x768 NV double freq? */ super : { adwhs : 360, adwhe : 1604, xofs : 158, xpix : 512, xinc : 2488, hlen : 1199, fal : 37, lal : 290, yinc : 1349, yskip : 0, yofso : 102, yofse : 102, ypix : 768, yiwgto : 2721, yiwgte : 673, pcl : 2213659, /* 28.500 MHz * 2 = 57.000 MHz */ fsc : 705268427, idel : 0, }, pcle : 0, pcli : 0, }; /* -------- SAA7104 Test Slave modes -------- */ TVPh2Regs ph_ntsc_slave_a = { /* 640x480 Slave */ super : { adwhs : 328, adwhe : 1608, xofs : 86, xpix : 320, xinc : 0, hlen : 1071, fal : 24, lal : 248, yinc : 1824, yskip : 0, yofso : 48, yofse : 48, ypix : 637, yiwgto : 2960, yiwgte : 912, pcl : 2197224, /* 28.288 MHz */ fsc : 569408543, idel : 6, }, pcle : 1, pcli : 1, }; TVPh2Regs ph_ntsc_slave_b = { /* 800x600 Slave */ super : { adwhs : 320, adwhe : 1604, xofs : 72, xpix : 400, xinc : 3288, hlen : 1071, fal : 27, lal : 248, yinc : 1432, yskip : 0, yofso : 70, yofse : 70, ypix : 637, yiwgto : 2793, yiwgte : 746, pcl : 3715234, /* 47.832 MHz */ /* too high ? */ fsc : 569408543, idel : 6, }, pcle : 1, pcli : 1, }; /* ---- */ TVPh2Regs ph_pal_slave_a = { /* 640x480 Slave, from dump */ super : { adwhs : 348, adwhe : 1628, xofs : 88, xpix : 320, xinc : 0, hlen : 813, fal : 32, lal : 296, yinc : 2136, yskip : 0, yofso : 87, yofse : 87, ypix : 0, /* ?? */ yiwgto : 3116, yiwgte : 1068, pcl : 1957085, /* 25.197 MHz */ fsc : 705268427, idel : 5, }, pcle : 1, pcli : 1, #if 0 bs : 33, /* !! */ be : 29, bsta : 47, blckl : 51, blnnl : 53, chps : 136, /* !! */ gy : 26, gcd : 26, ccrs : 1, gainu : 125, gainv : 175, #endif }; TVPh2Regs ph_pal_slave_b = { /* 800x600 Slave */ super : { adwhs : 348, adwhe : 1628, xofs : 96, xpix : 399, xinc : 3294, hlen : 1092, fal : 31, lal : 295, yinc : 1778, /* or: 1781 */ yskip : 0, yofso : 64, /* or: 32 */ yofse : 64, /* or: 32 */ ypix : 1023, /* ?? */ yiwgto : 2934, yiwgte : 886, pcl : 2796212, /* 36.000 MHz */ fsc : 705268427, idel : 5, }, pcle : 1, pcli : 1, #if 0 bs : 33, /* !! */ be : 29, bsta : 47, blckl : 51, blnnl : 53, chps : 136, /* !! */ gy : 26, gcd : 26, ccrs : 1, gainu : 125, gainv : 175, #endif }; /* -------- -------- */ static int clamp_gain[32] = {-100, -1500/16, -1400/16, -1300/16, -1200/16, -1100/16, -1000/16, -900/16, -800/16, -700/16, -600/16, -500/16, -400/16, -300/16, -200/16, -100/16, 0, 100/16, 200/16, 300/16, 400/16, 500/16, 600/16, 700/16, 800/16, 900/16, 1000/16, 1100/16, 1200/16, 1300/16, 1400/16, 1500/16}; static int clamp_sharpness[2] = {0, 100}; static int clamp_chroma_bandwidth[3] = {0, 50, 100}; static int clamp_cross_color[4] = {0, 50, 80, 100}; void data_init_ph1 (TVSystem system, TVPh1Regs *r) { if (!r) return; r->flags1 = 0; r->flags2 = PH_FLAG2_NORMAL; switch (system) /* 7.5 IRE setup vs. non-setup */ { case TV_SYSTEM_NTSC_J: case TV_SYSTEM_PAL: case TV_SYSTEM_PAL_X: case TV_SYSTEM_PAL_60: case TV_SYSTEM_PAL_NC: r->gainu = 125; /* @ 0x5b 100IRE: 125 */ r->gainv = 175; /* @ 0x5c 100IRE: 175 */ r->blckl = 51; /* @ 0x5d 143IRE: 51 = 0x33 */ r->blnnl = 53; /* @ 0x5e 143IRE: 53 = 0x35 */ break; case TV_SYSTEM_NTSC: case TV_SYSTEM_PAL_N: case TV_SYSTEM_PAL_M: case TV_SYSTEM_PAL_M60: r->flags1 |= PH_FLAG1_YGS; r->gainu = 118; /* @ 0x5b 92.5IRE: 118 */ r->gainv = 165; /* @ 0x5c 92.5IRE: 165 */ r->blckl = 58; /* @ 0x5d 140IRE: 58 = 0x3a */ r->blnnl = 46; /* @ 0x5e 140IRE: 46 = 0x2e */ break; case TV_SYSTEM_NONE: case TV_SYSTEM_SECAM: break; } switch (system) { case TV_SYSTEM_NTSC: r->flags1 |= PH_FLAG1_FISE; r->bs = 25; /* @ 0x28 nstc: 25 */ r->be = 29; /* @ 0x29 ntsc: 29 */ r->bsta = 63; /* @ 0x62 92.5IRE/NTSC: 63 */ break; case TV_SYSTEM_NTSC_J: r->flags1 |= PH_FLAG1_FISE; r->bs = 25; /* @ 0x28 pal: 33, nstc: 25 FIXME */ r->be = 29; /* @ 0x29 pal: 29, ntsc: 29 FIXME */ r->bsta = 67; /* @ 0x62 100IRE/NTSC: 67 */ break; case TV_SYSTEM_PAL: case TV_SYSTEM_PAL_X: case TV_SYSTEM_PAL_N: case TV_SYSTEM_PAL_NC: r->bs = 25; /* @ 0x28 pal: 33, nstc: 25 FIXME NV does it.*/ r->be = 29; /* @ 0x29 pal: 29, ntsc: 29 */ r->bsta = 47; /* @ 0x62 100IRE/PAL: 47 */ break; case TV_SYSTEM_PAL_60: case TV_SYSTEM_PAL_M: case TV_SYSTEM_PAL_M60: r->flags1 |= PH_FLAG1_FISE; r->bs = 25; /* @ 0x28 pal: 33, nstc: 25 FIXME */ r->be = 29; /* @ 0x29 pal: 29, ntsc: 29 FIXME */ r->bsta = 45; /* @ 0x62 92.5IRE/PAL: 45 */ break; case TV_SYSTEM_NONE: case TV_SYSTEM_SECAM: break; } /* Need clock frequency with more precision. Used: 37.037 ns. FSC rounded to first 6.5 digits, unless specified in data sheet. FIXME: 27 MHz ! */ switch (system) { case TV_SYSTEM_NTSC_J: case TV_SYSTEM_NTSC: r->fsc = 569408543; /* 3579455 Hz */ break; case TV_SYSTEM_PAL: case TV_SYSTEM_PAL_X: case TV_SYSTEM_PAL_60: case TV_SYSTEM_PAL_N: r->fsc = 705268427; /* 4433618.75 Hz */ break; case TV_SYSTEM_PAL_NC: r->fsc = 569807000; /* 3582056.25 Hz FIXME: Better precision */ break; case TV_SYSTEM_PAL_M60: /* unkown */ case TV_SYSTEM_PAL_M: r->fsc = 569418500; /* 3579611.49 Hz FIXME: Better precision */ break; case TV_SYSTEM_NONE: case TV_SYSTEM_SECAM: break; } switch (system) { case TV_SYSTEM_NTSC_J: case TV_SYSTEM_NTSC: r->flags1 |= PH_FLAG1_SCBW; /* NV: SCBW !! ?? */ r->macro = 0; break; case TV_SYSTEM_PAL: case TV_SYSTEM_PAL_X: case TV_SYSTEM_PAL_60: case TV_SYSTEM_PAL_N: case TV_SYSTEM_PAL_NC: case TV_SYSTEM_PAL_M: case TV_SYSTEM_PAL_M60: r->flags1 |= PH_FLAG1_PAL; r->macro = 4; break; case TV_SYSTEM_NONE: case TV_SYSTEM_SECAM: break; } r->bcy = 16; /* NV: 0x10 */ r->bcu = 128; /* NV: 0x80 */ r->bcv = 128; /* NV: 0x80 */ r->gy = 26; /* NV: 0x1a */ r->gcd = 26; /* NV: 0x1a */ r->chps = 0; /* @ 0x5a NV: 0x00 */ r->ccrs = 0; /* No cross color reduction */ r->flc = 0; /* NV Interlaced */ r->phres = 0; /* NV No subcarrier reset */ /* FIXME idel */ } void data_init_ph2 (TVSystem system, TVPh2Regs *r) { if (!r) return; data_init_ph1 (system, &r->super); r->yfil = 1; /* before */ r->fili = 8; r->flags3 = PH_FLAG3_DEF; } void data_default_ph (TVSettings *s) { s->tv_hoffset = s->mon_hoffset = 0; s->tv_voffset = s->mon_voffset = 0; s->brightness_sig = 0; s->contrast_sig = 0; s->contrast = 0; s->saturation_sig = 0; s->saturation = 0; s->flicker = 50; s->flicker_adapt = 0; s->luma_bandwidth = 50; s->chroma_bandwidth = 50; s->sharpness = 50; s->cross_color = 0; s->phase = 0; s->hue = 0; } void data_clamp_ph (TVSettings *s, TVRegs *r) { /* FIXME */ if (s->tv_hoffset <= -100) s->tv_hoffset = -100; if (s->tv_hoffset >= 100) s->tv_hoffset = 100; if (s->tv_voffset <= -100) s->tv_voffset = -100; if (s->tv_voffset >= 100) s->tv_voffset = 100; if (s->mon_hoffset <= -100) s->mon_hoffset = -100; if (s->mon_hoffset >= 100) s->mon_hoffset = 100; if (s->mon_voffset <= -100) s->mon_voffset = -100; if (s->mon_voffset >= 100) s->mon_voffset = 100; if (s->brightness_sig < -50) s->brightness_sig = -50; if (s->brightness_sig > 50) s->brightness_sig = 50; if (s->saturation_sig < -50) s->saturation_sig = -50; if (s->saturation_sig > 50) s->saturation_sig = 50; if (s->phase < -180) s->phase = -180; if (s->phase > 180) s->phase = 180; s->contrast_sig = 0; s->hue = 0; if (r) { s->flicker = 100 - (r->enc.ph1.yskip * 100 / 4095); } else { s->flicker = 50; } s->flicker_adapt = 0; s->luma_bandwidth = 50; s->chroma_bandwidth = data_clamp (s->chroma_bandwidth, 3, clamp_chroma_bandwidth); s->sharpness = data_clamp (s->sharpness, 2, clamp_sharpness); s->cross_color = data_clamp (s->cross_color, 4, clamp_cross_color); s->contrast = data_clamp (s->contrast, 32, clamp_gain); s->saturation = data_clamp (s->saturation, 32, clamp_gain); } void data_setup_ph (TVSettings *s, TVRegs *r) { register int i; register float f; r->enc.ph1.adwhs += s->tv_hoffset; r->enc.ph1.adwhe += s->tv_hoffset; i = s->brightness_sig + r->enc.ph1.blckl; if (i < 0) i = 0; if (i > 63) i = 63; r->enc.ph1.blckl = i; /* 6 bits, 0-63 */ r->enc.ph1.gy = data_pick (s->contrast, 32, clamp_gain); r->enc.ph1.gcd = data_pick (s->saturation, 32, clamp_gain); f = (1.0 + 0.01 * s->saturation_sig) * r->enc.ph1.gainu; if (f < 0.0) f = 0.0; if (f > 511.0) f = 511.0; r->enc.ph1.gainu = (int) f; f = (1.0 + 0.01 * s->saturation_sig) * r->enc.ph1.gainv; if (f < 0.0) f = 0.0; if (f > 511.0) f = 511.0; r->enc.ph1.gainv = (int) f; i = (int) (s->phase * 256.0 / 360.0) + r->enc.ph1.chps; r->enc.ph1.chps = i & 0xff; /* 8 bit */ r->enc.ph1.ccrs = data_pick (s->cross_color, 4, clamp_cross_color); switch (data_pick (s->chroma_bandwidth, 3, clamp_chroma_bandwidth)) { case 0: r->enc.ph1.flags1 &= ~PH_FLAG1_SCBW; break; case 2: r->enc.ph1.flags1 |= PH_FLAG1_SCBW; break; } /* scbw will be set with tv system; 0 disables, 50 keeps, 100 enables */ switch (data_pick (s->sharpness, 2, clamp_sharpness)) { case 0: r->enc.ph1.flags1 &= ~PH_FLAG1_YFIL; break; case 1: r->enc.ph1.flags1 |= PH_FLAG1_YFIL; break; } r->enc.ph1.macro = (r->enc.ph1.macro & ~0x3) | ((s->flags & TV_DESC_MACROVISION) ? 1 : 0); r->portEnc &= ~PORT_PCLK_POLARITY; if (s->flags & TV_DESC_COLORFIX) { r->portEnc |= PORT_PCLK_LOW; } else { r->portEnc |= PORT_PCLK_HIGH; } if (s->flags & TV_DESC_CARRIER_LOCK) { r->enc.ph1.phres = 3; } else { r->enc.ph1.phres = 0; } if (s->flags & TV_DESC_NONINTERLACED) { r->enc.ph1.flc = 1; /* FIXME test */ } else { r->enc.ph1.flc = 0; } /* FIXME connector */ switch (s->connector) { case CONNECT_CONVERT: r->enc.ph1.flags2 = PH_FLAG2_CONVERT; break; case CONNECT_COMPOSITE: case CONNECT_SVIDEO: case CONNECT_BOTH: default: r->enc.ph1.flags2 = PH_FLAG2_NORMAL; break; } /* FIXME CAN_CARRIER, ... */ } /* bit2 pin27: red, cr, c(svhs) bit1 pin28: green, cvbs, y/vbs(svhs) bit0 pin30: blue, cb, cvbs(fbas) fbas: cvbsen0=1 shvhs: (cvbsen0=1) cvbsen1=0, vbsen=1, cen=1 convert: (cvbsen0=1) cvbsen1=1, vbsen=0 (cen=1) no setup: 100IRE setup: 92.5IRE + 7.5setup See table A-1 of CX docs for TV System characteristics NTSC-M, PAL-M and PAL-N have setup (92.5IRE?) */ nvtv-0.4.7/src/data_nx.c0000644000175000001440000002010207677065171010560 /* NVTV NVidia internal encoder data -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_nx.c,v 1.3 2003/06/27 16:02:01 dthierbach Exp $ * * Contents: * * Data tables and routines for the NVidia internal encoder chip. * */ #include #include #include #include "data_nx.h" #include "data_nv.h" /* -------- NX -------- 60 Hz -------- */ TVNxImgRegs nx_60_normal_a = { /* NTSC 640x480 */ scaler_h : 720, scaler_v : 240, overscan : 896, vip1 : 1762, vip2 : 6431, }; TVNxImgRegs nx_60_normal_b = { /* NTSC 800x600 */ scaler_h : 720, scaler_v : 240, overscan : 896, vip1 : 1188, vip2 : 7005, }; TVNxImgRegs nx_60_normal_c = { /* NTSC 1024x768 */ scaler_h : 720, scaler_v : 240, overscan : 896, vip1 : 369, vip2 : 7823, }; /* -------- NX -------- 50 Hz -------- */ TVNxImgRegs nx_50_normal_a = { /* PAL 640x480 */ scaler_h : 720, scaler_v : 288, overscan : 896, vip1 : 3994, vip2 : 103, }; TVNxImgRegs nx_50_normal_b = { /* PAL 800x600 */ scaler_h : 720, scaler_v : 288, overscan : 896, vip1 : 6534, vip2 : 1659, }; TVNxImgRegs nx_50_normal_c = { /* PAL 1024x768 */ scaler_h : 720, scaler_v : 288, overscan : 896, vip1 : 7209, vip2 : 983, }; /* -------- NX -------- CRT -------- */ /* -------- System -------- */ /* SVideo: CONN-3, !CONN-5 */ TVNxIndRegs nx_pal = { fsub : 705268427, nxreg04 : 0, nxreg08 : 126, nxreg09 : 64, nxreg0a : 138, nxreg0b : 50, nxreg0c : 35, nxreg0e : 251, nxreg10 : 251, nxreg17 : 625, nxreg1e : 800, nxreg20 : 166, nxreg22 : 166, nxreg29 : 26, nxreg2c : 24, nxreg31 : 1440, /* 2x720 */ nxreg35 : 16, nxreg3c : 251, /* = reg10 */ nxsys12 : 0, flags : NX_FLAG_SYS_0 | NX_FLAG_SYS_3 | NX_FLAG_SYS_6, }; TVNxIndRegs nx_ntsc = { fsub : 569408543, nxreg04 : 0, nxreg08 : 126, nxreg09 : 68, nxreg0a : 118, nxreg0b : 67, nxreg0c : 0, nxreg0e : 282, nxreg10 : 240, nxreg17 : 525, nxreg1e : 800, nxreg20 : 156, nxreg22 : 156, nxreg29 : 22, nxreg2c : 32, nxreg31 : 1440, /* 2x720 */ nxreg35 : 16, nxreg3c : 240, /* = reg10 */ nxsys12 : 2, flags : 0, /* !SYS-0 !SYS-3 !SYS-6 */ }; /* different from ntsc: 0e 20 22 */ TVNxIndRegs nx_ntsc_j = { fsub : 569408543, nxreg04 : 0, nxreg08 : 126, nxreg09 : 68, nxreg0a : 118, nxreg0b : 67, nxreg0c : 0, nxreg0e : 240, /* different */ nxreg10 : 240, nxreg17 : 525, nxreg1e : 800, nxreg20 : 166, /* different */ nxreg22 : 166, /* different */ nxreg29 : 22, nxreg2c : 32, nxreg31 : 1440, /* 2x720 */ nxreg35 : 16, nxreg3c : 240, /* = reg10 */ nxsys12 : 2, flags : 0, /* !SYS-0 !SYS-3 !SYS-6 */ }; TVNxIndRegs nx_pal_m = { /* unchecked */ fsub : 568782819, nxreg04 : 0, nxreg08 : 126, nxreg09 : 68, nxreg0a : 118, nxreg0b : 47, nxreg0c : 33, nxreg0e : 282, nxreg10 : 240, nxreg17 : 625, nxreg1e : 800, nxreg20 : 156, nxreg22 : 156, nxreg29 : 18, nxreg2c : 32, nxreg31 : 1440, /* 2x720 */ nxreg35 : 16, nxreg3c : 240, /* = reg10 */ nxsys12 : 0, flags : NX_FLAG_SYS_6, /* !SYS-0 !SYS-3 SYS-6 */ }; TVNxIndRegs nx_pal_n = { fsub : 705268427, nxreg04 : 0, nxreg08 : 126, nxreg09 : 64, nxreg0a : 138, nxreg0b : 47, nxreg0c : 33, nxreg0e : 282, nxreg10 : 240, nxreg17 : 625, nxreg1e : 800, nxreg20 : 156, nxreg22 : 156, nxreg29 : 26, nxreg2c : 24, nxreg31 : 1440, /* 2x720 */ nxreg35 : 16, nxreg3c : 240, /* = reg10 */ nxsys12 : 0, flags : NX_FLAG_SYS_6, /* !SYS-0 !SYS-3 SYS-6 */ }; TVNxIndRegs nx_pal_nc = { fsub : 569807942, nxreg04 : 0, nxreg08 : 126, nxreg09 : 68, nxreg0a : 138, nxreg0b : 50, nxreg0c : 35, nxreg0e : 251, nxreg10 : 251, nxreg17 : 625, nxreg1e : 800, nxreg20 : 166, nxreg22 : 166, nxreg29 : 26, nxreg2c : 24, nxreg31 : 1440, /* 2x720 */ nxreg35 : 16, nxreg3c : 251, /* = reg10 */ nxsys12 : 0, flags : NX_FLAG_SYS_0 | NX_FLAG_SYS_3 | NX_FLAG_SYS_6, }; /* -------- -------- */ void data_init_nx (TVSystem system, TVNxRegs *r) { int i, j; if (!r) return; r->muxa = 2; /* SVideo */ r->muxb = 1; /* SVideo */ r->muxc = 0; /* SVideo */ r->filter = 1; /* depends on img ... */ r->flags1 = NX_FLAG1_SVIDEO; switch (system) { case TV_SYSTEM_NTSC: /* additional fsci values for NDC (no dot crawl) */ r->ind = nx_ntsc; break; case TV_SYSTEM_NTSC_J: r->ind = nx_ntsc_j; break; case TV_SYSTEM_NONE: /* to have a default */ case TV_SYSTEM_SECAM: /* makes most sense */ case TV_SYSTEM_PAL: case TV_SYSTEM_PAL_X: r->ind = nx_pal; break; case TV_SYSTEM_PAL_N: /* PAL-N has different fsci values */ r->ind = nx_pal_n; break; case TV_SYSTEM_PAL_NC: /* guess */ r->ind = nx_pal_nc; break; case TV_SYSTEM_PAL_M: /* needs different fsci values */ case TV_SYSTEM_PAL_M60: /* guess */ r->ind = nx_pal_m; break; case TV_SYSTEM_PAL_60: /* modify PAL_M */ r->ind = nx_pal; /* FIXME for now */ break; } r->ind.flags &= ~(NX_FLAG_CONN_3 | NX_FLAG_CONN_5); r->ind.flags |= NX_FLAG_CONN_3; /* SVideo: CONN-3, !CONN-5 */ for (i = 0; i <= 3; i++) { for (j = 0; j <= 7; j++) { r->filt_x1[i][j] = 0; r->filt_x2[i][j] = 0; r->filt_y[i][j] = 0; } } } void data_default_nx (TVSettings *s) { s->tv_hoffset = s->mon_hoffset = 0; s->tv_voffset = s->mon_voffset = 0; s->brightness_sig = 0; s->contrast_sig = 0; s->contrast = 0; s->saturation_sig = 0; s->saturation = 0; s->flicker = 75; s->flicker_adapt = 0; s->luma_bandwidth = 100; s->chroma_bandwidth = 75; s->sharpness = 50; s->cross_color = 0; s->phase = 0; s->hue = 0; /* FIXME flags */ } void data_clamp_nx (TVSettings *s, TVRegs *r) { } void data_setup_nx (TVSettings *s, TVRegs *r) { } void data_calc_vip_nx (TVRegs *r) { int low, high; low = (2048 * r->crtc.nv.VDisplay + 1024) / ((r->enc.nx.img.scaler_v * r->enc.nx.img.overscan + 512) / 1024); high = (low / 4096) * 4096; if (high < low) high += 4096; if (r->enc.nx.ind.flags & NX_FLAG_SYS_0) { r->enc.nx.img.vip1 = (high + low) / 2; r->enc.nx.img.vip2 = (high - low) / 2; } else { r->enc.nx.img.vip1 = (high - low) / 2; r->enc.nx.img.vip2 = (high + low) / 2; } } static int filter_coeff[4][4][7] = { {{ 63, 59, 46, 45, 46, 59, 63}, { -14, -17, -1, 22, 47, 76, 78}, { -21, -25, -28, -27, -28, -25, -21}, { 9, 8, -4, -14, -24, -33, -29}}, {{ 65, 65, 66, 66, 66, 65, 65}, { 3, 9, 25, 33, 41, 56, 62}, { -6, -20, -36, -36, -36, -20, -6}, { -12, -16, -20, -18, -16, -4, 6}}, {{ 64, 65, 65, 64, 65, 65, 64}, { 16, 19, 28, 32, 37, 45, 49}, { 27, 20, 13, 13, 13, 20, 27}, { -5, -4, 2, 7, 11, 24, 32}}, {{ 63, 63, 63, 63, 63, 63, 63}, { 25, 27, 30, 32, 33, 36, 38}, { 67, 65, 63, 63, 63, 65, 67}, { 18, 21, 28, 32, 35, 44, 49}} }; void data_calc_filter_nx (TVRegs *r) { } void data_complete_nx (TVRegs *r) { data_calc_vip_nx (r); data_calc_filter_nx (r); } nvtv-0.4.7/src/data_nv.c0000644000175000001440000024226210006415006010543 /* NVTV NVidia CRTC data -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_nv.c,v 1.23 2004/01/30 08:47:02 dthierbach Exp $ * * Contents: * * Data routines for the NVidia CRTC data. * */ #include "local.h" /* before everything else */ #include #include #include #include "data_bt.h" #include "data_cx.h" #include "data_ch.h" #include "data_ph.h" #include "data_nx.h" #include "data_nv.h" #include "calc_bt.h" /* ======== BT ================================ */ #define TV_DEF_BT (TV_CAP_MACROVISION | TV_CAP_NONINTERLACED | \ TV_CAP_MONOCHROME) #define TV_DEF_BT_DUAL (TV_DEF_BT | TV_DEF_DUALVIEW) /* -------- BT -------- NTSC -------- */ /* -------- 640x480 -------- */ TVNvRegs nv_bt_ntsc_small_a = { HDisplay : 640, HSyncStart : 664-8, HSyncEnd : 696-8, HTotal : 744, VDisplay : 480, VSyncStart : 524, VSyncEnd : 526, VTotal : 600, flags : 0, clock : 0, }; TVNvRegs nv_bt_ntsc_normal_a = { HDisplay : 640, HSyncStart : 680-8, HSyncEnd : 736-8, HTotal : 752, VDisplay : 480, VSyncStart : 506, VSyncEnd : 508, VTotal : 562, flags : 0, clock : 0, }; TVNvRegs nv_bt_ntsc_huge_a = { HDisplay : 640, HSyncStart : 672-8, HSyncEnd : 696-8, HTotal : 760, VDisplay : 480, VSyncStart : 486, VSyncEnd : 488, VTotal : 521, flags : 0, clock : 0, }; /* -------- 800x600 -------- */ TVNvRegs nv_bt_ntsc_small_b = { HDisplay : 800, HSyncStart : 808-8, HSyncEnd : 832-8, HTotal : 848, VDisplay : 600, VSyncStart : 630, VSyncEnd : 632, VTotal : 718, flags : 0, clock : 0, }; TVNvRegs nv_bt_ntsc_normal_b = { /* FIXME: SyncStart ok ?? */ HDisplay : 800, HSyncStart : 800-8, HSyncEnd : 824-8, HTotal : 840, VDisplay : 600, VSyncStart : 630, VSyncEnd : 632, VTotal : 690, flags : 0, clock : 0, }; TVNvRegs nv_bt_ntsc_huge_b = { HDisplay : 800, HSyncStart : 808-8, HSyncEnd : 824-8, HTotal : 848, VDisplay : 600, VSyncStart : 608, VSyncEnd : 610, VTotal : 650, flags : 0, clock : 0, }; /* -------- 720x480 -------- */ TVNvRegs nv_bt_ntsc_normal_c = { HDisplay : 720, HSyncStart : 796-8, HSyncEnd : 936-8, HTotal : 896, VDisplay : 480, VSyncStart : 527, VSyncEnd : 557, VTotal : 600, flags : 0, clock : 0, }; /* -------- 720x480 DVD -------- */ TVNvRegs nv_bt_ntsc_dvd_a = { HDisplay : 720, HSyncStart : 744, HSyncEnd : 808, HTotal : 832, VDisplay : 480, VSyncStart : 489, VSyncEnd : 491, VTotal : 525, flags : 0, clock : 0, }; /* The following mode flickers at the top part */ TVNvRegs nv_bt_ntsc_dvd_b = { /* TV_DEF_BT_DUAL */ HDisplay : 720, HSyncStart : 760, /* Beos: 744 */ HSyncEnd : 840, /* Beos: 744+144 */ HTotal : 848, VDisplay : 480, VSyncStart : 490, VSyncEnd : 492, /* Beos: 490+26 */ VTotal : 525, flags : 0, clock : 0, }; /* -------- BT -------- PAL -------- */ /* -------- 640x480 -------- */ TVNvRegs nv_bt_pal_small_a = { HDisplay : 640, HSyncStart : 744-8, HSyncEnd : 888-8, HTotal : 944, VDisplay : 480, VSyncStart : 532, VSyncEnd : 534, VTotal : 625, flags : 0, clock : 0, }; TVNvRegs nv_bt_pal_normal_a = { /* no mon sync !! */ HDisplay : 640, HSyncStart : 728, /* 768-8, */ HSyncEnd : 752, /* 880-8, */ HTotal : 1000, VDisplay : 480, VSyncStart : 508, VSyncEnd : 510, VTotal : 565, flags : 0, clock : 0, }; TVNvRegs nv_bt_pal_huge_a = { /* no mon sync !! */ HDisplay : 640, HSyncStart : 736-8, HSyncEnd : 872-8, HTotal : 976, VDisplay : 480, VSyncStart : 483, VSyncEnd : 485, VTotal : 520, flags : 0, clock : 0, }; /* -------- 800x600 -------- */ TVNvRegs nv_bt_pal_small_b = { HDisplay : 800, HSyncStart : 824-8, /* 880, */ HSyncEnd : 880-8, /* 912, */ HTotal : 912, VDisplay : 600, VSyncStart : 658, VSyncEnd : 660, VTotal : 750, flags : 0, clock : 0, }; TVNvRegs nv_bt_pal_normal_b = { HDisplay : 800, HSyncStart : 840-8, HSyncEnd : 864-8, HTotal : 952, VDisplay : 600, VSyncStart : 625, VSyncEnd : 627, VTotal : 687, flags : 0, clock : 0, }; TVNvRegs nv_bt_pal_large_b = { HDisplay : 800, HSyncStart : 848-8, HSyncEnd : 928-8, HTotal : 1000, VDisplay : 600, VSyncStart : 615, VSyncEnd : 617, VTotal : 665, flags : 0, clock : 0, }; TVNvRegs nv_bt_pal_huge_b = { HDisplay : 800, HSyncStart : 944-8, HSyncEnd : 968-8, HTotal : 1000, VDisplay : 600, VSyncStart : 653, VSyncEnd : 657, VTotal : 696, flags : 0, clock : 0, }; /* -------- 768x576 -------- */ TVNvRegs nv_bt_pal_small_c = { HDisplay : 768, HSyncStart : 824-8, HSyncEnd : 896-8, HTotal : 976, VDisplay : 576, VSyncStart : 610, VSyncEnd : 621, VTotal : 680, flags : 0, clock : 0, }; TVNvRegs nv_bt_pal_normal_c = { HDisplay : 768, HSyncStart : 824-8, HSyncEnd : 896-8, HTotal : 968, VDisplay : 576, VSyncStart : 599, VSyncEnd : 601, VTotal : 655, flags : 0, clock : 0, }; TVNvRegs nv_bt_pal_huge_c = { HDisplay : 768, HSyncStart : 832, HSyncEnd : 856, HTotal : 944, VDisplay : 576, VSyncStart : 583, VSyncEnd : 585, VTotal : 625, flags : 0, clock : 0, }; TVNvRegs nv_bt_pal_normal1_c = { /* TV_DEF_BT_DUAL */ HDisplay : 768, HSyncStart : 824-8, HSyncEnd : 896-8, HTotal : 968, VDisplay : 576, VSyncStart : 600, VSyncEnd : 602, VTotal : 665, flags : 0, clock : 0, }; /* -------- 800x576 -------- */ /* 800 x 576 (for 1024x576 widescreen scaled by xine) */ TVNvRegs nv_bt_pal_normal_d = { HDisplay : 800, HSyncStart : 840-8, HSyncEnd : 888-8, HTotal : 960, VDisplay : 576, VSyncStart : 608, VSyncEnd : 610, VTotal : 675, flags : 0, clock : 0, }; /* -------- 720x576 DVD -------- */ TVNvRegs nv_bt_pal_dvd_a = { HDisplay : 720, HSyncStart : 746, /* Beos: 744 */ HSyncEnd : 832, /* Beos: 744+140 -- not a multiple of 8 */ HTotal : 840, /* 888 */ VDisplay : 576, VSyncStart : 579, /* Beos: 579 */ VSyncEnd : 581, /* Beos: 579+42=621 */ VTotal : 625, flags : 0, clock : 0, }; /* -------- BT -------- PAL-60 -------- */ /* -------- 640x480 -------- */ TVNvRegs nv_bt_pal60_small_a = { HDisplay : 640, HSyncStart : 664, HSyncEnd : 728, HTotal : 768, VDisplay : 480, VSyncStart : 532, VSyncEnd : 534, VTotal : 609, flags : 0, clock : 0, }; TVNvRegs nv_bt_pal60_normal_a = { HDisplay : 640, HSyncStart : 672, HSyncEnd : 728, HTotal : 784, VDisplay : 480, VSyncStart : 509, VSyncEnd : 511, VTotal : 567, flags : 0, clock : 0, }; TVNvRegs nv_bt_pal60_huge_a = { HDisplay : 640, HSyncStart : 656, HSyncEnd : 696, HTotal : 752, VDisplay : 480, VSyncStart : 489, VSyncEnd : 491, VTotal : 525, flags : 0, clock : 0, }; /* -------- 800x600 -------- */ TVNvRegs nv_bt_pal60_small_b = { HDisplay : 800, HSyncStart : 800, HSyncEnd : 824, HTotal : 832, VDisplay : 600, VSyncStart : 649, VSyncEnd : 651, VTotal : 735, flags : 0, clock : 0, }; TVNvRegs nv_bt_pal60_normal_b = { HDisplay : 800, HSyncStart : 800, HSyncEnd : 824, HTotal : 824, VDisplay : 600, VSyncStart : 625, VSyncEnd : 627, VTotal : 685, flags : 0, clock : 0, }; TVNvRegs nv_bt_pal60_huge_b = { HDisplay : 800, HSyncStart : 800, HSyncEnd : 808, HTotal : 824, VDisplay : 600, VSyncStart : 611, VSyncEnd : 613, VTotal : 655, flags : 0, clock : 0, }; /* -------- 720x480 DVD -------- */ TVNvRegs nv_bt_pal60_dvd_a = { HDisplay : 720, HSyncStart : 744, HSyncEnd : 792, HTotal : 856, VDisplay : 480, VSyncStart : 489, VSyncEnd : 491, VTotal : 525, flags : 0, clock : 0, }; /* -------- BT async -------- PAL -------- */ /* -------- 640x480 -------- */ TVNvRegs nv_bt_async_pal_small_a = { clock : 29500, /* kHz */ HDisplay : 640, HSyncStart : 744-8, HSyncEnd : 888-8, HTotal : 944, VDisplay : 480, VSyncStart : 532, VSyncEnd : 534, VTotal : 625, flags : 0, }; TVNvRegs nv_bt_slave_pal_small_a = { clock : 0, /* 29.500 kHz */ HDisplay : 640, HSyncStart : 744-8, HSyncEnd : 888-8, HTotal : 944, VDisplay : 480, VSyncStart : 532, VSyncEnd : 534, VTotal : 625, flags : 0, slave : { HTotal : 944, HSyncStart : 1, HSyncEnd : 64, VTotal : 625, VSyncStart : 1, VSyncEnd : 16, Unknown : 0, /* anything bigger than 0 flickers ... */ } }; /* -------- BT overlay -------- PAL -------- */ /* -------- 640x480 -------- */ TVNvRegs nv_bt_ovly_pal_small_a = { HDisplay : 640, HSyncStart : 768, HSyncEnd : 80, VDisplay : 480, VSyncStart : 688, VSyncEnd : 80, flags : 0, }; /* -------- BT modes -------- */ /* Modes: NTSC 640x480 S tv ok, mon ok, oc ok, calcable (std 0) NTSC 640x480 N tv ok, mon ok, oc ok, calcable NTSC 640x480 H tv ok, mon ok, oc ok, calcable NTSC 800x600 S tv ok, mon ok, oc ok, calcable (std 2) NTSC 800x600 N tv ok, mon ok, oc ok, calcable NTSC 800x600 H tv ok*, mon ok, oc ok, calcable PAL 640x480 S tv ok, mon ok, oc ok, calcable (std 1) PAL 640x480 N tv ok, mon NO, oc ok, calcable PAL 640x480 H tv ?, mon ?, oc ok, calcable PAL 800x600 S tv ok, mon ok, oc ok, calcable (std 3) PAL 800x600 N tv ok, mon ok, oc ok, calcable PAL 800x600 H tv ok, mon NO, oc ?, not calcable PAL 768x576 S tv ok, mon ok, oc ok, calcable PAL 768x576 N tv ok, mon ok, oc ok, calcable * needs several attempts, monitor takes some time syncing. (Huge modes check with HWcursor = False) Bad modes: PAL 800x600 H distorted dualview PAL 640x480 N no dualview PAL 640x480 H no dualview NTSC 800x600 N tv left border wrong (sync?) */ typedef struct { TVModeSpec spec; TVNvRegs *nv; TVBtRegs *bt; int hsynoffset; int hostFlags; int encFlags; int descFlags; } TVTemplateNvBt; TVTemplateNvBt templ_nv_bt [] = { {{TV_SYSTEM_NTSC, 640, 480, "Small", "4:3", 13.79, 13.58}, &nv_bt_ntsc_small_a, &bt_ntsc_small_a, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_NTSC, 640, 480, "Normal", "4:3", 10.59, 08.23}, &nv_bt_ntsc_normal_a, &bt_ntsc_normal_a, 12, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_NTSC, 640, 480, "Huge", "4:3", 02.46, 01.23}, &nv_bt_ntsc_huge_a, &bt_ntsc_huge_a, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_NTSC, 800, 600, "Small", "4:3", 21.62, 11.52}, &nv_bt_ntsc_small_b, &bt_ntsc_small_b, -8, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_NTSC, 800, 600, "Normal", "4:3", 11.90, 05.35}, &nv_bt_ntsc_normal_b, &bt_ntsc_normal_b, -62, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_NTSC, 800, 600, "Huge", "4:3", 07.15, 0.004}, &nv_bt_ntsc_huge_b, &bt_ntsc_huge_b, -60, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_NTSC, 720, 480, "Normal", "DVD", 08.762, 18.107}, &nv_bt_ntsc_normal_c, &bt_ntsc_normal_c, -4, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_NTSC, 720, 480, "DVD", "DVD", 01.245, 01.235}, &nv_bt_ntsc_dvd_a, &bt_ntsc_dvd_a, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL, 640, 480, "Small", "4:3", 16.56, 16.67}, &nv_bt_pal_small_a, &bt_pal_small_a, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL, 640, 480, "Normal", "4:3", 12.87, 07.64}, &nv_bt_pal_normal_a, &bt_pal_normal_a, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT}, {{TV_SYSTEM_PAL, 640, 480, "Huge", "4:3", 06.22, 00.69}, &nv_bt_pal_huge_a, &bt_pal_huge_a, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT}, {{TV_SYSTEM_PAL, 800, 600, "Small", "4:3", 14.53, 13.19}, &nv_bt_pal_small_b, &bt_pal_small_b, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL, 800, 600, "Normal", "4:3", 10.81, 05.56}, &nv_bt_pal_normal_b, &bt_pal_normal_b, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL, 800, 600, "Large", "4:3", 07.461, 02.083}, &nv_bt_pal_large_b, &bt_pal_large_b, -8, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL, 800, 600, "Huge", "4:3", 00.039, 00.00}, &nv_bt_pal_huge_b, &bt_pal_huge_b, 14, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT}, {{TV_SYSTEM_PAL, 768, 576, "Small", "4:3", 13.122, 07.986}, &nv_bt_pal_small_c, &bt_pal_small_c, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL, 768, 576, "Normal", "4:3", 09.806, 04.514}, &nv_bt_pal_normal_c, &bt_pal_normal_c, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL, 768, 576, "Huge", "4:3", 00.000, 00.000}, &nv_bt_pal_huge_c, &bt_pal_huge_c, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL, 800, 576, "Normal", "???", 08.83, 07.29}, &nv_bt_pal_normal_d, &bt_pal_normal_d, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL, 720, 576, "DVD", "DVD", 00.208, 00.000}, &nv_bt_pal_dvd_a, &bt_pal_dvd_a, 4, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL_60, 640, 480, "Small", "4:3", 16.76, 14.81}, &nv_bt_pal60_small_a, &bt_pal60_small_a, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL_60, 640, 480, "Normal", "4:3", 10.59, 08.23}, &nv_bt_pal60_normal_a, &bt_pal60_normal_a, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL_60, 640, 480, "Huge", "4:3", 01.47, 01.23}, &nv_bt_pal60_huge_a, &bt_pal60_huge_a, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL_60, 800, 600, "Small", "4:3", 21.62, 11.52}, &nv_bt_pal60_small_b, &bt_pal60_small_b, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL_60, 800, 600, "Normal", "4:3", 11.90, 05.35}, &nv_bt_pal60_normal_b, &bt_pal60_normal_b, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL_60, 800, 600, "Huge", "4:3", 07.86, 00.82}, &nv_bt_pal60_huge_b, &bt_pal60_huge_b, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL_60, 720, 480, "DVD", "DVD", 01.245, 01.235}, &nv_bt_pal60_dvd_a, &bt_pal60_dvd_a, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT_DUAL}, #ifdef CONFIG_ASYNC_BT {{TV_SYSTEM_PAL, 640, 480, "Small*", "4:3", 16.56, 16.67}, &nv_bt_async_pal_small_a, &bt_async_pal_small_a, 0, PORT_NVIDIA_PCLK_SLAVE, PORT_NVIDIA, TV_DEF_BT_DUAL}, {{TV_SYSTEM_PAL, 640, 480, "Small$", "4:3", 16.56, 16.67}, &nv_bt_slave_pal_small_a, &bt_pal_small_a, 0, PORT_NVIDIA_SYNC_SLAVE, PORT_NVIDIA_SYNC_SLAVE, TV_DEF_BT_DUAL}, #endif #ifdef CONFIG_OVERLAY_NV {{TV_SYSTEM_PAL, 640, 480, "Small@", "4:3", 16.56, 16.67}, &nv_bt_ovly_pal_small_a, &bt_pal_small_a, 0, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_BT | TV_CAP_OVERLAY}, #endif {{TV_SYSTEM_NONE, 0, 0, NULL, NULL, 0.0, 0.0}, NULL, NULL, 0, 0}, }; /* -------- -------- */ static TVMode *modes_nv_bt = NULL; /* * count number of modes matching system; TV_SYSTEM_NONE matches all. */ int data_count_nv_bt (TVSystem system) { int count; TVTemplateNvBt *t; count = 0; for (t = templ_nv_bt; t->spec.system != TV_SYSTEM_NONE; t++) { if (system == TV_SYSTEM_NONE || system == t->spec.system) count++; } return count; } static TVMode* loop_create_nv_bt (TVMode *m, TVTemplateNvBt *t, TVSystem convert_from, TVSystem convert_to) { for (; t->spec.system != TV_SYSTEM_NONE; t++) { if (convert_from == TV_SYSTEM_NONE || t->spec.system == convert_from) { m->spec = t->spec; if (convert_to != TV_SYSTEM_NONE) m->spec.system = convert_to; m->descFlags = t->descFlags; m->regs.portHost = t->hostFlags; m->regs.portEnc = t->encFlags; m->regs.portHost = m->regs.portEnc = PORT_NVIDIA; m->regs.devFlags = DEV_TELEVISION; if (t->descFlags & TV_CAP_DUALVIEW) m->regs.devFlags = DEV_MONITOR | DEV_TELEVISION; if (t->descFlags & TV_CAP_OVERLAY) m->regs.devFlags = DEV_TELEVISION | DEV_OVERLAY; m->regs.crtc.nv = *(t->nv); m->regs.enc.bt = *(t->bt); m->regs.enc.bt.hsynoffset = t->hsynoffset; data_mux_nv_bt (&m->regs.enc.bt); data_init_nomux_bt (m->spec.system, &m->regs.enc.bt); data_init_nv (&m->regs.crtc.nv, m->regs.portHost, m->regs.devFlags); switch (convert_to) { case TV_SYSTEM_NTSC_J: break; /* handled by init */ case TV_SYSTEM_PAL_M: data_ntsc_palm_bt (&m->regs.enc.bt); break; default: break; } m++; } } return m; } TVMode* data_modes_nv_bt (void) { int c; TVMode *m; if (modes_nv_bt) return modes_nv_bt; c = data_count_nv_bt (TV_SYSTEM_NONE) + data_count_nv_bt (TV_SYSTEM_NTSC) /* NTSC_J */ + data_count_nv_bt (TV_SYSTEM_NTSC) /* PAL_M */ + 1; /* final zero */ modes_nv_bt = (TVMode *) malloc (sizeof (TVMode) * c); m = modes_nv_bt; m = loop_create_nv_bt (m, templ_nv_bt, TV_SYSTEM_NONE, TV_SYSTEM_NONE); m = loop_create_nv_bt (m, templ_nv_bt, TV_SYSTEM_NTSC, TV_SYSTEM_NTSC_J); m = loop_create_nv_bt (m, templ_nv_bt, TV_SYSTEM_NTSC, TV_SYSTEM_PAL_M); m->spec.system = TV_SYSTEM_NONE; return modes_nv_bt; } /* ======== CX ================================ */ #define TV_DEF_CX (TV_CAP_MACROVISION | TV_CAP_NONINTERLACED \ | TV_CAP_MONOCHROME) #define TV_DEF_CX_DUAL (TV_DEF_CX | TV_DEF_DUALVIEW) /* -------- CX -------- NTSC -------- */ /* -------- 1024x768 3:2 -------- */ TVNvRegs cx_crt_ntsc_small_a = { HDisplay : 1024, HSyncStart : 1040, /* guess */ HSyncEnd : 1104, /* guess */ HTotal : 1176, VDisplay : 768, VSyncStart : 845, /* guess */ VSyncEnd : 847, /* guess */ VTotal : 975, // PrivFlags : TV_DEF_CX | TV_DEF_DUALVIEW, flags : 0, }; TVNvRegs cx_crt_ntsc_normal_a = { HDisplay : 1024, HSyncStart : 1040, /* guess */ HSyncEnd : 1104, /* guess */ HTotal : 1170, VDisplay : 768, VSyncStart : 830, /* guess */ VSyncEnd : 832, /* guess */ VTotal : 945, // Privflags : TV_DEF_CX | TV_DEF_DUALVIEW, flags : 0, }; TVNvRegs cx_crt_ntsc_tiny_a = { HDisplay : 1024, HSyncStart : 1040, /* guess */ HSyncEnd : 1104, /* guess */ HTotal : 1170, VDisplay : 768, VSyncStart : 865, /* guess */ VSyncEnd : 867, /* guess */ VTotal : 1015, // Privflags : TV_DEF_CX | TV_DEF_DUALVIEW, flags : 0, }; /* -------- 800x600 3:2 -------- */ TVNvRegs cx_crt_ntsc_small_b = { HDisplay : 800, HSyncStart : 880, /* verified, Arne */ HSyncEnd : 936, HTotal : 1176, VDisplay : 600, VSyncStart : 656, VSyncEnd : 658, VTotal : 750, // Privflags : TV_DEF_CX | TV_DEF_DUALVIEW, flags : 0, }; TVNvRegs cx_crt_ntsc_tiny_b = { HDisplay : 800, HSyncStart : 920, /* verified, Arne */ HSyncEnd : 984, HTotal : 1194, /* verified, Arne. Calc: 1170 */ VDisplay : 600, VSyncStart : 680, VSyncEnd : 682, VTotal : 805, // Privflags : TV_DEF_CX | TV_DEF_DUALVIEW, flags : 0, }; TVNvRegs cx_crt_ntsc_mini_b = { HDisplay : 800, HSyncStart : 900, /* verified, Arne */ HSyncEnd : 964, HTotal : 1194, /* verified, Arne. Calc: 1170 */ VDisplay : 600, VSyncStart : 665, VSyncEnd : 667, VTotal : 770, // Privflags : TV_DEF_CX | TV_DEF_DUALVIEW, flags : 0, }; /* -------- CX -------- PAL -------- */ /* -------- 1024x768 3:2 -------- */ TVNvRegs cx_crt_pal_small_a = { HDisplay : 1024, HSyncStart : 1040, /* verified, Arne */ HSyncEnd : 1096, /* verified, Arne */ HTotal : 1328, /* verified, Arne. Calc: 1400 */ VDisplay : 768, VSyncStart : 846, /* verified, Arne. */ VSyncEnd : 848, /* Arne: 846 ??? */ VTotal : 980, // Privflags : TV_DEF_CX | TV_DEF_DUALVIEW, flags : 0, }; TVNvRegs cx_crt_pal_mini_a = { HDisplay : 1024, HSyncStart : 1104, /* verified, Arne. */ HSyncEnd : 1184, /* verified, Arne. */ HTotal : 1394, VDisplay : 768, VSyncStart : 853, VSyncEnd : 855, VTotal : 1000, // Privflags : TV_DEF_CX | TV_DEF_DUALVIEW, flags : 0, }; /* -------- CX modes -------- */ typedef struct { TVModeSpec spec; TVNvRegs *nv; TVCxRegs *cx; int hostFlags; int encFlags; int descFlags; } TVTemplateNvCx; TVTemplateNvCx templ_nv_cx [] = { {{TV_SYSTEM_NTSC, 1024, 768, "Tiny", "4:3", 18.04, 18.11}, /* Mode 42 */ &cx_crt_ntsc_tiny_a, &cx_ntsc_tiny_a, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_CX_DUAL}, {{TV_SYSTEM_NTSC, 1024, 768, "Small", "4:3", 15.11, 14.81}, /* Mode 10 */ &cx_crt_ntsc_small_a, &cx_ntsc_small_a, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_CX_DUAL}, {{TV_SYSTEM_NTSC, 1024, 768, "Normal", "4:3", 11.97, 11.93}, /* Mode 26 */ &cx_crt_ntsc_normal_a, &cx_ntsc_normal_a, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_CX_DUAL}, {{TV_SYSTEM_NTSC, 800, 600, "Tiny+", "4:3", 19.26, 19.34}, /* Mode 34 */ &cx_crt_ntsc_tiny_b, &cx_ntsc_tiny_b, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_CX_DUAL}, {{TV_SYSTEM_NTSC, 800, 600, "Mini+", "4:3", 15.59, 15.64}, /* Mode 40 */ &cx_crt_ntsc_mini_b, &cx_ntsc_mini_b, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_CX_DUAL}, {{TV_SYSTEM_NTSC, 800, 600, "Small+", "4:3", 13.79, 13.58}, /* Mode 18 */ &cx_crt_ntsc_small_b, &cx_ntsc_small_b, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_CX_DUAL}, {{TV_SYSTEM_PAL, 1024, 768, "Mini", "4:3", 16.20, 16.67}, /* Mode 43 */ &cx_crt_pal_mini_a, &cx_pal_mini_a, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_CX_DUAL}, {{TV_SYSTEM_PAL, 1024, 768, "Small", "4:3", 13.44, 14.24}, /* Mode 11 */ &cx_crt_pal_small_a, &cx_pal_small_a, PORT_NVIDIA, PORT_NVIDIA, TV_DEF_CX_DUAL}, {{TV_SYSTEM_NONE, 0, 0, NULL, NULL, 0.0, 0.0}, NULL, NULL, 0}, }; /* -------- -------- */ static TVMode* modes_nv_cx = NULL; /* * count number of modes matching system; TV_SYSTEM_NONE matches all. */ int data_count_nv_cx (TVTemplateNvCx *t, TVSystem system) { int count; count = 0; for (; t->spec.system != TV_SYSTEM_NONE; t++) { if (system == TV_SYSTEM_NONE || system == t->spec.system) count++; } return count; } /* * Create CX modes from both BT and CX templates. */ static TVMode* loop_create_nv_btcx (TVMode *m, TVTemplateNvBt *t, TVSystem convert_from, TVSystem convert_to) { for (; t->spec.system != TV_SYSTEM_NONE; t++) { if (convert_from == TV_SYSTEM_NONE || t->spec.system == convert_from) { m->spec = t->spec; if (convert_to != TV_SYSTEM_NONE) m->spec.system = convert_to; m->descFlags = t->descFlags; m->regs.portHost = t->hostFlags; m->regs.portEnc = t->encFlags; m->regs.portHost = m->regs.portEnc = PORT_NVIDIA; m->regs.devFlags = (t->descFlags & TV_CAP_DUALVIEW) ? (DEV_MONITOR | DEV_TELEVISION) : (DEV_TELEVISION); m->regs.crtc.nv = *(t->nv); m->regs.enc.cx.bt = *(t->bt); m->regs.enc.cx.bt.hsynoffset = t->hsynoffset; /* does data_mux_nv_bt */ data_init_cx (m->spec.system, &m->regs.enc.cx, TRUE); data_init_nv (&m->regs.crtc.nv, m->regs.portHost, m->regs.devFlags); switch (convert_to) { case TV_SYSTEM_NTSC_J: break; /* handled by init */ case TV_SYSTEM_PAL_M: data_ntsc_palm_bt (&m->regs.enc.cx.bt); break; case TV_SYSTEM_SECAM: data_secam_cx (&m->regs.enc.cx); break; default: break; } m++; } } return m; } static TVMode* loop_create_nv_cx (TVMode *m, TVTemplateNvCx *t, TVSystem convert_from, TVSystem convert_to) { for (; t->spec.system != TV_SYSTEM_NONE; t++) { if (convert_from == TV_SYSTEM_NONE || t->spec.system == convert_from) { m->spec = t->spec; if (convert_to != TV_SYSTEM_NONE) m->spec.system = convert_to; m->descFlags = t->descFlags; m->regs.portHost = t->hostFlags; m->regs.portEnc = t->encFlags; m->regs.devFlags = (t->descFlags & TV_CAP_DUALVIEW) ? (DEV_MONITOR | DEV_TELEVISION) : (DEV_TELEVISION); m->regs.crtc.nv = *(t->nv); m->regs.enc.cx = *(t->cx); /* does data_mux_nv_bt */ data_init_cx (m->spec.system, &m->regs.enc.cx, FALSE); data_init_nv (&m->regs.crtc.nv, m->regs.portHost, m->regs.devFlags); switch (convert_to) { case TV_SYSTEM_NTSC_J: break; /* handled by init */ case TV_SYSTEM_PAL_M: data_ntsc_palm_bt (&m->regs.enc.cx.bt); break; case TV_SYSTEM_SECAM: data_secam_cx (&m->regs.enc.cx); break; default: break; } m++; } } return m; } TVMode *data_modes_nv_cx (void) { int c; TVMode *m; if (modes_nv_cx) return modes_nv_cx; c = data_count_nv_bt (TV_SYSTEM_NONE) + data_count_nv_bt (TV_SYSTEM_PAL) /* SECAM */ + data_count_nv_bt (TV_SYSTEM_NTSC) /* NTSC_J */ + data_count_nv_bt (TV_SYSTEM_NTSC) /* PAL_M */ + data_count_nv_cx (templ_nv_cx, TV_SYSTEM_NONE) + data_count_nv_cx (templ_nv_cx, TV_SYSTEM_PAL) /* SECAM */ + data_count_nv_cx (templ_nv_cx, TV_SYSTEM_NTSC) /* NTSC_J */ + data_count_nv_cx (templ_nv_cx, TV_SYSTEM_NTSC) /* PAL_M */ + 1; /* final zero */ modes_nv_cx = (TVMode *) malloc (sizeof (TVMode) * c); m = modes_nv_cx; m = loop_create_nv_btcx (m, templ_nv_bt, TV_SYSTEM_NONE, TV_SYSTEM_NONE); m = loop_create_nv_btcx (m, templ_nv_bt, TV_SYSTEM_PAL, TV_SYSTEM_SECAM); m = loop_create_nv_btcx (m, templ_nv_bt, TV_SYSTEM_NTSC, TV_SYSTEM_NTSC_J); m = loop_create_nv_btcx (m, templ_nv_bt, TV_SYSTEM_NTSC, TV_SYSTEM_PAL_M); m = loop_create_nv_cx (m, templ_nv_cx, TV_SYSTEM_NONE, TV_SYSTEM_NONE); m = loop_create_nv_cx (m, templ_nv_cx, TV_SYSTEM_PAL, TV_SYSTEM_SECAM); m = loop_create_nv_cx (m, templ_nv_cx, TV_SYSTEM_NTSC, TV_SYSTEM_NTSC_J); m = loop_create_nv_cx (m, templ_nv_cx, TV_SYSTEM_NTSC, TV_SYSTEM_PAL_M); m->spec.system = TV_SYSTEM_NONE; return modes_nv_cx; } /* ======== CH ================================ */ #define TV_DEF_CH (TV_CAP_MONOCHROME | TV_CAP_COLORFIX) /* -------- CH1 -------- NTSC -------- */ /* -------- 640x480 -------- */ TVNvRegs nv_ch1_ntsc_huge_a = { HDisplay : 640, HSyncStart : 664-8, HSyncEnd : 736-8, HTotal : 784, /* Mode 16 ch: 784 */ VDisplay : 480, VSyncStart : 486, VSyncEnd : 488, VTotal : 525, /* Mode 16 ch: 525 */ flags : 0, }; TVNvRegs nv_ch1_ntsc_small_a = { HDisplay : 640, HSyncStart : 664-8, HSyncEnd : 736-8, HTotal : 784, /* Mode 17 ch: 784 */ VDisplay : 480, VSyncStart : 522, VSyncEnd : 524, VTotal : 600, /* Mode 17 ch: 600 */ flags : 0, }; TVNvRegs nv_ch1_ntsc_tiny_a = { HDisplay : 640, HSyncStart : 672-8, HSyncEnd : 744-8, HTotal : 800, /* Mode 18 ch: 800 */ VDisplay : 480, VSyncStart : 538, VSyncEnd : 540, VTotal : 630, /* Mode 18 ch: 630 */ flags : 0, }; /* -------- 800x600 -------- */ TVNvRegs nv_ch1_ntsc_huge_b = { HDisplay : 800, HSyncStart : 856-8, HSyncEnd : 920-8, HTotal : 1040, /* Mode 22 ch: 1040 */ VDisplay : 600, VSyncStart : 600, VSyncEnd : 602, VTotal : 630, /* Mode 22 ch: 630 */ flags : 0, }; TVNvRegs nv_ch1_ntsc_large_b = { HDisplay : 800, HSyncStart : 880-8, HSyncEnd : 968-8, HTotal : 1040, /* Mode 23 ch: 1040 */ VDisplay : 600, VSyncStart : 626, VSyncEnd : 628, VTotal : 700, /* Mode 23 ch: 700 */ flags : 0, }; TVNvRegs nv_ch1_ntsc_small_b = { HDisplay : 800, HSyncStart : 896-8, HSyncEnd : 960-8, HTotal : 1064, /* Mode 24 ch: 1064 */ VDisplay : 600, VSyncStart : 652, VSyncEnd : 654, VTotal : 750, /* Mode 24 ch: 750 */ flags : 0, }; /* -------- 640x400 -------- */ TVNvRegs nv_ch1_ntsc_huge_c = { /* FIXME: Doesn't work */ HDisplay : 640, HSyncStart : 704-8, HSyncEnd : 768-8, HTotal : 840, /* Mode 10 ch: 840 */ VDisplay : 400, VSyncStart : 410, VSyncEnd : 411, VTotal : 420, /* Mode 10 ch: 420 */ flags : 0, }; TVNvRegs nv_ch1_ntsc_small_c = { HDisplay : 640, HSyncStart : 696-8, HSyncEnd : 760-8, HTotal : 840, /* Mode 11 ch: 840 */ VDisplay : 400, VSyncStart : 444, VSyncEnd : 446, VTotal : 525, /* Mode 11 ch: 525 */ flags : 0, }; TVNvRegs nv_ch1_ntsc_tiny_c = { HDisplay : 640, HSyncStart : 696-8, HSyncEnd : 768-8, HTotal : 840, /* Mode 12 ch: 840 */ VDisplay : 400, VSyncStart : 480, VSyncEnd : 482, VTotal : 600, /* Mode 12 ch: 600 */ flags : 0, }; /* -------- 720x400 -------- */ TVNvRegs nv_ch1_ntsc_huge_d = { HDisplay : 720, HSyncStart : 784-8, HSyncEnd : 864-8, HTotal : 945, /* Mode 6 ch: 945 */ VDisplay : 400, VSyncStart : 404, VSyncEnd : 405, VTotal : 420, /* Mode 6 ch: 420 */ flags : 0, }; TVNvRegs nv_ch1_ntsc_small_d = { HDisplay : 720, HSyncStart : 784-8, HSyncEnd : 864-8, HTotal : 936, /* Mode 7 ch: 936 */ VDisplay : 400, VSyncStart : 450, VSyncEnd : 452, VTotal : 525, /* Mode 7 ch: 525 */ flags : 0, }; /* -------- 512x384 -------- */ TVNvRegs nv_ch1_ntsc_large_e = { HDisplay : 512, HSyncStart : 616-8, HSyncEnd : 688-8, HTotal : 800, /* Mode 2 ch: 800 */ VDisplay : 384, VSyncStart : 396, VSyncEnd : 398, VTotal : 420, /* Mode 2 ch: 420 */ flags : 0, }; TVNvRegs nv_ch1_ntsc_small_e = { HDisplay : 512, HSyncStart : 608-8, HSyncEnd : 672-8, HTotal : 784, /* Mode 3 ch: 784 */ VDisplay : 384, VSyncStart : 434, VSyncEnd : 436, VTotal : 525, /* Mode 3 ch: 525 */ flags : 0, }; /* -------- DVD convenience modes -------- */ TVNvRegs nv_ch1_ntsc_large_f = { /* test */ HDisplay : 768, HSyncStart : 856-8, HSyncEnd : 952-8, HTotal : 1040, /* Mode 23 ch: 1040 */ VDisplay : 576, VSyncStart : 618, VSyncEnd : 620, VTotal : 700, /* Mode 23 ch: 700 */ flags : 0, }; TVNvRegs nv_ch1_ntsc_large_g = { /* test */ HDisplay : 800, HSyncStart : 880-8, HSyncEnd : 968-8, HTotal : 1040, /* Mode 23 ch: 1040 */ VDisplay : 450, VSyncStart : 550, VSyncEnd : 552, VTotal : 700, /* Mode 23 ch: 700 */ flags : 0, }; /* -------- 720x{576,480} DVD -------- */ /* Note: Not used yet, crt values not tested */ TVNvRegs nv_ch1_ntsc_interl_dvd = { HDisplay : 720, HSyncStart : 752-8, HSyncEnd : 768-8, HTotal : 858, /* Mode 26 ch: 858 */ VDisplay : 480, VSyncStart : 500, VSyncEnd : 501, VTotal : 525, /* Mode 26 ch: 525 */ flags : 0, }; /* -------- CH -------- PAL -------- */ /* -------- 640x480 -------- */ /* FIXME: crt_pal_large_a -- no dualview, not in tvcc either */ TVNvRegs nv_ch1_pal_huge_a = { HDisplay : 640, HSyncStart : 688-8, HSyncEnd : 760-8, HTotal : 760, /* Mode 13 ch: 840 */ VDisplay : 480, VSyncStart : 532, VSyncEnd : 534, VTotal : 574, /* Mode 13 ch: 500 */ flags : 0, }; TVNvRegs nv_ch1_pal_small_a = { HDisplay : 640, HSyncStart : 688-8, HSyncEnd : 760-8, HTotal : 760, /* Mode 14 ch: 840 */ VDisplay : 480, VSyncStart : 532, VSyncEnd : 534, VTotal : 574, /* Mode 14 ch: 625 */ flags : 0, }; TVNvRegs nv_ch1_pal_tiny_a = { HDisplay : 640, HSyncStart : 688-8, HSyncEnd : 760-8, HTotal : 760, /* Mode 15 ch: 840 */ VDisplay : 480, VSyncStart : 590, VSyncEnd : 592, VTotal : 750, /* Mode 15 ch: 750 */ flags : 0, }; /* -------- 800x600 -------- */ /* FIXME: huge has significant distortion on right hand side */ TVNvRegs nv_ch1_pal_huge_b = { HDisplay : 800, HSyncStart : 808-8, HSyncEnd : 872-8, HTotal : 944, /* Mode 19 ch: 944 */ VDisplay : 600, VSyncStart : 600, VSyncEnd : 601, VTotal : 635, /* Mode 19 ch: 625 */ flags : 0, }; TVNvRegs nv_ch1_pal_small_b = { HDisplay : 800, HSyncStart : 824-8, HSyncEnd : 888-8, HTotal : 960, /* Mode 20 ch: 960 */ VDisplay : 600, VSyncStart : 656, VSyncEnd : 658, VTotal : 750, /* Mode 20 ch: 750 */ flags : 0, }; TVNvRegs nv_ch1_pal_tiny_b = { HDisplay : 800, HSyncStart : 840-8, HSyncEnd : 904-8, HTotal : 936, /* Mode 21 ch: 936 */ VDisplay : 600, VSyncStart : 709, VSyncEnd : 711, VTotal : 836, /* Mode 21 ch: 836 */ flags : 0, }; /* Note: Mode 21 has 627 PAL lines instead of 625 */ /* -------- 640x400 -------- */ TVNvRegs nv_ch1_pal_small_c = { HDisplay : 640, HSyncStart : 824-8, HSyncEnd : 888-8, HTotal : 1000, /* Mode 8 ch: 1000 */ VDisplay : 400, VSyncStart : 440, VSyncEnd : 442, VTotal : 500, /* Mode 8 ch: 500 */ flags : 0, }; TVNvRegs nv_ch1_pal_tiny_c = { HDisplay : 640, HSyncStart : 760-8, HSyncEnd : 824-8, HTotal : 936, /* Mode 9 ch: 1008 */ VDisplay : 400, VSyncStart : 496, VSyncEnd : 498, VTotal : 625, /* Mode 9 ch: 625 */ flags : 0, }; /* -------- 720x400 -------- */ TVNvRegs nv_ch1_pal_small_d = { HDisplay : 720, HSyncStart : 824-8, HSyncEnd : 888-8, HTotal : 1125, /* Mode 4 ch: 1125 */ VDisplay : 400, VSyncStart : 437, VSyncEnd : 439, VTotal : 500, /* Mode 4 ch: 500 */ flags : 0, }; TVNvRegs nv_ch1_pal_tiny_d = { HDisplay : 720, HSyncStart : 840-8, HSyncEnd : 904-8, HTotal : 1116, /* Mode 5 ch: 1116 */ VDisplay : 400, VSyncStart : 498, VSyncEnd : 500, VTotal : 625, /* Mode 5 ch: 625 */ flags : 0, }; /* -------- 512x384 -------- */ TVNvRegs nv_ch1_pal_small_e = { HDisplay : 512, HSyncStart : 640-8, HSyncEnd : 704-8, HTotal : 840, /* Mode 0 ch: 840 */ VDisplay : 384, VSyncStart : 428, VSyncEnd : 430, VTotal : 500, /* Mode 0 ch: 500 */ flags : 0, }; TVNvRegs nv_ch1_pal_tiny_e = { HDisplay : 512, HSyncStart : 624-8, HSyncEnd : 704-8, HTotal : 840, /* Mode 1 ch: 840 */ VDisplay : 384, VSyncStart : 498, VSyncEnd : 500, VTotal : 625, /* Mode 1 ch: 625 */ flags : 0, }; /* -------- DVD convenience modes -------- */ TVNvRegs nv_ch1_pal_large_f = { /* test FIXME: SyncStart ok ?? */ HDisplay : 768, HSyncStart : 800-8, HSyncEnd : 872-8, HTotal : 944, /* Mode 19 ch: 944 */ VDisplay : 576, VSyncStart : 592, VSyncEnd : 594, VTotal : 635, /* Mode 19 ch: 625 */ flags : 0, }; TVNvRegs nv_ch1_pal_large_g = { /* test */ HDisplay : 800, HSyncStart : 808-8, HSyncEnd : 872-8, HTotal : 944, /* Mode 19 ch: 944 */ VDisplay : 450, VSyncStart : 530, VSyncEnd : 532, VTotal : 635, /* Mode 19 ch: 625 */ flags : 0, }; TVNvRegs nv_ch1_pal_small_f = { /* test */ HDisplay : 768, HSyncStart : 808-8, HSyncEnd : 880-8, HTotal : 960, /* Mode 20 ch: 960 */ VDisplay : 576, VSyncStart : 642, VSyncEnd : 644, VTotal : 750, /* Mode 20 ch: 750 */ flags : 0, }; TVNvRegs nv_ch1_pal_small_g = { /* test */ HDisplay : 800, HSyncStart : 824-8, HSyncEnd : 888-8, HTotal : 960, /* Mode 20 ch: 960 */ VDisplay : 450, VSyncStart : 582, VSyncEnd : 584, VTotal : 750, /* Mode 20 ch: 750 */ flags : 0, }; /* -------- 720x{576,480} DVD -------- */ TVNvRegs nv_ch1_pal_interl_dvd = { HDisplay : 720, HSyncStart : 752-8, HSyncEnd : 768-8, HTotal : 864, /* Mode 25 ch: 864 */ VDisplay : 576, VSyncStart : 600, VSyncEnd : 602, VTotal : 625, /* Mode 25 ch: 625 */ flags : 0, }; /* -------- CH2 -------- NTSC -------- */ TVNvRegs nv_ch2_ntsc_huge_c = { /* Mode 19 */ HDisplay : 720, HSyncStart : 0, HSyncEnd : 0, HTotal : 882, VDisplay : 480, VSyncStart : 0, VSyncEnd : 0, VTotal : 525, flags : 0, }; TVNvRegs nv_ch2_ntsc_small_c = { /* Mode 20 */ HDisplay : 720, HSyncStart : 0, HSyncEnd : 0, HTotal : 882, VDisplay : 480, VSyncStart : 0, VSyncEnd : 0, VTotal : 600, flags : 0, }; TVNvRegs nv_ch2_ntsc_tiny_c = { /* Mode 21 */ HDisplay : 720, HSyncStart : 0, HSyncEnd : 0, HTotal : 900, VDisplay : 480, VSyncStart : 0, VSyncEnd : 0, VTotal : 630, flags : 0, }; TVNvRegs nv_ch2_ntsc_large_b = { /* Mode 28 */ HDisplay : 800, HSyncStart : 0, HSyncEnd : 0, HTotal : 1040, VDisplay : 600, VSyncStart : 0, VSyncEnd : 0, VTotal : 700, flags : 0, }; TVNvRegs nv_ch2_ntsc_small_b = { /* Mode 29 */ HDisplay : 800, HSyncStart : 0, HSyncEnd : 0, HTotal : 1064, VDisplay : 600, VSyncStart : 0, VSyncEnd : 0, VTotal : 750, flags : 0, }; TVNvRegs nv_ch2_ntsc_tiny_b = { /* Mode 30 */ HDisplay : 800, HSyncStart : 0, HSyncEnd : 0, HTotal : 1040, VDisplay : 600, VSyncStart : 0, VSyncEnd : 0, VTotal : 840, flags : 0, }; TVNvRegs nv_ch2_ntsc_huge_a = { /* Mode 34 */ HDisplay : 1024, HSyncStart : 0, HSyncEnd : 0, HTotal : 1160, VDisplay : 768, VSyncStart : 0, VSyncEnd : 0, VTotal : 840, flags : 0, }; TVNvRegs nv_ch2_ntsc_large_a = { /* Mode 35 */ HDisplay : 1024, HSyncStart : 0, HSyncEnd : 0, HTotal : 1160, VDisplay : 768, VSyncStart : 0, VSyncEnd : 0, VTotal : 945, flags : 0, }; TVNvRegs nv_ch2_ntsc_tiny_a = { /* Mode 36 */ HDisplay : 1024, HSyncStart : 0, HSyncEnd : 0, HTotal : 1168, VDisplay : 768, VSyncStart : 0, VSyncEnd : 0, VTotal : 1050, flags : 0, }; TVNvRegs nv_ch2_ntsc_dvd = { /* Mode 38 */ HDisplay : 720, HSyncStart : 0, HSyncEnd : 0, HTotal : 858, VDisplay : 480, VSyncStart : 0, VSyncEnd : 0, VTotal : 525, flags : 0, }; /* -------- CH2 -------- PAL -------- */ TVNvRegs nv_ch2_pal_huge_d = { /* Mode 22 */ HDisplay : 720, HSyncStart : 0, HSyncEnd : 0, HTotal : 882, VDisplay : 576, VSyncStart : 0, VSyncEnd : 0, VTotal : 625, flags : 0, }; TVNvRegs nv_ch2_pal_small_d = { /* Mode 23 */ HDisplay : 720, HSyncStart : 0, HSyncEnd : 0, HTotal : 900, VDisplay : 576, VSyncStart : 0, VSyncEnd : 0, VTotal : 750, flags : 0, }; TVNvRegs nv_ch2_pal_tiny_d = { /* Mode 24 */ HDisplay : 720, HSyncStart : 0, HSyncEnd : 0, HTotal : 900, VDisplay : 576, VSyncStart : 0, VSyncEnd : 0, VTotal : 875, flags : 0, }; TVNvRegs nv_ch2_pal_huge_b = { /* Mode 25 */ HDisplay : 800, HSyncStart : 0, HSyncEnd : 0, HTotal : 944, VDisplay : 600, VSyncStart : 0, VSyncEnd : 0, VTotal : 625, flags : 0, }; TVNvRegs nv_ch2_pal_small_b = { /* Mode 26 */ HDisplay : 800, HSyncStart : 0, HSyncEnd : 0, HTotal : 960, VDisplay : 600, VSyncStart : 0, VSyncEnd : 0, VTotal : 750, flags : 0, }; TVNvRegs nv_ch2_pal_tiny_b = { /* Mode 27 */ HDisplay : 800, HSyncStart : 0, HSyncEnd : 0, HTotal : 960, VDisplay : 600, VSyncStart : 0, VSyncEnd : 0, VTotal : 875, flags : 0, }; TVNvRegs nv_ch2_pal_huge_a = { /* Mode 31 */ HDisplay : 1024, HSyncStart : 0, HSyncEnd : 0, HTotal : 1400, VDisplay : 768, VSyncStart : 0, VSyncEnd : 0, VTotal : 875, flags : 0, }; TVNvRegs nv_ch2_pal_small_a = { /* Mode 32 */ HDisplay : 1024, HSyncStart : 0, HSyncEnd : 0, HTotal : 1400, VDisplay : 768, VSyncStart : 0, VSyncEnd : 0, VTotal : 1000, flags : 0, }; TVNvRegs nv_ch2_pal_tiny_a = { /* Mode 33 */ HDisplay : 1024, HSyncStart : 0, HSyncEnd : 0, HTotal : 1400, VDisplay : 768, VSyncStart : 0, VSyncEnd : 0, VTotal : 1125, flags : 0, }; TVNvRegs nv_ch2_pal_dvd = { /* Mode 37 */ HDisplay : 720, HSyncStart : 0, HSyncEnd : 0, HTotal : 864, VDisplay : 576, VSyncStart : 0, VSyncEnd : 0, VTotal : 625, flags : 0, }; /* -------- CH1/NV -------- Slave modes -------- */ /* NTSC 000001a4 0000020d 18 ; 320x200 -> 420 525 24 Mode 11 doublepix 00000188 00000258 0d ; 320x240 -> 392 600 13 Mode 17 doublepix 00000348 0000020d 03 ; 640x400 -> 840 525 03 Mode 11 00000310 00000258 0d ; 640x480 -> 784 600 13 Mode 17 00000428 000002ee 00 ; 720x480 -> 1064 750 0 Mode (24) 00000410 00000276 00 ; 720x576 -> 1040 630 0 Mode (22) 00000428 000002ee 0d ; 800x600 -> 1064 750 13 Mode 24 PAL 000001f4 000001f4 06 ; 320x200 -> 500 500 6 Mode 8 doublepix 000001a4 00000271 08 ; 320x240 -> 420 625 8 Mode 1,14 ? 000003e8 000001f4 05 ; 640x400 -> 1000 500 5 Mode 8 00000348 00000271 05 ; 640x480 -> 840 625 5 Mode 14 000003c0 000002ee 05 ; 720x480 -> 960 750 5 Mode (20) 000003b0 00000271 00 ; 720x576 -> 944 625 0 Mode 19 000003c0 000002ee 05 ; 800x600 -> 960 750 5 Mode 20 Mode 0: 512 384 840 500 525, 800 0.833333 560, 750 0.888889 600, 700 0.952381 625, 672 0.992063 672, 625 1.06667 700, 600 1.11111 750, 560 1.19048 800, 525 1.26984 840, 500 1.33333 Mode 1: 512 384 840 625 525, 1000 0.833333 600, 875 0.952381 625, 840 0.992063 700, 750 1.11111 750, 700 1.19048 840, 625 1.33333 Mode 2: 512 384 800 420 525, 640 0.875 560, 600 0.933333 600, 560 1.0 640, 525 1.06667 672, 500 1.12 700, 480 1.16667 750, 448 1.25 800, 420 1.33333 Mode 3: 512 384 784 525 525, 784 0.892857 560, 735 0.952381 588, 700 1.0 600, 686 1.02041 686, 600 1.16667 700, 588 1.19048 735, 560 1.25 784, 525 1.33333 Mode 4: 720 400 1125 500 750, 750 1.2 900, 625 1.44 1125, 500 1.8 Mode 5: 720 400 1116 625 750, 930 1.20968 775, 900 1.25 900, 775 1.45161 930, 750 1.5 1116, 625 1.8 Mode 6: 720 400 945 420 735, 540 1.4 756, 525 1.44 810, 490 1.54286 882, 450 1.68 900, 441 1.71429 945, 420 1.8 Mode 7: 720 400 936 525 728, 675 1.4 756, 650 1.45385 780, 630 1.5 819, 600 1.575 840, 585 1.61538 900, 546 1.73077 910, 540 1.75 936, 525 1.8 Mode 8: 640 400 1000 500 800, 625 1.28 1000, 500 1.6 Mode 9: 640 400 1008 625 700, 900 1.11111 720, 875 1.14286 750, 840 1.19048 840, 750 1.33333 875, 720 1.38889 900, 700 1.42857 1000, 630 1.5873 1008, 625 1.6 Mode 10: 640 400 840 420 672, 525 1.28 700, 504 1.33333 720, 490 1.37143 735, 480 1.4 784, 450 1.49333 800, 441 1.52381 840, 420 1.6 Mode 11: 640 400 840 525 700, 630 1.33333 735, 600 1.4 750, 588 1.42857 840, 525 1.6 Mode 12: 640 400 840 600 672, 750 1.28 700, 720 1.33333 720, 700 1.37143 750, 672 1.42857 800, 630 1.52381 840, 600 1.6 Mode 13: 640 480 840 500 672, 625 1.06667 700, 600 1.11111 750, 560 1.19048 800, 525 1.26984 840, 500 1.33333 Mode 14: 640 480 840 625 700, 750 1.11111 750, 700 1.19048 840, 625 1.33333 Mode 15: 640 480 840 750 700, 900 1.11111 720, 875 1.14286 750, 840 1.19048 840, 750 1.33333 Mode 16: 640 480 784 525 686, 600 1.16667 700, 588 1.19048 735, 560 1.25 784, 525 1.33333 Mode 17: 640 480 784 600 640, 735 1.08844 672, 700 1.14286 700, 672 1.19048 735, 640 1.25 784, 600 1.33333 Mode 18: 640 480 800 630 672, 750 1.12 700, 720 1.16667 720, 700 1.2 750, 672 1.25 800, 630 1.33333 Mode 19: 800 600 944 625 944, 625 1.33333 Mode 20: 800 600 960 750 800, 900 1.11111 900, 800 1.25 960, 750 1.33333 Mode 21: 800 600 936 836 836, 936 1.19088 858, 912 1.22222 912, 858 1.29915 936, 836 1.33333 Mode 22: 800 600 1040 630 800, 819 1.02564 819, 800 1.05 840, 780 1.07692 900, 728 1.15385 910, 720 1.16667 936, 700 1.2 975, 672 1.25 1008, 650 1.29231 1040, 630 1.33333 Mode 23: 800 600 1040 700 800, 910 1.02564 832, 875 1.06667 875, 832 1.12179 910, 800 1.16667 1000, 728 1.28205 1040, 700 1.33333 Mode 24: 800 600 1064 750 840, 950 1.05263 875, 912 1.09649 912, 875 1.14286 950, 840 1.19048 1000, 798 1.25313 1050, 760 1.31579 1064, 750 1.33333 */ TVNvRegs nv_ch1_ntsc_slave_a = { /* Mode 17 small_a */ HDisplay : 640, HSyncStart : 664-8, HSyncEnd : 736-8, HTotal : 784, /* Mode 17 ch: 784 */ VDisplay : 480, VSyncStart : 522, VSyncEnd : 524, VTotal : 600, /* Mode 17 ch: 600 */ slave : { HTotal : 784, HSyncStart : 1, HSyncEnd : 64, VTotal : 600, VSyncStart : 1, VSyncEnd : 16, Unknown : 13, } }; TVChRegs ch1_ntsc_slave_b = { /* Mode 24: 800x600 7:10 */ dmr_ir : 4, dmr_vs : 1, dmr_sr : 5, sav : 142, hpr : 60, vpr : 0, pll_m : 89, pll_n : 302, pllcap : 0, dacg : 0, mode : 24, }; TVNvRegs nv_ch1_ntsc_slave_b = { /* Mode 24 small_b */ HDisplay : 800, HSyncStart : 864, HSyncEnd : 968, HTotal : 984, /* Mode 24 ch: 1064 */ VDisplay : 600, VSyncStart : 602, VSyncEnd : 605, VTotal : 698, /* Mode 24 ch: 750 */ slave : { HTotal : 1064, HSyncStart : 1, HSyncEnd : 64, VTotal : 750, VSyncStart : 1, VSyncEnd : 16, Unknown : 13, } }; TVNvRegs nv_ch1_pal_slave_a = { /* Mode 14 small_a */ HDisplay : 640, HSyncStart : 688-8, HSyncEnd : 760-8, HTotal : 760, /* Mode 14 ch: 840 */ VDisplay : 480, VSyncStart : 532, VSyncEnd : 534, VTotal : 574, /* Mode 14 ch: 625 */ slave : { HTotal : 840, HSyncStart : 1, HSyncEnd : 64, VTotal : 625, VSyncStart : 1, VSyncEnd : 16, Unknown : 5, } }; TVChRegs ch1_pal_slave_b = { /* Mode 20: 800x600 5:6 */ dmr_ir : 4, dmr_vs : 0, dmr_sr : 3, sav : 126, hpr : 64, vpr : 0, pll_m : 33, pll_n : 86, pllcap : 0, /* docs: 1 !! */ mode : 20, }; TVNvRegs nv_ch1_pal_slave_b = { /* Mode 20 small_b */ HDisplay : 800, HSyncStart : 840, HSyncEnd : 968, HTotal : 936, VDisplay : 600, VSyncStart : 602, VSyncEnd : 605, VTotal : 698, slave : { HTotal : 960, HSyncStart : 1, HSyncEnd : 64, VTotal : 750, VSyncStart : 1, VSyncEnd : 16, Unknown : 5, } }; /* -------- NV -------- modelist -------- */ /* No Dualview for: PAL 640x400 T Mode 9 PAL 720x400 T Mode 5 NTSC 720x400 L Mode 6 NTSC 512x384 L Mode 2 */ /* FIXME: ch2 modes for 800x600/768x576 are different. New modes have 720x480, 720x576, 800x600, 1024x768. So make 3 templates. */ /* FIXME: Calculate correct voc and hoc values. At the moment, hoc = voc, and the voc values seem way off for some reason. */ typedef struct { TVModeSpec spec; TVNvRegs *nv; TVChRegs *ch; unsigned long *fsci; int portFlags; int descFlags; } TVTemplateNvCh; /* For the PAL-X convenience mode, FSCI is sometimes the same?? This is now ignored -- the convenience modes get modified as well. */ TVTemplateNvCh templ_nv_ch1_50hz [] = { /* 50 Hz: PAL, PAL-N, PAL-X */ {{TV_SYSTEM_PAL, 800, 600, "Tiny", "4:3", 21.875, 21.875}, /* Mode 21 */ &nv_ch1_pal_tiny_b, &ch1_pal_tiny_b, ch1_fsci_pal_tiny_b, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_PAL, 800, 600, "Small", "4:3", 13.194, 13.194}, /* Mode 20 */ &nv_ch1_pal_small_b, &ch1_pal_small_b, ch1_fsci_pal_small_b, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_PAL, 800, 600, "Huge", "4:3", -4.167, -4.167}, /* Mode 19 */ &nv_ch1_pal_huge_b, &ch1_pal_huge_b, ch1_fsci_pal_huge_b, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_PAL, 640, 480, "Tiny", "4:3", 30.556, 30.556}, /* Mode 15 */ &nv_ch1_pal_tiny_a, &ch1_pal_tiny_a, ch1_fsci_pal_tiny_a, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_PAL, 640, 480, "Small", "4:3", 16.667, 16.667}, /* Mode 14 */ &nv_ch1_pal_small_a, &ch1_pal_small_a, ch1_fsci_pal_small_a, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_PAL, 640, 480, "Huge", "4:3", -4.167, -4.167}, /* Mode 13 */ &nv_ch1_pal_huge_a, &ch1_pal_huge_a, ch1_fsci_pal_huge_a, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_PAL, 640, 400, "Tiny", "8:5", 30.556, 30.556}, /* Mode 9 */ &nv_ch1_pal_tiny_c, &ch1_pal_tiny_c, ch1_fsci_pal_tiny_c, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_PAL, 640, 400, "Small", "8:5", 13.194, 13.194}, /* Mode 8 */ &nv_ch1_pal_small_c, &ch1_pal_small_c, ch1_fsci_pal_small_c, PORT_NVIDIA, TV_DEF_CH | TV_CAP_MACROVISION}, /* FIXME: No Dual view yet */ {{TV_SYSTEM_PAL, 720, 400, "Tiny", "9:5", 30.556, 30.556}, /* Mode 5 */ &nv_ch1_pal_tiny_d, &ch1_pal_tiny_d, ch1_fsci_pal_tiny_d, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_PAL, 720, 400, "Small", "9:5", 13.194, 13.194}, /* Mode 4 */ &nv_ch1_pal_small_d, &ch1_pal_small_d, ch1_fsci_pal_small_d, PORT_NVIDIA, TV_DEF_CH}, /* FIXME: No Dualview yet */ {{TV_SYSTEM_PAL, 512, 384, "Tiny", "4:3", 33.333, 33.333}, /* Mode 1 */ &nv_ch1_pal_tiny_e, &ch1_pal_tiny_e, ch1_fsci_pal_tiny_e, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_PAL, 512, 384, "Small", "4:3", 16.667, 16.667}, /* Mode 0 */ &nv_ch1_pal_small_e, &ch1_pal_small_e, ch1_fsci_pal_small_e, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_PAL, 768, 576, "Small", "4:3", 0.000, 0.000}, /* Mode 20' */ &nv_ch1_pal_small_f, &ch1_pal_small_f, ch1_fsci_pal_small_b, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_PAL, 768, 576, "Large", "4:3", 0.000, 0.000}, /* Mode 19' */ &nv_ch1_pal_large_f, &ch1_pal_large_f, ch1_fsci_pal_huge_b, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_PAL, 800, 450, "Small", "16:9", 0.000, 0.000}, /* Mode 20" */ &nv_ch1_pal_small_g, &ch1_pal_small_g, ch1_fsci_pal_small_b, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_PAL, 800, 450, "Large", "16:9", 0.000, 0.000}, /* Mode 19" */ &nv_ch1_pal_large_g, &ch1_pal_large_g, ch1_fsci_pal_huge_b, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, #ifdef CONFIG_SLAVE_CH {{TV_SYSTEM_PAL, 800, 600, "Slave$", "4:3", 13.194, 13.194}, /* Mode 20 */ &nv_ch1_pal_slave_b, &ch1_pal_slave_b, ch1_fsci_pal_small_b, PORT_NVIDIA_SYNC_SLAVE, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_PAL, 640, 480, "Slave$", "4:3", 16.667, 16.667}, /* Mode 14 */ &nv_ch1_pal_slave_a, &ch1_pal_small_a, ch1_fsci_pal_small_a, PORT_NVIDIA_SYNC_SLAVE, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, #endif #if 0 /* not yet supported */ {{TV_SYSTEM_PAL, 720, 576, "Interl", 0.000, 0.000}, /* Mode 25 */ &nv_ch1_pal_interl_dvd, &ch1_pal_interl_dvd, NULL, PORT_NVIDIA, TV_DEF_CH}, #endif {{TV_SYSTEM_NONE, 0, 0, NULL, NULL, 0.0, 0.0}, NULL, NULL, NULL, 0}, }; /* NTSC modes with "no dot crawl" get # appended to size */ /* 60 Hz: NTSC, NTSC-NDC, PAL-M, PAL-60 */ TVTemplateNvCh templ_nv_ch1_60hz [] = { {{TV_SYSTEM_NTSC, 800, 600, "Small", "4:3", 12.500, 12.500}, /* Mode 24 */ &nv_ch1_ntsc_small_b, &ch1_ntsc_small_b, ch1_fsci_ntsc_small_b, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_NTSC, 800, 600, "Large", "4:3", 6.250, 6.250}, /* Mode 23 */ &nv_ch1_ntsc_large_b, &ch1_ntsc_large_b, ch1_fsci_ntsc_large_b, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_NTSC, 800, 600, "Huge", "4:3", -4.167, -4.167}, /* Mode 22 */ &nv_ch1_ntsc_huge_b, &ch1_ntsc_huge_b, ch1_fsci_ntsc_huge_b, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_NTSC, 640, 480, "Tiny", "4:3", 16.667, 16.667}, /* Mode 18 */ &nv_ch1_ntsc_tiny_a, &ch1_ntsc_tiny_a, ch1_fsci_ntsc_tiny_a, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_NTSC, 640, 480, "Small", "4:3", 12.500, 12.500}, /* Mode 17 */ &nv_ch1_ntsc_small_a, &ch1_ntsc_small_a, ch1_fsci_ntsc_small_a, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_NTSC, 640, 480, "Huge", "4:3", 0.000, 0.000}, /* Mode 16 */ &nv_ch1_ntsc_huge_a, &ch1_ntsc_huge_a, ch1_fsci_ntsc_huge_a, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_NTSC, 640, 400, "Tiny", "8:5", 27.083, 27.083}, /* Mode 12 */ &nv_ch1_ntsc_tiny_c, &ch1_ntsc_tiny_c, ch1_fsci_ntsc_tiny_c, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_NTSC, 640, 400, "Small", "8:5", 16.667, 16.667}, /* Mode 11 */ &nv_ch1_ntsc_small_c, &ch1_ntsc_small_c, ch1_fsci_ntsc_small_c, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_NTSC, 640, 400, "Huge", "8:5", -4.167, -4.167}, /* Mode 10 */ &nv_ch1_ntsc_huge_c, &ch1_ntsc_huge_c, ch1_fsci_ntsc_huge_c, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_NTSC, 720, 400, "Small", "9:5", 16.667, 16.667}, /* Mode 7 */ &nv_ch1_ntsc_small_d, &ch1_ntsc_small_d, ch1_fsci_ntsc_small_d, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_NTSC, 720, 400, "Huge", "9:5", -4.167, -4.167}, /* Mode 6 */ &nv_ch1_ntsc_huge_d, &ch1_ntsc_huge_d, ch1_fsci_ntsc_huge_d, PORT_NVIDIA, TV_DEF_CH}, /* FIXME: No Dualview yet */ {{TV_SYSTEM_NTSC, 512, 384, "Small", "4:3", 20.000, 20.000}, /* Mode 3 */ &nv_ch1_ntsc_small_e, &ch1_ntsc_small_e, ch1_fsci_ntsc_small_e, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_NTSC, 512, 384, "Large", "4:3", 0.000, 0.000}, /* Mode 2 */ &nv_ch1_ntsc_large_e, &ch1_ntsc_large_e, ch1_fsci_ntsc_large_e, PORT_NVIDIA, TV_DEF_CH}, /* FIXME: No Dualview */ {{TV_SYSTEM_NTSC, 768, 576, "Large", "4:3", 0.000, 0.000}, /* Mode 23' */ &nv_ch1_ntsc_large_f, &ch1_ntsc_large_f, ch1_fsci_ntsc_large_b, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_NTSC, 800, 450, "Large", "16:9", 0.000, 0.000}, /* Mode 23" */ &nv_ch1_ntsc_large_g, &ch1_ntsc_large_g, ch1_fsci_ntsc_large_b, PORT_NVIDIA, TV_DEF_CH | TV_DEF_DUALVIEW}, #ifdef CONFIG_SLAVE_CH {{TV_SYSTEM_NTSC, 800, 600, "Slave$", "4:3", 12.500, 12.500}, /* Mode 24 */ &nv_ch1_ntsc_slave_b, &ch1_ntsc_slave_b, ch1_fsci_ntsc_small_b, PORT_NVIDIA_SYNC_SLAVE, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_NTSC, 640, 480, "Slave$", "4:3", 12.500, 12.500}, /* Mode 17 */ &nv_ch1_ntsc_slave_a, &ch1_ntsc_small_a, ch1_fsci_ntsc_small_a, PORT_NVIDIA_SYNC_SLAVE, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, #endif #if 0 /* not yet supported, maybe never will */ {{TV_SYSTEM_NTSC, 720, 480, "Interl", "DVD", 0.000, 0.000}, /* Mode 26 */ &nv_ch1_ntsc_interl_dvd, &ch1_ntsc_interl_dvd, NULL, PORT_NVIDIA, TV_DEF_CH}, #endif {{TV_SYSTEM_NONE, 0, 0, NULL, NULL, 0.0, 0.0}, NULL, NULL, NULL, 0}, }; /* -------- -------- */ static TVMode *modes_nv_ch1 = NULL; static TVMode *modes_nv_ch2 = NULL; static TVMode* loop_create_nv_ch1 (TVMode *m, TVTemplateNvCh *t, TVSystem system, int f, char *suffix) { for (; t->spec.system != TV_SYSTEM_NONE; t++) { m->spec = t->spec; m->spec.system = system; m->descFlags = t->descFlags; if (suffix) { register char *s; s = (char *) malloc ((strlen(t->spec.size) + strlen (suffix) + 1) * sizeof (char)); m->spec.size = strcat (strcpy (s, t->spec.size), suffix); } m->regs.devFlags = (t->descFlags & TV_CAP_DUALVIEW) ? (DEV_MONITOR | DEV_TELEVISION) : (DEV_TELEVISION); m->regs.portHost = m->regs.portEnc = t->portFlags; m->regs.crtc.nv = *(t->nv); m->regs.enc.ch = *(t->ch); if (t->fsci) m->regs.enc.ch.fsci = t->fsci[f]; data_init_ch1 (system, &m->regs.enc.ch); data_init_nv (&m->regs.crtc.nv, m->regs.portHost, m->regs.devFlags); m++; } return m; } static TVMode* loop_create_nv_ch2 (TVMode *m, TVTemplateNvCh *t, TVSystem system, int f, char *suffix) { for (; t->spec.system != TV_SYSTEM_NONE; t++) { m->spec = t->spec; m->spec.system = system; m->descFlags = t->descFlags; if (suffix) { register char *s; s = (char *) malloc ((strlen(t->spec.size) + strlen (suffix) + 1) * sizeof (char)); m->spec.size = strcat (strcpy (s, t->spec.size), suffix); } m->regs.devFlags = (t->descFlags & TV_CAP_DUALVIEW) ? (DEV_MONITOR | DEV_TELEVISION) : (DEV_TELEVISION); m->regs.portHost = m->regs.portEnc = t->portFlags; m->regs.crtc.nv = *(t->nv); m->regs.enc.ch = *(t->ch); if (t->fsci) m->regs.enc.ch.fsci = t->fsci[f]; data_init_ch2 (system, &m->regs.enc.ch); data_init_nv (&m->regs.crtc.nv, m->regs.portHost, m->regs.devFlags); m++; } return m; } TVMode* data_modes_nv_ch1 (void) { int c; TVMode *m; if (modes_nv_ch1) return modes_nv_ch1; c = sizeof (templ_nv_ch1_60hz) / sizeof(TVTemplateNvCh) * 5 + sizeof (templ_nv_ch1_50hz) / sizeof(TVTemplateNvCh) * 3 + 1; modes_nv_ch1 = (TVMode *) malloc (sizeof (TVMode) * c); m = modes_nv_ch1; m = loop_create_nv_ch1 (m, templ_nv_ch1_60hz, TV_SYSTEM_NTSC, 0, NULL); m = loop_create_nv_ch1 (m, templ_nv_ch1_60hz, TV_SYSTEM_NTSC_J, 0, NULL); m = loop_create_nv_ch1 (m, templ_nv_ch1_60hz, TV_SYSTEM_NTSC, 1, "#"); m = loop_create_nv_ch1 (m, templ_nv_ch1_60hz, TV_SYSTEM_PAL_M, 2, NULL); m = loop_create_nv_ch1 (m, templ_nv_ch1_60hz, TV_SYSTEM_PAL_60, 3, NULL); m = loop_create_nv_ch1 (m, templ_nv_ch1_50hz, TV_SYSTEM_PAL, 0, NULL); m = loop_create_nv_ch1 (m, templ_nv_ch1_50hz, TV_SYSTEM_PAL_N, 1, NULL); m = loop_create_nv_ch1 (m, templ_nv_ch1_50hz, TV_SYSTEM_PAL_X, 2, NULL); m->spec.system = TV_SYSTEM_NONE; return modes_nv_ch1; } TVMode* data_modes_nv_ch2 (void) { int c; TVMode *m; c = 0 + 1; modes_nv_ch2 = (TVMode *) malloc (sizeof (TVMode) * c); m = modes_nv_ch2; m->spec.system = TV_SYSTEM_NONE; return modes_nv_ch2; } /* ======== PH ================================ */ #define TV_DEF_PH (TV_CAP_MACROVISION | TV_CAP_NONINTERLACED \ | TV_CAP_DUALVIEW | TV_CAP_COLORFIX) /* -------- PH -------- NTSC -------- */ /* -------- 640x480 -------- */ TVNvRegs nv_ph_ntsc_small_a = { HDisplay : 640, HSyncStart : 656, HSyncEnd : 752, HTotal : 800, /* verified */ VDisplay : 480, VSyncStart : 536, /* test! */ VSyncEnd : 538, /* test! */ VTotal : 620, /* test! */ flags : 0, }; TVNvRegs nv_ph_ntsc_medium_a = { HDisplay : 640, HSyncStart : 656, HSyncEnd : 752, HTotal : 800, /* verified */ VDisplay : 480, VSyncStart : 519, /* test! */ VSyncEnd : 521, /* test! */ VTotal : 585, /* test! */ flags : 0, }; /* -------- 800x600 -------- */ TVNvRegs nv_ph_ntsc_small_b = { HDisplay : 800, HSyncStart : 824, /* VESA 56Hz */ HSyncEnd : 896, /* VESA 56Hz */ HTotal : 1024, /* verified */ VDisplay : 600, VSyncStart : 668, /* test! */ VSyncEnd : 670, /* test! */ VTotal : 774, /* test! */ flags : 0, }; TVNvRegs nv_ph_ntsc_medium_b = { HDisplay : 800, HSyncStart : 824, /* VESA 56Hz */ HSyncEnd : 896, /* VESA 56Hz */ HTotal : 1024, /* verified */ VDisplay : 600, VSyncStart : 649, /* test! */ VSyncEnd : 651, /* test! */ VTotal : 731, /* test! */ flags : 0, }; TVNvRegs nv_ph_ntsc_huge_b = { HDisplay : 800, HSyncStart : 824, /* VESA 56Hz */ HSyncEnd : 896, /* VESA 56Hz */ HTotal : 1024, /* verified */ VDisplay : 600, VSyncStart : 613, /* test! */ VSyncEnd : 615, /* test! */ VTotal : 655, /* test! */ flags : 0, }; /* -------- PH -------- PAL -------- */ /* -------- 640x480 -------- */ TVNvRegs nv_ph_pal_small_a = { HDisplay : 640, HSyncStart : 656, HSyncEnd : 752, HTotal : 800, /* verified */ VDisplay : 480, VSyncStart : 526, /* test! */ VSyncEnd : 528, /* test! */ VTotal : 602, /* test! */ flags : 0, }; TVNvRegs nv_ph_pal_medium_a = { HDisplay : 640, HSyncStart : 656, HSyncEnd : 752, HTotal : 800, /* verified */ VDisplay : 480, VSyncStart : 515, /* test! */ VSyncEnd : 517, /* test! */ VTotal : 581, /* test! */ flags : 0, }; /* -------- 800x600 -------- */ TVNvRegs nv_ph_pal_small_b = { HDisplay : 800, HSyncStart : 824, /* VESA 56Hz */ HSyncEnd : 896, /* VESA 56Hz */ HTotal : 1024, /* verified */ VDisplay : 600, VSyncStart : 657, /* test! */ VSyncEnd : 659, /* test! */ VTotal : 752, /* test! */ flags : 0, }; TVNvRegs nv_ph_pal_medium_b = { HDisplay : 800, HSyncStart : 824, /* VESA 56Hz */ HSyncEnd : 896, /* VESA 56Hz */ HTotal : 1024, /* verified */ VDisplay : 600, VSyncStart : 643, /* test! */ VSyncEnd : 645, /* test! */ VTotal : 726, /* test! */ flags : 0, }; TVNvRegs nv_ph_pal_huge_b = { HDisplay : 800, HSyncStart : 824, /* VESA 56Hz */ HSyncEnd : 896, /* VESA 56Hz */ HTotal : 1024, /* verified */ VDisplay : 600, VSyncStart : 610, /* test! */ VSyncEnd : 612, /* test! */ VTotal : 653, /* test! */ flags : 0, }; /* ======== PH ======== SAA7104 ======================== */ /* -------- SAA7104 Test Master modes -------- */ TVNvRegs nv_ph_ntsc_test_a = { HDisplay : 640, HSyncStart : 656, HSyncEnd : 720, HTotal : 768, VDisplay : 480, VSyncStart : 526, VSyncEnd : 528, VTotal : 602, flags : 0, }; TVNvRegs nv_ph_ntsc_test_b = { HDisplay : 800, HSyncStart : 928, HSyncEnd : 1000, HTotal : 1216, VDisplay : 600, VSyncStart : 657, VSyncEnd : 659, VTotal : 752, flags : 0, }; TVNvRegs nv_ph_ntsc_test_c = { /* Master/Slave */ /* Clock 2*32.799 MHz -> 1140x960 -> 59.94 Hz ok */ HDisplay : 1024, HSyncStart : 1072, HSyncEnd : 1128, HTotal : 1140, /* rem 4 */ VDisplay : 768, VSyncStart : 820, VSyncEnd : 822, VTotal : 960, flags : 0, slave : { HTotal : 1140, HSyncStart : 1, HSyncEnd : 64, VTotal : 960, VSyncStart : 1, VSyncEnd : 16, Unknown : 6, } }; /* ---- */ TVNvRegs nv_ph_pal_test_a = { HDisplay : 640, HSyncStart : 656, HSyncEnd : 752, HTotal : 808, VDisplay : 480, VSyncStart : 526, VSyncEnd : 528, VTotal : 602, flags : 0, }; TVNvRegs nv_ph_pal_test_b = { HDisplay : 800, HSyncStart : 824, /* VESA 56Hz */ HSyncEnd : 896, /* VESA 56Hz */ HTotal : 1032, VDisplay : 600, VSyncStart : 657, VSyncEnd : 659, VTotal : 752, flags : 0, }; TVNvRegs nv_ph_pal_test_c = { /* Master/Slave */ /* Clock 2*28.500 MHz -> 1200x950 -> 50 Hz ok */ HDisplay : 1024, HSyncStart : 1072, HSyncEnd : 1128, HTotal : 1200, VDisplay : 768, VSyncStart : 820, VSyncEnd : 822, VTotal : 950, flags : 0, slave : { HTotal : 1200, HSyncStart : 1, HSyncEnd : 64, VTotal : 950, VSyncStart : 1, VSyncEnd : 16, Unknown : 6, } }; /* -------- SAA7104 Test Slave modes -------- */ TVNvRegs nv_ph_ntsc_slave_a = { /* 640x480 Slave */ /* Clock 28.288 MHz -> 800x590 -> 59.93 Hz ok */ HDisplay : 640, HSyncStart : 720, HSyncEnd : 744, HTotal : 800, VDisplay : 480, VSyncStart : 520, VSyncEnd : 522, VTotal : 590, slave : { HTotal : 800, HSyncStart : 1, HSyncEnd : 64, VTotal : 590, VSyncStart : 1, VSyncEnd : 16, Unknown : 0, } }; TVNvRegs nv_ph_ntsc_slave_b = { /* 800x600 Slave */ /* Clock 47.832 MHz -> 1064x750 -> 59.94 Hz ok */ HDisplay : 800, HSyncStart : 964, HSyncEnd : 1028, HTotal : 1064, VDisplay : 600, VSyncStart : 651, VSyncEnd : 654, VTotal : 750, slave : { HTotal : 1064, HSyncStart : 1, HSyncEnd : 64, VTotal : 750, VSyncStart : 1, VSyncEnd : 16, Unknown : 0, } }; /* ---- */ TVNvRegs nv_ph_pal_slave_a = { /* 640x480 Slave */ /* Clock 25.197 -> 840x600 -> 49.99 Hz */ HDisplay : 640, HSyncStart : 736, HSyncEnd : 752, HTotal : 832, VDisplay : 480, VSyncStart : 520, /* 480 */ VSyncEnd : 522, /* 484 */ VTotal : 600, /* 304 ?? */ slave : { HTotal : 840, HSyncStart : 1, HSyncEnd : 64, VTotal : 600, VSyncStart : 1, VSyncEnd : 16, Unknown : 12, } }; TVNvRegs nv_ph_pal_slave_b = { /* 800x600 Slave */ /* Clock 36.000 -> 1000x720 -> 50 Hz ok */ HDisplay : 800, HSyncStart : 992, HSyncEnd : 1152, HTotal : 1056, VDisplay : 600, VSyncStart : 601, VSyncEnd : 604, VTotal : 694, slave : { HTotal : 1000, HSyncStart : 1, HSyncEnd : 64, VTotal : 720, VSyncStart : 1, VSyncEnd : 16, Unknown : 6, } }; /* -------- PH modes -------- */ typedef struct { TVModeSpec spec; TVNvRegs *nv; TVPh1Regs *ph; int portFlags; int descFlags; } TVTemplateNvPh1; typedef struct { TVModeSpec spec; TVNvRegs *nv; TVPh2Regs *ph; int portFlags; int descFlags; } TVTemplateNvPh2; TVTemplateNvPh1 templ_nv_ph1 [] = { {{TV_SYSTEM_PAL, 640, 480, "Small", "4:3", 11.68, 13.19}, &nv_ph_pal_small_a, &ph_pal_small_a, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_PAL, 640, 480, "Medium", "4:3", 08.83, 10.07}, &nv_ph_pal_medium_a, &ph_pal_medium_a, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_PAL, 800, 600, "Small", "4:3", 11.68, 13.19}, &nv_ph_pal_small_b, &ph_pal_small_b, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_PAL, 800, 600, "Medium", "4:3", 08.83, 10.07}, &nv_ph_pal_medium_b, &ph_pal_medium_b, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_PAL, 800, 600, "Huge", "4:3", 00.00, 00.00}, &nv_ph_pal_huge_b, &ph_pal_huge_b, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_NTSC, 640, 480, "Small", "4:3", 12.67, 16.05}, &nv_ph_ntsc_small_a, &ph_ntsc_small_a, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_NTSC, 640, 480, "Medium", "4:3", 09.86, 11.11}, &nv_ph_ntsc_medium_a, &ph_ntsc_medium_a, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_NTSC, 800, 600, "Small", "4:3", 12.67, 16.05}, &nv_ph_ntsc_small_b, &ph_ntsc_small_b, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_NTSC, 800, 600, "Medium", "4:3", 09.86, 11.11}, &nv_ph_ntsc_medium_b, &ph_ntsc_medium_b, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_NTSC, 800, 600, "Huge", "4:3", 00.00, 00.82}, &nv_ph_ntsc_huge_b, &ph_ntsc_huge_b, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_NONE, 0, 0, NULL, NULL, 0.0, 0.0}, NULL, NULL, 0}, }; TVTemplateNvPh2 templ_nv_ph2 [] = { {{TV_SYSTEM_PAL, 640, 480, "Slave$", "4:3", 00.00, 00.00}, &nv_ph_pal_slave_a, &ph_pal_slave_a, PORT_NVIDIA_SYNC_SLAVE, TV_DEF_PH}, {{TV_SYSTEM_PAL, 800, 600, "Slave$", "4:3", 00.00, 00.00}, &nv_ph_pal_slave_b, &ph_pal_slave_b, PORT_NVIDIA_SYNC_SLAVE, TV_DEF_PH}, {{TV_SYSTEM_PAL, 1024, 768, "Slave$", "4:3", 00.00, 00.00}, &nv_ph_pal_test_c, &ph_pal_test_c, PORT_NVIDIA_SYNC_SLAVE, TV_DEF_PH}, {{TV_SYSTEM_NTSC, 640, 480, "Slave$", "4:3", 00.00, 00.00}, &nv_ph_ntsc_slave_a, &ph_ntsc_slave_a, PORT_NVIDIA_SYNC_SLAVE, TV_DEF_PH}, {{TV_SYSTEM_NTSC, 800, 600, "Slave$", "4:3", 00.00, 00.00}, &nv_ph_ntsc_slave_b, &ph_ntsc_slave_b, PORT_NVIDIA_SYNC_SLAVE, TV_DEF_PH}, {{TV_SYSTEM_NTSC, 1024, 768, "Slave$", "4:3", 00.00, 00.00}, &nv_ph_ntsc_test_c, &ph_ntsc_test_c, PORT_NVIDIA_SYNC_SLAVE, TV_DEF_PH}, {{TV_SYSTEM_PAL, 640, 480, "Test", "4:3", 00.00, 00.00}, &nv_ph_pal_test_a, &ph_pal_test_a, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_PAL, 800, 600, "Test", "4:3", 00.00, 00.00}, &nv_ph_pal_test_b, &ph_pal_test_b, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_PAL, 1024, 768, "Test", "4:3", 00.00, 00.00}, &nv_ph_pal_test_c, &ph_pal_test_c, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_NTSC, 640, 480, "Test", "4:3", 00.00, 00.00}, &nv_ph_ntsc_test_a, &ph_ntsc_test_a, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_NTSC, 800, 600, "Test", "4:3", 00.00, 00.00}, &nv_ph_ntsc_test_b, &ph_ntsc_test_b, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_NTSC, 1024, 768, "Test", "4:3", 00.00, 00.00}, &nv_ph_ntsc_test_c, &ph_ntsc_test_c, PORT_NVIDIA, TV_DEF_PH}, {{TV_SYSTEM_NONE, 0, 0, NULL, NULL, 0.0, 0.0}, NULL, NULL, 0}, }; /* -------- -------- */ static TVMode *modes_nv_ph1 = NULL; static TVMode *modes_nv_ph2 = NULL; /* * count number of modes matching system; TV_SYSTEM_NONE matches all. */ int data_count_nv_ph1 (TVSystem system) { int count; TVTemplateNvPh1 *t; count = 0; for (t = templ_nv_ph1; t->spec.system != TV_SYSTEM_NONE; t++) { if (system == TV_SYSTEM_NONE || system == t->spec.system) count++; } return count; } int data_count_nv_ph2 (TVSystem system) { int count; TVTemplateNvPh2 *t; count = 0; for (t = templ_nv_ph2; t->spec.system != TV_SYSTEM_NONE; t++) { if (system == TV_SYSTEM_NONE || system == t->spec.system) count++; } return count; } TVMode* data_modes_nv_ph1 (void) { int c; TVMode *m; TVTemplateNvPh1 *t; if (modes_nv_ph1) return modes_nv_ph1; c = data_count_nv_ph1 (TV_SYSTEM_NONE) + 1; modes_nv_ph1 = (TVMode *) malloc (sizeof (TVMode) * c); m = modes_nv_ph1; for (t = templ_nv_ph1; t->spec.system != TV_SYSTEM_NONE; t++) { m->spec = t->spec; m->descFlags = t->descFlags; m->regs.portHost = m->regs.portEnc = t->portFlags; m->regs.devFlags = (t->descFlags & TV_CAP_DUALVIEW) ? (DEV_MONITOR | DEV_TELEVISION) : (DEV_TELEVISION); m->regs.crtc.nv = *(t->nv); m->regs.enc.ph1 = *(t->ph); data_init_ph1 (m->spec.system, &m->regs.enc.ph1); data_init_nv (&m->regs.crtc.nv, m->regs.portHost, m->regs.devFlags); m++; } m->spec.system = TV_SYSTEM_NONE; return modes_nv_ph1; } TVMode* data_modes_nv_ph2 (void) { int c; TVMode *m; TVTemplateNvPh1 *t1; TVTemplateNvPh2 *t2; if (modes_nv_ph2) return modes_nv_ph2; c = data_count_nv_ph1 (TV_SYSTEM_NONE) + data_count_nv_ph2 (TV_SYSTEM_NONE) + 1; modes_nv_ph2 = (TVMode *) malloc (sizeof (TVMode) * c); m = modes_nv_ph2; for (t1 = templ_nv_ph1; t1->spec.system != TV_SYSTEM_NONE; t1++) { m->spec = t1->spec; m->descFlags = t1->descFlags; m->regs.portHost = m->regs.portEnc = t1->portFlags; m->regs.devFlags = (t1->descFlags & TV_CAP_DUALVIEW) ? (DEV_MONITOR | DEV_TELEVISION) : (DEV_TELEVISION); m->regs.crtc.nv = *(t1->nv); m->regs.enc.ph1 = *(t1->ph); m->regs.enc.ph2.pcle = 1; m->regs.enc.ph2.pcli = 1; data_init_ph2 (m->spec.system, &m->regs.enc.ph2); data_init_nv (&m->regs.crtc.nv, m->regs.portHost, m->regs.devFlags); m++; } for (t2 = templ_nv_ph2; t2->spec.system != TV_SYSTEM_NONE; t2++) { m->spec = t2->spec; m->descFlags = t2->descFlags; m->regs.portHost = m->regs.portEnc = t2->portFlags; m->regs.devFlags = (t2->descFlags & TV_CAP_DUALVIEW) ? (DEV_MONITOR | DEV_TELEVISION) : (DEV_TELEVISION); m->regs.crtc.nv = *(t2->nv); m->regs.enc.ph2 = *(t2->ph); data_init_ph2 (m->spec.system, &m->regs.enc.ph2); data_init_nv (&m->regs.crtc.nv, m->regs.portHost, m->regs.devFlags); m++; } m->spec.system = TV_SYSTEM_NONE; return modes_nv_ph2; } /* ======== NX ======== NVIDIA Internal ======================== */ #define TV_DEF_NX 0 /* -------- CRT -------- */ TVNvRegs nv_nx_normal_a = { /* All 640x480 */ HDisplay : 640, HSyncStart : 656, HSyncEnd : 752, HTotal : 880, HBlankStart : 640, HBlankEnd : 880, VDisplay : 480, VSyncStart : 480, VSyncEnd : 492, VTotal : 525, VBlankStart : 480, VBlankEnd : 525, flags : 0, clock : 0, }; TVNvRegs nv_nx_normal_b = { /* All 800x600 */ HDisplay : 800, HSyncStart : 840, HSyncEnd : 968, HTotal : 1056, HBlankStart : 800, HBlankEnd : 1056, VDisplay : 600, VSyncStart : 600, VSyncEnd : 605, VTotal : 628, VBlankStart : 600, VBlankEnd : 628, flags : 0, clock : 0, }; TVNvRegs nv_nx_normal_c = { /* NTSC 1024x768 */ HDisplay : 1024, HSyncStart : 1048, HSyncEnd : 1184, HTotal : 1344, HBlankStart : 1024, HBlankEnd : 1344, VDisplay : 768, VSyncStart : 768, VSyncEnd : 777, VTotal : 806, VBlankStart : 768, VBlankEnd : 806, flags : 0, clock : 0, }; /* -------- NX modes -------- */ typedef struct { TVModeSpec spec; TVNvRegs *nv; TVNxImgRegs *nx; int portFlags; int descFlags; } TVTemplateNvNx; TVTemplateNvNx templ_nv_nx_60hz [] = { {{TV_SYSTEM_NTSC, 640, 480, "Normal", "4:3", 08.75, 08.75}, &nv_nx_normal_a, &nx_60_normal_a, PORT_NVIDIA, TV_DEF_NX}, {{TV_SYSTEM_NTSC, 800, 600, "Normal", "4:3", 08.75, 08.75}, &nv_nx_normal_b, &nx_60_normal_b, PORT_NVIDIA, TV_DEF_NX}, {{TV_SYSTEM_NTSC, 1024, 768, "Normal", "4:3", 08.75, 08.75}, &nv_nx_normal_c, &nx_60_normal_c, PORT_NVIDIA, TV_DEF_NX}, {{TV_SYSTEM_NONE, 0, 0, NULL, NULL, 0.0, 0.0}, NULL, NULL, 0}, }; TVTemplateNvNx templ_nv_nx_50hz [] = { {{TV_SYSTEM_PAL, 640, 480, "Normal", "4:3", 08.75, 08.75}, &nv_nx_normal_a, &nx_50_normal_a, PORT_NVIDIA, TV_DEF_NX}, {{TV_SYSTEM_PAL, 800, 600, "Normal", "4:3", 08.75, 08.75}, &nv_nx_normal_b, &nx_50_normal_b, PORT_NVIDIA, TV_DEF_NX}, {{TV_SYSTEM_PAL, 1024, 768, "Normal", "4:3", 08.75, 08.75}, &nv_nx_normal_c, &nx_50_normal_c, PORT_NVIDIA, TV_DEF_NX}, {{TV_SYSTEM_NONE, 0, 0, NULL, NULL, 0.0, 0.0}, NULL, NULL, 0}, }; /* -------- -------- */ static TVMode *modes_nv_nx = NULL; static TVMode* loop_create_nv_nx (TVMode *m, TVTemplateNvNx *t, TVSystem system) { for (; t->spec.system != TV_SYSTEM_NONE; t++) { m->spec = t->spec; m->spec.system = system; m->descFlags = t->descFlags; m->regs.devFlags = DEV_TELEVISION | DEV_INTERNAL; m->regs.portHost = m->regs.portEnc = t->portFlags; m->regs.crtc.nv = *(t->nv); m->regs.enc.nx.img = *(t->nx); data_init_nx (system, &m->regs.enc.nx); /* initializes rest */ data_init_nv (&m->regs.crtc.nv, m->regs.portHost, m->regs.devFlags); data_complete_nx (&m->regs); m++; } return m; } TVMode* data_modes_nv_nx (void) { int c; TVMode *m; if (modes_nv_nx) return modes_nv_nx; c = sizeof (templ_nv_nx_60hz) / sizeof(TVTemplateNvNx) * 3 + sizeof (templ_nv_nx_50hz) / sizeof(TVTemplateNvNx) * 3 + 1; modes_nv_nx = (TVMode *) malloc (sizeof (TVMode) * c); m = modes_nv_nx; m = loop_create_nv_nx (m, templ_nv_nx_60hz, TV_SYSTEM_NTSC ); m = loop_create_nv_nx (m, templ_nv_nx_60hz, TV_SYSTEM_NTSC_J); m = loop_create_nv_nx (m, templ_nv_nx_60hz, TV_SYSTEM_PAL_M ); m = loop_create_nv_nx (m, templ_nv_nx_50hz, TV_SYSTEM_PAL ); m = loop_create_nv_nx (m, templ_nv_nx_50hz, TV_SYSTEM_PAL_N ); m = loop_create_nv_nx (m, templ_nv_nx_50hz, TV_SYSTEM_PAL_NC); m->spec.system = TV_SYSTEM_NONE; return modes_nv_nx; } /* ======== ================================ */ void data_init_nv (TVNvRegs *r, int portHost, int devFlags) { if (devFlags & DEV_OVERLAY) { r->clock = 0; r->HBlankStart = 0; r->HBlankEnd = 0; r->HTotal = 0; r->VBlankStart = 0; r->VBlankEnd = 0; r->VTotal = 0; } else { r->HBlankStart = r->HDisplay; r->HBlankEnd = r->HTotal; r->VBlankStart = r->VDisplay; r->VBlankEnd = r->VTotal; } r->latency = 0; if ((portHost & PORT_SYNC_DIR) == PORT_SYNC_MASTER) { r->slave.HSyncStart = 0; r->slave.HSyncEnd = 0; r->slave.HTotal = 0; r->slave.VSyncStart = 0; r->slave.VSyncEnd = 0; r->slave.VTotal = 0; r->slave.Unknown = 0; } r->flags = 0; /* FIXME */ } void data_move_bt_cx (TVSettings *s, TVRegs *r) { /* FIXME: Pure monitor movement, and tv vert movement */ /* If HTotal = h_clki - 3*8, the monitor position is the same as at hclk_i. However, the image moves, so compensate with hsyncoffset. Try to keep hsynoffset always positive */ /* Can't make HTotal too small, or monitor image will disappear... So sometimes you have to use negative hsynoffset ... */ #if 0 /* TODO */ if (r->crtc.HTotal > r->enc.bt.h_clki - 3*8 && r->crtc.HTotal < r->enc.bt.h_clki) { /* compensate for bad HTotal value */ r->enc.bt.hsynoffset += r->crtc.HTotal - (r->enc.bt.h_clki - 3*8); r->crtc.HTotal = r->enc.bt.h_clki - 3*8; } #endif r->crtc.nv.VSyncStart -= s->mon_voffset; r->crtc.nv.VSyncEnd -= s->mon_voffset; r->crtc.nv.HSyncStart -= s->mon_hoffset * 8; r->crtc.nv.HSyncEnd -= s->mon_hoffset * 8; } void data_move_nv (TVSettings *s, TVRegs *r) { /* FIXME: Pure monitor movement */ r->crtc.nv.VSyncStart -= s->mon_voffset; r->crtc.nv.VSyncEnd -= s->mon_voffset; r->crtc.nv.HSyncStart -= s->mon_hoffset * 8; r->crtc.nv.HSyncEnd -= s->mon_hoffset * 8; } void data_make_nv (int hdisplay, int hsyncstart, int hsyncend, int htotal, int vdisplay, int vsyncstart, int vsyncend, int vtotal, int dotclock, TVCrtcRegs *crt) { crt->nv.clock = dotclock; crt->nv.HDisplay = hdisplay; crt->nv.HSyncStart = hsyncstart; crt->nv.HSyncEnd = hsyncend; crt->nv.HTotal = htotal; crt->nv.VDisplay = vdisplay; crt->nv.VSyncStart = vsyncstart; crt->nv.VSyncEnd = vsyncend; crt->nv.VTotal = vtotal; data_init_nv (&crt->nv, PORT_NVIDIA, DEV_MONITOR); } /* -------- -------- */ void data_calc_nv_bt (TVSystem system, int hres, int vres, double hoc, double voc, TVRegs *r) { recalc_bt_custom (system, hres, vres, hoc, voc, r); calc_nv_btcx (hres, vres, r); data_mux_nv_bt (&r->enc.bt); data_init_nomux_bt (system, &r->enc.bt); r->portHost = r->portEnc = PORT_NVIDIA; } void data_calc_nv_cx (TVSystem system, int hres, int vres, double hoc, double voc, TVRegs *r) { recalc_cx_custom (system, hres, vres, hoc, voc, r); calc_nv_btcx (hres, vres, r); data_init_cx (system, &r->enc.cx, 0); r->portHost = r->portEnc = PORT_NVIDIA; } /* -------- -------- */ void data_setup_nv_bt (TVSettings *s, TVRegs *r) { data_move_nv (s, r); data_move_bt_cx (s, r); data_mux_nv_bt (&r->enc.bt); data_setup_nomux_bt (s, r); } void data_setup_nv_cx (TVSettings *s, TVRegs *r) { data_move_nv (s, r); data_move_bt_cx (s, r); data_mux_nv_bt (&r->enc.bt); data_setup_cx (s, r); } void data_setup_nv_ch1 (TVSettings *s, TVRegs *r) { data_move_nv (s, r); data_setup_ch1 (s, r); } void data_setup_nv_ch2 (TVSettings *s, TVRegs *r) { data_move_nv (s, r); data_setup_ch2 (s, r); } void data_setup_nv_ph (TVSettings *s, TVRegs *r) { data_move_nv (s, r); data_setup_ph (s, r); } void data_setup_nv_nx (TVSettings *s, TVRegs *r) { data_move_nv (s, r); data_setup_nx (s, r); } /* -------- -------- */ DataCardFunc data_nv_func = { make: data_make_nv, }; DataFunc data_nv_bt_func = { modes: data_modes_nv_bt, defaults: data_default_bt, setup: data_setup_nv_bt, clamp: data_clamp_bt, calc: data_calc_nv_bt, }; DataFunc data_nv_cx_func = { modes: data_modes_nv_cx, defaults: data_default_cx, setup: data_setup_nv_cx, clamp: data_clamp_cx, calc: data_calc_nv_cx, }; DataFunc data_nv_ch1_func = { modes: data_modes_nv_ch1, defaults: data_default_ch, setup: data_setup_nv_ch1, clamp: data_clamp_ch, calc: data_calc_null, }; DataFunc data_nv_ch2_func = { /* FIXME */ modes: data_modes_nv_ch2, defaults: data_default_ch, setup: data_setup_nv_ch2, clamp: data_clamp_ch, calc: data_calc_null, }; DataFunc data_nv_ph1_func = { modes: data_modes_nv_ph1, defaults: data_default_ph, setup: data_setup_nv_ph, clamp: data_clamp_ph, calc: data_calc_null, }; DataFunc data_nv_ph2_func = { modes: data_modes_nv_ph2, defaults: data_default_ph, setup: data_setup_nv_ph, clamp: data_clamp_ph, calc: data_calc_null, }; DataFunc data_nv_nx_func = { modes: data_modes_nv_nx, defaults: data_default_nx, setup: data_setup_nv_nx, clamp: data_clamp_nx, calc: data_calc_null, }; nvtv-0.4.7/src/data_tdfx.c0000644000175000001440000003143207660263500011074 /* NVTV 3dfx CRTC data -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_tdfx.c,v 1.4 2003/05/13 21:44:32 dthierbach Exp $ * * Contents: * * Data routines for the 3dfx CRTC data. * */ #include #include #include "data_tdfx.h" #include "data_bt.h" #include "calc_bt.h" /* -------- BT ------------------------ */ #define TV_DEF_BT (TV_CAP_MACROVISION | TV_CAP_NONINTERLACED | \ TV_CAP_MONOCHROME) /* -------- BT -------- NTSC -------- */ TVTdfxRegs tdfx_bt_ntsc_small_a = { HScreenSize : 640, VScreenSize : 480, tvHBlankStart : 89, /* tuned h_blanki=126 */ tvVBlankStart : 75, }; TVTdfxRegs tdfx_bt_ntsc_normal_a = { HScreenSize : 640, VScreenSize : 480, tvHBlankStart : 102, /* tuned h_blanki=140 */ tvVBlankStart : 58, }; TVTdfxRegs tdfx_bt_ntsc_huge_a = { HScreenSize : 640, VScreenSize : 480, tvHBlankStart : 101, /* tuned h_blanki=133 */ tvVBlankStart : 36, /* tuned v_blanki=36 */ }; TVTdfxRegs tdfx_bt_ntsc_small_b = { HScreenSize : 800, VScreenSize : 600, tvHBlankStart : 29, /* tuned h_blanki=66 */ tvVBlankStart : 86, }; TVTdfxRegs tdfx_bt_ntsc_normal_b = { HScreenSize : 800, VScreenSize : 600, tvHBlankStart : 0, /* tuned h_blanki=26 hsynoffset=-12 */ tvVBlankStart : 60, }; TVTdfxRegs tdfx_bt_ntsc_huge_b = { HScreenSize : 800, VScreenSize : 600, tvHBlankStart : 0, /* tuned h_blanki=26 hsynoffset=-12 */ tvVBlankStart : 42, }; TVTdfxRegs tdfx_bt_ntsc_normal_c = { HScreenSize : 720, VScreenSize : 480, tvHBlankStart : 116, /* tuned h_blanki=154 hsynoffset=0 */ tvVBlankStart : 75, }; TVTdfxRegs tdfx_bt_ntsc_dvd_a = { HScreenSize : 720, VScreenSize : 480, tvHBlankStart : 106, /* tuned h_blanki=140 */ tvVBlankStart : 36, }; /* -------- BT -------- PAL -------- */ TVTdfxRegs tdfx_bt_pal_small_a = { HScreenSize : 640, VScreenSize : 480, tvHBlankStart : 228, /* tuned h_blanki=266 */ tvVBlankStart : 90, }; TVTdfxRegs tdfx_bt_pal_normal_a = { HScreenSize : 640, VScreenSize : 480, tvHBlankStart : 278, /* tuned h_blanki=315 */ tvVBlankStart : 57, }; TVTdfxRegs tdfx_bt_pal_huge_a = { HScreenSize : 640, VScreenSize : 480, tvHBlankStart : 260, /* tuned h_blanki=299/312 */ tvVBlankStart : 36, }; TVTdfxRegs tdfx_bt_pal_small_b = { HScreenSize : 800, VScreenSize : 600, tvHBlankStart : 98, /* tuned h_blanki=135/140 */ tvVBlankStart : 95, }; TVTdfxRegs tdfx_bt_pal_normal_b = { HScreenSize : 800, VScreenSize : 600, tvHBlankStart : 138, /* tuned h_blanki=175/100,140 */ tvVBlankStart : 64, }; TVTdfxRegs tdfx_bt_pal_large_b = { HScreenSize : 800, VScreenSize : 600, tvHBlankStart : 162, /* tuned h_blanki=190 hsynoffset=-8 */ tvVBlankStart : 51, }; TVTdfxRegs tdfx_bt_pal_huge_b = { HScreenSize : 800, VScreenSize : 600, tvHBlankStart : 63, /* tuned h_blanki=101 hsynoffset=14 */ tvVBlankStart : 46, /* tuned v_blanki=133 */ }; TVTdfxRegs tdfx_bt_pal_small_c = { HScreenSize : 768, VScreenSize : 576, tvHBlankStart : 166, /* tuned h_blanki=203 */ tvVBlankStart : 71, }; TVTdfxRegs tdfx_bt_pal_normal_c = { HScreenSize : 768, VScreenSize : 576, tvHBlankStart : 165, /* tuned h_blanki=203 */ tvVBlankStart : 58, }; TVTdfxRegs tdfx_bt_pal_dvd_a = { HScreenSize : 720, VScreenSize : 576, tvHBlankStart : 89, /* tuned h_blanki=147 hsynoffset=4 */ tvVBlankStart : 32, /* tuned v_blanki=42 */ }; /* -------- BT -------- PAL-60 -------- */ TVTdfxRegs tdfx_bt_pal60_small_a = { HScreenSize : 640, VScreenSize : 480, tvHBlankStart : 103, /* tuned h_blanki=140 */ tvVBlankStart : 81, /* tuned v_blank=81 */ }; TVTdfxRegs tdfx_bt_pal60_normal_a = { HScreenSize : 640, VScreenSize : 480, tvHBlankStart : 108, /* tuned h_blanki=145/140 */ tvVBlankStart : 58, }; TVTdfxRegs tdfx_bt_pal60_huge_a = { HScreenSize : 640, VScreenSize : 480, tvHBlankStart : 92, /* tuned h_blanki=126 */ tvVBlankStart : 23, /* tuned v_blanki=36 */ }; TVTdfxRegs tdfx_bt_pal60_small_b = { HScreenSize : 800, VScreenSize : 600, tvHBlankStart : 28, /* tuned h_blanki=66 */ tvVBlankStart : 86, }; TVTdfxRegs tdfx_bt_pal60_normal_b = { HScreenSize : 800, VScreenSize : 600, tvHBlankStart : 0, /* tuned h_blanki=26 (not optimal) */ tvVBlankStart : 60, }; TVTdfxRegs tdfx_bt_pal60_huge_b = { HScreenSize : 800, VScreenSize : 600, tvHBlankStart : 0, /* tuned h_blanki=26 (not optimal) */ tvVBlankStart : 44, }; TVTdfxRegs tdfx_bt_pal60_dvd_a = { HScreenSize : 720, VScreenSize : 480, tvHBlankStart : 106, /* tuned h_blanki=140 */ tvVBlankStart : 36, }; /* -------- TDFX -------- Mode list -------- */ typedef struct { TVModeSpec spec; TVTdfxRegs *tdfx; TVBtRegs *bt; int hsynoffset; int flags; } TVTemplateTdfxBt; TVTemplateTdfxBt templ_tdfx_bt [] = { {{TV_SYSTEM_NTSC, 640, 480, "Small", "4:3", 13.79, 13.58}, &tdfx_bt_ntsc_small_a, &bt_ntsc_small_a, 0, TV_DEF_BT}, {{TV_SYSTEM_NTSC, 640, 480, "Normal", "4:3", 10.59, 08.23}, &tdfx_bt_ntsc_normal_a, &bt_ntsc_normal_a, 0, TV_DEF_BT}, {{TV_SYSTEM_NTSC, 640, 480, "Huge", "4:3", 02.46, 01.23}, &tdfx_bt_ntsc_huge_a, &bt_ntsc_huge_a, 0, TV_DEF_BT}, {{TV_SYSTEM_NTSC, 800, 600, "Small", "4:3", 21.62, 11.52}, &tdfx_bt_ntsc_small_b, &bt_ntsc_small_b, 0, TV_DEF_BT}, {{TV_SYSTEM_NTSC, 800, 600, "Normal", "4:3", 11.90, 05.35}, &tdfx_bt_ntsc_normal_b, &bt_ntsc_normal_b, -12, TV_DEF_BT}, {{TV_SYSTEM_NTSC, 800, 600, "Huge", "4:3", 07.15, 0.004}, &tdfx_bt_ntsc_huge_b, &bt_ntsc_huge_b, 0, TV_DEF_BT}, {{TV_SYSTEM_NTSC, 720, 480, "Normal", "DVD", 08.762, 18.107}, &tdfx_bt_ntsc_normal_c, &bt_ntsc_normal_c, 0, TV_DEF_BT}, {{TV_SYSTEM_NTSC, 720, 480, "DVD", "DVD", 01.245, 01.235}, &tdfx_bt_ntsc_dvd_a, &bt_ntsc_dvd_a, 0, TV_DEF_BT}, {{TV_SYSTEM_PAL, 640, 480, "Small", "4:3", 16.56, 16.67}, &tdfx_bt_pal_small_a, &bt_pal_small_a, 0, TV_DEF_BT}, {{TV_SYSTEM_PAL, 640, 480, "Normal", "4:3", 12.87, 07.64}, &tdfx_bt_pal_normal_a, &bt_pal_normal_a, 0, TV_DEF_BT}, {{TV_SYSTEM_PAL, 640, 480, "Huge", "4:3", 06.22, 00.69}, &tdfx_bt_pal_huge_a, &bt_pal_huge_a, 0, TV_DEF_BT}, {{TV_SYSTEM_PAL, 800, 600, "Small", "4:3", 14.53, 13.19}, &tdfx_bt_pal_small_b, &bt_pal_small_b, 0, TV_DEF_BT}, {{TV_SYSTEM_PAL, 800, 600, "Normal", "4:3", 10.81, 05.56}, &tdfx_bt_pal_normal_b, &bt_pal_normal_b, 0, TV_DEF_BT}, {{TV_SYSTEM_PAL, 800, 600, "Large", "4:3", 07.461, 02.083}, &tdfx_bt_pal_large_b, &bt_pal_large_b, -8, TV_DEF_BT}, {{TV_SYSTEM_PAL, 800, 600, "Huge", "4:3", 00.039, 00.00}, &tdfx_bt_pal_huge_b, &bt_pal_huge_b, 14, TV_DEF_BT}, {{TV_SYSTEM_PAL, 768, 576, "Small", "4:3", 13.122, 07.986}, &tdfx_bt_pal_small_c, &bt_pal_small_c, 0, TV_DEF_BT}, {{TV_SYSTEM_PAL, 768, 576, "Normal", "4:3", 09.806, 04.514}, &tdfx_bt_pal_normal_c, &bt_pal_normal_c, 0, TV_DEF_BT}, {{TV_SYSTEM_PAL, 720, 576, "DVD", "DVD", 00.208, 00.000}, &tdfx_bt_pal_dvd_a, &bt_pal_dvd_a, 4, TV_DEF_BT}, {{TV_SYSTEM_PAL_60, 640, 480, "Small", "4:3", 16.76, 14.81}, &tdfx_bt_pal60_small_a, &bt_pal60_small_a, 0, TV_DEF_BT}, {{TV_SYSTEM_PAL_60, 640, 480, "Normal", "4:3", 10.59, 08.23}, &tdfx_bt_pal60_normal_a, &bt_pal60_normal_a, 0, TV_DEF_BT}, {{TV_SYSTEM_PAL_60, 640, 480, "Huge", "4:3", 01.47, 01.23}, &tdfx_bt_pal60_huge_a, &bt_pal60_huge_a, 0, TV_DEF_BT}, {{TV_SYSTEM_PAL_60, 800, 600, "Small", "4:3", 21.62, 11.52}, &tdfx_bt_pal60_small_b, &bt_pal60_small_b, 0, TV_DEF_BT}, {{TV_SYSTEM_PAL_60, 800, 600, "Normal", "4:3", 11.90, 05.35}, &tdfx_bt_pal60_normal_b, &bt_pal60_normal_b, 0, TV_DEF_BT}, {{TV_SYSTEM_PAL_60, 800, 600, "Huge", "4:3", 07.86, 00.82}, &tdfx_bt_pal60_huge_b, &bt_pal60_huge_b, 0, TV_DEF_BT}, {{TV_SYSTEM_PAL_60, 720, 480, "DVD", "DVD", 01.245, 01.235}, &tdfx_bt_pal60_dvd_a, &bt_pal60_dvd_a, 0, TV_DEF_BT}, {{TV_SYSTEM_NONE, 0, 0, NULL, NULL, 0.0, 0.0}, NULL, NULL, 0, 0}, }; /* -------- -------- */ static TVMode *modes_tdfx_bt = NULL; /* * count number of modes matching system; TV_SYSTEM_NONE matches all. */ int data_count_tdfx_bt (TVSystem system) { int count; TVTemplateTdfxBt *t; count = 0; for (t = templ_tdfx_bt; t->spec.system != TV_SYSTEM_NONE; t++) { if (system == TV_SYSTEM_NONE || system == t->spec.system) count++; } return count; } TVMode *data_modes_tdfx_bt (void) { int c; TVMode *m; TVTemplateTdfxBt *t; if (modes_tdfx_bt) return modes_tdfx_bt; c = data_count_tdfx_bt (TV_SYSTEM_NONE) + 1; modes_tdfx_bt = (TVMode *) malloc (sizeof (TVMode) * c); m = modes_tdfx_bt; for (t = templ_tdfx_bt; t->spec.system != TV_SYSTEM_NONE; t++) { m->spec = t->spec; m->descFlags = t->flags; m->regs.portHost = m->regs.portEnc = PORT_TDFX; m->regs.devFlags = DEV_TELEVISION; m->regs.crtc.tdfx = *(t->tdfx); m->regs.enc.bt = *(t->bt); m->regs.enc.bt.hsynoffset = t->hsynoffset; data_mux_tdfx_bt (&m->regs.enc.bt); data_init_nomux_bt (m->spec.system, &m->regs.enc.bt); data_init_tdfx (&m->regs.crtc.tdfx, m->regs.portHost); m++; } m->spec.system = TV_SYSTEM_NONE; return modes_tdfx_bt; } /* -------- -------- */ void data_init_tdfx (TVTdfxRegs *r, int portHost) { r->tvHBlankEnd = r->tvHBlankStart + r->HScreenSize; r->tvVBlankEnd = r->tvVBlankStart + r->VScreenSize; r->tvBlankDelay = 0; r->tvSyncDelay = 0; r->tvLatency = 0; if ((portHost & PORT_SYNC_DIR) == PORT_SYNC_MASTER) { r->clock = 0; r->HDisplay = 0; r->HBlankStart = 0; r->HSyncStart = 0; r->HSyncEnd = 0; r->HBlankEnd = 0; r->HTotal = 0; r->VDisplay = 0; r->VBlankStart = 0; r->VSyncStart = 0; r->VSyncEnd = 0; r->VBlankEnd = 0; r->VTotal = 0; } r->flags = 0; } void data_make_tdfx (int hdisplay, int hsyncstart, int hsyncend, int htotal, int vdisplay, int vsyncstart, int vsyncend, int vtotal, int dotclock, TVCrtcRegs *crt) { crt->tdfx.clock = dotclock; crt->tdfx.HDisplay = hdisplay; crt->tdfx.HSyncStart = hsyncstart; crt->tdfx.HSyncEnd = hsyncend; crt->tdfx.HTotal = htotal; crt->tdfx.VDisplay = vdisplay; crt->tdfx.VSyncStart = vsyncstart; crt->tdfx.VSyncEnd = vsyncend; crt->tdfx.VTotal = vtotal; crt->tdfx.HScreenSize = hdisplay; crt->tdfx.VScreenSize = vdisplay; crt->tdfx.tvHBlankStart = 0; crt->tdfx.tvHBlankEnd = 0; crt->tdfx.tvVBlankStart = 0; crt->tdfx.tvVBlankEnd = 0; crt->tdfx.tvBlankDelay = 0; crt->tdfx.tvSyncDelay = 0; crt->tdfx.flags = 0; if (dotclock > 135000) { crt->tdfx.flags |= TDFX_FLAG_CLOCK2X; crt->tdfx.HDisplay /= 2; crt->tdfx.HSyncStart /= 2; crt->tdfx.HSyncEnd /= 2; crt->tdfx.HTotal /= 2; crt->tdfx.HScreenSize /= 2; } } /* -------- -------- */ void calc_tdfx_btcx (int hres, int vres, TVRegs *r) { register TVTdfxRegs *c = &r->crtc.tdfx; r->devFlags = DEV_TELEVISION | DEV_MONITOR; c->HScreenSize = hres; c->VScreenSize = vres; c->tvHBlankStart = r->enc.bt.h_blanki - 38; c->tvVBlankStart = r->enc.bt.v_blanki; if (c->tvHBlankStart < 0) { r->enc.bt.hsynoffset = c->tvHBlankStart; c->tvHBlankStart = 0; } data_init_tdfx (c, PORT_TDFX); } void data_calc_tdfx_bt (TVSystem system, int hres, int vres, double hoc, double voc, TVRegs *r) { recalc_bt_custom (system, hres, vres, hoc, voc, r); calc_tdfx_btcx (hres, vres, r); data_mux_tdfx_bt (&r->enc.bt); data_init_nomux_bt (system, &r->enc.bt); r->portHost = r->portEnc = PORT_TDFX; } void data_setup_tdfx_bt (TVSettings *s, TVRegs *r) { data_mux_tdfx_bt (&r->enc.bt); data_setup_nomux_bt (s, r); } /* -------- -------- */ DataCardFunc data_tdfx_func = { make: data_make_tdfx, }; DataFunc data_tdfx_bt_func = { modes: data_modes_tdfx_bt, defaults: data_default_bt, setup: data_setup_tdfx_bt, clamp: data_clamp_bt, calc: data_calc_tdfx_bt, }; nvtv-0.4.7/src/data_i810.c0000644000175000001440000003474710006415006010610 /* NVTV Intel 810 CRTC data -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_i810.c,v 1.8 2004/01/30 08:47:02 dthierbach Exp $ * * Contents: * * Data routines for the Intel 810 CRTC data. * */ #include #include #include #include "data_i810.h" #include "data_ch.h" /* -------- CH -------------------------------- */ #define TV_DEF_CH (TV_CAP_MONOCHROME) /* -------- I810 -------- CRT/CH1 -------- */ TVI810Regs i810_ch1_pal_huge_a = { /* Mode 13 */ tvHDisplay : 640, tvHSyncStart : 740, tvHSyncEnd : 804, tvHTotal : 840, tvVDisplay : 480, tvVSyncStart : 490, tvVSyncEnd : 492, tvVTotal : 500, }; TVI810Regs i810_ch1_pal_small_a = { /* Mode 14 */ tvHDisplay : 640, tvHSyncStart : 740, tvHSyncEnd : 804, tvHTotal : 840, tvVDisplay : 480, tvVSyncStart : 552, tvVSyncEnd : 554, tvVTotal : 625, }; TVI810Regs i810_ch1_pal_tiny_a = { /* Mode 15 */ tvHDisplay : 640, tvHSyncStart : 740, tvHSyncEnd : 804, tvHTotal : 840, tvVDisplay : 480, tvVSyncStart : 615, tvVSyncEnd : 617, tvVTotal : 750, }; TVI810Regs i810_ch1_ntsc_huge_a = { /* Mode 16 */ tvHDisplay : 640, tvHSyncStart : 712, tvHSyncEnd : 776, tvHTotal : 784, tvVDisplay : 480, tvVSyncStart : 502, tvVSyncEnd : 504, tvVTotal : 525, }; TVI810Regs i810_ch1_ntsc_small_a = { /* Mode 17 */ tvHDisplay: 640, tvHSyncStart: 712, tvHSyncEnd: 776, tvHTotal: 784, tvVDisplay: 480, tvVSyncStart: 540, tvVSyncEnd: 542, tvVTotal: 600, }; TVI810Regs i810_ch1_ntsc_tiny_a = { /* Mode 18 */ tvHDisplay : 640, tvHSyncStart : 720, tvHSyncEnd : 784, tvHTotal : 800, tvVDisplay : 480, tvVSyncStart : 555, tvVSyncEnd : 557, tvVTotal : 630, }; TVI810Regs i810_ch1_pal_huge_b = { /* Mode 19 */ tvHDisplay : 800, tvHSyncStart : 872, tvHSyncEnd : 936, tvHTotal : 944, tvVDisplay : 600, tvVSyncStart : 612, tvVSyncEnd : 614, tvVTotal : 625, }; TVI810Regs i810_ch1_pal_small_b = { /* Mode 20 */ tvHDisplay : 800, tvHSyncStart : 880, tvHSyncEnd : 944, tvHTotal : 960, tvVDisplay : 600, tvVSyncStart : 675, tvVSyncEnd : 677, tvVTotal : 750, }; TVI810Regs i810_ch1_pal_tiny_b = { /* Mode 21 */ tvHDisplay : 800, tvHSyncStart : 868, tvHSyncEnd : 932, tvHTotal : 936, tvVDisplay : 600, tvVSyncStart : 718, tvVSyncEnd : 720, tvVTotal : 836, }; TVI810Regs i810_ch1_ntsc_huge_b = { /* Mode 22 */ tvHDisplay : 800, tvHSyncStart : 920, tvHSyncEnd : 984, tvHTotal : 1040, tvVDisplay : 600, tvVSyncStart : 615, tvVSyncEnd : 617, tvVTotal : 630, }; TVI810Regs i810_ch1_ntsc_large_b = { /* Mode 23 */ tvHDisplay : 800, tvHSyncStart : 920, tvHSyncEnd : 984, tvHTotal : 1040, tvVDisplay : 600, tvVSyncStart : 650, tvVSyncEnd : 652, tvVTotal : 700, }; TVI810Regs i810_ch1_ntsc_small_b = { /* Mode 24 */ tvHDisplay : 800, tvHSyncStart : 932, tvHSyncEnd : 996, tvHTotal : 1064, tvVDisplay : 600, tvVSyncStart : 675, tvVSyncEnd : 677, tvVTotal : 750, }; /* -------- I830 -------- CRT/CH2 -------- */ TVI810Regs i830_ch2_pal_small_a = { /* Mode 32 */ tvHDisplay : 1024, /* from dump */ tvHSyncStart : 1212, /* from dump */ tvHSyncEnd : 1276, /* from dump */ tvHTotal : 1400, /* from dump */ tvVDisplay : 768, /* from dump */ tvVSyncStart : 884, /* from dump */ tvVSyncEnd : 886, /* from dump */ tvVTotal : 1000, /* from dump */ }; /* -------- I845 -------- CRT/CH2 -------- */ TVI810Regs i845_ch2_pal_tiny_b = { /* Mode 27 */ tvHDisplay : 800, tvHSyncStart : 824, tvHSyncEnd : 1144, /* ??? from BIOS */ tvHTotal : 960, tvVDisplay : 600, tvVSyncStart : 649, /* from BIOS */ tvVSyncEnd : 652, /* from BIOS */ tvVTotal : 875, }; TVI810Regs i845_ch2_ntsc_small_b = { /* Mode 29 */ tvHDisplay : 800, tvHSyncStart : 932, /* i865: 934 */ tvHSyncEnd : 1252, /* ??? from BIOS */ /* i65: 1254 */ tvHTotal : 1064, tvVDisplay : 600, tvVSyncStart : 611, /* from BIOS */ tvVSyncEnd : 614, /* from BIOS */ tvVTotal : 750, }; /* -------- I810 -------- modelist -------- */ typedef struct { int sav; int hpr; int vpr; } TVAdjustI810Ch; typedef struct { TVModeSpec spec; TVI810Regs *i810; TVChRegs *ch; unsigned long *fsci; TVAdjustI810Ch adj; int portFlags; int descFlags; } TVTemplateI810Ch; /* NTSC modes with "no dot crawl" get # appended to size */ /* ---- CH1 ---- */ TVTemplateI810Ch templ_i810_ch1_50hz [] = { /* 50 Hz: PAL, PAL-N, PAL-X */ {{TV_SYSTEM_PAL, 800, 600, "Tiny", "4:3", 21.875, 21.875}, /* Mode 21 */ &i810_ch1_pal_tiny_b, &ch1_pal_tiny_b, ch1_fsci_pal_tiny_b, {sav: 68, hpr: 76, vpr: 306}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_PAL, 800, 600, "Small", "4:3", 13.194, 13.194}, /* Mode 20 */ &i810_ch1_pal_small_b, &ch1_pal_small_b, ch1_fsci_pal_small_b, {sav: 80, hpr: 63, vpr: 306}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_PAL, 800, 600, "Huge", "4:3", -4.167, -4.167}, /* Mode 19 */ &i810_ch1_pal_huge_b, &ch1_pal_huge_b, ch1_fsci_pal_huge_b, {sav: 72, hpr: 43, vpr: 298}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_PAL, 640, 480, "Tiny", "4:3", 30.556, 30.556}, /* Mode 15 */ &i810_ch1_pal_tiny_a, &ch1_pal_tiny_a, ch1_fsci_pal_tiny_a, {sav: 100, hpr: 80, vpr: 306}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_PAL, 640, 480, "Small", "4:3", 16.667, 16.667}, /* Mode 14 */ &i810_ch1_pal_small_a, &ch1_pal_small_a, ch1_fsci_pal_small_a, {sav: 100, hpr: 53, vpr: 305}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_PAL, 640, 480, "Huge", "4:3", -4.167, -4.167}, /* Mode 13 */ &i810_ch1_pal_huge_a, &ch1_pal_huge_a, ch1_fsci_pal_huge_a, {sav: 100, hpr: 25, vpr: 304}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_NONE, 0, 0, NULL, NULL, 0.0, 0.0}, NULL, NULL, NULL, {}, 0}, }; /* NTSC modes with "no dot crawl" get # appended to size */ TVTemplateI810Ch templ_i810_ch1_60hz [] = { /* 60 Hz: NTSC, NTSC-NDC, PAL-M */ {{TV_SYSTEM_NTSC, 800, 600, "Small", "4:3", 12.500, 12.500}, /* Mode 24 */ &i810_ch1_ntsc_small_b, &ch1_ntsc_small_b, ch1_fsci_ntsc_small_b, {sav: 132, hpr: 59, vpr: 255}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_NTSC, 800, 600, "Large", "4:3", 6.250, 6.250}, /* Mode 23 */ &i810_ch1_ntsc_large_b, &ch1_ntsc_large_b, ch1_fsci_ntsc_large_b, {sav: 120, hpr: 46, vpr: 255}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_NTSC, 800, 600, "Huge", "4:3", -4.167, -4.167}, /* Mode 22 */ &i810_ch1_ntsc_huge_b, &ch1_ntsc_huge_b, ch1_fsci_ntsc_huge_b, {sav: 120, hpr: 29, vpr: 251}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_NTSC, 640, 480, "Tiny", "4:3", 16.667, 16.667}, /* Mode 18 */ &i810_ch1_ntsc_tiny_a, &ch1_ntsc_tiny_a, ch1_fsci_ntsc_tiny_a, {sav: 80, hpr: 55, vpr: 255}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_NTSC, 640, 480, "Small", "4:3", 12.500, 12.500}, /* Mode 17 */ &i810_ch1_ntsc_small_a, &ch1_ntsc_small_a, ch1_fsci_ntsc_small_a, {sav: 72, hpr: 46, vpr: 255}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_NTSC, 640, 480, "Huge", "4:3", 0.000, 0.000}, /* Mode 16 */ &i810_ch1_ntsc_huge_a, &ch1_ntsc_huge_a, ch1_fsci_ntsc_huge_a, {sav: 72, hpr: 30, vpr: 255}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_NONE, 0, 0, NULL, NULL, 0.0, 0.0}, NULL, NULL, NULL, {}, 0}, }; /* ---- CH2 ---- */ TVTemplateI810Ch templ_i810_ch2_50hz [] = { /* 50 Hz: PAL, PAL-N, PAL-X */ {{TV_SYSTEM_PAL, 800, 600, "Tiny", "4:3", 00.000, 00.000}, /* Mode 27 */ &i845_ch2_pal_tiny_b, &ch2_pal_tiny_b, ch2_fsci_pal_tiny_b, {sav: 132, hpr: 90, vpr: 32}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_PAL, 800, 600, "Small", "4:3", 00.000, 00.000}, /* FIXME */ &i845_ch2_pal_tiny_b, &ch2_pal_tiny_b, ch2_fsci_pal_tiny_b, {sav: 132, hpr: 90, vpr: 32}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_PAL, 1024, 768, "Small", "4:3", 00.000, 00.000}, /* Mode 32 */ &i830_ch2_pal_small_a, &ch2_pal_small_a, ch2_fsci_pal_small_a, {sav: 190, hpr: 60, vpr: 304}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW}, {{TV_SYSTEM_NONE, 0, 0, NULL, NULL, 0.0, 0.0}, NULL, NULL, NULL, {}, 0}, }; TVTemplateI810Ch templ_i810_ch2_60hz [] = { /* 60 Hz: NTSC, NTSC-NDC, PAL-M */ {{TV_SYSTEM_NTSC, 800, 600, "Small", "4:3", 12.500, 12.500}, /* Mode 29 */ &i845_ch2_ntsc_small_b, &ch2_ntsc_small_b, ch1_fsci_ntsc_small_b, {sav: 132, hpr: 58, vpr: 14}, PORT_I810, TV_DEF_CH | TV_DEF_DUALVIEW | TV_CAP_MACROVISION}, {{TV_SYSTEM_NONE, 0, 0, NULL, NULL, 0.0, 0.0}, NULL, NULL, NULL, {}, 0}, }; /* -------- -------- */ static TVMode *modes_i810_ch1 = NULL; static TVMode *modes_i810_ch2 = NULL; static TVMode* loop_create_i810_ch1 (TVMode *m, TVTemplateI810Ch *t, TVSystem system, int f, char *suffix) { for (; t->spec.system != TV_SYSTEM_NONE; t++) { m->spec = t->spec; m->spec.system = system; m->descFlags = t->descFlags; if (suffix) { register char *s; s = (char *) malloc ((strlen(t->spec.size) + strlen (suffix) + 1) * sizeof (char)); m->spec.size = strcat (strcpy (s, t->spec.size), suffix); } m->regs.devFlags = (t->descFlags & TV_CAP_DUALVIEW) ? (DEV_MONITOR | DEV_TELEVISION) : (DEV_TELEVISION); m->regs.portHost = m->regs.portEnc = t->portFlags; m->regs.crtc.i810 = *(t->i810); m->regs.enc.ch = *(t->ch); m->regs.enc.ch.sav = t->adj.sav; m->regs.enc.ch.hpr = t->adj.hpr; m->regs.enc.ch.vpr = t->adj.vpr; if (t->fsci) m->regs.enc.ch.fsci = t->fsci[f]; data_init_ch1 (system, &m->regs.enc.ch); data_init_i810 (&m->regs.crtc.i810, m->regs.portHost); m++; } return m; } static TVMode* loop_create_i810_ch2 (TVMode *m, TVTemplateI810Ch *t, TVSystem system, int f, char *suffix) { for (; t->spec.system != TV_SYSTEM_NONE; t++) { m->spec = t->spec; m->spec.system = system; m->descFlags = t->descFlags; if (suffix) { register char *s; s = (char *) malloc ((strlen(t->spec.size) + strlen (suffix) + 1) * sizeof (char)); m->spec.size = strcat (strcpy (s, t->spec.size), suffix); } m->regs.devFlags = (t->descFlags & TV_CAP_DUALVIEW) ? (DEV_MONITOR | DEV_TELEVISION) : (DEV_TELEVISION); m->regs.portHost = m->regs.portEnc = t->portFlags; m->regs.crtc.i810 = *(t->i810); m->regs.enc.ch = *(t->ch); m->regs.enc.ch.sav = t->adj.sav; m->regs.enc.ch.hpr = t->adj.hpr; m->regs.enc.ch.vpr = t->adj.vpr; if (t->fsci) m->regs.enc.ch.fsci = t->fsci[f]; data_init_ch2 (system, &m->regs.enc.ch); data_init_i810 (&m->regs.crtc.i810, m->regs.portHost); m++; } return m; } TVMode* data_modes_i810_ch1 (void) { int c; TVMode *m; if (modes_i810_ch1) return modes_i810_ch1; c = sizeof (templ_i810_ch1_60hz) / sizeof(TVTemplateI810Ch) * 5 + sizeof (templ_i810_ch1_50hz) / sizeof(TVTemplateI810Ch) * 2 + 1; modes_i810_ch1 = (TVMode *) malloc (sizeof (TVMode) * c); m = modes_i810_ch1; m = loop_create_i810_ch1 (m, templ_i810_ch1_60hz, TV_SYSTEM_NTSC, 0, NULL); m = loop_create_i810_ch1 (m, templ_i810_ch1_60hz, TV_SYSTEM_NTSC_J, 0, NULL); m = loop_create_i810_ch1 (m, templ_i810_ch1_60hz, TV_SYSTEM_NTSC, 1, "#"); m = loop_create_i810_ch1 (m, templ_i810_ch1_60hz, TV_SYSTEM_PAL_M, 2, NULL); m = loop_create_i810_ch1 (m, templ_i810_ch1_60hz, TV_SYSTEM_PAL_60, 3, NULL); m = loop_create_i810_ch1 (m, templ_i810_ch1_50hz, TV_SYSTEM_PAL, 0, NULL); m = loop_create_i810_ch1 (m, templ_i810_ch1_50hz, TV_SYSTEM_PAL_N, 1, NULL); m->spec.system = TV_SYSTEM_NONE; return modes_i810_ch1; } TVMode* data_modes_i810_ch2 (void) { int c; TVMode *m; if (modes_i810_ch2) return modes_i810_ch2; c = sizeof (templ_i810_ch2_60hz) / sizeof(TVTemplateI810Ch) * 5 + sizeof (templ_i810_ch2_50hz) / sizeof(TVTemplateI810Ch) * 2 + 1; modes_i810_ch2 = (TVMode *) malloc (sizeof (TVMode) * c); m = modes_i810_ch2; m = loop_create_i810_ch2 (m, templ_i810_ch2_60hz, TV_SYSTEM_NTSC, 0, NULL); m = loop_create_i810_ch2 (m, templ_i810_ch2_60hz, TV_SYSTEM_NTSC_J, 0, NULL); m = loop_create_i810_ch2 (m, templ_i810_ch2_60hz, TV_SYSTEM_NTSC, 1, "#"); m = loop_create_i810_ch2 (m, templ_i810_ch2_60hz, TV_SYSTEM_PAL_M, 2, NULL); m = loop_create_i810_ch2 (m, templ_i810_ch2_60hz, TV_SYSTEM_PAL_60, 3, NULL); m = loop_create_i810_ch2 (m, templ_i810_ch2_50hz, TV_SYSTEM_PAL, 0, NULL); m = loop_create_i810_ch2 (m, templ_i810_ch2_50hz, TV_SYSTEM_PAL_N, 1, NULL); m->spec.system = TV_SYSTEM_NONE; return modes_i810_ch2; } /* -------- -------- */ void data_init_i810 (TVI810Regs *r, int portHost) { r->tvHBlankStart = r->tvHDisplay; r->tvHBlankEnd = r->tvHTotal; r->tvVBlankStart = r->tvVDisplay; r->tvVBlankEnd = r->tvVTotal; r->borderRed = 0; r->borderGreen = 0; r->borderBlue = 0; } void data_make_i810 (int hdisplay, int hsyncstart, int hsyncend, int htotal, int vdisplay, int vsyncstart, int vsyncend, int vtotal, int dotclock, TVCrtcRegs *crt) { } /* -------- -------- */ DataCardFunc data_i810_func = { make: data_make_i810, }; DataFunc data_i810_ch1_func = { modes: data_modes_i810_ch1, defaults: data_default_ch, setup: data_setup_ch1, clamp: data_clamp_ch, calc: data_calc_null, }; DataFunc data_i810_ch2_func = { modes: data_modes_i810_ch2, defaults: data_default_ch, setup: data_setup_ch2, clamp: data_clamp_ch, calc: data_calc_null, }; nvtv-0.4.7/src/data_xbox.c0000644000175000001440000001376607620035051011113 /* NVTV XBox CRTC/FP data -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_xbox.c,v 1.2 2003/02/04 22:09:45 dthierbach Exp $ * * Contents: * * Data routines for the XBox CRTC/FP data. * */ #include "local.h" /* before everything else */ #include #include #include #include "data_bt.h" #include "data_cx.h" #include "data_ch.h" #include "data_ph.h" #include "data_xbox.h" #include "calc_bt.h" /* ======== CX ================================ */ #define TV_DEF_CX (TV_CAP_MACROVISION | TV_CAP_NONINTERLACED \ | TV_CAP_MONOCHROME) /* -------- CX -------- NTSC -------- */ /* -------- 640x480 -------- */ TVNvRegs xbox_cx_ntsc_bios = { /* BIOS defaults */ HDisplay : 640, HBlankStart : 640, HBlankEnd : 728, /* originally 744, but will be modified anyway */ HSyncStart : 640, HSyncEnd : 672, HTotal : 728, VDisplay : 480, VBlankStart : 480, VBlankEnd : 525, VSyncStart : 492, VSyncEnd : 495, VTotal : 525, flags : 0, clock : 0, fp : { HDisplay : 640-1, HSyncStart : 653, HSyncEnd : 685, HTotal : 776-1, HValidStart : 0, HValidEnd : 480-1, HCrtc : 600-1, VDisplay : 480-1, VSyncStart : 490, VSyncEnd : 493, VTotal : 525-1, VValidStart : 0, VValidEnd : 480-1, VCrtc : 480-1 } }; /* -------- CX modes -------- */ typedef struct { TVModeSpec spec; TVNvRegs *nv; TVCxRegs *cx; int hostFlags; int encFlags; int descFlags; } TVTemplateXBoxCx; TVTemplateXBoxCx templ_xbox_cx [] = { {{TV_SYSTEM_NTSC, 640, 480, "BIOS", "4:3", 00.00, 00.00}, &xbox_cx_ntsc_bios, &cx_ntsc_xbox, PORT_XBOX, PORT_XBOX, TV_DEF_CX}, {{TV_SYSTEM_NONE, 0, 0, NULL, NULL, 0.0, 0.0}, NULL, NULL, 0}, }; /* -------- -------- */ static TVMode *modes_xbox_cx = NULL; /* * count number of modes matching system; TV_SYSTEM_NONE matches all. */ int data_count_xbox_cx (TVTemplateXBoxCx *t, TVSystem system) { int count; count = 0; for (; t->spec.system != TV_SYSTEM_NONE; t++) { if (system == TV_SYSTEM_NONE || system == t->spec.system) count++; } return count; } static TVMode *loop_create_xbox_cx (TVMode *m, TVTemplateXBoxCx *t, Bool convert) { for (; t->spec.system != TV_SYSTEM_NONE; t++) { if (!convert || t->spec.system == TV_SYSTEM_PAL) { m->spec = t->spec; if (convert) m->spec.system = TV_SYSTEM_SECAM; m->descFlags = t->descFlags; m->regs.portHost = t->hostFlags; m->regs.portEnc = t->encFlags; m->regs.devFlags = DEV_TELEVISION | DEV_FLATPANEL; m->regs.crtc.nv = *(t->nv); m->regs.enc.cx = *(t->cx); data_init_cx (m->spec.system, &m->regs.enc.cx, FALSE); data_init_xbox (&m->regs.crtc.nv, m->regs.portHost, m->regs.devFlags); if (convert) data_secam_cx (&m->regs.enc.cx); m++; } } return m; } TVMode *data_modes_xbox_cx (void) { int c; TVMode *m; if (modes_xbox_cx) return modes_xbox_cx; c = data_count_xbox_cx (templ_xbox_cx, TV_SYSTEM_NONE) + data_count_xbox_cx (templ_xbox_cx, TV_SYSTEM_PAL) /* SECAM */ + 1; /* final zero */ modes_xbox_cx = (TVMode *) malloc (sizeof (TVMode) * c); m = modes_xbox_cx; m = loop_create_xbox_cx (m, templ_xbox_cx, FALSE); m = loop_create_xbox_cx (m, templ_xbox_cx, TRUE); m->spec.system = TV_SYSTEM_NONE; return modes_xbox_cx; } /* ======== ================================ */ void data_init_xbox (TVNvRegs *r, int portHost, int devFlags) { r->HBlankStart = r->HDisplay; r->HBlankEnd = r->HTotal; r->VBlankStart = r->VDisplay; r->VBlankEnd = r->VTotal; r->latency = 0; r->slave.HSyncStart = 0; r->slave.HSyncEnd = 0; r->slave.HTotal = 0; r->slave.VSyncStart = 0; r->slave.VSyncEnd = 0; r->slave.VTotal = 0; r->slave.Unknown = 0; r->flags = 0; /* FIXME */ } void data_move_xbox (TVSettings *s, TVRegs *r) { /* FIXME */ /* Probably have to adjust FP registers */ } void data_make_xbox (int hdisplay, int hsyncstart, int hsyncend, int htotal, int vdisplay, int vsyncstart, int vsyncend, int vtotal, int dotclock, TVCrtcRegs *crt) { crt->nv.clock = dotclock; crt->nv.HDisplay = hdisplay; crt->nv.HSyncStart = hsyncstart; crt->nv.HSyncEnd = hsyncend; crt->nv.HTotal = htotal; crt->nv.VDisplay = vdisplay; crt->nv.VSyncStart = vsyncstart; crt->nv.VSyncEnd = vsyncend; crt->nv.VTotal = vtotal; data_init_xbox (&crt->nv, PORT_XBOX, DEV_MONITOR); } /* -------- -------- */ void data_calc_xbox_cx (TVSystem system, int hres, int vres, double hoc, double voc, TVRegs *r) { recalc_cx_custom (system, hres, vres, hoc, voc, r); calc_nv_btcx (hres, vres, r); data_init_cx (system, &r->enc.cx, 0); r->portHost = r->portEnc = PORT_XBOX; } /* -------- -------- */ void data_setup_xbox_cx (TVSettings *s, TVRegs *r) { data_move_xbox (s, r); /* FIXME Maybe movement can be done just with FP registers, without changing the encoder regs? */ } /* -------- -------- */ DataCardFunc data_xbox_func = { make: data_make_xbox, }; /* -------- -------- */ DataFunc data_xbox_cx_func = { modes: data_modes_xbox_cx, defaults: data_default_cx, setup: data_setup_xbox_cx, clamp: data_clamp_cx, calc: data_calc_xbox_cx, }; nvtv-0.4.7/src/data_vesa.c0000644000175000001440000001027107620516351011064 /* NVTV data vesa -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_vesa.c,v 1.1 2003/02/06 17:35:37 dthierbach Exp $ * * Contents: VESA modelines, as a fallback * */ #include "local.h" /* before everything else */ #include #include "data.h" #include "data_vesa.h" typedef struct { char *name; int clock; int hdisplay; /* horizontal timing */ int hsyncstart; int hsyncend; int htotal; int vdisplay; /* vertical timing */ int vsyncstart; int vsyncend; int vtotal; } VesaModeLine; static VesaModeLine modes [] = { {"640x350@85", 31500, 640, 672, 736, 832, 350, 382, 385, 445, }, {"640x400@85", 31500, 640, 672, 736, 832, 400, 401, 404, 445, }, {"720x400@85", 35500, 720, 756, 828, 936, 400, 401, 404, 446, }, {"640x480@60", 25200, 640, 656, 752, 800, 480, 490, 492, 525, }, {"640x480@72", 31500, 640, 664, 704, 832, 480, 489, 491, 520, }, {"640x480@75", 31500, 640, 656, 720, 840, 480, 481, 484, 500, }, {"640x480@85", 36000, 640, 696, 752, 832, 480, 481, 484, 509, }, {"800x600@56", 36000, 800, 824, 896,1024, 600, 601, 603, 625, }, {"800x600@60", 40000, 800, 840, 968,1056, 600, 601, 605, 628, }, {"800x600@72", 50000, 800, 856, 976,1040, 600, 637, 643, 666, }, {"800x600@75", 49500, 800, 816, 896,1056, 600, 601, 604, 625, }, {"800x600@85", 56300, 800, 832, 896,1048, 600, 601, 604, 631, }, {"1024x768@60", 65000, 1024,1048,1184,1344, 768, 771, 777, 806, }, {"1024x768@70", 75000, 1024,1048,1184,1328, 768, 771, 777, 806, }, {"1024x768@75", 78800, 1024,1040,1136,1312, 768, 769, 772, 800, }, {"1024x768@85", 94500, 1024,1072,1168,1376, 768, 769, 772, 808, }, {"1152x864@75", 108000, 1152,1216,1344,1600, 864, 865, 868, 900, }, {"1280x960@60", 108000, 1280,1376,1488,1800, 960, 961, 964,1000, }, {"1280x960@85", 148500, 1280,1344,1504,1728, 960, 961, 964,1011, }, {"1280x1024@60", 108000, 1280,1328,1440,1688, 1024,1025,1028,1066, }, {"1280x1024@75", 135000, 1280,1296,1440,1688, 1024,1025,1028,1066, }, {"1280x1024@85", 157500, 1280,1344,1504,1728, 1024,1025,1028,1072, }, {"1600x1200@60", 162000, 1600,1664,1856,2160, 1200,1201,1204,1250, }, {"1600x1200@65", 175500, 1600,1664,1856,2160, 1200,1201,1204,1250, }, {"1600x1200@70", 189000, 1600,1664,1856,2160, 1200,1201,1204,1250, }, {"1600x1200@75", 202500, 1600,1664,1856,2160, 1200,1201,1204,1250, }, {"1600x1200@85", 229500, 1600,1664,1856,2160, 1200,1201,1204,1250, }, {"1792x1344@60", 204800, 1792,1920,2120,2448, 1344,1345,1348,1394, }, {"1792x1344@75", 261000, 1792,1888,2104,2456, 1344,1345,1348,1417, }, {"1856x1392@60", 218300, 1856,1952,2176,2528, 1392,1393,1396,1439, }, {"1856x1392@75", 288000, 1856,1984,2208,2560, 1392,1393,1396,1500, }, {"1920x1440@60", 234000, 1920,2048,2256,2600, 1440,1441,1444,1500, }, {"1920x1440@75", 297000, 1920,2064,2288,2640, 1440,1441,1444,1500, }, {"1400x1050@60", 122000, 1400,1488,1640,1880, 1050,1052,1064,1082, }, {"1400x1050@75", 155800, 1400,1464,1784,1912, 1050,1052,1064,1090, }, {NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0,} }; Bool data_vesa_mode (char *name, TVCrtcRegs *crt, make_vidmode make) { VesaModeLine *m; for (m = modes; m->name; m++) { if (strcmp (m->name, name) == 0) { make (m->hdisplay, m->hsyncstart, m->hsyncend, m->htotal, m->vdisplay, m->vsyncstart, m->vsyncend, m->vtotal, m->clock, crt); return TRUE; } } return FALSE; } nvtv-0.4.7/src/calc_bt.c0000644000175000001440000010624507655674002010541 /* NVTV Recalc -- Dirk Thierbach * * This is the recalc code from Brooktree, slightly modified. The * legal status of this code is unclear, but since it was freely * available on the Brooktree public ftp server before Brooktree * became Conexant, and most of the equations are easily derived from * the public documentation, I think it is save to use it. * */ #include #include #include #include "local.h" #include "tv_chip.h" #include "calc_bt.h" #define DebugOut(x) printf(x) /* ucPixelInputMode */ #define BT868_PIXEL_INPUT_MODE_24BIT_RGB_MUX (1 << 0) #define BT868_PIXEL_INPUT_MODE_16BIT_YCRCB_MUX (1 << 1) /* dwFilterFlags */ #define BT868_FILTER_FLAGS_DISFFILT (1 << 0) /* dwRegisterFlags */ #define BT868_REGISTER_FLAGS_ENOUT ((unsigned long) 1L << 0) #define BT868_REGISTER_FLAGS_ENBLANKO ((unsigned long) 1L << 1) #define BT868_REGISTER_FLAGS_VSYNCDUR ((unsigned long) 1L << 2) #define BT868_REGISTER_FLAGS_SETUP ((unsigned long) 1L << 3) #define BT868_REGISTER_FLAGS_VBLANKDLY ((unsigned long) 1L << 4) #define BT868_REGISTER_FLAGS_ENXCLK ((unsigned long) 1L << 5) #define BT868_REGISTER_FLAGS_BYPLL ((unsigned long) 1L << 6) #define BT868_REGISTER_FLAGS_ECLIP ((unsigned long) 1L << 7) #define BT868_REGISTER_FLAGS_SCRESET ((unsigned long) 1L << 8) #define BT868_REGISTER_FLAGS_NIOUT ((unsigned long) 1L << 9) #define BT868_REGISTER_FLAGS_PAL ((unsigned long) 1L << 10) #define BT868_REGISTER_FLAGS_625LINE ((unsigned long) 1L << 11) #define BT868_REGISTER_FLAGS_ENDOT ((unsigned long) 1L << 12) #define BT868_REGISTER_FLAGS_SLAVE ((unsigned long) 1L << 13) #define BT868_REGISTER_FLAGS_MODE2X ((unsigned long) 1L << 14) #define BT868_REGISTER_FLAGS_ECBAR ((unsigned long) 1L << 15) /* dwImplementationFlags; */ #define BT868_IMPLEMENTATION_FLAGS_DISCONFREE (1 << 0) #define BT868_IMPLEMENTATION_FLAGS_CCIR601 (1 << 1) #define BT868_IMPLEMENTATION_FLAGS_DOUBLEPLL (1 << 2) #define BT_IMPLEMENTATION_FLAGS_CONEXANT (1 << 3) /* dwInOutScanFlags; */ #define BT868_INOUTSCAN_FLAGS_OUT_INTERLACED (1 << 0) #define BT868_INOUTSCAN_FLAGS_IN_INTERLACED (1 << 1) /* ucTVOutMode 0 = NTSC, 1 = NTSC-50, 2 = PAL-BDGHI, 3 = PAL-N, 4 = PAL-Nc, 5 = PAL-M, 6 = PAL-M60, 7 = PAL-60 */ /* vsr = vertical scale ratio? vsrq = vsr quantized ? */ struct settings { double dCHARCLK; double dFXTAL; // 13500000; double dMinFrontPorchBC; // 13; // { 0 - 20 } double dMinBackPorchBC; // 3; // { 0 - 20 } double dHSYNOFFSET; // 0; // { 0 - 511 } double dHSYNWIDTH; // 2; // { 0 - 63 } double dVSYNOFFSET; // 0; // { -1024 - 1023 } double dVSYNWIDTH; // 1; // { 0 - 7 } double dALO; // 0; // { 288, 243, 288, 243 } double dTLO; // 0; // { 312.5, 262.5, 312, 262 } double dATO; // 0; // { .000052, .00005265556, .000052, .00005265556 } double dTTO; // 0; // { .000064, .0000635556, .000064, .0000635556 } double dFSC; // 0; FSC = Freq Sub Carrier double dHSYNCWIDTH; // .0000047; double dFRONTPORCH; // .0000015; double dHBURSTBEGIN; double dHBURSTEND; double dHBLANKO; double dHBLANKI; double dMSC; double dHXTAL; double dPHZINC; double dVBLANKO; double dVSRQ; double dMaxHsyncDrift; double dMinFrontPorchIn; double dFrontPorchIn; double dFrontPorchOut; double dBackPorchIn; double dBackPorchOut; double dFCLK; double dHACTIVEI; // 640; // { 640, 800 } double dVACTIVEI; // 480; // { 480, 600 } double dHOC; // .1379; // { 0 - .25 } double dVOC; // .1358; // { 0 - .25 } double dVSR; // 0; double dTLI; // 0; double dVLINESI; // 0; double dHCLKO; // 0; double dHCLKI; // 0; double dTPI; // 0; double dHFRACT; // 0; double dMFP; // 0; double dMBP; // 0; double dVACTIVEO; // 0; double dVBLANKI; // 0; double dPLLINT; // 0; double dPLLFRACT; // 0; double dPLLRATIO; // 0; double dSINX; // 0; double dV100; // 0; double dSYNCAMP; // 0; double dBSTAMP; // 0; double dMY; // 0; double dMCR; // 0; double dMCB; // 0; double dVSCALE; // 0; double dCLKRATIO; /* NEW */ long ucPHASEOFF; // 0; long ucLUMADLY; // 0; long ucOUTMODE; // 0; long ucAutoConfigMode; // 0; long ucTVOutMode; // 0; long ucPixelInputMode; long ucCLPF; // 0; long ucYLPF; // 3; long ucFSELY; // 3; long ucFSELC; // 3; long ucYCORING; // 0; long ucCCORING; // 0; long ucYATTENUATE; // 0; long ucCATTENUATE; // 0; long ucDIS_YFLPF; // 0; long ucDIS_GMSHY; // 1; long ucDIS_GMUSHY; // 1; long ucDIS_GMSHC; // 1; long ucDIS_GMUSHC; // 1; long ucOUTMUXA; // 0; long ucOUTMUXB; // 2; long ucOUTMUXC; // 1; long ucOUTMUXD; // 0; unsigned long dwRegisterFlags; unsigned long dwImplementationFlags; unsigned long dwInOutScanFlags; unsigned long dwFilterFlags; // 0; }; typedef struct settings * PENCODER_SETTINGS; inline double min (double a, double b) { if (a < b) return a; else return b; } inline double max (double a, double b) { if (a > b) return a; else return b; } void Bt868EncoderInitializeDefault( PENCODER_SETTINGS pS ) { pS->dCHARCLK = 1; /* FIXME TEST 8; */ /* { 1, 8, 9 } */ pS->dFXTAL = 13500000; /* { any }*/ pS->dMinFrontPorchBC = 13; /* { 0 - 20 }*/ pS->dMinBackPorchBC = 3; /* { 0 - 20 }*/ pS->dHSYNOFFSET = 0; /* { 0 - 511 }*/ pS->dHSYNWIDTH = 2; /* { 0 - 63 }*/ pS->dVSYNOFFSET = 0; /* { -1024 - 1023 } */ pS->dVSYNWIDTH = 1; /* { 0 - 7 } */ pS->dALO = 0; /* { 288, 243, 288, 243 }*/ pS->dTLO = 0; /* { 312.5, 262.5, 312, 262 }*/ pS->dATO = 0; /* { .000052, .00005265556, .000052, .00005265556 }*/ pS->dTTO = 0; /* { .000064, .0000635556, .000064, .0000635556 }*/ pS->dFSC = 0; pS->dHSYNCWIDTH = .0000047; pS->dFRONTPORCH = .0000015; pS->dHBURSTBEGIN = 0; pS->dHBURSTEND = 0; pS->dHBLANKO = 0; pS->dHBLANKI = 0; pS->dMSC = 0; pS->dHXTAL = 0; pS->dPHZINC = 0; pS->dVBLANKO = 0; pS->dVSRQ = 0; pS->dCLKRATIO = 1.0; pS->dMaxHsyncDrift = 0; pS->dMinFrontPorchIn = 0; pS->dFrontPorchIn = 0; pS->dFrontPorchOut = 0; pS->dBackPorchIn = 0; pS->dBackPorchOut = 0; pS->dFCLK = 0; pS->dHACTIVEI = 640; /* { 640, 800 } */ pS->dVACTIVEI = 480; /* { 480, 600 } */ pS->dHOC = .1379; /* { 0 - .25 } */ pS->dVOC = .1358; /* { 0 - .25 } */ pS->dVSR = 0; pS->dTLI = 0; pS->dVLINESI = 0; pS->dHCLKO = 0; pS->dHCLKI = 0; pS->dTPI = 0; pS->dHFRACT = 0; pS->dMFP = 0; pS->dMBP = 0; pS->dVACTIVEO = 0; pS->dVBLANKI = 0; pS->dPLLINT = 0; pS->dPLLFRACT = 0; pS->dPLLRATIO = 0; pS->dSINX = 0; pS->dV100 = 0; pS->dSYNCAMP = 0; pS->dBSTAMP = 0; pS->dMY = 0; pS->dMCR = 0; pS->dMCB = 0; pS->dVSCALE = 0; pS->ucPHASEOFF = 0; pS->ucLUMADLY = 0; pS->ucOUTMODE = 0; pS->ucAutoConfigMode = 0; pS->ucTVOutMode = 0; pS->ucPixelInputMode = BT868_PIXEL_INPUT_MODE_24BIT_RGB_MUX; pS->ucCLPF = 0; pS->ucYLPF = 3; pS->ucFSELY = 3; pS->ucFSELC = 3; pS->ucYCORING = 0; pS->ucCCORING = 0; pS->ucYATTENUATE = 0; pS->ucCATTENUATE = 0; pS->ucDIS_YFLPF = 0; pS->ucDIS_GMSHY = 1; pS->ucDIS_GMUSHY = 1; pS->ucDIS_GMSHC = 1; pS->ucDIS_GMUSHC = 1; pS->ucOUTMUXA = 0; pS->ucOUTMUXB = 2; pS->ucOUTMUXC = 1; pS->ucOUTMUXD = 0; pS->dwRegisterFlags = BT868_REGISTER_FLAGS_ENOUT | BT868_REGISTER_FLAGS_ENBLANKO | BT868_REGISTER_FLAGS_VSYNCDUR | BT868_REGISTER_FLAGS_SETUP; pS->dwImplementationFlags = BT868_IMPLEMENTATION_FLAGS_DISCONFREE; pS->dwInOutScanFlags = BT868_INOUTSCAN_FLAGS_OUT_INTERLACED; pS->dwFilterFlags = 0; } void Bt868SetAutoConfigMode (PENCODER_SETTINGS pS, int ucMode) { pS->ucAutoConfigMode = ucMode; pS->dwInOutScanFlags |= BT868_INOUTSCAN_FLAGS_OUT_INTERLACED; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_VBLANKDLY; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_ENXCLK; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_BYPLL; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_ECLIP; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_SCRESET; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_NIOUT; pS->ucCLPF = 3; pS->ucCLPF = 0; if( ( ucMode == 0 ) || ( ucMode == 2 ) || ( ucMode == 4 ) || ( ucMode == 6 ) ) { // NTSC pS->ucTVOutMode = 0; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_PAL; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_VSYNCDUR; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_625LINE; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_SETUP; if( ( ucMode == 0 ) || ( ucMode == 4 ) ) { // 640x480 pS->dHACTIVEI = 640; pS->dVACTIVEI = 480; pS->dHOC = .1379; pS->dVOC = .1358; } else { // 800x600 pS->dHACTIVEI = 800; pS->dVACTIVEI = 600; pS->dHOC = .2162; pS->dVOC = .1152; } } else { // PAL pS->ucTVOutMode = 2; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_PAL; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_VSYNCDUR; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_625LINE; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_SETUP; if( ( ucMode == 1 ) || ( ucMode == 5 ) ) { // 640x480 pS->dHACTIVEI = 640; pS->dVACTIVEI = 480; pS->dHOC = .1656; pS->dVOC = .1667; } else { // 800x600 pS->dHACTIVEI = 800; pS->dVACTIVEI = 600; pS->dHOC = .1453; pS->dVOC = .1319; } } } static void recalc_outfield (PENCODER_SETTINGS pS) { if( ( pS->ucTVOutMode == 0 ) || ( pS->ucTVOutMode == 1 ) || ( pS->ucTVOutMode == 5 ) /* PAL_M */ || ( pS->ucTVOutMode == 6 ) || ( pS->ucTVOutMode == 7 ) ) { pS->dALO = 243; pS->dATO = .00005265556; pS->dTTO = .00006355556; if( pS->dwInOutScanFlags & BT868_INOUTSCAN_FLAGS_OUT_INTERLACED ) { pS->dTLO = 262.5; } else { pS->dTLO = 262; } } else { pS->dALO = 288; pS->dATO = .000052; pS->dTTO = .000064; if( pS->dwInOutScanFlags & BT868_INOUTSCAN_FLAGS_OUT_INTERLACED ) { pS->dTLO = 312.5; } else { pS->dTLO = 312; } } } static void recalc_tvformat (PENCODER_SETTINGS pS) { double dACTIVEBEGIN = 0; double dIMAGECENTER = 0; double dHSYNCFREQ = 0; double dBURSTSTART = 0; double dBURSTEND = 0; switch( pS->ucTVOutMode ) { case 0: /* NTSC */ pS->dFSC = 3579545; dBURSTSTART = .0000053; dBURSTEND = .00000782; dHSYNCFREQ = .000063555; dACTIVEBEGIN = .0000094; dIMAGECENTER = .000035667; break; case 1: /* NTSC-50 Hz */ pS->dFSC = 3579545; dBURSTSTART = .0000053; dBURSTEND = .00000782; dHSYNCFREQ = .000064; dACTIVEBEGIN = .0000094; dIMAGECENTER = .000035667; break; case 2: /* PAL-BDGHI */ pS->dFSC = 4433618.75; dBURSTSTART = .0000056; dBURSTEND = .00000785; dHSYNCFREQ = .000064; dACTIVEBEGIN = .0000105; dIMAGECENTER = .000036407; break; case 3: /* PAL-N */ pS->dFSC = 4433618.75; dBURSTSTART = .0000056; dBURSTEND = .00000785; dHSYNCFREQ = .000064; dACTIVEBEGIN = .0000094; dIMAGECENTER = .000035667; break; case 4: /* PAL-Nc */ pS->dFSC = 3582056.25; dBURSTSTART = .0000056; dBURSTEND = .00000811; dHSYNCFREQ = .000064; dACTIVEBEGIN = .0000105; dIMAGECENTER = .000036407; break; case 5: /* PAL-M */ pS->dFSC = 3575611.88; dBURSTSTART = .0000058; dBURSTEND = .00000832; dHSYNCFREQ = .000063555; dACTIVEBEGIN = .0000094; dIMAGECENTER = .000035667; break; case 6: /* PAL-M60 */ pS->dFSC = 3575611.88; dBURSTSTART = .0000058; dBURSTEND = .00000832; dHSYNCFREQ = .000063555; dACTIVEBEGIN = .0000094; dIMAGECENTER = .000035667; break; case 7: /* PAL-60 */ pS->dFSC = 4433619.49; dBURSTSTART = .0000056; dBURSTEND = .00000785; dHSYNCFREQ = .000063555; dACTIVEBEGIN = .0000094; dIMAGECENTER = .000035667; break; } } static void recalc_prepare (PENCODER_SETTINGS pS) { pS->dVSR = pS->dVACTIVEI / ( pS->dALO * ( 1 - pS->dVOC ) ); if( pS->dwImplementationFlags & BT868_IMPLEMENTATION_FLAGS_DISCONFREE ) { pS->dVSR = (long)( ( pS->dVSR * pS->dTLO ) + 0.5 ) / pS->dTLO; } pS->dVSCALE = (long)( ( pS->dVSR - 1 ) * 4096 + 0.5 ); pS->dTLI = pS->dVSR * pS->dTLO; pS->dVLINESI = (long)pS->dTLI; pS->dHCLKO = ( 2 * ( ( pS->dHACTIVEI / ( 1.0 - pS->dHOC ) ) * ( pS->dTTO / pS->dATO ) ) ) + 0.5; pS->dTPI = ( ( pS->dHCLKO * pS->dCLKRATIO / pS->dVSR ) * 256 + 0.5 ) / 256.0; pS->dHFRACT = (long)( ( pS->dTPI - (long)pS->dTPI ) * 256 ); pS->dHCLKI = (long)pS->dTPI; pS->dMFP = max( 14.0, pS->dMinFrontPorchBC ); pS->dMBP = max( 4.0, pS->dMinBackPorchBC ); #if 0 if( pS->dTPI < ( pS->dHACTIVEI + pS->dMFP + pS->dMBP ) ) { // error DebugOut( "error: dTPI < ( dHACTIVEI + dMFP + dMBP )\n" ); return; } #endif pS->dVACTIVEO = ( ( pS->dVACTIVEI + 3 ) / pS->dVSR ) + 1; } static void recalc_find_oc (PENCODER_SETTINGS pS, double dMinHOC, double dMaxHOC, double dMinVOC, double dMaxVOC, RecalcFindRes callback) { double dBestVOC = 0; double dTempVOC = 0; double dBestHOC = 0; double dTempHOC = 0; double dMinTLI = 0; double dMaxTLI = 0; double dTempTLI = 0; double dBestTLI = 0; double dMinHCLKO = 0; double dMaxHCLKO = 0; double dBestHCLKO = 0; double dBestMetric = 1000; double dTempVSR = 0; double dBestVSR = 0; double dMinTPI = 0; double dTempTPI = 0; double dBestTPI = 0; double dTempCLKRATIO = 1; /* NEW */ double dBestCLKRATIO = 1; /* NEW */ int actCLKRATIO; int maxCLKRATIO; double dTempHCLKO = 0; double dTempVACTIVEO = 0; double dTempTCCI = 0; double dDelta = 0; double dMetric = 0; double dAspect = 0; double dMinHBT = 0; if (dMinHOC < 0) dMinHOC = 0; if (dMinVOC < 0) dMinVOC = 0; dMinTLI= (long)(pS->dVACTIVEI / ((1 - dMinVOC) * pS->dALO) * pS->dTLO); dMaxTLI = (long)(pS->dVACTIVEI / ((1 - dMaxVOC) * pS->dALO) * pS->dTLO); dMinHCLKO = (long) ((pS->dHACTIVEI * 2) / ((1 - dMinHOC) * (pS->dATO / pS->dTTO))); dMaxHCLKO = (long) ((pS->dHACTIVEI * 2) / ((1 - dMaxHOC) * (pS->dATO / pS->dTTO))); maxCLKRATIO = 0; if (pS->dwImplementationFlags & BT_IMPLEMENTATION_FLAGS_CONEXANT) { maxCLKRATIO = 1; } for (actCLKRATIO = 0; actCLKRATIO <= maxCLKRATIO; actCLKRATIO++) { dTempCLKRATIO = 1.0; if (actCLKRATIO) dTempCLKRATIO = 3.0/2.0; for(dTempTLI = dMinTLI; dTempTLI <= dMaxTLI; dTempTLI++) { dTempVSR = dTempTLI / pS->dTLO; dTempVACTIVEO = (long)(((pS->dVACTIVEI * pS->dTLO) + (dTempTLI - 1)) / dTempTLI); dTempVOC = 1 - dTempVACTIVEO / pS->dALO; dMinTPI = pS->dHACTIVEI / (1 - (dMinHBT / (pS->dTTO * dTempVSR))); for(dTempHCLKO = dMinHCLKO; dTempHCLKO <= dMaxHCLKO; dTempHCLKO++) { dTempTPI = (dTempHCLKO * dTempCLKRATIO) * (pS->dTLO / dTempTLI); dTempTCCI = dTempTPI / pS->dCHARCLK; if((dTempTCCI == (long)dTempTCCI) && (dTempTPI >= dMinTPI)) { int flag; dTempHOC = 1 - ((pS->dHACTIVEI / (dTempHCLKO / 2)) / (pS->dATO / pS->dTTO)); dDelta = fabs(dTempHOC - pS->dHOC) + fabs(dTempVOC - pS->dVOC); dMetric = ((dTempHOC - pS->dHOC) * (dTempHOC - pS->dHOC)) + ((dTempVOC - pS->dVOC) * (dTempVOC - pS->dVOC)) + (2 * dDelta * dDelta); dAspect = (1.0 - dTempHOC) / (1.0 - dTempVOC); flag = 0; if (((int) dTempTPI) % 8 == 0) flag |= BT_CALC_CHARCLK8; if (((int) dTempTPI) % 9 == 0) flag |= BT_CALC_CHARCLK9; if (actCLKRATIO) flag |= BT_CALC_RATIO32; if (callback) callback (dTempHOC, dTempVOC, dMetric, dAspect, flag); if(dMetric < dBestMetric) { dBestMetric = dMetric; dBestHOC = dTempHOC; dBestVOC = dTempVOC; dBestVSR = dTempVSR; dBestTLI = dTempTLI; dBestTPI = dTempTPI; dBestHCLKO = dTempHCLKO; dBestCLKRATIO = dTempCLKRATIO; } } /* valid solution */ } /* dTempHCLKO loop */ } /* dTempTLI loop */ } /* CLKRATIO loop */ if(dBestMetric == 1000) { // error #if 0 DebugOut("error: dBestMetric == 1000"); #endif return; } pS->dVSR = dBestVSR; pS->dVSCALE = (long)((dBestVSR - 1) * 4096 + 0.5); pS->dVLINESI = (long)dBestTLI; pS->dHCLKO = (long)dBestHCLKO; pS->dHFRACT = 0; pS->dHCLKI = (long)dBestTPI; pS->dVACTIVEO = (long)((pS->dVACTIVEI + 3) / dBestVSR) + 1; pS->dHOC = dBestHOC; pS->dVOC = dBestVOC; pS->dCLKRATIO = dBestCLKRATIO; } void Bt868ReCalc(PENCODER_SETTINGS pS) { double dPI = 3.141593; double dTotalHBlankO = 0; double dTotalHBlankI = 0; double dHeadRoom = 0; double dMaxHR = 0; double dFifoMargin = 0; double dFifoSize; dFifoSize = 800; if (pS->dwImplementationFlags & BT_IMPLEMENTATION_FLAGS_CONEXANT) { dFifoSize = 1024; } recalc_outfield (pS); recalc_tvformat (pS); /* on pS->ucTVOutMode */ recalc_prepare (pS); /* FIXME: shouldn't have to do full prepare ... */ recalc_find_oc (pS, pS->dHOC - .05, pS->dHOC + .05, pS->dVOC - .05, pS->dVOC + .05, NULL); if( pS->dwImplementationFlags & BT868_IMPLEMENTATION_FLAGS_CCIR601) { pS->dHCLKO = 1716; pS->dHCLKI = pS->dHCLKO / 2; pS->dVACTIVEO = 240; pS->dHBLANKI = 10; pS->dHACTIVEI = 720; pS->dVLINESI = 262; pS->dVBLANKI = 19; pS->dVACTIVEI = 240; pS->dVSCALE = 0; pS->ucPixelInputMode = BT868_PIXEL_INPUT_MODE_16BIT_YCRCB_MUX; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_VBLANKDLY; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_ENXCLK; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_ENDOT; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_SLAVE; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_ENOUT; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_ENBLANKO; pS->dwFilterFlags |= BT868_FILTER_FLAGS_DISFFILT; pS->dHOC = 0; pS->dVOC = 0; pS->dwInOutScanFlags &= ~BT868_INOUTSCAN_FLAGS_IN_INTERLACED; } /* Calculate parameters relative to HCLKO, i.e. numbers represent fractions of a whole line. The HXTAL constant is F_sc / F_line, i.e. HXTAL = F_xtal / F_line. */ switch( pS->ucTVOutMode ) { case 0: /* NTSC */ case 1: /* NTSC-50 ?? */ pS->dVBLANKO = (long)( 140 - ( pS->dVACTIVEO / 2.0 ) + 0.5 ); pS->dHBURSTBEGIN = 2 * (long)( ( 0.0416958041958 * pS->dHCLKO ) + 0.5 ); pS->dHBURSTEND = 2 * (long)( ( 0.06270104895105 * pS->dHCLKO ) + 0.5) - 128; pS->dHSYNCWIDTH = 2 * (long)( ( 0.03697552447552 * pS->dHCLKO ) + 0.5 ); pS->dHBLANKO = 2 * (long)( ( 0.280597027972 * pS->dHCLKO ) + 0.5 ) - (long)( pS->dHACTIVEI ) + 15; pS->dMSC = (long)( 0x80000000 * ( 455.0 / pS->dHCLKO ) + 0.5 ) + pS->dPHZINC; pS->dHXTAL = ( pS->dFXTAL * 227.5 ) / pS->dFSC; break; case 3: /* PAL-N */ pS->dVBLANKO = (long)( 167 - ( pS->dVACTIVEO / 2.0 ) + 0.5 ); pS->dHBURSTBEGIN = (long)( ( 0.0875 * pS->dHCLKO ) + 0.5 ); pS->dHBURSTEND = (long)( ( 0.12265625 * pS->dHCLKO ) + 0.5 ) - 128; pS->dHSYNCWIDTH = (long)( ( 0.0734375 * pS->dHCLKO ) + 0.5 ); pS->dHBLANKO = 2 * (long)( ( 0.2786484375 * pS->dHCLKO ) + 0.5 ) - (long)( pS->dHACTIVEI ) + 15; pS->dMSC = (long)( ( ( 567.5032 / pS->dHCLKO ) * 0x80000000 ) + 0.5 ) + pS->dPHZINC; pS->dHXTAL = ( pS->dFXTAL * 283.7516 ) / pS->dFSC; break; case 4: /* PAL-Nc */ pS->dVBLANKO = (long)( 167 - ( pS->dVACTIVEO / 2.0 ) + 0.5 ); pS->dHBURSTBEGIN = 2 * (long)( ( 0.04375 * pS->dHCLKO ) + 0.5 ); pS->dHBURSTEND = 2 * (long)( ( 0.063359375 * pS->dHCLKO ) + 0.5 ) - 128; pS->dHSYNCWIDTH = 2 * (long)( ( 0.03671875 * pS->dHCLKO ) + 0.5 ); pS->dHBLANKO = 2 * (long)( ( 0.2844296875 * pS->dHCLKO ) + 0.5 ) - (long)( pS->dHACTIVEI ) + 15; pS->dMSC = (long)( ( ( 458.5032 / pS->dHCLKO ) * 0x80000000 ) + 0.5 ) + pS->dPHZINC; pS->dHXTAL = ( pS->dFXTAL * 229.2516 ) / pS->dFSC; break; case 5: /* PAL-M */ pS->dVBLANKO = (long)( 140 - ( pS->dVACTIVEO / 2.0 ) + 0.5); pS->dHBURSTBEGIN = (long)( ( 0.09125874125874 * pS->dHCLKO ) + 0.5 ); pS->dHBURSTEND = 2 * (long)( ( 0.06545454545455 * pS->dHCLKO ) + 0.5 ) - 128; pS->dHSYNCWIDTH = 2 * (long)( ( 0.03697552447552 * pS->dHCLKO ) + 0.5 ); pS->dHBLANKO = (long)( ( 0.5611940559441 * pS->dHCLKO ) + 0.5 ) - (long)( pS->dHACTIVEI ) + 15; pS->dMSC = (long)( 0x80000000 * ( 454.5 / pS->dHCLKO ) + 0.5 ) + pS->dPHZINC; pS->dHXTAL = ( pS->dFXTAL * 227.25 ) / pS->dFSC; break; case 7: /* PAL-60 ? */ pS->dVBLANKO = (long)( 140 - ( pS->dVACTIVEO / 2.0 ) + 0.5 ); pS->dHBURSTBEGIN = 2 * (long)( 151.2 * ( pS->dHCLKO / 3432 ) + 0.5 ); pS->dHBURSTEND = 2 * (long)( ( 211.95 * ( pS->dHCLKO / 3432 ) ) + 0.5 ) - 128; pS->dHSYNCWIDTH = 2 * (long)( 126.9 * ( pS->dHCLKO / 3432 ) + 0.5 ); pS->dHBLANKO = 2 * (long)( ( .280597027972 * pS->dHCLKO ) + 0.5 ) - (long)( pS->dHACTIVEI ) + 15; pS->dMSC = (long)( 4294967296.0 * ( ( 2216809375.0 / 7867132.0 ) / pS->dHCLKO ) + 0.5) + pS->dPHZINC; //pS->dMSC = (long)( 0x80000000 * ( 563.5622676726 / pS->dHCLKO ) + 0.5) + pS->dPHZINC; //pS->dHXTAL = ( pS->dFXTAL * 281.7811338363 ) / pS->dFSC; pS->dHXTAL = ( pS->dFXTAL * ( 2216809375.0 / 7867132.0 ) ) / ( pS->dFSC ); break; default: /* PAL-BDGHI, PAL-M60 ? */ // 625-line Systems pS->dVBLANKO = (long)( 167 - ( pS->dVACTIVEO / 2.0 ) + 0.5 ); pS->dHBURSTBEGIN = 2 * (long)( ( 0.04375 * pS->dHCLKO ) + 0.5 ); pS->dHBURSTEND = 2 * (long)( ( 0.061328125 * pS->dHCLKO ) + 0.5 ) - 128; pS->dHSYNCWIDTH = 2 * (long)( ( 0.03671875 * pS->dHCLKO ) + 0.5 ); pS->dHBLANKO = 2 * (long)( ( 0.2844296875 * pS->dHCLKO ) + 0.5 ) - (long)( pS->dHACTIVEI ) + 15; pS->dMSC = (long)( ( 567.5032 / pS->dHCLKO ) * 0x80000000 + 0.5 ) + pS->dPHZINC; pS->dHXTAL = ( pS->dFXTAL * 283.7516 ) / pS->dFSC; } // Vertical input blanking pS->dVSRQ = ( (long)( pS->dVSR * 4096.0 + .5 ) ) / 4096.0; if( pS->dVSRQ < pS->dVSR ) { // These calculations are in units of dHCLKO pS->dMaxHsyncDrift = ( pS->dVSRQ - pS->dVSR ) * pS->dTLO / pS->dVSR * pS->dHCLKO; pS->dMinFrontPorchIn = pS->dMFP / ( pS->dHCLKI * pS->dVSR ) * pS->dHCLKO; pS->dFrontPorchOut = pS->dHCLKO - pS->dHBLANKO - pS->dHACTIVEI * 2; dFifoMargin = ( dFifoSize - pS->dHACTIVEI ) * 2; // Check for fifo overflow if( pS->dFrontPorchOut + dFifoMargin < -pS->dMaxHsyncDrift + pS->dMinFrontPorchIn ) { dTotalHBlankO = pS->dHCLKO - pS->dHACTIVEI * 2; dTotalHBlankI = ( pS->dHCLKI - pS->dHACTIVEI ) / pS->dHCLKI / pS->dVSR * pS->dHCLKO; // Try forcing the Hsync drift the opposite direction pS->dMaxHsyncDrift = ( pS->dVSRQ + 1.0 / 4096 - pS->dVSR ) * pS->dTLO / pS->dVSR * pS->dHCLKO; // Check that fifo overflow and underflow can be avoided if( dTotalHBlankO + dFifoMargin >= dTotalHBlankI + pS->dMaxHsyncDrift ) { pS->dVSRQ = pS->dVSRQ + 1.0 / 4096; pS->dVSCALE = (long)( ( pS->dVSRQ - 1 ) * 4096 ); } // NOTE: If fifo overflow and underflow can't be avoided, // alternative overscan compensation ratios should // be selected and all calculations repeated. If // that is not feasible, the calculations for // H_BLANKI below will delay the overflow or under- // flow as much as possible, to minimize the visible // artifacts. } } pS->dVBLANKI = (long)( ( pS->dVBLANKO - 1 ) * pS->dVSRQ ); if( pS->dwImplementationFlags & BT868_IMPLEMENTATION_FLAGS_CCIR601 ) { pS->dVSCALE = 0; pS->dVBLANKI = 19; } // Horizontal input blanking // These calculations are in units of dHCLKI dTotalHBlankI = pS->dHCLKI - pS->dHACTIVEI; pS->dFrontPorchIn = max( pS->dMFP, min( dTotalHBlankI / 8.0, dTotalHBlankI - pS->dMBP ) ); pS->dBackPorchIn = dTotalHBlankI - pS->dFrontPorchIn; pS->dMaxHsyncDrift = ( pS->dVSRQ - pS->dVSR ) * pS->dTLO * pS->dHCLKI; dTotalHBlankO = ( pS->dHCLKO - pS->dHACTIVEI * 2.0 ) / pS->dHCLKO * pS->dVSR * pS->dHCLKI; pS->dBackPorchOut = pS->dHBLANKO / pS->dHCLKO * pS->dVSR * pS->dHCLKI; pS->dFrontPorchOut = dTotalHBlankO - pS->dBackPorchOut; dFifoMargin = ( dFifoSize - pS->dHACTIVEI ) * 2.0 / pS->dHCLKO * pS->dVSR * pS->dHCLKI; // This may be excessive, but is adjusted by the code. dHeadRoom = 32.0; // Check that fifo overflow and underflow can be avoided if( ( dTotalHBlankO + dFifoMargin ) >= ( dTotalHBlankI + abs( pS->dMaxHsyncDrift ) ) ) { dMaxHR = ( dTotalHBlankO + dFifoMargin ) - ( dTotalHBlankI - abs( pS->dMaxHsyncDrift ) ); if( dMaxHR < ( dHeadRoom * 2.0 ) ) { dHeadRoom = (long)( dMaxHR / 2.0); } // Check for overflow if( ( ( pS->dFrontPorchOut + dFifoMargin ) - dHeadRoom ) < ( pS->dFrontPorchIn - min( pS->dMaxHsyncDrift, 0 ) ) ) { pS->dFrontPorchIn = max( pS->dMFP, ( pS->dFrontPorchOut + dFifoMargin + min( pS->dMaxHsyncDrift, 0 ) - dHeadRoom ) ); pS->dBackPorchIn = dTotalHBlankI - pS->dFrontPorchIn; } // Check for underflow if( pS->dBackPorchOut - dHeadRoom < pS->dBackPorchIn + max( pS->dMaxHsyncDrift, 0 ) ) { pS->dBackPorchIn = max( pS->dMBP, ( pS->dBackPorchOut - max( pS->dMaxHsyncDrift, 0 ) - dHeadRoom ) ); pS->dFrontPorchIn = dTotalHBlankI - pS->dBackPorchIn; } } else if( pS->dMaxHsyncDrift < 0 ) { // Delay the overflow as long as possible pS->dBackPorchIn = min( ( pS->dBackPorchOut - 1 ), ( dTotalHBlankI - pS->dMFP ) ); pS->dFrontPorchIn = dTotalHBlankI - pS->dBackPorchIn; } else { // Delay the underflow as long as possible pS->dFrontPorchIn = min( ( pS->dFrontPorchOut + dFifoMargin - 1 ), ( dTotalHBlankI - pS->dMBP ) ); pS->dBackPorchIn = dTotalHBlankI - pS->dFrontPorchIn; } pS->dHBLANKI = (long)( pS->dBackPorchIn ); if( pS->dwImplementationFlags & BT868_IMPLEMENTATION_FLAGS_CCIR601 ) { pS->dHBLANKI = 10; } pS->dPLLRATIO = (long)(6.0 * (pS->dHCLKO / pS->dHXTAL) * pS->dCLKRATIO * 0x10000 + 0.5); if( pS->dwImplementationFlags & BT868_IMPLEMENTATION_FLAGS_DOUBLEPLL ) { // Double PLL frequency pS->dPLLRATIO *= 2; } pS->dFCLK = ( pS->dFXTAL * pS->dPLLRATIO / 6.0 ) / 0x10000; pS->dPLLINT = (long)( pS->dPLLRATIO / 0x10000 ); pS->dPLLFRACT = (long)( pS->dPLLRATIO - pS->dPLLINT * 0x10000 ); pS->dSINX = sin( dPI * pS->dFSC / pS->dFCLK ) / ( dPI * pS->dFSC / pS->dFCLK ); if( pS->dwRegisterFlags & BT868_REGISTER_FLAGS_MODE2X ) { // Internal clock divided by 2 pS->dSINX = sin( dPI * pS->dFSC / ( pS->dFCLK / 2 ) ) / ( dPI * pS->dFSC / ( pS->dFCLK / 2 ) ); } if( ( pS->ucTVOutMode == 0 ) || ( pS->ucTVOutMode == 1 ) ) { pS->dV100 = 676.203; pS->dSYNCAMP = 229; pS->dBSTAMP = (long)( ( 114.5 / pS->dSINX ) + 0.5 ); } else { pS->dV100 = 716.1; pS->dSYNCAMP = 240; pS->dBSTAMP = (long)( ( 84.84 / pS->dSINX ) + 0.5 ); } if (pS->ucPixelInputMode <= 3) { // RBG modes pS->dMY = (long)( ( pS->dV100 / 5.099501953125 ) + 0.5 ); pS->dMCR = (long)( ( pS->dV100 / ( 5.746659386525 * pS->dSINX ) ) + 0.5 ); pS->dMCB = (long)( ( pS->dV100 / ( 10.22275919266 * pS->dSINX ) ) + 0.5 ); } else { // YCRCB modes pS->dMY = (long)( ( pS->dV100 / 4.379572265625 ) + 0.5 ); pS->dMCR = (long)( ( pS->dV100 * ( 0.2767455917354 / pS->dSINX ) ) + 0.5 ); pS->dMCB = (long)( ( pS->dV100 * ( 0.1966701565097 / pS->dSINX ) ) + 0.5 ); if( pS->dwRegisterFlags & BT868_REGISTER_FLAGS_ECBAR ) { // makes correction for ROM values pS->dMCR /= 2; pS->dMCB /= 2; } } } void recalc_system (TVSystem system, PENCODER_SETTINGS pS, TVBtRegs *b) { pS->dwInOutScanFlags |= BT868_INOUTSCAN_FLAGS_OUT_INTERLACED; pS->ucCLPF = 3; pS->ucCLPF = 0; switch (system) { case TV_SYSTEM_NTSC: pS->ucTVOutMode = 0; /* NTSC */ pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_VSYNCDUR; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_625LINE; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_SETUP; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_PAL; if (b) b->flags1 = BT_FLAG1_NTSC; break; case TV_SYSTEM_NTSC_J: pS->ucTVOutMode = 0; /* NTSC */ pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_VSYNCDUR; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_625LINE; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_SETUP; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_PAL; if (b) b->flags1 = BT_FLAG1_NTSC_J; break; case TV_SYSTEM_PAL: pS->ucTVOutMode = 2; /* PAL-BDGHI */ pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_VSYNCDUR; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_625LINE; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_SETUP; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_PAL; if (b) b->flags1 = BT_FLAG1_PAL_BDGHI; break; case TV_SYSTEM_PAL_N: pS->ucTVOutMode = 3; /* PAL-N */ pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_VSYNCDUR; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_625LINE; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_SETUP; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_PAL; if (b) b->flags1 = BT_FLAG1_PAL_N; break; case TV_SYSTEM_PAL_NC: pS->ucTVOutMode = 4; /* PAL-Nc */ pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_VSYNCDUR; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_625LINE; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_SETUP; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_PAL; if (b) b->flags1 = BT_FLAG1_PAL_BDGHI; break; case TV_SYSTEM_PAL_M: pS->ucTVOutMode = 5; /* PAL-M */ pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_VSYNCDUR; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_625LINE; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_SETUP; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_PAL; if (b) b->flags1 = BT_FLAG1_PAL_M; break; case TV_SYSTEM_PAL_60: pS->ucTVOutMode = 7; /* PAL-60 */ pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_VSYNCDUR; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_625LINE; pS->dwRegisterFlags &= ~BT868_REGISTER_FLAGS_SETUP; pS->dwRegisterFlags |= BT868_REGISTER_FLAGS_PAL; if (b) b->flags1 = BT_FLAG1_PAL_60; break; case TV_SYSTEM_PAL_M60: pS->ucTVOutMode = 6; /* PAL-60 */ /* Not documented ... */ break; default: break; } } void recalc_find (TVSystem system, int hres, int vres, double hoc_min, double hoc_max, double voc_min, double voc_max, RecalcFindRes callback, int flags) { struct settings s; Bt868EncoderInitializeDefault (&s); s.dwImplementationFlags |= flags; recalc_system (system, &s, NULL); s.dHOC = (hoc_min + hoc_max) / 2.0; /* FIXME */ s.dVOC = (voc_min + voc_max) / 2.0; s.dHACTIVEI = hres & ~0x7; s.dVACTIVEI = vres; recalc_outfield (&s); recalc_tvformat (&s); /* on s.ucTVOutMode */ recalc_prepare (&s); /* FIXME: shouldn't have to do full prepare ... */ recalc_find_oc (&s, hoc_min, hoc_max, voc_min, voc_max, callback); } void recalc_bt_find (TVSystem system, int hres, int vres, double hoc_min, double hoc_max, double voc_min, double voc_max, RecalcFindRes callback) { recalc_find (system, hres, vres, hoc_min, hoc_max, voc_min, voc_max, callback, 0); } void recalc_cx_find (TVSystem system, int hres, int vres, double hoc_min, double hoc_max, double voc_min, double voc_max, RecalcFindRes callback) { recalc_find (system, hres, vres, hoc_min, hoc_max, voc_min, voc_max, callback, BT_IMPLEMENTATION_FLAGS_CONEXANT); } void calc_nv_btcx (int hres, int vres, TVRegs *r) { /* This is just in approximation, and by no means accurate. */ r->crtc.nv.HDisplay = hres; r->crtc.nv.HTotal = r->enc.bt.h_clki & ~0x7; /* Some attempts to get good sync values: */ /* r->crtc.nv.HSyncStart = (r->crtc.nv.HTotal + r->crtc.nv.HDisplay) / 2 + 8; */ r->crtc.nv.HSyncStart = ((r->crtc.nv.HTotal - r->enc.bt.h_blanki) & ~0x7) + 48; /* 48 seems to work in many PAL cases, but it may be completely wrong. */ /* Now try to sanitize at least the worst cases */ if (r->crtc.nv.HSyncStart <= r->crtc.nv.HDisplay) r->crtc.nv.HSyncStart = r->crtc.nv.HDisplay + 8; if (r->crtc.nv.HSyncStart >= r->crtc.nv.HTotal) r->crtc.nv.HSyncStart = r->crtc.nv.HDisplay + 8; r->crtc.nv.HSyncEnd = r->crtc.nv.HSyncStart + 24; /* wild guess */ if (r->crtc.nv.HSyncEnd >= r->crtc.nv.HTotal) r->crtc.nv.HSyncStart = r->crtc.nv.HTotal; r->crtc.nv.VDisplay = vres; r->crtc.nv.VTotal = r->enc.bt.v_linesi; /* Some attempts to get good sync values: */ /* r->crtc.nv.VSyncStart = (r->crtc.nv.VTotal + r->crtc.nv.VDisplay) / 2 + 2; */ r->crtc.nv.VSyncStart = r->crtc.nv.VTotal - r->enc.bt.v_blanki; if (r->crtc.nv.VSyncStart <= r->crtc.nv.VDisplay) r->crtc.nv.VSyncStart = r->crtc.nv.VDisplay + 8; r->crtc.nv.VSyncEnd = r->crtc.nv.VSyncStart + 2; r->crtc.nv.flags = 0; r->devFlags = DEV_TELEVISION | DEV_MONITOR; } void recalc_bt_copy (PENCODER_SETTINGS s, TVBtRegs *r) { r->hsynoffset = (int) s->dHSYNOFFSET; r->vsynoffset = (int) s->dVSYNOFFSET; r->hsynwidth = (int) s->dHSYNWIDTH; r->vsynwidth = (int) s->dVSYNWIDTH; r->h_clko = (int) s->dHCLKO; r->h_active = (int) s->dHACTIVEI; r->hsync_width = (int) s->dHSYNCWIDTH; r->hburst_begin = (int) s->dHBURSTBEGIN; r->hburst_end = (int) s->dHBURSTEND; r->h_blanko = (int) s->dHBLANKO; r->v_blanko = (int) s->dVBLANKO; r->v_activeo = (int) s->dVACTIVEO; r->h_fract = (int) s->dHFRACT; r->h_clki = (int) s->dHCLKI; r->h_blanki = (int) s->dHBLANKI; r->v_linesi = (int) s->dVLINESI; r->v_blanki = (int) s->dVBLANKI; r->v_activei = (int) s->dVACTIVEI; r->v_scale = (int) s->dVSCALE; r->pll_fract = (int) s->dPLLFRACT; r->pll_int = (int) s->dPLLINT; r->sync_amp = (int) s->dSYNCAMP; r->bst_amp = (int) s->dBSTAMP; r->mcr = (int) s->dMCR; r->mcb = (int) s->dMCB; r->my = (int) s->dMY; r->msc = (long) s->dMSC; } void recalc_bt_custom (TVSystem system, int hres, int vres, double hoc, double voc, TVRegs *r) { struct settings s; Bt868EncoderInitializeDefault (&s); recalc_system (system, &s, &r->enc.bt); s.dHOC = hoc; s.dVOC = voc; s.dHACTIVEI = hres & ~0x7; s.dVACTIVEI = vres; Bt868ReCalc (&s); recalc_bt_copy (&s, &r->enc.bt); } void recalc_cx_custom (TVSystem system, int hres, int vres, double hoc, double voc, TVRegs *r) { struct settings s; Bt868EncoderInitializeDefault (&s); s.dwImplementationFlags |= BT_IMPLEMENTATION_FLAGS_CONEXANT; recalc_system (system, &s, &r->enc.cx.bt); s.dHOC = hoc; s.dVOC = voc; s.dHACTIVEI = hres & ~0x7; s.dVACTIVEI = vres; Bt868ReCalc (&s); recalc_bt_copy (&s, &r->enc.cx.bt); r->enc.bt.flags1 |= CX_FLAG1_EXT; r->enc.cx.wsdat = 0; if (s.dCLKRATIO != 1.0) r->enc.cx.flags5 |= CX_FLAG5_PLL_32CLK; /* Remaining init will be done in data_init_cx */ } /* Mode Total 872 +185 1000 34.5 MHz 815 +43 Large 840 +209 1000 33.25 MHz 791 +49 Large 832 +217 " " Small800 816 +153 960 36 MHz 807 +9 Small800 784 +185 " Small768 816 +241 1000 34 MHz 759 +57 816 +241 1000 32.75 MHz */ nvtv-0.4.7/src/back_direct.c0000644000175000001440000001707510023540453011367 /* NVTV direct backend -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_direct.c,v 1.32 2004/03/10 07:18:03 dthierbach Exp $ * * Contents: * * Backend for direct access of the card (common part for Linux and MS-Windows) * */ #include "local.h" /* before everything else */ #include #include "backend.h" #include "back_direct.h" #include "back_nvidia.h" #include "back_tdfx.h" #include "back_i810.h" #ifdef DEBUG_PROBE #include "tv_i2c.h" #include "tv_common.h" #endif /* -------- Generic find routines -------- */ /* * List all modes (by system) */ int bdir_listModes (CardType card, DataFunc *data, TVSystem system, TVMode *(list[])) { if (!data) return FALSE; return data_listModes (data->modes (), system, list); } /* * Find mode by size (and resolution). */ Bool bdir_findBySize (CardType card, DataFunc *data, TVSystem system, int xres, int yres, char *size, TVMode *mode) { TVMode *tvm; if (!data) return FALSE; tvm = data_find (data->modes (), system, xres, yres, size); if (!tvm) return FALSE; *mode = *tvm; return TRUE; } /* * Find mode by overscan (and resolution) */ Bool bdir_findByOverscan (CardType card, DataFunc *data, TVSystem system, int xres, int yres, double hoc, double voc, TVMode *mode) { TVMode *tvm; if (!data) return FALSE; tvm = data_findNearest (data->modes (), system, xres, yres, hoc, voc); if (!tvm) return FALSE; *mode = *tvm; return TRUE; } /* -------- -------- */ /* * Open card. For now, just pass that on. */ void bdir_openCard (CardPtr card) { switch (card->type) { case CARD_NVIDIA: case CARD_XBOX: back_card = &bnv_func; break; case CARD_TDFX: back_card= &btdfx_func; break; case CARD_I810: back_card= &bi810_func; break; default: RAISE (MSG_ABORT, "Wrong card type in bdir_openCard."); exit (1); } back_card->openCard (card); } /* * Close card, For now, just pass that on. */ void bdir_closeCard (void) { if (back_card) back_card->closeCard (); back_card = NULL; } /* -------- Probe system -------- */ /* This is more or less a hack to get some information about the whole system in case something doesn't work. It should be eventually removed from the direct backend, but at the moment this is the logical place for it. */ #ifdef DEBUG_PROBE void bdir_probe_ch1 (I2CDevPtr dev) { I2CByte res; int i; for (i = 0x00; i <= 0x3F; i++) { if ((i & 0xf) == 0x0) printf (" %02X:", i); if ((i & 0xf) == 0x8) printf (" "); tvBusOk = TRUE; TVReadBus (dev, i, &res); if (!tvBusOk) printf (" --"); else printf (" %02X", res); if ((i & 0xf) == 0xf) printf ("\n"); } } #endif #ifdef DEBUG_PROBE void bdir_probe_ch2 (I2CDevPtr dev) { I2CByte res; int i; for (i = 0x00; i <= 0x7F; i++) { if ((i & 0xf) == 0x0) printf (" %02X:", i); if ((i & 0xf) == 0x8) printf (" "); tvBusOk = TRUE; TVReadBus (dev, i, &res); if (!tvBusOk) printf (" --"); else printf (" %02X", res); if ((i & 0xf) == 0xf) printf ("\n"); } } #endif #ifdef DEBUG_PROBE void bdir_probe_cx (I2CDevPtr dev) { I2CByte res; int i; tvBusOk = TRUE; TVWriteBus (dev, 0x6c, 0x46); /* enable reg rd */ for (i = 0x00; i <= 0xFF; i += 1) { if ((i & 0xf) == 0x0) printf (" %02X:", i); if ((i & 0xf) == 0x8) printf (" "); tvBusOk = TRUE; TVReadBus (dev, i, &res); if (!tvBusOk) printf (" --"); else printf (" %02X", res); if ((i & 0xf) == 0xf) printf ("\n"); } tvBusOk = TRUE; TVWriteBus (dev, 0x6c, 0x06); /* disable reg rd, for bt compatibility */ } #endif #ifdef DEBUG_PROBE void bdir_probe_ph (I2CDevPtr dev) { I2CByte res; I2CByte rgb[3]; int i; for (i = 0x00; i <= 0xFD; i += 1) { if ((i & 0xf) == 0x0) printf (" %02X:", i); if ((i & 0xf) == 0x8) printf (" "); tvBusOk = TRUE; TVReadBus (dev, i, &res); if (!tvBusOk) printf (" --"); else printf (" %02X", res); if ((i & 0xf) == 0xf) printf ("\n"); } printf ("\n"); tvBusOk = TRUE; TVWriteBus (dev, 0xfe, 0x00); /* Cursor bit map */ for (i = 0x00; i < 0x100; i += 1) { if ((i & 0xf) == 0x0) printf (" %02X:", i); if ((i & 0xf) == 0x8) printf (" "); tvBusOk = TRUE; TVStatusBus (dev, &res); if (!tvBusOk) printf (" --"); else printf (" %02X", res); if ((i & 0xf) == 0xf) printf ("\n"); } TVWriteBus (dev, 0xff, 0x00); /* RGB LUT */ for (i = 0x00; i < 0x100; i += 1) { if ((i & 0x7) == 0x0) printf (" %02X:", i); if ((i & 0x7) == 0x4) printf (" "); tvBusOk = TRUE; TVStatusSeqBus (dev, rgb, 3); if (!tvBusOk) printf (" -- -- --"); else printf (" %02X%02X%02X", rgb[0], rgb[1], rgb[2]); if ((i & 0x7) == 0x7) printf ("\n"); } } #endif #ifdef DEBUG_PROBE void bdir_probeSystem (CardPtr card_list) { CardPtr card; I2CChainPtr chain, root; printf ("NVTV " PACKAGE_VERSION " Probe\n"); for (card = card_list; card; card = card->next) { printf ("%s (%04X) io=0x%08lX\n", card->name, card->pci_id, card->reg_base); bdir_openCard (card); back_card->probeCard (); printf (" I2C Devices:"); root = back_card->probeBus (); for (chain = root; chain; chain = chain->next) { printf (" %1s:%02X", I2C_ID(chain->dev)); } printf ("\n\n"); for (chain = root; chain; chain = chain->next) { if (chain->type != TV_NO_CHIP) { printf (" Device %1s:%02X = %s\n", I2C_ID(chain->dev), chain->name); switch (chain->type & TV_ENCODER) { case TV_CHRONTEL_MODEL1: bdir_probe_ch1 (chain->dev); break; case TV_CHRONTEL_MODEL2: bdir_probe_ch2 (chain->dev); break; case TV_CONEXANT: bdir_probe_cx (chain->dev); break; case TV_PHILIPS_MODEL1: case TV_PHILIPS_MODEL2: bdir_probe_ph (chain->dev); break; default: break; } } } bdir_closeCard (); } } #endif BackAccessRec bdir_func = { openCard: bdir_openCard, closeCard: bdir_closeCard, #ifdef DEBUG_PROBE probeSystem: bdir_probeSystem, #endif }; /* -------- Helper -------- */ void bdir_freeChips (CardPtr card) { ChipPtr chip, del; chip = card->chips; while (chip) { del = chip; chip = chip->next; /* don't free name */ free (del); } card->chips = NULL; } ChipPtr bdir_copyChips (I2CChainPtr root) { ChipPtr chip, ins, first; I2CChainPtr chain; first = ins = NULL; for (chain = root; chain; chain = chain->next) { chip = (ChipPtr) xcalloc (1, sizeof(ChipInfo)); chip->private = chain; chip->next = NULL; chip->type = chain->type; chip->name = chain->name; if (chain->dev) { chip->bus = chain->dev->pI2CBus->BusName[2]; chip->addr = chain->dev->SlaveAddr; } else { chip->bus = -1; chip->addr = 0; } if (ins) { ins->next = chip; } else { first = chip; } ins = chip; } return first; } nvtv-0.4.7/src/back_nvidia.c0000644000175000001440000007217410020723072011365 /* NVTV nvidia backend -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_nvidia.c,v 1.45 2004/03/01 21:08:10 dthierbach Exp $ * * Contents: * * Backend for nvidia cards, direct access. * */ #include "local.h" /* before everything else */ #include #include #include "xfree.h" /* via back_direct.h */ #include "mmio.h" #include "bitmask.h" #include "backend.h" #include "card_direct.h" #include "back_direct.h" #include "back_nvidia.h" #include "nv_type.h" #include "tv_nv.h" #include "tv_i2c.h" #include "data.h" #include "xf86PciInfo.h" /* -------- State of common direct backend driver -------- */ /* The state of the backend consists of: * * - an NVRec (to be compatible to X) * - the current card * - the current main, tv and video head * - the current chip (in bnv_nv.TvFunc) * - the current chip function table (in bnv_data) * - the settings (in bnv_set, bnv_set_avail) * - the crt/cip registers before settings (in bnv_regs) * - the current and old viewport position (for dualhead) * - the current and old videoport position (for dualhead) * */ static CardPtr bnv_card; static int bnv_fd = -1; /* fd/handle for mmap */ static int bnv_main_head = 1; static int bnv_tv_head = 1; static int bnv_video_head = 1; static NVRec bnv_nv = { TvChain: NULL, TvBusses: {NULL, NULL, NULL}, TvMaxBus: 0, }; static DataFunc *bnv_data = NULL; static TVSettings bnv_set; static TVRegs bnv_regs; Bool bnv_set_avail = FALSE; Bool bnv_enc_avail = FALSE; static int bnv_view_main_x = 0; static int bnv_view_main_y = 0; static int bnv_view_tv_x = 0; static int bnv_view_tv_y = 0; /* -------- Common backend driver routines -------- */ /* * Update crt regs from hardware */ void bnv_updateCrt (int head) { RAISE (MSG_DEBUG, "bnv update crt %i", head); NVGetAllRegs (&bnv_nv, head-1, &bnv_regs); } /* * Init heads: find current active heads. */ void bnv_initHeads (void) { int devFlags[2]; RAISE (MSG_DEBUG, "bnv init heads %i", bnv_nv.arch.heads); if (bnv_nv.arch.heads == 1) { bnv_main_head = bnv_tv_head = bnv_video_head = 1; bnv_nv.TvHead = 0; } else { bnv_main_head = bnv_tv_head = bnv_video_head = 0; devFlags[0] = NVGetDevFlags (&bnv_nv, 0); devFlags[1] = NVGetDevFlags (&bnv_nv, 1); if (devFlags[0] & DEV_TELEVISION) { bnv_tv_head = 1; } else if (devFlags[1] & DEV_TELEVISION) { bnv_tv_head = 2; } /* FIXME This will probably fail on a GF2Go if both monitor and FP are enabled */ if (devFlags[0] & DEV_FLATPANEL) { bnv_main_head = 1; if (bnv_tv_head == 0) bnv_tv_head = 2; } else if (devFlags[1] & DEV_FLATPANEL) { bnv_main_head = 2; if (bnv_tv_head == 0) bnv_tv_head = 1; } if (bnv_main_head == 0) bnv_main_head = 1; if (bnv_tv_head == 0) bnv_tv_head = bnv_main_head; bnv_video_head = bnv_tv_head; NVSetTvHead (&bnv_nv, bnv_tv_head - 1); NVSetVideoHead (&bnv_nv, bnv_video_head - 1); } } /* * Init card: read crt regs, probe chips */ /* FIXME: Maybe call backend funcs with 'this' argument, and have a 'virtual' apply func? */ void bnv_initCard (void) { bnv_updateCrt (1); if (bnv_nv.arch.exact == 0x2A) { if (!XBoxBusInit (&bnv_nv)) return; } else { if (!NVTvBusInit (&bnv_nv)) return; } bnv_initHeads (); bnv_updateCrt (bnv_tv_head); bnv_probeChips (); } /* * Map NVidia card memory */ void bnv_mapNvMem (CardPtr card, NVPtr pNv, int heads) { bnv_fd = openDevMem (card); pNv->riva.PMC = mapDevMem(card, bnv_fd, pNv->IOAddress+0x000000, 0x1000); pNv->riva.PFB = mapDevMem(card, bnv_fd, pNv->IOAddress+0x100000, 0x1000); pNv->riva.PEXTDEV = mapDevMem(card, bnv_fd, pNv->IOAddress+0x101000, 0x1000); pNv->riva.PCRTC = mapDevMem(card, bnv_fd, pNv->IOAddress+0x600000, 0x2000 * heads); pNv->riva.PCIO = ((CARD8 *) pNv->riva.PCRTC) + 0x1000; pNv->riva.PVIO = mapDevMem(card, bnv_fd, pNv->IOAddress+0x0C0000, 0x1000); pNv->riva.PRAMDAC = mapDevMem(card, bnv_fd, pNv->IOAddress+0x680000, 0x2000 * heads); pNv->riva.PDIO = ((CARD8 *) pNv->riva.PRAMDAC) + 0x1000; pNv->riva.PVIDEO = mapDevMem(card, bnv_fd, pNv->IOAddress+0x008000, 0x1000); pNv->riva.PTIMER = mapDevMem(card, bnv_fd, pNv->IOAddress+0x009000, 0x1000); pNv->riva.PTV = NULL; if (pNv->arch.exact == 0x17) { pNv->riva.PTV = mapDevMem(card, bnv_fd, pNv->IOAddress+0x00d000, 0x1000); } } void bnv_unmapNvMem (CardPtr card, NVPtr pNv, int heads) { unmapDevMem(card, pNv->IOAddress+0x000000, 0x1000); unmapDevMem(card, pNv->IOAddress+0x100000, 0x1000); unmapDevMem(card, pNv->IOAddress+0x101000, 0x1000); unmapDevMem(card, pNv->IOAddress+0x600000, 0x2000 * heads); unmapDevMem(card, pNv->IOAddress+0x680000, 0x2000 * heads); unmapDevMem(card, pNv->IOAddress+0x008000, 0x1000); closeDevMem (card, bnv_fd); bnv_fd = -1; } void bnv_setNvArch (CardPtr card, NVPtr pNv); void bnv_initArch (NVPtr pNv) { pNv->arch.boot = MMIO_IN32 (pNv->riva.PMC, 0x000); switch (pNv->arch.exact) { case 0x03: pNv->arch.maxP = 3; break; case 0x10: case 0x1a: pNv->arch.maxVclk[0] = 300000; break; case 0x11: pNv->arch.maxVclk[0] = 300000; pNv->arch.maxVclk[1] = 150000; break; case 0x17: case 0x20: case 0x25: pNv->arch.maxVclk[0] = 350000; pNv->arch.maxVclk[1] = 350000; break; } switch (pNv->arch.exact) { case 0x11: case 0x17: case 0x18: case 0x20: case 0x25: pNv->arch.maxM [0] = 13; pNv->arch.freqM[0] = 150000; pNv->arch.maxM [1] = 6; pNv->arch.freqM[1] = 200000; pNv->arch.maxM [2] = 4; pNv->arch.freqM[2] = 340000; pNv->arch.maxM [3] = 2; pNv->arch.freqM[4] = 0; break; default: pNv->arch.maxM [0] = 13; pNv->arch.freqM[0] = 250000; pNv->arch.maxM [1] = 6; pNv->arch.freqM[1] = 340000; pNv->arch.maxM [2] = 2; pNv->arch.freqM[2] = 0; break; } switch (pNv->arch.exact) { case 0x15: pNv->arch.minVco = 250000; pNv->arch.maxVco = 500000; if ((pNv->arch.boot & 0xff) != 0xa1) break; /* NV15 Rev A1 falls through */ case 0x11: pNv->arch.minVco = 200000; pNv->arch.maxVco = 400000; break; case 0x20: pNv->arch.minVco = 250000; pNv->arch.maxVco = 500000; break; case 0x17: case 0x18: case 0x25: pNv->arch.minVco = 300000; pNv->arch.maxVco = 600000; break; } /* FIXME: Should get minVco/maxVco from BIOS */ pNv->arch.crystalFreq = (GetBit (MMIO_IN32 (pNv->riva.PEXTDEV, 0x000),6)) ? 14318 : 13500; /* In Xfree riva_hw.c */ if (pNv->arch.exact == 0x17 || pNv->arch.exact == 0x18 || pNv->arch.exact == 0x1F || pNv->arch.exact == 0x25 || pNv->arch.exact == 0x28) { if (GetBit (MMIO_IN32 (pNv->riva.PEXTDEV, 0x000),22)) { pNv->arch.crystalFreq = 27000; } } if (pNv->arch.crystalFreq >= 14000) { pNv->arch.maxM [0] = 14; } if (pNv->arch.exact == 0x03) { pNv->arch.maxM[0] --; pNv->arch.minM = pNv->arch.maxM[0] - 5; } } /* * Open card, setup pNv, map mem, call probe */ void bnv_openCard (CardPtr card) { NVPtr pNv; int i; RAISE (MSG_DEBUG, "bnv open"); bnv_card = card; pNv = &bnv_nv; pNv->IOAddress = card->reg_base; pNv->Chipset = card->pci_id; for (i = 0; i < NV_MAXBUS; i++) pNv->TvBusses[i] = NULL; pNv->arch.major = 0x00; pNv->arch.exact = 0x00; pNv->arch.heads = 1; /* initialize values "on the safe side" */ pNv->arch.minVco = 128000; pNv->arch.maxVco = 256000; pNv->arch.maxVclk[0] = 256000; pNv->arch.maxVclk[1] = 0; pNv->arch.maxP = 4; pNv->arch.minM = 1; pNv->arch.maxM[0] = 12; pNv->arch.freqM[0] = 0; switch (card->pci_id) { case PCI_CHIP_RIVA128: pNv->arch.major = 0x03; /* NV3 */ break; case PCI_CHIP_TNT: case PCI_CHIP_TNT2: case PCI_CHIP_TNT2_A: case PCI_CHIP_TNT2_B: case PCI_CHIP_UTNT2: case PCI_CHIP_VTNT2: case PCI_CHIP_UVTNT2: case PCI_CHIP_ITNT2: pNv->arch.major = 0x04; /* NV4 */ break; default: pNv->arch.major = (card->pci_id & 0x0f00) >> 4; break; } pNv->arch.exact = pNv->arch.major; /* To be safe */ switch (card->pci_id) { case PCI_CHIP_RIVA128: pNv->arch.exact = 0x03; /* NV3 */ break; case PCI_CHIP_TNT: pNv->arch.exact = 0x04; /* NV4 */ break; case PCI_CHIP_TNT2: case PCI_CHIP_TNT2_A: case PCI_CHIP_TNT2_B: case PCI_CHIP_UTNT2: case PCI_CHIP_VTNT2: case PCI_CHIP_UVTNT2: pNv->arch.exact = 0x05; /* NV5 */ break; case PCI_CHIP_ITNT2: pNv->arch.exact = 0x0A; /* NV0A */ break; default: pNv->arch.exact = (card->pci_id & 0x0ff0) >> 4; break; } /* X says two head if: >= 0x11 && != 0x15,0x1a,0x20 */ switch (pNv->arch.exact) { case 0x03: case 0x04: case 0x05: case 0x0a: case 0x10: case 0x15: case 0x1a: case 0x20: case 0x2a: pNv->arch.heads = 1; break; case 0x11: case 0x17: case 0x18: case 0x1f: case 0x25: /* from X */ case 0x28: /* from X */ default: /* FIXME */ pNv->arch.heads = 2; break; } /* TODO: NV31 and NV36 have twostagePLL. 'nv' source claims (wrongly?) NV34 does, too. */ /* Number of DVO ports: NV11, NV20, NV17: 1. NV25, NV17/18/better: 2 */ bnv_mapNvMem (card, &bnv_nv, bnv_nv.arch.heads); bnv_setNvArch (card, &bnv_nv); bnv_initArch (&bnv_nv); bnv_initCard (); /* does probe */ } /* * Close card, unmap memory, free pNv */ void bnv_closeCard (void) { TVDestroyAll (&bnv_nv.TvChain, &bnv_nv.TvBusses, bnv_nv.TvMaxBus); bnv_unmapNvMem (bnv_card, &bnv_nv, bnv_nv.arch.heads); } /* * Set heads used for tv, monitor, video scaler. */ void bnv_setHeads (int main, int tv, int video) { RAISE (MSG_DEBUG, "bnv_setHeads %i %i %i", main, tv, video); if (main > 0) bnv_main_head = main; if (tv > 0) bnv_tv_head = tv; if (video > 0) bnv_video_head = video; if (bnv_main_head == bnv_tv_head) bnv_video_head = bnv_main_head; /* might refuse to set TV head ... */ bnv_tv_head = NVSetTvHead (&bnv_nv, bnv_tv_head - 1) + 1; NVSetVideoHead (&bnv_nv, bnv_video_head - 1); } /* * Get heads used for tv, monitor, video scaler. */ void bnv_getHeads (int *main, int *tv, int *video, int *max) { RAISE (MSG_DEBUG, "bnv_getHeads"); if (main ) *main = bnv_main_head; if (tv ) *tv = bnv_tv_head; if (video) *video = bnv_video_head; if (max ) *max = bnv_nv.arch.heads; } void bnv_getHeadDev (int head, int *devFlags) { RAISE (MSG_DEBUG, "bnv_getHeadDev"); if (devFlags) *devFlags = NVGetDevFlags (&bnv_nv, head-1); } /* * Probe all chips on card. */ void bnv_probeChips (void) { RAISE (MSG_DEBUG, "bnv_probeChips"); bdir_freeChips (bnv_card); TVDestroyChainDevices (&bnv_nv.TvChain, &bnv_nv.TvBusses, bnv_nv.TvMaxBus); NVProbeTvDevices (&bnv_nv); bnv_card->chips = bdir_copyChips (bnv_nv.TvChain); bnv_setChip (bnv_card->chips, FALSE); /* don't init */ } /* * Set active chip */ void bnv_setChip (ChipPtr chip, Bool init) { RAISE (MSG_DEBUG, "bnv_setChip %s %i", chip ? chip->name : "NULL", init); if (!chip) { bnv_enc_avail = FALSE; return; } bnv_enc_avail = TRUE; NVSetTvDevice (&bnv_nv, (I2CChainPtr) chip->private, init); bnv_data = data_func (CARD_NVIDIA, chip->type); bnv_data->defaults (&bnv_set); bnv_set_avail = TRUE; } void bxbox_setChip (ChipPtr chip, Bool init) { RAISE (MSG_DEBUG, "bnv_setChip %s %i", chip ? chip->name : "NULL", init); if (!chip) { bnv_enc_avail = FALSE; return; } bnv_enc_avail = TRUE; NVSetTvDevice (&bnv_nv, (I2CChainPtr) chip->private, init); bnv_data = data_func (CARD_XBOX, chip->type); bnv_data->defaults (&bnv_set); bnv_set_avail = TRUE; } /* * Apply any changes: process settings, call lower level part */ /* FIXME: Maybe call backend funcs with 'this' argument, and have a 'virtual' apply func? */ void bnv_apply (void) { TVRegs temp; temp = bnv_regs; if ((temp.devFlags & DEV_TELEVISION) && bnv_set_avail) { bnv_data->clamp (&bnv_set, &bnv_regs); bnv_data->setup (&bnv_set, &temp); } if (bnv_nv.arch.exact == 0x2A) { XBoxSetTvMode (&bnv_nv, &temp); } else { NVSetTvMode (&bnv_nv, &temp); } } /* * change settings, update tv chip registers */ void bnv_setSettings (TVSettings *set) { if (set) { bnv_set = *set; bnv_set_avail = TRUE; } else { bnv_set_avail = FALSE; } bnv_apply (); } /* * Get current settings */ void bnv_getSettings (TVSettings *set) { if (set && bnv_set_avail) *set = bnv_set; } /* * Set mode by crt and tv regs */ void bnv_setMode (TVRegs *r) { if (r) bnv_regs = *r; if (!bnv_enc_avail) return; bnv_apply (); } /* * Get current mode. Update crt from hardware. */ void bnv_getMode (TVRegs *r) { RAISE (MSG_DEBUG, "get mode nv %i", bnv_tv_head); bnv_updateCrt (bnv_tv_head); /* FIXME: Make sure chip is set here */ if (bnv_regs.devFlags & DEV_TELEVISION) { NVGetEncRegsPort (&bnv_nv, &bnv_regs.enc, &bnv_regs.portEnc); NVGetPort (&bnv_nv, &bnv_regs.portHost); } if (r) *r = bnv_regs; } /* * Set both mode and settings */ void bnv_setModeSettings (TVRegs *r, TVSettings *set) { if (set) { bnv_set = *set; bnv_set_avail = TRUE; } else { bnv_set_avail = FALSE; } if (r) bnv_regs = *r; if (!bnv_enc_avail) return; bnv_apply (); } /* * Enable test image (color bars) */ void bnv_setTestImage (TVEncoderRegs *tv, TVSettings *set) { if (set) bnv_set = *set; if (tv) bnv_regs.enc = *tv; if (!bnv_enc_avail) return; #if 0 /* FIXME */ if (set) { bnv_data->setup (&bnv_set, ...); } /* FIXME: Settings?? */ #endif NVSetTestImage (&bnv_nv, &bnv_regs.enc); } long bnv_getStatus (int index) { if (!bnv_enc_avail) return 0; return NVGetTvStatus (&bnv_nv, index); } TVConnect bnv_getConnection (void) { if (!bnv_enc_avail) return CONNECT_NONE; return NVGetTvConnect (&bnv_nv); } /* * List all modes (by system) */ int bnv_listModes (TVSystem system, TVMode *(list[])) { if (!bnv_enc_avail) return FALSE; return bdir_listModes (CARD_NVIDIA, bnv_data, system, list); } /* * Find mode by size (and resolution). */ Bool bnv_findBySize (TVSystem system, int xres, int yres, char *size, TVMode *mode) { if (!bnv_enc_avail) return FALSE; return bdir_findBySize (CARD_NVIDIA, bnv_data, system, xres, yres, size, mode); } Bool bxbox_findBySize (TVSystem system, int xres, int yres, char *size, TVMode *mode) { if (!bnv_enc_avail) return FALSE; return bdir_findBySize (CARD_XBOX, bnv_data, system, xres, yres, size, mode); } /* * Find mode by overscan (and resolution) */ Bool bnv_findByOverscan (TVSystem system, int xres, int yres, double hoc, double voc, TVMode *mode) { if (!bnv_enc_avail) return FALSE; return bdir_findByOverscan (CARD_NVIDIA, bnv_data, system, xres, yres, hoc, voc, mode); } Bool bxbox_findByOverscan (TVSystem system, int xres, int yres, double hoc, double voc, TVMode *mode) { if (!bnv_enc_avail) return FALSE; return bdir_findByOverscan (CARD_XBOX, bnv_data, system, xres, yres, hoc, voc, mode); } /* * Initialize shared view for both heads, and return position of viewport * of second head. */ void bnv_initSharedView (int *view_x, int *view_y) { int addr, ofs; NVCopyHead (&bnv_nv, bnv_main_head - 1, bnv_tv_head - 1); NVGetCrtLayout (&bnv_nv, bnv_main_head - 1, &addr, &ofs); bnv_view_main_x = addr % (ofs * 2); bnv_view_main_y = addr / (ofs * 2); if (bnv_main_head != bnv_tv_head) { NVSetCrtLayout (&bnv_nv, bnv_tv_head - 1, addr, ofs); } /* The assumption here is that the first screen always starts at address 0, and we are in byte mode (K=2 for offset). FIXME? */ bnv_view_tv_x = addr % (ofs * 2); bnv_view_tv_y = addr / (ofs * 2); if (view_x) *view_x = bnv_view_tv_x; if (view_y) *view_y = bnv_view_tv_y; } /* * Check whether TwinView is active by inspecting the vertical interrupt * of the TV head. */ Bool bnv_getTwinView (int *view_x, int *view_y) { int addr, ofs; if (bnv_tv_head != bnv_main_head && NVVertIntrEnabled (&bnv_nv, bnv_tv_head - 1)) { NVGetCrtLayout (&bnv_nv, bnv_tv_head - 1, &addr, &ofs); if (view_x) *view_x = addr % (ofs * 2); if (view_y) *view_y = addr / (ofs * 2); return TRUE; } else { if (view_x) *view_x = 0; if (view_y) *view_y = 0; return FALSE; } } /* * The 'adjust' and 'service' actions are complex, and called as one * routine to reduce client/server interaction. They adjust the viewport * and video overlay position, while at the same time watching for * external changes. * * The 'adjust' action sets new viewport and video overlay position. * * The 'service' action sets the cursor position and modifies the * viewport position if necessary. * * Here are the rules: * * cursor service -> change hw cursor position, copy image etc. * cursor out of viewport -> change viewport position * main viewport moves -> change viewport position * tv viewport moves -> change viewport position * any viewport moves -> change video position * video hw moves -> change video position */ Bool bnv_checkViewport (int flags, int *pofs) { int addr, ofs; int x, y; Bool changed; changed = FALSE; if (bnv_tv_head != bnv_main_head && (flags & BACK_SERVICE_VIEW_MAIN)) { NVGetCrtLayout (&bnv_nv, bnv_main_head - 1, &addr, &ofs); x = addr % (ofs * 2); y = addr / (ofs * 2); RAISE (MSG_DEBUG, "bnv check main %i,%i", x, y); if (x != bnv_view_main_x || y != bnv_view_main_y) { changed = TRUE; bnv_view_tv_x = bnv_view_main_x = x; bnv_view_tv_y = bnv_view_main_y = y; } } if (!changed) { NVGetCrtLayout (&bnv_nv, bnv_tv_head - 1, &addr, &ofs); x = addr % (ofs * 2); y = addr / (ofs * 2); if (x != bnv_view_tv_x || y != bnv_view_tv_y) { changed = TRUE; bnv_view_tv_x = x; bnv_view_tv_y = y; } } if (pofs) *pofs = ofs; return changed; } Bool bnv_adjustViewport (int flags, int *view_x, int *view_y) { int addr, ofs; Bool changed; RAISE (MSG_DEBUG, "bnv adj view %i,%i", *view_x, *view_y); changed = bnv_checkViewport (flags, &ofs); if (changed) { *view_x = bnv_view_tv_x; *view_y = bnv_view_tv_y; } else { bnv_view_tv_x = *view_x; bnv_view_tv_y = *view_y; } addr = bnv_view_tv_x + bnv_view_tv_y * ofs * 2; NVSetCrtLayout (&bnv_nv, bnv_tv_head - 1, addr, ofs); return changed; } Bool bnv_serviceViewportCursor (int flags, int cursor_x, int cursor_y, int *view_x, int *view_y) { int x, y; int addr, ofs; Bool changed; RAISE (MSG_DEBUG, "bnv service %i,%i", cursor_x, cursor_y); changed = bnv_checkViewport (flags, &ofs); if (flags & BACK_SERVICE_VIEW_CURSOR) { if (cursor_x < bnv_view_tv_x) { bnv_view_tv_x = cursor_x; changed = TRUE; } if (cursor_y < bnv_view_tv_y) { bnv_view_tv_y = cursor_y; changed = TRUE; } if (cursor_x > bnv_view_tv_x + bnv_regs.crtc.nv.HDisplay) { bnv_view_tv_x = cursor_x - bnv_regs.crtc.nv.HDisplay; changed = TRUE; } if (cursor_y > bnv_view_tv_y + bnv_regs.crtc.nv.VDisplay) { bnv_view_tv_y = cursor_y - bnv_regs.crtc.nv.VDisplay; changed = TRUE; } } if (changed) { *view_x = bnv_view_tv_x; *view_y = bnv_view_tv_y; addr = bnv_view_tv_x + bnv_view_tv_y * ofs * 2; NVSetCrtLayout (&bnv_nv, bnv_tv_head - 1, addr, ofs); } if ((flags & BACK_SERVICE_CURSOR) && bnv_main_head != bnv_tv_head) { NVCopyCursor (&bnv_nv, bnv_main_head - 1, bnv_tv_head - 1); NVGetCursorPos (&bnv_nv, bnv_tv_head - 1, &x, &y); NVSetCursorPos (&bnv_nv, bnv_tv_head - 1, cursor_x - bnv_view_tv_x, cursor_y - bnv_view_tv_y); if (x != cursor_x - bnv_view_tv_x || y != cursor_y - bnv_view_tv_y) { changed = TRUE; } } return changed; } #ifdef DEBUG_PROBE void bnv_probe_dump (int regs [], int max) { int i; for (i = 0x00; i < max; i++) { if ((i & 0xf) == 0x0) printf (" %02X:", i); if ((i & 0xf) == 0x8) printf (" "); printf (" %02X", regs[i]); if ((i & 0xf) == 0xf) printf ("\n"); } } void bnv_probe_crt (NVPtr pNv) { int regs [0xa0]; int last = 0xa0; int i; int head; for (head = 0; head < bnv_nv.arch.heads; head++) { printf (" CRT registers %i/%i:\n", head+1, bnv_nv.arch.heads); for (i = 0x00; i < last; i++) regs[i] = 0x00; writeCrtNv (pNv, head, 0x1f, 0x57); /* unlock extended registers */ for (i = 0x00; i < last; i++) regs [i] = readCrtNv (pNv, head, i); bnv_probe_dump (regs, last); } } void bnv_probe_attr (NVPtr pNv) { int regs [0x60]; int i; int head; for (head = 0; head < bnv_nv.arch.heads; head++) { printf (" ATTR registers %i/%i:\n", head+1, bnv_nv.arch.heads); for (i = 0x00; i < 0x20; i++) regs[i] = 0x00; for (i = 0x00; i < 0x20; i++) regs [i] = NVReadAttr (pNv, head, i); bnv_probe_dump (regs, 0x20); } } void bnv_probe_seq (NVPtr pNv, int head) { int regs [0x60]; int i; printf (" SEQ registers %i/%i:\n", head+1, bnv_nv.arch.heads); for (i = 0x00; i < 0x10; i++) regs[i] = 0x00; for (i = 0x00; i < 0x10; i++) regs [i] = NVReadSeq (pNv, i); bnv_probe_dump (regs, 0x10); } void bnv_probe_gr (NVPtr pNv, int head) { int regs [0x60]; int i; printf (" GR registers %i/%i:\n", head+1, bnv_nv.arch.heads); for (i = 0x00; i < 0x10; i++) regs[i] = 0x00; for (i = 0x00; i < 0x10; i++) regs [i] = NVReadGr (pNv, i); bnv_probe_dump (regs, 0x10); } void bnv_probe_misc (NVPtr pNv, int head) { printf (" MISC registers %i/%i:\n", head+1, bnv_nv.arch.heads); printf (" input0=%02X vse=%02X feat=%02X misc=%02X\n", MMIO_IN8(bnv_nv.riva.PCIO, 0x3c2), MMIO_IN8(bnv_nv.riva.PVIO, 0x3c3), MMIO_IN8(bnv_nv.riva.PCIO, 0x3ca), MMIO_IN8(bnv_nv.riva.PVIO, 0x3cc)); } #define pdac(x) ((int) MMIO_H_IN32 (bnv_nv.riva.PRAMDAC, head, x)) #define pcrt(x) ((int) MMIO_H_IN32 (bnv_nv.riva.PCRTC, head, x)) void bnv_probeCard (void) { int head; printf (" MC_boot=%08lX FB_boot=%08lX FB_conf=%08lX EXT_boot=%08lX\n", MMIO_IN32 (bnv_nv.riva.PMC, 0x000), MMIO_IN32 (bnv_nv.riva.PFB, 0x000), MMIO_IN32 (bnv_nv.riva.PFB, 0x200), MMIO_IN32 (bnv_nv.riva.PEXTDEV, 0x000)); for (head = 0; head < bnv_nv.arch.heads; head++) { printf (" PCRTC %i/%i:\n", head+1, bnv_nv.arch.heads); printf (" Assoc = %08X Config = %08X\n", pcrt(0x860), pcrt(0x804)); printf (" PRAMDAC %i/%i:\n", head+1, bnv_nv.arch.heads); printf (" PLL coeff = %08X 0x524 = %08X VPLL = %08X / %08X\n", pdac(0x50c), pdac(0x524), pdac(0x508), pdac(0x520)); printf (" Gen Ctrl = %08X Test Ctrl = %08X TV Setup = %08X\n", pdac(0x600), pdac(0x608), pdac(0x700)); printf (" FP Test = %08X TG Ctrl = %08X FP Debug = %08X\n", pdac(0x844), pdac(0x848), pdac(0x880)); printf (" TV blank = v= %08X-%08X h= %08X-%08X %08X \n", pdac(0x704), pdac(0x708), pdac(0x70c), pdac(0x710), pdac(0x714)); printf (" TV slave = v= %08X-%08X h= %08X-%08X %08X,%08X\n", pdac(0x724), pdac(0x728), pdac(0x730), pdac(0x734), pdac(0x720), pdac(0x72C)); printf (" TV slave' = %08X\n", pdac(0x738)); } writeCrtNv (&bnv_nv, 0, 0x1f, 0x57); /* unlock extended registers */ bnv_probe_crt (&bnv_nv); /* unlocks crt regs */ bnv_probe_attr (&bnv_nv); for (head = 0; head < bnv_nv.arch.heads; head++) { if (bnv_nv.arch.heads > 1) { switch (head) { case 0: writeCrtNv (&bnv_nv, 0, 0x44, 0x00); break; case 1: writeCrtNv (&bnv_nv, 0, 0x44, 0x03); break; } } bnv_probe_seq (&bnv_nv, head); bnv_probe_gr (&bnv_nv, head); bnv_probe_misc (&bnv_nv, head); } if (bnv_nv.arch.heads > 1) { writeCrtNv (&bnv_nv, 0, 0x44, 0x00); /* FIXME may not be default!! */ } printf ("\n"); } I2CChainPtr bnv_probeBus (void) { TVDestroyChainDevices (&bnv_nv.TvChain, &bnv_nv.TvBusses, bnv_nv.TvMaxBus); /* probe needs unlocked crt */ NVUpdateTvState (&bnv_nv); TVCheckChain (bnv_nv.TvChain); bnv_nv.TvChain = TVProbeCreateAll (bnv_nv.TvBusses, bnv_nv.TvMaxBus, NULL); return bnv_nv.TvChain; } #endif /* DEBUG_PROBE */ BackCardRec bnv_func = { openCard: bnv_openCard, closeCard: bnv_closeCard, #ifdef DEBUG_PROBE probeCard: bnv_probeCard, probeBus: bnv_probeBus, #endif setHeads: bnv_setHeads, getHeads: bnv_getHeads, getHeadDev: bnv_getHeadDev, probeChips: bnv_probeChips, setChip: bnv_setChip, setSettings: bnv_setSettings, getSettings: bnv_getSettings, setMode: bnv_setMode, getMode: bnv_getMode, setModeSettings: bnv_setModeSettings, setTestImage: bnv_setTestImage, getStatus: bnv_getStatus, getConnection: bnv_getConnection, listModes: bnv_listModes, findBySize: bnv_findBySize, findByOverscan: bnv_findByOverscan, initSharedView: bnv_initSharedView, getTwinView: bnv_getTwinView, adjustViewport: bnv_adjustViewport, serviceViewportCursor: bnv_serviceViewportCursor, }; BackCardRec bxbox_func = { openCard: bnv_openCard, closeCard: bnv_closeCard, #ifdef DEBUG_PROBE probeCard: bnv_probeCard, probeBus: bnv_probeBus, #endif setHeads: bnv_setHeads, getHeads: bnv_getHeads, getHeadDev: bnv_getHeadDev, probeChips: bnv_probeChips, setChip: bxbox_setChip, setSettings: bnv_setSettings, getSettings: bnv_getSettings, setMode: bnv_setMode, getMode: bnv_getMode, setModeSettings: bnv_setModeSettings, setTestImage: bnv_setTestImage, getStatus: bnv_getStatus, getConnection: bnv_getConnection, listModes: bnv_listModes, findBySize: bxbox_findBySize, findByOverscan: bxbox_findByOverscan, initSharedView: bnv_initSharedView, getTwinView: bnv_getTwinView, adjustViewport: bnv_adjustViewport, serviceViewportCursor: bnv_serviceViewportCursor, }; /* -------- Architecture -------- */ char *bnv_architecture (int boot_mask) { /* FIXME -- not for multiple cards! */ static char s[14]; if ((boot_mask & 0xf0000000) == 0 && (boot_mask & 0x0f000000) != 0) { snprintf (s, sizeof(s), "NV%X Rev %X.%i", GetBF(boot_mask,27:20), GetBF(boot_mask,7:0), GetBF(boot_mask,19:16)); return s; } switch (boot_mask) { case 0x00010100: return "NV1 Rev A"; /* NVX */ case 0x00010101: return "NV1 Rev B"; /* NVX */ case 0x00010102: return "NV1 Rev B2"; /* NVX */ case 0x00010103: return "NV1 Rev B3"; /* NVX */ case 0x00010104: return "NV1 Rev C1"; /* NVX */ case 0x10020400: return "NV2 Rev A1"; /* NVX */ case 0x00030100: return "NV3 Rev A1"; /* NVX */ case 0x00030110: return "NV3 Rev B1"; /* NVX */ case 0x20030120: return "NV3T Rev A1"; /* NVX */ case 0x20030121: return "NV3T Rev A2"; /* NVX */ case 0x20030122: return "NV3T Rev A3-4"; /* NVX */ case 0x20004000: return "NV4 Rev A1-3"; /* NVX */ case 0x20034001: return "NV4 Rev A4"; /* NVX */ case 0x20044001: return "NV4 Rev A5"; /* NVX */ case 0x20104000: return "NV5/6 Rev A1"; /* NVX */ case 0x20114000: return "NV5/6 Rev A2"; /* NVX */ case 0x20124000: return "NV5/6 Rev A3"; /* NVX */ case 0x20204000: return "NV5/6 Rev B1"; /* NVX */ case 0x20214000: return "NV5/6 Rev B2"; /* NVX */ case 0x20224000: return "NV5/6 Rev B3"; /* NVX */ #if 0 /* FIXME duplicate! */ case 0x20204000: return "NV0A Rev A1"; /* NVX */ case 0x20214000: return "NV0A Rev A2"; /* NVX */ case 0x20224000: return "NV0A Rev B1"; /* NVX */ #endif default: break; } snprintf (s, sizeof(s), "NV Id %08X", boot_mask); return s; } void bnv_setNvArch (CardPtr card, NVPtr pNv) { card->arch = bnv_architecture (MMIO_IN32 (pNv->riva.PMC, 0x000)); } /* Scenarios: NVIDIA driver NV driver If there is a TV head already active, choose that. If there is a FP head active, choose that as main, and the other as TV. Else choose the first as main. If no TV head, choose same as first. Keep all that out of tv_nv. Q: Only change basic crtc and encoder registers if * kernel already had TV enabled * other cases? Q: What's the difference between an kernel TV enabled head and an nvtv enabled one? A: The vertical interrupt. */ nvtv-0.4.7/src/back_tdfx.c0000644000175000001440000002363110005515125011053 /* NVTV 3dfx backend -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_tdfx.c,v 1.25 2004/01/27 17:05:25 dthierbach Exp $ * * Contents: * * Backend for 3dfx (Voodoo 3) cards, direct access. * */ #include "local.h" /* before everything else */ #include #ifdef HAVE_UNISTD_H #include #endif #include #include "xfree.h" /* via back_direct.h */ #ifdef DEBUG_PROBE #include "bitmask.h" #include "mmio.h" #endif #include "backend.h" #include "card_direct.h" #include "back_direct.h" #include "back_null.h" #include "back_tdfx.h" #include "tv_tdfx.h" #include "data.h" /* -------- State of common direct backend driver -------- */ static CardPtr btdfx_card; static int btdfx_fd = -1; /* fd/handle for mmap */ static TDFXRec btdfx_tdfx = { TvChain: NULL, TvBus: NULL, }; static DataFunc *btdfx_data = NULL; static TVSettings btdfx_set; static TVRegs btdfx_regs; Bool btdfx_set_avail = FALSE; /* -------- Common backend driver routines -------- */ /* * Update crt regs from hardware */ void btdfx_updateCrt (void) { TDFXGetAllRegs (&btdfx_tdfx, &btdfx_regs); } /* * Init card: read crt regs, probe chips */ void btdfx_initCard (void) { btdfx_updateCrt (); if (TDFXTvBusInit (&btdfx_tdfx)) { TDFXTvBusConfig (&btdfx_tdfx); btdfx_probeChips (); } } /* * Map Tdfx card memory */ void btdfx_mapMem (CardPtr card, TDFXPtr pTdfx) { btdfx_fd = openDevMem (card); pTdfx->MMIOBase[0] = mapDevMem(card, btdfx_fd, card->reg_base, 0x1000); pTdfx->PIOBase[0] = card->pio_base; pTdfx->IOBase = 0xd0; } void btdfx_unmapMem (CardPtr card, TDFXPtr pTdfx) { unmapDevMem(card, (unsigned long) pTdfx->MMIOBase[0], 0x1000); closeDevMem (card, btdfx_fd); btdfx_fd = -1; } /* * Open card, map mem, call probe */ void btdfx_openCard (CardPtr card) { RAISE (MSG_DEBUG, "btdfx open"); btdfx_card = card; btdfx_mapMem (card, &btdfx_tdfx); btdfx_initCard (); /* does probe */ btdfx_card->arch = "3DFX"; /* FIXME: Use sub vendor? */ } /* * Close card, unmap memory. */ void btdfx_closeCard (void) { TVDestroyAll (&btdfx_tdfx.TvChain, &btdfx_tdfx.TvBus, 1); btdfx_unmapMem (btdfx_card, &btdfx_tdfx); } void btdfx_setHeads (int main, int tv, int video) { RAISE (MSG_DEBUG, "btdfx_setHeads"); } void btdfx_getHeads (int *main, int *tv, int *video, int *max) { RAISE (MSG_DEBUG, "btdfx_getHeads"); if (tv) *tv = 1; if (video) *video = 1; if (max) *max = 1; } void btdfx_getHeadDev (int head, int *devFlags) { RAISE (MSG_DEBUG, "btdfx_getHeadDev"); if (devFlags) *devFlags = TDFXGetDevFlags (&btdfx_tdfx); } void btdfx_probeChips (void) { RAISE (MSG_DEBUG, "btdfx_probe"); bdir_freeChips (btdfx_card); TVDestroyChainDevices (&btdfx_tdfx.TvChain, &btdfx_tdfx.TvBus, 1); TDFXProbeTvDevices (&btdfx_tdfx); btdfx_card->chips = bdir_copyChips (btdfx_tdfx.TvChain); btdfx_setChip (btdfx_card->chips, FALSE); /* don't init */ } void btdfx_setChip (ChipPtr chip, Bool init) { RAISE (MSG_DEBUG, "btdfx_setChip %s %i", chip ? chip->name : "NULL", init); if (!chip) return; TDFXSetTvDevice (&btdfx_tdfx, (I2CChainPtr) chip->private, init); btdfx_data = data_func (CARD_TDFX, chip->type); btdfx_data->defaults (&btdfx_set); btdfx_set_avail = TRUE; } /* * Apply any changes: process settings, call lower level part */ void btdfx_apply (void) { TVRegs temp; temp = btdfx_regs; if ((temp.devFlags & DEV_TELEVISION) && btdfx_set_avail) { btdfx_data->clamp (&btdfx_set, &btdfx_regs); btdfx_data->setup (&btdfx_set, &temp); } #ifdef CONFIG_TDFX_SETUP_BLANK { register TVTdfxRegs *r = &temp.crtc.tdfx; r->tvHBlankEnd = r->tvHBlankStart + r->HScreenSize; r->tvVBlankEnd = r->tvVBlankStart + r->VScreenSize; } #endif TDFXSetTvMode (&btdfx_tdfx, &temp); } /* * change settings, update tv chip registers */ void btdfx_setSettings (TVSettings *set) { RAISE (MSG_DEBUG, "btdfx_setSettings"); if (set) { btdfx_set = *set; btdfx_set_avail = TRUE; } else { btdfx_set_avail = FALSE; } btdfx_apply (); } /* * Get current settings */ void btdfx_getSettings (TVSettings *set) { RAISE (MSG_DEBUG, "btdfx_getSettings"); if (set && btdfx_set_avail) *set = btdfx_set; } /* * Set mode by crt and tv regs */ void btdfx_setMode (TVRegs *r) { RAISE (MSG_DEBUG, "btdfx_setMode"); if (r) btdfx_regs = *r; btdfx_apply (); } /* * Get current mode. Update crt from hardware. */ void btdfx_getMode (TVRegs *r) { RAISE (MSG_DEBUG, "btdfx_getMode"); btdfx_updateCrt (); if (r) *r = btdfx_regs; } /* * Set both mode and settings */ void btdfx_setModeSettings (TVRegs *r, TVSettings *set) { RAISE (MSG_DEBUG, "btdfx_setModeSettings"); if (set) { btdfx_set = *set; btdfx_set_avail = TRUE; } else { btdfx_set_avail = FALSE; } if (r) btdfx_regs = *r; btdfx_apply (); } void btdfx_setTestImage (TVEncoderRegs *tv, TVSettings *set) { RAISE (MSG_DEBUG, "btdfx_setTestImage"); if (set) btdfx_set = *set; if (tv) btdfx_regs.enc = *tv; #if 0 /* FIXME */ if (set) { btdfx_data->setup (&btdfx_set, ...); } /* FIXME: Settings?? */ #endif TDFXSetTestImage (&btdfx_tdfx, &btdfx_regs.enc); } long btdfx_getStatus (int index) { RAISE (MSG_DEBUG, "btdfx_getStatus"); return TDFXGetTvStatus (&btdfx_tdfx, index); } TVConnect btdfx_getConnection (void) { RAISE (MSG_DEBUG, "btdfx_getConnection"); return TDFXGetTvConnect (&btdfx_tdfx); } /* * List all modes (by system) */ int btdfx_listModes (TVSystem system, TVMode *(list[])) { return bdir_listModes (CARD_TDFX, btdfx_data, system, list); } /* * Find mode by size (and resolution). */ Bool btdfx_findBySize (TVSystem system, int xres, int yres, char *size, TVMode *mode) { return bdir_findBySize (CARD_TDFX, btdfx_data, system, xres, yres, size, mode); } /* * Find mode by overscan (and resolution) */ Bool btdfx_findByOverscan (TVSystem system, int xres, int yres, double hoc, double voc, TVMode *mode) { return bdir_findByOverscan (CARD_TDFX, btdfx_data, system, xres, yres, hoc, voc, mode); } #ifdef DEBUG_PROBE void btdfx_probe_dump (int regs [], int max) { int i; for (i = 0x00; i < max; i++) { if ((i & 0xf) == 0x0) printf (" %02X:", i); if ((i & 0xf) == 0x8) printf (" "); printf (" %02X", regs[i]); if ((i & 0xf) == 0xf) printf ("\n"); } } void btdfx_probe_crt (TDFXPtr pTdfx) { int regs [0x60]; int i; printf (" CRT registers\n"); for (i = 0x00; i < 0x30; i++) regs[i] = 0x00; for (i = 0x00; i < 0x30; i++) regs [i] = readCrtTdfx (pTdfx, i); btdfx_probe_dump (regs, 0x30); } #define TDFX_RD32(p,i) MMIO_IN32(((p)->MMIOBase[0]), (i)) void btdfx_probeCard (void) { register unsigned long val; val = TDFX_RD32(&btdfx_tdfx, 0x10); printf (" miscInit0 (0x10)=%08lX tv_blank=%i tv_sync=%i\n", val, GetBF(val,10:8), GetBF(val,13:11)); val = TDFX_RD32(&btdfx_tdfx, 0x14); printf (" miscInit1 (0x14)=%08lX rom=%i\n", val, GetBF(val,4:4)); val = TDFX_RD32(&btdfx_tdfx, 0x24); printf (" tmuGbeInit (0x24)=%08lX inv=%i dly=%i\n", val, GetBF(val,15:15), GetBF(val,19:16)); val = TDFX_RD32(&btdfx_tdfx, 0x28); printf (" vgaInit0 (0x28)=%08lX ext=%i\n", val, GetBF(val,1:1)); val = TDFX_RD32(&btdfx_tdfx, 0x2c); printf (" vgaInit1 (0x2c)=%08lX lock=%i%i%i\n", val, GetBF(val,21:21), GetBF(val,22:22), GetBF(val,23:23)); val = TDFX_RD32(&btdfx_tdfx, 0x5c); printf (" vidProcCfg (0x5c)=%08lX en=%i half=%i 2x=%i\n", val, GetBF(val,0:0), GetBF(val,4:4), GetBF(val,26:26)); val = TDFX_RD32(&btdfx_tdfx, 0x70); printf (" vidInFormat (0x70)=%08lX\n", val); val = TDFX_RD32(&btdfx_tdfx, 0x78); printf (" vidSerParPort (0x78)=%08lX\n", val); val = TDFX_RD32(&btdfx_tdfx, 0x98); printf (" vidScreenSize (0x98)=%08lX w=%i h=%i\n", val, GetBF(val,11:0), GetBF(val,23:12)); btdfx_probe_crt (&btdfx_tdfx); /* unlocks crt regs */ printf ("\n"); } I2CChainPtr btdfx_probeBus (void) { /* needs unlocked crt */ TDFXUpdateTvState (&btdfx_tdfx); TVCheckChain (btdfx_tdfx.TvChain); btdfx_tdfx.TvChain = TVProbeCreateAll (&btdfx_tdfx.TvBus, 1, NULL); return btdfx_tdfx.TvChain; } #endif BackCardRec btdfx_func = { openCard: btdfx_openCard, closeCard: btdfx_closeCard, #ifdef DEBUG_PROBE probeCard: btdfx_probeCard, probeBus: btdfx_probeBus, #endif setHeads: btdfx_setHeads, getHeads: btdfx_getHeads, getHeadDev: btdfx_getHeadDev, probeChips: btdfx_probeChips, setChip: btdfx_setChip, setSettings: btdfx_setSettings, getSettings: btdfx_getSettings, setMode: btdfx_setMode, getMode: btdfx_getMode, setModeSettings: btdfx_setModeSettings, setTestImage: btdfx_setTestImage, getStatus: btdfx_getStatus, getConnection: btdfx_getConnection, listModes: btdfx_listModes, findBySize: btdfx_findBySize, findByOverscan: btdfx_findByOverscan, initSharedView: bnull_initSharedView, getTwinView: bnull_getTwinView, adjustViewport: bnull_adjustViewport, serviceViewportCursor: bnull_serviceViewportCursor, }; nvtv-0.4.7/src/back_i810.c0000644000175000001440000002635710005546117010604 /* NVTV i810 backend -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_i810.c,v 1.24 2004/01/27 20:38:39 dthierbach Exp $ * * Contents: * * Backend for Intel i810, i810dc100, i810e, i815, and i815e cards; * direct access. * */ #include "local.h" /* before everything else */ #include #ifdef HAVE_UNISTD_H #include #endif #include #include "xfree.h" /* via back_direct.h */ #include "mmio.h" #include "bitmask.h" #include "backend.h" #include "card_direct.h" #include "back_direct.h" #include "back_null.h" #include "back_i810.h" #include "tv_i810.h" #include "data.h" #include "xf86PciInfo.h" /* -------- State of common direct backend driver -------- */ static CardPtr bi810_card; static int bi810_fd = -1; /* fd/handle for mmap */ static I810Rec bi810_i810 = { TvChain: NULL, TvBusses: {NULL, NULL, NULL}, TvMaxBus: 0, }; static DataFunc *bi810_data = NULL; static TVSettings bi810_set; static TVRegs bi810_regs; Bool bi810_set_avail = FALSE; /* -------- Common backend driver routines -------- */ /* * Update crt regs from hardware */ void bi810_updateCrt (void) { /* doesn't manage non-tv registers yet, so no need to get them */ } /* * Init card: read crt regs, probe chips */ void bi810_initCard (void) { bi810_updateCrt (); if (I810TvBusInit (&bi810_i810)) { bi810_probeChips (); } } /* * Map Intel 810 card memory */ void bi810_mapMem (CardPtr card, I810Ptr pI810) { bi810_fd = openDevMem (card); pI810->MMIOBase = mapDevMem(card, bi810_fd, card->reg_base, 0x80000); } void bi810_unmapMem (CardPtr card, I810Ptr pI810) { unmapDevMem(card, (unsigned long) pI810->MMIOBase, 0x80000); closeDevMem (card, bi810_fd); bi810_fd = -1; } /* * Open card, map mem, call probe */ void bi810_openCard (CardPtr card) { RAISE (MSG_DEBUG, "bi810 open"); bi810_card = card; bi810_i810.Chipset = card->pci_id; bi810_i810.arch.major = 0x10; bi810_i810.arch.heads = 1; bi810_card->arch = "Intel"; switch (card->pci_id) { case PCI_CHIP_I810: case PCI_CHIP_I810_DC100: case PCI_CHIP_I810_E: case PCI_CHIP_I810_IG: case PCI_CHIP_I815: bi810_i810.arch.major = 0x10; bi810_card->arch = "Intel 810/815"; /* FIXME: Use sub vendor? */ break; case PCI_CHIP_I830: bi810_i810.arch.major = 0x30; bi810_i810.arch.heads = 2; bi810_card->arch = "Intel 830"; break; case PCI_CHIP_I845: bi810_i810.arch.major = 0x45; bi810_card->arch = "Intel 845"; break; case PCI_CHIP_I855: bi810_i810.arch.major = 0x55; bi810_card->arch = "Intel 855"; break; case PCI_CHIP_I865: bi810_i810.arch.major = 0x65; bi810_card->arch = "Intel 865"; break; default: RAISE (MSG_ERROR, "bi810_openCard: Unknown pci id %04x", card->pci_id); break; } bi810_mapMem (card, &bi810_i810); bi810_initCard (); /* does probe */ /* FIXME Do 830 */ } /* * Close card, unmap memory. */ void bi810_closeCard (void) { TVDestroyAll (&bi810_i810.TvChain, &bi810_i810.TvBusses, bi810_i810.TvMaxBus); bi810_unmapMem (bi810_card, &bi810_i810); } void bi810_setHeads (int main, int tv, int video) { RAISE (MSG_DEBUG, "bi810_setHeads"); } void bi810_getHeads (int *main, int *tv, int *video, int *max) { RAISE (MSG_DEBUG, "bi810_getHeads"); if (tv) *tv = 1; if (video) *video = 1; if (max) *max = 1; } void bi810_getHeadDev (int head, int *devFlags) { RAISE (MSG_DEBUG, "bi810_getHeadDev"); /* FIXME */ if (devFlags) *devFlags = IntelGetDevFlags (&bi810_i810, 0); } void bi810_probeChips (void) { RAISE (MSG_DEBUG, "bi810_probe"); bdir_freeChips (bi810_card); TVDestroyChainDevices (&bi810_i810.TvChain, &bi810_i810.TvBusses, bi810_i810.TvMaxBus); I810ProbeTvDevices (&bi810_i810); bi810_card->chips = bdir_copyChips (bi810_i810.TvChain); bi810_setChip (bi810_card->chips, FALSE); /* don't init */ } void bi810_setChip (ChipPtr chip, Bool init) { RAISE (MSG_DEBUG, "bi810_setChip %s %i", chip ? chip->name : "NULL", init); if (!chip) return; I810SetTvDevice (&bi810_i810, (I2CChainPtr) chip->private, init); bi810_data = data_func (CARD_I810, chip->type); bi810_data->defaults (&bi810_set); bi810_set_avail = TRUE; } /* * Apply any changes: process settings, call lower level part */ void bi810_apply (void) { TVRegs temp; temp = bi810_regs; if ((temp.devFlags & DEV_TELEVISION) && bi810_set_avail) { bi810_data->clamp (&bi810_set, &bi810_regs); bi810_data->setup (&bi810_set, &temp); } IntelSetTvMode (&bi810_i810, &temp); } /* * change settings, update tv chip registers */ void bi810_setSettings (TVSettings *set) { RAISE (MSG_DEBUG, "bi810_setSettings"); if (set) { bi810_set = *set; bi810_set_avail = TRUE; } else { bi810_set_avail = FALSE; } bi810_apply (); } /* * Get current settings */ void bi810_getSettings (TVSettings *set) { RAISE (MSG_DEBUG, "bi810_getSettings"); if (set && bi810_set_avail) *set = bi810_set; } /* * Set mode by crt and tv regs */ void bi810_setMode (TVRegs *r) { RAISE (MSG_DEBUG, "bi810_setMode"); if (r) bi810_regs = *r; bi810_apply (); } /* * Get current mode. Update crt from hardware. */ void bi810_getMode (TVRegs *r) { RAISE (MSG_DEBUG, "bi810_getMode"); bi810_updateCrt (); if (r) *r = bi810_regs; } /* * Set both mode and settings */ void bi810_setModeSettings (TVRegs *r, TVSettings *set) { RAISE (MSG_DEBUG, "bi810_setModeSettings"); if (set) { bi810_set = *set; bi810_set_avail = TRUE; } else { bi810_set_avail = FALSE; } if (r) bi810_regs = *r; bi810_apply (); } void bi810_setTestImage (TVEncoderRegs *tv, TVSettings *set) { RAISE (MSG_DEBUG, "bi810_setTestImage"); if (set) bi810_set = *set; if (tv) bi810_regs.enc = *tv; #if 0 /* FIXME */ if (set) { bi810_data->setup (&bi810_set, ...); } /* FIXME: Settings?? */ #endif I810SetTestImage (&bi810_i810, &bi810_regs.enc); } long bi810_getStatus (int index) { RAISE (MSG_DEBUG, "bi810_getStatus"); return I810GetTvStatus (&bi810_i810, index); } TVConnect bi810_getConnection (void) { RAISE (MSG_DEBUG, "bi810_getConnection"); return I810GetTvConnect (&bi810_i810); } /* * List all modes (by system) */ int bi810_listModes (TVSystem system, TVMode *(list[])) { return bdir_listModes (CARD_I810, bi810_data, system, list); } /* * Find mode by size (and resolution). */ Bool bi810_findBySize (TVSystem system, int xres, int yres, char *size, TVMode *mode) { return bdir_findBySize (CARD_I810, bi810_data, system, xres, yres, size, mode); } /* * Find mode by overscan (and resolution) */ Bool bi810_findByOverscan (TVSystem system, int xres, int yres, double hoc, double voc, TVMode *mode) { return bdir_findByOverscan (CARD_I810, bi810_data, system, xres, yres, hoc, voc, mode); } #ifdef DEBUG_PROBE #define I810_RD32(p,i) MMIO_IN32(((p).MMIOBase), (i)) #define I810_P_RD32(p,h,i) MMIO_IN32(((p).MMIOBase), (i+0x1000*h)) void bi830_probeCard (void) { int i; printf (" DCLK 0D=%08lX 1D=%08lX 0DS=%08lX DPLL A=%08lX B=%08lX\n", I810_RD32(bi810_i810, 0x6000), I810_RD32(bi810_i810, 0x6004), I810_RD32(bi810_i810, 0x6010), I810_RD32(bi810_i810, 0x6014), I810_RD32(bi810_i810, 0x6018)); printf (" ADPA=%08lX DVO A=%08lX B=%08lX C=%08lX LVDS=%08lX\n", I810_RD32(bi810_i810, 0x61100), I810_RD32(bi810_i810, 0x61120), I810_RD32(bi810_i810, 0x61140), I810_RD32(bi810_i810, 0x61160), I810_RD32(bi810_i810, 0x61180)); printf (" DIM =%08lX DIM A=%08lX B=%08lX C=%08lX %08lX\n", I810_RD32(bi810_i810, 0x61104), I810_RD32(bi810_i810, 0x61124), I810_RD32(bi810_i810, 0x61144), I810_RD32(bi810_i810, 0x61164), I810_RD32(bi810_i810, 0x61184)); printf (" FPA %08lX %08lX %08lX %08lX\n", I810_RD32(bi810_i810, 0x6040), I810_RD32(bi810_i810, 0x6044), I810_RD32(bi810_i810, 0x6048), I810_RD32(bi810_i810, 0x604c)); printf (" 020cc=%08lX 020d8=%08lX 020dc=%08lX\n", I810_RD32(bi810_i810, 0x20cc), I810_RD32(bi810_i810, 0x20d8), I810_RD32(bi810_i810, 0x20dc)); printf (" 71280=%08lX 71400=%08lX\n", I810_RD32(bi810_i810, 0x71280), I810_RD32(bi810_i810, 0x71400)); for (i = 0; i <= 1; i++) { printf (" Pipe %c\n", i + 'A'); printf (" HTOTAL=%08lX HBLANK=%08lX HSYNC=%08lX\n", I810_P_RD32(bi810_i810, i, 0x60000), I810_P_RD32(bi810_i810, i, 0x60004), I810_P_RD32(bi810_i810, i, 0x60008)); printf (" VTOTAL=%08lX VBLANK=%08lX VSYNC=%08lX\n", I810_P_RD32(bi810_i810, i, 0x6000c), I810_P_RD32(bi810_i810, i, 0x60010), I810_P_RD32(bi810_i810, i, 0x60014)); printf (" SOURCE=%08lX CONFIG=%08lX 7z030=%08lX 7z080=%08lX\n", I810_P_RD32(bi810_i810, i, 0x6001c), I810_P_RD32(bi810_i810, i, 0x70008), I810_P_RD32(bi810_i810, i, 0x70030), I810_P_RD32(bi810_i810, i, 0x70080)); } for (i = 0; i <= 1; i++) { printf (" Display plane %c\n", i + 'A'); printf (" CTRL=%08lX BASE=%08lX STRIDE=%08lX\n", I810_P_RD32(bi810_i810, i, 0x70180), I810_P_RD32(bi810_i810, i, 0x70184), I810_P_RD32(bi810_i810, i, 0x70188)); } /* dump 71410-71428 BIOS scratch regs? */ } void bi810_probeCard (void) { /* FIXME */ bi830_probeCard (); } I2CChainPtr bi810_probeBus (void) { /* needs unlocked crt */ I810UpdateTvState (&bi810_i810); TVCheckChain (bi810_i810.TvChain); bi810_i810.TvChain = TVProbeCreateAll (bi810_i810.TvBusses, bi810_i810.TvMaxBus, NULL); return bi810_i810.TvChain; } #endif BackCardRec bi810_func = { openCard: bi810_openCard, closeCard: bi810_closeCard, #ifdef DEBUG_PROBE probeCard: bi810_probeCard, probeBus: bi810_probeBus, #endif setHeads: bi810_setHeads, getHeads: bi810_getHeads, getHeadDev: bi810_getHeadDev, probeChips: bi810_probeChips, setChip: bi810_setChip, setSettings: bi810_setSettings, getSettings: bi810_getSettings, setMode: bi810_setMode, getMode: bi810_getMode, setModeSettings: bi810_setModeSettings, setTestImage: bi810_setTestImage, getStatus: bi810_getStatus, getConnection: bi810_getConnection, listModes: bi810_listModes, findBySize: bi810_findBySize, findByOverscan: bi810_findByOverscan, initSharedView: bnull_initSharedView, getTwinView: bnull_getTwinView, adjustViewport: bnull_adjustViewport, serviceViewportCursor: bnull_serviceViewportCursor, }; nvtv-0.4.7/src/back_null.c0000644000175000001440000001650610005515125011063 /* NVTV null backend -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_null.c,v 1.27 2004/01/27 17:05:25 dthierbach Exp $ * * Contents: * * Null backend for testing/debugging/calculating without hardware present. * */ #include "local.h" /* before everything else */ #include "backend.h" #include "back_null.h" #include "data.h" static ChipInfo null_chip_nx = { name: " (6:00)", type: TV_NVIDIA, bus:6, addr:0x00, next: NULL }; static ChipInfo null_chip_ph2 = { name: " (5:8a)", type: TV_PHILIPS_MODEL2, bus:5, addr:0x8a, next: &null_chip_nx }; static ChipInfo null_chip_ph1 = { name: " (4:8a)", type: TV_PHILIPS_MODEL1, bus:4, addr:0x8a, next: &null_chip_ph2 }; static ChipInfo null_chip_ch2 = { name: " (3:ec)", type: TV_CHRONTEL_MODEL2, bus:3, addr:0xec, next: &null_chip_ph1 }; static ChipInfo null_chip_ch1 = { name: " (2:ea)", type: TV_CHRONTEL_MODEL1, bus:2, addr:0xea, next: &null_chip_ch2 }; static ChipInfo null_chip_cx = { name: " (1:8a)", type: TV_CONEXANT, bus:1, addr:0x8a, next: &null_chip_ch1 }; static ChipInfo null_chip_bt = { name: " (0:88)", type: TV_BROOKTREE, bus:0, addr:0x88, next: &null_chip_cx }; #define null_chips null_chip_bt static CardInfo null_i810_card = { name: "", type: CARD_I810, dev:NULL, reg_base:0x0, pci_id:0x7121, arch: "No Architecture", chips: &null_chips, next: NULL }; static CardInfo null_tdfx_card = { name: "", type: CARD_TDFX, dev:NULL, reg_base:0x0, pci_id:0x0005, arch: "No Architecture", chips: &null_chips, next: &null_i810_card }; static CardInfo null_xbox_card = { name: "", type: CARD_XBOX, dev:NULL, reg_base:0x0, pci_id:0x02A0, arch: "No Architecture", chips: &null_chips, next: &null_tdfx_card }; static CardInfo null_nv_card = { name: "", type: CARD_NVIDIA, dev:NULL, reg_base:0x0, pci_id:0x0110, arch: "No Architecture", chips: &null_chips, next: &null_xbox_card }; #define null_cards null_nv_card static DataFunc *bnull_data = NULL; static CardPtr bnull_card = NULL; void bnull_openCard (CardPtr card) { RAISE (MSG_DEBUG, "bnull_open"); bnull_card = card; bnull_data = data_func (card->type, card->chips->type); } void bnull_closeCard (void) { RAISE (MSG_DEBUG, "bnull_close"); } #ifdef DEBUG_PROBE void bnull_probeSystem (CardPtr card_list) { RAISE (MSG_DEBUG, "bnull_probeSystem"); } void bnull_probeCard (void) { RAISE (MSG_DEBUG, "bnull_probeCard"); } I2CChainPtr bnull_probeBus (void) { RAISE (MSG_DEBUG, "bnull_probeBus"); return NULL; } #endif void bnull_setHeads (int main, int tv, int video) { RAISE (MSG_DEBUG, "bnull_setHeads"); } void bnull_getHeads (int *main, int *tv, int *video, int *max) { RAISE (MSG_DEBUG, "bnull_getHeads"); if (max) *max = 2; } void bnull_getHeadDev (int head, int *devFlags) { RAISE (MSG_DEBUG, "bnull_getHeadDev"); if (devFlags) *devFlags = DEV_MONITOR; } void bnull_probeChips (void) { RAISE (MSG_DEBUG, "bnull_probe"); if (bnull_card) { bnull_data = data_func (bnull_card->type, bnull_card->chips->type); } else { bnull_data = &null_func; } } void bnull_setChip (ChipPtr chip, Bool init) { RAISE (MSG_DEBUG, "bnull_setChip %s %i", chip->name, init); bnull_data = data_func (bnull_card->type, chip->type); } void bnull_setSettings (TVSettings *set) { RAISE (MSG_DEBUG, "bnull_setSettings"); } void bnull_getSettings (TVSettings *set) { RAISE (MSG_DEBUG, "bnull_getSettings"); } void bnull_setMode (TVRegs *r) { RAISE (MSG_DEBUG, "bnull_setMode"); } void bnull_getMode (TVRegs *r) { RAISE (MSG_DEBUG, "bnull_getMode"); } void bnull_setModeSettings (TVRegs *r, TVSettings *set) { RAISE (MSG_DEBUG, "bnull_setModeSettings"); } void bnull_setTestImage (TVEncoderRegs *tv, TVSettings *set) { RAISE (MSG_DEBUG, "bnull_setTestImage"); } long bnull_getStatus (int index) { RAISE (MSG_DEBUG, "bnull_getStatus"); return 0; } TVConnect bnull_getConnection (void) { RAISE (MSG_DEBUG, "bnull_getConnection"); return CONNECT_NONE; } int bnull_listModes (TVSystem system, TVMode *(list[])) { return data_listModes (bnull_data->modes (), system, list); } Bool bnull_findBySize (TVSystem system, int xres, int yres, char *size, TVMode *mode) { TVMode *tvm; RAISE (MSG_DEBUG, "bnull_findBySize %i %i,%i %s", system, xres, yres, size); /* FIXME: All cards */ tvm = data_find (bnull_data->modes (), system, xres, yres, size); if (!tvm) return FALSE; *mode = *tvm; return TRUE; } Bool bnull_findByOverscan (TVSystem system, int xres, int yres, double hoc, double voc, TVMode *mode) { RAISE (MSG_DEBUG, "bnull_findByOC %i %i,%i", system, xres, yres); return FALSE; } void bnull_initSharedView (int *view_x, int *view_y) { *view_x = *view_y = 0; } Bool bnull_getTwinView (int *view_x, int *view_y) { *view_x = *view_y = 0; return FALSE; } Bool bnull_adjustViewport (int flags, int *view_x, int *view_y) { *view_x = *view_y = 0; return FALSE; } Bool bnull_serviceViewportCursor (int flags, int cursor_x, int cursor_y, int *view_x, int *view_y) { *view_x = *view_y = 0; return FALSE; } BackAccessRec bnull_access_func = { openCard: bnull_openCard, closeCard: bnull_closeCard, #ifdef DEBUG_PROBE probeSystem: bnull_probeSystem, #endif }; BackCardRec bnull_card_func = { openCard: bnull_openCard, closeCard: bnull_closeCard, #ifdef DEBUG_PROBE probeCard: bnull_probeCard, probeBus: bnull_probeBus, #endif setHeads: bnull_setHeads, getHeads: bnull_getHeads, getHeadDev: bnull_getHeadDev, probeChips: bnull_probeChips, setChip: bnull_setChip, setSettings: bnull_setSettings, getSettings: bnull_getSettings, setMode: bnull_setMode, getMode: bnull_getMode, setModeSettings: bnull_setModeSettings, setTestImage: bnull_setTestImage, getStatus: bnull_getStatus, getConnection: bnull_getConnection, listModes: bnull_listModes, findBySize: bnull_findBySize, findByOverscan: bnull_findByOverscan, initSharedView: bnull_initSharedView, getTwinView: bnull_getTwinView, adjustViewport: bnull_adjustViewport, serviceViewportCursor: bnull_serviceViewportCursor, }; CardPtr back_null_init (void) { back_access = &bnull_access_func; back_card = &bnull_card_func; return &null_cards; } nvtv-0.4.7/src/back_unix.c0000644000175000001440000000602007654516251011103 /* NVTV unix direct backend -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_unix.c,v 1.2 2003/05/02 16:28:25 dthierbach Exp $ * * Contents: * * Backend for direct access of the card unter Unix * */ #include "local.h" /* before everything else */ #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #include #include "backend.h" #include "back_direct.h" #include "card_direct.h" /* -------- Root backend -------- */ static CardPtr card_root_list = NULL; /* * Check if root access is possible. */ Bool back_root_avail (void) { if (getuid() != 0 || geteuid() != 0 ) return FALSE; return TRUE; } /* * Find all cards in system, and return list. */ CardPtr back_root_init (void) { back_access = &bdir_func; if (card_root_list) return card_root_list; /* only probe once, and never free card_root_list once allocated. */ scan_cards_pci (&card_root_list, DEV_MEM); return card_root_list; } /* -------- nvdev backend -------- */ static CardPtr card_nvdev_list = NULL; /* Check if /dev/nvidiactl is accessible, and if the kernel module * is already in use (hopefully by the XFree 'nvdriver' module). */ Bool back_nvdev_avail (Bool force) { FILE *f; int fd; char mod[80]; int size, count; Bool ok; /* Better check /proc/modules first, because access /dev/nvidiactrl may autoload kernel module */ if ((f = fopen ("/proc/modules", "r"))) { ok = FALSE; while (! feof(f)) { fscanf (f, "%80s %i %i", mod, &size, &count); while (! feof(f) && fgetc(f) != '\n'); if ((strcmp ("NVdriver", mod) == 0 || strcmp ("nvidia", mod) == 0) && count > 0) { ok = TRUE; break; } } fclose (f); if (!ok) return FALSE; } else { if (!force) { fprintf (stderr, "Cannot open /proc/modules, won't allow nvdev access.\n"); return FALSE; } } if ((fd = open (DEV_NVCTL, O_RDWR, 0)) < 0) return FALSE; close (fd); return TRUE; } CardPtr back_nvdev_init (void) { back_access = &bdir_func; if (card_nvdev_list) return card_nvdev_list; /* only probe once, and never free card_nvdev_list once allocated. */ scan_cards_nvdev (&card_nvdev_list); return card_nvdev_list; } nvtv-0.4.7/src/back_winio.c0000755000175000001440000000415507741555571011264 /* NVTV MS-Windows card access -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_winio.c,v 1.2 2003/10/10 16:16:57 dthierbach Exp $ * * Contents: * * Access the graphics card under MS-Windows via WinIo. * * For now, we use an alternative file to back_mswin and change card_direct * via the HAVE_WINIO define. This is ugly, and eventually back_mswin and * back_winio should be merged. * */ /* FIXME Version with WinIo */ /* Option: Use dlltool: dlltool --dllname WinIo.dll --def /cygdrive/c/EXTRA/WinIo/Source/Dll/WinIo.def --output-lib WinIoCygwin.lib to create lib file, then don't use _declspec and _stdcall, and link with it. */ #define INT32 XXX /* Hack to escape redefinition of INT32 */ #include #undef INT32 #include "local.h" /* before everything else */ #include #include "backend.h" #include "back_direct.h" #include "card_direct.h" /* -------- WinIO backend -------- */ static CardPtr card_winio_list = NULL; /* * Check if driver access is possible. */ Bool back_win_avail (void) { return TRUE; } /* * Find all cards in system, and return list. */ CardPtr back_win_init (void) { back_access = &bdir_func; if (card_winio_list) return card_winio_list; /* only probe once, and never free card_winio_list once allocated. */ scan_cards_pci (&card_winio_list, DEV_WINIO); return card_winio_list; } nvtv-0.4.7/src/back_mswin.c0000644000175000001440000001133107741555571011263 /* NVTV MS-Windows card access -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_mswin.c,v 1.5 2003/10/10 16:16:57 dthierbach Exp $ * * Contents: * * Access the graphics card under MS-Windows via the driver. * */ #define INT32 XXX /* Hack to escape redefinition of INT32 */ #include #undef INT32 #include "local.h" /* before everything else */ #include #include "backend.h" #include "back_direct.h" /* -------- Fake memory mapping -------- */ /* FIXME: Should probably be in extra file that replaces card_direct */ int openDevMem (CardPtr card) { return 1; } void closeDevMem (int fd) { } void *mapDevMem (int fd, unsigned long Base, unsigned long Size) { return (void *) Base; } void unmapDevMem (unsigned long Base, unsigned long Size) { } /* -------- Quick'n'dirty routines to access driver -------- */ static BOOLEAN (__stdcall *NvIoControl)(ULONG code, ULONG *params) = NULL; static ULONG gClientContext = 0, gDeviceContext = 0xDABBAD00L; static char gDeviceName[128] = "Display"; ULONG Nv01AllocRoot(ULONG *ClientContext) { ULONG params[3]; params[1] = 0; NvIoControl(1, params); *ClientContext = params[0]; return params[2]; } ULONG Nv01AllocDevice(ULONG ClientContext, ULONG DeviceContext, ULONG DeviceNameLen, char *DeviceName) { ULONG params[5]; params[0] = ClientContext; params[1] = DeviceContext; params[2] = DeviceNameLen; params[3] = (ULONG) DeviceName; NvIoControl(6, params); return params[4]; } ULONG Nv01Free(ULONG int1, ULONG int2, ULONG int3) { ULONG params[4]; params[0] = int1; params[1] = int2; params[2] = int3; NvIoControl(0, params); return params[3]; } ULONG Nv01ConfigGet(ULONG code) { ULONG params[5]; params[0] = gClientContext; params[1] = gDeviceContext; params[2] = code; NvIoControl(0x0d, params); return params[3]; } ULONG Nv04ConfigGetEx(ULONG code, void *ioparams, ULONG ioparamssize) { ULONG params[6]; params[0] = gClientContext; params[1] = gDeviceContext; params[2] = code; params[3] = (ULONG)ioparams; params[4] = ioparamssize; NvIoControl(0x11, params); return params[5]; } /* -------- MS-Windows backend -------- */ static CardInfo card_win_rec = { next: NULL, name: "Card", dev: "Dev", arch: "Arch", type: CARD_NVIDIA, reg_base: 0, pio_base: 0, addr_bus:0, addr_slot:0, addr_func: 0, pci_id: 0, chips: NULL }; static HINSTANCE card_win_lib; /* * Check if driver access is possible. */ Bool back_win_avail (void) { /* FIXME for multiple calls */ card_win_lib = LoadLibrary("NVARCH32.DLL"); if (!card_win_lib) { fprintf (stderr, "Cannot load NVARCH32.DLL. Do you have the NVIDIA driver installed?\n"); /* FIXME Use GetLastError */ return FALSE; } NvIoControl = (BOOLEAN (__stdcall *)(ULONG, ULONG *)) GetProcAddress(card_win_lib, "NvIoControl"); if (!NvIoControl) { fprintf (stderr, "Cannot get NvIoControl address. Maybe the driver has the wrong version?\n"); /* FIXME Use GetLastError */ return FALSE; } return TRUE; } /* * Find all cards in system, and return list. */ CardPtr back_win_init (void) { unsigned long reg_phys, reg_virt, pci_id; Nv01AllocRoot(&gClientContext); Nv01AllocDevice(gClientContext, gDeviceContext, 128, gDeviceName); reg_virt = Nv01ConfigGet(0x009); reg_phys = Nv01ConfigGet(0x00a); pci_id = Nv01ConfigGet(0x00d); Nv01Free(gClientContext, gClientContext, gClientContext); printf ("virt=%08lX phys=%08lX\n", reg_virt, reg_phys); card_win_rec.reg_base = reg_virt; card_win_rec.pci_id = (pci_id >> 16) & 0xffff; back_access = &bdir_func; return &card_win_rec; } /* FIXME FreeLibrary(card_win_lib); leaks if not used? */ /* FIXME EnumDisplaySettingsA, ChangeDisplaySettingsA, CharNextA, SetWindowLongA */ /* Alternative: Use DPMI (Dos Protected Mode Interface), INT 31h, only available for 16bit code. In WDM, there are _REGISTER_ _PORT_ macros For Win NT, there are ... display/mini/s3v uses 16bit DPMI and passes MMIOBASE on to 32bit */ nvtv-0.4.7/src/back_client.c0000644000175000001440000003174007741555571011412 /* NVTV client backend -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_client.c,v 1.22 2003/10/10 16:16:57 dthierbach Exp $ * * Contents: * * Client backend for accessing the server * */ #include "local.h" /* before everything else */ #include /* for free */ #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #include #include "backend.h" #include "back_client.h" #include "pipe.h" /* -------- State -------- */ static FILE *pipe_in = NULL; static FILE *pipe_out = NULL; static CardPtr bcl_root = NULL; static CardPtr bcl_card = NULL; /* -------- String pool -------- */ /* * Add string to pool, and free original if already in pool. */ static int pool_size = 0; static char** pool_list = NULL; char* pool_addFree (char *s) { int l, r, i; RAISE (MSG_DEBUG, "pool %s ", s); if (!s) return NULL; l = 0; r = pool_size-1; while (l <= r) { register int c; i = (l + r) / 2; c = strcmp (s, pool_list[i]); if (c < 0) r = i-1; else if (c > 0) l = i+1; else { RAISE (MSG_DEBUG, "found"); xfree (s); return pool_list [i]; } } /* Must insert between r and l */ #if 0 if (r < 0) r = 0; /* sanitize for debug messages */ if (pool_list && r >= 0) RAISE (MSG_DEBUG, " %i=%s ", r, pool_list[r]); RAISE (MSG_DEBUG, "*"); if (pool_list && l < pool_size) RAISE (MSG_DEBUG, " %i=%s ", l, pool_list[l]); #endif pool_size++; pool_list = xrealloc (pool_list, pool_size * sizeof (char *)); i = l+1; if (pool_size > 1) { memmove (pool_list+i, pool_list+l, (pool_size-i) * sizeof(char *)); } pool_list[l] = s; return s; } /* -------- Driver routines -------- */ void bcl_openPipes (void) { /* IMPORTANT: Open out pipe first, otherwise deadlock */ pipe_out = fopen (PIPE_OUT, "w"); pipe_in = fopen (PIPE_IN, "r"); } void bcl_closePipes (void) { fclose (pipe_in ); fclose (pipe_out); } void bcl_openCard (CardPtr card) { CardPtr c; int i, index; RAISE (MSG_DEBUG, "bcl_open"); bcl_card = card; bcl_openPipes (); /* convert card to index */ i = index = 0; for (c = bcl_root; c; c = c->next) { i++; if (c == card) index = i; } pipeWriteCmd (pipe_out, PCmd_OpenCard); pipeWriteArgs (pipe_out, 1, sizeof(index), &index); pipeReadCmd (pipe_in); bcl_card->chips = pipeReadList (pipe_in, sizeof (ChipInfo)); } void bcl_closeCard (void) { RAISE (MSG_DEBUG, "bcl_close"); pipeWriteCmd (pipe_out, PCmd_CloseCard); pipeWriteArgs (pipe_out, 0); bcl_closePipes (); } void bcl_setHeads (int main, int tv, int video) { RAISE (MSG_DEBUG, "bcl_setHeads %i %i %i", main, tv, video); pipeWriteCmd (pipe_out, PCmd_SetHeads); pipeWriteArgs (pipe_out, 3, sizeof(int), &main, sizeof(int), &tv, sizeof(int), &video); } void bcl_getHeads (int *main, int *tv, int *video, int *max) { RAISE (MSG_DEBUG, "bcl_getHeads"); pipeWriteCmd (pipe_out, PCmd_GetHeads); pipeWriteArgs (pipe_out, 0); pipeReadCmd (pipe_in); pipeReadArgs (pipe_in, 4, sizeof(int), main, sizeof(int), tv, sizeof(int), video, sizeof(int), max); } void bcl_getHeadDev (int head, int *devFlags) { RAISE (MSG_DEBUG, "bcl_getHeadDev"); pipeWriteCmd (pipe_out, PCmd_GetHeadDev); pipeWriteArgs (pipe_out, 1, sizeof (head), &head); pipeReadCmd (pipe_in); pipeReadArgs (pipe_in, 1, sizeof(int), devFlags); } void bcl_probeChips (void) { ChipPtr chip, del; RAISE (MSG_DEBUG, "bcl_probe"); chip = bcl_card->chips; while (chip) { del = chip; chip = chip->next; free (del->name); free (del); } pipeWriteCmd (pipe_out, PCmd_ProbeChips); pipeWriteArgs (pipe_out, 0); pipeReadCmd (pipe_in); bcl_card->chips = pipeReadList (pipe_in, sizeof (ChipInfo)); } void bcl_setChip (ChipPtr chip, Bool init) { ChipPtr c; int i, index; RAISE (MSG_DEBUG, "bcl_setChip %s %i", chip->name, init); /* convert chip to index */ i = index = 0; for (c = bcl_card->chips; c; c = c->next) { i++; if (c == chip) index = i; } pipeWriteCmd (pipe_out, PCmd_SetChip); pipeWriteArgs (pipe_out, 2, sizeof(index), &index, sizeof(init), &init); } void bcl_setSettings (TVSettings *set) { RAISE (MSG_DEBUG, "bcl_setSettings"); pipeWriteCmd (pipe_out, PCmd_SetSettings); pipeWriteArgs (pipe_out, 1, sizeof(TVSettings), set); } void bcl_getSettings (TVSettings *set) { RAISE (MSG_DEBUG, "bcl_getSettings"); pipeWriteCmd (pipe_out, PCmd_GetSettings); pipeWriteArgs (pipe_out, 0); pipeReadCmd (pipe_in); pipeReadArgs (pipe_in, 1, sizeof(TVSettings), set); } void bcl_setMode (TVRegs *regs) { RAISE (MSG_DEBUG, "bcl_setMode"); pipeWriteCmd (pipe_out, PCmd_SetMode); pipeWriteArgs (pipe_out, 1, sizeof(TVRegs), regs); } void bcl_getMode (TVRegs *regs) { RAISE (MSG_DEBUG, "bcl_getMode"); pipeWriteCmd (pipe_out, PCmd_GetMode); pipeWriteArgs (pipe_out, 0); pipeReadCmd (pipe_in); pipeReadArgs (pipe_in, 1, sizeof(TVRegs), regs); } void bcl_setModeSettings (TVRegs *regs, TVSettings *set) { RAISE (MSG_DEBUG, "bcl_setModeSettings"); pipeWriteCmd (pipe_out, PCmd_SetModeSettings); pipeWriteArgs (pipe_out, 2, sizeof(TVRegs), regs, sizeof(TVSettings), set); } void bcl_setTestImage (TVEncoderRegs *tv, TVSettings *set) { RAISE (MSG_DEBUG, "bcl_setTestImage"); pipeWriteCmd (pipe_out, PCmd_SetTestImage); pipeWriteArgs (pipe_out, 2, sizeof(TVEncoderRegs), tv, sizeof(TVSettings), set); } long bcl_getStatus (int index) { long l; RAISE (MSG_DEBUG, "bcl_getStatus"); pipeWriteCmd (pipe_out, PCmd_GetStatus); pipeWriteArgs (pipe_out, 1, sizeof(index), &index); pipeReadCmd (pipe_in); pipeReadArgs (pipe_in, 1, sizeof(l), &l); return l; } TVConnect bcl_getConnection (void) { TVConnect c; RAISE (MSG_DEBUG, "bcl_getConnection"); pipeWriteCmd (pipe_out, PCmd_GetConnection); pipeWriteArgs (pipe_out, 0); pipeReadCmd (pipe_in); pipeReadArgs (pipe_in, 1, sizeof(c), &c); RAISE (MSG_DEBUG, "bcl_getConnection got %i", c); return c; } int bcl_listModes (TVSystem system, TVMode *(list[])) { TVMode *m, *r; int n, i, c; RAISE (MSG_DEBUG, "bcl_listModes %i", system); pipeWriteCmd (pipe_out, PCmd_ListModes); pipeWriteArgs (pipe_out, 1, sizeof(system), &system); pipeReadCmd (pipe_in); pipeReadArray (pipe_in, &c); m = r = xcalloc (sizeof (TVMode), c); *list = r; for (i = 1; i <= c; i++, m++) { n = pipeReadArgs (pipe_in, 3, sizeof(TVMode), m, 0, &m->spec.size, 0, &m->spec.aspect); /* assert n == 3 */ m->spec.size = pool_addFree (m->spec.size); m->spec.aspect = pool_addFree (m->spec.aspect); } return c; } Bool bcl_findBySize (TVSystem system, int xres, int yres, char *size, TVMode *mode) { int n; RAISE (MSG_DEBUG, "bcl_findBySize %i %i,%i %s", system, xres, yres, size); pipeWriteCmd (pipe_out, PCmd_FindBySize); pipeWriteArgs (pipe_out, 4, sizeof(system), &system, sizeof(xres), &xres, sizeof(yres), &yres, strlen(size)+1, size); pipeReadCmd (pipe_in); mode->spec.size = mode->spec.aspect = NULL; n = pipeReadArgs (pipe_in, 3, sizeof(TVMode), mode, 0, &mode->spec.size, 0, &mode->spec.aspect); mode->spec.size = pool_addFree (mode->spec.size); mode->spec.aspect = pool_addFree (mode->spec.aspect); return (n >= 3); } Bool bcl_findByOverscan (TVSystem system, int xres, int yres, double hoc, double voc, TVMode *mode) { int n; RAISE (MSG_DEBUG, "bcl_findByOC %i %i,%i", system, xres, yres); pipeWriteCmd (pipe_out, PCmd_FindByOverscan); pipeWriteArgs (pipe_out, 5, sizeof(system), &system, sizeof(xres), &xres, sizeof(yres), &yres, sizeof(hoc), &hoc, sizeof(voc), &voc); pipeReadCmd (pipe_in); mode->spec.size = mode->spec.aspect = NULL; n = pipeReadArgs (pipe_in, 3, sizeof(TVMode), mode, 0, &mode->spec.size, 0, &mode->spec.aspect); mode->spec.size = pool_addFree (mode->spec.size); mode->spec.aspect = pool_addFree (mode->spec.aspect); return (n >= 3); } void bcl_initSharedView (int *view_x, int *view_y) { RAISE (MSG_DEBUG, "bcl_initSharedView"); pipeWriteCmd (pipe_out, PCmd_InitSharedView); pipeWriteArgs (pipe_out, 0); pipeReadCmd (pipe_in); pipeReadArgs (pipe_in, 2, sizeof(int), view_x, sizeof(int), view_y); } Bool bcl_getTwinView (int *view_x, int *view_y) { Bool result; RAISE (MSG_DEBUG, "bcl_getTwinVie"); pipeWriteCmd (pipe_out, PCmd_GetTwinView); pipeWriteArgs (pipe_out, 0); pipeReadCmd (pipe_in); pipeReadArgs (pipe_in, 3, sizeof(Bool), &result, sizeof(int), view_x, sizeof(int), view_y); return result; } Bool bcl_adjustViewport (int flags, int *view_x, int *view_y) { Bool result; RAISE (MSG_DEBUG, "bcl_adjustViewport"); pipeWriteCmd (pipe_out, PCmd_AdjustView); pipeWriteArgs (pipe_out, 3, sizeof(int), &flags, sizeof(int), view_x, sizeof(int), view_y); pipeReadCmd (pipe_in); pipeReadArgs (pipe_out, 3, sizeof(int), &result, sizeof(int), view_x, sizeof(int), view_y); return result; } Bool bcl_serviceViewportCursor (int flags, int cursor_x, int cursor_y, int *view_x, int *view_y) { Bool result; RAISE (MSG_DEBUG, "bcl_serviceViewportCursor"); pipeWriteCmd (pipe_out, PCmd_ServiceVC); pipeWriteArgs (pipe_out, 5, sizeof(int), &flags, sizeof(int), &cursor_x, sizeof(int), &cursor_y, sizeof(int), view_x, sizeof(int), view_y); pipeReadCmd (pipe_in); pipeReadArgs (pipe_out, 3, sizeof(int), &result, sizeof(int), view_x, sizeof(int), view_y); return result; } /* We cannot reuse the bnull functions here, because that would require * the client library to include a lot more files. */ #ifdef DEBUG_PROBE void bcl_probeSystem (CardPtr card_list) { RAISE (MSG_DEBUG, "bcl_probeSystem"); } void bcl_probeCard (void) { RAISE (MSG_DEBUG, "bcl_probeCard"); } I2CChainPtr bcl_probeBus (void) { RAISE (MSG_DEBUG, "bcl_probeBus"); return NULL; } #endif BackAccessRec bcl_access_func = { openCard: bcl_openCard, closeCard: bcl_closeCard, #ifdef DEBUG_PROBE probeSystem: bcl_probeSystem, #endif }; BackCardRec bcl_card_func = { openCard: bcl_openCard, closeCard: bcl_closeCard, #ifdef DEBUG_PROBE probeCard: bcl_probeCard, probeBus: bcl_probeBus, #endif setHeads: bcl_setHeads, getHeads: bcl_getHeads, getHeadDev: bcl_getHeadDev, probeChips: bcl_probeChips, setChip: bcl_setChip, setSettings: bcl_setSettings, getSettings: bcl_getSettings, setMode: bcl_setMode, getMode: bcl_getMode, setModeSettings: bcl_setModeSettings, setTestImage: bcl_setTestImage, getStatus: bcl_getStatus, getConnection: bcl_getConnection, listModes: bcl_listModes, findBySize: bcl_findBySize, findByOverscan: bcl_findByOverscan, initSharedView: bcl_initSharedView, getTwinView: bcl_getTwinView, adjustViewport: bcl_adjustViewport, serviceViewportCursor: bcl_serviceViewportCursor, }; /* -------- Init -------- */ Bool back_client_avail (void) { int version; int fd_out, fd_in; /* IMPORTANT: Open out pipe first, otherwise deadlock */ fd_out = open (PIPE_OUT, O_WRONLY | O_NONBLOCK); if (fd_out < 0) return FALSE; fd_in = open (PIPE_IN, O_RDONLY | O_NONBLOCK); if (fd_in < 0) { close (fd_out); return FALSE; } close (fd_in); close (fd_out); bcl_openPipes (); if (!pipe_in || !pipe_out) { /* FIXME TODO: error message */ bcl_closePipes (); return FALSE; } pipeWriteCmd (pipe_out, PCmd_Version); pipeWriteArgs (pipe_out, 0); pipeReadCmd (pipe_in); pipeReadArgs (pipe_in, 1, sizeof(version), &version); bcl_closePipes (); if (version != PIPE_VERSION) RAISE (MSG_ABORT, "Server protocol version mismatch."); return (version == PIPE_VERSION); } CardPtr back_client_init (void) { CardPtr card; back_access = &bcl_access_func; back_card = &bcl_card_func; bcl_openPipes (); pipeWriteCmd (pipe_out, PCmd_Init); pipeWriteArgs (pipe_out, 0); bcl_root = pipeReadList (pipe_in, sizeof (CardInfo)); bcl_card = bcl_root; bcl_closePipes (); for (card = bcl_card; card; card = card->next) { card->dev = ""; card->arch = ""; card->chips = NULL; card->dev = NULL; card->reg_mapped = NULL; } return bcl_root; } nvtv-0.4.7/src/actions.c0000644000175000001440000002215307734027252010602 /* NVTV actions -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * Contents: X actions. Requires HAVE_X * */ #include "local.h" /* before everything else */ #ifndef HAVE_X #error "actions.c requires X" #endif #include #ifdef HAVE_UNISTD_H #include #endif #include #include #include #include #include "actions.h" /* -------- X Actions -------- */ /* Minimum vidmode extension version required */ #define MINMAJOR 0 #define MINMINOR 5 inline int sqr (int arg) { return arg * arg; } Bool has_vidmode (Display *display) { static int vidmode = 0; int MajorVersion, MinorVersion; int EventBase, ErrorBase; while (vidmode == 0) { if (!XF86VidModeQueryVersion (display, &MajorVersion, &MinorVersion)) { fprintf(stderr, "Unable to query video extension version\n"); vidmode = -1; break; } if (!XF86VidModeQueryExtension(display, &EventBase, &ErrorBase)) { fprintf(stderr, "Unable to query video extension information\n"); vidmode = -1; break; } /* Fail if the extension version in the server is too old */ if (MajorVersion < MINMAJOR || (MajorVersion == MINMAJOR && MinorVersion < MINMINOR)) { fprintf(stderr, "Xserver is running an old XFree86-VidModeExtension version" " (%d.%d)\n", MajorVersion, MinorVersion); fprintf(stderr, "Minimum required version is %d.%d\n", MINMAJOR, MINMINOR); vidmode = -1; break; } vidmode = 1; break; } if (vidmode > 0) return TRUE; else return FALSE; } /* get all modelines only once, so we don't have to free them */ int vidmodelines (Display *display, int screen, XF86VidModeModeInfo ***info) { static XF86VidModeModeInfo **modesinfo = NULL; static int modecount = 0; if (!modesinfo) { XF86VidModeGetAllModeLines (display, screen, &modecount, &modesinfo); } *info = modesinfo; return modecount; } void switch_vidmode (Display *display, int screen, int res_x, int res_y) { XF86VidModeModeInfo **modesinfo; int modecount; int i; int dist; int best_dist = -1; int best_index = -1; RAISE (MSG_DEBUG, "vidmode %i %i", res_x, res_y); if (!has_vidmode (display)) return; modecount = vidmodelines (display, screen, &modesinfo); for (i = 0; i < modecount; i++) { dist = sqr(modesinfo [i]->hdisplay - res_x) + sqr(modesinfo [i]->vdisplay - res_y); if (modesinfo [i]->hdisplay < res_x || modesinfo [i]->vdisplay < res_y) { dist = -1; } if (dist >= 0 && (dist < best_dist || best_dist == -1)) { best_dist = dist; best_index = i; } } if (best_dist >= 0) { RAISE (MSG_DEBUG, "vidmode switch %i", best_index); XF86VidModeSwitchToMode (display, screen, modesinfo [best_index]); } } /* * Find X video mode with given resolution */ Bool find_vidmode (Display *display, int screen, int res_x, int res_y, TVCrtcRegs *crt, make_vidmode make) { XF86VidModeModeInfo **modesinfo; int modecount; int i; if (!has_vidmode (display)) return FALSE; modecount = vidmodelines (display, screen, &modesinfo); for (i = 0; i < modecount; i++) { if (modesinfo [i]->hdisplay == res_x && modesinfo [i]->vdisplay == res_y) break; } if (i >= modecount) return FALSE; make (modesinfo [i]->hdisplay, modesinfo [i]->hsyncstart, modesinfo [i]->hsyncend, modesinfo [i]->htotal, modesinfo [i]->vdisplay, modesinfo [i]->vsyncstart, modesinfo [i]->vsyncend, modesinfo [i]->vtotal, modesinfo [i]->dotclock, crt); return TRUE; } /* * get current X video mode */ Bool get_vidmode (Display *display, int screen, int *res_x, int *res_y, TVCrtcRegs *crt, make_vidmode make) { XF86VidModeModeLine modeline; int dotclock; if (!has_vidmode (display)) return FALSE; XF86VidModeGetModeLine (display, screen, &dotclock, &modeline); if (res_x) *res_x = modeline.hdisplay; if (res_y) *res_y = modeline.vdisplay; make (modeline.hdisplay, modeline.hsyncstart, modeline.hsyncend, modeline.htotal, modeline.vdisplay, modeline.vsyncstart, modeline.vsyncend, modeline.vtotal, dotclock, crt); return TRUE; } void center_window (Display *display, int screen, Window window, int res_x, int res_y) { Window root; int x, y; unsigned width, height, borderw, depth; unsigned disp_w, disp_h; int screen_w, screen_h; int rx, ry; Window junkwin; int junkint; XF86VidModeModeLine modeline; RAISE (MSG_DEBUG, "center 0x%lx %i,%i", window, res_x, res_y); if (window == None || !has_vidmode (display)) return; XGetGeometry (display, window, &root, &x, &y, &width, &height, &borderw, &depth); (void) XTranslateCoordinates (display, window, root, 0, 0, &rx, &ry, &junkwin); if (res_x >= 0 && res_y >= 0) { disp_w = res_x; disp_h = res_y; } else { XF86VidModeGetModeLine (display, screen, &junkint, &modeline); if (modeline.privsize > 0) XFree(modeline.private); disp_w = modeline.hdisplay; disp_h = modeline.vdisplay; } screen_w = DisplayWidth (display, screen); screen_h = DisplayHeight (display, screen); x = rx + ((int) width - (int) disp_w) / 2; y = ry + ((int) height - (int) disp_h) / 2; if (x < 0) x = 0; if (y < 0) y = 0; if (x > screen_w) x = screen_w; if (y > screen_h) y = screen_h; XF86VidModeSetViewPort (display, screen, x, y); XWarpPointer (display, None, window, 0, 0, 0, 0, width / 2, height / 2); /* FIXME TODO: Better, disable the pointer by setting an empty pixmap or grabbing it, and restore image on leave event or on the next mouse event. Will work only in interactive (gui) mode! */ } /* -------- dsimple.c -------- */ /* This is are (slightly modified) routines from programs/xlsfonts/dsimple.c * in the XFree sources, written by Mark Lillibridge. */ #define Fatal_Error(X) { fprintf(stderr, X); exit (1); } Window Select_Window (Display *dpy, int screen) { int status; Cursor cursor; XEvent event; Window target_win = None, root = RootWindow(dpy,screen); int buttons = 0; /* Make the target cursor */ cursor = XCreateFontCursor(dpy, XC_crosshair); /* Grab the pointer using target cursor, letting it room all over */ status = XGrabPointer(dpy, root, False, ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, root, cursor, CurrentTime); if (status != GrabSuccess) Fatal_Error("Can't grab the mouse."); /* Let the user select a window... */ while ((target_win == None) || (buttons != 0)) { /* allow one more event */ XAllowEvents(dpy, SyncPointer, CurrentTime); XWindowEvent(dpy, root, ButtonPressMask|ButtonReleaseMask, &event); switch (event.type) { case ButtonPress: if (target_win == None) { target_win = event.xbutton.subwindow; /* window selected */ if (target_win == None) target_win = root; } buttons++; break; case ButtonRelease: if (buttons > 0) /* there may have been some down before we started */ buttons--; break; } } XUngrabPointer(dpy, CurrentTime); /* Done with pointer */ return(target_win); } /* * Window_With_Name: routine to locate a window with a given name on a display. * If no window with the given name is found, 0 is returned. * If more than one window has the given name, the first * one found will be returned. Only top and its subwindows * are looked at. Normally, top should be the RootWindow. */ Window Window_With_Name (Display *dpy, Window top, char *name) { Window *children, dummy; unsigned int nchildren; int i; Window w = None; char *window_name; if (XFetchName(dpy, top, &window_name) && !strcmp(window_name, name)) return(top); if (!XQueryTree(dpy, top, &dummy, &dummy, &children, &nchildren)) return None; for (i=0; i * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * I2C-related by code - Andy Green * * Adapted for nvtv - "Milosch Meriac" * */ #include #include "local.h" #include "xbox.h" /* FIXME TODO Can the IO_BASE be read from the PCI registers? */ const unsigned short I2C_IO_BASE=0xC000; inline void IoOutputWord(unsigned short Port,unsigned short Data) { outw(Data,I2C_IO_BASE+Port); }; inline void IoOutputByte(unsigned short Port,unsigned char Data) { outb(Data,I2C_IO_BASE+Port); }; inline unsigned short IoInputWord(unsigned short Port) { return inw(I2C_IO_BASE+Port); }; inline unsigned char IoInputByte(unsigned short Port) { return inb(I2C_IO_BASE+Port); }; // ---------------------------- I2C ----------------------------------------------------------- // // get a value from a given device address // errors will have b31 set, ie, will be negative, otherwise fetched byte in LSB of return int I2CTransmitCmdGetReturn(unsigned char bPicAddressI2cFormat, unsigned char Cmd) { unsigned int dwRetriesToLive=4; while(dwRetriesToLive--) { unsigned int dwSpinsToLive=0x8000000; IoOutputByte(4, bPicAddressI2cFormat|1); IoOutputByte(8, Cmd); IoOutputWord(0, IoInputWord(0)); IoOutputByte(2, 0x0a); { unsigned char b=8; while( (b & 8) && (dwSpinsToLive--) ) { b=IoInputByte(0); } if(dwSpinsToLive==0) return ERR_I2C_ERROR_TIMEOUT; if(b&0x2) continue; // retry if(b&0x24) return ERR_I2C_ERROR_BUS; if(!(b&0x10)) return ERR_I2C_ERROR_BUS; // we are okay, fetch returned byte return (int)IoInputByte(6); } } return ERR_I2C_ERROR_BUS; } // transmit a word, no returned data from I2C device int I2CTransmitCmdData(unsigned char bPicAddressI2cFormat, unsigned char Cmd, unsigned char Data, int fMode) { unsigned int dwRetriesToLive=4; while(dwRetriesToLive--) { unsigned int dwSpinsToLive=0x8000000; IoOutputByte(4, bPicAddressI2cFormat & ~1); IoOutputByte(8, Cmd); IoOutputWord(6, Data); IoOutputWord(0, IoInputWord(0)); if(fMode) { IoOutputByte(2, 0x1a); } else { IoOutputByte(2, 0x0a); } { unsigned char b=8; while( (b & 8) && (dwSpinsToLive--) ) { b=IoInputByte(0); } if(dwSpinsToLive==0) return ERR_I2C_ERROR_TIMEOUT; if(b&0x2) continue; // retry if(b&0x24) return ERR_I2C_ERROR_BUS; if(!(b&0x10)) return ERR_I2C_ERROR_BUS; // we are okay, return happy code return ERR_SUCCESS; } } return ERR_I2C_ERROR_BUS; } void I2CTransmitStop(void) { IoOutputWord(2, (IoInputWord(2) & 0x10)|0x20); } nvtv-0.4.7/src/gui.c0000644000175000001440000033742310041235076007725 /* NVTV Gui -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui.c,v 1.52 2004/01/30 08:47:02 dthierbach Exp $ * * Contents: * * The GTK graphical user interface. */ #include "local.h" /* before everything else */ #include #include #include #include #include #include #include #include #include "tv_chip.h" #include "nvtv.h" #include "data.h" #include "data_bt.h" #include "data_ch.h" #include "gui.h" #include "gui_bt.h" #include "gui_cx.h" #include "gui_ch.h" #include "gui_ph.h" #include "gui_nx.h" #include "gui_nv.h" #include "gui_tdfx.h" #include "gui_i810.h" #include "actions.h" #include "print.h" #include "backend.h" /* -------- Global variables -------- */ GtkWidget *gui_main_window; /* ---- GUI state ---- */ int gui_main_head, gui_tv_head, gui_video_head; int gui_max_head; Bool gui_change_heads = FALSE; TVRegs gui_regs; #define gui_set opt_set /* FIXME */ int gui_set_saved = (TV_CAP_MASK & ~TV_CAP_DUALVIEW) | TV_DESC_DUALVIEW; /* Dualview is set by default */ TVMode gui_orig_mode = { {TV_SYSTEM_NONE, 0, 0, "Monitor", "---", 0.0, 0.0}, descFlags: 0 }; TVMode gui_fetch_mode = { {TV_SYSTEM_NONE, 0, 0, "Fetch", "---", 0.0, 0.0}, descFlags: 0 }; TVRegs *gui_orig_regs = NULL; /* either NULL or points into gui_orig_mode */ static int gui_service_delays [] = { 50, 100, 200, 400, 0 }; /* in ms */ int gui_service_delay = 0; int gui_service_flags = 0; TVChip gui_tv_chip = TV_NO_CHIP; TVSystem gui_system = TV_SYSTEM_NONE; TVMode *gui_list_mode = NULL; TVMode *gui_act_mode = NULL; Window gui_window = None; int gui_window_x, gui_window_y; int gui_window_width, gui_window_height; Bool gui_auto = FALSE; Bool gui_bypass = FALSE; Bool gui_tvstate = FALSE; /* FALSE=off, TRUE=on */ DataFunc *gui_func = NULL; gint gui_service_timeout_id = -1; /* service timeout */ /* ---- other variables ---- */ static CardPtr gui_card_list; static CardPtr gui_card = NULL; /* ---- "Changed" signal chains ---- */ GuiNotify *update_crt; GuiNotify *update_chip; GuiNotify *update_port; GuiNotify *update_mode; GuiNotify *update_set; GuiNotify *update_service; GuiNotify *changed_all; GuiNotify *show_bt, *hide_bt; GuiNotify *show_cx, *hide_cx; GuiNotify *show_ch, *hide_ch; GuiNotify *show_ph1, *hide_ph1; GuiNotify *show_ph2, *hide_ph2; GuiNotify *show_nx, *hide_nx; GuiNotify *show_card[CARD_LAST], *hide_card[CARD_LAST]; GuiNotify *show_head, *hide_head; GuiNotify *update_bypass; /* -------- Accelerators -------- */ GuiAccel gui_accel[ACCEL_LAST] = { {"Switch TV on:", "F1"}, {"Switch TV off:", "F2"}, {"Switch X mode:", "F4"}, {"Center X window:", "F5"}, {"Resize X window:", "F6"}, {"Reset values:", "F9"}, {"Print values:", "F10"}, }; GtkAccelGroup *gui_main_accel_group; /* -------- GUI Masks -------- */ struct mask_mode_page { GtkOptionMenu *system; GtkCList *modes; gint column; /* last column sorted */ GtkLabel *res; GtkLabel *size; GtkLabel *aspect; GtkLabel *overscan; GtkLabel *tv_state, *mon_state; GtkLabel *xwin_name; GtkWidget *xwin_frame; GtkWidget *xcenter, *xadjust; GtkWidget *xwin_pos, *xwin_size; }; struct mask_mode_page gui_mode_mask; struct mask_config_page { GtkLabel *io_addr, *probe; GtkOptionMenu *chip; }; struct mask_config_page gui_config_mask; struct mask_offset { GtkAdjustment *hadj, *vadj; gfloat hcenter, vcenter; }; struct mask_offset gui_tv_offset, gui_mon_offset; struct mask_offset gui_xwin_pos, gui_xwin_size; struct mask_offset gui_view_pos; struct mask_settings { GtkAdjustment *brightness_sig, *contrast_sig, *saturation_sig; GtkToggleButton *dualview, *macrovis, *monochrome, *noninterlaced, *colorfix; GSList *output; int connect; }; struct mask_settings gui_settings; struct mask_heads { GtkAdjustment *main, *tv, *video; GtkLabel *timer, *twin; GtkToggleButton *shared; GtkFrame *disp_mon[2]; GtkFrame *disp_tv[2]; GtkFrame *disp_fp[2]; }; struct mask_heads gui_heads; /* -------- */ typedef struct set_mask { char *label; int xl, xr; int min, max; GtkAdjustment **adj; int *addr; } GuiSetMask; #define SET_ADJ(m) adj:&gui_settings.m #define SET_VAL(m) addr:&gui_set.m static GuiSetMask gui_set_mask [] = { {"Contrast", xl:1, xr:3, min:-100, max:100, SET_VAL(contrast)}, {"Saturation", xl:1, xr:3, min:-100, max:100, SET_VAL(saturation)}, {"Brightness#", xl:1, xr:5, min: -50, max: 50, SET_VAL(brightness_sig), SET_ADJ(brightness_sig)}, {"Contrast#", xl:1, xr:5, min: -50, max: 50, SET_VAL(contrast_sig), SET_ADJ(contrast_sig)}, {"Saturation#", xl:1, xr:5, min: -50, max: 50, SET_VAL(saturation_sig), SET_ADJ(saturation_sig)}, {"Phase", xl:1, xr:5, min: -60, max: 60, SET_VAL(phase)}, {"Hue", xl:1, xr:5, min: -60, max: 60, SET_VAL(hue)}, {"Flicker", xl:1, xr:3, min: 0, max:100, SET_VAL(flicker)}, {"+", xl:3, xr:5, min: 0, max:100, SET_VAL(flicker_adapt)}, {"Bandwidth", xl:1, xr:3, min: 0, max:100, SET_VAL(luma_bandwidth)}, {"+", xl:3, xr:5, min: 0, max:100, SET_VAL(chroma_bandwidth)}, {"Sharpness", xl:1, xr:3, min: 0, max:100, SET_VAL(sharpness)}, {"+", xl:3, xr:5, min: 0, max:100, SET_VAL(cross_color)}, {NULL} }; #define FIELD_FLAG(m) addr:&m, size:sizeof(int) static GuiFlagMask service_mask_flag [] = { {label:"", mask: BACK_SERVICE_CURSOR, FIELD_FLAG(gui_service_flags)}, {label:"", mask: BACK_SERVICE_VIEW_CURSOR, FIELD_FLAG(gui_service_flags)}, {label:"", mask: BACK_SERVICE_VIEW_MAIN, FIELD_FLAG(gui_service_flags)} }; static GuiFlagMask dev_port_mask_flag [] = { {label:"Monitor", mask: DEV_MONITOR, FIELD_FLAG(gui_regs.devFlags)}, {label:"TV", mask: DEV_TELEVISION, FIELD_FLAG(gui_regs.devFlags)}, {label:"LCD", mask: DEV_FLATPANEL, FIELD_FLAG(gui_regs.devFlags)}, {label:"Overlay", mask: DEV_OVERLAY, FIELD_FLAG(gui_regs.devFlags)}, {label:"Intern", mask: DEV_INTERNAL, FIELD_FLAG(gui_regs.devFlags)}, {NULL} }; static GuiFlagMask host_port_mask_flag [] = { {label:"", mask: PORT_PCLK_MODE, FIELD_FLAG(gui_regs.portHost)}, {label:"", mask: PORT_PCLK_POLARITY, FIELD_FLAG(gui_regs.portHost)}, {label:"", mask: PORT_SYNC_DIR, FIELD_FLAG(gui_regs.portHost)}, {label:"", mask: PORT_HSYNC_POLARITY, FIELD_FLAG(gui_regs.portHost)}, {label:"", mask: PORT_VSYNC_POLARITY, FIELD_FLAG(gui_regs.portHost)}, {label:"", mask: PORT_BLANK_DIR, FIELD_FLAG(gui_regs.portHost)}, {label:"", mask: PORT_BLANK_POLARITY, FIELD_FLAG(gui_regs.portHost)}, {label:"", mask: PORT_BLANK_REGION, FIELD_FLAG(gui_regs.portHost)}, {label:"", mask: PORT_FORMAT_MASK_COLOR, FIELD_FLAG(gui_regs.portHost)}, {label:"", mask: PORT_FORMAT_MASK_ALT, FIELD_FLAG(gui_regs.portHost)}, }; static GuiFlagMask enc_port_mask_flag [] = { {label:"", mask: PORT_PCLK_MODE, FIELD_FLAG(gui_regs.portEnc)}, {label:"", mask: PORT_PCLK_POLARITY, FIELD_FLAG(gui_regs.portEnc)}, {label:"", mask: PORT_SYNC_DIR, FIELD_FLAG(gui_regs.portEnc)}, {label:"", mask: PORT_HSYNC_POLARITY, FIELD_FLAG(gui_regs.portEnc)}, {label:"", mask: PORT_VSYNC_POLARITY, FIELD_FLAG(gui_regs.portEnc)}, {label:"", mask: PORT_BLANK_DIR, FIELD_FLAG(gui_regs.portEnc)}, {label:"", mask: PORT_BLANK_POLARITY, FIELD_FLAG(gui_regs.portEnc)}, {label:"", mask: PORT_BLANK_REGION, FIELD_FLAG(gui_regs.portEnc)}, {label:"", mask: PORT_FORMAT_MASK_COLOR, FIELD_FLAG(gui_regs.portEnc)}, {label:"", mask: PORT_FORMAT_MASK_ALT, FIELD_FLAG(gui_regs.portEnc)}, }; /* -------- GTK Helper Routines -------- */ /* * Create an option menu with labels. */ GtkWidget* create_option_menu (GtkSignalFunc func, ...) { va_list ap; GtkWidget *opt, *menu, *item; char *label; int i; va_start (ap, func); opt = gtk_option_menu_new(); menu = gtk_menu_new(); for (i = 0; TRUE; i++) { label = va_arg (ap, char *); if (!label) break; item = gtk_menu_item_new_with_label (label); if (func) gtk_signal_connect (GTK_OBJECT (item), "activate", func, (gpointer) i); gtk_menu_append (GTK_MENU (menu), item); } gtk_option_menu_set_menu (GTK_OPTION_MENU (opt), menu); va_end (ap); return opt; } /* * Attempt to control the size of an entry */ #if GTK_MAJOR_VERSION == 1 void entry_size_request_cb (GtkWidget *widget, GtkRequisition *req) { g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_ENTRY (widget)); g_return_if_fail (req != NULL); /* No info about max or avg xsize, so guess */ if (((GtkEntry *) widget)->text_max_length > 0) { req->width = ((GtkEntry *) widget)->text_max_length * (widget->style->font->ascent + widget->style->font->descent) + (widget->style->klass->xthickness + 2) * 2; } } #endif GtkWidget *create_entry_with_size (gint max_length) { GtkWidget *entry; entry = gtk_entry_new_with_max_length (max_length); #if GTK_MAJOR_VERSION == 1 gtk_signal_connect_after (GTK_OBJECT(entry), "size_request", GTK_SIGNAL_FUNC(entry_size_request_cb), NULL); #endif return entry; } /* * Attempt to control the size of a spinbutton */ #if GTK_MAJOR_VERSION == 1 void spinbutton_size_request_cb (GtkWidget *widget, GtkRequisition *req) { GtkAdjustment *adj; register int s; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_SPIN_BUTTON (widget)); g_return_if_fail (req != NULL); /* WARNING: This is a very crude estimation of average font character width and arrow size using ascent and descent, and probably will not work with all fonts. */ adj = ((GtkSpinButton *) widget)->adjustment; if (adj) { s = ((int) log10 (adj->upper - adj->lower)) + 1 + ((GtkSpinButton *) widget)->digits; s = s * (widget->style->font->ascent - widget->style->font->descent) + 6 * widget->style->klass->xthickness + 4 + (widget->style->font->ascent + widget->style->font->descent - 1) / 2; /* ARROW_SIZE == 11 */ req->width = s; } } #endif GtkWidget *create_spinbutton_with_size (GtkAdjustment *adjustment, gfloat climb_rate, guint digits) { GtkWidget *spin; spin = gtk_spin_button_new (adjustment, climb_rate, digits); #if GTK_MAJOR_VERSION == 1 gtk_signal_connect_after (GTK_OBJECT(spin), "size_request", GTK_SIGNAL_FUNC(spinbutton_size_request_cb), NULL); #endif return spin; } /* * Create an arrow button and attach to table. */ GtkWidget *create_arrow_button (GtkTable *table, GtkArrowType arrow_type, int x0, int x1, int y0, int y1) { GtkWidget *button; GtkWidget *arrow; button = gtk_button_new(); if (arrow_type >= GTK_ARROW_UP && arrow_type <= GTK_ARROW_RIGHT) { arrow = gtk_arrow_new (arrow_type, GTK_SHADOW_OUT); gtk_widget_set_usize (arrow, 20, 20); gtk_container_add (GTK_CONTAINER (button), arrow); } gtk_table_attach (table, button, x0, x1, y0, y1, GTK_FILL, GTK_FILL, 0,0); return button; } /* * Create a vertical or horizontal radio box. Store radio group if * non-null. */ GtkWidget *create_radio_box (int active, gboolean hor_vert, GtkSignalFunc func, GSList **group, ...) { GtkWidget *bbox; GtkWidget *button; char *label; GSList *slist; va_list ap; int i; va_start (ap, group); if (hor_vert) { bbox = gtk_hbox_new (FALSE, 0); } else { bbox = gtk_vbox_new (FALSE, 0); } gtk_container_set_border_width (GTK_CONTAINER (bbox), 5); button = NULL; slist = NULL; for (i = 0; TRUE; i++) { label = va_arg (ap, char *); if (!label) break; if (button) slist = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label (slist, label); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), (active == i) ? TRUE : FALSE); if (func) gtk_signal_connect (GTK_OBJECT (button), "toggled", func, (gpointer) i); gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0); } va_end (ap); if (group) { *group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); } return bbox; } /* * Set active index of radio group */ void set_radio_group_active (GSList *group, int active) { group = g_slist_nth (group, g_slist_length (group) - active - 1); if (group) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (group->data), TRUE); } } /* * Create justified label */ GtkWidget *create_aligned_label (const char *str, gfloat xalign, gfloat yalign) { GtkWidget *label; label = gtk_label_new (str); gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign); return label; } /* * Create notify widget (misuse adjustment for now) */ GuiNotify *create_notify (void) { return (GuiNotify *) gtk_adjustment_new (0, 0, 0, 0, 0, 0); } /* * Change adjustment only if new value is different */ void change_adjustment (GtkAdjustment *adj, int value, GtkSignalFunc func) { if (adj->value != value) { if (func) gtk_signal_handler_block_by_func (GTK_OBJECT (adj), func, NULL); gtk_adjustment_set_value (adj, value); if (func) gtk_signal_handler_unblock_by_func (GTK_OBJECT (adj), func, NULL); } } /* * Connect show and hide signals */ void set_show_hide (GtkWidget *page, GtkAdjustment *show, GtkAdjustment *hide) { gtk_signal_connect_object (GTK_OBJECT (show), "changed", GTK_SIGNAL_FUNC (gtk_widget_show_all), GTK_OBJECT (page)); gtk_signal_connect_object (GTK_OBJECT (hide), "changed", GTK_SIGNAL_FUNC (gtk_widget_hide_all), GTK_OBJECT (page)); } /* -------- State methods -------- */ /* ---- register changed (on signal chain) ---- */ void reg_changed_cb (GtkAdjustment *adj, gpointer data) { GuiRegMask *m = (GuiRegMask *) gtk_object_get_data (GTK_OBJECT(adj), "adj"); if (m->size == sizeof(int)) { *((int *) m->addr) = (int) adj->value; } else if (m->size == sizeof(long)) { *((long *) m->addr) = (long) adj->value; } gtk_signal_emit_by_name (GTK_OBJECT (changed_all), "changed"); } void reg_low_changed_cb (GtkAdjustment *adj, gpointer data) { GuiRegMask *m = (GuiRegMask *) gtk_object_get_data (GTK_OBJECT(adj), "adj"); long l; if (m->size != sizeof(long)) { RAISE (MSG_ERROR, "reg_low_changed: not a long value"); return; } l = *((long *) m->addr); l = (l / 100000) * 100000 + (long) adj->value; *((long *) m->addr) = l; gtk_signal_emit_by_name (GTK_OBJECT (changed_all), "changed"); } void reg_high_changed_cb (GtkAdjustment *adj, gpointer data) { GuiRegMask *m = (GuiRegMask *) gtk_object_get_data (GTK_OBJECT(adj), "adj"); long l; if (m->size != sizeof(long)) { RAISE (MSG_ERROR, "reg_high_changed: not a long value"); return; } l = *((long *) m->addr); l = (l % 100000) + ((long) adj->value * 100000); *((long *) m->addr) = l; gtk_signal_emit_by_name (GTK_OBJECT (changed_all), "changed"); } /* ---- register update (on signal chain) ---- */ void reg_update_cb (GtkAdjustment *adj, gpointer data) { GuiRegMask *m = (GuiRegMask *) gtk_object_get_data (GTK_OBJECT(adj), "adj"); gfloat val; val = 0.0; if (m->size == sizeof(int)) { val = (gfloat) *((int *) m->addr); } else if (m->size == sizeof(long)) { val = (gfloat) *((long *) m->addr); } gtk_signal_handler_block_by_func (GTK_OBJECT (adj), GTK_SIGNAL_FUNC (reg_changed_cb), NULL); gtk_adjustment_set_value (GTK_ADJUSTMENT(adj), val); gtk_signal_handler_unblock_by_func (GTK_OBJECT (adj), GTK_SIGNAL_FUNC (reg_changed_cb), NULL); } void reg_low_update_cb (GtkAdjustment *adj, gpointer data) { GuiRegMask *m = (GuiRegMask *) gtk_object_get_data (GTK_OBJECT(adj), "adj"); gfloat val; val = 0.0; if (m->size != sizeof(long)) { RAISE (MSG_ERROR, "reg_low_update: not a long value"); return; } val = (gfloat) (*((long *) m->addr) % 100000); gtk_signal_handler_block_by_func (GTK_OBJECT (adj), GTK_SIGNAL_FUNC (reg_low_changed_cb), NULL); gtk_adjustment_set_value (GTK_ADJUSTMENT(adj), val); gtk_signal_handler_unblock_by_func (GTK_OBJECT (adj), GTK_SIGNAL_FUNC (reg_low_changed_cb), NULL); } void reg_high_update_cb (GtkAdjustment *adj, gpointer data) { GuiRegMask *m = (GuiRegMask *) gtk_object_get_data (GTK_OBJECT(adj), "adj"); gfloat val; val = 0.0; if (m->size != sizeof(long)) { RAISE (MSG_ERROR, "reg_high_update: not a long value"); return; } val = (gfloat) (*((long *) m->addr) / 100000); gtk_signal_handler_block_by_func (GTK_OBJECT (adj), GTK_SIGNAL_FUNC (reg_high_changed_cb), NULL); gtk_adjustment_set_value (GTK_ADJUSTMENT(adj), val); gtk_signal_handler_unblock_by_func (GTK_OBJECT (adj), GTK_SIGNAL_FUNC (reg_high_changed_cb), NULL); } /* ---- flag (on signal chain) ---- */ void flag_changed_cb (GtkWidget *button, gpointer data) { GuiFlagMask *m = (GuiFlagMask *) gtk_object_get_data (GTK_OBJECT(button), "mask"); if (GTK_TOGGLE_BUTTON (button)->active) { *((int *) m->addr) |= m->mask; } else { *((int *) m->addr) &= ~m->mask; } gtk_signal_emit_by_name (GTK_OBJECT (changed_all), "changed"); } void flag_opt_changed_cb (GtkWidget *opt, gpointer data) { GuiFlagMask *m = (GuiFlagMask *) gtk_object_get_data (GTK_OBJECT(opt), "mask"); if (data) { *((int *) m->addr) |= m->mask; } else { *((int *) m->addr) &= ~m->mask; } gtk_signal_emit_by_name (GTK_OBJECT (changed_all), "changed"); } void flag_update_cb (GtkWidget *button, gpointer data) { GuiFlagMask *m = (GuiFlagMask *) gtk_object_get_data (GTK_OBJECT(button), "mask"); gtk_signal_handler_block_by_func (GTK_OBJECT (button), GTK_SIGNAL_FUNC (flag_changed_cb), NULL); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), (*((int *) m->addr) & m->mask) ? TRUE : FALSE); gtk_signal_handler_unblock_by_func (GTK_OBJECT (button), GTK_SIGNAL_FUNC (flag_changed_cb), NULL); } void flag_opt_update_cb (GtkWidget *opt, gpointer data) { GuiFlagMask *m = (GuiFlagMask *) gtk_object_get_data (GTK_OBJECT(opt), "mask"); /* No need to block changed signal */ gtk_option_menu_set_history (GTK_OPTION_MENU (opt), (*((int *) m->addr) & m->mask) ? 1 : 0); } /* ---- setting (on signal chain) ---- */ void set_changed_cb (GtkAdjustment *adj, gpointer data) { GuiSetMask *m = (GuiSetMask *) gtk_object_get_data (GTK_OBJECT(adj), "adj"); RAISE (MSG_DEBUG, "set_changed %p %s", m, m->label); *((int *) m->addr) = (int) adj->value; gtk_signal_emit_by_name (GTK_OBJECT (changed_all), "changed"); } void set_update_cb (GtkAdjustment *adj, gpointer data) { GuiSetMask *m = (GuiSetMask *) gtk_object_get_data (GTK_OBJECT(adj), "adj"); gfloat val; val = (gfloat) *((int *) m->addr); gtk_signal_handler_block_by_func (GTK_OBJECT (adj), GTK_SIGNAL_FUNC (set_changed_cb), NULL); gtk_adjustment_set_value (GTK_ADJUSTMENT(adj), val); gtk_signal_handler_unblock_by_func (GTK_OBJECT (adj), GTK_SIGNAL_FUNC (set_changed_cb), NULL); } /* ---- port registers ---- */ void gui_port_changed (void) { gtk_signal_emit_by_name (GTK_OBJECT (update_port), "changed"); } void gui_port_set (TVRegs *regs) { gui_regs.devFlags = regs->devFlags; gui_regs.portHost = regs->portHost; gui_regs.portEnc = regs->portEnc; RAISE (MSG_DEBUG, "gui_set_port"); gui_port_changed (); } /* ---- crt registers ---- */ void gui_crt_changed (void) { gtk_signal_emit_by_name (GTK_OBJECT (update_crt), "changed"); } void gui_crt_set (TVCrtcRegs *crtc) { gui_regs.crtc = *crtc; RAISE (MSG_DEBUG, "gui_set_crt"); gui_crt_changed (); } /* ---- chip registers ---- */ void gui_tv_changed (void) { gtk_signal_emit_by_name (GTK_OBJECT (update_chip), "changed"); } void gui_tv_set (void) { gui_tv_changed (); } /* ---- both registers ---- */ void gui_regs_set (TVRegs *regs, Bool setup) { if (regs) gui_regs = *regs; if (gui_func) { if (setup) gui_func->setup (&gui_set, &gui_regs); } gui_crt_changed (); gui_tv_changed (); gui_port_changed (); } /* -------- Settings -------- */ void gui_get_settings_flags (void) { gui_set.flags = 0; if (gui_settings.macrovis->active) gui_set.flags |= TV_DESC_MACROVISION; if (gui_settings.monochrome->active) gui_set.flags |= TV_DESC_MONOCHROME; if (gui_settings.noninterlaced->active) gui_set.flags |= TV_DESC_NONINTERLACED; if (gui_settings.colorfix->active) gui_set.flags |= TV_DESC_COLORFIX; if (gui_settings.dualview->active) { gui_set.flags |= TV_DESC_DUALVIEW; gui_regs.devFlags |= DEV_MONITOR; } else { gui_regs.devFlags &= ~DEV_MONITOR; } } void gui_set_settings_flags (void) { RAISE (MSG_DEBUG, "set settings flags"); gtk_toggle_button_set_active (gui_settings.dualview, (gui_set.flags & TV_DESC_DUALVIEW) ? TRUE : FALSE); gtk_toggle_button_set_active (gui_settings.macrovis, (gui_set.flags & TV_DESC_MACROVISION) ? TRUE : FALSE); gtk_toggle_button_set_active (gui_settings.monochrome, (gui_set.flags & TV_DESC_MONOCHROME) ? TRUE : FALSE); gtk_toggle_button_set_active (gui_settings.noninterlaced, (gui_set.flags & TV_DESC_NONINTERLACED) ? TRUE : FALSE); gtk_toggle_button_set_active (gui_settings.colorfix, (gui_set.flags & TV_DESC_COLORFIX) ? TRUE : FALSE); } void gui_get_settings (void) { RAISE (MSG_DEBUG, "get settings"); gui_set.tv_hoffset = gui_tv_offset.hadj->value; gui_set.tv_voffset = gui_tv_offset.vadj->value; gui_set.mon_hoffset = gui_mon_offset.hadj->value; gui_set.mon_voffset = gui_mon_offset.vadj->value; gui_set.connector = gui_settings.connect; } void settings_cb (GtkObject *obj, gpointer data); void gui_set_settings (void) { static int lock = 0; RAISE (MSG_DEBUG, "set settings %i", lock); if (lock > 0) return; lock++; change_adjustment (gui_tv_offset.hadj, gui_set.tv_hoffset, GTK_SIGNAL_FUNC (settings_cb)); change_adjustment (gui_tv_offset.vadj, gui_set.tv_voffset, GTK_SIGNAL_FUNC (settings_cb)); change_adjustment (gui_mon_offset.hadj, gui_set.mon_hoffset, GTK_SIGNAL_FUNC (settings_cb)); change_adjustment (gui_mon_offset.vadj, gui_set.mon_voffset, GTK_SIGNAL_FUNC (settings_cb)); RAISE (MSG_DEBUG, "set settings changed"); gtk_signal_emit_by_name (GTK_OBJECT (update_set), "changed"); lock--; RAISE (MSG_DEBUG, "set settings done %i", lock); } void settings_cb (GtkObject *obj, gpointer data) { static int lock = 0; RAISE (MSG_DEBUG, "settings_cb %i", lock); if (lock > 0) return; lock++; if (gui_func) { gui_get_settings (); gui_func->clamp (&gui_set, &gui_regs); gui_set_settings (); gtk_signal_emit_by_name (GTK_OBJECT (changed_all), "changed"); } lock--; RAISE (MSG_DEBUG, "settings_cb done %i", lock); } void settings_flags_cb (GtkObject *obj, gpointer data) { static int lock = 0; RAISE (MSG_DEBUG, "settings_flags_cb %i", lock); if (lock > 0) return; lock++; if (gui_func) { gui_get_settings_flags (); gtk_signal_emit_by_name (GTK_OBJECT (changed_all), "changed"); } lock--; } void setup_cb (GtkWidget *button, gpointer data) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data), TRUE); gui_regs_set (NULL, TRUE); } void bypass_cb (GtkWidget *button, gpointer data) { if (GTK_TOGGLE_BUTTON (button)->active) { gui_bypass = TRUE; } else { gui_bypass = FALSE; } gtk_signal_emit_by_name (GTK_OBJECT (update_bypass), "changed"); } void bypass_update_cb (GtkAdjustment *adj, GtkObject *button) { gtk_signal_handler_block_by_func (GTK_OBJECT (button), GTK_SIGNAL_FUNC (bypass_cb), NULL); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), gui_bypass); gtk_signal_handler_unblock_by_func (GTK_OBJECT (button), GTK_SIGNAL_FUNC (bypass_cb), NULL); } /* ---- actual mode ---- */ void gui_act_mode_changed (void) { register int mask; if (gui_act_mode) { gui_regs_set (&gui_act_mode->regs, gui_bypass); gtk_signal_emit_by_name (GTK_OBJECT (changed_all), "changed"); gui_get_settings_flags (); /* save flags that were available and are forced now */ mask = (gui_set_saved & ~gui_act_mode->descFlags & TV_CAP_MASK) >> TV_CAP_BIT; gui_set_saved &= ~mask; gui_set_saved |= mask & gui_set.flags; /* restore flags that were forced and are available now */ mask = (~gui_set_saved & gui_act_mode->descFlags & TV_CAP_MASK) >> TV_CAP_BIT; gui_set.flags &= ~mask; gui_set.flags |= mask & gui_set_saved; /* force flags */ mask = (~gui_act_mode->descFlags & TV_CAP_MASK) >> TV_CAP_BIT; gui_set.flags &= ~mask; gui_set.flags |= mask & gui_act_mode->descFlags; /* save force mask */ gui_set_saved &= ~TV_CAP_MASK; gui_set_saved |= TV_CAP_MASK & gui_act_mode->descFlags; gui_set_settings_flags (); gtk_widget_set_sensitive (GTK_WIDGET (gui_settings.dualview), (gui_act_mode->descFlags & TV_CAP_DUALVIEW) ? TRUE : FALSE); gtk_widget_set_sensitive (GTK_WIDGET (gui_settings.macrovis), (gui_act_mode->descFlags & TV_CAP_MACROVISION) ? TRUE : FALSE); gtk_widget_set_sensitive (GTK_WIDGET (gui_settings.monochrome), (gui_act_mode->descFlags & TV_CAP_MONOCHROME) ? TRUE : FALSE); gtk_widget_set_sensitive (GTK_WIDGET (gui_settings.noninterlaced), (gui_act_mode->descFlags & TV_CAP_NONINTERLACED) ? TRUE : FALSE); gtk_widget_set_sensitive (GTK_WIDGET (gui_settings.colorfix), (gui_act_mode->descFlags & TV_CAP_COLORFIX) ? TRUE : FALSE); } } void gui_act_mode_set (TVMode *mode) { char s[20]; gui_act_mode = mode; if (gui_act_mode) { snprintf (s, 20, "%3i x %3i", gui_act_mode->spec.res_x, gui_act_mode->spec.res_y); gtk_label_set_text (gui_mode_mask.res, s); gtk_label_set_text (gui_mode_mask.size, gui_act_mode->spec.size); gtk_label_set_text (gui_mode_mask.aspect, gui_act_mode->spec.aspect); snprintf (s, 20, "%05.2f x %05.2f", gui_act_mode->spec.hoc, gui_act_mode->spec.voc); gtk_label_set_text (gui_mode_mask.overscan, s); } else { gtk_label_set_text (gui_mode_mask.res, ""); gtk_label_set_text (gui_mode_mask.size, ""); gtk_label_set_text (gui_mode_mask.overscan, ""); } gui_act_mode_changed (); } /* ---- list mode (current selection) ---- */ void gui_list_mode_changed (void) { gtk_signal_emit_by_name (GTK_OBJECT (update_mode), "changed"); } void gui_list_mode_cb (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data) { gui_list_mode = gtk_clist_get_row_data (gui_mode_mask.modes, row); gui_list_mode_changed (); gui_act_mode_set (gui_list_mode); } /* ---- list of all modes ---- */ /* * Set list of modes selected by gui_system. */ void gui_modes_init (void) { TVMode *m; char sr[20], ss[20], so[20], sa[10]; char *text [5]; int row; int select; /* TODO FIXME: Use listModes */ if (gui_func && gui_card) { m = gui_func->modes (); } else { m = NULL; } gtk_clist_freeze (gui_mode_mask.modes); gtk_clist_clear (gui_mode_mask.modes); if (m) { row = 0; select = 0; while (m->spec.system != TV_SYSTEM_NONE) { if (m->spec.system == gui_system) { if (opt_size) { if (m->spec.res_x == opt_res_x && m->spec.res_y == opt_res_y && strcasecmp (m->spec.size, opt_size) == 0) { select = row; } } snprintf (sr, 20, "%3i x %3i", m->spec.res_x, m->spec.res_y); snprintf (ss, 20, "%s", m->spec.size); snprintf (so, 20, "%05.2f x %05.2f", m->spec.hoc, m->spec.voc); snprintf (sa, 10, "%s", m->spec.aspect); /* FIXME relative aspect? */ /* snprintf (sa, 10, "%7.5f", aspect); */ text [0] = sr; text [1] = ss; text [2] = so; text [3] = sa; gtk_clist_append (gui_mode_mask.modes, text); gtk_clist_set_row_data (gui_mode_mask.modes, row, m); row++; } m++; } gtk_clist_select_row (gui_mode_mask.modes, select, 0); } gui_mode_mask.column = -1; gtk_clist_thaw (gui_mode_mask.modes); /* FIXME: Create custom mode if opt_hoc and opt_voc are set */ } void gui_modes_column_cb (GtkCList *clist, gint column, struct mask_mode_page *m) { g_return_if_fail (GTK_IS_CLIST (m->modes)); if (m->column == column) { gtk_clist_set_sort_type (m->modes, GTK_SORT_DESCENDING); m->column = -1; } else { gtk_clist_set_sort_type (m->modes, GTK_SORT_ASCENDING); m->column = column; } gtk_clist_set_sort_column (m->modes, column); gtk_clist_sort (m->modes); gtk_clist_set_sort_type (m->modes, GTK_SORT_ASCENDING); } /* ---- tv system ---- */ void gui_system_changed (void) { gui_modes_init (); } void gui_system_cb (GtkWidget *widget, gpointer data) { gui_system = (TVSystem) data; gui_system_changed (); } void gui_system_set (TVSystem system) { gui_system = system; if (gui_system > TV_SYSTEM_NONE) gtk_option_menu_set_history (gui_mode_mask.system, gui_system); gui_system_changed (); } void gui_system_init (void) { gui_system = TV_SYSTEM_PAL; /* Must have some default. */ if (opt_system != TV_SYSTEM_NONE) { gui_system = opt_system; } if (gui_system > TV_SYSTEM_NONE) { gtk_option_menu_set_history (gui_mode_mask.system, gui_system); } /* mode will be init by caller */ } /* -------- Heads -------- */ void head_cb (GtkWidget *widget, gpointer data); void view_cb (GtkWidget *widget, gpointer data); gint service_view_cb (gpointer data); void gui_set_heads (void) { gtk_signal_handler_block_by_func (GTK_OBJECT (gui_heads.main), GTK_SIGNAL_FUNC (head_cb), NULL); gtk_signal_handler_block_by_func (GTK_OBJECT (gui_heads.tv), GTK_SIGNAL_FUNC (head_cb), NULL); gtk_signal_handler_block_by_func (GTK_OBJECT (gui_heads.video), GTK_SIGNAL_FUNC (head_cb), NULL); gtk_adjustment_set_value (gui_heads.main, gui_main_head); gtk_adjustment_set_value (gui_heads.tv, gui_tv_head); gtk_adjustment_set_value (gui_heads.video, gui_video_head); gtk_signal_handler_unblock_by_func (GTK_OBJECT (gui_heads.main), GTK_SIGNAL_FUNC (head_cb), NULL); gtk_signal_handler_unblock_by_func (GTK_OBJECT (gui_heads.tv), GTK_SIGNAL_FUNC (head_cb), NULL); gtk_signal_handler_unblock_by_func (GTK_OBJECT (gui_heads.video), GTK_SIGNAL_FUNC (head_cb), NULL); } void gui_get_heads (void) { gui_main_head = gui_heads.main->value; gui_tv_head = gui_heads.tv->value; gui_video_head = gui_heads.video->value; } void head_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "head"); gui_get_heads (); back_card->setHeads (gui_main_head, gui_tv_head, gui_video_head); back_card->getHeads (&gui_main_head, &gui_tv_head, &gui_video_head, NULL); gui_set_heads (); } void head_update_cb (GtkWidget *widget, gpointer data) { int flags; int i; for (i = 0; i < gui_max_head; i++) { back_card->getHeadDev (i+1, &flags); gtk_frame_set_shadow_type (gui_heads.disp_mon[i], (flags & DEV_MONITOR) ? GTK_SHADOW_IN : GTK_SHADOW_ETCHED_OUT); gtk_frame_set_shadow_type (gui_heads.disp_tv[i], (flags & DEV_TELEVISION) ? GTK_SHADOW_IN : GTK_SHADOW_ETCHED_OUT); gtk_frame_set_shadow_type (gui_heads.disp_fp[i], (flags & DEV_FLATPANEL) ? GTK_SHADOW_IN : GTK_SHADOW_ETCHED_OUT); } } void gui_set_view (int view_x, int view_y) { gtk_signal_handler_block_by_func (GTK_OBJECT (gui_view_pos.hadj), GTK_SIGNAL_FUNC (view_cb), NULL); gtk_signal_handler_block_by_func (GTK_OBJECT (gui_view_pos.vadj), GTK_SIGNAL_FUNC (view_cb), NULL); gtk_adjustment_set_value (gui_view_pos.hadj, view_x); gtk_adjustment_set_value (gui_view_pos.vadj, view_y); gtk_signal_handler_unblock_by_func (GTK_OBJECT (gui_view_pos.hadj), GTK_SIGNAL_FUNC (view_cb), NULL); gtk_signal_handler_unblock_by_func (GTK_OBJECT (gui_view_pos.vadj), GTK_SIGNAL_FUNC (view_cb), NULL); } void duplicate_cb (GtkWidget *widget, gpointer data) { int x, y; RAISE (MSG_DEBUG, "duplicate"); if (GTK_TOGGLE_BUTTON (widget)->active) { if (gui_main_head != gui_tv_head) { gtk_label_set_text (gui_heads.twin, "lost"); back_card->initSharedView (&x, &y); gui_view_pos.hcenter = x; gui_view_pos.vcenter = y; gui_set_view (x, y); /* FIXME set active */ } } else { /* FIXME set inactive */ } } void view_cb (GtkWidget *widget, gpointer data) { int view_x, view_y; RAISE (MSG_DEBUG, "view pos"); view_x = (int) gui_view_pos.hadj->value; view_y = (int) gui_view_pos.vadj->value; if (back_card->adjustViewport (gui_service_flags, &view_x, &view_y)) { gui_set_view (view_x, view_y); } } void service_timeout (void) { char s[20]; gui_service_timeout_id = gtk_timeout_add ( gui_service_delays [gui_service_delay], (GtkFunction) service_view_cb, NULL); snprintf (s, 20, "%4i ms", gui_service_delays [gui_service_delay]); gtk_label_set_text (gui_heads.timer, s); } gint service_view_cb (gpointer data) { int view_x, view_y; Window root, child; int root_x, root_y; int win_x, win_y; unsigned int mask; if (gui_tvstate && gui_main_head != gui_tv_head && gui_service_flags != 0) { XQueryPointer (gdk_display, my_gdk_root_window, &root, &child, &root_x, &root_y, &win_x, &win_y, &mask); RAISE (MSG_DEBUG, "service %i,%i", root_x, root_y); view_x = (int) gui_view_pos.hadj->value; view_y = (int) gui_view_pos.vadj->value; if (back_card->serviceViewportCursor (gui_service_flags, root_x, root_y, &view_x, &view_y)) { gui_set_view (view_x, view_y); gui_service_delay = 0; } else { if (gui_service_delays [gui_service_delay + 1] != 0) gui_service_delay++; } } else { if (gui_service_delays [gui_service_delay + 1] != 0) gui_service_delay++; } service_timeout (); return FALSE; /* continue */ } void service_flag_cb (GtkWidget *widget, gpointer data) { if (GTK_TOGGLE_BUTTON (widget)->active) { gui_service_flags |= (int) data; } else { gui_service_flags &= ~ (int) data; } RAISE (MSG_DEBUG, "service flag %x", gui_service_flags); } void service_update_cb (GtkWidget *button, gpointer data) { GuiFlagMask *m = (GuiFlagMask *) gtk_object_get_data (GTK_OBJECT(button), "mask"); gtk_signal_handler_block_by_func (GTK_OBJECT (button), GTK_SIGNAL_FUNC (service_flag_cb), (gpointer) m->mask); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), (*((int *) m->addr) & m->mask) ? TRUE : FALSE); gtk_signal_handler_unblock_by_func (GTK_OBJECT (button), GTK_SIGNAL_FUNC (service_flag_cb), (gpointer) m->mask); } /* ---- connector ---- */ void gui_connector_cb (GtkWidget *widget, gpointer data) { if (GTK_TOGGLE_BUTTON (widget)->active) { gui_settings.connect = (TVConnect) data; } settings_cb (NULL, 0); } /* * Check which TV connections are available, and set radio group. */ void gui_connector_set (TVConnect connect) { RAISE (MSG_DEBUG, "set connect %i %i", connect, opt_connect); if (connect == CONNECT_AUTO) { RAISE (MSG_DEBUG, "auto connect"); connect = back_card->getConnection (); } gui_settings.connect = connect; set_radio_group_active (gui_settings.output, (int) connect); } void gui_connector_init (void) { if (opt_connect == CONNECT_NONE) { gui_connector_set (CONNECT_AUTO); } else { gui_connector_set (opt_connect); } } void check_monitor_cb (GtkWidget *widget, gpointer data) { gui_connector_set (CONNECT_AUTO); } /* ---- chip (I2C bus device) ---- */ void gui_device_changed (TVChip last_type) { RAISE (MSG_DEBUG, "gui_device_changed %i %i", last_type, gui_tv_chip); if (last_type != gui_tv_chip) { switch (last_type & TV_ENCODER) { case TV_BROOKTREE: gtk_signal_emit_by_name (GTK_OBJECT (hide_bt), "changed"); break; case TV_CONEXANT: gtk_signal_emit_by_name (GTK_OBJECT (hide_cx), "changed"); break; case TV_CHRONTEL_MODEL1: gtk_signal_emit_by_name (GTK_OBJECT (hide_ch), "changed"); break; case TV_CHRONTEL_MODEL2: /* FIXME */ gtk_signal_emit_by_name (GTK_OBJECT (hide_ch), "changed"); break; case TV_PHILIPS_MODEL1: gtk_signal_emit_by_name (GTK_OBJECT (hide_ph1), "changed"); break; case TV_PHILIPS_MODEL2: gtk_signal_emit_by_name (GTK_OBJECT (hide_ph2), "changed"); break; case TV_NVIDIA: gtk_signal_emit_by_name (GTK_OBJECT (hide_nx), "changed"); break; default: break; } } /* Always, because card could have changed */ gui_func = data_func (gui_card->type, gui_tv_chip); if (last_type != gui_tv_chip) { switch (gui_tv_chip & TV_ENCODER) { case TV_BROOKTREE: gtk_signal_emit_by_name (GTK_OBJECT (show_bt), "changed"); break; case TV_CONEXANT: gtk_signal_emit_by_name (GTK_OBJECT (show_cx), "changed"); break; case TV_CHRONTEL_MODEL1: gtk_signal_emit_by_name (GTK_OBJECT (show_ch), "changed"); break; case TV_CHRONTEL_MODEL2: /* FIXME */ gtk_signal_emit_by_name (GTK_OBJECT (show_ch), "changed"); break; case TV_PHILIPS_MODEL1: gtk_signal_emit_by_name (GTK_OBJECT (show_ph1), "changed"); break; case TV_PHILIPS_MODEL2: gtk_signal_emit_by_name (GTK_OBJECT (show_ph2), "changed"); break; case TV_NVIDIA: gtk_signal_emit_by_name (GTK_OBJECT (show_nx), "changed"); break; default: break; } if (gui_func) gui_func->defaults (&gui_set); modifySet (&gui_set, opt_set_act); gui_func->clamp (&gui_set, &gui_regs); gui_set_settings (); } gui_connector_init (); gui_modes_init (); /* FIXME: Should set head here */ RAISE (MSG_DEBUG, "gui_device_changed end"); } /* * Set selected I2C device (TV chip). */ void gui_device_cb (GtkWidget *widget, ChipPtr chip) { TVChip last_type; last_type = gui_tv_chip; back_card->setChip (chip, TRUE); gui_tv_chip = chip->type; gui_device_changed (last_type); } void gui_device_set (ChipPtr chip) { TVChip last_type; int i; ChipPtr c; last_type = gui_tv_chip; if (!chip) return; back_card->setChip (chip, TRUE); gui_tv_chip = chip->type; for (i = 0, c = gui_card->chips; c; c = c->next, i++) { if (c == chip) gtk_option_menu_set_history (gui_config_mask.chip, i); } gui_device_changed (last_type); RAISE (MSG_DEBUG, "gui_device_set end"); } void gui_device_init (Bool probe) { GtkWidget *menu; GtkWidget *item; ChipPtr c, ca; RAISE (MSG_DEBUG, "gui_device_init"); menu = gtk_menu_new (); if (probe) back_card->probeChips (); for (c = gui_card->chips; c; c = c->next) { item = gtk_menu_item_new_with_label (c->name); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC(gui_device_cb), (gpointer) c); gtk_menu_append (GTK_MENU (menu), item); } if (!gui_card->chips) { item = gtk_menu_item_new_with_label (""); gtk_menu_append (GTK_MENU (menu), item); } /* unrefs and frees the old menu ... hopefully. */ gtk_option_menu_set_menu (gui_config_mask.chip, menu); /* make labels visible */ gtk_widget_show_all (menu); gui_device_set (findDefOptChip (gui_card)); RAISE (MSG_DEBUG, "gui_device_init end"); } void check_chip_cb (GtkWidget *widget, gpointer data) { gui_device_init (TRUE); } /* ---- pci card ---- */ void gui_card_changed (CardPtr last_card) { int x, y; char s [30]; RAISE (MSG_DEBUG, "gui_card_changed"); if (gui_card) { snprintf (s, 30, "%s", gui_card->arch); } else { strncpy (s, "(No card)", 20); } gtk_label_set_text (gui_config_mask.io_addr, s); if (last_card != gui_card) { if (last_card) gtk_signal_emit_by_name (GTK_OBJECT ( hide_card [last_card->type - CARD_FIRST]), "changed"); if (gui_card) gtk_signal_emit_by_name (GTK_OBJECT ( show_card [gui_card->type - CARD_FIRST]), "changed"); } back_card->getHeads (&gui_main_head, &gui_tv_head, &gui_video_head, &gui_max_head); gui_heads.main->upper = gui_heads.tv->upper = gui_heads.video->upper = gui_max_head; if (opt_head != -1) { gui_tv_head = gui_video_head = opt_head; back_card->setHeads (gui_main_head, gui_tv_head, gui_video_head); } gui_set_heads (); if (gui_max_head > 1) { gtk_signal_emit_by_name (GTK_OBJECT (show_head), "changed"); } else { gtk_signal_emit_by_name (GTK_OBJECT (hide_head), "changed"); } if (back_card->getTwinView (&x, &y)) { gtk_label_set_text (gui_heads.twin, "On"); gui_set_view (x, y); } else { gtk_label_set_text (gui_heads.twin, "Off"); } head_update_cb (NULL, NULL); #ifndef DISABLE_TIMEOUT if (gui_max_head > 1) { gui_service_delay = 0; service_timeout (); } else { if (gui_service_timeout_id != -1) gtk_timeout_remove (gui_service_timeout_id); } #endif gui_device_init (FALSE); } void gui_card_set (CardPtr card) { CardPtr last_card; last_card = gui_card; if (gui_card) { back_access->closeCard (); } gui_card = card; back_access->openCard (gui_card); gui_card_changed (last_card); } void gui_card_cb (GtkWidget *widget, gpointer data) { gui_card_set ((CardPtr) data); } /* -------- X Video Mode -------- */ /* * Switch to smallest fitting video mode. */ void xswitch_mode_cb (GtkWidget *widget, gpointer data) { if (!gui_act_mode) return; switch_vidmode (gdk_display, my_gdk_screen, gui_act_mode->spec.res_x, gui_act_mode->spec.res_y); } /* -------- X window center & resize -------- */ void gui_xresize_cb (GtkWidget *widget, gpointer data); void gui_xmove_cb (GtkWidget *widget, gpointer data); void gui_xwindow_changed (void); /* * Check if window size is current, and get new size & hints if not. */ Bool gui_xwindow_error; int gui_xwindow_handler (Display *dpy, XErrorEvent *error) { gui_xwindow_error = TRUE; return 0; } void gui_xwindow_check (void) { XErrorHandler handler; Window root; int x, y; unsigned width, height, borderw, depth; static XSizeHints *hints = NULL; long user; Window junkwin; RAISE (MSG_DEBUG, "xwindow_check %li", gui_window); if (!gui_window) return; if (!hints) hints = XAllocSizeHints(); gui_xwindow_error = FALSE; handler = XSetErrorHandler (gui_xwindow_handler); XGetGeometry (gdk_display, gui_window, &root, &x, &y, &width, &height, &borderw, &depth); XTranslateCoordinates (gdk_display, gui_window, my_gdk_root_window, x-borderw, y-borderw, &x, &y, &junkwin); XSetErrorHandler(handler); if (gui_xwindow_error) { gui_window = None; gui_xwindow_changed (); return; } if (x != gui_window_x || y != gui_window_y || width != gui_window_width || height != gui_window_height) { RAISE (MSG_DEBUG, " %i,%i %ix%i", x, y, width, height); gui_window_x = x; gui_window_y = y; gui_window_width = width; gui_window_height = height; XGetWMNormalHints (gdk_display, gui_window, hints, &user); gtk_signal_handler_block_by_func (GTK_OBJECT (gui_xwin_pos.hadj), GTK_SIGNAL_FUNC (gui_xmove_cb), NULL); gtk_signal_handler_block_by_func (GTK_OBJECT (gui_xwin_pos.vadj), GTK_SIGNAL_FUNC (gui_xmove_cb), NULL); gtk_adjustment_set_value (gui_xwin_pos.hadj, x); gtk_adjustment_set_value (gui_xwin_pos.vadj, y); gtk_signal_handler_unblock_by_func (GTK_OBJECT (gui_xwin_pos.hadj), GTK_SIGNAL_FUNC (gui_xmove_cb), NULL); gtk_signal_handler_unblock_by_func (GTK_OBJECT (gui_xwin_pos.vadj), GTK_SIGNAL_FUNC (gui_xmove_cb), NULL); gtk_signal_handler_block_by_func (GTK_OBJECT (gui_xwin_size.hadj), GTK_SIGNAL_FUNC (gui_xresize_cb), NULL); gtk_signal_handler_block_by_func (GTK_OBJECT (gui_xwin_size.vadj), GTK_SIGNAL_FUNC (gui_xresize_cb), NULL); if (hints->flags & PResizeInc) { gui_xwin_size.hadj->step_increment = hints->width_inc; gui_xwin_size.hadj->page_increment = 10 * hints->width_inc; gui_xwin_size.vadj->step_increment = hints->height_inc; gui_xwin_size.vadj->page_increment = 10 * hints->height_inc; } gtk_adjustment_set_value (gui_xwin_size.hadj, width); gtk_adjustment_set_value (gui_xwin_size.vadj, height); gtk_signal_handler_unblock_by_func (GTK_OBJECT (gui_xwin_size.hadj), GTK_SIGNAL_FUNC (gui_xresize_cb), NULL); gtk_signal_handler_unblock_by_func (GTK_OBJECT (gui_xwin_size.vadj), GTK_SIGNAL_FUNC (gui_xresize_cb), NULL); } } /* * Move the X window. */ void gui_xmove_cb (GtkWidget *widget, gpointer data) { gui_xwindow_check (); gui_window_x = (int) gui_xwin_pos.hadj->value; gui_window_y = (int) gui_xwin_pos.vadj->value; if (gui_window) { XMoveWindow (gdk_display, gui_window, gui_window_x, gui_window_y); XSync (gdk_display, False); /* give the WM a chance */ gui_xwindow_check (); } } /* * Resize the X window. */ void gui_xresize_cb (GtkWidget *widget, gpointer data) { gui_xwindow_check (); gui_window_width = (int) gui_xwin_size.hadj->value; gui_window_height = (int) gui_xwin_size.vadj->value; if (gui_window) { XResizeWindow (gdk_display, gui_window, gui_window_width, gui_window_height); XSync (gdk_display, False); /* give the WM a chance */ gui_xwindow_check (); } } /* * The X Window selection has changed. */ void gui_xwindow_changed (void) { char *name; gui_window_width = -1; gui_window_height = -1; if (gui_window) { gui_xwindow_check (); /* get width and height */ XFetchName(gdk_display, gui_window, &name); gtk_label_set_text (gui_mode_mask.xwin_name, name); gui_xwin_pos.hcenter = (int) gui_window_x; gui_xwin_pos.vcenter = (int) gui_window_y; gui_xwin_size.hcenter = (int) gui_window_width; gui_xwin_size.vcenter = (int) gui_window_height; gtk_widget_set_sensitive (GTK_WIDGET (gui_mode_mask.xwin_frame), TRUE); gtk_widget_set_sensitive (GTK_WIDGET (gui_mode_mask.xcenter), TRUE); gtk_widget_set_sensitive (GTK_WIDGET (gui_mode_mask.xadjust), TRUE); gtk_widget_set_sensitive (GTK_WIDGET (gui_mode_mask.xwin_pos), TRUE); gtk_widget_set_sensitive (GTK_WIDGET (gui_mode_mask.xwin_size), TRUE); } else { gtk_label_set_text (gui_mode_mask.xwin_name, "(None)"); gtk_widget_set_sensitive (GTK_WIDGET (gui_mode_mask.xwin_frame), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (gui_mode_mask.xcenter), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (gui_mode_mask.xadjust), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (gui_mode_mask.xwin_pos), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (gui_mode_mask.xwin_size), FALSE); } } /* * Select an X window, and store original size. */ void xselect_window_cb (GtkWidget *widget, gpointer data) { gui_window = Select_Window (gdk_display, my_gdk_screen); if (gui_window != None) gui_window = XmuClientWindow (gdk_display, gui_window); gui_xwindow_changed (); } /* * Center the X window in the X virtual viewport. */ void xcenter_window_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "xcenter_window_cb %li", gui_window); gui_xwindow_check (); if (!gui_window) return; if (gui_tvstate) { center_window (gdk_display, my_gdk_screen, gui_window, gui_act_mode->spec.res_x, gui_act_mode->spec.res_y); } else { center_window (gdk_display, my_gdk_screen, gui_window, -1, -1); } } /* * Adjust the X window size to the mode size. */ void xadjust_window_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "xadjust_window_cb %li", gui_window); gui_xwindow_check (); if (!gui_window) return; if (!gui_act_mode) return; XResizeWindow (gdk_display, gui_window, gui_act_mode->spec.res_x, gui_act_mode->spec.res_y); /* FIXME: If in dualhead mode, also move window ? */ XSync (gdk_display, False); /* give the WM a chance */ gui_xwindow_check (); /* update size */ } /* -------- -------- */ void offset_center_cb (GtkWidget *widget, struct mask_offset *offset) { /* FIXME: freeze */ gtk_adjustment_set_value (offset->hadj, offset->hcenter); gtk_adjustment_set_value (offset->vadj, offset->vcenter); /* FIXME: thaw, signal changed */ } void spin_dec_cb (GtkWidget *widget, gpointer data) { gtk_spin_button_spin (GTK_SPIN_BUTTON(data), GTK_SPIN_STEP_BACKWARD, 0.0); } void spin_inc_cb (GtkWidget *widget, gpointer data) { gtk_spin_button_spin (GTK_SPIN_BUTTON(data), GTK_SPIN_STEP_FORWARD, 0.0); } void changed_all_cb (GtkObject *obj, gpointer data) { gtk_signal_emit_by_name (GTK_OBJECT (changed_all), "changed"); } /* -------- -------- */ void gui_orig_update (void) { TVRegs temp; back_card->getMode (&temp); gui_tvstate = (temp.devFlags & DEV_TELEVISION) ? TRUE : FALSE; if (!gui_tvstate) { gui_orig_regs = &gui_orig_mode.regs; *gui_orig_regs = temp; } } void gui_head_init (void) { int view_x, view_y; RAISE (MSG_DEBUG, "gui_head_init"); if (gui_main_head != gui_tv_head && !back_card->getTwinView (&view_x, &view_y)) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gui_heads.shared), TRUE); /* this calls duplicate_cb, which does the rest. */ } } void tvmonitor_on_cb (GtkButton *button, gpointer data) { gui_get_settings (); gui_get_settings_flags (); gui_orig_update (); back_card->setModeSettings (&gui_regs, gui_bypass ? NULL : &gui_set); gui_tvstate = TRUE; gui_head_init (); gtk_label_set_text (gui_mode_mask.tv_state, "On"); gtk_label_set_text (gui_mode_mask.mon_state, (gui_regs.devFlags & DEV_MONITOR) ? "Dual" : "Off"); head_update_cb (NULL, NULL); } void tvmonitor_off_cb (GtkButton *button, gpointer data) { if (!gui_orig_regs) { /* We don't have valid crt values, so try the X vidmode current modeline. */ if (get_vidmode (gdk_display, my_gdk_screen, NULL, NULL, &gui_orig_mode.regs.crtc, data_card_func (gui_card->type)->make)) { gui_orig_regs= &gui_orig_mode.regs; gui_orig_regs->devFlags = DEV_MONITOR; gui_orig_regs->portHost = PORT_PCLK_MASTER | PORT_SYNC_MASTER; gui_orig_regs->portEnc = 0; } } if (gui_orig_regs) { back_card->setModeSettings (gui_orig_regs, NULL); } else { fprintf (stderr, "No monitor crt modeline found."); } gui_tvstate = FALSE; gtk_label_set_text (gui_mode_mask.tv_state, "Off"); gtk_label_set_text (gui_mode_mask.mon_state, "On"); head_update_cb (NULL, NULL); } void color_bar_cb (GtkButton *button, gpointer data) { back_card->setTestImage (&gui_regs.enc, gui_bypass ? NULL : &gui_set); gtk_label_set_text (gui_mode_mask.tv_state, "Test"); head_update_cb (NULL, NULL); } void apply_cb (GtkButton *button, gpointer data) { if (gui_tvstate) { gui_get_settings (); gui_get_settings_flags (); back_card->setModeSettings (&gui_regs, gui_bypass ? NULL : &gui_set); } } void auto_apply_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "auto_apply_cb"); if (gui_tvstate && gui_auto) { gui_get_settings (); gui_get_settings_flags (); back_card->setModeSettings (&gui_regs, gui_bypass ? NULL : &gui_set); } } void auto_cb (GtkWidget *widget, gpointer data) { if (GTK_TOGGLE_BUTTON (widget)->active) { gui_auto = TRUE; } else { gui_auto = FALSE; } } void gui_print_cb (GtkButton *button, gpointer data) { TVRegs temp; temp = gui_regs; gui_get_settings (); gui_get_settings_flags (); if (gui_func && !gui_bypass) gui_func->setup (&gui_set, &temp); if (gui_act_mode) { printf ("*** Resolution %03i x %03i Overscan %06.3f x %06.3f", gui_act_mode->spec.res_x, gui_act_mode->spec.res_y, gui_act_mode->spec.hoc, gui_act_mode->spec.voc); } if ((int) data & PRINT_FP_REGS) print_fp_regs (&temp.crtc, gui_card->type); if ((int) data & PRINT_CRT_REGS) print_crt_regs (&temp.crtc, gui_card->type); if ((int) data & PRINT_CHIP_REGS) print_tv_regs (&temp.enc, gui_tv_chip); }; void gui_reset_port_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "gui_reset_port_cb "); if (gui_act_mode) { gui_port_set (&gui_act_mode->regs); } } void gui_reset_crt_cb (GtkWidget *widget, gpointer data) { if (gui_act_mode) { gui_crt_set (&gui_act_mode->regs.crtc); } } void reset_setting_cb (GtkWidget *widget, gpointer data) { if (gui_func) { gui_func->defaults (&gui_set); gui_set_settings (); auto_apply_cb (NULL, NULL); } } void gui_monitor_mode_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "gui_monitor_cb "); if (gui_orig_regs) { gui_act_mode_set (&gui_orig_mode); } } void gui_fetch_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "gui_fetch_cb"); back_card->getMode (&gui_fetch_mode.regs); /* FIXME calculate spec?? ... card/encoder dependent */ gui_act_mode_set (&gui_fetch_mode); } void quit_cb (GtkWidget *widget, gpointer data) { gtk_main_quit (); } void gui_map_cb (GtkWidget *widget, GtkAccelGroup *group) { gtk_window_add_accel_group (GTK_WINDOW (gui_main_window), group); } void gui_unmap_cb (GtkWidget *widget, GtkAccelGroup *group) { gtk_window_remove_accel_group (GTK_WINDOW (gui_main_window), group); } /* -------- -------- */ gfloat lower_bound (int bits) { if (bits >= 0) return 0; bits = -bits - 1; return (gfloat) - (((long long)1 << bits) - 1); } gfloat upper_bound (int bits) { if (bits < 0) bits = -bits - 1; return (gfloat) (((long long)1 << bits) - 1); } /* -------- GUI Pages helper routines -------- */ GtkWidget *create_adjust_frame (char *title, int min, int max, gboolean hor_vert, struct mask_offset *offset, GtkSignalFunc signal, GtkWidget **ptable) { GtkWidget *frame; GtkWidget *table; GtkWidget *button; GtkWidget *spin; GtkWidget *box; GtkAdjustment *adj; frame = gtk_frame_new (title); table = gtk_table_new (3, 3, FALSE); if (ptable) *ptable = table; gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_container_add (GTK_CONTAINER (frame), table); if (hor_vert) { box = gtk_hbox_new (FALSE, 0); } else { box = gtk_vbox_new (FALSE, 0); } gtk_table_attach (GTK_TABLE(table), box, 0,3, 3,4, GTK_FILL, GTK_FILL, 0,0); adj = (GtkAdjustment *) gtk_adjustment_new (0.0, (double) min, (double) max, 1.0, 10.0, 0.0); offset->hadj = adj; offset->hcenter = 0.0; spin = gtk_spin_button_new (adj, 0.0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin), GTK_UPDATE_IF_VALID); gtk_box_pack_start(GTK_BOX (box), spin, TRUE, TRUE, 0); button = create_arrow_button (GTK_TABLE(table), GTK_ARROW_LEFT, 0,1, 1,2); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (spin_dec_cb), spin); button = create_arrow_button (GTK_TABLE(table), GTK_ARROW_RIGHT, 2,3, 1,2); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (spin_inc_cb), spin); adj = (GtkAdjustment *) gtk_adjustment_new (0.0, (double) min, (double) max, 1.0, 10.0, 0.0); offset->vadj = adj; offset->vcenter = 0.0; spin = gtk_spin_button_new (adj, 0.0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin), GTK_UPDATE_IF_VALID); gtk_box_pack_start(GTK_BOX (box), spin, TRUE, TRUE, 0); button = create_arrow_button (GTK_TABLE(table), GTK_ARROW_UP, 1,2, 0,1); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (spin_dec_cb), spin); button = create_arrow_button (GTK_TABLE(table), GTK_ARROW_DOWN, 1,2, 2,3); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (spin_inc_cb), spin); button = create_arrow_button (GTK_TABLE(table), (GtkArrowType) -1, 1,2, 1,2); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (offset_center_cb), offset); gtk_table_set_col_spacings (GTK_TABLE(table), 5); gtk_table_set_row_spacings (GTK_TABLE(table), 5); if (signal) { gtk_signal_connect (GTK_OBJECT (offset->hadj), "value-changed", signal, NULL); gtk_signal_connect (GTK_OBJECT (offset->vadj), "value-changed", signal, NULL); } return frame; } void gui_mask_checkbutton (GtkWidget *table, GtkObject *changed, GuiFlagMask *m, int x1, int x2, int y) { GtkWidget *button; button = gtk_check_button_new_with_label (m->label); gtk_table_attach (GTK_TABLE(table), button, x1, x2, y, y+1, GTK_FILL, GTK_FILL, 0, 0); gtk_object_set_data (GTK_OBJECT (button), "mask", m); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (flag_changed_cb), NULL); gtk_signal_connect_object (changed, "changed", GTK_SIGNAL_FUNC (flag_update_cb), GTK_OBJECT (button)); } /* * Create an option menu for flags */ GtkWidget* gui_mask_option_menu_flag (GtkWidget *table, GtkObject *changed, GuiFlagMask *m, int x1, int x2, int y, char *clear, char *set) { GtkWidget *opt, *menu, *item; opt = gtk_option_menu_new(); gtk_object_set_data (GTK_OBJECT (opt), "mask", m); menu = gtk_menu_new(); item = gtk_menu_item_new_with_label (clear); gtk_object_set_data (GTK_OBJECT (item), "mask", m); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (flag_opt_changed_cb), (gpointer) 0); gtk_menu_append (GTK_MENU (menu), item); item = gtk_menu_item_new_with_label (set); gtk_object_set_data (GTK_OBJECT (item), "mask", m); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (flag_opt_changed_cb), (gpointer) 1); gtk_signal_connect_object (changed, "changed", GTK_SIGNAL_FUNC (flag_opt_update_cb), GTK_OBJECT (opt)); gtk_menu_append (GTK_MENU (menu), item); gtk_option_menu_set_menu (GTK_OPTION_MENU (opt), menu); if (table) { gtk_table_attach (GTK_TABLE(table), opt, x1,x2, y,y+1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); } return opt; } /* * Create a labelled label in a frame. */ GtkWidget* create_framed_label (GtkWidget *table, char *title, char *value, int x1, int x2, int x3, int y) { GtkWidget *frame; GtkWidget *label; if (title) { label = gtk_label_new (title); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE(table), label, x1, x2, y, y+1, GTK_FILL, GTK_FILL, 0, 0); } frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN); gtk_table_attach (GTK_TABLE(table), frame, x2, x3, y, y+1, GTK_FILL, GTK_FILL, 0, 0); label = gtk_label_new (value); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_padding (GTK_MISC (label), 5, 0); gtk_container_add (GTK_CONTAINER(frame), label); return label; } /* * Create label with another label in a table, for status page. */ GtkLabel *gui_mask_label (GtkWidget *table, char *title, char *val, int x1, int x2, int x3, int y) { GtkWidget *label; label = gtk_label_new (title); gtk_table_attach (GTK_TABLE(table), label, x1, x2, y, y+1, GTK_FILL,GTK_FILL,0,0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); label = gtk_label_new (val); gtk_table_attach (GTK_TABLE(table), label, x2, x3, y, y+1, GTK_FILL,GTK_FILL,0,0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); return (GtkLabel *) label; } /* * Create label with spinbutton, adjustment and signals, for head selection. */ GtkAdjustment *gui_labelled_entry (GtkWidget *table, char *title, GtkSignalFunc signal, int x1, int x2, int x3, int y) { GtkWidget *spin; GtkWidget *label; GtkAdjustment *adj; label = gtk_label_new (title); gtk_table_attach (GTK_TABLE(table), label, x1, x2, y, y+1, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 1.0, 2.0, 1.0, 1.0, 0.0); spin = create_spinbutton_with_size (adj, 0.0, 0); my_gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spin), GTK_SHADOW_OUT); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin), GTK_UPDATE_IF_VALID); gtk_table_attach (GTK_TABLE(table), spin, x2, x3, y, y+1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); /* Connect functionality to adjustment, not to spinbutton */ if (signal) { gtk_signal_connect (GTK_OBJECT (adj), "value-changed", signal, NULL); } return adj; } /* * Create scale with signals, for settings mask. Return adjustment. */ GtkAdjustment *gui_mask_scale (GtkWidget *table, GtkObject *changed, GtkSignalFunc changed_cb, GuiSetMask *m, int x1, int x2, int y) { GtkWidget *scale; GtkAdjustment *adj; adj = (GtkAdjustment *) gtk_adjustment_new (0.0, (double) m->min, (double) m->max, 1.0, 10.0, 0.0); scale = gtk_hscale_new (adj); gtk_scale_set_digits (GTK_SCALE (scale), 0); // gtk_adjustment_set_value (adj, 0.0); gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_RIGHT); gtk_table_attach (GTK_TABLE(table), scale, x1,x2, y,y+1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0,0); /* Connect functionality to adjustment, not to spinbutton */ gtk_object_set_data (GTK_OBJECT (adj), "adj", m); gtk_signal_connect (GTK_OBJECT (adj), "value-changed", GTK_SIGNAL_FUNC (set_changed_cb), NULL); gtk_signal_connect (GTK_OBJECT (adj), "value-changed", changed_cb, NULL); gtk_signal_connect_object (changed, "changed", GTK_SIGNAL_FUNC (set_update_cb), GTK_OBJECT (adj)); return adj; } /* * Create label with spinbutton, adjustment and signals, for register mask. */ void gui_mask_entry (GtkWidget *table, GtkObject *changed, GuiRegMask *m, int x1, int x2, int x3, int y) { GtkWidget *spin; GtkWidget *label; GtkAdjustment *adj; label = gtk_label_new (m->label); gtk_table_attach (GTK_TABLE(table), label, x1, x2, y, y+1, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); adj = (GtkAdjustment *) gtk_adjustment_new (0.0, lower_bound (m->bits), upper_bound (m->bits), m->tick, m->tick * 10, 0.0); spin = create_spinbutton_with_size (adj, 0.0, 0); my_gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spin), GTK_SHADOW_OUT); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin), GTK_UPDATE_IF_VALID); gtk_table_attach (GTK_TABLE(table), spin, x2, x3, y, y+1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); /* Connect functionality to adjustment, not to spinbutton */ gtk_object_set_data (GTK_OBJECT (adj), "adj", m); gtk_signal_connect (GTK_OBJECT (adj), "value-changed", GTK_SIGNAL_FUNC (reg_changed_cb), NULL); gtk_signal_connect_object (changed, "changed", GTK_SIGNAL_FUNC (reg_update_cb), GTK_OBJECT (adj)); } /* * Create label with two spinbuttons, adjustments and signals. * This is a workaround, since the stupid spinbuttons can only hold * float values, which is not enough for 32 bits. */ void gui_mask_twin_entry (GtkWidget *table, GtkObject *changed, GuiRegMask *m, int x1, int x2, int x3, int x4, int y) { GtkWidget *spin; GtkWidget *label; GtkAdjustment *adj; label = gtk_label_new (m->label); gtk_table_attach (GTK_TABLE(table), label, x1, x2, y, y+1, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 99999.0, m->tick, m->tick * 100, 0.0); spin = create_spinbutton_with_size (adj, 0.0, 0); my_gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spin), GTK_SHADOW_OUT); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin), GTK_UPDATE_IF_VALID); gtk_table_attach (GTK_TABLE(table), spin, x2, x3, y, y+1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); /* Connect functionality to adjustment, not to spinbutton */ gtk_object_set_data (GTK_OBJECT (adj), "adj", m); gtk_signal_connect (GTK_OBJECT (adj), "value-changed", GTK_SIGNAL_FUNC (reg_high_changed_cb), NULL); gtk_signal_connect_object (changed, "changed", GTK_SIGNAL_FUNC (reg_high_update_cb), GTK_OBJECT (adj)); adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 99999.0, m->tick, m->tick * 100, 0.0); spin = create_spinbutton_with_size (adj, 0.0, 0); my_gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spin), GTK_SHADOW_OUT); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin), GTK_UPDATE_IF_VALID); gtk_table_attach (GTK_TABLE(table), spin, x3, x4, y, y+1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); /* Connect functionality to adjustment, not to spinbutton */ gtk_object_set_data (GTK_OBJECT (adj), "adj", m); gtk_signal_connect (GTK_OBJECT (adj), "value-changed", GTK_SIGNAL_FUNC (reg_low_changed_cb), NULL); gtk_signal_connect_object (changed, "changed", GTK_SIGNAL_FUNC (reg_low_update_cb), GTK_OBJECT (adj)); } /* -------- GUI Pages -------- */ GtkWidget *gui_regs_page (char *title, GtkAccelGroup *accel_group, int print_mode, GtkObject *update, GtkSignalFunc reset_cb, int reg_x, int reg_y, int reg_lines, GuiRegMask *mask_reg, int twin_x, int twin_y, GuiRegMask *mask_twin, int flag_x, int flag_y, int flag_lines, GuiFlagMask *mask_flag) { GtkWidget *page; GtkWidget *frame; GtkWidget *table; GtkWidget *button; int i; page = gtk_table_new (1,1,FALSE); gtk_signal_connect (GTK_OBJECT (page), "map", GTK_SIGNAL_FUNC (gui_map_cb), (gpointer) accel_group); gtk_signal_connect (GTK_OBJECT (page), "unmap", GTK_SIGNAL_FUNC (gui_unmap_cb), (gpointer) accel_group); frame = gtk_frame_new (title); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach_defaults(GTK_TABLE(page), frame, 0,4,0,1); table = gtk_table_new (1, 1, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_container_add (GTK_CONTAINER (frame), table); if (mask_reg) { for (i = 0; TRUE; i++) { GuiRegMask *m = mask_reg + i; int x = (i / reg_lines) * 3 + reg_x; int y = i % reg_lines + reg_y; if (!(m->label)) break; gui_mask_entry (table, update, m, x, x+2, x+3, y); } } if (mask_twin) { for (i = 0; TRUE; i++) { GuiRegMask *m = mask_twin + i; int x = twin_x; int y = i + twin_y; if (!(m->label)) break; gui_mask_twin_entry (table, update, m, x, x+2, x+3, x+4, y); } } if (mask_flag) { for (i = 0; TRUE; i++) { GuiFlagMask *m = mask_flag + i; int x = (i / flag_lines) * 2 + flag_x; int y = i % flag_lines + flag_y; if (!(m->label)) break; gui_mask_checkbutton (table, update, m, x, x+2, y); } } gtk_table_set_col_spacings (GTK_TABLE(table), 5); gtk_table_set_row_spacings (GTK_TABLE(table), 5); /* Buttons */ button = gtk_button_new_with_label ("Fetch"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gui_fetch_cb), NULL); gtk_table_attach(GTK_TABLE(page), button, 0,1, 1,2, GTK_FILL, GTK_FILL, 0, 0); button = gtk_toggle_button_new_with_label ("Bypass"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (bypass_cb), NULL); gtk_signal_connect (GTK_OBJECT (update_bypass), "changed", GTK_SIGNAL_FUNC (bypass_update_cb), GTK_OBJECT (button)); gtk_table_attach(GTK_TABLE(page), button, 1,2, 1,2, GTK_FILL, GTK_FILL, 0, 0); button = gtk_button_new_with_label ("Print"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gui_print_cb), (gpointer) print_mode); gtk_table_attach(GTK_TABLE(page), button, 2,3, 1,2, GTK_FILL, GTK_FILL, 0, 0); button = gtk_button_new_with_label ("Reset"); gtk_signal_connect (GTK_OBJECT (button), "clicked", reset_cb, NULL); gtk_widget_add_accelerator (GTK_WIDGET (button), "clicked", accel_group, gui_accel[ACCEL_RESET].key, gui_accel[ACCEL_RESET].mods, GTK_ACCEL_VISIBLE); gtk_table_attach(GTK_TABLE(page), button, 3,4, 1,2, GTK_FILL, GTK_FILL, 0, 0); return page; } /* -------- */ GtkWidget *gui_config_page (void) { GtkWidget *page; GtkWidget *frame; GtkWidget *table; GtkWidget *label; GtkWidget *box; GtkWidget *button; int i; CardPtr card; GtkWidget *opt, *menu, *item; page = gtk_table_new (1,1,FALSE); /* Hardware, Card Detected */ frame = gtk_frame_new ("Hardware"); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach (GTK_TABLE(page), frame, 0,2, 0,1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); table = gtk_table_new (1,1,FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_container_add (GTK_CONTAINER (frame), table); label = gtk_label_new ("TV Encoder:"); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE(table), label, 0,1, 0,1, GTK_FILL, GTK_FILL, 0, 0); opt = create_option_menu (NULL, "", NULL); gui_config_mask.chip = (GtkOptionMenu *) (opt); gtk_table_attach (GTK_TABLE(table), opt, 1,2, 0,1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); label = gtk_label_new ("Video Card:"); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE(table), label, 0,1, 1,2, GTK_FILL, GTK_FILL, 0, 0); opt = gtk_option_menu_new(); menu = gtk_menu_new(); for (card = gui_card_list; card; card = card->next) { item = gtk_menu_item_new_with_label (card->name); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC(gui_card_cb), (gpointer) card); gtk_menu_append (GTK_MENU (menu), item); } gtk_option_menu_set_menu (GTK_OPTION_MENU (opt), menu); gtk_table_attach (GTK_TABLE(table), opt, 1,2, 1,2, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); label = gtk_label_new ("Architecture:"); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE(table), label, 0,1, 2,3, GTK_FILL, GTK_FILL, 0, 0); label = gtk_label_new ("---"); gui_config_mask.io_addr = GTK_LABEL (label); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE(table), label, 1,2, 2,3, GTK_FILL, GTK_FILL, 0, 0); gtk_table_set_row_spacings (GTK_TABLE(table), 3); gtk_table_set_col_spacings (GTK_TABLE(table), 5); /* Connector */ frame = gtk_frame_new ("Connector"); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach (GTK_TABLE(page), frame, 1,2, 1,2, GTK_FILL, GTK_FILL | GTK_EXPAND, 0,0); box = create_radio_box (2, FALSE, GTK_SIGNAL_FUNC (gui_connector_cb), &gui_settings.output, "Composite", "SVideo", "Both", "Convert", NULL); gtk_container_set_border_width (GTK_CONTAINER (box), 5); gtk_container_add (GTK_CONTAINER (frame), box); button = gtk_button_new_with_label ("Probe"); gtk_misc_set_padding (GTK_MISC (GTK_BIN(button)->child), 10, 0); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (check_monitor_cb), NULL); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); /* Color bars */ frame = gtk_frame_new ("Test Image"); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach(GTK_TABLE(page), frame, 1,2, 2,3, GTK_FILL, GTK_FILL, 0, 0); button = gtk_button_new_with_label ("Color bars"); gtk_container_set_border_width (GTK_CONTAINER (button), 5); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (color_bar_cb), NULL); gtk_container_add (GTK_CONTAINER (frame), button); /* Accelerators */ frame = gtk_frame_new ("Keyboard accelerators"); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach (GTK_TABLE(page), frame, 0,1, 1,3, GTK_FILL, GTK_FILL | GTK_EXPAND, 0,0); table = gtk_table_new (1,1,FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_container_add (GTK_CONTAINER (frame), table); gtk_table_set_row_spacings (GTK_TABLE(table), 3); gtk_table_set_col_spacings (GTK_TABLE(table), 20); for (i = 0; i < ACCEL_LAST; i++) { label = gtk_label_new (gui_accel[i].label); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0); gtk_table_attach (GTK_TABLE(table), label, 0,1, i,i+1, GTK_FILL, GTK_FILL, 0, 0); label = gtk_label_new (gui_accel[i].accel); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0); gtk_table_attach (GTK_TABLE(table), label, 1,2, i,i+1, GTK_FILL, GTK_FILL, 0, 0); } return page; } GtkWidget *gui_mode_page (void) { GtkWidget *page; GtkWidget *pane; GtkWidget *frame; GtkWidget *label; GtkWidget *opt; GtkWidget *button; GtkWidget *scroller; GtkWidget *clist; page = gtk_table_new (1,1,FALSE); gtk_container_set_border_width (GTK_CONTAINER (page), 0); pane = gtk_table_new (1,1,FALSE); gtk_container_set_border_width (GTK_CONTAINER (pane), 5); gtk_table_attach(GTK_TABLE(page), pane, 0,4, 0,1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); /* TV System */ frame = gtk_frame_new ("TV System"); gtk_container_set_border_width (GTK_CONTAINER (frame), 0); gtk_table_attach (GTK_TABLE(pane), frame, 0,1, 0,1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0,0); opt = create_option_menu (GTK_SIGNAL_FUNC (gui_system_cb), "NTSC", "NTSC-J", "PAL", "PAL-60", "PAL-N", "PAL-Nc", "PAL-M", "PAL-M60", "PAL-X", "SECAM", NULL); gui_mode_mask.system = (GtkOptionMenu *) opt; gtk_container_set_border_width (GTK_CONTAINER (opt), 3); /* FIXME resize/send event to option menu after new border width */ gtk_container_add (GTK_CONTAINER (frame), opt); /* Resolution */ frame = gtk_frame_new ("Resolution"); gtk_container_set_border_width (GTK_CONTAINER (frame), 0); gtk_table_attach (GTK_TABLE(pane), frame, 1,2, 0,1, GTK_FILL, GTK_FILL, 0,0); label = gtk_label_new ("---- x ---"); gui_mode_mask.res = (GtkLabel *) label; gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_padding (GTK_MISC (label), 5, 3); gtk_container_add (GTK_CONTAINER (frame), label); /* Size */ frame = gtk_frame_new ("Size"); gtk_container_set_border_width (GTK_CONTAINER (frame), 0); gtk_table_attach (GTK_TABLE(pane), frame, 2,3, 0,1, GTK_FILL, GTK_FILL, 0,0); label = gtk_label_new ("--------"); gui_mode_mask.size = (GtkLabel *) label; gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_padding (GTK_MISC (label), 5, 3); gtk_container_add (GTK_CONTAINER (frame), label); /* Aspect */ frame = gtk_frame_new ("Aspect"); gtk_container_set_border_width (GTK_CONTAINER (frame), 0); gtk_table_attach (GTK_TABLE(pane), frame, 3,4, 0,1, GTK_FILL, GTK_FILL, 0,0); label = gtk_label_new ("4:3"); gui_mode_mask.aspect = (GtkLabel *) label; gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_padding (GTK_MISC (label), 5, 3); gtk_container_add (GTK_CONTAINER (frame), label); /* X Window */ frame = gtk_frame_new ("X Window"); gui_mode_mask.xwin_frame = frame; gtk_widget_set_sensitive (GTK_WIDGET (frame), FALSE); gtk_container_set_border_width (GTK_CONTAINER (frame), 0); gtk_table_attach (GTK_TABLE(pane), frame, 0,1, 1,2, GTK_FILL, GTK_FILL, 0,0); label = gtk_label_new ("(None)"); gui_mode_mask.xwin_name = (GtkLabel *) label; gtk_widget_set_usize (GTK_WIDGET (label), 1, 1); /* Hack: Clip name */ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_padding (GTK_MISC (label), 5, 3); gtk_container_add (GTK_CONTAINER(frame), label); /* Overscan */ frame = gtk_frame_new ("Overscan"); gtk_container_set_border_width (GTK_CONTAINER (frame), 0); gtk_table_attach (GTK_TABLE(pane), frame, 1,2, 1,2, GTK_FILL, GTK_FILL, 0,0); label = gtk_label_new (NULL); gui_mode_mask.overscan = (GtkLabel *) label; gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_padding (GTK_MISC (label), 5, 3); gtk_container_add (GTK_CONTAINER (frame), label); /* Monitor State */ frame = gtk_frame_new ("Monitor"); gtk_container_set_border_width (GTK_CONTAINER (frame), 0); gtk_table_attach (GTK_TABLE(pane), frame, 2,3, 1,2, GTK_FILL, GTK_FILL, 0,0); label = gtk_label_new ("Off"); gui_mode_mask.mon_state = (GtkLabel *) label; gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_padding (GTK_MISC (label), 5, 3); gtk_container_add (GTK_CONTAINER (frame), label); /* TV State */ frame = gtk_frame_new ("TV"); gtk_container_set_border_width (GTK_CONTAINER (frame), 0); gtk_table_attach (GTK_TABLE(pane), frame, 3,4, 1,2, GTK_FILL, GTK_FILL, 0,0); label = gtk_label_new ("Off"); gui_mode_mask.tv_state = (GtkLabel *) label; gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_padding (GTK_MISC (label), 5, 3); gtk_container_add (GTK_CONTAINER (frame), label); /* Mode list */ scroller = gtk_scrolled_window_new (NULL, NULL); gtk_container_set_border_width (GTK_CONTAINER (scroller), 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_table_attach (GTK_TABLE(pane), scroller, 0,4, 2,3, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); clist = gtk_clist_new (4); gui_mode_mask.modes = (GtkCList *) clist; gui_mode_mask.column = -1; gtk_clist_set_column_title (GTK_CLIST (clist), 0, "Resolution"); gtk_clist_set_column_title (GTK_CLIST (clist), 1, "Size"); gtk_clist_set_column_title (GTK_CLIST (clist), 2, "Overscan"); gtk_clist_set_column_title (GTK_CLIST (clist), 3, "Aspect"); gtk_clist_column_titles_show (GTK_CLIST (clist)); gtk_clist_column_titles_active (GTK_CLIST (clist)); /* must be after show */ gtk_clist_set_selection_mode (GTK_CLIST (clist), GTK_SELECTION_BROWSE); gtk_clist_set_shadow_type (GTK_CLIST (clist), GTK_SHADOW_IN); gtk_clist_set_column_width (GTK_CLIST (clist), 0, 70); gtk_clist_set_column_width (GTK_CLIST (clist), 1, 50); gtk_clist_set_column_width (GTK_CLIST (clist), 2, 90); gtk_signal_connect (GTK_OBJECT (clist), "select_row", GTK_SIGNAL_FUNC (gui_list_mode_cb), NULL); gtk_signal_connect (GTK_OBJECT (clist), "click_column", GTK_SIGNAL_FUNC (gui_modes_column_cb), (gpointer) &gui_mode_mask); gtk_container_add (GTK_CONTAINER(scroller), clist); gtk_table_set_col_spacings (GTK_TABLE(pane), 3); gtk_table_set_row_spacings (GTK_TABLE(pane), 3); /* Buttons */ button = gtk_button_new_with_label ("X Mode"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (xswitch_mode_cb), NULL); gtk_table_attach(GTK_TABLE(page), button, 0,1, 1,2, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_add_accelerator (GTK_WIDGET (button), "clicked", gui_main_accel_group, gui_accel[ACCEL_SWITCH].key, gui_accel[ACCEL_SWITCH].mods, GTK_ACCEL_VISIBLE); button = gtk_button_new_with_label ("X Select"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (xselect_window_cb), NULL); gtk_table_attach(GTK_TABLE(page), button, 1,2, 1,2, GTK_FILL, GTK_FILL, 0, 0); button = gtk_button_new_with_label ("X Center"); gui_mode_mask.xcenter = button; gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (xcenter_window_cb), NULL); gtk_widget_add_accelerator (GTK_WIDGET (button), "clicked", gui_main_accel_group, gui_accel[ACCEL_CENTER].key, gui_accel[ACCEL_CENTER].mods, GTK_ACCEL_VISIBLE); gtk_table_attach(GTK_TABLE(page), button, 2,3, 1,2, GTK_FILL, GTK_FILL, 0, 0); button = gtk_button_new_with_label ("X Resize"); gui_mode_mask.xadjust = button; gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (xadjust_window_cb), NULL); gtk_widget_add_accelerator (GTK_WIDGET (button), "clicked", gui_main_accel_group, gui_accel[ACCEL_ADJUST].key, gui_accel[ACCEL_ADJUST].mods, GTK_ACCEL_VISIBLE); gtk_table_attach(GTK_TABLE(page), button, 3,4, 1,2, GTK_FILL, GTK_FILL, 0, 0); /* return */ return page; } GtkWidget *gui_position_page (void) { GtkWidget *page; GtkWidget *frame; GtkWidget *table; GtkAccelGroup *gui_setting_accel_group; gui_setting_accel_group = gtk_accel_group_new (); page = gtk_table_new (1,1,FALSE); gtk_signal_connect (GTK_OBJECT (page), "map", GTK_SIGNAL_FUNC (gui_map_cb), (gpointer) gui_setting_accel_group); gtk_signal_connect (GTK_OBJECT (page), "unmap", GTK_SIGNAL_FUNC (gui_unmap_cb), (gpointer) gui_setting_accel_group); table = gtk_table_new (1, 1, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_table_set_col_spacings (GTK_TABLE(table), 10); gtk_table_set_row_spacings (GTK_TABLE(table), 10); gtk_table_attach_defaults(GTK_TABLE(page), table, 0,5,0,1); /* TV Position */ frame = create_adjust_frame ("TV Position", -100, 100, TRUE, &gui_tv_offset, GTK_SIGNAL_FUNC (settings_cb), NULL); gtk_table_attach (GTK_TABLE(table), frame, 0,1, 0,1, GTK_FILL, GTK_FILL, 0,0); /* Monitor Position */ frame = create_adjust_frame ("Monitor Position", -100, 100, TRUE, &gui_mon_offset, GTK_SIGNAL_FUNC (settings_cb), NULL); gtk_table_attach (GTK_TABLE(table), frame, 1,2, 0,1, GTK_FILL, GTK_FILL, 0,0); /* Window Position */ frame = create_adjust_frame ("Move Window", -1000, 10000, TRUE, &gui_xwin_pos, GTK_SIGNAL_FUNC (gui_xmove_cb), NULL); gui_mode_mask.xwin_pos = frame; gtk_widget_set_sensitive (GTK_WIDGET (frame), FALSE); gtk_table_attach (GTK_TABLE(table), frame, 0,1, 1,2, GTK_FILL, GTK_FILL, 0,0); /* Window Resize */ frame = create_adjust_frame ("Resize Window", 0, 10000, TRUE, &gui_xwin_size, GTK_SIGNAL_FUNC (gui_xresize_cb), NULL); gui_mode_mask.xwin_size = frame; // gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_widget_set_sensitive (GTK_WIDGET (frame), FALSE); gtk_table_attach (GTK_TABLE(table), frame, 1,2, 1,2, GTK_FILL, GTK_FILL, 0,0); return page; } GtkWidget *gui_settings_page (void) { int i, y; GtkWidget *page; GtkWidget *vbox; GtkWidget *frame; GtkWidget *table; GtkWidget *button; GtkWidget *label; GtkWidget *widget; GtkAdjustment *adj; GtkAccelGroup *gui_setting_accel_group; gui_setting_accel_group = gtk_accel_group_new (); page = gtk_table_new (1,1,FALSE); gtk_signal_connect (GTK_OBJECT (page), "map", GTK_SIGNAL_FUNC (gui_map_cb), (gpointer) gui_setting_accel_group); gtk_signal_connect (GTK_OBJECT (page), "unmap", GTK_SIGNAL_FUNC (gui_unmap_cb), (gpointer) gui_setting_accel_group); vbox = gtk_vbox_new (FALSE, 10); gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); gtk_table_attach_defaults(GTK_TABLE(page), vbox, 0,4, 0,1); /* Options */ frame = gtk_frame_new ("TV Options"); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); table = gtk_table_new (1, 1, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_table_set_col_spacings (GTK_TABLE(table), 5); gtk_table_set_row_spacings (GTK_TABLE(table), 0); gtk_container_add (GTK_CONTAINER (frame), table); button = gtk_check_button_new_with_label ("Dualview"); gui_settings.dualview = GTK_TOGGLE_BUTTON (button); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (settings_flags_cb), (gpointer) button); gtk_table_attach (GTK_TABLE(table), button, 0,1, 0,1, GTK_FILL,GTK_FILL, 0,0); button = gtk_check_button_new_with_label ("Colorfix"); gui_settings.colorfix = GTK_TOGGLE_BUTTON (button); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (settings_flags_cb), (gpointer) button); gtk_table_attach (GTK_TABLE(table), button, 0,1, 1,2, GTK_FILL,GTK_FILL, 0,0); button = gtk_check_button_new_with_label ("Monochrome"); gui_settings.monochrome = GTK_TOGGLE_BUTTON (button); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (settings_flags_cb), (gpointer) button); gtk_table_attach (GTK_TABLE(table), button, 1,2, 0,1, GTK_FILL,GTK_FILL, 0,0); button = gtk_check_button_new_with_label ("Non-interlaced"); gui_settings.noninterlaced = GTK_TOGGLE_BUTTON (button); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (settings_flags_cb), (gpointer) button); gtk_table_attach (GTK_TABLE(table), button, 1,2, 1,2, GTK_FILL,GTK_FILL, 0,0); button = gtk_check_button_new_with_label ("Macrovision"); gui_settings.macrovis = GTK_TOGGLE_BUTTON (button); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (settings_flags_cb), (gpointer) button); gtk_table_attach (GTK_TABLE(table), button, 2,3, 0,1, GTK_FILL,GTK_FILL, 0,0); button = gtk_check_button_new_with_label ("Free carrier"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (settings_flags_cb), (gpointer) button); gtk_table_attach (GTK_TABLE(table), button, 2,3, 1,2, GTK_FILL,GTK_FILL, 0,0); /* TV Settings */ frame = gtk_frame_new ("TV Settings"); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); table = gtk_table_new (1, 1, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_table_set_col_spacings (GTK_TABLE(table), 5); gtk_table_set_row_spacings (GTK_TABLE(table), 5); gtk_container_add (GTK_CONTAINER (frame), table); y = -1; for (i = 0; TRUE; i++) { GuiSetMask *m = gui_set_mask + i; if (!m->label) break; if (m->label [0] != '+') { y++; label = gtk_label_new (m->label); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE(table), label, 0,1, y,y+1, GTK_FILL,GTK_FILL,0,0); } adj = gui_mask_scale (table, GTK_OBJECT (update_set), GTK_SIGNAL_FUNC (settings_cb), m, m->xl, m->xr, y); if (m->adj) *(m->adj) = adj; } /* Hack: control size of sliders */ gtk_table_set_col_spacing (GTK_TABLE(table), 1, 100); gtk_table_set_col_spacing (GTK_TABLE(table), 3, 100); /* Buttons */ widget = gtk_toggle_button_new_with_label ("Bypass"); button = gtk_button_new_with_label ("Setup"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (setup_cb), (gpointer) widget); gtk_table_attach(GTK_TABLE(page), button, 0,1, 1,2, GTK_FILL, GTK_FILL, 0, 0); button = widget; gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (bypass_cb), NULL); gtk_signal_connect (GTK_OBJECT (update_bypass), "changed", GTK_SIGNAL_FUNC (bypass_update_cb), GTK_OBJECT (button)); gtk_table_attach(GTK_TABLE(page), button, 1,2, 1,2, GTK_FILL, GTK_FILL, 0, 0); button = gtk_button_new_with_label ("Print"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gui_print_cb), (gpointer)(PRINT_CRT_REGS | PRINT_CHIP_REGS)); gtk_widget_add_accelerator (GTK_WIDGET (button), "clicked", gui_main_accel_group, gui_accel[ACCEL_PRINT].key, gui_accel[ACCEL_PRINT].mods, GTK_ACCEL_VISIBLE); gtk_table_attach(GTK_TABLE(page), button, 2,3, 1,2, GTK_FILL, GTK_FILL, 0, 0); button = gtk_button_new_with_label ("Reset"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (reset_setting_cb), NULL); gtk_widget_add_accelerator (GTK_WIDGET (button), "clicked", gui_setting_accel_group, gui_accel[ACCEL_RESET].key, gui_accel[ACCEL_RESET].mods, GTK_ACCEL_VISIBLE); gtk_table_attach(GTK_TABLE(page), button, 3,4, 1,2, GTK_FILL, GTK_FILL, 0, 0); return page; } GtkWidget *gui_head_page (void) { GtkWidget *page; GtkWidget *frame; GtkWidget *table; GtkWidget *button; GtkWidget *label; GtkWidget *bbox; GtkAccelGroup *gui_head_accel_group; gui_head_accel_group = gtk_accel_group_new (); page = gtk_table_new (1,1,FALSE); gtk_signal_connect (GTK_OBJECT (page), "map", GTK_SIGNAL_FUNC (gui_map_cb), (gpointer) gui_head_accel_group); gtk_signal_connect (GTK_OBJECT (page), "unmap", GTK_SIGNAL_FUNC (gui_unmap_cb), (gpointer) gui_head_accel_group); /* Display */ frame = gtk_frame_new ("Display"); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach (GTK_TABLE(page), frame, 0,3, 0,1, GTK_FILL, GTK_FILL, 0,0); table = gtk_table_new (1, 1, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_container_add (GTK_CONTAINER (frame), table); label = create_framed_label (table, "Head 1:", "Monitor", 0,1,2, 0); gui_heads.disp_mon[0] = GTK_FRAME(label->parent); label = create_framed_label (table, NULL, "TV", 0,2,3, 0); gui_heads.disp_tv[0] = GTK_FRAME(label->parent); label = create_framed_label (table, NULL, "Flatpanel", 0,3,4, 0); gui_heads.disp_fp[0] = GTK_FRAME(label->parent); label = create_framed_label (table, "Head 2:", "Monitor", 0,1,2, 1); gui_heads.disp_mon[1] = GTK_FRAME(label->parent); label = create_framed_label (table, NULL, "TV", 0,2,3, 1); gui_heads.disp_tv[1] = GTK_FRAME(label->parent); label = create_framed_label (table, NULL, "Flatpanel", 0,3,4, 1); gui_heads.disp_fp[1] = GTK_FRAME(label->parent); button = gtk_button_new_with_label (" Update "); gtk_table_attach (GTK_TABLE(table), button, 4,5, 0,1, GTK_FILL, GTK_FILL, 0, 0); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (head_update_cb), NULL); gtk_table_set_col_spacings (GTK_TABLE(table), 5); gtk_table_set_col_spacing (GTK_TABLE(table), 3, 15); gtk_table_set_row_spacings (GTK_TABLE(table), 5); /* Viewport Position */ frame = create_adjust_frame ("Viewport Position", 0, 2000, TRUE, &gui_view_pos, GTK_SIGNAL_FUNC (view_cb), NULL); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach (GTK_TABLE(page), frame, 0,2, 1,3, GTK_FILL | GTK_EXPAND, GTK_FILL, 0,0); /* Adjust */ frame = gtk_frame_new ("Adjust"); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach (GTK_TABLE(page), frame, 2,3, 1,2, GTK_FILL, GTK_FILL, 0,0); bbox = gtk_vbutton_box_new (); gtk_container_set_border_width (GTK_CONTAINER (bbox), 5); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START); gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 4); gtk_container_add (GTK_CONTAINER (frame), bbox); button = gtk_check_button_new_with_label ("Cursor"); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (service_flag_cb), (gpointer) BACK_SERVICE_CURSOR); gtk_object_set_data (GTK_OBJECT (button), "mask", service_mask_flag+0); gtk_signal_connect_object (GTK_OBJECT(update_service), "changed", GTK_SIGNAL_FUNC (service_update_cb), GTK_OBJECT (button)); gtk_container_add (GTK_CONTAINER(bbox), button); /* Adjust viewport */ frame = gtk_frame_new ("Adjust viewport"); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach (GTK_TABLE(page), frame, 2,3, 2,3, GTK_FILL, GTK_FILL, 0,0); bbox = gtk_vbutton_box_new (); gtk_container_set_border_width (GTK_CONTAINER (bbox), 5); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START); gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 4); gtk_container_add (GTK_CONTAINER (frame), bbox); button = gtk_check_button_new_with_label ("by Cursor"); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (service_flag_cb), (gpointer) BACK_SERVICE_VIEW_CURSOR); gtk_object_set_data (GTK_OBJECT (button), "mask", service_mask_flag+1); gtk_signal_connect_object (GTK_OBJECT(update_service), "changed", GTK_SIGNAL_FUNC (service_update_cb), GTK_OBJECT (button)); gtk_container_add (GTK_CONTAINER(bbox), button); button = gtk_check_button_new_with_label ("by Monitor"); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (service_flag_cb), (gpointer) BACK_SERVICE_VIEW_MAIN); gtk_object_set_data (GTK_OBJECT (button), "mask", service_mask_flag+2); gtk_signal_connect_object (GTK_OBJECT(update_service), "changed", GTK_SIGNAL_FUNC (service_update_cb), GTK_OBJECT (button)); gtk_container_add (GTK_CONTAINER(bbox), button); /* Heads */ frame = gtk_frame_new ("Heads"); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach (GTK_TABLE(page), frame, 0,1, 3,4, GTK_FILL, GTK_FILL, 0,0); table = gtk_table_new (1, 1, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_container_add (GTK_CONTAINER (frame), table); gui_heads.main = gui_labelled_entry (table, "Monitor:", GTK_SIGNAL_FUNC(head_cb), 0,1,2, 0); gui_heads.tv = gui_labelled_entry (table, "TV:", GTK_SIGNAL_FUNC(head_cb), 0,1,2, 1); gui_heads.video = gui_labelled_entry (table, "Video:", GTK_SIGNAL_FUNC(head_cb), 0,1,2, 2); gtk_table_set_row_spacings (GTK_TABLE(table), 5); gtk_table_set_col_spacings (GTK_TABLE(table), 10); /* Status */ frame = gtk_frame_new ("Status"); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach (GTK_TABLE(page), frame, 1,3, 3,4, GTK_FILL, GTK_FILL, 0,0); table = gtk_table_new (1, 1, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_container_add (GTK_CONTAINER (frame), table); label = create_framed_label (table, "Timer:", "Off", 0,1,2, 0); gui_heads.timer = GTK_LABEL (label); label = create_framed_label (table, "Twinview:", "Off", 0,1,2, 1); gui_heads.twin = GTK_LABEL (label); label = gtk_label_new ("Shared view:"); /* NULL */ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE(table), label, 0,1, 2,3, GTK_FILL, GTK_FILL, 0, 0); button = gtk_toggle_button_new_with_label (" Enable "); gui_heads.shared = GTK_TOGGLE_BUTTON (button); /* gtk_container_set_border_width (GTK_CONTAINER (button), 2); */ gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (duplicate_cb), NULL); gtk_table_attach (GTK_TABLE(table), button, 1,2, 2,3, GTK_FILL, GTK_FILL, 0, 0); gtk_table_set_col_spacings (GTK_TABLE(table), 5); gtk_table_set_row_spacings (GTK_TABLE(table), 5); return page; } GtkWidget *gui_port_frame (char *title, GtkObject *update, GuiFlagMask *flag) { GtkWidget *frame; GtkWidget *table; GtkWidget *label; GtkWidget *opt; frame = gtk_frame_new (title); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); table = gtk_table_new (1, 1, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_container_add (GTK_CONTAINER (frame), table); /* Attention: Label for zero value must come first */ label = create_aligned_label ("Clock:", 0.0, 0.5); gtk_table_attach (GTK_TABLE(table), label, 0,1, 0,1, GTK_FILL, GTK_FILL, 0, 0); opt = gui_mask_option_menu_flag (table, update, flag+0, 1,2, 0, "Master", "Slave"); opt = gui_mask_option_menu_flag (table, update, flag+1, 2,3, 0, "Low", "High"); label = create_aligned_label ("Sync:", 0.0, 0.5); gtk_table_attach (GTK_TABLE(table), label, 0,1, 1,2, GTK_FILL, GTK_FILL, 0, 0); opt = gui_mask_option_menu_flag (table, update, flag+2, 1,2, 1, "Master", "Slave"); opt = gui_mask_option_menu_flag (table, update, flag+3, 2,3, 1, "Low", "High"); opt = gui_mask_option_menu_flag (table, update, flag+4, 3,4, 1, "Low", "High"); label = create_aligned_label ("Blank:", 0.0, 0.5); gtk_table_attach (GTK_TABLE(table), label, 0,1, 2,3, GTK_FILL, GTK_FILL, 0, 0); opt = gui_mask_option_menu_flag (table, update, flag+5, 1,2, 2, "Out", "In"); opt = gui_mask_option_menu_flag (table, update, flag+6, 2,3, 2, "Low", "High"); opt = gui_mask_option_menu_flag (table, update, flag+7, 3,4, 2, "Region", "DotClock"); label = create_aligned_label ("Format:", 0.0, 0.5); gtk_table_attach (GTK_TABLE(table), label, 0,1, 3,4, GTK_FILL, GTK_FILL, 0, 0); opt = gui_mask_option_menu_flag (table, update, flag+8, 1,2, 3, "RGB", "YCrCb"); opt = gui_mask_option_menu_flag (table, update, flag+9, 2,3, 3, "Normal", "Alternate"); gtk_table_set_col_spacings (GTK_TABLE(table), 5); gtk_table_set_row_spacings (GTK_TABLE(table), 5); return frame; } GtkWidget *gui_port_page (void) { GtkWidget *page; GtkWidget *frame; GtkWidget *table; GtkWidget *button; GtkWidget *label; int i; GtkAccelGroup *gui_port_accel_group; gui_port_accel_group = gtk_accel_group_new (); page = gtk_table_new (1,1,FALSE); gtk_signal_connect (GTK_OBJECT (page), "map", GTK_SIGNAL_FUNC (gui_map_cb), (gpointer) gui_port_accel_group); gtk_signal_connect (GTK_OBJECT (page), "unmap", GTK_SIGNAL_FUNC (gui_unmap_cb), (gpointer) gui_port_accel_group); /* Display */ frame = gtk_frame_new ("Device"); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach (GTK_TABLE(page), frame, 0,5, 0,1, GTK_FILL, GTK_FILL, 0,0); table = gtk_table_new (1, 1, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_container_add (GTK_CONTAINER (frame), table); for (i = 0; TRUE; i++) { GuiFlagMask *m = dev_port_mask_flag + i; if (!(m->label)) break; gui_mask_checkbutton (table, GTK_OBJECT (update_port), m, i, i+1, 0); } gtk_table_set_col_spacings (GTK_TABLE(table), 5); gtk_table_set_row_spacings (GTK_TABLE(table), 5); /* Ports */ frame = gui_port_frame ("Host port", GTK_OBJECT (update_port), host_port_mask_flag); gtk_table_attach (GTK_TABLE(page), frame, 0,5, 1,2, GTK_FILL | GTK_EXPAND, GTK_FILL, 0,0); frame = gui_port_frame ("Encoder port", GTK_OBJECT (update_port), enc_port_mask_flag); gtk_table_attach (GTK_TABLE(page), frame, 0,5, 2,3, GTK_FILL | GTK_EXPAND, GTK_FILL, 0,0); /* Empty expanding widget */ label = gtk_label_new (NULL); gtk_table_attach (GTK_TABLE(page), label, 0,5, 3,4, GTK_FILL, GTK_FILL | GTK_EXPAND, 0,0); /* Buttons */ button = gtk_button_new_with_label ("Monitor"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gui_monitor_mode_cb), NULL); gtk_table_attach(GTK_TABLE(page), button, 0,1, 4,5, GTK_FILL, GTK_FILL, 0, 0); button = gtk_button_new_with_label ("Reset"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC(gui_reset_port_cb), NULL); gtk_widget_add_accelerator (GTK_WIDGET (button), "clicked", gui_port_accel_group, gui_accel[ACCEL_RESET].key, gui_accel[ACCEL_RESET].mods, GTK_ACCEL_VISIBLE); gtk_table_attach(GTK_TABLE(page), button, 4,5, 4,5, GTK_FILL, GTK_FILL, 0, 0); return page; } GtkWidget *gui_about_page (void) { GtkWidget *page; GtkWidget *frame; GtkWidget *scroller; GtkWidget *label; page = gtk_table_new (1,1,FALSE); frame = gtk_frame_new ("About"); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach (GTK_TABLE(page), frame, 0,1, 0,1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); scroller = gtk_scrolled_window_new (NULL, NULL); gtk_container_set_border_width (GTK_CONTAINER (scroller), 5); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_container_add (GTK_CONTAINER (frame), scroller); label = gtk_label_new ( "TV-OUT for NVidia Cards (Version " PACKAGE_VERSION ")\n\n" "Written by Dirk Thierbach\n\n" "Visit the Sourceforge project at\n" "http://sourceforge.net/projects/nv-tv-out/\n\n" "With many thanks to the members of the Sourceforge Rivatv project. " "Without their help this program would not have been possible.\n\n" "This program is protected by the Gnu Public License (GPL). You should " "have received the source code of this program together with a copy of " "the GPL. You may freely use, distribute, or modify the program, as long " "as anything derived in this way from the source code is covered by the " "GPL as well. See the text of the GPL for details."); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_pattern (GTK_LABEL (label), ""); /* does not work... */ gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_FILL); gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroller), label); return page; } void gui_main_buttons (GtkWidget *window, GtkWidget *table) { GtkWidget *button; button = gtk_button_new_with_label ("TV on"); gtk_widget_show (button); gtk_table_attach(GTK_TABLE(table), button, 0,1,1,2, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (tvmonitor_on_cb), NULL); gtk_widget_add_accelerator (GTK_WIDGET (button), "clicked", gui_main_accel_group, gui_accel[ACCEL_TV_ON].key, gui_accel[ACCEL_TV_ON].mods, GTK_ACCEL_VISIBLE); button = gtk_button_new_with_label ("TV off"); gtk_widget_show (button); gtk_table_attach(GTK_TABLE(table), button, 1,2,1,2, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (tvmonitor_off_cb), NULL); gtk_widget_add_accelerator (GTK_WIDGET (button), "clicked", gui_main_accel_group, gui_accel[ACCEL_TV_OFF].key, gui_accel[ACCEL_TV_OFF].mods, GTK_ACCEL_VISIBLE); button = gtk_button_new_with_label ("Apply"); gtk_widget_show (button); gtk_table_attach(GTK_TABLE(table), button, 2,3,1,2, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (apply_cb), NULL); button = gtk_toggle_button_new_with_label ("AutoApply"); gtk_widget_show (button); gtk_table_attach(GTK_TABLE(table), button, 3,4,1,2, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (auto_cb), NULL); gtk_signal_connect (GTK_OBJECT (changed_all), "changed", GTK_SIGNAL_FUNC (auto_apply_cb), NULL); button = gtk_button_new_with_label ("Quit"); gtk_widget_show (button); gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window)); gtk_table_attach(GTK_TABLE(table), button, 4,5,1,2, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); } void gui_accel_parse (void) { GuiAccelIndex i; for (i = ACCEL_FIRST; i < ACCEL_LAST; i++) { gtk_accelerator_parse (gui_accel[i].accel, &gui_accel[i].key, &gui_accel[i].mods); } } void gui_accel_root (GtkWidget *main_window) { /* FIXME TODO: register gdk_root_window as gdk window, if not already registered XSelectInput on root window gdk_window_set_user_data (widget->window, main_window); ... and hope for the best... */ } /* -------- Main -------- */ void gui_main (int argc, char *argv[], CardPtr card_list) { GtkWidget *table; GtkWidget *notebook; GtkWidget *page; RAISE (MSG_DEBUG, "gui_main"); gtk_init (&argc, &argv); gui_card_list = card_list; /* In the meantime, misuse adjustments for update signal chains. */ update_crt = create_notify (); update_chip = create_notify (); update_mode = create_notify (); update_set = create_notify (); update_port = create_notify (); update_service = create_notify (); update_bypass = create_notify (); changed_all = create_notify (); show_bt = create_notify (); show_cx = create_notify (); show_ch = create_notify (); show_ph1 = create_notify (); show_ph2 = create_notify (); show_nx = create_notify (); hide_bt = create_notify (); hide_cx = create_notify (); hide_ch = create_notify (); hide_ph1 = create_notify (); hide_ph2 = create_notify (); hide_nx = create_notify (); { int i; for (i = 0; i < CARD_LAST; i++) { show_card[i] = create_notify (); hide_card[i] = create_notify (); } } show_head = create_notify (); hide_head = create_notify (); gui_bt_init (); gui_cx_init (); gui_ch_init (); gui_ph_init (); gui_nx_init (); gui_main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (gui_main_window), "NVidia TV-Out"); gtk_signal_connect (GTK_OBJECT (gui_main_window), "destroy", GTK_SIGNAL_FUNC (quit_cb), NULL); gui_main_accel_group = gtk_accel_group_new (); gtk_window_add_accel_group (GTK_WINDOW (gui_main_window), gui_main_accel_group); gui_accel_parse (); table = gtk_table_new (1,1,FALSE); gtk_widget_show (table); gtk_container_add (GTK_CONTAINER (gui_main_window), table); notebook = gtk_notebook_new (); gtk_widget_show (notebook); gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_LEFT); gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE); gtk_table_attach_defaults(GTK_TABLE(table), notebook, 0,5,0,1); page = gui_about_page (); gtk_widget_show_all (page); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("About", 0.0, 0.5)); page = gui_mode_page (); gtk_widget_show_all (page); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("Mode", 0.0, 0.5)); page = gui_position_page (); gtk_widget_show_all (page); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("Position", 0.0, 0.5)); page = gui_settings_page (); gtk_widget_show_all (page); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("Settings", 0.0, 0.5)); page = gui_config_page (); gtk_widget_show_all (page); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("Config", 0.0, 0.5)); page = gui_head_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("Heads", 0.0, 0.5)); set_show_hide (page, show_head, hide_head); page = gui_port_page (); gtk_widget_show_all (page); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("Ports", 0.0, 0.5)); page = gui_nv_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("NV Regs", 0.0, 0.5)); set_show_hide (page, show_card[CARD_NVIDIA-CARD_FIRST], hide_card[CARD_NVIDIA-CARD_FIRST]); set_show_hide (page, show_card[CARD_XBOX-CARD_FIRST], hide_card[CARD_XBOX-CARD_FIRST]); page = gui_nv_fp_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("FP Regs", 0.0, 0.5)); set_show_hide (page, show_card[CARD_XBOX-CARD_FIRST], hide_card[CARD_XBOX-CARD_FIRST]); page = gui_tdfx_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("3dfx Regs", 0.0, 0.5)); set_show_hide (page, show_card[CARD_TDFX-CARD_FIRST], hide_card[CARD_TDFX-CARD_FIRST]); page = gui_i810_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("I810 Regs", 0.0, 0.5)); set_show_hide (page, show_card[CARD_I810-CARD_FIRST], hide_card[CARD_I810-CARD_FIRST]); page = gui_bt_calc_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("BT/CX Calc", 0.0, 0.5)); set_show_hide (page, show_bt, hide_bt); set_show_hide (page, show_cx, hide_cx); page = gui_bt_reg1_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("BT Regs1", 0.0, 0.5)); set_show_hide (page, show_bt, hide_bt); page = gui_bt_reg2_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("BT Regs2", 0.0, 0.5)); set_show_hide (page, show_bt, hide_bt); page = gui_bt_reg3_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("BT Regs3", 0.0, 0.5)); set_show_hide (page, show_bt, hide_bt); page = gui_bt_status_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("Status", 0.0, 0.5)); set_show_hide (page, show_bt, hide_bt); page = gui_cx_reg1_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("CX Regs1", 0.0, 0.5)); set_show_hide (page, show_cx, hide_cx); page = gui_cx_reg2_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("CX Regs2", 0.0, 0.5)); set_show_hide (page, show_cx, hide_cx); page = gui_cx_reg3_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("CX Regs3", 0.0, 0.5)); set_show_hide (page, show_cx, hide_cx); page = gui_cx_reg4_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("CX Regs4", 0.0, 0.5)); set_show_hide (page, show_cx, hide_cx); page = gui_cx_status_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("Status", 0.0, 0.5)); set_show_hide (page, show_cx, hide_cx); page = gui_ch_reg1_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("CH Regs1", 0.0, 0.5)); set_show_hide (page, show_ch, hide_ch); page = gui_ch_reg2_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("CH Regs2", 0.0, 0.5)); set_show_hide (page, show_ch, hide_ch); page = gui_ch_status_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("Status", 0.0, 0.5)); set_show_hide (page, show_ch, hide_ch); page = gui_ph_calc_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("PH Calc", 0.0, 0.5)); set_show_hide (page, show_ph1, hide_ph1); set_show_hide (page, show_ph2, hide_ph2); page = gui_ph1_reg1_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("PH Regs1", 0.0, 0.5)); set_show_hide (page, show_ph1, hide_ph1); page = gui_ph1_reg2_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("PH Regs2", 0.0, 0.5)); set_show_hide (page, show_ph1, hide_ph1); page = gui_ph2_reg1_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("PH Regs1", 0.0, 0.5)); set_show_hide (page, show_ph2, hide_ph2); page = gui_ph2_reg2_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("PH Regs2", 0.0, 0.5)); set_show_hide (page, show_ph2, hide_ph2); page = gui_ph_status_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("Status", 0.0, 0.5)); set_show_hide (page, show_ph1, hide_ph1); set_show_hide (page, show_ph2, hide_ph2); page = gui_nx_reg1_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("NX Regs1", 0.0, 0.5)); set_show_hide (page, show_nx, hide_nx); page = gui_nx_reg2_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("NX Regs2", 0.0, 0.5)); set_show_hide (page, show_nx, hide_nx); page = gui_nx_filt1_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("NX Filt1", 0.0, 0.5)); set_show_hide (page, show_nx, hide_nx); page = gui_nx_filt2_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("NX Filt2", 0.0, 0.5)); set_show_hide (page, show_nx, hide_nx); page = gui_nx_filt3_page (); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, create_aligned_label ("NX Filt3", 0.0, 0.5)); set_show_hide (page, show_nx, hide_nx); gtk_notebook_set_page (GTK_NOTEBOOK (notebook), 1); gui_main_buttons (gui_main_window, table); /* Realize */ /* Show, then hide all pages, so the size calculation will work properly. I wish one could do that without displaying them */ { int i; gtk_signal_emit_by_name (GTK_OBJECT (show_bt), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (show_cx), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (show_ch), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (show_ph1), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (show_ph2), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (show_nx), "changed"); for (i = 0; i < CARD_LAST; i++) gtk_signal_emit_by_name (GTK_OBJECT (show_card[i]), "changed"); gtk_widget_show (gui_main_window); gtk_signal_emit_by_name (GTK_OBJECT (hide_bt), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (hide_cx), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (hide_ch), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (hide_ph1), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (hide_ph2), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (hide_nx), "changed"); for (i = 0; i < CARD_LAST; i++) gtk_signal_emit_by_name (GTK_OBJECT (hide_card[i]), "changed"); } /* Update values */ gui_set_saved &= ~opt_mode_mask; gui_set_saved |= opt_mode_flags; gui_set_saved &= ~(opt_mode_mask << TV_CAP_BIT); gui_service_flags = opt_service_flags; gtk_signal_emit_by_name (GTK_OBJECT (update_service), "changed"); gui_system_init (); /* Init system only once. */ gui_card_set (card_list); gui_orig_update (); gui_head_init (); if (opt_window != None) { gui_window = opt_window; gui_xwindow_changed (); } color_bar_cb (NULL, NULL); gtk_main (); } /* dev Monitor TV Flatpanel Port: clock master high sync master high high blank in high region */ nvtv-0.4.7/src/gui_bt.c0000644000175000001440000006612107741555571010426 /* NVTV GUI (Brooktree part) -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_bt.c,v 1.23 2003/10/10 16:16:57 dthierbach Exp $ * * Contents: * * The GTK graphical user interface. Brooktree part. */ #include "local.h" /* before everything else */ #include #include "gui.h" #include "gui_bt.h" #include "backend.h" #include "calc_bt.h" #include "data_bt.h" /* Automatic minimum distance between overscan percentages */ #define AUTO_DIST 10.0 GtkAdjustment *update_bt; #ifndef DISABLE_TIMEOUT static gint gui_timeout_bt_id = -1; /* status timeout */ #endif static TVMode bt_calc_mode = { {TV_SYSTEM_NONE, 0, 0, "Custom", "", 0.0, 0.0}, descFlags: TV_CAP_DUALVIEW | TV_DESC_DUALVIEW | TV_CAP_MACROVISION | TV_CAP_NONINTERLACED | TV_CAP_MONOCHROME }; #define FIELD(b,m) addr:&(b.m), size:sizeof(b.m) #define FIELD_BT(m) FIELD(gui_regs.enc.bt,m) /* -------- GUI Masks -------- */ struct mask_calc { GtkAdjustment *hres, *vres; GtkAdjustment *hoc_min, *hoc_max, *voc_min, *voc_max; GtkLabel *hoc_sel, *voc_sel; GtkCList *list; gint column; /* last column sorted */ GtkToggleButton *dist; GtkButton *calc; }; struct mask_calc gui_mask_calc; struct mask_bt_freq { GtkLabel *clk, *hsyn, *vsyn, *hover, *vover, *aspect; }; struct mask_bt_freq gui_mask_bt_freq; struct mask_status { GtkToggleButton *tvon, *pll, *over, *under, *pal, *busy; }; struct mask_status gui_mask_bt_status; static GuiRegMask bt_mask1_reg [] = { {label:"h_active:", bits:10, tick:1, FIELD_BT(h_active)}, {label:"h_blanki:", bits:9, tick:1, FIELD_BT(h_blanki)}, {label:"h_clki:", bits:11, tick:1, FIELD_BT(h_clki)}, {label:"h_fract:", bits:8, tick:1, FIELD_BT(h_fract)}, {label:"h_blanko:", bits:11, tick:1, FIELD_BT(h_blanko)}, {label:"h_clko:", bits:12, tick:1, FIELD_BT(h_clko)}, {label:"sync_amp:", bits:8, tick:1, FIELD_BT(sync_amp)}, {label:"bst_amp:", bits:8, tick:1, FIELD_BT(bst_amp)}, {label:"hsync_width:", bits:8, tick:1, FIELD_BT(hsync_width)}, {label:"hburst_begin:", bits:8, tick:1, FIELD_BT(hburst_begin)}, {label:"hburst_end:", bits:8, tick:1, FIELD_BT(hburst_end)}, {label:"v_activei:", bits:10, tick:1, FIELD_BT(v_activei)}, {label:"v_blanki:", bits:8, tick:1, FIELD_BT(v_blanki)}, {label:"v_linesi:", bits:10, tick:1, FIELD_BT(v_linesi)}, {label:"v_activeo:", bits:9, tick:1, FIELD_BT(v_activeo)}, {label:"v_blanko:", bits:10, tick:1, FIELD_BT(v_blanko)}, {label:"v_scale:", bits:14, tick:1, FIELD_BT(v_scale)}, {label:"pll_fract:", bits:16, tick:1, FIELD_BT(pll_fract)}, {label:"pll_int:", bits:6, tick:1, FIELD_BT(pll_int)}, {label:NULL} }; static GuiRegMask bt_mask2_reg [] = { {label:"hsynoffset:", bits:-10,tick:1, FIELD_BT(hsynoffset)}, {label:"vsynoffset:", bits:11, tick:1, FIELD_BT(vsynoffset)}, {label:"hsynwidth:", bits:6, tick:1, FIELD_BT(hsynwidth)}, {label:"vsynwidth:", bits:3, tick:1, FIELD_BT(vsynwidth)}, {label:"phase_off:", bits:8, tick:1, FIELD_BT(phase_off)}, {label:"macro:", bits:3, tick:1, FIELD_BT(macro)}, {label:"mcr:", bits:8, tick:1, FIELD_BT(mcr)}, {label:"mcb:", bits:8, tick:1, FIELD_BT(mcb)}, {label:"my:", bits:8, tick:1, FIELD_BT(my)}, {label:"out_muxa:", bits:2, tick:1, FIELD_BT(out_muxa)}, {label:"out_muxb:", bits:2, tick:1, FIELD_BT(out_muxb)}, {label:"out_muxc:", bits:2, tick:1, FIELD_BT(out_muxc)}, {label:NULL} }; static GuiRegMask bt_mask2_twin [] = { {label:"msc:", bits:32, tick:1, FIELD_BT(msc)}, {label:NULL} }; static GuiFlagMask bt_mask2_flag [] = { {label:"dacdisa", mask:BT_FLAG3_DACDISA, FIELD_BT(flags3)}, {label:"dacdisb", mask:BT_FLAG3_DACDISB, FIELD_BT(flags3)}, {label:"dacdisc", mask:BT_FLAG3_DACDISC, FIELD_BT(flags3)}, {label:NULL } }; static GuiRegMask bt_mask3_reg [] = { {label:"f_sely:", bits:3, tick:1, FIELD_BT(f_sely)}, {label:"f_selc:", bits:3, tick:1, FIELD_BT(f_selc)}, {label:"ylpf:", bits:2, tick:1, FIELD_BT(ylpf)}, {label:"clpf:", bits:2, tick:1, FIELD_BT(clpf)}, {label:"ycoring:", bits:3, tick:1, FIELD_BT(ycoring)}, {label:"ccoring:", bits:3, tick:1, FIELD_BT(ccoring)}, {label:"yattenuate:", bits:3, tick:1, FIELD_BT(yattenuate)}, {label:"cattenuate:", bits:3, tick:1, FIELD_BT(cattenuate)}, {label:NULL} }; static GuiFlagMask bt_mask3_flag [] = { {label:"ni_out", mask:BT_FLAG1_NI_OUT, FIELD_BT(flags1)}, {label:"setup", mask:BT_FLAG1_SETUP, FIELD_BT(flags1)}, {label:"625line", mask:BT_FLAG1_625LINE, FIELD_BT(flags1)}, {label:"vsync_dur", mask:BT_FLAG1_VSYNC_DUR, FIELD_BT(flags1)}, {label:"dis_screset", mask:BT_FLAG1_DIS_SCRESET, FIELD_BT(flags1)}, {label:"pal_md", mask:BT_FLAG1_PAL_MD, FIELD_BT(flags1)}, {label:"dis_ffilt", mask:BT_FLAG2_DIS_FFILT, FIELD_BT(flags2)}, {label:"dis_yflpf", mask:BT_FLAG2_DIS_YFLPF, FIELD_BT(flags2)}, {label:"eclip", mask:BT_FLAG1_ECLIP, FIELD_BT(flags1)}, {label:"en_async", mask:BT_FLAG1_EN_ASYNC, FIELD_BT(flags1)}, {label:"dis_gmshy", mask:BT_FLAG2_DIS_GMSHY, FIELD_BT(flags2)}, {label:"dis_gmushy", mask:BT_FLAG2_DIS_GMUSHY, FIELD_BT(flags2)}, {label:"dis_gmshc", mask:BT_FLAG2_DIS_GMSHC, FIELD_BT(flags2)}, {label:"dis_gmushc", mask:BT_FLAG2_DIS_GMUSHC, FIELD_BT(flags2)}, {label:"dis_chroma", mask:BT_FLAG2_DIS_CHROMA, FIELD_BT(flags2)}, {label:NULL } }; /* -------- -------- */ void bt_freq_calc_cb (GtkObject *obj, struct mask_bt_freq *m) { double Fxtal = 13500000; double Fclk; double Fhsyn; double Fvsyn; double dALO, dTLO, dATO, dTTO, dVACTIVEO; double dAspect, dHOC, dVOC; char s [20]; if ((gui_tv_chip & TV_ENCODER) != TV_BROOKTREE && (gui_tv_chip & TV_ENCODER) != TV_CONEXANT) return; Fclk = Fxtal * (gui_regs.enc.bt.pll_int + gui_regs.enc.bt.pll_fract / 65536.0) / 6.0; sprintf (s, "%3.2f MHz", Fclk / 1e6); gtk_label_set_text (m->clk, s); Fhsyn = Fclk / gui_regs.enc.bt.h_clki; snprintf (s, 20, "%3.2f kHz", Fhsyn / 1e3); gtk_label_set_text (m->hsyn, s); Fvsyn = Fhsyn / gui_regs.enc.bt.v_linesi; snprintf (s, 20, "%3.2f Hz", Fvsyn); gtk_label_set_text (m->vsyn, s); if (gui_regs.enc.bt.flags1 & BT_FLAG1_625LINE) { dALO = 288.0; dTLO = 312.0; dATO = .000052; dTTO = .000064; } else { dALO = 243.0; dTLO = 262.0; dATO = .00005265556; dTTO = .00006355556; } /* if interlace then dTLO += 0.5 */ dVACTIVEO = (int) (((gui_regs.enc.bt.v_activei * dTLO) + (gui_regs.enc.bt.v_linesi - 1.0)) / gui_regs.enc.bt.v_linesi); /* normally, dVACTIVEO = v_activeo - 2 */ /* These two euqations are also possible, but that's not what happens * in recalc.c, so don't use them. * dVOC = 1.0 - (gui_regs.enc.bt.v_activeo - 2) / dALO; * dVOC = 1.0 - ((gui_regs.enc.bt.v_activei / gui_regs.enc.bt.v_linesi) / * (dALO / dTLO)); */ dVOC = 1.0 - dVACTIVEO / dALO; dHOC = 1.0 - ((2.0 * gui_regs.enc.bt.h_active / gui_regs.enc.bt.h_clko) / (dATO / dTTO)); dAspect = (1.0 - dHOC) / (1.0 - dVOC); snprintf (s, 20, "%06.3f %%", dHOC * 100.0); gtk_label_set_text (m->hover, s); snprintf (s, 20, "%06.3f %%", dVOC * 100.0); gtk_label_set_text (m->vover, s); snprintf (s, 20, "%07.5f", dAspect); gtk_label_set_text (m->aspect, s); /* FIXME: check above, calculate aspect */ } gint check_bt_cb (struct mask_status *m) { int status; if ((gui_tv_chip & TV_ENCODER) != TV_BROOKTREE) return TRUE; status = back_card->getStatus (2); if (status < 0) return TRUE; if (! (status & 0x100)) status = 0; gtk_toggle_button_set_active (m->tvon, (status & 0x100) ? TRUE : FALSE); gtk_toggle_button_set_active (m->pll, (status & 0x010) ? TRUE : FALSE); gtk_toggle_button_set_active (m->over, (status & 0x008) ? TRUE : FALSE); gtk_toggle_button_set_active (m->under, (status & 0x004) ? TRUE : FALSE); gtk_toggle_button_set_active (m->pal, (status & 0x002) ? TRUE : FALSE); gtk_toggle_button_set_active (m->busy, (status & 0x001) ? TRUE : FALSE); return TRUE; } void calc_update_cb (GtkWidget *widget, struct mask_calc *m) { gtk_widget_set_sensitive (GTK_WIDGET (m->calc), (m->list->selection) ? TRUE : FALSE); } void calc_dist_min_cb (GtkAdjustment *min, GtkAdjustment *max) { if (gui_mask_calc.dist->active && max->value - min->value < AUTO_DIST) gtk_adjustment_set_value (max, min->value + AUTO_DIST); if (min->value > max->value) gtk_adjustment_set_value (max, min->value); } void calc_dist_max_cb (GtkAdjustment *max, GtkAdjustment *min) { if (gui_mask_calc.dist->active && max->value - min->value < AUTO_DIST) gtk_adjustment_set_value (min, max->value - AUTO_DIST); if (min->value > max->value) gtk_adjustment_set_value (min, max->value); } void calc_result_cb (double hoc, double voc, double badness, double aspect, int flag) { char sh[10], sv[10], sb[10], sa[10], sn[4]; char *text [5]; snprintf (sh, 10, "%06.3f %%", hoc * 100.0); snprintf (sv, 10, "%06.3f %%", voc * 100.0); snprintf (sb, 10, "%8.5f", badness); snprintf (sa, 10, "%6.4f", aspect); snprintf (sn, 3, "%c%s", (flag & BT_CALC_CHARCLK8) ? '8' : '1', (flag & BT_CALC_RATIO32) ? "+" : ""); text [0] = sh; text [1] = sv; text [2] = sb; text [3] = sa; text [4] = sn; gtk_clist_append (gui_mask_calc.list, text); } void calc_list_cb (GtkWidget *widget, struct mask_calc *m) { int hres, vres; double hoc_min, hoc_max, voc_min, voc_max; gtk_clist_freeze (m->list); gtk_clist_clear (m->list); hres = (int) m->hres->value; vres = (int) m->vres->value; hoc_min = m->hoc_min->value / 100.0; voc_min = m->voc_min->value / 100.0; hoc_max = m->hoc_max->value / 100.0; voc_max = m->voc_max->value / 100.0; switch (gui_tv_chip & TV_ENCODER) { case TV_BROOKTREE: recalc_bt_find (gui_system, hres, vres, hoc_min, hoc_max, voc_min, voc_max, &calc_result_cb); break; case TV_CONEXANT: recalc_cx_find (gui_system, hres, vres, hoc_min, hoc_max, voc_min, voc_max, &calc_result_cb); break; default: break; } m->column = -1; gtk_clist_sort (m->list); gtk_clist_select_row (m->list, 0, 0); gtk_clist_thaw (m->list); calc_update_cb (NULL, m); } void calc_reset_cb (GtkWidget *widget, struct mask_calc *m) { if ((gui_tv_chip & TV_ENCODER) != TV_BROOKTREE && (gui_tv_chip & TV_ENCODER) != TV_CONEXANT) return; if (gui_list_mode) { gtk_adjustment_set_value (m->hres, gui_list_mode->spec.res_x); gtk_adjustment_set_value (m->vres, gui_list_mode->spec.res_y); gtk_adjustment_set_value (m->hoc_min, gui_list_mode->spec.hoc - AUTO_DIST/2.0); gtk_adjustment_set_value (m->hoc_max, gui_list_mode->spec.hoc + AUTO_DIST/2.0); gtk_adjustment_set_value (m->voc_min, gui_list_mode->spec.voc - AUTO_DIST/2.0); gtk_adjustment_set_value (m->voc_max, gui_list_mode->spec.voc + AUTO_DIST/2.0); gtk_clist_clear (m->list); calc_update_cb (NULL, m); } } void calc_column_cb (GtkCList *clist, gint column, struct mask_calc *m) { if (m->column == column) { gtk_clist_set_sort_type (m->list, GTK_SORT_DESCENDING); m->column = -1; } else { gtk_clist_set_sort_type (m->list, GTK_SORT_ASCENDING); m->column = column; } gtk_clist_set_sort_column (m->list, column); gtk_clist_sort (m->list); gtk_clist_set_sort_column (m->list, 2); gtk_clist_set_sort_type (m->list, GTK_SORT_ASCENDING); } void calc_select_cb (GtkCList *clist, gint row, gint column, GdkEventButton *event, struct mask_calc *m) { gchar *text; g_return_if_fail (GTK_IS_CLIST (clist)); gtk_clist_get_text (clist, row, 0, &text); gtk_label_set_text (m->hoc_sel, text); gtk_clist_get_text (clist, row, 1, &text); gtk_label_set_text (m->voc_sel, text); } void calc_calc_cb (GtkButton *button, struct mask_calc *m) { int hres, vres; double hoc, voc; bt_calc_mode.spec.res_x = hres = (int) m->hres->value; bt_calc_mode.spec.res_y = vres = (int) m->vres->value; sscanf (m->hoc_sel->label, "%lf", &hoc); sscanf (m->voc_sel->label, "%lf", &voc); bt_calc_mode.spec.hoc = hoc; bt_calc_mode.spec.voc = voc; hoc /= 100.0; voc /= 100.0; gui_func->calc (gui_system, hres, vres, hoc, voc, &bt_calc_mode.regs); gui_act_mode_set (&bt_calc_mode); } void reset_bt_cb (GtkObject *obj, gpointer data) { if ((gui_tv_chip & TV_ENCODER) != TV_BROOKTREE) return; if (gui_act_mode) { gui_regs.enc.bt = gui_act_mode->regs.enc.bt; gui_tv_set (); gtk_signal_emit_by_name (GTK_OBJECT (update_bt), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (changed_all), "changed"); } } void update_bt_cb (GtkObject *obj, gpointer data) { if ((gui_tv_chip & TV_ENCODER) != TV_BROOKTREE) return; gtk_signal_emit_by_name (GTK_OBJECT (update_bt), "changed"); } void gui_map_bt_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "gui_map_bt_cb"); #ifndef DISABLE_TIMEOUT if (gui_timeout_bt_id == -1) { gui_timeout_bt_id = gtk_timeout_add (500 /* ms */, (GtkFunction) check_bt_cb, &gui_mask_bt_status); } #endif } void gui_unmap_bt_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "gui_unmap_bt_cb"); #ifndef DISABLE_TIMEOUT if (gui_timeout_bt_id != -1) { gtk_timeout_remove (gui_timeout_bt_id); gui_timeout_bt_id = -1; } #endif } /* -------- GUI Pages -------- */ GtkWidget *gui_bt_status_page (void) { GtkWidget *page; GtkWidget *frame; GtkWidget *table; GtkWidget *button; page = gtk_vbox_new (FALSE, 5); gtk_signal_connect (GTK_OBJECT (page), "map", GTK_SIGNAL_FUNC (gui_map_bt_cb), NULL); gtk_signal_connect (GTK_OBJECT (page), "unmap", GTK_SIGNAL_FUNC (gui_unmap_bt_cb), NULL); gtk_container_set_border_width (GTK_CONTAINER (page), 5); /* Frequencies CRT / TV */ frame = gtk_frame_new ("Frequencies"); gtk_box_pack_start (GTK_BOX (page), frame, TRUE, TRUE, 0); table = gtk_table_new (3, 4, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 10); gtk_container_add (GTK_CONTAINER (frame), table); gui_mask_bt_freq.clk = gui_mask_label (table, "Monitor dot clock:", "---.-- MHz", 0,1,2, 0); gui_mask_bt_freq.hsyn = gui_mask_label (table, "Monitor horiz. sync:", "---.-- kHz", 0,1,2, 1); gui_mask_bt_freq.vsyn = gui_mask_label (table, "Monitor vert. sync:", "---.-- Hz", 0,1,2, 2); gui_mask_bt_freq.hover = gui_mask_label (table, "TV horiz. overscan:", "--.-- %", 0,1,2, 3); gui_mask_bt_freq.vover = gui_mask_label (table, "TV vert. overscan:", "--.-- %", 0,1,2, 4); gui_mask_bt_freq.aspect = gui_mask_label (table, "TV aspect ratio:", "-.--- ", 0,1,2, 5); gtk_table_set_col_spacings (GTK_TABLE(table), 10); gtk_table_set_row_spacings (GTK_TABLE(table), 10); /* TV Status: BT Fifo overrun/underrun */ frame = gtk_frame_new ("Brooktree Status"); gtk_box_pack_start (GTK_BOX (page), frame, TRUE, TRUE, 0); table = gtk_table_new (1, 1, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 10); gtk_container_add (GTK_CONTAINER (frame), table); button = gtk_check_button_new_with_label ("TV on"); gui_mask_bt_status.tvon = GTK_TOGGLE_BUTTON (button); gtk_table_attach (GTK_TABLE(table), button, 0,1, 0,1, GTK_FILL,GTK_FILL,0,0); button = gtk_check_button_new_with_label ("PLL locked"); gui_mask_bt_status.pll = GTK_TOGGLE_BUTTON (button); gtk_table_attach (GTK_TABLE(table), button, 0,1, 1,2, GTK_FILL,GTK_FILL,0,0); button = gtk_check_button_new_with_label ("FIFO overrun"); gui_mask_bt_status.over = GTK_TOGGLE_BUTTON (button); gtk_table_attach (GTK_TABLE(table), button, 1,2, 0,1, GTK_FILL,GTK_FILL,0,0); button = gtk_check_button_new_with_label ("FIFO underrun"); gui_mask_bt_status.under = GTK_TOGGLE_BUTTON (button); gtk_table_attach (GTK_TABLE(table), button, 1,2, 1,2, GTK_FILL,GTK_FILL,0,0); button = gtk_check_button_new_with_label ("PAL pin"); gui_mask_bt_status.pal = GTK_TOGGLE_BUTTON (button); gtk_table_attach (GTK_TABLE(table), button, 2,3, 0,1, GTK_FILL,GTK_FILL,0,0); button = gtk_check_button_new_with_label ("Busy"); gui_mask_bt_status.busy = GTK_TOGGLE_BUTTON (button); gtk_table_attach (GTK_TABLE(table), button, 2,3, 1,2, GTK_FILL,GTK_FILL,0,0); gtk_table_set_col_spacings (GTK_TABLE(table), 5); gtk_table_set_row_spacings (GTK_TABLE(table), 5); /* return */ return page; } GtkWidget *gui_bt_reg1_page (void) { GtkAccelGroup *gui_bt_reg_accel_group; gui_bt_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("BT 868/869 Timings", gui_bt_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_bt), GTK_SIGNAL_FUNC (reset_bt_cb), 0, 0, 11, bt_mask1_reg, 0, 11, NULL, 0, 0, 0, NULL); } GtkWidget *gui_bt_reg2_page (void) { GtkAccelGroup *gui_bt_reg_accel_group; gui_bt_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("BT 868/869 Parameters", gui_bt_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_bt), GTK_SIGNAL_FUNC (reset_bt_cb), 0, 0, 9, bt_mask2_reg, 0, 9, bt_mask2_twin, 6, 0, 9, bt_mask2_flag); } GtkWidget *gui_bt_reg3_page (void) { GtkAccelGroup *gui_bt_reg_accel_group; gui_bt_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("BT 868/869 Flags", gui_bt_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_bt), GTK_SIGNAL_FUNC (reset_bt_cb), 0, 0, 9, bt_mask3_reg, 0, 0, NULL, 6, 0, 8, bt_mask3_flag); } GtkWidget *gui_bt_calc_page (void) { GtkWidget *page; GtkWidget *frame; GtkWidget *table; GtkWidget *label; GtkWidget *spin; GtkWidget *button; GtkWidget *scroller; GtkWidget *clist; GtkAdjustment *adj; GtkAccelGroup *gui_bt_calc_accel_group; gui_bt_calc_accel_group = gtk_accel_group_new (); page = gtk_table_new (5,2,FALSE); gtk_signal_connect (GTK_OBJECT (page), "map", GTK_SIGNAL_FUNC (gui_map_cb), (gpointer) gui_bt_calc_accel_group); gtk_signal_connect (GTK_OBJECT (page), "unmap", GTK_SIGNAL_FUNC (gui_unmap_cb), (gpointer) gui_bt_calc_accel_group); frame = gtk_frame_new ("Calculate registers"); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach_defaults(GTK_TABLE(page), frame, 0,5,0,1); table = gtk_table_new (2, 2, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_container_add (GTK_CONTAINER (frame), table); label = gtk_label_new ("Horizontal:"); gtk_table_attach (GTK_TABLE(table), label, 0,1, 1,2, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); label = gtk_label_new ("Vertical:"); gtk_table_attach (GTK_TABLE(table), label, 0,1, 2,3, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); label = gtk_label_new ("Resolution"); gtk_table_attach (GTK_TABLE(table), label, 1,2, 0,1, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 1024.0, 1.0, 10.0, 0.0); gui_mask_calc.hres = adj; spin = gtk_spin_button_new (adj, 0.0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin), GTK_UPDATE_IF_VALID); gtk_table_attach (GTK_TABLE(table), spin, 1,2, 1,2, GTK_FILL, GTK_FILL, 0, 0); adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 1024.0, 1.0, 10.0, 0.0); gui_mask_calc.vres = adj; spin = gtk_spin_button_new (adj, 0.0, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin), GTK_UPDATE_IF_VALID); gtk_table_attach (GTK_TABLE(table), spin, 1,2, 2,3, GTK_FILL, GTK_FILL, 0, 0); label = gtk_label_new ("Overscan range (%)"); gtk_table_attach (GTK_TABLE(table), label, 2,4, 0,1, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.00, 50.00, 0.1, 1.0, 0.0); gui_mask_calc.hoc_min = adj; spin = gtk_spin_button_new (adj, 0.0, 2); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin), GTK_UPDATE_IF_VALID); gtk_table_attach (GTK_TABLE(table), spin, 2,3, 1,2, GTK_FILL, GTK_FILL, 0, 0); adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.00, 50.00, 0.1, 1.0, 0.0); gui_mask_calc.hoc_max = adj; spin = gtk_spin_button_new (adj, 0.0, 2); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin), GTK_UPDATE_IF_VALID); gtk_table_attach (GTK_TABLE(table), spin, 3,4, 1,2, GTK_FILL, GTK_FILL, 0, 0); gtk_signal_connect (GTK_OBJECT (gui_mask_calc.hoc_min), "value-changed", GTK_SIGNAL_FUNC (calc_dist_min_cb), (gpointer) gui_mask_calc.hoc_max); gtk_signal_connect (GTK_OBJECT (gui_mask_calc.hoc_max), "value-changed", GTK_SIGNAL_FUNC (calc_dist_max_cb), (gpointer) gui_mask_calc.hoc_min); adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.00, 50.00, 0.1, 1.0, 0.0); gui_mask_calc.voc_min = adj; spin = gtk_spin_button_new (adj, 0.0, 2); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin), GTK_UPDATE_IF_VALID); gtk_table_attach (GTK_TABLE(table), spin, 2,3, 2,3, GTK_FILL, GTK_FILL, 0, 0); adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.00, 50.00, 0.1, 1.0, 0.0); gui_mask_calc.voc_max = adj; spin = gtk_spin_button_new (adj, 0.0, 2); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin), GTK_UPDATE_IF_VALID); gtk_table_attach (GTK_TABLE(table), spin, 3,4, 2,3, GTK_FILL, GTK_FILL, 0, 0); gtk_signal_connect (GTK_OBJECT (gui_mask_calc.voc_min), "value-changed", GTK_SIGNAL_FUNC (calc_dist_min_cb), (gpointer) gui_mask_calc.voc_max); gtk_signal_connect (GTK_OBJECT (gui_mask_calc.voc_max), "value-changed", GTK_SIGNAL_FUNC (calc_dist_max_cb), (gpointer) gui_mask_calc.voc_min); label = gtk_label_new ("Selected"); gtk_table_attach (GTK_TABLE(table), label, 4,5, 0,1, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); label = gtk_label_new ("--.--- %"); gui_mask_calc.hoc_sel = (GtkLabel *) label; gtk_table_attach (GTK_TABLE(table), label, 4,5, 1,2, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0); label = gtk_label_new ("--.--- %"); gui_mask_calc.voc_sel = (GtkLabel *) label; gtk_table_attach (GTK_TABLE(table), label, 4,5, 2,3, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0); scroller = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_table_attach (GTK_TABLE(table), scroller, 0,5, 3,4, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); clist = gtk_clist_new (5); gui_mask_calc.list = (GtkCList *) clist; gui_mask_calc.column = -1; gtk_clist_set_column_title (GTK_CLIST (clist), 0, "H.Over."); gtk_clist_set_column_title (GTK_CLIST (clist), 1, "V.Over."); gtk_clist_set_column_title (GTK_CLIST (clist), 2, "Badness"); gtk_clist_set_column_title (GTK_CLIST (clist), 3, "Aspect"); gtk_clist_set_column_title (GTK_CLIST (clist), 4, "Note"); gtk_clist_column_titles_show (GTK_CLIST (clist)); gtk_clist_column_titles_active (GTK_CLIST (clist)); /* must be after show */ gtk_clist_set_selection_mode (GTK_CLIST (clist), GTK_SELECTION_BROWSE); gtk_clist_set_shadow_type (GTK_CLIST (clist), GTK_SHADOW_IN); gtk_clist_set_column_width (GTK_CLIST (clist), 0, 58); /* some guess */ gtk_clist_set_column_width (GTK_CLIST (clist), 1, 58); /* some guess */ gtk_clist_set_column_width (GTK_CLIST (clist), 2, 55); /* some guess */ gtk_clist_set_column_width (GTK_CLIST (clist), 3, 45); /* some guess */ gtk_clist_set_column_width (GTK_CLIST (clist), 4, 25); /* some guess */ gtk_clist_set_sort_column (GTK_CLIST (clist), 2); /* badness */ gtk_clist_set_sort_type (GTK_CLIST (clist), GTK_SORT_ASCENDING); gtk_signal_connect (GTK_OBJECT (clist), "select_row", GTK_SIGNAL_FUNC (calc_select_cb), &gui_mask_calc); gtk_signal_connect (GTK_OBJECT (clist), "click_column", GTK_SIGNAL_FUNC (calc_column_cb), &gui_mask_calc); gtk_container_add(GTK_CONTAINER(scroller), clist); gtk_table_set_col_spacings (GTK_TABLE(table), 5); button = gtk_button_new_with_label ("List"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (calc_list_cb), &gui_mask_calc); gtk_table_attach(GTK_TABLE(page), button, 0,1,1,2, GTK_FILL, GTK_FILL, 0, 0); button = gtk_button_new_with_label ("Calc"); gui_mask_calc.calc = (GtkButton *) button; gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (calc_calc_cb), &gui_mask_calc); gtk_table_attach(GTK_TABLE(page), button, 1,2,1,2, GTK_FILL, GTK_FILL, 0, 0); button = gtk_toggle_button_new_with_label ("AutoDist"); gui_mask_calc.dist = GTK_TOGGLE_BUTTON (button); gtk_table_attach(GTK_TABLE(page), button, 2,3,1,2, GTK_FILL, GTK_FILL, 0, 0); button = gtk_button_new_with_label ("Print"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gui_print_cb), (gpointer) (PRINT_CHIP_REGS | PRINT_CRT_REGS)); gtk_table_attach(GTK_TABLE(page), button, 3,4,1,2, GTK_FILL, GTK_FILL, 0, 0); button = gtk_button_new_with_label ("Reset"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (calc_reset_cb), &gui_mask_calc); gtk_widget_add_accelerator (GTK_WIDGET (button), "clicked", gui_bt_calc_accel_group, gui_accel[ACCEL_RESET].key, gui_accel[ACCEL_RESET].mods, GTK_ACCEL_VISIBLE); gtk_table_attach(GTK_TABLE(page), button, 4,5,1,2, GTK_FILL, GTK_FILL, 0, 0); return page; } void gui_bt_init (void) { update_bt = (GtkAdjustment *) gtk_adjustment_new (0, 0, 0, 0, 0, 0); gtk_signal_connect (GTK_OBJECT (update_chip), "changed", GTK_SIGNAL_FUNC (update_bt_cb), NULL); gtk_signal_connect (GTK_OBJECT (update_mode), "changed", GTK_SIGNAL_FUNC (calc_reset_cb), &gui_mask_calc); gtk_signal_connect (GTK_OBJECT (changed_all), "changed", GTK_SIGNAL_FUNC (bt_freq_calc_cb), &gui_mask_bt_freq); } /* BT Regs1: old BT Regs BT Regs2: hsynoffset, vsynoffset, hsynwidth, vsynwidth, phase_off, macro, msc out_mux{a,b,c} BT Regs3: old BT Flags */ nvtv-0.4.7/src/gui_cx.c0000644000175000001440000004157507741555571010441 /* NVTV GUI (Conexant part) -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_cx.c,v 1.11 2003/10/10 16:16:57 dthierbach Exp $ * * Contents: * * The GTK graphical user interface. Conexant part. */ /* FIXME: Reuse bt routines ... */ #include "local.h" /* before everything else */ #include #include "gui.h" #include "gui_bt.h" #include "gui_cx.h" GtkAdjustment *update_cx; #ifndef DISABLE_TIMEOUT static gint gui_timeout_cx_id = -1; /* status timeout */ #endif #define FIELD(b,m) addr:&(b.m), size:sizeof(b.m) #define FIELD_BT(m) FIELD(gui_regs.enc.cx.bt,m) #define FIELD_CX(m) FIELD(gui_regs.enc.cx,m) /* -------- GUI Masks -------- */ struct mask_cx_freq { GtkLabel *clk, *hsyn, *vsyn, *hover, *vover, *aspect; }; struct mask_cx_freq gui_mask_cx_freq; struct mask_status { GtkToggleButton *tvon, *pal, *over, *under, *pll_lock, *pll_reset, *secam; }; struct mask_status gui_mask_cx_status; static GuiRegMask cx_mask1_reg [] = { {label:"h_active:", bits:11, tick:1, FIELD_BT(h_active)}, {label:"h_blanki:", bits:10, tick:1, FIELD_BT(h_blanki)}, {label:"h_clki:", bits:11, tick:1, FIELD_BT(h_clki)}, {label:"h_fract:", bits:8, tick:1, FIELD_BT(h_fract)}, {label:"h_blanko:", bits:11, tick:1, FIELD_BT(h_blanko)}, {label:"h_clko:", bits:12, tick:1, FIELD_BT(h_clko)}, {label:"sync_amp:", bits:8, tick:1, FIELD_BT(sync_amp)}, {label:"bst_amp:", bits:8, tick:1, FIELD_BT(bst_amp)}, {label:"hsync_width:", bits:8, tick:1, FIELD_BT(hsync_width)}, {label:"hburst_begin:", bits:9, tick:1, FIELD_BT(hburst_begin)}, {label:"hburst_end:", bits:9, tick:1, FIELD_BT(hburst_end)}, {label:"v_activei:", bits:10, tick:1, FIELD_BT(v_activei)}, {label:"v_blanki:", bits:8, tick:1, FIELD_BT(v_blanki)}, {label:"v_linesi:", bits:11, tick:1, FIELD_BT(v_linesi)}, {label:"v_activeo:", bits:9, tick:1, FIELD_BT(v_activeo)}, {label:"v_blanko:", bits:10, tick:1, FIELD_BT(v_blanko)}, {label:"v_scale:", bits:14, tick:1, FIELD_BT(v_scale)}, {label:"pll_fract:", bits:16, tick:1, FIELD_BT(pll_fract)}, {label:"pll_int:", bits:6, tick:1, FIELD_BT(pll_int)}, {label:"wssinc:", bits:16, tick:1, FIELD_CX(wssinc)}, {label:NULL} }; static GuiRegMask cx_mask2_reg [] = { {label:"dr_limitp:", bits:11, tick:1, FIELD_CX(dr_limitp)}, {label:"dr_limitn:", bits:11, tick:1, FIELD_CX(dr_limitn)}, {label:"db_limitp:", bits:11, tick:1, FIELD_CX(db_limitp)}, {label:"db_limitn:", bits:11, tick:1, FIELD_CX(db_limitn)}, {label:"filfsconv:", bits:6, tick:1, FIELD_CX(filfsconv)}, {label:"filincr:", bits:8, tick:1, FIELD_CX(filincr)}, {label:"mcompy:", bits:8, tick:1, FIELD_CX(mcompy)}, {label:"mcompu:", bits:8, tick:1, FIELD_CX(mcompu)}, {label:"mcompv:", bits:8, tick:1, FIELD_CX(mcompv)}, {label:NULL } }; static GuiFlagMask cx_mask2_flag [] = { {label:"prog_sc", mask:CX_FLAG4_PROG_SC, FIELD_CX(flags4)}, {label:"sc_pattern", mask:CX_FLAG4_SC_PATTERN, FIELD_CX(flags4)}, {label:"field_id", mask:CX_FLAG4_FIELD_ID, FIELD_CX(flags4)}, {label:"fm", mask:CX_FLAG1_FM, FIELD_BT(flags1)}, {label:"ewssf1", mask:CX_FLAG5_EWSSF1, FIELD_CX(flags5)}, {label:"ewssf2", mask:CX_FLAG5_EWSSF2, FIELD_CX(flags5)}, {label:NULL } }; static GuiRegMask cx_mask2_twin [] = { {label:"wsdat:", bits:21, tick:1, FIELD_CX(wsdat)}, {label:"msc:", bits:32, tick:1, FIELD_BT(msc)}, {label:"msc_db:", bits:32, tick:1, FIELD_CX(msc_db)}, {label:NULL} }; static GuiRegMask cx_mask3_reg [] = { {label:"hsynoffset:", bits:-10,tick:1, FIELD_BT(hsynoffset)}, {label:"vsynoffset:", bits:11, tick:1, FIELD_BT(vsynoffset)}, {label:"hsynwidth:", bits:6, tick:1, FIELD_BT(hsynwidth)}, {label:"vsynwidth:", bits:3, tick:1, FIELD_BT(vsynwidth)}, {label:"phase_off:", bits:8, tick:1, FIELD_BT(phase_off)}, {label:"hue_adj:", bits:8, tick:1, FIELD_CX(hue_adj)}, {label:"y_off:", bits:8, tick:1, FIELD_CX(y_off)}, {label:"mcr:", bits:8, tick:1, FIELD_BT(mcr)}, {label:"mcb:", bits:8, tick:1, FIELD_BT(mcb)}, {label:"my:", bits:8, tick:1, FIELD_BT(my)}, {label:"out_muxa:", bits:2, tick:1, FIELD_BT(out_muxa)}, {label:"out_muxb:", bits:2, tick:1, FIELD_BT(out_muxb)}, {label:"out_muxc:", bits:2, tick:1, FIELD_BT(out_muxc)}, {label:"out_muxd:", bits:2, tick:1, FIELD_BT(out_muxd)}, {label:"c_altff:", bits:2, tick:1, FIELD_CX(c_altff)}, {label:"y_altff:", bits:2, tick:1, FIELD_CX(y_altff)}, {label:"c_thresh:", bits:3, tick:1, FIELD_CX(c_thresh)}, {label:"y_thresh:", bits:3, tick:1, FIELD_CX(y_thresh)}, {label:"macro:", bits:3, tick:1, FIELD_BT(macro)}, {label:NULL} }; static GuiFlagMask cx_mask3_flag [] = { {label:"dacdisa", mask:BT_FLAG3_DACDISA, FIELD_BT(flags3)}, {label:"dacdisb", mask:BT_FLAG3_DACDISB, FIELD_BT(flags3)}, {label:"dacdisc", mask:BT_FLAG3_DACDISC, FIELD_BT(flags3)}, {label:"dacdisd", mask:BT_FLAG3_DACDISD, FIELD_BT(flags3)}, {label:"adpt_ff", mask:CX_FLAG5_ADPT_FF, FIELD_CX(flags5)}, {label:"ffrtn", mask:CX_FLAG5_FFRTN, FIELD_CX(flags5)}, {label:"yselect", mask:CX_FLAG5_YSELECT, FIELD_CX(flags5)}, {label:NULL } }; static GuiRegMask cx_mask4_reg [] = { {label:"f_sely:", bits:3, tick:1, FIELD_BT(f_sely)}, {label:"f_selc:", bits:3, tick:1, FIELD_BT(f_selc)}, {label:"pkfil_sel:", bits:2, tick:1, FIELD_CX(pkfil_sel)}, {label:"ylpf:", bits:2, tick:1, FIELD_BT(ylpf)}, {label:"clpf:", bits:2, tick:1, FIELD_BT(clpf)}, {label:"ycoring:", bits:3, tick:1, FIELD_BT(ycoring)}, {label:"ccoring:", bits:3, tick:1, FIELD_BT(ccoring)}, {label:"yattenuate:", bits:3, tick:1, FIELD_BT(yattenuate)}, {label:"cattenuate:", bits:3, tick:1, FIELD_BT(cattenuate)}, {label:NULL} }; static GuiFlagMask cx_mask4_flag [] = { {label:"ni_out", mask:BT_FLAG1_NI_OUT, FIELD_BT(flags1)}, {label:"setup", mask:BT_FLAG1_SETUP, FIELD_BT(flags1)}, {label:"625line", mask:BT_FLAG1_625LINE, FIELD_BT(flags1)}, {label:"vsync_dur", mask:BT_FLAG1_VSYNC_DUR, FIELD_BT(flags1)}, {label:"dis_screset", mask:BT_FLAG1_DIS_SCRESET, FIELD_BT(flags1)}, {label:"pal_md", mask:BT_FLAG1_PAL_MD, FIELD_BT(flags1)}, {label:"dis_ffilt", mask:BT_FLAG2_DIS_FFILT, FIELD_BT(flags2)}, {label:"dis_yflpf", mask:BT_FLAG2_DIS_YFLPF, FIELD_BT(flags2)}, {label:"eclip", mask:BT_FLAG1_ECLIP, FIELD_BT(flags1)}, {label:"chroma_bw", mask:CX_FLAG4_CHROMA_BW, FIELD_CX(flags4)}, {label:"en_async", mask:BT_FLAG1_EN_ASYNC, FIELD_BT(flags1)}, {label:"pll_32clk", mask:CX_FLAG5_PLL_32CLK, FIELD_CX(flags5)}, {label:"pix_double", mask:CX_FLAG5_PIX_DOUBLE, FIELD_CX(flags5)}, {label:"div2", mask:CX_FLAG5_DIV2, FIELD_CX(flags5)}, {label:"dis_gmshy", mask:BT_FLAG2_DIS_GMSHY, FIELD_BT(flags2)}, {label:"dis_gmushy", mask:BT_FLAG2_DIS_GMUSHY, FIELD_BT(flags2)}, {label:"dis_gmshc", mask:BT_FLAG2_DIS_GMSHC, FIELD_BT(flags2)}, {label:"dis_gmushc", mask:BT_FLAG2_DIS_GMUSHC, FIELD_BT(flags2)}, {label:"dis_chroma", mask:BT_FLAG2_DIS_CHROMA, FIELD_BT(flags2)}, {label:"by_yccr", mask:CX_FLAG4_BY_YCCR, FIELD_CX(flags4)}, {label:NULL } }; /* -------- -------- */ /* FIXME: Handle different xtal, 3:2 mode, div2 */ void cx_freq_calc_cb (GtkObject *obj, struct mask_cx_freq *m) { double Fxtal = 13500000; double Fclk; double Fhsyn; double Fvsyn; double dALO, dTLO, dATO, dTTO, dVACTIVEO; double dAspect, dHOC, dVOC; char s [20]; if ((gui_tv_chip & TV_ENCODER) != TV_BROOKTREE && (gui_tv_chip & TV_ENCODER) != TV_CONEXANT) return; Fclk = Fxtal * (gui_regs.enc.bt.pll_int + gui_regs.enc.bt.pll_fract / 65536.0) / 6.0; sprintf (s, "%3.2f MHz", Fclk / 1e6); gtk_label_set_text (m->clk, s); Fhsyn = Fclk / gui_regs.enc.bt.h_clki; snprintf (s, 20, "%3.2f kHz", Fhsyn / 1e3); gtk_label_set_text (m->hsyn, s); Fvsyn = Fhsyn / gui_regs.enc.bt.v_linesi; snprintf (s, 20, "%3.2f Hz", Fvsyn); gtk_label_set_text (m->vsyn, s); if (gui_regs.enc.bt.flags1 & BT_FLAG1_625LINE) { dALO = 288.0; dTLO = 312.0; dATO = .000052; dTTO = .000064; } else { dALO = 243.0; dTLO = 262.0; dATO = .00005265556; dTTO = .00006355556; } /* if interlace then dTLO += 0.5 */ dVACTIVEO = (int) (((gui_regs.enc.bt.v_activei * dTLO) + (gui_regs.enc.bt.v_linesi - 1.0)) / gui_regs.enc.bt.v_linesi); /* normally, dVACTIVEO = v_activeo - 2 */ /* These two euqations are also possible, but that's not what happens * in recalc.c, so don't use them. * dVOC = 1.0 - (gui_regs.enc.bt.v_activeo - 2) / dALO; * dVOC = 1.0 - ((gui_regs.enc.bt.v_activei / gui_regs.enc.bt.v_linesi) / * (dALO / dTLO)); */ dVOC = 1.0 - dVACTIVEO / dALO; dHOC = 1.0 - ((2.0 * gui_regs.enc.bt.h_active / gui_regs.enc.bt.h_clko) / (dATO / dTTO)); dAspect = (1.0 - dHOC) / (1.0 - dVOC); snprintf (s, 20, "%06.3f %%", dHOC * 100.0); gtk_label_set_text (m->hover, s); snprintf (s, 20, "%06.3f %%", dVOC * 100.0); gtk_label_set_text (m->vover, s); snprintf (s, 20, "%07.5f", dAspect); gtk_label_set_text (m->aspect, s); /* FIXME: check above, calculate aspect */ } gint check_cx_cb (struct mask_status *m) { int status; if ((gui_tv_chip & TV_ENCODER) != TV_CONEXANT) return TRUE; status = back_card->getStatus (4); if (status < 0) return TRUE; if (! (status & 0x100)) status = 0; gtk_toggle_button_set_active (m->tvon, (status & 0x100) ? TRUE : FALSE); gtk_toggle_button_set_active (m->secam, (status & 0x040) ? TRUE : FALSE); gtk_toggle_button_set_active (m->pll_reset, (status & 0x020) ? TRUE : FALSE); gtk_toggle_button_set_active (m->pll_lock, (status & 0x010) ? TRUE : FALSE); gtk_toggle_button_set_active (m->over, (status & 0x008) ? TRUE : FALSE); gtk_toggle_button_set_active (m->under, (status & 0x004) ? TRUE : FALSE); gtk_toggle_button_set_active (m->pal, (status & 0x002) ? TRUE : FALSE); return TRUE; } void reset_cx_cb (GtkObject *obj, gpointer data) { if ((gui_tv_chip & TV_ENCODER) != TV_CONEXANT) return; if (gui_act_mode) { gui_regs.enc.cx = gui_act_mode->regs.enc.cx; gui_tv_set (); gtk_signal_emit_by_name (GTK_OBJECT (update_cx), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (changed_all), "changed"); } } void update_cx_cb (GtkObject *obj, gpointer data) { if ((gui_tv_chip & TV_ENCODER) != TV_CONEXANT) return; gtk_signal_emit_by_name (GTK_OBJECT (update_cx), "changed"); } void gui_map_cx_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "gui_map_cx_cb"); #ifndef DISABLE_TIMEOUT if (gui_timeout_cx_id == -1) { gui_timeout_cx_id = gtk_timeout_add (500 /* ms */, (GtkFunction) check_cx_cb, &gui_mask_cx_status); } #endif } void gui_unmap_cx_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "gui_unmap_cx_cb"); #ifndef DISABLE_TIMEOUT if (gui_timeout_cx_id != -1) { gtk_timeout_remove (gui_timeout_cx_id); gui_timeout_cx_id = -1; } #endif } /* -------- GUI Pages -------- */ GtkWidget *gui_cx_status_page (void) { GtkWidget *page; GtkWidget *frame; GtkWidget *table; GtkWidget *button; page = gtk_vbox_new (FALSE, 5); gtk_signal_connect (GTK_OBJECT (page), "map", GTK_SIGNAL_FUNC (gui_map_cx_cb), NULL); gtk_signal_connect (GTK_OBJECT (page), "unmap", GTK_SIGNAL_FUNC (gui_unmap_cx_cb), NULL); gtk_container_set_border_width (GTK_CONTAINER (page), 5); /* Frequencies CRT / TV */ frame = gtk_frame_new ("Frequencies"); gtk_box_pack_start (GTK_BOX (page), frame, TRUE, TRUE, 0); table = gtk_table_new (3, 4, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 10); gtk_container_add (GTK_CONTAINER (frame), table); gui_mask_cx_freq.clk = gui_mask_label (table, "Monitor dot clock:", "---.-- MHz", 0,1,2, 0); gui_mask_cx_freq.hsyn = gui_mask_label (table, "Monitor horiz. sync:", "---.-- kHz", 0,1,2, 1); gui_mask_cx_freq.vsyn = gui_mask_label (table, "Monitor vert. sync:", "---.-- Hz", 0,1,2, 2); gui_mask_cx_freq.hover = gui_mask_label (table, "TV horiz. overscan:", "--.-- %", 0,1,2, 3); gui_mask_cx_freq.vover = gui_mask_label (table, "TV vert. overscan:", "--.-- %", 0,1,2, 4); gui_mask_cx_freq.aspect = gui_mask_label (table, "TV aspect ratio:", "-.--- ", 0,1,2, 5); gtk_table_set_col_spacings (GTK_TABLE(table), 10); gtk_table_set_row_spacings (GTK_TABLE(table), 10); /* TV Status: CX Fifo overrun/underrun */ frame = gtk_frame_new ("Conexant Status"); gtk_box_pack_start (GTK_BOX (page), frame, TRUE, TRUE, 0); table = gtk_table_new (1, 1, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 10); gtk_container_add (GTK_CONTAINER (frame), table); button = gtk_check_button_new_with_label ("TV on"); gui_mask_cx_status.tvon = (GtkToggleButton *) button; gtk_table_attach (GTK_TABLE(table), button, 0,1, 0,1, GTK_FILL,GTK_FILL,0,0); button = gtk_check_button_new_with_label ("PLL locked"); gui_mask_cx_status.pll_lock = (GtkToggleButton *) button; gtk_table_attach (GTK_TABLE(table), button, 0,1, 1,2, GTK_FILL,GTK_FILL,0,0); button = gtk_check_button_new_with_label ("PLL reset"); gui_mask_cx_status.pll_reset = (GtkToggleButton *) button; gtk_table_attach (GTK_TABLE(table), button, 0,1, 2,3, GTK_FILL,GTK_FILL,0,0); button = gtk_check_button_new_with_label ("FIFO overrun"); gui_mask_cx_status.over = (GtkToggleButton *) button; gtk_table_attach (GTK_TABLE(table), button, 1,2, 0,1, GTK_FILL,GTK_FILL,0,0); button = gtk_check_button_new_with_label ("FIFO underrun"); gui_mask_cx_status.under = (GtkToggleButton *) button; gtk_table_attach (GTK_TABLE(table), button, 1,2, 1,2, GTK_FILL,GTK_FILL,0,0); button = gtk_check_button_new_with_label ("PAL pin"); gui_mask_cx_status.pal = (GtkToggleButton *) button; gtk_table_attach (GTK_TABLE(table), button, 2,3, 0,1, GTK_FILL,GTK_FILL,0,0); button = gtk_check_button_new_with_label ("SECAM"); gui_mask_cx_status.secam = (GtkToggleButton *) button; gtk_table_attach (GTK_TABLE(table), button, 2,3, 1,2, GTK_FILL,GTK_FILL,0,0); gtk_table_set_col_spacings (GTK_TABLE(table), 5); gtk_table_set_row_spacings (GTK_TABLE(table), 5); /* return */ return page; } GtkWidget *gui_cx_reg1_page (void) { GtkAccelGroup *gui_cx_reg_accel_group; gui_cx_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("CX 25870/871 Timings", gui_cx_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_cx), GTK_SIGNAL_FUNC (reset_cx_cb), 0, 0, 11, cx_mask1_reg, 0, 0, NULL, 0, 0, 0, NULL); } GtkWidget *gui_cx_reg2_page (void) { GtkAccelGroup *gui_cx_reg_accel_group; gui_cx_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("CX 25870/871 Secam & Subcarrier", gui_cx_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_cx), GTK_SIGNAL_FUNC (reset_cx_cb), 0, 0, 6, cx_mask2_reg, 0, 6, cx_mask2_twin, 3, 3, 3, cx_mask2_flag); } GtkWidget *gui_cx_reg3_page (void) { GtkAccelGroup *gui_cx_reg_accel_group; gui_cx_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("CX 25870/871 Parameters", gui_cx_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_cx), GTK_SIGNAL_FUNC (reset_cx_cb), 0, 0, 10, cx_mask3_reg, 0, 0, NULL, 6, 0, 9, cx_mask3_flag); } GtkWidget *gui_cx_reg4_page (void) { GtkAccelGroup *gui_cx_reg_accel_group; gui_cx_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("CX 25870/871 Flags", gui_cx_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_cx), GTK_SIGNAL_FUNC (reset_cx_cb), 0, 0, 10, cx_mask4_reg, 0, 0, NULL, 4, 0, 10, cx_mask4_flag); } void gui_cx_init (void) { update_cx = (GtkAdjustment *) gtk_adjustment_new (0, 0, 0, 0, 0, 0); gtk_signal_connect (GTK_OBJECT (update_chip), "changed", GTK_SIGNAL_FUNC (update_cx_cb), NULL); gtk_signal_connect (GTK_OBJECT (changed_all), "changed", GTK_SIGNAL_FUNC (cx_freq_calc_cb), &gui_mask_cx_freq); } nvtv-0.4.7/src/gui_ch.c0000644000175000001440000002544407743224066010410 /* NVTV GUI (Chrontel part) -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_ch.c,v 1.20 2003/10/15 10:57:58 dthierbach Exp $ * * Contents: * * The GTK graphical user interface. Chrontel part. */ #include "local.h" /* before everything else */ #include #include "gui.h" #include "gui_ch.h" #include "backend.h" #include "data_ch.h" static GtkAdjustment *update_ch; static gint gui_timeout_ch_id = -1; /* status timeout */ #define FIELD(b,m) addr:&(b.m), size:sizeof(b.m) #define FIELD_CH(m) FIELD(gui_regs.enc.ch,m) /* -------- GUI Masks -------- */ struct mask_ch_freq { GtkLabel *clk, *hsyn, *vsyn, *hover, *vover, *aspect; GtkLabel *pixels, *lines; }; struct mask_ch_freq gui_mask_ch_freq; struct mask_civ { GtkLabel *low, *high; }; struct mask_civ gui_mask_civ; static GuiRegMask ch_mask1_reg [] = { {label:"dmr-ir:", bits:3, tick:1, FIELD_CH(dmr_ir)}, {label:"dmr-vs:", bits:2, tick:1, FIELD_CH(dmr_vs)}, {label:"dmr-sr:", bits:3, tick:1, FIELD_CH(dmr_sr)}, {label:"pll-m:", bits:9, tick:1, FIELD_CH(pll_m)}, {label:"pll-n:", bits:10, tick:1, FIELD_CH(pll_n)}, {label:"pllcap:", bits:1, tick:1, FIELD_CH(pllcap)}, {label:"dacg:", bits:1, tick:1, FIELD_CH(dacg)}, {label:"blr:", bits:8, tick:1, FIELD_CH(blr)}, {label:"ce:", bits:3, tick:1, FIELD_CH(ce)}, {label:"sav:", bits:9, tick:1, FIELD_CH(sav)}, {label:"hpr:", bits:9, tick:1, FIELD_CH(hpr)}, {label:"vpr:", bits:9, tick:1, FIELD_CH(vpr)}, {label:"civh:", bits:2, tick:1, FIELD_CH(civh)}, {label:"mode:", bits:5, tick:1, FIELD_CH(mode)}, {label:"macro:", bits:2, tick:1, FIELD_CH(macro)}, {label:NULL} }; static GuiFlagMask ch_mask1_flag [] = { {label:"pd0", mask:CH_FLAG_DAC_PD0, FIELD_CH(flags)}, {label:"pd1", mask:CH_FLAG_DAC_PD1, FIELD_CH(flags)}, {label:"poutp", mask:CH_FLAG_POUTP, FIELD_CH(flags)}, {label:"aciv", mask:CH_FLAG_ACIV, FIELD_CH(flags)}, {label:"cfrb", mask:CH_FLAG_CFRB, FIELD_CH(flags)}, {label:"cvbw", mask:CH_FLAG_CVBW, FIELD_CH(flags)}, {label:"scart", mask:CH_FLAG_SCART, FIELD_CH(flags)}, {label:NULL } }; static GuiRegMask ch_mask1_twin [] = { {label:"fsci:", bits:32, tick:1, FIELD_CH(fsci)}, {label:NULL} }; static GuiRegMask ch_mask2_reg [] = { {label:"vbw-flff:", bits:1, tick:1, FIELD_CH(vbw_flff)}, {label:"vbw-cbw:", bits:2, tick:1, FIELD_CH(vbw_cbw)}, {label:"vbw-ypeak:", bits:1, tick:1, FIELD_CH(vbw_ypeak)}, {label:"vbw-ysv:", bits:2, tick:1, FIELD_CH(vbw_ysv)}, {label:"vbw-ycv:", bits:1, tick:1, FIELD_CH(vbw_ycv)}, {label:"ffr-fc:", bits:2, tick:1, FIELD_CH(ffr_fc)}, {label:"ffr-fy:", bits:2, tick:1, FIELD_CH(ffr_fy)}, {label:"ffr-ft:", bits:2, tick:1, FIELD_CH(ffr_ft)}, {label:NULL} }; /* -------- -------- */ void reset_ch_cb (GtkWidget *widget, gpointer data) { if (((gui_tv_chip & TV_ENCODER) == TV_CHRONTEL_MODEL1 || (gui_tv_chip & TV_ENCODER) == TV_CHRONTEL_MODEL2) && gui_act_mode) { gui_regs.enc.ch = gui_act_mode->regs.enc.ch; gui_tv_set (); gtk_signal_emit_by_name (GTK_OBJECT (update_ch), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (changed_all), "changed"); } } void update_ch_cb (GtkWidget *widget, gpointer data) { if (((gui_tv_chip & TV_ENCODER) == TV_CHRONTEL_MODEL1 || (gui_tv_chip & TV_ENCODER) == TV_CHRONTEL_MODEL2) && gui_act_mode) { gtk_signal_emit_by_name (GTK_OBJECT (update_ch), "changed"); } } void ch_freq_calc_cb (GtkObject *obj, struct mask_ch_freq *m) { int alo, tlo; double ato, tto; int tpl, tlf; /* total pixels/line, total lines/field */ double sc; double hoc, voc, aspect; double Fref, Fpixel; double Fhsyn; double Fvsyn; int res_x, res_y; char s [20]; static int tlf_pal[8] = {500,625, -1,750,836, -1,-1,-1}; static int tlf_ntsc[8] = {420,525,600,630,700,750,-1,-1}; static double scale[8] = {5/4.0, 1/1.0, 7/8.0, 5/6.0, 3/4.0, 7/10.0, -1, -1}; if ((gui_tv_chip & TV_ENCODER) != TV_CHRONTEL_MODEL1) return; Fref = 14.31818; /* MHz */ switch (gui_regs.enc.ch.dmr_vs) { case 1: /* TV_SYSTEM_NTSC */ case 3: /* TV_SYSTEM_NTSC_J */ alo = 480; tlo = 262 * 2 + 1; ato = 52.65556; /* us */ tto = 63.55556; /* us */ /* 63.55556; */ tlf = tlf_ntsc[gui_regs.enc.ch.dmr_sr]; break; case 0: /* TV_SYSTEM_PAL */ case 2: /* TV_SYSTEM_PAL_M */ default: alo = 576; tlo = 312 * 2 + 1; ato = 52.0; /* us */ tto = 64.0; /* us */ tlf = tlf_pal[gui_regs.enc.ch.dmr_sr]; break; } switch (gui_regs.enc.ch.dmr_ir) { case 0: res_x = 512; res_y = 384; break; case 1: res_x = 720; res_y = 400; break; case 2: res_x = 640; res_y = 400; break; case 3: res_x = 640; res_y = 480; break; case 4: res_x = 800; res_y = 600; break; case 5: res_x = 720; res_y = alo; break; default: res_x = 1; res_y = 1; } Fpixel = Fref * (gui_regs.enc.ch.pll_n + 2.0) / (gui_regs.enc.ch.pll_m + 2.0); sprintf (s, "%3.2f MHz", Fpixel); gtk_label_set_text (m->clk, s); sc = scale[gui_regs.enc.ch.dmr_sr]; tpl = (int) ((tto / 2.0) / (1.0 / Fpixel) * sc + 0.5); hoc = 1.0 - ((double) res_x / tpl) / ((double) ato / tto); voc = 1.0 - ((double) res_y / tlf) / ((double) alo / tlo); aspect = 1.0; /* FIXME TODO */ Fhsyn = 1e3 * Fpixel / tpl; snprintf (s, 20, "%3.2f kHz", Fhsyn); gtk_label_set_text (m->hsyn, s); Fvsyn = 1e3 * Fhsyn / tlf; snprintf (s, 20, "%3.2f Hz", Fvsyn); gtk_label_set_text (m->vsyn, s); snprintf (s, 20, "%06.3f %%", hoc * 100.0); gtk_label_set_text (m->hover, s); snprintf (s, 20, "%06.3f %%", voc * 100.0); gtk_label_set_text (m->vover, s); snprintf (s, 20, "%07.5f", aspect); gtk_label_set_text (m->aspect, s); snprintf (s, 20, "%3i / %3i", res_x, tpl); gtk_label_set_text (m->pixels, s); snprintf (s, 20, "%3i / %3i", res_y, tlf); gtk_label_set_text (m->lines, s); } gint check_civ_cb (struct mask_civ *m) { long status; char s[20]; if ((gui_tv_chip & TV_ENCODER) != TV_CHRONTEL_MODEL1) return TRUE; status = back_card->getStatus (0); if (status >= 0) { snprintf (s, 20, "%9li", status << 6); gtk_label_set_text (m->low, s); snprintf (s, 20, "%9li", status << 6 | 0x3f); gtk_label_set_text (m->high, s); } else { gtk_label_set_text (m->low, ""); gtk_label_set_text (m->high, ""); } return TRUE; } void gui_map_ch_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "gui_map_ch_cb"); #ifndef DISABLE_TIMEOUT if (gui_timeout_ch_id == -1) { gui_timeout_ch_id = gtk_timeout_add (500 /* ms */, (GtkFunction) check_civ_cb, &gui_mask_civ); } #endif } void gui_unmap_ch_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "gui_unmap_ch_cb"); #ifndef DISABLE_TIMEOUT if (gui_timeout_ch_id != -1) { gtk_timeout_remove (gui_timeout_ch_id); gui_timeout_ch_id = -1; } #endif } /* -------- GUI Pages -------- */ GtkWidget *gui_ch_reg1_page (void) { GtkAccelGroup *gui_ch_reg_accel_group; gui_ch_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("Chrontel Registers", gui_ch_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_ch), GTK_SIGNAL_FUNC (reset_ch_cb), 0, 0, 9, ch_mask1_reg, 0, 9, ch_mask1_twin, 7, 0, 9, ch_mask1_flag); } GtkWidget *gui_ch_reg2_page (void) { GtkAccelGroup *gui_ch_reg_accel_group; gui_ch_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("Chrontel Registers", gui_ch_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_ch), GTK_SIGNAL_FUNC (reset_ch_cb), 0, 0, 5, ch_mask2_reg, 0, 0, NULL, 0, 0, 0, NULL); } GtkWidget *gui_ch_status_page (void) { GtkWidget *page; GtkWidget *frame; GtkWidget *table; page = gtk_vbox_new (FALSE, 5); gtk_signal_connect (GTK_OBJECT (page), "map", GTK_SIGNAL_FUNC (gui_map_ch_cb), NULL); gtk_signal_connect (GTK_OBJECT (page), "unmap", GTK_SIGNAL_FUNC (gui_unmap_ch_cb), NULL); gtk_container_set_border_width (GTK_CONTAINER (page), 5); /* Frequencies CRT / TV */ frame = gtk_frame_new ("Frequencies"); gtk_box_pack_start (GTK_BOX (page), frame, TRUE, TRUE, 0); table = gtk_table_new (1, 1, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 10); gtk_container_add (GTK_CONTAINER (frame), table); gui_mask_ch_freq.clk = gui_mask_label (table, "Monitor dot clock:", "---.-- MHz", 0,1,2, 0); gui_mask_ch_freq.hsyn = gui_mask_label (table, "Monitor horiz. sync:", "---.-- kHz", 0,1,2, 1); gui_mask_ch_freq.vsyn = gui_mask_label (table, "Monitor vert. sync:", "---.-- Hz", 0,1,2, 2); gui_mask_ch_freq.hover = gui_mask_label (table, "TV horiz. overscan:", "--.-- %", 0,1,2, 3); gui_mask_ch_freq.vover = gui_mask_label (table, "TV vert. overscan:", "--.-- %", 0,1,2, 4); gui_mask_ch_freq.aspect = gui_mask_label (table, "TV aspect ratio:", "-.--- ", 0,1,2, 5); gui_mask_ch_freq.pixels = gui_mask_label (table, "Pixels (horiz.)", "--- / ---", 0,1,2, 6); gui_mask_ch_freq.lines = gui_mask_label (table, "Lines (vert.)", "--- / ---", 0,1,2, 7); gtk_table_set_col_spacings (GTK_TABLE(table), 10); gtk_table_set_row_spacings (GTK_TABLE(table), 10); /* CH Status */ frame = gtk_frame_new ("Chrontel Status"); gtk_box_pack_start (GTK_BOX (page), frame, TRUE, TRUE, 0); table = gtk_table_new (1, 1, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 10); gtk_container_add (GTK_CONTAINER (frame), table); gui_mask_civ.low = gui_mask_label (table, "CIV lower bound:", "---------", 0,1,2, 0); gui_mask_civ.high = gui_mask_label (table, "CIV upper bound:", "---------", 0,1,2, 1); gtk_table_set_col_spacings (GTK_TABLE(table), 10); gtk_table_set_row_spacings (GTK_TABLE(table), 10); return page; } void gui_ch_init (void) { update_ch = (GtkAdjustment *) gtk_adjustment_new (0, 0, 0, 0, 0, 0); gtk_signal_connect (GTK_OBJECT (update_chip), "changed", GTK_SIGNAL_FUNC (update_ch_cb), NULL); gtk_signal_connect (GTK_OBJECT (changed_all), "changed", GTK_SIGNAL_FUNC (ch_freq_calc_cb), &gui_mask_ch_freq); } nvtv-0.4.7/src/gui_ph.c0000644000175000001440000007243407741555571010434 /* NVTV Gui Philips -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_ph.c,v 1.23 2003/10/10 16:16:57 dthierbach Exp $ * * Contents: * * The GTK graphical user interface. Philips part. */ #include "local.h" /* before everything else */ #include #include #include "gui.h" #include "gui_ph.h" #include "backend.h" #include "data_ph.h" #define two_to_21 2097152.0 #define two_to_20 1048576.0 /* Automatic minimum distance between overscan percentages */ static GtkAdjustment *update_ph; static gint gui_timeout_ph_id = -1; /* status timeout */ static TVMode ph_calc = {{TV_SYSTEM_NONE, 0, 0, "Custom", "", 0.0, 0.0}}; #define FIELD(b,m) addr:&(b.m), size:sizeof(b.m) #define FIELD_PH1(m) FIELD(gui_regs.enc.ph1,m) #define FIELD_PH2(m) FIELD(gui_regs.enc.ph2,m) /* -------- GUI Masks -------- */ struct mask_calc { GtkAdjustment *hdisp, *vdisp; GtkAdjustment *hsync; GtkAdjustment *htotal; GtkAdjustment *hoc, *voc; GtkAdjustment *hoffset, *voffset; GtkAdjustment *flicker; GtkAdjustment *yinc, *yskip, *yofse, *yofso; GtkLabel *hsize, *vsize; GtkLabel *vtotal, *vsync; }; struct mask_calc ph_mask_calc; struct mask_ph_freq { GtkLabel *clk, *hsyn, *vsyn, *hover, *vover, *aspect; }; struct mask_ph_freq gui_mask_ph_freq; struct mask_ph_status { GtkToggleButton *tvon, *over, *under; }; struct mask_ph_status gui_mask_ph_status; static GuiRegMask ph_mask1_twin [] = { {label:"fsc:", bits:32, tick:1, FIELD_PH1(fsc)}, {label:"pcl:", bits:24, tick:1, FIELD_PH1(pcl)}, {label:NULL} }; /* -------- */ static GuiRegMask ph1_mask1_reg [] = { {label:"adwhs:", bits:11, tick:1, FIELD_PH1(adwhs)}, {label:"adwhe:", bits:11, tick:1, FIELD_PH1(adwhe)}, {label:"fal:", bits:9, tick:1, FIELD_PH1(fal)}, {label:"lal:", bits:9, tick:1, FIELD_PH1(lal)}, {label:"gy:", bits:5, tick:1, FIELD_PH1(gy)}, {label:"gcd:", bits:5, tick:1, FIELD_PH1(gcd)}, {label:"bs:", bits:6, tick:1, FIELD_PH1(bs)}, {label:"be:", bits:6, tick:1, FIELD_PH1(be)}, {label:"idel:", bits:4, tick:1, FIELD_PH1(idel)}, {label:"gainu:", bits:9, tick:1, FIELD_PH1(gainu)}, {label:"gainv:", bits:9, tick:1, FIELD_PH1(gainv)}, {label:"blckl:", bits:6, tick:1, FIELD_PH1(blckl)}, {label:"blnnl:", bits:6, tick:1, FIELD_PH1(blnnl)}, {label:"bsta:", bits:6, tick:1, FIELD_PH1(bsta)}, {label:"macro:", bits:3, tick:1, FIELD_PH1(macro)}, {label:NULL} }; static GuiRegMask ph1_mask2_reg [] = { {label:"xpix:", bits:10, tick:1, FIELD_PH1(xpix)}, {label:"xofs:", bits:10, tick:1, FIELD_PH1(xofs)}, {label:"xinc:", bits:12, tick:1, FIELD_PH1(xinc)}, {label:"ypix:", bits:10, tick:1, FIELD_PH1(ypix)}, {label:"yofso:", bits:10, tick:1, FIELD_PH1(yofso)}, {label:"yofse:", bits:10, tick:1, FIELD_PH1(yofse)}, {label:"yinc:", bits:12, tick:1, FIELD_PH1(yinc)}, {label:"yskip:", bits:12, tick:1, FIELD_PH1(yskip)}, {label:"yiwgto:", bits:12, tick:1, FIELD_PH1(yiwgto)}, {label:"yiwgte:", bits:12, tick:1, FIELD_PH1(yiwgte)}, {label:"hlen:", bits:12, tick:1, FIELD_PH1(hlen)}, {label:"chps:", bits:8, tick:1, FIELD_PH1(chps)}, {label:"bcy:", bits:8, tick:1, FIELD_PH1(bcy)}, {label:"bcu:", bits:8, tick:1, FIELD_PH1(bcu)}, {label:"bcv:", bits:8, tick:1, FIELD_PH1(bcv)}, {label:"ccrs:", bits:2, tick:1, FIELD_PH1(ccrs)}, {label:"flc:", bits:2, tick:1, FIELD_PH1(flc)}, {label:"phres:", bits:2, tick:1, FIELD_PH1(phres)}, {label:NULL} }; static GuiFlagMask ph1_mask1_flag [] = { {label:"fise", mask:PH_FLAG1_FISE, FIELD_PH1(flags1)}, {label:"pal", mask:PH_FLAG1_PAL, FIELD_PH1(flags1)}, {label:"ygs", mask:PH_FLAG1_YGS, FIELD_PH1(flags1)}, {label:NULL } }; static GuiFlagMask ph1_mask2_flag [] = { {label:"scbw", mask:PH_FLAG1_SCBW, FIELD_PH1(flags1)}, {label:"cen", mask:PH_FLAG2_CEN, FIELD_PH1(flags2)}, {label:"cvbsen0", mask:PH_FLAG2_CVBSEN0, FIELD_PH1(flags2)}, {label:"cvbsen1", mask:PH_FLAG2_CVBSEN1, FIELD_PH1(flags2)}, {label:"vbsen", mask:PH_FLAG2_VBSEN, FIELD_PH1(flags2)}, {label:"yfil", mask:PH_FLAG1_YFIL, FIELD_PH1(flags1)}, {label:NULL } }; /* -------- */ static GuiRegMask ph2_mask1_reg [] = { {label:"adwhs:", bits:11, tick:1, FIELD_PH1(adwhs)}, {label:"adwhe:", bits:11, tick:1, FIELD_PH1(adwhe)}, {label:"fal:", bits:9, tick:1, FIELD_PH1(fal)}, {label:"lal:", bits:9, tick:1, FIELD_PH1(lal)}, {label:"gy:", bits:5, tick:1, FIELD_PH1(gy)}, {label:"gcd:", bits:5, tick:1, FIELD_PH1(gcd)}, {label:"bs:", bits:6, tick:1, FIELD_PH1(bs)}, {label:"be:", bits:6, tick:1, FIELD_PH1(be)}, {label:"idel:", bits:4, tick:1, FIELD_PH1(idel)}, {label:"gainu:", bits:9, tick:1, FIELD_PH1(gainu)}, {label:"gainv:", bits:9, tick:1, FIELD_PH1(gainv)}, {label:"blckl:", bits:6, tick:1, FIELD_PH1(blckl)}, {label:"blnnl:", bits:6, tick:1, FIELD_PH1(blnnl)}, {label:"bsta:", bits:6, tick:1, FIELD_PH1(bsta)}, {label:"macro:", bits:3, tick:1, FIELD_PH1(macro)}, {label:"fili:", bits:4, tick:1, FIELD_PH2(fili)}, {label:"pcle:", bits:2, tick:1, FIELD_PH2(pcle)}, {label:"pcli:", bits:2, tick:1, FIELD_PH2(pcli)}, {label:NULL} }; static GuiRegMask ph2_mask2_reg [] = { {label:"xpix:", bits:10, tick:1, FIELD_PH1(xpix)}, {label:"xofs:", bits:10, tick:1, FIELD_PH1(xofs)}, {label:"xinc:", bits:12, tick:1, FIELD_PH1(xinc)}, {label:"ypix:", bits:10, tick:1, FIELD_PH1(ypix)}, {label:"yofso:", bits:10, tick:1, FIELD_PH1(yofso)}, {label:"yofse:", bits:10, tick:1, FIELD_PH1(yofse)}, {label:"yinc:", bits:12, tick:1, FIELD_PH1(yinc)}, {label:"yskip:", bits:12, tick:1, FIELD_PH1(yskip)}, {label:"yiwgto:", bits:12, tick:1, FIELD_PH1(yiwgto)}, {label:"yiwgte:", bits:12, tick:1, FIELD_PH1(yiwgte)}, {label:"hlen:", bits:12, tick:1, FIELD_PH1(hlen)}, {label:"chps:", bits:8, tick:1, FIELD_PH1(chps)}, {label:"bcy:", bits:8, tick:1, FIELD_PH1(bcy)}, {label:"bcu:", bits:8, tick:1, FIELD_PH1(bcu)}, {label:"bcv:", bits:8, tick:1, FIELD_PH1(bcv)}, {label:"ccrs:", bits:2, tick:1, FIELD_PH1(ccrs)}, {label:"flc:", bits:2, tick:1, FIELD_PH1(flc)}, {label:"phres:", bits:2, tick:1, FIELD_PH1(phres)}, {label:"yfil:", bits:2, tick:1, FIELD_PH2(yfil)}, {label:NULL} }; static GuiFlagMask ph2_mask1_flag [] = { {label:"fise", mask:PH_FLAG1_FISE, FIELD_PH1(flags1)}, {label:"pal", mask:PH_FLAG1_PAL, FIELD_PH1(flags1)}, {label:"ygs", mask:PH_FLAG1_YGS, FIELD_PH1(flags1)}, {label:"ifbp", mask:PH_FLAG3_IFBP, FIELD_PH2(flags3)}, {label:"ifra", mask:PH_FLAG3_IFRA, FIELD_PH2(flags3)}, {label:NULL } }; static GuiFlagMask ph2_mask2_flag [] = { {label:"scbw", mask:PH_FLAG1_SCBW, FIELD_PH1(flags1)}, {label:"cen", mask:PH_FLAG2_CEN, FIELD_PH1(flags2)}, {label:"cvbsen0", mask:PH_FLAG2_CVBSEN0, FIELD_PH1(flags2)}, {label:"cvbsen1", mask:PH_FLAG2_CVBSEN1, FIELD_PH1(flags2)}, {label:"cvbsen2", mask:PH_FLAG2_CVBSEN2, FIELD_PH1(flags2)}, {label:"vbsen", mask:PH_FLAG2_VBSEN, FIELD_PH1(flags2)}, {label:"yfil", mask:PH_FLAG1_YFIL, FIELD_PH1(flags1)}, {label:"xint", mask:PH_FLAG3_XINT, FIELD_PH2(flags3)}, {label:"eidiv", mask:PH_FLAG3_EIDIV, FIELD_PH2(flags3)}, {label:"yupsc", mask:PH_FLAG3_YUPSC, FIELD_PH2(flags3)}, {label:NULL } }; #if 0 #endif /* -------- */ void ph_freq_calc_cb (GtkObject *obj, struct mask_ph_freq *m) { double Fxtal = 27000000; /* Hz */ double Fclk; double Fhsyn; double Fvsyn; double hoc, voc; int hclk; double ato, alo; char s [20]; if ((gui_tv_chip & TV_COMPANY) != TV_PHILIPS) return; Fclk = Fxtal * gui_regs.enc.ph1.pcl / two_to_20; switch (gui_tv_chip & TV_ENCODER) { case TV_PHILIPS_MODEL1: Fclk /= 2; break; case TV_PHILIPS_MODEL2: Fclk /= (1 << gui_regs.enc.ph2.pcle); break; } sprintf (s, "%3.2f MHz", Fclk / 1e6); gtk_label_set_text (m->clk, s); Fhsyn = Fclk / (gui_regs.enc.ph1.hlen + 1); snprintf (s, 20, "%3.2f kHz", Fhsyn / 1e3); gtk_label_set_text (m->hsyn, s); if (gui_regs.enc.ph1.flags1 & PH_FLAG1_FISE) { Fvsyn = 60.0; /* NTSC etc. */ hclk = 858; ato = 710 * 2.0; /* dclk */ alo = 243.0; /* Ph-Data: 240.0; */ } else { Fvsyn = 50.0; /* PAL etc. */ hclk = 864; ato = 702 * 2.0; /* dclk */ alo = 288.0; /* Ph_Data: 287.0; */ } snprintf (s, 20, "%3.2f Hz", Fvsyn); gtk_label_set_text (m->vsyn, s); voc = 1.0 - ((gui_regs.enc.ph1.lal - gui_regs.enc.ph1.fal) / alo); hoc = 1.0 - ((gui_regs.enc.ph1.adwhe - gui_regs.enc.ph1.adwhs) / ato); snprintf (s, 20, "%06.3f %%", hoc * 100.0); gtk_label_set_text (m->hover, s); snprintf (s, 20, "%06.3f %%", voc * 100.0); gtk_label_set_text (m->vover, s); gtk_label_set_text (m->aspect, "-"); } gint check_ph_cb (struct mask_ph_status *m) { int status; if ((gui_tv_chip & TV_COMPANY) != TV_PHILIPS) return TRUE; status = back_card->getStatus (0); if (status < 0) return TRUE; if (! (status & 0x100)) status = 0; gtk_toggle_button_set_active (m->tvon, (status & 0x100) ? TRUE : FALSE); gtk_toggle_button_set_active (m->over, (status & 0x008) ? TRUE : FALSE); gtk_toggle_button_set_active (m->under, (status & 0x004) ? TRUE : FALSE); return TRUE; } /* ---- Calc ---- */ void calc_ph_reset_cb (GtkWidget *widget, struct mask_calc *m) { if ((gui_tv_chip & TV_COMPANY) != TV_PHILIPS) return; if (gui_list_mode) { gtk_adjustment_set_value (m->hdisp, gui_list_mode->regs.crtc.nv.HDisplay); gtk_adjustment_set_value (m->vdisp, gui_list_mode->regs.crtc.nv.VDisplay); gtk_adjustment_set_value (m->hsync, gui_list_mode->regs.crtc.nv.HSyncStart); gtk_adjustment_set_value (m->htotal, gui_list_mode->regs.crtc.nv.HTotal); gtk_adjustment_set_value (m->hoc, gui_list_mode->spec.hoc); gtk_adjustment_set_value (m->voc, gui_list_mode->spec.voc); gtk_adjustment_set_value (m->hoffset, 0); gtk_adjustment_set_value (m->voffset, 0); gtk_adjustment_set_value (m->flicker, 100); gtk_adjustment_set_value (m->yinc, 0); gtk_adjustment_set_value (m->yskip, 0); gtk_adjustment_set_value (m->yofse, 0); gtk_adjustment_set_value (m->yofso, 0); gtk_label_set_text (m->hsize, "-"); gtk_label_set_text (m->vsize, "-"); gtk_label_set_text (m->vsync, "-"); gtk_label_set_text (m->vtotal, "-"); } } void gui_xscale_cb (GtkWidget *widget, gpointer data) { } void gui_yscale_cb (GtkWidget *widget, gpointer data) { } /* The following are rough guesses for the border of the 'comfortable' PCL range. The docs hints at 40 MHz - 85 MHz, with 27 MHz crystal */ #define PCL_MIN ((40 << 21) / 27) #define PCL_MAX ((85 << 21) / 27) void calc_ph_cb (GtkButton *button, struct mask_calc *m) { TVNvRegs *c = &ph_calc.regs.crtc.nv; TVPh1Regs *r = &ph_calc.regs.enc.ph1; TVPh2Regs *r2 = &ph_calc.regs.enc.ph2; int OutPix, OutLin; int OutOfsPix, OutOfsLin; int yinc_adj, yskip_adj, yofso_adj, yofse_adj; int InPix, InLin; int InPpl; int vtotal; int ratio; /* Clock ratio, RiePclk in docs */ double hoc, voc; double flicker; double vfactor; double hfactor; double tlf; /* total lines/field */ double tpl; /* total pixels/line */ int alf; /* active lines/field */ int flf; /* first line/field */ int fpl; /* first pixel/line */ int cpl; /* center pixel/line */ char s[16]; InPix = (int) m->hdisp->value; InLin = (int) m->vdisp->value; InPpl = (int) m->htotal->value; c->HSyncStart = (int) m->hsync->value; c->HTotal = (int) m->htotal->value; hoc = m->hoc->value; voc = m->voc->value; flicker = m->flicker->value; OutOfsPix = (int) m->hoffset->value; OutOfsLin = (int) m->voffset->value; yinc_adj = (int) m->yinc->value; yskip_adj = (int) m->yskip->value; yofso_adj = (int) m->yofso->value; yofse_adj = (int) m->yofse->value; switch (gui_system) { case TV_SYSTEM_NTSC: /* 60 Hz */ tpl = 1716; /* ntsc. = 63.555492 ms */ fpl = 256; cpl = 710; tlf = 262.5; /* ntsc */ alf = 243; /* Ph-Data: 240; */ flf = 19; break; case TV_SYSTEM_PAL: /* 50 Hz */ tpl = 1728; /* pal. = 63.999936 ms */ fpl = 284; cpl = 702; tlf = 312.5; /* pal */ alf = 288; /* Ph-Data: 287; */ flf = 23; break; default: return; /* FIXME */ } /* FIXME TODO */ /* This is just a rough estimate according to the formulas in the doc. It needs to be adjusted. */ OutPix = floor (cpl * (1.0 - hoc / 100.0)); OutLin = floor (alf * (1.0 - voc / 100.0)); vtotal = (int) ((InLin + 2.0) / OutLin * tlf); vfactor = vtotal / tlf; ratio = 1; /* no x upscaling */ ph_calc.spec.system = gui_system; ph_calc.spec.res_x = InPix; ph_calc.spec.res_y = InLin; ph_calc.spec.hoc = (1.0 - ((double) OutPix / cpl)) * 100.0; ph_calc.spec.voc = (1.0 - ((double) OutLin / alf)) * 100.0; c->HDisplay = InPix; c->VDisplay = InLin; c->HTotal = (InPpl + 7) & ~7; c->HSyncStart &= ~7; c->HSyncEnd = c->HTotal - (c->HSyncStart - c->HDisplay); if (c->HSyncEnd < c->HSyncStart) c->HSyncEnd = (c->HSyncStart + c->HTotal) / 2; switch (gui_tv_chip & TV_ENCODER) { case TV_PHILIPS_MODEL1: data_init_ph1 (gui_system, r); break; case TV_PHILIPS_MODEL2: data_init_ph2 (gui_system, r2); r2->pcli = 1; r2->pcle = 1; hfactor = 1.0 * OutPix / InPix; if (hfactor > 2.0) { r2->pcle = 3; ratio = 4; } else if (hfactor > 1.0) { r2->pcle = 2; ratio = 2; } else { ratio = 1; } /* FIXME set pcli/pcle according to frequency and upscaling */ /* PH2 PLL between ca. 40 Mhz and 85 Mhz (before divide) */ /* If YUPSC needed, divide YINC by 2 */ break; } r->adwhs = fpl + cpl - OutPix + OutOfsPix; r->adwhe = r->adwhs + OutPix * 2; r->hlen = InPpl * ratio - 1; r->xpix = ceil (InPix * ratio / 2); r->xofs = c->HTotal - c->HSyncStart; r->xinc = ceil (OutPix * 4096.0 / (InPix * ratio)); if (r->xinc >= 4096) r->xinc = 0; r->fal = flf + (alf - OutLin) / 2 + OutOfsLin; r->lal = r->fal + OutLin; switch (gui_tv_chip & TV_ENCODER) { case TV_PHILIPS_MODEL1: r->pcl = floor ((vfactor * InPpl / tpl * two_to_21) + 0.5); break; case TV_PHILIPS_MODEL2: /* Make pcl four times as big as base */ r->pcl = floor ((vfactor * (InPpl << r2->pcle) / tpl * two_to_21) + 0.5); if (r2->pcle > 0 && r->pcl < PCL_MIN) { r2->pcle++; r2->pcli++; /* half freq */ } else if (r->pcl > PCL_MAX) { r->pcl >>= 2; /* double freq */ r2->pcle--; r2->pcli--; } else { r->pcl >>= 1; /* normal case */ } break; } r->yofso = floor (r->fal * vfactor - 2.5) + yofso_adj; r->yofse = r->yofso + yofse_adj; r->ypix = InLin; r->yskip = floor ((100.0 - flicker) / 100.0 * 4095.0) + yskip_adj; r->yinc = floor (OutLin / (InLin + 2.0) * (1.0 + r->yskip / 4095.0) * 4096.0 - 0.5) + yinc_adj; /* Check yinc max bound, reduce yskip if necessary */ if (r->yinc > 4095) { r->yinc = 4095; r->yskip = floor ((r->yinc / 4096.0 / (OutLin / (InLin + 2.0)) - 1.0) * 4095.0 - 0.5); } r->yiwgto = floor (r->yinc / 2.0 + 2048.0 - 0.5); r->yiwgte = floor ((r->yinc - r->yskip) / 2.0); while (r->yiwgte < 0) { r->yiwgte += r->yinc; r->yofse++; } c->VTotal = vtotal; c->VSyncStart = c->VTotal - r->yofso; c->VSyncEnd = c->VSyncStart + 2; gui_act_mode_set (&ph_calc); /* does setup */ snprintf (s, 14, "%3i", OutPix); gtk_label_set_text (m->hsize, s); snprintf (s, 14, "%3i", OutLin); gtk_label_set_text (m->vsize, s); snprintf (s, 14, "%3i", vtotal); gtk_label_set_text (m->vtotal, s); snprintf (s, 14, "%3i", c->VSyncStart); gtk_label_set_text (m->vsync, s); } /* ---- ---- */ void reset_ph_cb (GtkObject *obj, gpointer data) { if ((gui_tv_chip & TV_COMPANY) != TV_PHILIPS) return; if (gui_act_mode) { gui_regs.enc.ph1 = gui_act_mode->regs.enc.ph1; gui_tv_set (); gtk_signal_emit_by_name (GTK_OBJECT (update_ph), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (changed_all), "changed"); } } void update_ph_cb (GtkObject *obj, gpointer data) { if ((gui_tv_chip & TV_COMPANY) != TV_PHILIPS) return; gtk_signal_emit_by_name (GTK_OBJECT (update_ph), "changed"); } void gui_map_ph_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "gui_map_ph_cb"); #ifndef DISABLE_TIMEOUT if (gui_timeout_ph_id == -1) { gui_timeout_ph_id = gtk_timeout_add (500 /* ms */, (GtkFunction) check_ph_cb, &gui_mask_ph_status); } #endif } void gui_unmap_ph_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "gui_unmap_ph_cb"); #ifndef DISABLE_TIMEOUT if (gui_timeout_ph_id != -1) { gtk_timeout_remove (gui_timeout_ph_id); gui_timeout_ph_id = -1; } #endif } /* -------- GUI helper -------- */ GtkAdjustment *create_spin (GtkWidget *table, double min, double max, double inc, int decim, int x1, int x2, int y) { GtkWidget *spin; GtkAdjustment *adj; adj = (GtkAdjustment *) gtk_adjustment_new (0.0, min, max, inc, inc * 10.0, 0.0); spin = gtk_spin_button_new (adj, 0.0, decim); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin), GTK_UPDATE_IF_VALID); gtk_table_attach (GTK_TABLE(table), spin, x1, x2, y,y+1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); return adj; } /* -------- GUI Pages -------- */ GtkWidget *gui_ph_status_page (void) { GtkWidget *page; GtkWidget *frame; GtkWidget *table; GtkWidget *button; page = gtk_vbox_new (FALSE, 5); gtk_signal_connect (GTK_OBJECT (page), "map", GTK_SIGNAL_FUNC (gui_map_ph_cb), NULL); gtk_signal_connect (GTK_OBJECT (page), "unmap", GTK_SIGNAL_FUNC (gui_unmap_ph_cb), NULL); gtk_container_set_border_width (GTK_CONTAINER (page), 5); /* Frequencies CRT / TV */ frame = gtk_frame_new ("Frequencies"); gtk_box_pack_start (GTK_BOX (page), frame, TRUE, TRUE, 0); table = gtk_table_new (3, 4, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 10); gtk_container_add (GTK_CONTAINER (frame), table); gui_mask_ph_freq.clk = gui_mask_label (table, "Monitor dot clock:", "---.-- MHz", 0,1,2, 0); gui_mask_ph_freq.hsyn = gui_mask_label (table, "Monitor horiz. sync:", "---.-- kHz", 0,1,2, 1); gui_mask_ph_freq.vsyn = gui_mask_label (table, "Monitor vert. sync:", "---.-- Hz", 0,1,2, 2); gui_mask_ph_freq.hover = gui_mask_label (table, "TV horiz. overscan:", "--.-- %", 0,1,2, 3); gui_mask_ph_freq.vover = gui_mask_label (table, "TV vert. overscan:", "--.-- %", 0,1,2, 4); gui_mask_ph_freq.aspect = gui_mask_label (table, "TV aspect ratio:", "-.--- ", 0,1,2, 5); gtk_table_set_col_spacings (GTK_TABLE(table), 10); gtk_table_set_row_spacings (GTK_TABLE(table), 10); /* TV Status: PH Fifo overrun/underrun */ frame = gtk_frame_new ("Philips Status"); gtk_box_pack_start (GTK_BOX (page), frame, TRUE, TRUE, 0); table = gtk_table_new (1, 1, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 10); gtk_container_add (GTK_CONTAINER (frame), table); button = gtk_check_button_new_with_label ("TV on"); gui_mask_ph_status.tvon = GTK_TOGGLE_BUTTON (button); gtk_table_attach (GTK_TABLE(table), button, 0,1, 0,1, GTK_FILL,GTK_FILL,0,0); button = gtk_check_button_new_with_label ("FIFO overrun"); gui_mask_ph_status.over = (GtkToggleButton *) button; gtk_table_attach (GTK_TABLE(table), button, 0,1, 1,2, GTK_FILL,GTK_FILL,0,0); button = gtk_check_button_new_with_label ("FIFO underrun"); gui_mask_ph_status.under = (GtkToggleButton *) button; gtk_table_attach (GTK_TABLE(table), button, 0,1, 2,3, GTK_FILL,GTK_FILL,0,0); gtk_table_set_col_spacings (GTK_TABLE(table), 5); gtk_table_set_row_spacings (GTK_TABLE(table), 5); /* FIXME to the two other FIFO bits */ /* return */ return page; } GtkWidget *gui_ph1_reg1_page (void) { GtkAccelGroup *gui_ph_reg_accel_group; gui_ph_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("Philips Registers (Out)", gui_ph_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_ph), GTK_SIGNAL_FUNC (reset_ph_cb), 0, 0, 8, ph1_mask1_reg, 0, 8, ph_mask1_twin, 6, 0, 8, ph1_mask1_flag); } GtkWidget *gui_ph1_reg2_page (void) { GtkAccelGroup *gui_ph_reg_accel_group; gui_ph_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("Philips Registers (In)", gui_ph_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_ph), GTK_SIGNAL_FUNC (reset_ph_cb), 0, 0, 10, ph1_mask2_reg, 0, 10, NULL, 6, 0, 11, ph1_mask2_flag); } GtkWidget *gui_ph2_reg1_page (void) { GtkAccelGroup *gui_ph_reg_accel_group; gui_ph_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("Philips Registers (Out)", gui_ph_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_ph), GTK_SIGNAL_FUNC (reset_ph_cb), 0, 0, 9, ph2_mask1_reg, 0, 9, ph_mask1_twin, 6, 0, 8, ph2_mask1_flag); } GtkWidget *gui_ph2_reg2_page (void) { GtkAccelGroup *gui_ph_reg_accel_group; gui_ph_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("Philips Registers (In)", gui_ph_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_ph), GTK_SIGNAL_FUNC (reset_ph_cb), 0, 0, 10, ph2_mask2_reg, 0, 10, NULL, 6, 0, 10, ph2_mask2_flag); } GtkWidget *gui_ph_calc_page (void) { GtkWidget *page; GtkWidget *frame; GtkWidget *table; GtkWidget *label; GtkWidget *button; GtkWidget *pane; GtkAccelGroup *gui_ph_calc_accel_group; gui_ph_calc_accel_group = gtk_accel_group_new (); page = gtk_table_new (1,1,FALSE); gtk_container_set_border_width (GTK_CONTAINER (page), 0); gtk_signal_connect (GTK_OBJECT (page), "map", GTK_SIGNAL_FUNC (gui_map_cb), (gpointer) gui_ph_calc_accel_group); gtk_signal_connect (GTK_OBJECT (page), "unmap", GTK_SIGNAL_FUNC (gui_unmap_cb), (gpointer) gui_ph_calc_accel_group); pane = gtk_table_new (1,1,FALSE); gtk_container_set_border_width (GTK_CONTAINER (pane), 5); gtk_table_attach(GTK_TABLE(page), pane, 0,5, 0,1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); /* Parameters */ frame = gtk_frame_new ("Parameters"); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach(GTK_TABLE(pane), frame, 0,1, 0,1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); table = gtk_table_new (0, 0, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_container_add (GTK_CONTAINER (frame), table); label = gtk_label_new ("Horiz."); gtk_table_attach (GTK_TABLE(table), label, 1,3, 0,1, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); label = gtk_label_new ("Vert."); gtk_table_attach (GTK_TABLE(table), label, 3,5, 0,1, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); label = gtk_label_new ("Display:"); gtk_table_attach (GTK_TABLE(table), label, 0,1, 1,2, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); ph_mask_calc.hdisp = create_spin (table, 0.0, 2048.0, 1.0, 0, 1,3, 1); ph_mask_calc.vdisp = create_spin (table, 0.0, 2048.0, 1.0, 0, 3,5, 1); label = gtk_label_new ("Sync:"); gtk_table_attach (GTK_TABLE(table), label, 0,1, 2,3, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); ph_mask_calc.hsync = create_spin (table, 0.0, 2048.0, 1.0, 0, 1,3, 2); ph_mask_calc.vsync = GTK_LABEL ( create_framed_label (table, NULL, "-", 0, 3,4, 2)); label = gtk_label_new ("Total:"); gtk_table_attach (GTK_TABLE(table), label, 0,1, 3,4, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); ph_mask_calc.htotal = create_spin (table, 0.0, 2048.0, 1.0, 0, 1,3, 3); ph_mask_calc.vtotal = GTK_LABEL ( create_framed_label (table, NULL, "-", 0, 3,4, 3)); label = gtk_label_new ("OC:"); gtk_table_attach (GTK_TABLE(table), label, 0,1, 4,5, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); ph_mask_calc.hoc = create_spin (table, 0.0, 100.0, 0.1, 1, 1,3, 4); ph_mask_calc.voc = create_spin (table, 0.0, 100.0, 0.1, 1, 3,5, 4); label = gtk_label_new ("Offset:"); gtk_table_attach (GTK_TABLE(table), label, 0,1, 5,6, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); ph_mask_calc.hoffset = create_spin (table, -100.0, 100.0, 1.0, 0, 1,3, 5); ph_mask_calc.voffset = create_spin (table, -50.0, 50.0, 1.0, 0, 3,5, 5); label = gtk_label_new ("Flicker:"); gtk_table_attach (GTK_TABLE(table), label, 0,1, 6,7, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); ph_mask_calc.flicker = create_spin (table, 0.0, 100.0, 0.1, 1, 3,5, 6); label = gtk_label_new ("Upscale:"); gtk_table_attach (GTK_TABLE(table), label, 0,1, 7,8, GTK_FILL, GTK_FILL, 0, 0); /* Values */ label = gtk_label_new ("Size:"); gtk_table_attach (GTK_TABLE(table), label, 0,1, 10,11, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); ph_mask_calc.hsize = GTK_LABEL ( create_framed_label (table, NULL, "-", 0, 1,2, 10)); ph_mask_calc.vsize = GTK_LABEL ( create_framed_label (table, NULL, "-", 0, 3,4, 10)); gtk_table_set_col_spacings (GTK_TABLE(table), 5); gtk_table_set_row_spacings (GTK_TABLE(table), 5); gtk_table_set_row_spacing (GTK_TABLE(table), 0, 10); /* Adjust */ frame = gtk_frame_new ("Adjust"); gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_table_attach_defaults(GTK_TABLE(pane), frame, 1,2, 0,2); table = gtk_table_new (0, 0, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_container_add (GTK_CONTAINER (frame), table); label = gtk_label_new ("Offset"); gtk_table_attach (GTK_TABLE(table), label, 1,2, 0,1, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); label = gtk_label_new ("YINC:"); gtk_table_attach (GTK_TABLE(table), label, 0,1, 1,2, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); ph_mask_calc.yinc = create_spin (table, -4096.0, 4096.0, 1.0, 0, 1,2, 1); label = gtk_label_new ("YSKIP:"); gtk_table_attach (GTK_TABLE(table), label, 0,1, 2,3, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); ph_mask_calc.yskip = create_spin (table, -4096.0, 4096.0, 1.0, 0, 1,2, 2); label = gtk_label_new ("YOFSO:"); gtk_table_attach (GTK_TABLE(table), label, 0,1, 3,4, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); ph_mask_calc.yofso = create_spin (table, -4096.0, 4096.0, 1.0, 0, 1,2, 3); label = gtk_label_new ("YOFSE:"); gtk_table_attach (GTK_TABLE(table), label, 0,1, 4,5, GTK_FILL, GTK_FILL, 0, 0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); ph_mask_calc.yofse = create_spin (table, -4096.0, 4096.0, 1.0, 0, 1,2, 4); gtk_table_set_col_spacings (GTK_TABLE(table), 5); gtk_table_set_row_spacings (GTK_TABLE(table), 5); gtk_table_set_row_spacing (GTK_TABLE(table), 0, 10); /* Buttons */ button = gtk_button_new_with_label ("Calc"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (calc_ph_cb), &ph_mask_calc); gtk_table_attach(GTK_TABLE(page), button, 0,1, 1,2, GTK_FILL, GTK_FILL, 0, 0); button = gtk_button_new_with_label ("Print"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gui_print_cb), (gpointer) (PRINT_CHIP_REGS | PRINT_CRT_REGS)); gtk_table_attach(GTK_TABLE(page), button, 3,4,1,2, GTK_FILL, GTK_FILL, 0, 0); button = gtk_button_new_with_label ("Reset"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (calc_ph_reset_cb), &ph_mask_calc); gtk_widget_add_accelerator (GTK_WIDGET (button), "clicked", gui_ph_calc_accel_group, gui_accel[ACCEL_RESET].key, gui_accel[ACCEL_RESET].mods, GTK_ACCEL_VISIBLE); gtk_table_attach(GTK_TABLE(page), button, 4,5,1,2, GTK_FILL, GTK_FILL, 0, 0); return page; } void gui_ph_init (void) { update_ph = (GtkAdjustment *) gtk_adjustment_new (0, 0, 0, 0, 0, 0); gtk_signal_connect (GTK_OBJECT (update_chip), "changed", GTK_SIGNAL_FUNC (update_ph_cb), NULL); gtk_signal_connect (GTK_OBJECT (update_mode), "changed", GTK_SIGNAL_FUNC (calc_ph_reset_cb), &ph_mask_calc); gtk_signal_connect (GTK_OBJECT (changed_all), "changed", GTK_SIGNAL_FUNC (ph_freq_calc_cb), &gui_mask_ph_freq); } nvtv-0.4.7/src/gui_nx.c0000644000175000001440000002661707741555571010454 /* NVTV GUI (NX part) -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_nx.c,v 1.3 2003/10/10 16:16:57 dthierbach Exp $ * * Contents: * * The GTK graphical user interface. Nvidia internal NX encoder part. */ #include "local.h" /* before everything else */ #include #include "gui.h" #include "gui_nx.h" GtkAdjustment *update_nx; #define FIELD(b,m) addr:&(b.m), size:sizeof(b.m) #define FIELD_NX(m) FIELD(gui_regs.enc.nx,m) /* -------- GUI Masks -------- */ static GuiRegMask nx_mask1_reg [] = { {label:"scaler_h", bits:10, tick:1, FIELD_NX(img.scaler_h)}, {label:"scaler_v", bits:10, tick:1, FIELD_NX(img.scaler_v)}, {label:"overscan", bits:11, tick:1, FIELD_NX(img.overscan)}, {label:"vip1", bits:28, tick:1, FIELD_NX(img.vip1)}, {label:"vip2", bits:28, tick:1, FIELD_NX(img.vip2)}, {label:"muxa", bits:2, tick:1, FIELD_NX(muxa)}, {label:"muxb", bits:2, tick:1, FIELD_NX(muxb)}, {label:"muxc", bits:2, tick:1, FIELD_NX(muxc)}, {label:"filter", bits:2, tick:1, FIELD_NX(filter)}, {label:NULL} }; static GuiRegMask nx_mask2_reg [] = { {label:"reg04", bits:8, tick:1, FIELD_NX(ind.nxreg04)}, {label:"reg08", bits:8, tick:1, FIELD_NX(ind.nxreg08)}, {label:"reg09", bits:7, tick:1, FIELD_NX(ind.nxreg09)}, {label:"reg0a", bits:8, tick:1, FIELD_NX(ind.nxreg0a)}, {label:"reg0b", bits:8, tick:1, FIELD_NX(ind.nxreg0b)}, {label:"reg0c", bits:8, tick:1, FIELD_NX(ind.nxreg0c)}, {label:"reg0e", bits:10, tick:4, FIELD_NX(ind.nxreg0e)}, {label:"reg10", bits:10, tick:4, FIELD_NX(ind.nxreg10)}, {label:"reg17", bits:10, tick:4, FIELD_NX(ind.nxreg17)}, {label:"reg1e", bits:10, tick:4, FIELD_NX(ind.nxreg1e)}, {label:"reg20", bits:8, tick:1, FIELD_NX(ind.nxreg20)}, {label:"reg22", bits:8, tick:1, FIELD_NX(ind.nxreg22)}, {label:"reg29", bits:5, tick:1, FIELD_NX(ind.nxreg29)}, {label:"reg2c", bits:6, tick:1, FIELD_NX(ind.nxreg2c)}, {label:"reg31", bits:11, tick:8, FIELD_NX(ind.nxreg31)}, {label:"reg35", bits:8, tick:1, FIELD_NX(ind.nxreg35)}, {label:"reg3c", bits:10, tick:4, FIELD_NX(ind.nxreg3c)}, {label:"sys12", bits:2, tick:1, FIELD_NX(ind.nxsys12)}, {label:NULL} }; static GuiRegMask nx_mask1_twin [] = { {label:"fsub:", bits:32, tick:1, FIELD_NX(ind.fsub)}, {label:NULL} }; static GuiFlagMask nx_mask1_flag [] = { {label:"daca", mask:NX_FLAG1_DACA, FIELD_NX(flags1)}, {label:"dacb", mask:NX_FLAG1_DACB, FIELD_NX(flags1)}, {label:"dacc", mask:NX_FLAG1_DACC, FIELD_NX(flags1)}, {label:NULL } }; static GuiFlagMask nx_mask2_flag [] = { {label:"sys-0", mask:NX_FLAG_SYS_0, FIELD_NX(ind.flags)}, {label:"sys-3", mask:NX_FLAG_SYS_3, FIELD_NX(ind.flags)}, {label:"sys-6", mask:NX_FLAG_SYS_6, FIELD_NX(ind.flags)}, {label:"conn-3", mask:NX_FLAG_CONN_3, FIELD_NX(ind.flags)}, {label:"conn-5", mask:NX_FLAG_CONN_5, FIELD_NX(ind.flags)}, {label:NULL } }; static GuiRegMask nx_mask1_filt [] = { {label:"1", bits:-10, tick:1, FIELD_NX(filt_x1[0][0])}, {label:"2", bits:-10, tick:1, FIELD_NX(filt_x1[0][1])}, {label:"3", bits:-10, tick:1, FIELD_NX(filt_x1[0][2])}, {label:"4", bits:-10, tick:1, FIELD_NX(filt_x1[0][3])}, {label:"5", bits:-10, tick:1, FIELD_NX(filt_x1[0][4])}, {label:"6", bits:-10, tick:1, FIELD_NX(filt_x1[0][5])}, {label:"7", bits:-10, tick:1, FIELD_NX(filt_x1[0][6])}, {label:"1", bits:-10, tick:1, FIELD_NX(filt_x1[1][0])}, {label:"2", bits:-10, tick:1, FIELD_NX(filt_x1[1][1])}, {label:"3", bits:-10, tick:1, FIELD_NX(filt_x1[1][2])}, {label:"4", bits:-10, tick:1, FIELD_NX(filt_x1[1][3])}, {label:"5", bits:-10, tick:1, FIELD_NX(filt_x1[1][4])}, {label:"6", bits:-10, tick:1, FIELD_NX(filt_x1[1][5])}, {label:"7", bits:-10, tick:1, FIELD_NX(filt_x1[1][6])}, {label:"1", bits:-10, tick:1, FIELD_NX(filt_x1[2][0])}, {label:"2", bits:-10, tick:1, FIELD_NX(filt_x1[2][1])}, {label:"3", bits:-10, tick:1, FIELD_NX(filt_x1[2][2])}, {label:"4", bits:-10, tick:1, FIELD_NX(filt_x1[2][3])}, {label:"5", bits:-10, tick:1, FIELD_NX(filt_x1[2][4])}, {label:"6", bits:-10, tick:1, FIELD_NX(filt_x1[2][5])}, {label:"7", bits:-10, tick:1, FIELD_NX(filt_x1[2][6])}, {label:"1", bits:-10, tick:1, FIELD_NX(filt_x1[3][0])}, {label:"2", bits:-10, tick:1, FIELD_NX(filt_x1[3][1])}, {label:"3", bits:-10, tick:1, FIELD_NX(filt_x1[3][2])}, {label:"4", bits:-10, tick:1, FIELD_NX(filt_x1[3][3])}, {label:"5", bits:-10, tick:1, FIELD_NX(filt_x1[3][4])}, {label:"6", bits:-10, tick:1, FIELD_NX(filt_x1[3][5])}, {label:"7", bits:-10, tick:1, FIELD_NX(filt_x1[3][6])}, {label:NULL} }; static GuiRegMask nx_mask2_filt [] = { {label:"1", bits:-10, tick:1, FIELD_NX(filt_x2[0][0])}, {label:"2", bits:-10, tick:1, FIELD_NX(filt_x2[0][1])}, {label:"3", bits:-10, tick:1, FIELD_NX(filt_x2[0][2])}, {label:"4", bits:-10, tick:1, FIELD_NX(filt_x2[0][3])}, {label:"5", bits:-10, tick:1, FIELD_NX(filt_x2[0][4])}, {label:"6", bits:-10, tick:1, FIELD_NX(filt_x2[0][5])}, {label:"7", bits:-10, tick:1, FIELD_NX(filt_x2[0][6])}, {label:"1", bits:-10, tick:1, FIELD_NX(filt_x2[1][0])}, {label:"2", bits:-10, tick:1, FIELD_NX(filt_x2[1][1])}, {label:"3", bits:-10, tick:1, FIELD_NX(filt_x2[1][2])}, {label:"4", bits:-10, tick:1, FIELD_NX(filt_x2[1][3])}, {label:"5", bits:-10, tick:1, FIELD_NX(filt_x2[1][4])}, {label:"6", bits:-10, tick:1, FIELD_NX(filt_x2[1][5])}, {label:"7", bits:-10, tick:1, FIELD_NX(filt_x2[1][6])}, {label:"1", bits:-10, tick:1, FIELD_NX(filt_x2[2][0])}, {label:"2", bits:-10, tick:1, FIELD_NX(filt_x2[2][1])}, {label:"3", bits:-10, tick:1, FIELD_NX(filt_x2[2][2])}, {label:"4", bits:-10, tick:1, FIELD_NX(filt_x2[2][3])}, {label:"5", bits:-10, tick:1, FIELD_NX(filt_x2[2][4])}, {label:"6", bits:-10, tick:1, FIELD_NX(filt_x2[2][5])}, {label:"7", bits:-10, tick:1, FIELD_NX(filt_x2[2][6])}, {label:"1", bits:-10, tick:1, FIELD_NX(filt_x2[3][0])}, {label:"2", bits:-10, tick:1, FIELD_NX(filt_x2[3][1])}, {label:"3", bits:-10, tick:1, FIELD_NX(filt_x2[3][2])}, {label:"4", bits:-10, tick:1, FIELD_NX(filt_x2[3][3])}, {label:"5", bits:-10, tick:1, FIELD_NX(filt_x2[3][4])}, {label:"6", bits:-10, tick:1, FIELD_NX(filt_x2[3][5])}, {label:"7", bits:-10, tick:1, FIELD_NX(filt_x2[3][6])}, {label:NULL} }; static GuiRegMask nx_mask3_filt [] = { {label:"1", bits:-10, tick:1, FIELD_NX(filt_y[0][0])}, {label:"2", bits:-10, tick:1, FIELD_NX(filt_y[0][1])}, {label:"3", bits:-10, tick:1, FIELD_NX(filt_y[0][2])}, {label:"4", bits:-10, tick:1, FIELD_NX(filt_y[0][3])}, {label:"5", bits:-10, tick:1, FIELD_NX(filt_y[0][4])}, {label:"6", bits:-10, tick:1, FIELD_NX(filt_y[0][5])}, {label:"7", bits:-10, tick:1, FIELD_NX(filt_y[0][6])}, {label:"1", bits:-10, tick:1, FIELD_NX(filt_y[1][0])}, {label:"2", bits:-10, tick:1, FIELD_NX(filt_y[1][1])}, {label:"3", bits:-10, tick:1, FIELD_NX(filt_y[1][2])}, {label:"4", bits:-10, tick:1, FIELD_NX(filt_y[1][3])}, {label:"5", bits:-10, tick:1, FIELD_NX(filt_y[1][4])}, {label:"6", bits:-10, tick:1, FIELD_NX(filt_y[1][5])}, {label:"7", bits:-10, tick:1, FIELD_NX(filt_y[1][6])}, {label:"1", bits:-10, tick:1, FIELD_NX(filt_y[2][0])}, {label:"2", bits:-10, tick:1, FIELD_NX(filt_y[2][1])}, {label:"3", bits:-10, tick:1, FIELD_NX(filt_y[2][2])}, {label:"4", bits:-10, tick:1, FIELD_NX(filt_y[2][3])}, {label:"5", bits:-10, tick:1, FIELD_NX(filt_y[2][4])}, {label:"6", bits:-10, tick:1, FIELD_NX(filt_y[2][5])}, {label:"7", bits:-10, tick:1, FIELD_NX(filt_y[2][6])}, {label:"1", bits:-10, tick:1, FIELD_NX(filt_y[3][0])}, {label:"2", bits:-10, tick:1, FIELD_NX(filt_y[3][1])}, {label:"3", bits:-10, tick:1, FIELD_NX(filt_y[3][2])}, {label:"4", bits:-10, tick:1, FIELD_NX(filt_y[3][3])}, {label:"5", bits:-10, tick:1, FIELD_NX(filt_y[3][4])}, {label:"6", bits:-10, tick:1, FIELD_NX(filt_y[3][5])}, {label:"7", bits:-10, tick:1, FIELD_NX(filt_y[3][6])}, {label:NULL} }; /* -------- -------- */ void reset_nx_cb (GtkObject *obj, gpointer data) { if ((gui_tv_chip & TV_ENCODER) != TV_NVIDIA) return; if (gui_act_mode) { gui_regs.enc.bt = gui_act_mode->regs.enc.bt; gui_tv_set (); gtk_signal_emit_by_name (GTK_OBJECT (update_nx), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (changed_all), "changed"); } } void update_nx_cb (GtkObject *obj, gpointer data) { if ((gui_tv_chip & TV_ENCODER) != TV_NVIDIA) return; gtk_signal_emit_by_name (GTK_OBJECT (update_nx), "changed"); } void gui_map_nx_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "gui_map_nx_cb"); } void gui_unmap_nx_cb (GtkWidget *widget, gpointer data) { RAISE (MSG_DEBUG, "gui_unmap_nx_cb"); } /* -------- GUI Pages -------- */ GtkWidget *gui_nx_reg1_page (void) { GtkAccelGroup *gui_nx_reg_accel_group; gui_nx_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("NVidia internal encoder registers 1", gui_nx_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_nx), GTK_SIGNAL_FUNC (reset_nx_cb), 0, 0, 5, nx_mask1_reg, 0, 6, nx_mask1_twin, 0, 7, 3, nx_mask1_flag); } GtkWidget *gui_nx_reg2_page (void) { GtkAccelGroup *gui_nx_reg_accel_group; gui_nx_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("NVidia internal encoder registers 2", gui_nx_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_nx), GTK_SIGNAL_FUNC (reset_nx_cb), 0, 0, 11, nx_mask2_reg, 0, 11, NULL, 6, 0, 11, nx_mask2_flag); } GtkWidget *gui_nx_filt1_page (void) { GtkAccelGroup *gui_nx_reg_accel_group; gui_nx_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("NVidia internal encoder filter x1", gui_nx_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_nx), GTK_SIGNAL_FUNC (reset_nx_cb), 0, 0, 7, nx_mask1_filt, 0, 11, NULL, 0, 0, 0, NULL); } GtkWidget *gui_nx_filt2_page (void) { GtkAccelGroup *gui_nx_reg_accel_group; gui_nx_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("NVidia internal encoder filter x2", gui_nx_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_nx), GTK_SIGNAL_FUNC (reset_nx_cb), 0, 0, 7, nx_mask2_filt, 0, 11, NULL, 0, 0, 0, NULL); } GtkWidget *gui_nx_filt3_page (void) { GtkAccelGroup *gui_nx_reg_accel_group; gui_nx_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("NVidia internal encoder filter y", gui_nx_reg_accel_group, PRINT_CHIP_REGS, GTK_OBJECT (update_nx), GTK_SIGNAL_FUNC (reset_nx_cb), 0, 0, 7, nx_mask3_filt, 0, 11, NULL, 0, 0, 0, NULL); } void gui_nx_init (void) { update_nx = (GtkAdjustment *) gtk_adjustment_new (0, 0, 0, 0, 0, 0); gtk_signal_connect (GTK_OBJECT (update_chip), "changed", GTK_SIGNAL_FUNC (update_nx_cb), NULL); } nvtv-0.4.7/src/gui_nv.c0000644000175000001440000001102607620035054010417 /* NVTV GUI (CRTC NV part) -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_nv.c,v 1.6 2003/02/04 22:09:48 dthierbach Exp $ * * Contents: * * The GTK graphical user interface. CRTC NV part. */ #include "local.h" /* before everything else */ #include #include "gui.h" #include "gui_nv.h" #include "backend.h" #define FIELD(b,m) addr:&(b.m), size:sizeof(b.m) #define FIELD_CRT(m) FIELD(gui_regs.crtc.nv,m) #define FIELD_FP(m) FIELD(gui_regs.crtc.nv.fp,m) static GuiRegMask nv_mask_reg [] = { {label:"HDisplay:", bits:12, tick:8, FIELD_CRT(HDisplay)}, {label:"HSyncStart:", bits:12, tick:8, FIELD_CRT(HSyncStart)}, {label:"HSyncEnd:", bits:12, tick:8, FIELD_CRT(HSyncEnd)}, {label:"HTotal:", bits:12, tick:8, FIELD_CRT(HTotal)}, {label:"VDisplay:", bits:12, tick:1, FIELD_CRT(VDisplay)}, {label:"VSyncStart:", bits:12, tick:1, FIELD_CRT(VSyncStart)}, {label:"VSyncEnd:", bits:12, tick:1, FIELD_CRT(VSyncEnd)}, {label:"VTotal:", bits:12, tick:1, FIELD_CRT(VTotal)}, {label:"Latency:", bits:3, tick:1, FIELD_CRT(latency)}, {label:"DotClock:", bits:20, tick:1, FIELD_CRT(clock)}, {label:"*HSyncStart:", bits:12, tick:1, FIELD_CRT(slave.HSyncStart)}, {label:"*HSyncEnd:", bits:12, tick:1, FIELD_CRT(slave.HSyncEnd)}, {label:"*HTotal:", bits:12, tick:1, FIELD_CRT(slave.HTotal)}, {label:"*VSyncStart:", bits:12, tick:1, FIELD_CRT(slave.VSyncStart)}, {label:"*VSyncEnd:", bits:12, tick:1, FIELD_CRT(slave.VSyncEnd)}, {label:"*VTotal:", bits:12, tick:1, FIELD_CRT(slave.VTotal)}, {label:"*Unknown:", bits:12, tick:1, FIELD_CRT(slave.Unknown)}, {label:NULL } }; static GuiFlagMask nv_mask_flag [] = { {label:"DblScan", mask:NV_FLAG_DOUBLE_SCAN, FIELD_CRT(flags)}, {label:"DblPix", mask:NV_FLAG_DOUBLE_PIX, FIELD_CRT(flags)}, {label:NULL } }; static GuiRegMask nv_fp_mask_reg [] = { {label:"HDisplay:", bits:11, tick:1, FIELD_FP(HDisplay)}, {label:"HSyncStart:", bits:11, tick:1, FIELD_FP(HSyncStart)}, {label:"HSyncEnd:", bits:11, tick:1, FIELD_FP(HSyncEnd)}, {label:"HTotal:", bits:11, tick:1, FIELD_FP(HTotal)}, {label:"HValidStart:", bits:11, tick:1, FIELD_FP(HValidStart)}, {label:"HValidEnd:", bits:11, tick:1, FIELD_FP(HValidEnd)}, {label:"HCrtc:", bits:11, tick:1, FIELD_FP(HCrtc)}, {label:"VDisplay:", bits:11, tick:1, FIELD_FP(VDisplay)}, {label:"VSyncStart:", bits:11, tick:1, FIELD_FP(VSyncStart)}, {label:"VSyncEnd:", bits:11, tick:1, FIELD_FP(VSyncEnd)}, {label:"VTotal:", bits:11, tick:1, FIELD_FP(VTotal)}, {label:"VValidStart:", bits:11, tick:1, FIELD_FP(VValidStart)}, {label:"VValidEnd:", bits:11, tick:1, FIELD_FP(VValidEnd)}, {label:"VCrtc:", bits:11, tick:1, FIELD_FP(VCrtc)}, {label:NULL } }; GtkWidget *gui_nv_page (void) { GtkAccelGroup *gui_nv_reg_accel_group; gui_nv_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("NV CRTC Register Values", gui_nv_reg_accel_group, PRINT_CRT_REGS, GTK_OBJECT (update_crt), GTK_SIGNAL_FUNC (gui_reset_crt_cb), 0, 0, 10, nv_mask_reg, 0, 0, NULL, 3, 7, 3, nv_mask_flag); #if 0 /* FIXME */ button = gtk_button_new_with_label ("Check"); gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); /* check if registers are "sane", correct if necessary */ gtk_table_attach(GTK_TABLE(page), button, 2,3,1,2, GTK_FILL, GTK_FILL, 0, 0); #endif } GtkWidget *gui_nv_fp_page (void) { GtkAccelGroup *gui_nv_fp_accel_group; gui_nv_fp_accel_group = gtk_accel_group_new (); return gui_regs_page ("NV Flatpanel Register Values", gui_nv_fp_accel_group, PRINT_FP_REGS, GTK_OBJECT (update_crt), GTK_SIGNAL_FUNC (gui_reset_crt_cb), 0, 0, 7, nv_fp_mask_reg, 0, 0, NULL, 0, 0, 0, NULL); } nvtv-0.4.7/src/gui_tdfx.c0000644000175000001440000000656507620035054010755 /* NVTV GUI (CRTC 3dfx part) -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_tdfx.c,v 1.5 2003/02/04 22:09:48 dthierbach Exp $ * * Contents: * * The GTK graphical user interface. CRTC 3dfx part. */ #include "local.h" /* after xfree, before everything else */ #include #include "gui.h" #include "gui_tdfx.h" #include "backend.h" #define FIELD(b,m) addr:&(b.m), size:sizeof(b.m) #define FIELD_CRT(m) FIELD(gui_regs.crtc.tdfx,m) static GuiRegMask tdfx_mask_reg [] = { {label:"HScreenSize:", bits:12, tick:1, FIELD_CRT(HScreenSize)}, {label:"VScreenSize:", bits:12, tick:1, FIELD_CRT(VScreenSize)}, {label:"HDisplay:", bits:12, tick:8, FIELD_CRT(HDisplay)}, {label:"HSyncStart:", bits:12, tick:8, FIELD_CRT(HSyncStart)}, {label:"HSyncEnd:", bits:12, tick:8, FIELD_CRT(HSyncEnd)}, {label:"HTotal:", bits:12, tick:8, FIELD_CRT(HTotal)}, {label:"VDisplay:", bits:12, tick:1, FIELD_CRT(VDisplay)}, {label:"VSyncStart:", bits:12, tick:1, FIELD_CRT(VSyncStart)}, {label:"VSyncEnd:", bits:12, tick:1, FIELD_CRT(VSyncEnd)}, {label:"VTotal:", bits:12, tick:1, FIELD_CRT(VTotal)}, {label:"DotClock:", bits:20, tick:1, FIELD_CRT(clock)}, {label:"*HBlankStart:", bits:11, tick:1, FIELD_CRT(tvHBlankStart)}, {label:"*HBlankEnd:", bits:11, tick:1, FIELD_CRT(tvHBlankEnd)}, {label:"*VBlankStart:", bits:11, tick:1, FIELD_CRT(tvVBlankStart)}, {label:"*VBlankEnd:", bits:11, tick:1, FIELD_CRT(tvVBlankEnd)}, {label:"*BlankDelay:", bits:3, tick:1, FIELD_CRT(tvBlankDelay)}, {label:"*SyncDelay:", bits:3, tick:1, FIELD_CRT(tvSyncDelay)}, {label:"*Latency:", bits:4, tick:1, FIELD_CRT(tvLatency)}, {label:NULL } }; static GuiFlagMask tdfx_mask_flag [] = { {label:"Clock2x", mask:TDFX_FLAG_CLOCK2X, FIELD_CRT(flags)}, {label:"DoublePix", mask:TDFX_FLAG_DOUBLE_PIX, FIELD_CRT(flags)}, {label:"HalfMode", mask:TDFX_FLAG_HALF_MODE, FIELD_CRT(flags)}, {label:NULL } }; GtkWidget *gui_tdfx_page (void) { GtkAccelGroup *gui_tdfx_reg_accel_group; gui_tdfx_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("CRTC 3dfx Register Values", gui_tdfx_reg_accel_group, PRINT_CRT_REGS, GTK_OBJECT (update_crt), GTK_SIGNAL_FUNC (gui_reset_crt_cb), 0, 0, 11, tdfx_mask_reg, 0, 11, NULL, 3, 7, 11, tdfx_mask_flag); #if 0 /* FIXME */ button = gtk_button_new_with_label ("Check"); gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); /* check if registers are "sane", correct if necessary */ gtk_table_attach(GTK_TABLE(page), button, 2,3,1,2, GTK_FILL, GTK_FILL, 0, 0); #endif } nvtv-0.4.7/src/gui_i810.c0000644000175000001440000000525107620035054010460 /* NVTV GUI (CRTC I810 part) -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_i810.c,v 1.4 2003/02/04 22:09:48 dthierbach Exp $ * * Contents: * * The GTK graphical user interface. CRTC I810 part. */ #include "local.h" /* before everything else */ #include #include "gui.h" #include "gui_i810.h" #include "backend.h" #define FIELD(b,m) addr:&(b.m), size:sizeof(b.m) #define FIELD_CRT(m) FIELD(gui_regs.crtc.i810,m) static GuiRegMask i810_mask_reg [] = { {label:"*HDisplay:", bits:11, tick:1, FIELD_CRT(tvHDisplay)}, {label:"*HSyncStart:", bits:12, tick:1, FIELD_CRT(tvHSyncStart)}, {label:"*HSyncEnd:", bits:12, tick:1, FIELD_CRT(tvHSyncEnd)}, {label:"*HTotal:", bits:12, tick:1, FIELD_CRT(tvHTotal)}, {label:"*VDisplay:", bits:11, tick:1, FIELD_CRT(tvVDisplay)}, {label:"*VSyncStart:", bits:12, tick:1, FIELD_CRT(tvVSyncStart)}, {label:"*VSyncEnd:", bits:12, tick:1, FIELD_CRT(tvVSyncEnd)}, {label:"*VTotal:", bits:12, tick:1, FIELD_CRT(tvVTotal)}, {label:"borderRed:", bits:8, tick:1, FIELD_CRT(borderRed)}, {label:"borderGreen:", bits:8, tick:1, FIELD_CRT(borderGreen)}, {label:"borderBlue:", bits:8, tick:1, FIELD_CRT(borderBlue)}, {label:NULL } }; static GuiFlagMask i810_mask_flag [] = { {label:NULL } }; GtkWidget *gui_i810_page (void) { GtkAccelGroup *gui_i810_reg_accel_group; gui_i810_reg_accel_group = gtk_accel_group_new (); return gui_regs_page ("CRTC I810 Register Values", gui_i810_reg_accel_group, PRINT_CRT_REGS, GTK_OBJECT (update_crt), GTK_SIGNAL_FUNC (gui_reset_crt_cb), 0, 0, 8, i810_mask_reg, 0, 11, NULL, 6, 0, 11, i810_mask_flag); #if 0 /* FIXME */ button = gtk_button_new_with_label ("Check"); gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); /* check if registers are "sane", correct if necessary */ gtk_table_attach(GTK_TABLE(page), button, 2,3,1,2, GTK_FILL, GTK_FILL, 0, 0); #endif } nvtv-0.4.7/src/nvtvd.c0000644000175000001440000004053210020723072010265 /* NVTV server -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: nvtvd.c,v 1.4 2004/03/01 21:08:10 dthierbach Exp $ * * Contents: * * Server main program * */ #include "local.h" /* before everything else */ #include #include #include #include #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #include "pipe.h" #include "backend.h" #include "back_unix.h" #include "back_null.h" /* -------- Options -------- */ BackAccessPtr back_access = NULL; /* global backend */ BackCardPtr back_card = NULL; Bool opt_null = FALSE; Bool opt_nvdev = FALSE; Bool opt_debug = FALSE; Bool opt_quiet = FALSE; static const char *short_options = "?hnNdq"; static struct option long_options[] = {{"help", no_argument, NULL, 'h'}, {"null", no_argument, NULL, 'n'}, {"nvdev", no_argument, NULL, 'N'}, {"debug", no_argument, NULL, 'd'}, {"quiet", no_argument, NULL, 'q'}, {NULL, 0, NULL, 0} }; char *prog; /* Program name for error messages */ /* -------- Usage -------- */ void usage (void) { fprintf (stderr, "usage: nvtvd [-options ...]\n\n"); fprintf (stderr, "where options include:\n"); fprintf (stderr, " -h --help print this message\n"); fprintf (stderr, " -N --nvdev enable usage of /dev/nv* devices\n"); fprintf (stderr, " -n --null use null backend (for debugging)\n"); fprintf (stderr, " -d --debug don't detach from controlling terminal\n"); fprintf (stderr, " -q --quiet no logging\n"); } /* -------- Error handling -------- */ void raise_msg (int class, char *format, ...) { static char buf[1024]; static int pos = 0; int delta; va_list args; if (!opt_quiet) { va_start(args, format); delta = vsnprintf(buf + pos, sizeof(buf) - pos, format, args); va_end(args); if (delta == -1 || pos + delta > sizeof(buf) - 1) { pos = sizeof(buf); } else { pos += delta; } if (class == MSG_DEBUG_NL) return; pos = 0; if (opt_debug) { switch (class) { case MSG_ABORT: fprintf (stderr, "Fatal: "); break; case MSG_WARNING: fprintf (stderr, "Warning: "); break; } fprintf (stderr, "%s\n", buf); } else { switch (class) { case MSG_ABORT: syslog (LOG_CRIT, "%.500s", buf); break; case MSG_WARNING: syslog (LOG_WARNING, "%.500s", buf); break; case MSG_INFO: syslog (LOG_INFO, "%.500s", buf); break; case MSG_DEBUG: syslog (LOG_DEBUG, "%.500s", buf); break; default: case MSG_ERROR: syslog (LOG_ERR, "%.500s", buf); break; } } } if (class == MSG_ABORT) exit (1); /* FIXME */ } /* -------- Server state -------- */ static CardPtr srv_root = NULL; static CardPtr srv_card = NULL; static FILE *pipe_in = NULL; static FILE *pipe_out = NULL; /* -------- Server command routines -------- */ void srv_openCard (void) { CardPtr card; int i, index; RAISE (MSG_DEBUG, "srv_open"); index = 0; pipeReadArgs (pipe_in, 1, sizeof(index), &index); /* convert index to card */ card = srv_root; for (i = 1; i < index; i++) { if (card) card = card->next; } if (index == 0) card = NULL; srv_card = card; back_access->openCard (srv_card); pipeWriteCmd (pipe_out, PCmd_OpenCard); if (srv_card) { pipeWriteList (pipe_out, sizeof (ChipInfo), srv_card->chips); } else { pipeWriteArgs (pipe_out, 0); } } void srv_closeCard (void) { RAISE (MSG_DEBUG, "srv_close"); pipeReadArgs (pipe_in, 0); if (srv_card) { back_access->closeCard (); } srv_card = NULL; } void srv_setHeads (void) { int monitor, tv, video; RAISE (MSG_DEBUG, "srv_setHeads"); pipeReadArgs (pipe_in, 3, sizeof(int), &monitor, sizeof(int), &tv, sizeof(int), &video); RAISE (MSG_DEBUG, "srv_setHeads %i %i %i", monitor, tv, video); back_card->setHeads (monitor, tv, video); } void srv_getHeads (void) { int tv, monitor, video, max; RAISE (MSG_DEBUG, "srv_getHeads"); pipeReadArgs (pipe_in, 0); back_card->getHeads (&monitor, &tv, &video, &max); RAISE (MSG_DEBUG, "srv_getHeads %i %i %i %i", monitor, tv, video, max); pipeWriteCmd (pipe_out, PCmd_GetHeads); pipeWriteArgs (pipe_out, 4, sizeof(int), &monitor, sizeof(int), &tv, sizeof(int), &video, sizeof(int), &max); } void srv_getHeadDev (void) { int head, devFlags; RAISE (MSG_DEBUG, "srv_getHeadDev"); pipeReadArgs (pipe_in, 1, sizeof(int), &head); back_card->getHeadDev (head, &devFlags); RAISE (MSG_DEBUG, "srv_getHeadDev %i %i", head, devFlags); pipeWriteCmd (pipe_out, PCmd_GetHeadDev); pipeWriteArgs (pipe_out, 1, sizeof(int), &devFlags); } void srv_probeChips (void) { RAISE (MSG_DEBUG, "srv_probe"); pipeReadArgs (pipe_in, 0); back_card->probeChips (); pipeWriteCmd (pipe_out, PCmd_ProbeChips); pipeWriteList (pipe_out, sizeof (ChipInfo), srv_card->chips); } void srv_setChip (void) { ChipPtr chip; Bool init; int i, index; RAISE (MSG_DEBUG, "srv_setChip"); index = 0; init = 1; pipeReadArgs (pipe_in, 2, sizeof(index), &index, sizeof(init), &init); /* convert index to chip */ chip = srv_card->chips; for (i = 1; i < index; i++) { if (chip) chip = chip->next; } if (index == 0) chip = NULL; back_card->setChip (chip, init); } void srv_setSettings (void) { TVSettings set, *pset; RAISE (MSG_DEBUG, "srv_setSettings"); pipeReadArgsOpt (pipe_in, 1, sizeof(TVSettings), &set, &pset); back_card->setSettings (pset); } void srv_getSettings (void) { TVSettings set; RAISE (MSG_DEBUG, "srv_getSettings"); pipeReadArgs (pipe_in, 0); back_card->getSettings (&set); pipeWriteCmd (pipe_out, PCmd_GetSettings); pipeWriteArgs (pipe_out, 1, sizeof(TVSettings), &set); } void srv_setMode (void) { TVRegs regs, *pregs; RAISE (MSG_DEBUG, "srv_setMode"); pipeReadArgsOpt (pipe_in, 1, sizeof(TVRegs), ®s, &pregs); back_card->setMode (pregs); } void srv_getMode (void) { TVRegs regs; RAISE (MSG_DEBUG, "srv_getMode"); pipeReadArgs (pipe_in, 0); back_card->getMode (®s); pipeWriteCmd (pipe_out, PCmd_GetMode); pipeWriteArgs (pipe_out, 1, sizeof(TVRegs), ®s); } void srv_setModeSettings (void) { TVRegs regs, *pregs; TVSettings set, *pset; RAISE (MSG_DEBUG, "srv_setModeSettings"); pipeReadArgsOpt (pipe_in, 2, sizeof(TVRegs), ®s, &pregs, sizeof(TVSettings), &set, &pset); back_card->setModeSettings (pregs, pset); } void srv_setTestImage (void) { TVEncoderRegs tv, *ptv; TVSettings set, *pset; RAISE (MSG_DEBUG, "srv_setTestImage"); pipeReadArgsOpt (pipe_in, 2, sizeof(TVEncoderRegs), &tv, &ptv, sizeof(TVSettings), &set, &pset); back_card->setTestImage (ptv, pset); } void srv_getStatus (void) { int index; long l; RAISE (MSG_DEBUG, "srv_getStatus"); index = 0; pipeReadArgs (pipe_in, 1, sizeof(index), &index); pipeWriteCmd (pipe_out, PCmd_GetStatus); l = back_card->getStatus (index); pipeWriteArgs (pipe_out, 1, sizeof(l), &l); } void srv_getConnection (void) { TVConnect c; RAISE (MSG_DEBUG, "srv_getConnection"); pipeReadArgs (pipe_in, 0); pipeWriteCmd (pipe_out, PCmd_GetConnection); c = back_card->getConnection (); pipeWriteArgs (pipe_out, 1, sizeof(c), &c); } void srv_listModes (void) { TVSystem system; TVMode *m, *modes; int c; RAISE (MSG_DEBUG, "srv_findBySize"); pipeReadArgs (pipe_in, 1, sizeof(system), &system); pipeWriteCmd (pipe_out, PCmd_ListModes); c = back_card->listModes (system, &modes); pipeWriteArray (pipe_out, c, 3); for (m = modes; c > 0; m++, c--) { pipeWriteArgs (pipe_out, 3, sizeof(TVMode), m, strlen (m->spec.size)+1, m->spec.size, strlen (m->spec.aspect)+1, m->spec.aspect); } } void srv_findBySize (void) { TVSystem system; int xres, yres; char *size; TVMode mode; RAISE (MSG_DEBUG, "srv_findBySize"); pipeReadArgs (pipe_in, 4, sizeof(system), &system, sizeof(xres), &xres, sizeof(yres), &yres, 0, &size); pipeWriteCmd (pipe_out, PCmd_FindBySize); if (back_card->findBySize (system, xres, yres, size, &mode)) { pipeWriteArgs (pipe_out, 3, sizeof(TVMode), &mode, strlen (mode.spec.size)+1, mode.spec.size, strlen (mode.spec.aspect)+1, mode.spec.aspect); } else { pipeWriteArgs (pipe_out, 0); } } void srv_findByOverscan (void) { TVSystem system; int xres, yres; double hoc, voc; TVMode mode; RAISE (MSG_DEBUG, "srv_findByOC"); pipeReadArgs (pipe_in, 5, sizeof(system), &system, sizeof(xres), &xres, sizeof(yres), &yres, sizeof(hoc), &hoc, sizeof(voc), &voc); pipeWriteCmd (pipe_out, PCmd_FindByOverscan); if (back_card->findByOverscan (system, xres, yres, hoc, voc, &mode)) { pipeWriteArgs (pipe_out, 3, sizeof(TVMode), &mode, strlen (mode.spec.size)+1, mode.spec.size, strlen (mode.spec.aspect)+1, mode.spec.aspect); } else { pipeWriteArgs (pipe_out, 0); } } void srv_initSharedView (void) { int view_x, view_y; RAISE (MSG_DEBUG, "srv_initSharedView"); pipeReadArgs (pipe_in, 0); back_card->initSharedView (&view_x, &view_y); pipeWriteCmd (pipe_out, PCmd_InitSharedView); pipeWriteArgs (pipe_out, 2, sizeof(int), &view_x, sizeof(int), &view_y); } void srv_getTwinView (void) { int view_x, view_y; Bool result; RAISE (MSG_DEBUG, "srv_getTwinView"); pipeReadArgs (pipe_in, 0); result = back_card->getTwinView (&view_x, &view_y); pipeWriteCmd (pipe_out, PCmd_GetTwinView); pipeWriteArgs (pipe_out, 3, sizeof(Bool), &result, sizeof(int), &view_x, sizeof(int), &view_y); } void srv_adjustViewport (void) { int flags; int view_x, view_y; Bool result; RAISE (MSG_DEBUG, "srv_adjustViewport"); pipeReadArgs (pipe_in, 3, sizeof(int), &flags, sizeof(int), &view_x, sizeof(int), &view_y); result = back_card->adjustViewport (flags, &view_x, &view_y); pipeWriteCmd (pipe_out, PCmd_AdjustView); pipeWriteArgs (pipe_in, 3, sizeof(int), &result, sizeof(int), &view_x, sizeof(int), &view_y); } void srv_serviceViewportCursor (void) { int flags; int cursor_x, cursor_y; int view_x, view_y; Bool result; RAISE (MSG_DEBUG, "srv_serviceViewportCursor"); pipeReadArgs (pipe_in, 5, sizeof(int), &flags, sizeof(int), &cursor_x, sizeof(int), &cursor_y, sizeof(int), &view_x, sizeof(int), &view_y); result = back_card->serviceViewportCursor (flags, cursor_x, cursor_y, &view_x, &view_y); pipeWriteCmd (pipe_out, PCmd_ServiceVC); pipeWriteArgs (pipe_in, 3, sizeof(int), &result, sizeof(int), &view_x, sizeof(int), &view_y); } /* -------- -------- */ void srv_version (void) { int version = PIPE_VERSION; pipeReadArgs (pipe_in, 0); pipeWriteCmd (pipe_out, PCmd_Version); pipeWriteArgs (pipe_out, 1, sizeof(version), &version); } void srv_init (void) { RAISE (MSG_INFO, "init by client"); pipeReadArgs (pipe_in, 0); if (srv_card) { back_card->closeCard (); } srv_card = NULL; pipeWriteCmd (pipe_in, PCmd_Init); pipeWriteList (pipe_out, sizeof (CardInfo), srv_root); } void srv_kill (void) { pipeReadArgs (pipe_in, 0); sleep (1); /* FIXME */ } void srv_openPipes (void) { /* IMPORTANT: PIPE_OUT is open first for reading (and thus is pipe_in for the server). The open blocks until someone is writing to the pipe. */ if (!pipe_in) { RAISE (MSG_DEBUG, "open in pipe"); pipe_in = fopen (PIPE_OUT, "r"); } if (!pipe_in) { unlink (PIPE_OUT); unlink (PIPE_IN); RAISE (MSG_ABORT, "Cannot open pipe %s", prog, PIPE_OUT); } RAISE (MSG_DEBUG, "in pipe opened"); /* Now open the other pipe for writing. */ if (!pipe_out) { RAISE (MSG_DEBUG, "open out pipe"); pipe_out = fopen (PIPE_IN, "w"); } if (!pipe_out) { unlink (PIPE_OUT); unlink (PIPE_IN); RAISE (MSG_ABORT, "Cannot open pipe %s", prog, PIPE_IN); } RAISE (MSG_DEBUG, "out pipe opened"); } void srv_closePipes () { RAISE (MSG_DEBUG, "close pipes"); fclose (pipe_in); fclose (pipe_out); pipe_in = NULL; pipe_out = NULL; } void srv_loop (void) { PipeCmd cmd; while (TRUE) { srv_openPipes (); RAISE (MSG_DEBUG, "srv_loop read cmd (eof %i)", feof (pipe_in)); cmd = pipeReadCmd (pipe_in); RAISE (MSG_DEBUG, "srv_loop %i (eof %i)", cmd, feof (pipe_in)); if (feof (pipe_in)) srv_closePipes (); if (!pipe_in || !pipe_out) continue; switch (cmd) { case PCmd_Init: srv_init (); break; case PCmd_Kill: srv_kill (); break; case PCmd_Version: srv_version (); break; case PCmd_OpenCard: srv_openCard (); break; case PCmd_CloseCard: srv_closeCard (); break; case PCmd_SetHeads: srv_setHeads (); break; case PCmd_GetHeads: srv_getHeads (); break; case PCmd_GetHeadDev: srv_getHeadDev (); break; case PCmd_ProbeChips: srv_probeChips (); break; case PCmd_SetChip: srv_setChip (); break; case PCmd_SetSettings: srv_setSettings (); break; case PCmd_GetSettings: srv_getSettings (); break; case PCmd_SetMode: srv_setMode (); break; case PCmd_GetMode: srv_getMode (); break; case PCmd_SetModeSettings: srv_setModeSettings (); break; case PCmd_SetTestImage: srv_setTestImage (); break; case PCmd_GetStatus: srv_getStatus (); break; case PCmd_GetConnection: srv_getConnection (); break; case PCmd_ListModes: srv_listModes (); break; case PCmd_FindBySize: srv_findBySize (); break; case PCmd_FindByOverscan: srv_findByOverscan (); break; case PCmd_InitSharedView: srv_initSharedView (); break; case PCmd_GetTwinView: srv_getTwinView (); break; case PCmd_AdjustView: srv_adjustViewport (); break; case PCmd_ServiceVC: srv_serviceViewportCursor (); break; default: /* not understood, but have to clean up pipe */ pipeReadArgs (pipe_in, 0); if (cmd & 1) { pipeWriteCmd (pipe_out, cmd); pipeWriteArgs (pipe_out, 0); } break; } /* switch */ } /* while */ } /* -------- Main -------- */ int main (int argc, char *argv[]) { int c = '?'; prog = argv[0]; opterr = 0; while ((c = getopt_long (argc, argv, short_options, long_options, NULL)) != EOF) { switch(c) { case 'h': /* Print usage */ case '?': usage(); break; case 'n': opt_null = TRUE; break; case 'N': opt_nvdev = TRUE; break; case 'd': opt_debug = TRUE; break; case 'q': opt_quiet = TRUE; break; } } if (!opt_debug) { closelog (); /* Close any previous log. */ openlog ("nvtvd", LOG_PID, LOG_USER); RAISE (MSG_INFO, "started"); } unlink (PIPE_OUT); unlink (PIPE_IN); umask (0000); /* Reset umask */ if (mkfifo (PIPE_OUT, 0622)) { /* rw--w--w- */ unlink (PIPE_OUT); RAISE (MSG_ABORT, "Cannot create pipe %s", PIPE_OUT); } if (mkfifo (PIPE_IN, 0644)) { /* rw-r--r-- */ unlink (PIPE_OUT); unlink (PIPE_IN); RAISE (MSG_ABORT, " Cannot create pipe %s", PIPE_IN); } RAISE (MSG_DEBUG, "pipes made"); if (opt_null) { srv_root = back_null_init (); } else { if (back_root_avail ()) { srv_root = back_root_init (); } else if (opt_nvdev && back_nvdev_avail (TRUE)) { srv_root = back_nvdev_init (); } else { RAISE (MSG_ABORT, "Cannot access video cards. Either you are not root," "or the NVidia devices\nare not accessible."); } } RAISE (MSG_DEBUG, "server loop"); if (!opt_debug) { daemon(0,0); RAISE (MSG_INFO, "detached from terminal"); } srv_loop (); fclose (pipe_in); fclose (pipe_out); unlink (PIPE_OUT); unlink (PIPE_IN); if (!opt_debug) { closelog (); } return 0; } /* FIXME: Signals kill, hup */ nvtv-0.4.7/src/actions.h0000644000175000001440000000300507620515120010570 /* NVTV actions -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * Header: X actions. * */ #ifndef _ACTIONS_H #define _ACTIONS_H #include #include "tv_chip.h" #include "data.h" /* only for make_vidmode */ Bool has_vidmode (Display *display); void switch_vidmode (Display *display, int screen, int res_x, int res_y); Bool get_vidmode (Display *display, int screen, int *res_x, int *res_y, TVCrtcRegs *crt, make_vidmode make); Bool find_vidmode (Display *display, int screen, int res_x, int res_y, TVCrtcRegs *crt, make_vidmode make); void center_window (Display *display, int screen, Window window, int res_x, int res_y); Window Select_Window (Display *dpy, int screen); Window Window_With_Name (Display *dpy, Window top, char *name); #endif nvtv-0.4.7/src/back_client.h0000644000175000001440000000476607616777457011441 /* NVTV client backend header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_client.h,v 1.12 2003/02/01 17:09:03 dthierbach Exp $ * * Contents: * * Header for client backend */ #ifndef _BACK_CLIENT_H #define _BACK_CLIENT_H #include "debug.h" #include "backend.h" Bool back_client_avail (void); CardPtr back_client_init (void); /* client backend methods */ /* Attention! The 'size' and 'aspect' strings returned by the find operations in mode.spec are allocated, and should be freed when not needed anymore. For the moment, this creates a memory leak, as this behaviour is different from the other backends. */ void bcl_openCard (CardPtr card); void bcl_closeCard (void); #ifdef DEBUG_PROBE void bcl_probeCards (CardPtr card_list); #endif void bcl_setHeads (int main, int tv, int video); void bcl_getHeads (int *main, int *tv, int *video, int *max); void bcl_probeChips (void); void bcl_setChip (ChipPtr chip, Bool init); void bcl_setSettings (TVSettings *set); void bcl_getSettings (TVSettings *set); void bcl_setMode (TVRegs *r); void bcl_getMode (TVRegs *r); void bcl_setModeSettings (TVRegs *r, TVSettings *set); void bcl_setTestImage (TVEncoderRegs *tv, TVSettings *set); long bcl_getStatus (int index); TVConnect bcl_getConnection (void); Bool bcl_findBySize (TVSystem system, int xres, int yres, char *size, TVMode *mode); Bool bcl_findByOverscan (TVSystem system, int xres, int yres, double hoc, double voc, TVMode *mode); void bcl_initSharedView (int *view_x, int *view_y); Bool bcl_getTwinView (int *view_x, int *view_y); Bool bcl_adjustViewportVideo (int flags, int *view_x, int *view_y); Bool bcl_serviceViewportVideoCursor (int flags, int cursor_x, int cursor_y, int *view_x, int *view_y); #endif /* _BACK_CLIENT_H */ nvtv-0.4.7/src/back_direct.h0000644000175000001440000000350107741555571011405 /* NVTV direct backend header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_direct.h,v 1.14 2003/10/10 16:16:57 dthierbach Exp $ * * Contents: * * Header for direct access backend (common part for Linux and MS-Windows) */ #ifndef _BACK_DIRECT_H #define _BACK_DIRECT_H #include "local.h" #include "backend.h" #include "tv_common.h" #include "data.h" /* back_direct methods */ extern BackAccessRec bdir_func; void bdir_openCard (CardPtr card); void bdir_closeCard (void); #ifdef DEBUG_PROBE void bdir_probeSystem (CardPtr card_list); #endif /* generic find routines */ int bdir_listModes (CardType card, DataFunc *data, TVSystem system, TVMode *(list[])); Bool bdir_findBySize (CardType card, DataFunc *data, TVSystem system, int xres, int yres, char *size, TVMode *mode); Bool bdir_findByOverscan (CardType card, DataFunc *data, TVSystem system, int xres, int yres, double hoc, double voc, TVMode *mode); /* additional helper methods */ void bdir_freeChips (CardPtr chips); ChipPtr bdir_copyChips (I2CChainPtr root); #endif /* _BACK_DIRECT_H */ nvtv-0.4.7/src/backend.h0000644000175000001440000001067210005515125010523 /* NVTV backend (header) -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: backend.h,v 1.20 2004/01/27 17:05:25 dthierbach Exp $ * * Contents: * * Common header for all backends */ #ifndef _BACKEND_H #define _BACKEND_H #include "debug.h" #include "tv_chip.h" #ifdef DEBUG_PROBE #include "tv_common.h" #endif #include "local.h" /* for Bool */ /* WARNING! The first entry of the two following data structures MUST be the 'next' field, and the second entry MUST be a string. If they are not, the pipe routines will crash. Other pointers besides those two are transfered through the pipe, but should be ignored, as there value is invalid. */ /* List of chips accessible on one card. Most of the time, there will be only one tv chip, though in theory one could use two on dual-head cards. Other chips can be stored here as well. We duplicate the information in I2Chain and I2CDev to make the frontend independent of the back end. */ typedef struct chip_info { struct chip_info *next; /* must be 1st entry! */ char *name; /* must be 2nd entry! (name including version and I2C addr) */ TVChip type; /* chip type */ int bus, addr; /* I2C bus and address */ void *private; /* identify device, backend private */ } ChipInfo, *ChipPtr; /* List of all NVidia cards available */ #define CARD32 unsigned int typedef struct card_info { struct card_info *next; /* must be 1st entry! */ char *name; /* must be 2nd entry! (name including bus addr) */ char *dev; /* name of device for mmap (not via pipe) */ char *arch; /* architecture (not via pipe) */ CardType type; void* reg_mapped; /* not via pipe */ CARD32 reg_base; CARD32 reg_size; CARD32 pio_base; int addr_bus, addr_slot, addr_func; int pci_id; ChipPtr chips; } CardInfo, *CardPtr; #define BACK_SERVICE_CURSOR (1 << 0) #define BACK_SERVICE_VIDEO (1 << 1) #define BACK_SERVICE_VIEW_CURSOR (1 << 2) #define BACK_SERVICE_VIEW_MAIN (1 << 3) typedef struct { void (*openCard) (CardPtr card); void (*closeCard) (void); #ifdef DEBUG_PROBE void (*probeSystem) (CardPtr card_list); #endif } BackAccessRec, *BackAccessPtr; /* * listModes: Allocate a list of modes matching system, and return * size of list. System may be TV_SYSTEM_NONE to match all systems. */ typedef struct { void (*openCard) (CardPtr card); void (*closeCard) (void); void (*probeChips) (void); #ifdef DEBUG_PROBE void (*probeCard) (void); I2CChainPtr (*probeBus) (void); #endif void (*setHeads) (int main, int tv, int video); void (*getHeads) (int *main, int *tv, int *video, int *max); void (*getHeadDev) (int head, int *devFlags); void (*setChip) (ChipPtr chip, Bool init); void (*setSettings) (TVSettings *set); void (*getSettings) (TVSettings *set); void (*setMode) (TVRegs *r); void (*getMode) (TVRegs *r); void (*setModeSettings) (TVRegs *r, TVSettings *set); void (*setTestImage) (TVEncoderRegs *tv, TVSettings *set); long (*getStatus) (int index); TVConnect (*getConnection) (void); int (*listModes) (TVSystem system, TVMode *(modes[])); Bool (*findBySize) (TVSystem system, int xres, int yres, char *size, TVMode *mode); Bool (*findByOverscan) (TVSystem system, int xres, int yres, double hoc, double voc, TVMode *mode); void (*initSharedView) (int *view_x, int *view_y); Bool (*getTwinView) (int *view_x, int *view_y); Bool (*adjustViewport) (int flags, int *view_x, int *view_y); Bool (*serviceViewportCursor) (int flags, int cursor_x, int cursor_y, int *view_x, int *view_y); } BackCardRec, *BackCardPtr; /* The backend(s) use static information, so there can only be one backend active: */ extern BackAccessPtr back_access; extern BackCardPtr back_card; #endif /* _BACKEND_H */ nvtv-0.4.7/src/back_i810.h0000644000175000001440000000363407531242573010613 /* NVTV i810 backend header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_i810.h,v 1.2 2002/08/22 20:11:39 dthierbach Exp $ * * Contents: * * Header: Backend for Intel i810, i810dc100, i810e, i815, and i815e cards; * direct access. * */ #ifndef _BACK_I810_H #define _BACK_I810_H #include "backend.h" extern BackCardRec bi810_func; void bi810_openCard (CardPtr card); void bi810_closeCard (void); void bi810_setHeads (int main, int tv, int video); void bi810_getHeads (int *main, int *tv, int *video, int *max); void bi810_probeChips (void); void bi810_setChip (ChipPtr chip, Bool init); void bi810_setSettings (TVSettings *set); void bi810_getSettings (TVSettings *set); void bi810_setMode (TVRegs *r); void bi810_getMode (TVRegs *r); void bi810_setModeSettings (TVRegs *r, TVSettings *set); void bi810_setTestImage (TVEncoderRegs *tv, TVSettings *set); long bi810_getStatus (int index); TVConnect bi810_getConnection (void); Bool bi810_findBySize (TVSystem system, int xres, int yres, char *size, TVMode *mode); Bool bi810_findByOverscan (TVSystem system, int xres, int yres, double hoc, double voc, TVMode *mode); #endif /* _BACK_I810_H */ nvtv-0.4.7/src/back_mswin.h0000755000175000001440000000226407620035145011262 /* NVTV MS-Windows card access header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_mswin.h,v 1.1 2003/02/04 22:10:45 dthierbach Exp $ * * Contents: * * Header: Access the graphics card under MS-Windows via the driver. * */ #ifndef _BACK_MSWIN_H #define _BACK_MSWIN_H #include "local.h" /* for Bool */ #include "backend.h" Bool back_win_avail (void); CardPtr back_win_init (void); #endif /* _BACK_MSWIN_H */ nvtv-0.4.7/src/back_null.h0000644000175000001440000000443507531242573011104 /* NVTV null backend header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_null.h,v 1.12 2002/08/22 20:11:39 dthierbach Exp $ * * Contents: * * Header for null backend */ #ifndef _BACK_NULL_H #define _BACK_NULL_H #include "debug.h" #include "backend.h" CardPtr back_null_init (void); /* back_null methods */ void bnull_openCard (CardPtr card); void bnull_closeCard (void); void bnull_setHeads (int main, int tv, int video); void bnull_getHeads (int *main, int *tv, int *video, int *max); void bnull_probeChips (void); void bnull_setChip (ChipPtr chip, Bool init); void bnull_setSettings (TVSettings *set); void bnull_getSettings (TVSettings *set); void bnull_setMode (TVRegs *r); void bnull_getMode (TVRegs *r); void bnull_setModeSettings (TVRegs *r, TVSettings *set); void bnull_setTestImage (TVEncoderRegs *tv, TVSettings *set); long bnull_getStatus (int index); TVConnect bnull_getConnection (void); Bool bnull_findBySize (TVSystem system, int xres, int yres, char *size, TVMode *mode); Bool bnull_findByOverscan (TVSystem system, int xres, int yres, double hoc, double voc, TVMode *mode); void bnull_initSharedView (int *view_x, int *view_y); Bool bnull_getTwinView (int *view_x, int *view_y); Bool bnull_adjustViewport (int flags, int *view_x, int *view_y); Bool bnull_serviceViewportCursor (int flags, int cursor_x, int cursor_y, int *view_x, int *view_y); #ifdef DEBUG_PROBE void bnull_probeSystem (CardPtr card_list); void bnull_probeCard (void); I2CChainPtr bnull_probeBus (void); #endif #endif /* _BACK_NULL_H */ nvtv-0.4.7/src/back_nvidia.h0000644000175000001440000000422407564754311011404 /* NVTV nvidia backend header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_nvidia.h,v 1.9 2002/11/14 17:09:29 dthierbach Exp $ * * Contents: * * Header for nvidia backend */ #ifndef _BACK_NVIDIA_H #define _BACK_NVIDIA_H #include "backend.h" extern BackCardRec bnv_func; extern BackCardRec bxbox_func; void bnv_openCard (CardPtr card); void bnv_closeCard (void); void bnv_setHeads (int main, int tv, int video); void bnv_getHeads (int *main, int *tv, int *video, int *max); void bnv_probeChips (void); void bnv_setChip (ChipPtr chip, Bool init); void bnv_setSettings (TVSettings *set); void bnv_getSettings (TVSettings *set); void bnv_setMode (TVRegs *r); void bnv_getMode (TVRegs *r); void bnv_setModeSettings (TVRegs *r, TVSettings *set); void bnv_setTestImage (TVEncoderRegs *tv, TVSettings *set); long bnv_getStatus (int index); TVConnect bnv_getConnection (void); Bool bnv_findBySize (TVSystem system, int xres, int yres, char *size, TVMode *mode); Bool bnv_findByOverscan (TVSystem system, int xres, int yres, double hoc, double voc, TVMode *mode); void bnv_initSharedView (int *view_x, int *view_y); Bool bnv_getTwinView (int *view_x, int *view_y); Bool bnv_adjustViewport (int flags, int *view_x, int *view_y); Bool bnv_serviceViewportCursor (int flags, int cursor_x, int cursor_y, int *view_x, int *view_y); void bnv_probeSystem (CardPtr card_list); #endif /* _BACK_NVIDIA_H */ nvtv-0.4.7/src/back_tdfx.h0000644000175000001440000000357207531242573011100 /* NVTV 3dfx backend header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_tdfx.h,v 1.5 2002/08/22 20:11:39 dthierbach Exp $ * * Contents: * * Header: Backend for 3dfx (Voodoo 3) cards, direct access. * */ #ifndef _BACK_TDFX_H #define _BACK_TDFX_H #include "backend.h" extern BackCardRec btdfx_func; void btdfx_openCard (CardPtr card); void btdfx_closeCard (void); void btdfx_setHeads (int main, int tv, int video); void btdfx_getHeads (int *main, int *tv, int *video, int *max); void btdfx_probeChips (void); void btdfx_setChip (ChipPtr chip, Bool init); void btdfx_setSettings (TVSettings *set); void btdfx_getSettings (TVSettings *set); void btdfx_setMode (TVRegs *r); void btdfx_getMode (TVRegs *r); void btdfx_setModeSettings (TVRegs *r, TVSettings *set); void btdfx_setTestImage (TVEncoderRegs *tv, TVSettings *set); long btdfx_getStatus (int index); TVConnect btdfx_getConnection (void); Bool btdfx_findBySize (TVSystem system, int xres, int yres, char *size, TVMode *mode); Bool btdfx_findByOverscan (TVSystem system, int xres, int yres, double hoc, double voc, TVMode *mode); #endif /* _BACK_TDFX_H */ nvtv-0.4.7/src/back_unix.h0000755000175000001440000000235107620035145011105 /* NVTV unix direct backend header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_unix.h,v 1.1 2003/02/04 22:10:45 dthierbach Exp $ * * Contents: * * Header: Backend for direct access of the card unter Unix * */ #ifndef _BACK_UNIX_H #define _BACK_UNIX_H #include "local.h" /* for Bool */ #include "backend.h" Bool back_root_avail (void); CardPtr back_root_init (void); Bool back_nvdev_avail (Bool force); CardPtr back_nvdev_init (void); #endif /* _BACK_UNIX_H */ nvtv-0.4.7/src/bitmask.h0000644000175000001440000000363007620035045010571 /* NVTV Bitmask defines -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: bitmask.h,v 1.5 2003/02/04 22:09:41 dthierbach Exp $ * * Contents: * * Defines to manipulate bitfields. * */ #ifndef _BITMASK_H #define _BITMASK_H /* -------- */ /* Little macro to construct bitmask for contiguous ranges of bits */ #define BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b)) #define MASKEXPAND(mask) BITMASK(1?mask,0?mask) /* Macro to set specific bitfields (mask has to be a macro x:y) ! */ #define SetBF(mask,value) ((value) << (0?mask)) #define GetBF(var,mask) (((unsigned)((var) & MASKEXPAND(mask))) >> (0?mask) ) #define MaskAndSetBF(var,mask,value) (var)=(((var)&(~MASKEXPAND(mask)) \ | SetBF(mask,value))) /* SetBitField: Move bit-range in 'from' to bit-range in 'to' */ #define SetBitField(value,from,to) SetBF(to, GetBF(value,from)) #define SetBitFlag(value,mask,to) ((value & mask) ? (1 << to) : 0) #define SetBit(n) (1<<(n)) #define GetBit(value,n) ((value)&(1<<(n))) #define GetBitFlag(value,from,mask) (GetBit(value,from) ? mask : 0) #define Set8Bits(value) ((value)&0xff) #endif /* _BITMASK_H */ nvtv-0.4.7/src/calc_bt.h0000644000175000001440000000156707533742442010546 #ifndef _RECALC_H #define _RECALC_H #include "tv_chip.h" #define BT_CALC_CHARCLK8 (1 << 0) #define BT_CALC_CHARCLK9 (1 << 1) #define BT_CALC_RATIO32 (1 << 2) typedef void (*RecalcFindRes) (double hoc, double voc, double badness, double aspect, int flag); int recalc_main (int argc, char *argv []); void recalc_bt_find (TVSystem system, int hres, int vres, double hoc_min, double hoc_max, double voc_min, double voc_max, RecalcFindRes callback); void recalc_bt_custom (TVSystem system, int hres, int vres, double hoc, double voc, TVRegs *r); void recalc_cx_find (TVSystem system, int hres, int vres, double hoc_min, double hoc_max, double voc_min, double voc_max, RecalcFindRes callback); void recalc_cx_custom (TVSystem system, int hres, int vres, double hoc, double voc, TVRegs *r); void calc_nv_btcx (int hres, int vres, TVRegs *r); #endif /* _RECALC_H */ nvtv-0.4.7/src/card_direct.h0000644000175000001440000000276707741555571011433 /* NVTV direct card access (header) -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: card_direct.h,v 1.5 2003/10/10 16:16:57 dthierbach Exp $ * * Contents: * * Header: Access the graphics card directly (via mmaps) * */ #ifndef _CARD_DIRECT_H #define _CARD_DIRECT_H #include "backend.h" #define DEV_WINIO "winio" #define DEV_MEM "/dev/mem" #define DEV_NVCTL "/dev/nvidiactl" int openDevMem (CardPtr card); void closeDevMem (CardPtr card, int fd); void *mapDevMem (CardPtr card, int fd, unsigned long Base, unsigned long Size); void unmapDevMem (CardPtr card, unsigned long Base, unsigned long Size); void scan_cards_pci (CardPtr *card_root_list, char *devname); void scan_cards_nvdev (CardPtr *card_nvdev_list); #endif /* _CARD_DIRECT_H */ nvtv-0.4.7/src/data.h0000644000175000001440000000422007621755640010057 /* NVTV data header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data.h,v 1.18 2003/02/10 17:04:32 dthierbach Exp $ * */ #ifndef _DATA_H #define _DATA_H #include "tv_chip.h" /* init and setup must use a copy of the values from the database, otherwise the database will change. */ typedef struct { TVMode* (*modes) (void); void (*defaults) (TVSettings *s); void (*setup) (TVSettings *s, TVRegs *r); void (*clamp) (TVSettings *s, TVRegs *r); void (*calc) (TVSystem system, int hres, int vres, double hoc, double voc, TVRegs *r); } DataFunc; typedef void (*make_vidmode) (int hdisplay, int hsyncstart, int hsyncend, int htotal, int vdisplay, int vsyncstart, int vsyncend, int vtotal, int dotclock, TVCrtcRegs *crt); typedef struct { make_vidmode make; } DataCardFunc; int data_clamp (int val, int size, int ticks[]); int data_pick (int val, int size, int ticks[]); TVMode *data_find (TVMode *modes, TVSystem system, int res_x, int res_y, char *size); TVMode *data_findNearest (TVMode *modes, TVSystem system, int res_x, int res_y, double hoc, double voc); int data_listModes (TVMode *modes, TVSystem system, TVMode *(list[])); void data_calc_null (TVSystem system, int hres, int vres, double hoc, double voc, TVRegs *r); DataFunc *data_func (CardType card, TVChip chip); DataCardFunc *data_card_func (CardType card); extern DataFunc null_func; #endif /* _DATA_H */ nvtv-0.4.7/src/data_bt.h0000644000175000001440000000651207660263500010542 /* NVTV Brooktree chip data header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_bt.h,v 1.21 2003/05/13 21:44:32 dthierbach Exp $ * * Contents: * * Header: Data tables and setup routines for the Brooktree chip. */ #ifndef _DATA_BT_H #define _DATA_BT_H #include "tv_chip.h" #include "data.h" void data_init_bt (TVSystem system, TVBtRegs *r); void data_default_bt (TVSettings *s); void data_clamp_bt (TVSettings *s, TVRegs *r); void data_setup_bt (TVSettings *s, TVRegs *r); void data_init_nomux_bt (TVSystem system, TVBtRegs *r); void data_setup_nomux_bt (TVSettings *s, TVRegs *r); void data_mux_nv_bt (TVBtRegs *r); void data_mux_tdfx_bt (TVBtRegs *r); void data_ntsc_palm_bt (TVBtRegs *r); extern TVBtRegs bt_ntsc_small_a; /* 13.79 x 13.58 (std 0) */ extern TVBtRegs bt_ntsc_normal_a; /* 10.59 x 08.23 */ extern TVBtRegs bt_ntsc_huge_a; /* 02.46 x 01.23 */ extern TVBtRegs bt_ntsc_small_b; /* 21.62 x 11.52 (std 2) */ extern TVBtRegs bt_ntsc_normal_b; /* 11.90 x 05.35 */ extern TVBtRegs bt_ntsc_huge_b; /* 07.15 x 00.004 */ extern TVBtRegs bt_ntsc_normal_c; /* 08.762 x 18.107 */ extern TVBtRegs bt_ntsc_dvd_a; /* 01.245 x 01.235 */ extern TVBtRegs bt_ntsc_dvd_b; /* 02.135 x 01.235 */ extern TVBtRegs bt_pal_small_a; /* 16.56 x 16.67 (std 1) */ extern TVBtRegs bt_pal_normal_a; /* 12.87 x 07.64 */ extern TVBtRegs bt_pal_huge_a; /* 06.22 x 00.69 */ extern TVBtRegs bt_pal_small_b; /* 14.53 x 13.19 (std 3) */ extern TVBtRegs bt_pal_normal_b; /* 10.81 x 05.56 */ extern TVBtRegs bt_pal_large_b; /* 07.461 x 02.083 */ extern TVBtRegs bt_pal_huge_b; /* 00.039 x 00.00 (direct) */ extern TVBtRegs bt_pal_small_c; /* 13.122 x 07.986 */ extern TVBtRegs bt_pal_normal_c; /* 09.806 x 04.514 */ extern TVBtRegs bt_pal_huge_c; /* 00.000 x 00.000 */ extern TVBtRegs bt_pal_normal_d; /* 08.83 x 07.29 */ extern TVBtRegs bt_pal_dvd_a; /* 00.21 x 00.00 */ extern TVBtRegs bt_pal60_small_a; /* 16.758 x 14.815 */ extern TVBtRegs bt_pal60_normal_a; /* 10.592 x 08.230 */ extern TVBtRegs bt_pal60_huge_a; /* 01.469 x 01.235 */ extern TVBtRegs bt_pal60_small_b; /* 21.623 x 11.523 */ extern TVBtRegs bt_pal60_normal_b; /* 11.897 x 05.350 */ extern TVBtRegs bt_pal60_huge_b; /* 07.862 x 00.823 */ extern TVBtRegs bt_pal60_dvd_a; /* 01.245 x 01.235 */ extern TVBtRegs bt_async_pal_small_a; /* 16.56 x 16.67 (std 1) */ #endif /* _DATA_BT_H */ nvtv-0.4.7/src/data_ch.h0000644000175000001440000001634110006415006010514 /* NVTV Chrontel chip data header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_ch.h,v 1.21 2004/01/30 08:47:02 dthierbach Exp $ * * Contents: * * Header: Data tables and setup routines for the Chrontel chip. */ #ifndef _DATA_CH_H #define _DATA_CH_H #include "tv_chip.h" #include "data.h" void data_init_ch1 (TVSystem system, TVChRegs *r); void data_init_ch2 (TVSystem system, TVChRegs *r); void data_default_ch (TVSettings *s); void data_clamp_ch (TVSettings *s, TVRegs *r); void data_setup_ch1 (TVSettings *s, TVRegs *r); void data_setup_ch2 (TVSettings *s, TVRegs *r); /* ---- CH1 ---- */ extern TVChRegs ch1_ntsc_huge_a; /* Mode 16: 640x480 1:1 */ extern TVChRegs ch1_ntsc_small_a; /* Mode 17: 640x480 7:8 */ extern TVChRegs ch1_ntsc_tiny_a; /* Mode 18: 640x480 5:6 */ extern TVChRegs ch1_ntsc_huge_b; /* Mode 22: 800x600 5:6 */ extern TVChRegs ch1_ntsc_large_b; /* Mode 23: 800x600 3:4 */ extern TVChRegs ch1_ntsc_small_b; /* Mode 24: 800x600 7:10 */ extern TVChRegs ch1_ntsc_huge_c; /* Mode 10: 640x400 5:4 */ extern TVChRegs ch1_ntsc_small_c; /* Mode 11: 640x400 1:1 */ extern TVChRegs ch1_ntsc_tiny_c; /* Mode 12: 640x400 7:8 */ extern TVChRegs ch1_ntsc_huge_d; /* Mode 6: 720x400 5:4 */ extern TVChRegs ch1_ntsc_small_d; /* Mode 7: 720x400 1:1 */ extern TVChRegs ch1_ntsc_large_e; /* Mode 2: 512x384 5:4 */ extern TVChRegs ch1_ntsc_small_e; /* Mode 3: 512x384 1:1 */ extern TVChRegs ch1_ntsc_large_f; /* Mode 23: 800x600 3:4 */ extern TVChRegs ch1_ntsc_large_g; /* Mode 23: 800x600 3:4 */ extern TVChRegs ch1_ntsc_interl_dvd; /* Mode 26: 720x480 IL */ extern unsigned long ch1_fsci_ntsc_huge_a []; extern unsigned long ch1_fsci_ntsc_small_a []; extern unsigned long ch1_fsci_ntsc_tiny_a []; extern unsigned long ch1_fsci_ntsc_huge_b []; extern unsigned long ch1_fsci_ntsc_large_b []; extern unsigned long ch1_fsci_ntsc_small_b []; extern unsigned long ch1_fsci_ntsc_huge_c []; extern unsigned long ch1_fsci_ntsc_small_c []; extern unsigned long ch1_fsci_ntsc_tiny_c []; extern unsigned long ch1_fsci_ntsc_huge_d []; extern unsigned long ch1_fsci_ntsc_small_d []; extern unsigned long ch1_fsci_ntsc_large_e []; extern unsigned long ch1_fsci_ntsc_small_e []; extern TVChRegs ch1_pal_huge_a; /* Mode 13: 640x480 5:4 */ extern TVChRegs ch1_pal_small_a; /* Mode 14: 640x480 1:1 */ extern TVChRegs ch1_pal_tiny_a; /* Mode 15: 640x480 5:6 */ extern TVChRegs ch1_pal_huge_b; /* Mode 19: 800x600 1:1 */ extern TVChRegs ch1_pal_small_b; /* Mode 20: 800x600 5:6 */ extern TVChRegs ch1_pal_tiny_b; /* Mode 21: 800x600 3:4 */ extern TVChRegs ch1_pal_small_c; /* Mode 8: 640x400 5:4 */ extern TVChRegs ch1_pal_tiny_c; /* Mode 9: 640x400 1:1 */ extern TVChRegs ch1_pal_small_d; /* Mode 4: 720x400 5:4 */ extern TVChRegs ch1_pal_tiny_d; /* Mode 5: 720x400 1:1 */ extern TVChRegs ch1_pal_small_e; /* Mode 0: 512x384 5:4 */ extern TVChRegs ch1_pal_tiny_e; /* Mode 1: 512x384 1:1 */ extern TVChRegs ch1_pal_large_f; /* Mode 19: 800x600 1:1 */ extern TVChRegs ch1_pal_large_g; /* Mode 19: 800x600 1:1 */ extern TVChRegs ch1_pal_small_f; /* Mode 20: 800x600 5:6 */ extern TVChRegs ch1_pal_small_g; /* Mode 20: 800x600 5:6 */ extern TVChRegs ch1_pal_interl_dvd; /* Mode 25: 720x576 IL */ extern unsigned long ch1_fsci_pal_huge_a []; extern unsigned long ch1_fsci_pal_small_a []; extern unsigned long ch1_fsci_pal_tiny_a []; extern unsigned long ch1_fsci_pal_huge_b []; extern unsigned long ch1_fsci_pal_small_b []; extern unsigned long ch1_fsci_pal_tiny_b []; extern unsigned long ch1_fsci_pal_small_c []; extern unsigned long ch1_fsci_pal_tiny_c []; extern unsigned long ch1_fsci_pal_small_d []; extern unsigned long ch1_fsci_pal_tiny_d []; extern unsigned long ch1_fsci_pal_small_e []; extern unsigned long ch1_fsci_pal_tiny_e []; /* ---- CH2 ---- */ extern TVChRegs ch2_ntsc_huge_c; /* Mode 19: 720x480 / 882x525 1:1 */ extern TVChRegs ch2_ntsc_small_c; /* Mode 20: 720x480 / 882x600 7:8 */ extern TVChRegs ch2_ntsc_tiny_c; /* Mode 21: 720x480 / 900x630 5:6 */ extern TVChRegs ch2_ntsc_large_b; /* Mode 28: 800x600 / 1040x700 3:4 */ extern TVChRegs ch2_ntsc_small_b; /* Mode 29: 800x600 / 1064x750 7:10 */ extern TVChRegs ch2_ntsc_tiny_b; /* Mode 30: 800x600 / 1040x840 5:8 */ extern TVChRegs ch2_ntsc_huge_a; /* Mode 34: 1024x768 / 1160x840 5:8 */ extern TVChRegs ch2_ntsc_large_a; /* Mode 35: 1024x768 / 1160x945 5:9 */ extern TVChRegs ch2_ntsc_tiny_a; /* Mode 36: 1024x768 / 1168x1050 1:2 */ extern TVChRegs ch2_ntsc_dvd; /* Mode 38: 720x480 / 858x525 1:1 */ extern TVChRegs ch2_pal_huge_d; /* Mode 22: 720x576 / 882x625 1:1 */ extern TVChRegs ch2_pal_small_d; /* Mode 23: 720x576 / 900x750 5:6 */ extern TVChRegs ch2_pal_tiny_d; /* Mode 24: 720x576 / 900x875 5:7 */ extern TVChRegs ch2_pal_huge_b; /* Mode 25: 800x600 / 944x625 1:1 */ extern TVChRegs ch2_pal_small_b; /* Mode 26: 800x600 / 960x750 5:6 */ extern TVChRegs ch2_pal_tiny_b; /* Mode 27: 800x600 / 960x875 5:7 */ extern TVChRegs ch2_pal_huge_a; /* Mode 31: 1024x768 / 1400x875 5:7 */ extern TVChRegs ch2_pal_small_a; /* Mode 32: 1024x768 / 1400x1000 5:8 */ extern TVChRegs ch2_pal_tiny_a; /* Mode 33: 1024x768 / 1400x1125 5:9 */ extern TVChRegs ch2_pal_dvd; /* Mode 37: 720x576 / 864x625 1:1 */ extern unsigned long ch2_fsci_ntsc_huge_c []; /* 19 */ extern unsigned long ch2_fsci_ntsc_small_c []; /* 20 */ extern unsigned long ch2_fsci_ntsc_tiny_c []; /* 21 */ extern unsigned long ch2_fsci_ntsc_large_b []; /* 28 */ extern unsigned long ch2_fsci_ntsc_small_b []; /* 29 */ extern unsigned long ch2_fsci_ntsc_tiny_b []; /* 30 */ extern unsigned long ch2_fsci_ntsc_huge_a []; /* 34 */ extern unsigned long ch2_fsci_ntsc_large_a []; /* 35 */ extern unsigned long ch2_fsci_ntsc_tiny_a []; /* 36 */ extern unsigned long ch2_fsci_ntsc_dvd []; /* 38 */ extern unsigned long ch2_fsci_pal_huge_d []; /* 22 */ extern unsigned long ch2_fsci_pal_small_d []; /* 23 */ extern unsigned long ch2_fsci_pal_tiny_d []; /* 24 */ extern unsigned long ch2_fsci_pal_huge_b []; /* 25 */ extern unsigned long ch2_fsci_pal_small_b []; /* 26 */ extern unsigned long ch2_fsci_pal_tiny_b []; /* 27 */ extern unsigned long ch2_fsci_pal_huge_a []; /* 31 */ extern unsigned long ch2_fsci_pal_small_a []; /* 32 */ extern unsigned long ch2_fsci_pal_tiny_a []; /* 33 */ extern unsigned long ch2_fsci_pal_dvd []; /* 37 */ #endif /* _DATA_CH_H */ nvtv-0.4.7/src/data_cx.h0000644000175000001440000000352607564504061010554 /* NVTV Conexant chip data header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_cx.h,v 1.11 2002/11/13 17:13:21 dthierbach Exp $ * * Contents: * * Header: Data tables and setup routines for the Conexant chip. */ #ifndef _DATA_CX_H #define _DATA_CX_H #include "tv_chip.h" #include "data.h" void data_init_cx (TVSystem system, TVCxRegs *r, int btmode); void data_default_cx (TVSettings *s); void data_clamp_cx (TVSettings *s, TVRegs *r); void data_setup_cx (TVSettings *s, TVRegs *r); void data_secam_cx (TVCxRegs *r); TVCxRegs cx_ntsc_xbox; /* XBox BIOS */ TVCxRegs cx_ntsc_small_a; /* Mode 10, hoc=15.11 voc=14.81 */ TVCxRegs cx_ntsc_normal_a; /* Mode 26, hoc=11.97 voc=11.93 */ TVCxRegs cx_ntsc_tiny_a; /* Mode 42, hoc=18.04 voc=18.11 */ TVCxRegs cx_ntsc_small_b; /* Mode 18, hoc=13.79 voc=13.58 */ TVCxRegs cx_ntsc_tiny_b; /* Mode 34, hoc=19.26 voc=19.34 */ TVCxRegs cx_ntsc_mini_b; /* Mode 40, hoc=15.59 voc=15.64 */ TVCxRegs cx_pal_small_a; /* Mode 11, hoc=13.44 voc=14.24 */ TVCxRegs cx_pal_mini_a; /* Mode 43, hoc=16.20 voc=16.67 */ #endif /* _DATA_CX_H */ nvtv-0.4.7/src/data_ph.h0000644000175000001440000000523307620311214010533 /* NVTV Philips chip data header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_ph.h,v 1.15 2003/02/05 22:39:08 dthierbach Exp $ * * Contents: * * Header: Data tables and setup routines for the Philips chip. */ #ifndef _DATA_PH_H #define _DATA_PH_H #include "tv_chip.h" #include "data.h" void data_init_ph1 (TVSystem system, TVPh1Regs *r); void data_init_ph2 (TVSystem system, TVPh2Regs *r); void data_default_ph (TVSettings *s); void data_clamp_ph (TVSettings *s, TVRegs *r); void data_setup_ph (TVSettings *s, TVRegs *r); extern TVPh1Regs ph_ntsc_small_a; /* PH 620x204 Small, FFl, OC 12.67x16.05 */ extern TVPh1Regs ph_ntsc_medium_a; /* PH 640x216 +0 Reg, FFl, OC 09.86x11.11 */ extern TVPh1Regs ph_ntsc_small_b; /* PH 620x204 Small, FFl, OC 12.67x16.05 */ extern TVPh1Regs ph_ntsc_medium_b; /* PH 640x216 +0 Reg, FFl, OC 09.86x11.11 */ extern TVPh1Regs ph_ntsc_huge_b; /* PH 710x241 Full, FFl, OC 0.00x00.82 */ extern TVPh1Regs ph_pal_small_a; /* PH 620x250 Small, FFl, OC 11.68x13.19 */ extern TVPh1Regs ph_pal_medium_a; /* PH 640x259 +0 Reg, FFl, OC 08.83x10.07 */ extern TVPh1Regs ph_pal_small_b; /* PH 620x250 Small, FFl, OC 11.68x13.19 */ extern TVPh1Regs ph_pal_medium_b; /* PH 640x259 +0 Reg, FFl, OC 08.83x10.07 */ extern TVPh1Regs ph_pal_huge_b; /* PH 702x288 Full, FFl, OC 00.00x00.00 */ extern TVPh2Regs ph_ntsc_test_a; /* 640x480 NV */ extern TVPh2Regs ph_ntsc_test_b; /* 800x600 NV */ extern TVPh2Regs ph_ntsc_test_c; /* 1024x768 NV double freq? */ extern TVPh2Regs ph_pal_test_a; /* 640x480 NV */ extern TVPh2Regs ph_pal_test_b; /* 800x600 NV */ extern TVPh2Regs ph_pal_test_c; /* 1024x768 NV double freq? */ extern TVPh2Regs ph_ntsc_slave_a; /* 640x480 Slave */ extern TVPh2Regs ph_ntsc_slave_b; /* 800x600 Slave */ extern TVPh2Regs ph_pal_slave_a; /* 640x480 Slave, from dump */ extern TVPh2Regs ph_pal_slave_b; /* 800x600 Slave */ #endif /* _DATA_PH_H */ nvtv-0.4.7/src/data_nx.h0000644000175000001440000000304607677065171010575 /* NVTV NVidia internal encoder data header * * Author: Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_nx.h,v 1.2 2003/06/27 16:02:01 dthierbach Exp $ * * Contents: * * Header: Data tables and setup routines for the NVidia internal * encoder chip. */ #ifndef _DATA_NX_H #define _DATA_NX_H #include "tv_chip.h" #include "data.h" void data_init_nx (TVSystem system, TVNxRegs *r); void data_default_nx (TVSettings *s); void data_clamp_nx (TVSettings *s, TVRegs *r); void data_setup_nx (TVSettings *s, TVRegs *r); void data_complete_nx (TVRegs *r); extern TVNxImgRegs nx_50_normal_a; extern TVNxImgRegs nx_50_normal_b; extern TVNxImgRegs nx_50_normal_c; extern TVNxImgRegs nx_60_normal_a; extern TVNxImgRegs nx_60_normal_b; extern TVNxImgRegs nx_60_normal_c; #endif /* _DATA_NX_H */ nvtv-0.4.7/src/data_i810.h0000644000175000001440000000236207743224066010623 /* NVTV Intel 810 CRTC data header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_i810.h,v 1.4 2003/10/15 10:57:58 dthierbach Exp $ * * Contents: * * Header: Data routines for the Intel 810 CRTC data. * */ #ifndef _DATA_I810_H #define _DATA_I810_H #include "tv_chip.h" #include "data.h" void data_init_i810 (TVI810Regs *r, int portHost); extern DataCardFunc data_i810_func; extern DataFunc data_i810_ch1_func; extern DataFunc data_i810_ch2_func; #endif /* _DATA_I810_H */ nvtv-0.4.7/src/data_nv.h0000644000175000001440000000307007671651576010574 /* NVTV NVidia CRTC data header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_nv.h,v 1.7 2003/06/11 16:06:22 dthierbach Exp $ * * Contents: * * Header: Data routines for the NVidia CRTC data. * */ #ifndef _DATA_NV_H #define _DATA_NV_H #include "tv_chip.h" #include "data.h" void data_init_nv (TVNvRegs *r, int portHost, int devFlags); TVMode *data_modes_nv_bt (void); TVMode *data_modes_nv_cx (void); TVMode *data_modes_nv_ch1 (void); TVMode *data_modes_nv_ph1 (void); TVMode *data_modes_nv_ph2 (void); extern DataCardFunc data_nv_func; extern DataFunc data_nv_bt_func; extern DataFunc data_nv_cx_func; extern DataFunc data_nv_ch1_func; extern DataFunc data_nv_ch2_func; extern DataFunc data_nv_ph1_func; extern DataFunc data_nv_ph2_func; extern DataFunc data_nv_nx_func; #endif /* _DATA_NV_H */ nvtv-0.4.7/src/data_tdfx.h0000644000175000001440000000234707534761323011112 /* NVTV 3dfx CRTC data header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_tdfx.h,v 1.2 2002/09/02 22:14:43 dthierbach Exp $ * * Contents: * * Header: Data routines for the 3dfx CRTC data. * */ #ifndef _DATA_TDFX_H #define _DATA_TDFX_H #include "tv_chip.h" #include "data.h" void data_init_tdfx (TVTdfxRegs *r, int portHost); TVMode *data_modes_tdfx_bt (void); extern DataCardFunc data_tdfx_func; extern DataFunc data_tdfx_bt_func; #endif /* _DATA_TDFX_H */ nvtv-0.4.7/src/data_vesa.h0000644000175000001440000000220107620516351011063 /* NVTV data vesa header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_vesa.h,v 1.1 2003/02/06 17:35:37 dthierbach Exp $ * * Contents: Header for VESA modelines * */ #ifndef _DATA_VESA_H #define _DATA_VESA_H #include "local.h" #include "tv_chip.h" #include "data.h" Bool data_vesa_mode (char *name, TVCrtcRegs *crt, make_vidmode make); #endif /* _DATA_VESA_H */ nvtv-0.4.7/src/data_xbox.h0000644000175000001440000000236707564754311011131 /* NVTV XBox CRTC/FP data header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: data_xbox.h,v 1.1 2002/11/14 17:09:29 dthierbach Exp $ * * Contents: * * Header: Data routines for the XBox CRTC/FP data. * */ #ifndef _DATA_XBOX_H #define _DATA_XBOX_H #include "tv_chip.h" #include "data.h" void data_init_xbox (TVNvRegs *r, int portHost, int devFlags); TVMode *data_modes_xbox_cx (void); extern DataCardFunc data_xbox_func; extern DataFunc data_xbox_cx_func; #endif /* _DATA_NV_H */ nvtv-0.4.7/src/debug.h0000644000175000001440000001135610012127457010227 /* NVTV debug -- Dirk Thierbach * * This is open software protected by the GPL. See GPL.txt for details. * * Debug definitions. * */ #ifndef _DEBUG_H #define _DEBUG_H #include /* -------- Config defines -------- */ /* Chrontel slave sync modes (normally not necessary) */ /* #define CONFIG_SLAVE_CH */ /* Brooktree async modes (test) */ /* #define CONFIG_ASYNC_BT */ /* Setup BlankEnd for Voodoo cards */ #define CONFIG_TDFX_SETUP_BLANK /* Allow overlay modes */ /* #define CONFIG_OVERLAY_NV */ /* -------- Debugging defines -------- */ /* Disable timeout procs */ /* #define DISABLE_TIMEOUT */ /* Enable probe/debug routines */ #define DEBUG_PROBE /* Scan all unknown chips if no known tv chip is found (nv_tv.c) */ #define PROBE_ALL_UNKNOWN /* The EEPROM on the XBox bus might cause problems when probed. */ #ifdef XBOX_SUPPORT #undef PROBE_ALL_UNKOWN #endif /* -------- Meta */ /* Fake XBox (Meta) */ /* #define FAKE_XBOX */ /* Fake GeForce3 (Meta) */ /* #define FAKE_GEFORCE3 */ /* Fake Voodoo3 (Meta) */ /* #define FAKE_VOODOO */ /* Fake Intel i810 (Meta) */ /* #define FAKE_I810 */ /* Fake Intel i830 (Meta) */ /* #define FAKE_I830 */ /* Fake Brooktree chip (Meta) */ /* #define FAKE_BROOKTREE */ /* Fake Conexant chip (Meta) */ /* #define FAKE_CONEXANT */ /* Fake Chrontel chip (Meta) */ /* #define FAKE_CHRONTEL */ /* Fake Philips chip (Meta) */ /* #define FAKE_PHILIPS */ /* Fake TV mode (Meta) */ /* #define FAKE_TV */ /* -------- Tests Hooks */ /* Test MMIO and I2C -- usually set on gcc command line */ /* #define TEST_HOOKS */ /* -------- MMIO Tests */ /* Check MMIO when faking it */ /* #define CHECK_MMIO */ /* Base and range for check */ /* #define CHECK_MMIO_BASE 0x601 */ /* #define CHECK_MMIO_MIN 0x2000 */ /* #define CHECK_MMIO_MAX 0x4000 */ /* #define CHECK_MMIO_ABORT */ /* -------- */ /* Fake successful probing of all tv chips (nv_tv.c) */ /* #define FAKE_PROBE_ALL */ /* Fake successful probing of this addr on all busses (nv_tv.c) */ /* #define FAKE_PROBE_ADDR 0xEA */ /* Fake Brooktree chip identification */ /* #define FAKE_PROBE_BROOKTREE */ /* Fake Conexant chip identification */ /* #define FAKE_PROBE_CONEXANT */ /* Fake Chrontel chip identification */ /* #define FAKE_PROBE_CHRONTEL */ /* Fake Philips chip identification */ /* #define FAKE_PROBE_PHILIPS */ /* Fake id to return on identification */ /* #define FAKE_PROBE_ID TV_PHILIPS_7104 */ /* Fake I2C Bus reads and writes (nv_tv.c) */ /* #define FAKE_I2C */ /* Fake CRTC register writes (nv_tv.c) */ /* #define FAKE_CRTC */ /* Fake mmapped register writes (tv_nv.c) */ /* #define FAKE_MMIO */ /* Fake pci card in root backend */ /* #define FAKE_CARD */ /* Fake memory mapping */ /* #define FAKE_CARD_MMAP */ /* Fake vendor id of pci card. */ /* #define FAKE_CARD_VENDOR PCI_VENDOR_3DFX */ /* Fake device id of pci card */ /* #define FAKE_CARD_DEVICE PCI_CHIP_VOODOO3 */ /* -------- */ #ifdef FAKE_XBOX #define FAKE_CARD #define FAKE_CARD_MMAP #define FAKE_MMIO #define FAKE_CRTC #define FAKE_I2C #define FAKE_CARD_VENDOR PCI_VENDOR_NVIDIA #define FAKE_CARD_DEVICE PCI_CHIP_GEFORCE3_MCPX #endif #ifdef FAKE_GEFORCE3 #define FAKE_CARD #define FAKE_CARD_MMAP #define FAKE_MMIO #define FAKE_CRTC #define FAKE_I2C #define FAKE_CARD_VENDOR PCI_VENDOR_NVIDIA #define FAKE_CARD_DEVICE PCI_CHIP_GEFORCE3 #endif #ifdef FAKE_VOODOO #define FAKE_CARD #define FAKE_CARD_MMAP #define FAKE_CARD_VENDOR PCI_VENDOR_3DFX #define FAKE_CARD_DEVICE PCI_CHIP_VOODOO3 #endif #ifdef FAKE_I810 #define FAKE_CARD #define FAKE_CARD_MMAP #define FAKE_CARD_VENDOR PCI_VENDOR_INTEL #define FAKE_CARD_DEVICE PCI_CHIP_I810 #define FAKE_CHRONTEL #define FAKE_PROBE_ID TV_CHRONTEL_7007 #endif #ifdef FAKE_I830 #define FAKE_CARD #define FAKE_CARD_MMAP #define FAKE_CARD_VENDOR PCI_VENDOR_INTEL #define FAKE_CARD_DEVICE PCI_CHIP_I830 #define FAKE_CHRONTEL #define FAKE_PROBE_ID TV_CHRONTEL_7009 #endif #ifdef FAKE_BROOKTREE #define FAKE_MMIO #define FAKE_CRTC #define FAKE_I2C #define FAKE_PROBE_ADDR 0x8A #define FAKE_PROBE_BROOKTREE #ifndef FAKE_PROBE_ID #define FAKE_PROBE_ID TV_BROOKTREE #endif #endif #ifdef FAKE_CONEXANT #define FAKE_MMIO #define FAKE_CRTC #define FAKE_I2C #define FAKE_PROBE_ADDR 0x8A #define FAKE_PROBE_CONEXANT #ifndef FAKE_PROBE_ID #define FAKE_PROBE_ID TV_CONEXANT #endif #endif #ifdef FAKE_CHRONTEL #define FAKE_MMIO #define FAKE_CRTC #define FAKE_I2C #define FAKE_PROBE_ADDR 0xEA #define FAKE_PROBE_CHRONTEL #ifndef FAKE_PROBE_ID #define FAKE_PROBE_ID TV_CHRONTEL_7007 #endif #endif #ifdef FAKE_PHILIPS #define FAKE_MMIO #define FAKE_CRTC #define FAKE_I2C #define FAKE_PROBE_ADDR 0x88 #define FAKE_PROBE_PHILIPS #ifndef FAKE_PROBE_ID #define FAKE_PROBE_ID TV_PHILIPS_7102 #endif #endif #ifdef FAKE_TV #define FAKE_MMIO #define FAKE_CRTC #endif #endif /* _DEBUG_H */ nvtv-0.4.7/src/error.h0000644000175000001440000000421710020723072010262 /* NVTV error header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: error.h,v 1.4 2004/03/01 21:08:10 dthierbach Exp $ * * Contents: * * Error handling. * */ #ifndef _ERROR_H #define _ERROR_H #include #include "debug.h" /* -------- Error handling layer -------- */ /* Error handling must deal with these situations: * * (a) standalone ("nvtv") -- print message to stderr, abort if necessary * (b) server ("nvtvd") -- report message to syslog, handle aborts somehow * (c) library ("libnvtvsimple") -- make message available to caller * (d) as part of X -- use X DEBUG and ErrorF routines. * * So as a unified interface, there is a macro RAISE and message classes. * Cases (a) and (b) are handled here by mapping RAISE to a routine * in nvtv.c or nvtvd.c, and mapping the message classes to numers. * */ #define MSG_ABORT 1 /* critical message; abort after message */ #define MSG_ERROR 2 /* non-critical error */ #define MSG_WARNING 3 /* non-critical warning */ #define MSG_INFO 4 /* information for syslog */ #define MSG_DEBUG 5 /* debug message */ #define MSG_DEBUG_NL 6 /* debug message */ #define RAISE raise_msg void raise_msg (int class, char *format, ...); /* Fake output, FIXME no \n */ #define FPRINTF(X, Y...) /* */ #define xf86Msg(type,format,args...) /* */ #define xf86DrvMsg(scrnIndex,type,format, args...) /* */ #define DEBUG(x) /*x*/ #endif /* _ERROR_H */ nvtv-0.4.7/src/local.h0000644000175000001440000000503210041235163010221 /* NVTV Local header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: local.h,v 1.8 2003/10/10 16:16:57 dthierbach Exp $ * * Contents: * * Header: Local declarations. * * - Defines for GTK2 vs. GTK. * - Define for Bool (must be included after xfree.h for this reason) * - Defines for fixed size types. * * Defines for all basic types, for * a) without X, b) with xfree.h, c) under windows. * Map allocations a) X to normal b) normal to X * */ #ifndef _LOCAL_H #define _LOCAL_H #include "config.h" #include "debug.h" #include "error.h" /* For base types */ #ifdef HAVE_X #include #endif /* -------- GTK -------- */ #ifdef HAVE_GTK #if HAVE_GTK_VERSION == 1 #define my_gdk_screen gdk_screen #define my_gdk_root_window gdk_root_window #define my_gtk_spin_button_set_shadow_type(x, y) gtk_spin_button_set_shadow_type (x,y) #endif #if HAVE_GTK_VERSION == 2 #define my_gdk_screen gdk_x11_get_default_screen() #define my_gdk_root_window gdk_x11_get_default_root_xwindow() #define my_gtk_spin_button_set_shadow_type(x, y) #endif #endif /* HAVE_GTK */ /* -------- Allocation layer -------- */ /* Simulate X via stdlib. nf means 'no failure' */ #define xalloc(_size) malloc(_size) #define xnfcalloc(_num, _size) calloc(_num, _size) #define xcalloc(_num, _size) calloc(_num, _size) #define xfree(_ptr) free(_ptr) #define xrealloc(_ptr, _size) realloc(_ptr, _size) /* -------- Basic types -------- */ #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #define Bool int #ifndef HAVE_X /* Define the base types. If X is not included, and you get the base types from some other include file, please modify it here. */ typedef unsigned char CARD8; typedef unsigned short CARD16; typedef unsigned long CARD32; #endif /* HAVE_X */ #endif /* _LOCAL_H */ nvtv-0.4.7/src/miscstruct.h0000644000175000001440000000524607676546351011366 /* Excerpt from: miscstruct.h and misc.h */ /* $TOG: miscstruct.h /main/11 1998/02/09 14:29:04 kaleb $ */ /*********************************************************** Copyright 1987, 1998 The Open Group All Rights Reserved. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XFree86: xc/programs/Xserver/include/miscstruct.h,v 3.0 1996/02/18 03:45:10 dawes Exp $ */ #ifndef MISCSTRUCT_H #define MISCSTRUCT_H 1 #ifdef HAVE_X #include #else typedef long INT32; typedef void* pointer; #ifndef Bool #define Bool int #endif #endif /* HAVE_X */ /**** misc.h */ #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif /**** miscstruct.h */ typedef struct _Box { short x1, y1, x2, y2; } BoxRec; typedef union _DevUnion { pointer ptr; long val; unsigned long uval; pointer (*fptr)(void); } DevUnion; #endif /* MISCSTRUCT_H */ nvtv-0.4.7/src/mmio.h0000644000175000001440000001650510020723072010075 /* NVTV TV mmio header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: mmio.h,v 1.8 2004/03/01 21:08:10 dthierbach Exp $ * * Contents: * * Header: Extra memory mapped I/O defines * */ #ifndef _MMIO_H #define _MMIO_H /* This is the interface all MMIO and port access goes through. It has * to provide mappings for the following situations: * * 1) Standalone usage: Directly access MMIO hardware * 2) Inside X: Be compatible with X definitions (maybe extra include file?) * 3) During testing: Call test routines * * There is a fourth situation, when the old debug code just printf's * the MMIO accesses. * * The same thing applies to port access, with the additional obligation * to allow for different OSs (Linux, NetBSD, ...) * */ /* -------- Ports -------- */ void mmio_port_perm (unsigned long from, unsigned long num, int turn_on); #if !defined(FAKE_MMIO) && !defined(TEST_HOOKS) /* from xfree common/compiler.h */ #ifndef __NetBSD__ #ifdef linux #include #define OUTB(p,v) outb(v,p) #define INB(p) inb(p) #else /* linux */ /* FIXME: we won't need that for now under Windows */ #define OUTB(p,v) #define INB(p) 0 #endif #if 0 /* Linux def, maybe reusable for Cygwin ... */ static __inline void outb (unsigned char value, unsigned short int port) { __asm__ __volatile__ ("outb %b0,%w1": :"a" (value), "Nd" (port)); } static __inline unsigned char inb (unsigned short int port) { unsigned char _v; __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (port)); return _v; } #endif /* Linux def */ #else /* NetBSD */ static __inline__ u_int8_t inb(port) u_int16_t port; { u_int8_t r; __asm__ __volatile__ ("inb %w1,%0" : "=a" (r) : "Nd" (port)); return r; } static __inline__ void outb(value, port) u_int8_t value; u_int16_t port; { __asm__ __volatile__ ("outb %b0,%w1" : : "a" (value), "Nd" (port)); } #define OUTB(p,v) outb(v,p) #define INB(p) inb(p) #endif /* NetBSD */ #else /* FAKE_MMIO/TEST_HOOKS */ void port_outb (CARD16 port, CARD8 val); CARD8 port_inb (CARD16 port); void port_outw (CARD16 port, CARD16 val); CARD16 port_inw (CARD16 port); #define OUTB(p,v) port_outb(p,v) #define OUTW(p,v) port_outw(p,v) #define INB(p) port_inb(p) #define INW(p) port_inw(p) #endif /* FAKE_MMIO/TEST_HOOKS */ /* -------- MMIO -------- */ /* MMIO defines from X: common/compiler.h */ #define MMIO_IN8(base, offset) \ *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) #define MMIO_IN16(base, offset) \ *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)) #define MMIO_IN32(base, offset) \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) #define MMIO_OUT8(base, offset, val) \ *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) = (val) #define MMIO_OUT16(base, offset, val) \ *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)) = (val) #define MMIO_OUT32(base, offset, val) \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val) /* Extra MMIO defines */ #include "debug.h" #define HEAD 0x2000 #define CRT_INDEX(h) (0x3d4 + (h) * HEAD) #define CRT_DATA(h) (0x3d5 + (h) * HEAD) #define MMIO_H_OUT8(base,h,offset,val) MMIO_OUT8(base,(offset)+(h)*HEAD,val) #define MMIO_H_OUT32(base,h,offset,val) MMIO_OUT32(base,(offset)+(h)*HEAD,val) #define MMIO_H_IN8(base,h,offset) MMIO_IN8(base,(offset)+(h)*HEAD) #define MMIO_H_IN32(base,h,offset) MMIO_IN32(base,(offset)+(h)*HEAD) #define MMIO_H_AND32(base,h,offset,val) MMIO_AND32(base,(offset)+(h)*HEAD,val) #define MMIO_H_OR32(base,h,offset,val) MMIO_OR32(base,(offset)+(h)*HEAD,val) #if !defined(FAKE_MMIO) && !defined(TEST_HOOKS) #define MMIO_AND32(base, offset, val) \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) &= (val) #define MMIO_OR32(base, offset, val) \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) |= (val) #else /* FAKE_MMIO */ #undef MMIO_IN8 #undef MMIO_IN16 #undef MMIO_IN32 #undef MMIO_OUT8 #undef MMIO_OUT16 #undef MMIO_OUT32 #endif #ifdef TEST_HOOKS CARD8 mmio_in8 (void* base, unsigned offset); CARD16 mmio_in16 (void* base, unsigned offset); CARD32 mmio_in32 (void* base, unsigned offset); void mmio_out8 (void* base, unsigned offset, CARD8 val); void mmio_out16 (void* base, unsigned offset, CARD16 val); void mmio_out32 (void* base, unsigned offset, CARD32 val); void mmio_and32 (void* base, unsigned offset, CARD32 val); void mmio_or32 (void* base, unsigned offset, CARD32 val); #define MMIO_IN8(base, offset) mmio_in8 ((void *)base, offset) #define MMIO_IN16(base, offset) mmio_in16 ((void *)base, offset) #define MMIO_IN32(base, offset) mmio_in32 ((void *)base, offset) #define MMIO_OUT8(base, offset, val) mmio_out8 ((void *)base, offset, val) #define MMIO_OUT16(base, offset, val) mmio_out16 ((void *)base, offset, val) #define MMIO_OUT32(base, offset, val) mmio_out32 ((void *)base, offset, val) #define MMIO_AND32(base, offset, val) mmio_and32 ((void *)base, offset, val) #define MMIO_OR32(base, offset, val) mmio_or32 ((void *)base, offset, val) #else /* TEST_HOOKS */ #ifdef FAKE_MMIO #ifdef CHECK_MMIO #ifndef CHECK_MMIO_ABORT #define MMIO_CAUGHT FPRINTF ("\nMMIO CHECK trigger in %s:%i\n", __FUNCTION__, __LINE__) #else #define MMIO_CAUGHT FPRINTF ("OOPS %i", 1/0) #endif #define MMIO_RANGE(base, offset) \ ((((((int) base) >> 12) & 0xfff) == CHECK_MMIO_BASE && offset >= CHECK_MMIO_MIN && offset <= CHECK_MMIO_MAX) ? MMIO_CAUGHT : FPRINTF("")), #else #define MMIO_RANGE(base, offset) #endif #define MMIO_IN8(base, offset) \ ( MMIO_RANGE(base, offset) FPRINTF("[%03X/%04X?8] ", \ (((int) base) >> 12) & 0xfff, offset), 0 ) #define MMIO_IN16(base, offset) \ ( MMIO_RANGE(base, offset) FPRINTF("[%03X/%04X?16] ", \ (((int) base) >> 12) & 0xfff, offset), 0 ) #define MMIO_IN32(base, offset) \ ( MMIO_RANGE(base, offset) FPRINTF("[%03X/%04X?32] ", \ (((int) base) >> 12) & 0xfff, offset), 0L ) #define MMIO_OUT8(base, offset, val) \ ( MMIO_RANGE(base, offset) FPRINTF("[%03X/%04X=%02X] ", \ (((int) base) >> 12) & 0xfff, offset, (int) (val)) ) #define MMIO_OUT16(base, offset, val) \ ( MMIO_RANGE(base, offset) FPRINTF("[%03X/%04X=%04X] ", \ (((int) base) >> 12) & 0xfff, offset, (int) (val)) ) #define MMIO_OUT32(base, offset, val) \ ( MMIO_RANGE(base, offset) FPRINTF("[%03X/%04X=%08X] ", \ (((int) base) >> 12) & 0xfff, offset, (int) (val)) ) #define MMIO_AND32(base, offset, val) \ ( MMIO_RANGE(base, offset) FPRINTF("[%03X/%04X&=%08X] ", \ (((int) base) >> 12) & 0xfff, offset, (int) (val)) ) #define MMIO_OR32(base, offset, val) \ ( MMIO_RANGE(base, offset) FPRINTF("[%03X/%04X|=%08X] ", \ (((int) base) >> 12) & 0xfff, offset, (int) (val)) ) #endif /* FAKE_MMIO */ #endif /* TEST_HOOKS */ #endif /* _MMIO_H */ nvtv-0.4.7/src/xbox.h0000644000175000001440000000312607564273642010135 /* NVTV NV TV-Xbox I2C access -- Milosch Meriac * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * Header: * I2C-related by code - Andy Green * Adapted for nvtv - "Milosch Meriac" * */ #ifndef __XBOX_H__ #define __XBOX_H__ enum { ERR_SUCCESS = 0, // completed without error ERR_I2C_ERROR_TIMEOUT = 0x80000001, // I2C action failed because it did not complete in a reasonable time ERR_I2C_ERROR_BUS = 0x80000002, // I2C action failed due to non retryable bus error ERR_BOOT_PIC_ALG_BROKEN = 0x80000101 // PIC algorithm did not pass its self-test }; extern int I2CTransmitCmdGetReturn(unsigned char bPicAddressI2cFormat, unsigned char Cmd); extern int I2CTransmitCmdData(unsigned char bPicAddressI2cFormat, unsigned char Cmd, unsigned char Data, int fMode); extern void I2CTransmitStop(void); #endif/*__XBOX_H__*/ nvtv-0.4.7/src/gui.h0000644000175000001440000000712407564504061007733 /* NVTV Gui -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui.h,v 1.20 2002/11/13 17:13:21 dthierbach Exp $ * * Contents: * * Header: The GTK graphical user interface. */ #ifndef _GUI_H #define _GUI_H #include #include "backend.h" #include "data.h" /* FIXME: Think about global vars */ extern TVRegs gui_regs; extern TVSystem gui_system; extern TVMode *gui_list_mode; extern TVMode *gui_act_mode; extern TVChip gui_tv_chip; extern DataFunc *gui_func; typedef GtkAdjustment GuiNotify; extern GuiNotify *update_crt; extern GuiNotify *update_chip; extern GuiNotify *update_mode; extern GuiNotify *changed_all; typedef enum { ACCEL_FIRST = 0, ACCEL_TV_ON = 0, ACCEL_TV_OFF = 1, ACCEL_SWITCH = 2, ACCEL_CENTER = 3, ACCEL_ADJUST = 4, ACCEL_RESET = 5, ACCEL_PRINT = 6, ACCEL_LAST = 7, } GuiAccelIndex; typedef struct accel_struct { char *label; char *accel; guint key; GdkModifierType mods; } GuiAccel; extern GuiAccel gui_accel [ACCEL_LAST]; typedef struct reg_mask { char *label; int bits; int tick; void *addr; int size; } GuiRegMask; typedef struct flag_mask { char *label; int mask; void *addr; int size; } GuiFlagMask; #define PRINT_CRT_REGS (1 << 0) #define PRINT_CHIP_REGS (1 << 1) #define PRINT_ADJUSTED (1 << 2) #define PRINT_FP_REGS (1 << 3) GtkWidget* create_option_menu (GtkSignalFunc func, ...); GtkWidget *create_arrow_button (GtkTable *table, GtkArrowType arrow_type, int x0, int x1, int y0, int y1); GtkWidget *create_radio_box (int active, gboolean hor_vert, GtkSignalFunc func, GSList **group, ...); GuiNotify *create_notify (void); GtkWidget* create_framed_label (GtkWidget *table, char *title, char *value, int x1, int x2, int x3, int y); GtkLabel *gui_mask_label (GtkWidget *table, char *title, char *val, int x1, int x2, int x3, int y); void gui_mask_checkbutton (GtkWidget *table, GtkObject *changed, GuiFlagMask *m, int x1, int x2, int y); void gui_mask_entry (GtkWidget *table, GtkObject *changed, GuiRegMask *m, int x1, int x2, int x3, int y); void gui_mask_twin_entry (GtkWidget *table, GtkObject *changed, GuiRegMask *m, int x1, int x2, int x3, int x4, int y); void gui_act_mode_set (TVMode *mode); void gui_tv_set (void); void gui_map_cb (GtkWidget *widget, GtkAccelGroup *group); void gui_unmap_cb (GtkWidget *widget, GtkAccelGroup *group); void gui_print_cb (GtkButton *button, gpointer data); void gui_reset_crt_cb (GtkWidget *widget, gpointer data); GtkWidget *gui_regs_page (char *title, GtkAccelGroup *accel_group, int print_mode, GtkObject *update, GtkSignalFunc reset_cb, int reg_x, int reg_y, int reg_lines, GuiRegMask *mask_reg, int twin_x, int twin_y, GuiRegMask *mask_twin, int flag_x, int flag_y, int flag_lines, GuiFlagMask *mask_flag); void gui_main (int argc, char *argv[], CardPtr card_list); #endif /* _GUI_H */ nvtv-0.4.7/src/gui_bt.h0000644000175000001440000000252007671651600010414 /* NVTV GUI (Brooktree part) header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_bt.h,v 1.12 2003/06/11 16:06:24 dthierbach Exp $ * * Contents: * * Header: The GTK graphical user interface. Brooktree part. */ #ifndef _GUI_BT_H #define _GUI_BT_H #include #include "debug.h" #include "gui.h" extern GtkAdjustment *update_bt; GtkWidget *gui_bt_reg1_page (void); GtkWidget *gui_bt_reg2_page (void); GtkWidget *gui_bt_reg3_page (void); GtkWidget *gui_bt_status_page (void); GtkWidget *gui_bt_calc_page (void); void gui_bt_init (void); #endif /* _GUI_BT_H */ nvtv-0.4.7/src/gui_cx.h0000644000175000001440000000245407453102017010416 /* NVTV GUI (Brooktree part) header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_cx.h,v 1.4 2002/04/04 16:49:19 dthierbach Exp $ * * Contents: * * Header: The GTK graphical user interface. Brooktree part. */ #ifndef _GUI_CX_H #define _GUI_CX_H #include "debug.h" #include "gui.h" #include "nv_type.h" GtkWidget *gui_cx_reg1_page (void); GtkWidget *gui_cx_reg2_page (void); GtkWidget *gui_cx_reg3_page (void); GtkWidget *gui_cx_reg4_page (void); GtkWidget *gui_cx_status_page (void); void gui_cx_init (void); #endif /* _GUI_CX_H */ nvtv-0.4.7/src/gui_ch.h0000644000175000001440000000234207625455712010410 /* NVTV GUI (Chrontel part) header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_ch.h,v 1.5 2003/02/21 17:03:06 dthierbach Exp $ * * Contents: * * Header: The GTK graphical user interface. Chrontel part. */ #ifndef _GUI_CH_H #define _GUI_CH_H #include "debug.h" #include "gui.h" #include "nv_type.h" GtkWidget *gui_ch_reg1_page (void); GtkWidget *gui_ch_reg2_page (void); GtkWidget *gui_ch_status_page (void); void gui_ch_init (void); #endif /* _GUI_CH_H */ nvtv-0.4.7/src/gui_ph.h0000644000175000001440000000252207620311214010404 /* NVTV GUI (Philips part) header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_ph.h,v 1.9 2003/02/05 22:39:08 dthierbach Exp $ * * Contents: * * Header: The GTK graphical user interface. Philips part. */ #ifndef _GUI_PH_H #define _GUI_PH_H #include "debug.h" #include "gui.h" #include "nv_type.h" GtkWidget *gui_ph1_reg1_page (void); GtkWidget *gui_ph1_reg2_page (void); GtkWidget *gui_ph2_reg1_page (void); GtkWidget *gui_ph2_reg2_page (void); GtkWidget *gui_ph_status_page (void); GtkWidget *gui_ph_calc_page (void); void gui_ph_init (void); #endif /* _GUI_PH_H */ nvtv-0.4.7/src/gui_nx.h0000644000175000001440000000253307677065171010450 /* NVTV GUI (NX part) header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_nx.h,v 1.2 2003/06/27 16:02:01 dthierbach Exp $ * * Contents: * * Header: The GTK graphical user interface. Nvidia internal NX encoder part. */ #ifndef _GUI_NX_H #define _GUI_NX_H #include #include "debug.h" #include "gui.h" extern GtkAdjustment *update_nx; GtkWidget *gui_nx_reg1_page (void); GtkWidget *gui_nx_reg2_page (void); GtkWidget *gui_nx_filt1_page (void); GtkWidget *gui_nx_filt2_page (void); GtkWidget *gui_nx_filt3_page (void); void gui_nx_init (void); #endif /* _GUI_NX_H */ nvtv-0.4.7/src/gui_i810.h0000644000175000001440000000214107531460412010461 /* NVTV GUI (CRTC I810 part) header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_i810.h,v 1.1 2002/08/23 16:21:30 dthierbach Exp $ * * Contents: * * Header: The GTK graphical user interface. CRTC I810 part. */ #ifndef _GUI_I810_H #define _GUI_I810_H #include GtkWidget *gui_i810_page (void); #endif /* _GUI_I810_H */ nvtv-0.4.7/src/gui_nv.h0000644000175000001440000000216507564504061010436 /* NVTV GUI (CRTC NV part) header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_nv.h,v 1.3 2002/11/13 17:13:21 dthierbach Exp $ * * Contents: * * Header: The GTK graphical user interface. CRTC NV part. */ #ifndef _GUI_NV_H #define _GUI_NV_H #include GtkWidget *gui_nv_page (void); GtkWidget *gui_nv_fp_page (void); #endif /* _GUI_NV_H */ nvtv-0.4.7/src/gui_tdfx.h0000644000175000001440000000214107531460413010746 /* NVTV GUI (CRTC 3dfx part) header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: gui_tdfx.h,v 1.1 2002/08/23 16:21:31 dthierbach Exp $ * * Contents: * * Header: The GTK graphical user interface. CRTC 3dfx part. */ #ifndef _GUI_TDFX_H #define _GUI_TDFX_H #include GtkWidget *gui_tdfx_page (void); #endif /* _GUI_TDFX_H */ nvtv-0.4.7/src/nvtv.h0000644000175000001440000000422310005515125010124 /* NVTV main header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: nvtv.h,v 1.2 2004/01/27 17:05:25 dthierbach Exp $ * * Contents: Global variables. */ #ifndef _MAIN_H #define _MAIN_H #include "tv_chip.h" #include "backend.h" /* only for ChipPtr ... */ typedef struct _OptIntDecl { char *name; int min, max; int *addr; } OptIntDecl; typedef struct _OptIntVal { int val; int *addr; struct _OptIntVal *link; } OptIntVal; typedef struct _OptFlagDecl { char *name; int mask; int *addr_val; int *addr_mask; } OptFlagDecl; void modifySet (TVSettings *s, OptIntVal *m); /* only opt_set for now */ ChipPtr findDefOptChip (CardPtr card); extern OptIntVal *opt_set_act; extern Bool opt_no_root; extern TVSystem opt_system; /* use if != TV_SYSTEM_NONE */ extern TVConnect opt_connect; /* use if != CONNECT_NONE */ extern TVSettings opt_set; extern TVChip opt_tv_chip; /* use if != TV_NO_CHIP */ int opt_tv_bus, opt_tv_addr; /* use if == TV_CHIP_BY_ADDR */ #if HAVE_X extern Window opt_window; /* use if != None */ #endif extern int opt_res_x, opt_res_y; /* use if both != -1 */ extern float opt_hoc, opt_voc; /* use if both != -1.0 */ extern char *opt_size; /* use if != NULL */ extern int opt_head; /* use if != -1 */ extern int opt_service_flags; extern int opt_service_mask; extern int opt_mode_flags; extern int opt_mode_mask; #endif nvtv-0.4.7/src/pipe.h0000644000175000001440000000746210023540453010076 /* NVTV pipe header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: pipe.h,v 1.20 2004/03/10 07:18:03 dthierbach Exp $ * * Contents: * * Routine prototypes to access the named pipe for server/client * communication, and communication protocol constants. * */ #ifndef _PIPE_H #define _PIPE_H #include #ifndef CONFIG_PIPE_PATH #define CONFIG_PIPE_PATH "/var/run" #endif #define PIPE_IN CONFIG_PIPE_PATH "/nvtv-in" #define PIPE_OUT CONFIG_PIPE_PATH "/nvtv-out" #define PIPE_VERSION 0x000407 /* 0.4.7 */ /* even numbered commands expect no return, odd numbered commands do */ typedef enum { PCmd_None = 0, /* In: None */ PCmd_Init = 1, /* In: None; Out: card list */ PCmd_Kill = 2, /* In: None */ PCmd_Version = 3, /* In: None; Out: version */ PCmd_CloseCard = 10, /* In: None */ PCmd_OpenCard = 11, /* In: Card index; Out: chip list */ PCmd_SetChip = 12, /* In: Chip index, init; */ PCmd_ProbeChips = 13, /* In: None; Out: chip list */ PCmd_SetSettings = 14, /* In: Settings; */ PCmd_GetSettings = 15, /* In: None; Out: Settings */ PCmd_SetMode = 16, /* In: Regs */ PCmd_GetMode = 17, /* In: None; Out: Regs */ PCmd_SetModeSettings = 18, /* In: Regs, Settings; */ PCmd_SetTestImage = 20, /* In: EncRegs, Setttings; */ PCmd_GetStatus = 23, /* In: Index; Out: status */ PCmd_GetConnection = 25, /* In: None; Out: connect */ PCmd_FindBySize = 31, /* In: System, x, y, size; Out: mode */ PCmd_FindByOverscan = 33, /* In: System, x, y, hoc, voc; Out: mode */ PCmd_ListModes = 35, /* In: System Out: int, modes */ PCmd_SetHeads = 40, /* In: 3 heads */ PCmd_GetHeads = 41, /* In: None; Out: 3 heads */ PCmd_GetHeadDev = 43, /* In: Head; Out: Dev Flags */ PCmd_InitSharedView = 51, /* In: None; Out: 4 int */ PCmd_GetTwinView = 53, /* In: None; Out: 2 int, bool */ PCmd_AdjustView = 55, /* In: 3 int; Out: 2 int, bool */ PCmd_ServiceVC = 57, /* In: 5 int; Out: 2 int, bool */ } PipeCmd; PipeCmd pipeReadCmd (FILE *pipe); void pipeWriteCmd (FILE *pipe, PipeCmd cmd); int pipeReadArgs (FILE *pipe, int n, ...); int pipeReadArgsOpt (FILE *pipe, int n, ...); void pipeWriteArgs (FILE *pipe, int n, ...); void* pipeReadList (FILE *pipe, int size); void pipeWriteList (FILE *pipe, int size, void *list); void pipeReadArray (FILE *pipe, int *nelem); void pipeWriteArray (FILE *pipe, int nelem, int nsub); #endif /* _PIPE_H */ nvtv-0.4.7/src/print.h0000644000175000001440000000217207571657670010316 /* NVTV print -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: print.h,v 1.1 2002/11/29 12:38:16 dthierbach Exp $ * * Header: Printing actions. */ #ifndef _PRINT_H #define _PRINT_H #include "tv_chip.h" void print_fp_regs (TVCrtcRegs *m, CardType card); void print_crt_regs (TVCrtcRegs *m, CardType card); void print_tv_regs (TVEncoderRegs *r, TVChip chip); #endif nvtv-0.4.7/src/i810_type.h0000644000175000001440000000201210005524505010645 /* NVTV i810_type -- Dirk Thierbach * * Extends the TDFXRec type from tdfx.h and introduces new types, and should * eventually be merged with the original XFree file. * */ #ifndef _TDFX_TYPE_H #define _TDFX_TYPE_H #include "xf86i2c.h" #include "debug.h" #include "tv_common.h" #define I810_MAXBUS 3 typedef struct _I810Rec *I810Ptr; typedef struct { int heads; /* Number of heads (= pipes) */ int major; /* Major architecture, 0x10 for I810, 0x30 for I830 */ } IntelArch; typedef struct _I810Rec { unsigned char *MMIOBase; unsigned char *FbBase; /* ... */ int Chipset; /* FIXME Unused, instead in ScreenInfoRec ? */ /* ... */ /* new members: */ IntelArch arch; TVEncoderObj tvEncoder; I2CChainPtr TvChain; /* chain of devices on all busses */ I2CBusPtr TvBusses[I810_MAXBUS]; int TvMaxBus; I2CDevPtr TvDev; } I810Rec; #define I810PTR(p) ((I810Ptr)((p)->driverPrivate)) #endif /* _TDFX_TYPE_H */ nvtv-0.4.7/src/nv_type.h0000644000175000001440000000303010021315440010602 /* NVTV nv_type -- Dirk Thierbach * * Extends the NVRec type and introduces new types, and should * eventually be merged with the original XFree file. * */ #ifndef _NV_TYPE_H #define _NV_TYPE_H #include "xfree.h" #include "xf86i2c.h" #include "tv_common.h" /* Number of TV Busses */ #define NV_MAXBUS 3 typedef struct { int major; /* major architecutre, replaces riva.architecture */ int exact; /* exact architecture */ int heads; /* number of heads */ CARD32 boot; /* boot mask */ long crystalFreq; /* replaces riva.CrystalFreqKHz */ long minVco; /* minimum frequency of VCO for VPLL, in kHz */ long maxVco; /* maximum frequency of VCO for VPLL, in kHz */ long maxVclk[2]; /* maximum frequency of VPLL, per head, in kHz */ long freqM[4]; /* ascending limit frequencies for maxM, in kHz */ int maxM[4]; /* maximum M below limit frequency; ends with 0 */ int maxP; /* maximum P */ int minM; /* minimum M */ } NVArch; typedef struct { RIVA_HW_INST riva; /* ... */ CARD32 IOAddress; /* ... */ int Chipset; /* ... */ /* new members */ NVArch arch; /* Architecture dependend info */ TVEncoderObj tvEncoder; I2CChainPtr TvChain; /* chain of devices on all busses */ I2CBusPtr TvBusses[NV_MAXBUS]; int TvMaxBus; int TvHead; /* head tv bus is associated to */ } NVRec, *NVPtr; #define NVPTR(p) ((NVPtr)((p)->driverPrivate)) #endif /* _NV_TYPE_H */ nvtv-0.4.7/src/tdfx_type.h0000644000175000001440000000146207620034341011144 /* NVTV tdfx_type -- Dirk Thierbach * * Extends the TDFXRec type from tdfx.h and introduces new types, and should * eventually be merged with the original XFree file. * */ #ifndef _TDFX_TYPE_H #define _TDFX_TYPE_H #include "xf86i2c.h" #include "debug.h" #include "tv_common.h" typedef struct _TDFXRec *TDFXPtr; #define MAXCHIPS 4 typedef struct _TDFXRec { unsigned char *MMIOBase[MAXCHIPS]; unsigned char *FbBase; unsigned char *myFbBase; unsigned int PIOBase[MAXCHIPS]; int IOBase; /* normally, this is in the vgaHWRec */ /* ... */ /* new members: */ TVEncoderObj tvEncoder; I2CChainPtr TvChain; /* chain of devices on all busses */ I2CBusPtr TvBus; } TDFXRec; #define TDFXPTR(p) ((TDFXPtr)((p)->driverPrivate)) #endif /* _TDFX_TYPE_H */ nvtv-0.4.7/src/tv_chip.h0000644000175000001440000005055507677065171010622 /* NVTV tv_chip header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_chip.h,v 1.36 2003/06/27 16:02:01 dthierbach Exp $ * * Contents: * * Header: Structures and defines for the Brooktree, the Chrontel and the * Philips chip. This part could eventually become a part of the XFree * NV-Driver. * */ #ifndef _TV_CHIP_H #define _TV_CHIP_H typedef enum { TYPE_NONE = 0, TYPE_INT = 1, TYPE_ULONG = 2, } VarType; typedef enum { CARD_NONE = 0, CARD_FIRST = 1, CARD_NVIDIA = 1, CARD_TDFX = 2, CARD_I810 = 3, CARD_XBOX = 4, CARD_LAST = 4, } CardType; typedef enum { TV_SYSTEM_NONE = -1, TV_SYSTEM_NTSC = 0, TV_SYSTEM_NTSC_J = 1, /* same as NTSC_60 */ TV_SYSTEM_PAL = 2, TV_SYSTEM_PAL_60 = 3, TV_SYSTEM_PAL_N = 4, TV_SYSTEM_PAL_NC = 5, TV_SYSTEM_PAL_M = 6, TV_SYSTEM_PAL_M60 = 7, TV_SYSTEM_PAL_X = 8, /* Fake PAL System to correct color carriers, useful at least in Sweden PAL-B */ TV_SYSTEM_SECAM = 9, /* only on Conexant chips */ } TVSystem; typedef enum { TV_CHIP_BY_ADDR = -1, TV_NO_CHIP = 0, TV_CHRONTEL = 0x1000, TV_CHRONTEL_MODEL1 = 0x1100, TV_CHRONTEL_MODEL2 = 0x1200, TV_CHRONTEL_7003 = 0x1103, TV_CHRONTEL_7004 = 0x1104, TV_CHRONTEL_7005 = 0x1105, TV_CHRONTEL_7006 = 0x1106, TV_CHRONTEL_7007 = 0x1107, TV_CHRONTEL_7008 = 0x1108, TV_CHRONTEL_7009 = 0x1201, TV_CHRONTEL_7010 = 0x1202, TV_CHRONTEL_7011 = 0x1203, TV_CHRONTEL_7012 = 0x1204, TV_BROOKTREE = 0x2100, TV_CONEXANT = 0x2200, TV_PHILIPS = 0x3000, TV_PHILIPS_MODEL1 = 0x3100, TV_PHILIPS_MODEL2 = 0x3200, TV_PHILIPS_7102 = 0x3100, TV_PHILIPS_7103 = 0x3101, TV_PHILIPS_7108 = 0x3102, TV_PHILIPS_7109 = 0x3103, TV_PHILIPS_7104 = 0x3200, TV_PHILIPS_7105 = 0x3201, TV_PHILIPS_7108A = 0x3202, TV_PHILIPS_7109A = 0x3203, TV_NVIDIA = 0x4000, TV_NVIDIA_A = 0x4001, TV_NVIDIA_B = 0x4002, } TVChip; #define CARD_SHIFT 0 /* must fit into TV_ENCODER mask */ #define TV_COMPANY 0xf000 /* mask for company encoder type */ #define TV_ENCODER 0xff00 /* mask for principal encoder type */ /* -------- Host interface flags, all chips -------- */ /* These constants are used both for the host port and the encoder port. Direction is seen in both cases from the encoder, so "in" means "to encoder", "out" means "to host" */ #define PORT_SYNC_DIR (1 << 0) #define PORT_SYNC_OUT (0 << 0) #define PORT_SYNC_IN (1 << 0) #define PORT_SYNC_MASTER PORT_SYNC_OUT #define PORT_SYNC_SLAVE PORT_SYNC_IN #define PORT_BLANK_MODE (1 << 1) #define PORT_BLANK_REGION (0 << 1) #define PORT_BLANK_DOTCLK (1 << 1) #define PORT_BLANK_DIR (1 << 2) #define PORT_BLANK_OUT (0 << 2) #define PORT_BLANK_IN (1 << 2) #define PORT_PCLK_MODE (1 << 3) #define PORT_PCLK_MASTER (0 << 3) #define PORT_PCLK_SLAVE (1 << 3) #define PORT_VSYNC_POLARITY (1 << 4) #define PORT_VSYNC_LOW (0 << 4) #define PORT_VSYNC_HIGH (1 << 4) #define PORT_HSYNC_POLARITY (1 << 5) #define PORT_HSYNC_LOW (0 << 5) #define PORT_HSYNC_HIGH (1 << 5) #define PORT_BLANK_POLARITY (1 << 6) #define PORT_BLANK_LOW (0 << 6) #define PORT_BLANK_HIGH (1 << 6) #define PORT_PCLK_POLARITY (1 << 7) #define PORT_PCLK_LOW (0 << 7) #define PORT_PCLK_HIGH (1 << 7) #define PORT_FORMAT_MASK (3 << 8) #define PORT_FORMAT_MASK_COLOR (1 << 8) #define PORT_FORMAT_MASK_ALT (2 << 8) #define PORT_FORMAT_RGB (0 << 8) #define PORT_FORMAT_YCRCB (1 << 8) #define PORT_FORMAT_ALT_RGB (2 << 8) #define PORT_FORMAT_ALT_YCRCB (3 << 8) #define PORT_XBOX \ (PORT_VSYNC_HIGH | PORT_HSYNC_HIGH | PORT_SYNC_IN | \ PORT_BLANK_LOW | PORT_BLANK_OUT | PORT_PCLK_HIGH | PORT_PCLK_MASTER | \ PORT_FORMAT_ALT_YCRCB) #define PORT_NVIDIA \ (PORT_VSYNC_HIGH | PORT_HSYNC_HIGH | PORT_SYNC_OUT | \ PORT_BLANK_LOW | PORT_BLANK_OUT | PORT_PCLK_HIGH | PORT_PCLK_MASTER | \ PORT_FORMAT_RGB) #define PORT_NVIDIA_SYNC_SLAVE \ (PORT_VSYNC_HIGH | PORT_HSYNC_HIGH | PORT_SYNC_IN | \ PORT_BLANK_LOW | PORT_BLANK_OUT | PORT_PCLK_HIGH | PORT_PCLK_MASTER | \ PORT_FORMAT_RGB) #define PORT_NVIDIA_PCLK_SLAVE \ (PORT_VSYNC_HIGH | PORT_HSYNC_HIGH | PORT_SYNC_OUT | \ PORT_BLANK_LOW | PORT_BLANK_OUT | PORT_PCLK_HIGH | PORT_PCLK_SLAVE | \ PORT_FORMAT_RGB) #define PORT_TDFX \ (PORT_VSYNC_HIGH | PORT_HSYNC_HIGH | PORT_SYNC_OUT | \ PORT_BLANK_LOW | PORT_BLANK_IN | PORT_BLANK_REGION | \ PORT_PCLK_HIGH | PORT_PCLK_MASTER | PORT_FORMAT_RGB) #define PORT_I810 \ (PORT_VSYNC_LOW | PORT_HSYNC_LOW | PORT_SYNC_IN | \ PORT_BLANK_LOW | PORT_BLANK_OUT | PORT_PCLK_HIGH | PORT_PCLK_MASTER | \ PORT_FORMAT_RGB) /* -------- Brooktree -------- */ #define BT_FLAG1_NI_OUT (1 << 0) #define BT_FLAG1_SETUP (1 << 1) #define BT_FLAG1_625LINE (1 << 2) #define BT_FLAG1_VSYNC_DUR (1 << 3) #define BT_FLAG1_DIS_SCRESET (1 << 4) #define BT_FLAG1_PAL_MD (1 << 5) #define BT_FLAG1_ECLIP (1 << 6) #define BT_FLAG1_EN_ASYNC (1 << 8) #define BT_FLAG1_SYSTEM (BT_FLAG1_VSYNC_DUR | BT_FLAG1_SETUP | \ BT_FLAG1_PAL_MD | BT_FLAG1_625LINE) #define BT_FLAG1_NTSC (BT_FLAG1_VSYNC_DUR | BT_FLAG1_SETUP) #define BT_FLAG1_NTSC_J (BT_FLAG1_VSYNC_DUR) #define BT_FLAG1_PAL_BDGHI (BT_FLAG1_PAL_MD | BT_FLAG1_625LINE) #define BT_FLAG1_PAL_N (BT_FLAG1_VSYNC_DUR | BT_FLAG1_SETUP | \ BT_FLAG1_PAL_MD | BT_FLAG1_625LINE) #define BT_FLAG1_PAL_M (BT_FLAG1_VSYNC_DUR | BT_FLAG1_SETUP | \ BT_FLAG1_PAL_MD) #define BT_FLAG1_PAL_BDGHI (BT_FLAG1_PAL_MD | BT_FLAG1_625LINE) #define BT_FLAG1_PAL_60 (BT_FLAG1_PAL_MD | BT_FLAG1_VSYNC_DUR) #define BT_FLAG2_DIS_FFILT (1 << 0) #define BT_FLAG2_DIS_YFLPF (1 << 1) #define BT_FLAG2_DIS_GMSHY (1 << 2) #define BT_FLAG2_DIS_GMUSHY (1 << 3) #define BT_FLAG2_DIS_GMSHC (1 << 4) #define BT_FLAG2_DIS_GMUSHC (1 << 5) #define BT_FLAG2_DIS_CHROMA (1 << 6) #define BT_FLAG2_DIS_GM (BT_FLAG2_DIS_GMSHY | BT_FLAG2_DIS_GMUSHY \ | BT_FLAG2_DIS_GMSHC | BT_FLAG2_DIS_GMUSHC) #define BT_FLAG3_DACDISA (1 << 0) #define BT_FLAG3_DACDISB (1 << 1) #define BT_FLAG3_DACDISC (1 << 2) #define BT_FLAG3_DACDISD (1 << 3) #define BT_FLAG3_DAC (BT_FLAG3_DACDISA | BT_FLAG3_DACDISB \ | BT_FLAG3_DACDISC | BT_FLAG3_DACDISD) #define BT_FLAG3_COMPOSITE (BT_FLAG3_DACDISB | BT_FLAG3_DACDISC) #define BT_FLAG3_SVIDEO (BT_FLAG3_DACDISA) #define BT_FLAG3_CONVERT (BT_FLAG3_DACDISA) #define BT_FLAG3_BOTH 0 /* DACDISD is available only for the Conexant chip, and is reserved for the Brooktree chip. It is reset by default */ /* FIXME URGENT: Conexant doc says no more than 1 DAC should be disabled */ typedef struct { int hsynoffset; /* time */ int vsynoffset; /* time */ int hsynwidth; /* time */ /* don't confuse with hsync_width ! */ int vsynwidth; /* time */ int h_clko; /* time */ int h_active; /* time */ int hsync_width; /* time(system) */ int hburst_begin; /* time(system) */ int hburst_end; /* time(system) */ int h_blanko; /* time */ int v_blanko; /* time */ int v_activeo; /* time */ int h_fract; /* time */ int h_clki; /* time */ int h_blanki; /* time */ int v_linesi; /* time */ int v_blanki; /* time */ int v_activei; /* time */ int v_scale; /* time */ int pll_fract; /* time */ int pll_int; /* time */ int sync_amp; /* level(system) */ int bst_amp; /* level(system) */ int mcr; /* level(system) */ int mcb; /* level(system) */ int my; /* level(system) */ unsigned long msc; /* time */ int flags1; /* time */ int flags2; /* func */ int flags3; /* func */ int f_selc; /* func */ int f_sely; /* func */ int ycoring; /* func */ int ccoring; /* func */ int yattenuate; /* func */ int cattenuate; /* func */ int ylpf; /* func */ int clpf; /* func */ int out_muxa; /* func */ int out_muxb; /* func */ int out_muxc; /* func */ int out_muxd; /* func */ int phase_off; /* time(?) */ int macro; /* time(all) */ } TVBtRegs; /* -------- Conexant -------- */ #define CX_FLAG1_FM (1 << 7) #define CX_FLAG1_EXT (1 << 9) /* Is extension, don't init */ #define CX_FLAG4_PROG_SC (1 << 0) #define CX_FLAG4_SC_PATTERN (1 << 1) #define CX_FLAG4_FIELD_ID (1 << 3) #define CX_FLAG4_BY_YCCR (1 << 6) #define CX_FLAG4_CHROMA_BW (1 << 7) #define CX_FLAG4_MASK (CX_FLAG4_PROG_SC | CX_FLAG4_SC_PATTERN | \ CX_FLAG4_FIELD_ID | CX_FLAG4_BY_YCCR | \ CX_FLAG4_CHROMA_BW) #define CX_FLAG5_ADPT_FF (1 << 0) #define CX_FLAG5_FFRTN (1 << 1) #define CX_FLAG5_YSELECT (1 << 2) #define CX_FLAG5_DIV2 (1 << 4) #define CX_FLAG5_PLL_32CLK (1 << 5) #define CX_FLAG5_PIX_DOUBLE (1 << 6) #define CX_FLAG5_EWSSF1 (1 << 8) #define CX_FLAG5_EWSSF2 (1 << 9) typedef struct { TVBtRegs bt; unsigned long msc_db; /* time */ int dr_limitp; /* time */ int dr_limitn; /* time */ int db_limitp; /* time */ int db_limitn; /* time */ int filfsconv; /* ?? */ int filincr; /* ?? */ /* fil4286incr */ int flags4; /* time & func */ int flags5; /* time & func */ int mcompy; /* level */ int mcompu; /* level */ int mcompv; /* level */ int y_off; /* level */ int hue_adj; /* time(?) */ long wsdat; /* time */ int wssinc; /* time */ int c_altff; /* func */ int y_altff; /* func */ int c_thresh; /* func */ int y_thresh; /* func */ int pkfil_sel; /* func */ } TVCxRegs; /* -------- Chrontel -------- */ #define CH_FLAG_DAC 1:0 #define CH_FLAG_DAC_MASK 3 #define CH_FLAG_DAC_PD0 (1 << 0) #define CH_FLAG_DAC_PD1 (1 << 1) #define CH_FLAG_DAC_PD2 (1 << 2) #define CH_FLAG_DAC_PD3 (1 << 3) #define CH_FLAG_COMPOSITE 2 #define CH_FLAG_SVIDEO 0 #define CH_FLAG_BOTH 3 #define CH_FLAG_CFRB (1 << 5) #define CH_FLAG_CVBW (1 << 6) #define CH_FLAG_SCART (1 << 7) #define CH_FLAG_POUTP (1 << 8) #define CH_FLAG_ACIV (1 << 9) typedef struct { int dmr_ir; /* time */ int dmr_vs; /* time */ int dmr_sr; /* time */ int ffr_fc; /* func */ int ffr_fy; /* func */ int ffr_ft; /* func */ int vbw_flff; /* func */ /* flag */ int vbw_cbw; /* func */ int vbw_ypeak; /* func */ /* flag */ int vbw_ysv; /* func */ int vbw_ycv; /* func */ /* flag */ int dacg; /* level(system) */ /* flag */ int civh; /* func */ int sav; /* time */ int blr; /* level(system) */ int hpr; /* func/time */ int vpr; /* func/time */ int ce; /* func */ int te; /* func, CH7009 only */ int pll_m; /* time */ int pll_n; /* time */ int pllcap; /* time */ /* flag */ unsigned long fsci; #if 0 /* Test register; no documentation */ int ylm; /* y multiplier ? */ int clm; /* c multiplier ? */ #endif int flags; /* func */ int mode; /* for macrovision table */ int macro; } TVChRegs; /* -------- Philips -------- */ #define PH_FLAG1_FISE (1 << 0) #define PH_FLAG1_PAL (1 << 1) #define PH_FLAG1_SCBW (1 << 2) #define PH_FLAG1_YGS (1 << 4) #define PH_FLAG1_YFIL (1 << 8) #define PH_FLAG1_MASK (PH_FLAG1_FISE | PH_FLAG1_PAL | \ PH_FLAG1_SCBW | PH_FLAG1_YGS) #define PH_FLAG2_CVBSEN2 (1 << 1) /* Model2 only */ #define PH_FLAG2_CEN (1 << 4) #define PH_FLAG2_CVBSEN0 (1 << 5) #define PH_FLAG2_CVBSEN1 (1 << 6) #define PH_FLAG2_VBSEN (1 << 7) #define PH_FLAG2_MASK (PH_FLAG2_CEN | PH_FLAG2_CVBSEN0 | \ PH_FLAG2_CVBSEN1 | PH_FLAG2_CVBSEN2 | \ PH_FLAG2_VBSEN) #define PH_FLAG2_NORMAL (PH_FLAG2_CEN | PH_FLAG2_CVBSEN0 | \ PH_FLAG2_VBSEN) #define PH_FLAG2_CONVERT (PH_FLAG2_CEN | PH_FLAG2_CVBSEN0 | \ PH_FLAG2_CVBSEN1) #define PH_FLAG2_COMPOSITE PH_FLAG2_NORMAL #define PH_FLAG2_SVIDEO PH_FLAG2_NORMAL #define PH_FLAG2_BOTH PH_FLAG2_NORMAL typedef struct { int adwhs; /* time */ int adwhe; /* time */ int xofs; /* time */ int xpix; /* time */ int xinc; /* time */ int hlen; /* time */ int fal; /* time */ int lal; /* time */ int yinc; /* time */ int yskip; /* time */ int yofso; /* time */ int yofse; /* time */ int ypix; /* time */ int yiwgto; /* time */ int yiwgte; /* time */ long pcl; /* time */ long fsc; /* time */ int idel; /* init */ int bs; /* time(system) */ int be; /* time(system) */ int bsta; /* level(system) */ int blckl; /* level(system) */ int blnnl; /* level(system) */ int chps; /* time(phase) */ int gy; /* level */ int gcd; /* level */ int bcy; /* func */ int bcu; /* func */ int bcv; /* func */ int ccrs; /* func */ int gainu; /* func */ int gainv; /* func */ int flc; /* time */ int phres; /* func(phase) */ int flags1; int flags2; int flags3; int macro; } TVPh1Regs; #define PH_FLAG3_XINT (1 << 0) /* interpol. filter for upscaling */ #define PH_FLAG3_IFBP (1 << 4) /* (for high pixel rates) */ #define PH_FLAG3_IFRA (1 << 5) #define PH_FLAG3_YUPSC (1 << 6) /* y upscaling enabled */ #define PH_FLAG3_EIDIV (1 << 7) typedef struct { TVPh1Regs super; /* watch alignment? */ int yfil; int fili; int pcle; int pcli; int flags3; } TVPh2Regs; /* -------- NVidia internal -------- */ #define NX_FLAG1_DACA (1 << 0) #define NX_FLAG1_DACB (1 << 1) #define NX_FLAG1_DACC (1 << 2) #define NX_FLAG1_COMPOSITE (NX_FLAG1_DACB | NX_FLAG1_DACC) #define NX_FLAG1_SVIDEO (NX_FLAG1_DACA | NX_FLAG1_DACB) #define NX_FLAG1_BOTH (NX_FLAG1_DACA | NX_FLAG1_DACB | NX_FLAG1_DACC) #define NX_FLAG_CONN_3 (1 << 0) #define NX_FLAG_CONN_5 (1 << 1) #define NX_FLAG_SYS_0 (1 << 2) #define NX_FLAG_SYS_3 (1 << 3) #define NX_FLAG_SYS_6 (1 << 4) /* "Indirect" registers -- dependent on TV System */ typedef struct { unsigned long fsub; int nxreg04; int nxreg08; int nxreg09; int nxreg0a; int nxreg0b; int nxreg0c; int nxreg0e; int nxreg10; int nxreg17; int nxreg1e; int nxreg20; int nxreg22; int nxreg29; int nxreg2c; int nxreg31; /* active_h * 2 */ int nxreg35; int nxreg3c; int nxsys12; /* reg34/sysflags */ int flags; /* reg34/sysflags, reg07/connflags */ } TVNxIndRegs; /* Image (resolution and size) dependent regs */ typedef struct { int scaler_h; int scaler_v; int overscan; int vip1; int vip2; } TVNxImgRegs; typedef struct { TVNxIndRegs ind; TVNxImgRegs img; int filter; int filt_x1[4][7]; int filt_x2[4][7]; int filt_y [4][7]; int muxa, muxb, muxc; int flags1; } TVNxRegs; /* -------- CRT -------- */ /* Flags for devices */ #define DEV_MONITOR (1 << 0) #define DEV_TELEVISION (1 << 1) #define DEV_FLATPANEL (1 << 2) #define DEV_OVERLAY (1 << 3) #define DEV_INTERNAL (1 << 4) /* Flags that describe the mode, capabilities and defaults (in TVMode.descFlags). TODO: Get rid of Dualview, etc. */ #define TV_DESC_DUALVIEW (1 << 2) /* Default dualview */ #define TV_DESC_MACROVISION (1 << 3) /* Default macrovision */ #define TV_DESC_NONINTERLACED (1 << 4) /* Default noninterlace */ #define TV_DESC_MONOCHROME (1 << 5) /* Default monochrome */ #define TV_DESC_CARRIER_LOCK (1 << 6) /* Default carrier lock */ #define TV_DESC_COLORFIX (1 << 7) /* Default color fix */ #define TV_CAP_DUALVIEW (1 << 10) /* Has dualview */ #define TV_CAP_MACROVISION (1 << 11) /* Has macrovision choice */ #define TV_CAP_NONINTERLACED (1 << 12) /* Has noninterlace */ #define TV_CAP_MONOCHROME (1 << 13) /* Has monochrome */ #define TV_CAP_CARRIER_LOCK (1 << 14) /* Has carrier lock */ #define TV_CAP_COLORFIX (1 << 15) /* Has color fix */ #define TV_CAP_OVERLAY (1 << 24) /* Is overlay mode */ #define TV_CAP_BIT 8 /* Bit shift for DESC -> CAP */ #define TV_CAP_MASK (TV_CAP_DUALVIEW | TV_CAP_MACROVISION | \ TV_CAP_MONOCHROME | TV_CAP_NONINTERLACED | \ TV_CAP_COLORFIX) #define TV_DEF_DUALVIEW (TV_CAP_DUALVIEW | TV_DESC_DUALVIEW) #define NV_FLAG_DOUBLE_SCAN (1 << 0) #define NV_FLAG_DOUBLE_PIX (1 << 1) typedef struct { int HSyncStart; int HSyncEnd; int HTotal; int VSyncStart; int VSyncEnd; int VTotal; int Unknown; } TVNvSlaveRegs; typedef struct { int HDisplay; int HSyncStart; int HSyncEnd; int HTotal; int HValidStart; int HValidEnd; int HCrtc; int VDisplay; int VSyncStart; int VSyncEnd; int VTotal; int VValidStart; int VValidEnd; int VCrtc; } TVNvFpRegs; typedef struct { long clock; /* Pixel clock in kHz, 0 = ignore */ int HDisplay; /* horizontal timing */ int HBlankStart; int HSyncStart; int HSyncEnd; int HBlankEnd; int HTotal; int VDisplay; /* vertical timing */ int VBlankStart; int VSyncStart; int VSyncEnd; int VBlankEnd; int VTotal; int latency; /* internal TV clock delay */ int flags; TVNvSlaveRegs slave; TVNvFpRegs fp; } TVNvRegs; typedef struct { int tvHDisplay; /* horizontal timing */ int tvHBlankStart; int tvHSyncStart; int tvHSyncEnd; int tvHBlankEnd; int tvHTotal; int tvVDisplay; /* vertical timing */ int tvVBlankStart; int tvVSyncStart; int tvVSyncEnd; int tvVBlankEnd; int tvVTotal; int borderRed; int borderGreen; int borderBlue; } TVI810Regs; #define TDFX_FLAG_CLOCK2X (1 << 0) #define TDFX_FLAG_DOUBLE_PIX (1 << 1) #define TDFX_FLAG_HALF_MODE (1 << 2) typedef struct { long clock; /* Pixel clock in kHz, 0 = ignore */ int HDisplay; /* horizontal timing */ int HBlankStart; int HSyncStart; int HSyncEnd; int HBlankEnd; int HTotal; int VDisplay; /* vertical timing */ int VBlankStart; int VSyncStart; int VSyncEnd; int VBlankEnd; int VTotal; int HScreenSize; int VScreenSize; int tvHBlankStart; int tvHBlankEnd; int tvVBlankStart; int tvVBlankEnd; int tvBlankDelay; int tvSyncDelay; int tvLatency; /* internal TV clock delay */ int flags; } TVTdfxRegs; /* -------- Common -------- */ typedef union { TVBtRegs bt; TVCxRegs cx; TVChRegs ch; TVPh1Regs ph1; TVPh2Regs ph2; TVNxRegs nx; } TVEncoderRegs; typedef union { TVNvRegs nv; TVI810Regs i810; TVTdfxRegs tdfx; } TVCrtcRegs; typedef struct { int devFlags; /* device(s) used for this mode */ TVCrtcRegs crtc; TVEncoderRegs enc; int portHost; int portEnc; } TVRegs; /* External mode specification. TODO: Change this into x, y, and list of attributes */ typedef struct { TVSystem system; int res_x; int res_y; char *size; char *aspect; double hoc; double voc; } TVModeSpec; typedef struct { TVModeSpec spec; TVRegs regs; int descFlags; /* capabilities and defaults */ } TVMode; typedef enum { TV_UNKNOWN = 0, TV_OFF = 1, TV_BARS = 2, TV_ON = 3 } TVState; typedef enum { CONNECT_AUTO = -2, CONNECT_NONE = -1, CONNECT_COMPOSITE = 0, CONNECT_SVIDEO = 1, CONNECT_BOTH = 2, CONNECT_CONVERT = 3, /* Composite on both SVideo lines, for converter */ } TVConnect; typedef struct { int tv_hoffset, tv_voffset; int mon_hoffset, mon_voffset; int brightness_sig; /* -50 - 50 % */ int contrast; /* -100 - 100 % */ int contrast_sig; /* -50 - 50 % */ int saturation; /* -100 - 100 % */ int saturation_sig; /* -50 - 50 % */ int phase; /* -90 - 90 deg */ int hue; /* -90 - 90 deg */ int flicker; /* 0 - 100 % */ int flicker_adapt; /* 0 - 100 % */ int luma_bandwidth; /* 0 - 100 % */ int chroma_bandwidth; /* 0 - 100 % */ int sharpness; /* 0 - 100 % */ int cross_color; /* 0 - 100 % */ int flags; TVConnect connector; } TVSettings; /* FIXME: defines for TVSettings flags */ #endif /* _TV_CHIP */ nvtv-0.4.7/src/tv_common.h0000644000175000001440000000566210005515125011140 /* NVTV TV types header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_common.h,v 1.12 2004/01/27 17:05:25 dthierbach Exp $ * * Contents: * * Header: Common tv-related data types and defines. * */ #ifndef _TV_COMMON_H #define _TV_COMMON_H #include "xf86i2c.h" #include "tv_chip.h" typedef struct _I2CChainRec *I2CChainPtr; typedef struct _I2CChainRec { char *name; I2CDevPtr dev; I2CChainPtr next; TVChip type; } I2CChainRec; typedef struct _TvEncoderObj TVEncoderObj; struct _TvEncoderObj { TVChip type; void *ctrl; /* may be I2CDevPtr or NVPtr, must be typecast */; long minClock, maxClock; /* in kHz */ void (*Create) (TVEncoderObj *this, TVChip chip, void *ctrl); void (*InitRegs) (TVEncoderObj *this, int port); void (*SetRegs) (TVEncoderObj *this, TVEncoderRegs *r, TVState state); void (*GetRegs) (TVEncoderObj *this, TVEncoderRegs *r); void (*SetPort) (TVEncoderObj *this, int port); void (*GetPort) (TVEncoderObj *this, int *port); void (*SetState) (TVEncoderObj *this, TVEncoderRegs *r, TVState state); TVConnect (*GetConnect) (TVEncoderObj *this); long (*GetStatus) (TVEncoderObj *this, int index); int hwconfig; int hwstate; }; /* I2C Id of device for use in (s)printf */ #define I2C_ID(dev) (dev?dev->pI2CBus->BusName+2:"*"),(dev?dev->SlaveAddr:0) I2CChainPtr TVAllocChainEntry (I2CChainPtr root, I2CDevPtr dev, TVChip chip, char* name); I2CChainPtr TVFindDevice (I2CChainPtr root, TVChip chip); I2CChainPtr TVCreateChain (I2CBusPtr busses[], int nbus, I2CChainPtr chain, Bool all); void TVDestroyChain (I2CChainPtr root); void TVDestroyDevices (I2CBusPtr busses[], int nbus); void TVDestroyBusses (I2CBusPtr busses[], int nbus); void TVProbeDevice (I2CBusPtr bus, I2CSlaveAddr addr, char *format, ...); I2CChainPtr TVProbeCreateKnown (I2CBusPtr busses[], int nbus, I2CChainPtr chain); I2CChainPtr TVProbeCreateAll (I2CBusPtr busses[], int nbus, I2CChainPtr chain); void TVSetTvEncoder (TVEncoderObj *encoder, I2CChainPtr chain, void* extra); TVChip TVDetectDeviceA (I2CDevPtr dev); /* for 0x88/0x8A */ TVChip TVDetectDeviceB (I2CDevPtr dev); /* for 0xEA/0xEC */ extern TVState tvState; #endif /* _TV_COMMON_H */ nvtv-0.4.7/src/tv_i2c.h0000644000175000001440000000274010005515125010317 /* NVTV I2C wrapper header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_i2c.h,v 1.8 2004/01/27 17:05:25 dthierbach Exp $ * * Contents: * * I2C wrapper for the TV-I2C routines. * */ #ifndef _TV_I2C_H #define _TV_I2C_H #include "xf86i2c.h" extern Bool tvBusOk; Bool TVProbeBus (I2CBusPtr bus, I2CSlaveAddr addr); void TVWriteBus (I2CDevPtr d, I2CByte subaddr, I2CByte data); void TVWriteSeqBus (I2CDevPtr d, I2CByte subaddr, I2CByte *buf, int len); void TVReadBus (I2CDevPtr d, I2CByte subaddr, I2CByte *data); void TVReadSeqBus (I2CDevPtr d, I2CByte subaddr, I2CByte *data, int len); void TVStatusBus (I2CDevPtr d, I2CByte *data); void TVStatusSeqBus (I2CDevPtr d, I2CByte *buf, int len); #endif /* _TV_I2C_H */ nvtv-0.4.7/src/tv_null.h0000644000175000001440000000223507531242575010633 /* NVTV Null TV-I2C header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_null.h,v 1.5 2002/08/22 20:11:41 dthierbach Exp $ * * Contents: * * Header: Routines to fake null I2C access if no chip is found. * */ #ifndef _TV_NULL_H #define _TV_NULL_H #include "xf86i2c.h" #include "debug.h" #include "tv_chip.h" #include "tv_common.h" extern TVEncoderObj tvNullTemplate; #endif /* _TV_NULL_H */ nvtv-0.4.7/src/tv_nv.h0000644000175000001440000000617107741555571010315 /* NVTV NV TV-I2C access header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_nv.h,v 1.11 2003/10/10 16:16:57 dthierbach Exp $ * * Contents: * * Header: Routines to control the TV and the I2C bus on a NVidia * card, as well as other CRT/TV mode related register programming. * */ #ifndef _TV_NV_H #define _TV_NV_H #include "tv_chip.h" #include "nv_type.h" CARD8 readCrtNv (NVPtr pNv, int head, int reg); void writeCrtNv (NVPtr pNv, int head, int reg, CARD8 val); void orCrtNv (NVPtr pNv, int head, int reg, CARD8 val); void andCrtNv (NVPtr pNv, int head, int reg, CARD8 val); CARD8 NVReadGr(NVPtr pNv, CARD8 index); CARD8 NVReadSeq(NVPtr pNv, CARD8 index); CARD8 NVReadAttr(NVPtr pNv, int head, CARD8 index); CARD8 NVReadMiscOut(NVPtr pNv); Bool XBoxBusInit (NVPtr pNv); Bool NVTvBusInit (NVPtr pNv); void NVUpdateTvState (NVPtr pNv); I2CChainPtr NVFindTvDevice (NVPtr pNv, TVChip chip); void NVSetTvDevice (NVPtr pNv, I2CChainPtr chain, Bool init); void NVDestroyDevices (NVPtr pNv); void NVDestroyBusses (NVPtr pNv); void NVProbeTvDevices (NVPtr pNv); int NVSetTvHead (NVPtr pNv, int head); void NVSetVideoHead (NVPtr pNv, int head); void NVSetCrtRegs (NVPtr pNv, int head, TVNvRegs *r); void NVGetCrtRegs (NVPtr pNv, int head, TVNvRegs *r); void NVSetCrtLayout (NVPtr pNv, int head, int addr, int ofs); void NVGetCrtLayout (NVPtr pNv, int head, int *paddr, int *pofs); int NVGetDevFlags (NVPtr pNv, int head); long NVGetClock (NVPtr pNv, int head); long NVSetClock (NVPtr pNv, int head, long clock); long NVModifyClock (NVPtr pNv, int head, long clock); void NVGetAllRegs (NVPtr pNv, int head, TVRegs *r); void NVSetAllRegs (NVPtr pNv, int head, TVRegs *r); void NVGetEncRegsPort (NVPtr pNv, TVEncoderRegs *r, int *port); void NVGetPort (NVPtr pNv, int *port); void NVSetVideoPointOut (NVPtr pNv, int x, int y); void NVGetVideoPointOut (NVPtr pNv, int *x, int *y); void NVSetCursorPos (NVPtr pNv, int head, int x, int y); void NVGetCursorPos (NVPtr pNv, int head, int *x, int *y); Bool NVVertIntrEnabled (NVPtr pNv, int head); void NVCopyHead (NVPtr pNv, int fromHead, int toHead); void NVCopyCursor (NVPtr pNv, int fromHead, int toHead); void NVSetTestImage (NVPtr pNv, TVEncoderRegs *r); void NVSetTvMode (NVPtr pNv, TVRegs *r); void XBoxSetTvMode (NVPtr pNv, TVRegs *r); long NVGetTvStatus (NVPtr pNv, int index); TVConnect NVGetTvConnect (NVPtr pNv); #endif /* _TV_NV_H */ nvtv-0.4.7/src/tv_i810.h0000644000175000001440000000345407743224066010346 /* NVTV i810 TV-I2C header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_i810.h,v 1.6 2003/10/15 10:57:58 dthierbach Exp $ * * Contents: * * Header: Routines to control the TV and the I2C bus on Intel i810 etc. * cards. * */ #ifndef _TV_I810_H #define _TV_I810_H #include "i810_type.h" Bool I810TvBusInit (I810Ptr pI810); void I810TvBusConfig (I810Ptr pI810); void I810UpdateTvState (I810Ptr pI810); void I810SetTvDevice (I810Ptr pI810, I2CChainPtr chain, Bool init); void I810DestroyDevices (I810Ptr pI810); void I810DestroyBusses (I810Ptr pI810); void I810ProbeTvDevices (I810Ptr pI810); void I810SetTestImage (I810Ptr pI810, TVEncoderRegs *r); void I810SetTvMode (I810Ptr pI810, TVRegs *r); void I830SetTvMode (I810Ptr pI810, TVRegs *r); void IntelSetTvMode (I810Ptr pI810, TVRegs *r); long I810GetTvStatus (I810Ptr pI810, int index); TVConnect I810GetTvConnect (I810Ptr pI810); int I810GetDevFlags (I810Ptr pI810); int I830GetDevFlags (I810Ptr pI810, int head); int IntelGetDevFlags (I810Ptr pI810, int head); #endif /* _TV_I810_H */ nvtv-0.4.7/src/tv_tdfx.h0000644000175000001440000000363507741555571010641 /* NVTV 3dfx TV-I2C header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_tdfx.h,v 1.8 2003/10/10 16:16:57 dthierbach Exp $ * * Contents: * * Header: Routines to control the TV and the I2C bus on a 3dfx (Voodoo) card. * */ #ifndef _TV_TDFX_H #define _TV_TDFX_H #include "tdfx_type.h" CARD8 readCrtTdfx (TDFXPtr hwp, CARD8 index); void writeCrtTdfx (TDFXPtr hwp, CARD8 index, CARD8 value); Bool TDFXTvBusInit (TDFXPtr pTdfx); void TDFXTvBusConfig (TDFXPtr pTdfx); void TDFXUpdateTvState (TDFXPtr pTdfx); void TDFXSetTvDevice (TDFXPtr pTdfx, I2CChainPtr chain, Bool init); void TDFXDestroyDevices (TDFXPtr pTdfx); void TDFXDestroyBusses (TDFXPtr pTdfx); void TDFXProbeTvDevices (TDFXPtr pTdfx); void TDFXSetTestImage (TDFXPtr pTdfx, TVEncoderRegs *r); void TDFXSetTvMode (TDFXPtr pTdfx, TVRegs *r); long TDFXGetTvStatus (TDFXPtr pTdfx, int index); TVConnect TDFXGetTvConnect (TDFXPtr pTdfx); int TDFXGetDevFlags (TDFXPtr pTdfx); void TDFXSetCrtRegs (TDFXPtr pTdfx, TVTdfxRegs *r); void TDFXGetCrtRegs (TDFXPtr pTdfx, TVTdfxRegs *r); void TDFXSetAllRegs (TDFXPtr pTdfx, TVRegs *r); void TDFXGetAllRegs (TDFXPtr pTdfx, TVRegs *r); #endif /* _TV_TDFX_H */ nvtv-0.4.7/src/tv_bt.h0000644000175000001440000000267307531242575010274 /* NVTV Brooktree TV-I2C header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_bt.h,v 1.5 2002/08/22 20:11:41 dthierbach Exp $ * * Contents: * * Header: Routines to access the Brooktree chip registers via the I2C bus. * */ #ifndef _TV_BT_H #define _TV_BT_H #include "xf86i2c.h" #include "tv_i2c.h" #include "tv_chip.h" #include "tv_common.h" void TVBtMacroMode (TVEncoderObj *this, TVEncoderRegs *r); void TVBtSetRegs (TVEncoderObj *this, TVEncoderRegs *r, TVState state); void TVBtSetState (TVEncoderObj *this, TVEncoderRegs *r, TVState state); char *TVDetectBrooktree (I2CDevPtr dev, TVChip *encoder, TVState state); extern TVEncoderObj tvBtTemplate; #endif /* _TV_BT_H */ nvtv-0.4.7/src/tv_cx.h0000644000175000001440000000233407531242575010273 /* NVTV Conexant TV-I2C header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_cx.h,v 1.5 2002/08/22 20:11:41 dthierbach Exp $ * * Contents: * * Header: Routines to access the Conexant chip registers via the I2C bus. * */ #ifndef _TV_CX_H #define _TV_CX_H #include "xf86i2c.h" #include "tv_i2c.h" #include "tv_chip.h" #include "tv_common.h" char *TVDetectConexant (I2CDevPtr dev, TVChip *encoder); extern TVEncoderObj tvCxTemplate; #endif /* _TV_CX_H */ nvtv-0.4.7/src/tv_ch1_7007.h0000644000175000001440000000240207652527104011003 /* NVTV Chrontel TV-I2C header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_ch1_7007.h,v 1.1 2003/04/26 16:05:24 dthierbach Exp $ * * Contents: * * Header: Routines to access the Chrontel (Model 1, 7007-like) chip * registers via the I2C bus. * */ #ifndef _TV_CH1_H #define _TV_CH1_H #include "xf86i2c.h" #include "tv_i2c.h" #include "tv_chip.h" #include "tv_common.h" char *TVDetectChrontel1 (I2CDevPtr dev, TVChip *encoder); extern TVEncoderObj tvCh1Template; #endif /* _TV_CH1_H */ nvtv-0.4.7/src/tv_ch2_7009.h0000644000175000001440000000240207652527105011007 /* NVTV Chrontel TV-I2C header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_ch2_7009.h,v 1.1 2003/04/26 16:05:25 dthierbach Exp $ * * Contents: * * Header: Routines to access the Chrontel (Model 2, 7009-like) chip * registers via the I2C bus. * */ #ifndef _TV_CH2_H #define _TV_CH2_H #include "xf86i2c.h" #include "tv_i2c.h" #include "tv_chip.h" #include "tv_common.h" char *TVDetectChrontel2 (I2CDevPtr dev, TVChip *encoder); extern TVEncoderObj tvCh2Template; #endif /* _TV_CH1_H */ nvtv-0.4.7/src/tv_ph1_saa7102.h0000644000175000001440000000374707671651604011522 /* NVTV Philips TV-I2C header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_ph1_saa7102.h,v 1.2 2003/06/11 16:06:28 dthierbach Exp $ * * Contents: * * Header: Routines to access the Philips Model1 (SAA7102 etc.) encoder chip * registers via the I2C bus. * */ #ifndef _TV_PH1_H #define _TV_PH1_H #include "tv_chip.h" #include "tv_common.h" void TVPhInitRegs (TVEncoderObj *this); void TVPhCreate (TVEncoderObj *this, TVChip chip, void* ctrl); void TVPhSetPort (TVEncoderObj *this, int port); void TVPhGetPort (TVEncoderObj *this, int *port); void TVPh1InitRegs (TVEncoderObj *this, int flags); void TVPh1SetRegs (TVEncoderObj *this, TVEncoderRegs *r, TVState state); void TVPh1GetRegs (TVEncoderObj *this, TVEncoderRegs *r); void TVPh1SetPort (TVEncoderObj *this, int port); void TVPh1GetPort (TVEncoderObj *this, int *port); void TVPh1SetState (TVEncoderObj *this, TVEncoderRegs *r, TVState state); long TVPh1GetStatus (TVEncoderObj *this, int index); TVConnect TVPh1GetConnect (TVEncoderObj *this); void TVPh1SetHWConfig (TVEncoderObj *this, int config); void TVPh1GetHWConfig (TVEncoderObj *this, int *config); char *TVDetectPhilips (I2CDevPtr dev, TVChip *encoder); extern TVEncoderObj tvPh1Template; #endif /* _TV_PH1_H */ nvtv-0.4.7/src/tv_ph2_saa7104.h0000644000175000001440000000304407620311215011474 /* NVTV Philips TV-I2C header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_ph2_saa7104.h,v 1.1 2003/02/05 22:39:09 dthierbach Exp $ * * Contents: * * Header: Routines to access the Brooktree chip registers via the I2C bus. * */ #ifndef _TV_PH2_H #define _TV_PH2_H #include "tv_chip.h" #include "tv_common.h" void TVPh2InitRegs (TVEncoderObj *this, int flags); void TVPh2SetRegs (TVEncoderObj *this, TVEncoderRegs *r, TVState state); void TVPh2SetState (TVEncoderObj *this, TVEncoderRegs *r, TVState state); long TVPh2GetStatus (TVEncoderObj *this, int index); TVConnect TVPh2GetConnect (TVEncoderObj *this); void TVPh2SetHWConfig (TVEncoderObj *this, int config); void TVPh2GetHWConfig (TVEncoderObj *this, int *config); extern TVEncoderObj tvPh2Template; #endif /* _TV_PH2_H */ nvtv-0.4.7/src/tv_nx.h0000644000175000001440000000210107671651604010300 /* NVTV NV internal encoder header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tv_nx.h,v 1.1 2003/06/11 16:06:28 dthierbach Exp $ * * Contents: * * Header: Internal NV17 TV encoder * */ #ifndef _TV_NX_H #define _TV_NX_H #include "tv_common.h" extern TVEncoderObj tvNxTemplate; #endif /* _TV_NX_H */ nvtv-0.4.7/src/xf86_ansic.h0000644000175000001440000000303307617536730011121 /* * Copyright 1997-2000 by The XFree86 Project, Inc * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of the above listed copyright holders * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. The above listed * copyright holders make no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * THE ABOVE LISTED COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDERS BE * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ /* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.46 2001/04/10 16:08:03 dawes Exp $ */ #ifndef _XF86_ANSIC_H #define _XF86_ANSIC_H /* extract */ /**** libc_wrapper.c */ void xf86usleep(unsigned long usec); void xf86getsecs(long * secs, long * usecs); #endif nvtv-0.4.7/src/xf86i2c.h0000644000175000001440000000573007337247443010347 /* * Copyright (C) 1998 Itai Nahshon, Michael Schimek */ /* $XFree86: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h,v 1.4 1999/04/11 13:11:01 dawes Exp $ */ #ifndef _XF86I2C_H #define _XF86I2C_H #include "miscstruct.h" typedef unsigned char I2CByte; typedef unsigned short I2CSlaveAddr; typedef struct _I2CBusRec *I2CBusPtr; typedef struct _I2CDevRec *I2CDevPtr; /* I2C masters have to register themselves */ typedef struct _I2CBusRec { char * BusName; int scrnIndex; void (*I2CUDelay) (I2CBusPtr b, int usec); void (*I2CPutBits)(I2CBusPtr b, int scl, int sda); void (*I2CGetBits)(I2CBusPtr b, int *scl, int *sda); /* Look at the generic routines to see how these functions should behave. */ Bool (*I2CAddress)(I2CDevPtr d, I2CSlaveAddr); void (*I2CStop) (I2CDevPtr d); Bool (*I2CPutByte)(I2CDevPtr d, I2CByte data); Bool (*I2CGetByte)(I2CDevPtr d, I2CByte *data, Bool); DevUnion DriverPrivate; int HoldTime; /* 1 / bus clock frequency, 5 or 2 usec */ int BitTimeout; /* usec */ int ByteTimeout; /* usec */ int AcknTimeout; /* usec */ int StartTimeout; /* usec */ int RiseFallTime; /* usec */ I2CDevPtr FirstDev; I2CBusPtr NextBus; } I2CBusRec; I2CBusPtr xf86CreateI2CBusRec(void); void xf86DestroyI2CBusRec(I2CBusPtr pI2CBus, Bool unalloc, Bool devs_too); Bool xf86I2CBusInit(I2CBusPtr pI2CBus); I2CBusPtr xf86I2CFindBus(int scrnIndex, char *name); /* I2C slave devices */ typedef struct _I2CDevRec { char * DevName; int BitTimeout; /* usec */ int ByteTimeout; /* usec */ int AcknTimeout; /* usec */ int StartTimeout; /* usec */ I2CSlaveAddr SlaveAddr; I2CBusPtr pI2CBus; I2CDevPtr NextDev; } I2CDevRec; I2CDevPtr xf86CreateI2CDevRec(void); void xf86DestroyI2CDevRec(I2CDevPtr pI2CDev, Bool unalloc); Bool xf86I2CDevInit(I2CDevPtr pI2CDev); I2CDevPtr xf86I2CFindDev(I2CBusPtr, I2CSlaveAddr); /* See descriptions of these functions in xf86i2c.c */ Bool xf86I2CProbeAddress(I2CBusPtr pI2CBus, I2CSlaveAddr); Bool xf86I2CWriteRead(I2CDevPtr d, I2CByte *WriteBuffer, int nWrite, I2CByte *ReadBuffer, int nRead); #define xf86I2CRead(d, rb, nr) xf86I2CWriteRead(d, NULL, 0, rb, nr) Bool xf86I2CReadStatus(I2CDevPtr d, I2CByte *pbyte); Bool xf86I2CReadByte(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte); Bool xf86I2CReadBytes(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte, int n); Bool xf86I2CReadWord(I2CDevPtr d, I2CByte subaddr, unsigned short *pword); #define xf86I2CWrite(d, wb, nw) xf86I2CWriteRead(d, wb, nw, NULL, 0) Bool xf86I2CWriteByte(I2CDevPtr d, I2CByte subaddr, I2CByte byte); Bool xf86I2CWriteBytes(I2CDevPtr d, I2CByte subaddr, I2CByte *WriteBuffer, int nWrite); Bool xf86I2CWriteWord(I2CDevPtr d, I2CByte subaddr, unsigned short word); Bool xf86I2CWriteVec(I2CDevPtr d, I2CByte *vec, int nValues); #endif /*_XF86I2C_H */ nvtv-0.4.7/src/xf86PciInfo.h0000644000175000001440000021404010014353671011200 /* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.97 2001/05/10 21:14:54 dawes Exp $ */ /* * PCI Probe * * Copyright 1995-2000 by The XFree86 Project, Inc. * * A lot of this comes from Robin Cutshaw's scanpci * * Notes -- Jun 6, 2000 -- Kevin Brosius * Tips on adding Entries: * scanpci output can contain up to 4 numeric entries, 2 for chip and 2 for card * some generic cards don't have any valid info in the card field, * here's what you do; * - Add a vendor entry for your device if it doesn't already exist. The * first number of the pair is generally vendor id. Search for it below * and add a #define for it if it doesn't exist. * ie. 5333 is the vendor id for S3 * - Go to xf86PCIVendorNameInfoData[] and add a text name for your vendor id. * ie. PCI_VENDOR_S3 is "S3" * - Add an entry to xf86PCIVendorInfoData[], using the PCI_VENDOR define * you added, and a text description of the chipset. * - If your device has 0000 in the card field, * you've probably got a non-video or generic device. Stop here. * * - If you have info in the card field, and it's just a duplicate of the chip * info, then either stop, or add a 'generic' entry to xf86PCICardInfoData[]. * - If you have different info in the card field, check the first entry, * does the vendor match and/or already exist? If not, add it. Then * add an entry describing the card to xf86PCICardInfoData[] * - If you are adding a video card, add a PCI_CHIP #define matching the second * entry in your chip field. This gets used in your card driver as the PCI id. * ie. under the S3 comment, one entry is: PCI_CHIP_VIRGE 0x5631 * * Several people recommended http://www.yourvote.com/pci for pci device/vendor info. * */ /* Added some more NVidia entries. - Dirk Thierbach */ /* Added Intel 810/815/830 entries. - Dirk Thierbach */ #ifndef _XF86_PCIINFO_H #define _XF86_PCIINFO_H #include "xf86str.h" /* PCI Pseudo Vendor */ #define PCI_VENDOR_GENERIC 0x00FF #define PCI_VENDOR_REAL3D 0x003D #define PCI_VENDOR_COMPAQ 0x0E11 #define PCI_VENDOR_NCR_1 0x1000 #define PCI_VENDOR_ATI 0x1002 #define PCI_VENDOR_VLSI 0x1004 #define PCI_VENDOR_AVANCE 0x1005 #define PCI_VENDOR_NS 0x100B #define PCI_VENDOR_TSENG 0x100C #define PCI_VENDOR_WEITEK 0x100E #define PCI_VENDOR_VIDEOLOGIC 0x1010 #define PCI_VENDOR_DIGITAL 0x1011 #define PCI_VENDOR_CIRRUS 0x1013 #define PCI_VENDOR_IBM 0x1014 #define PCI_VENDOR_NCR_2 0x101A #define PCI_VENDOR_WD 0x101C #define PCI_VENDOR_AMD 0x1022 #define PCI_VENDOR_TRIDENT 0x1023 #define PCI_VENDOR_ALI 0x1025 #define PCI_VENDOR_MATROX 0x102B #define PCI_VENDOR_CHIPSTECH 0x102C #define PCI_VENDOR_MIRO 0x1031 #define PCI_VENDOR_NEC 0x1033 #define PCI_VENDOR_FD 0x1036 #define PCI_VENDOR_SIS 0x1039 #define PCI_VENDOR_HP 0x103C #define PCI_VENDOR_SMC_PCTECH 0x1042 #define PCI_VENDOR_DPT 0x1044 #define PCI_VENDOR_OPTI 0x1045 #define PCI_VENDOR_ELSA 0x1048 #define PCI_VENDOR_SGS 0x104A #define PCI_VENDOR_BUSLOGIC 0x104B #define PCI_VENDOR_TI 0x104C #define PCI_VENDOR_SONY 0x104D #define PCI_VENDOR_OAK 0x104E #define PCI_VENDOR_WINBOND 0x1050 #define PCI_VENDOR_MOTOROLA 0x1057 #define PCI_VENDOR_PROMISE 0x105A #define PCI_VENDOR_NUMNINE 0x105D #define PCI_VENDOR_UMC 0x1060 #define PCI_VENDOR_X 0x1061 #define PCI_VENDOR_PICOP 0x1066 #define PCI_VENDOR_MYLEX 0x1069 #define PCI_VENDOR_APPLE 0x106B #define PCI_VENDOR_YAMAHA 0x1073 #define PCI_VENDOR_NEXGEN 0x1074 #define PCI_VENDOR_QLOGIC 0x1077 #define PCI_VENDOR_CYRIX 0x1078 #define PCI_VENDOR_LEADTEK 0x107D #define PCI_VENDOR_CONTAQ 0x1080 #define PCI_VENDOR_FOREX 0x1083 #define PCI_VENDOR_OLICOM 0x108D #define PCI_VENDOR_SUN 0x108E #define PCI_VENDOR_DIAMOND 0x1092 #define PCI_VENDOR_CMD 0x1095 #define PCI_VENDOR_APPIAN 0x1097 #define PCI_VENDOR_VISION 0x1098 #define PCI_VENDOR_BROOKTREE 0x109E #define PCI_VENDOR_SIERRA 0x10A8 #define PCI_VENDOR_ACC 0x10AA #define PCI_VENDOR_WINBOND_2 0x10AB #define PCI_VENDOR_DATABOOK 0x10B3 #define PCI_VENDOR_3COM 0x10B7 #define PCI_VENDOR_SMC 0x10B8 #define PCI_VENDOR_ALI_2 0x10B9 #define PCI_VENDOR_MITSUBISHI 0x10BA #define PCI_VENDOR_SURECOM 0x10BD #define PCI_VENDOR_NEOMAGIC 0x10C8 #define PCI_VENDOR_ASP 0x10CD #define PCI_VENDOR_CERN 0x10DC #define PCI_VENDOR_NVIDIA 0x10DE #define PCI_VENDOR_IMS 0x10E0 #define PCI_VENDOR_TEKRAM 0x10E1 #define PCI_VENDOR_TUNDRA 0x10E3 #define PCI_VENDOR_AMCC 0x10E8 #define PCI_VENDOR_INTEGRAPHICS 0x10EA #define PCI_VENDOR_REALTEC 0x10EC #define PCI_VENDOR_TRUEVISION 0x10FA #define PCI_VENDOR_INITIO 0x1101 #define PCI_VENDOR_CREATIVE_2 0x1102 #define PCI_VENDOR_SIGMADESIGNS_2 0x1105 #define PCI_VENDOR_VIA 0x1106 #define PCI_VENDOR_VORTEX 0x1119 #define PCI_VENDOR_EF 0x111A #define PCI_VENDOR_FORE 0x1127 #define PCI_VENDOR_IMAGTEC 0x112F #define PCI_VENDOR_PLX 0x113C #define PCI_VENDOR_ALLIANCE 0x1142 #define PCI_VENDOR_VMIC 0x114A #define PCI_VENDOR_DIGI 0x114F #define PCI_VENDOR_MUTECH 0x1159 #define PCI_VENDOR_RENDITION 0x1163 #define PCI_VENDOR_TOSHIBA 0x1179 #define PCI_VENDOR_RICOH 0x1180 #define PCI_VENDOR_ZEINET 0x1193 #define PCI_VENDOR_LITEON 0x11AD #define PCI_VENDOR_SPECIALIX 0x11CB #define PCI_VENDOR_CONTROL 0x11FE #define PCI_VENDOR_CYCLADES 0x120E #define PCI_VENDOR_3DFX 0x121A #define PCI_VENDOR_SIGMADESIGNS 0x1236 #define PCI_VENDOR_SMI 0x126f #define PCI_VENDOR_ENSONIQ 0x1274 #define PCI_VENDOR_ROCKWELL 0x127A #define PCI_VENDOR_YOKOGAWA 0x1281 #define PCI_VENDOR_TRITECH 0x1292 #define PCI_VENDOR_NVIDIA_SGS 0x12d2 #define PCI_VENDOR_NETGEAR 0x1385 #define PCI_VENDOR_VMWARE 0x15AD #define PCI_VENDOR_SYMPHONY 0x1C1C #define PCI_VENDOR_TEKRAM_2 0x1DE1 #define PCI_VENDOR_3DLABS 0x3D3D #define PCI_VENDOR_AVANCE_2 0x4005 #define PCI_VENDOR_HERCULES 0x4843 #define PCI_VENDOR_CREATIVE 0x4942 #define PCI_VENDOR_S3 0x5333 #define PCI_VENDOR_INTEL 0x8086 #define PCI_VENDOR_ADAPTEC 0x9004 #define PCI_VENDOR_ADAPTEC_2 0x9005 #define PCI_VENDOR_ATRONICS 0x907F #define PCI_VENDOR_ARK 0xEDD8 /* Generic */ #define PCI_CHIP_VGA 0x0000 #define PCI_CHIP_8514 0x0001 /* Real 3D */ #define PCI_CHIP_I740_PCI 0x00D1 /* Compaq */ #define PCI_CHIP_QV1280 0x3033 #define PCI_CHIP_SMART 0xAE10 #define PCI_CHIP_NETELL100 0xAE32 #define PCI_CHIP_NETELL10 0xAE34 #define PCI_CHIP_NETFLEX3 0xAE35 #define PCI_CHIP_NETELL100D 0xAE40 #define PCI_CHIP_NETELL100PL 0xAE43 #define PCI_CHIP_NETELL100I 0xB011 #define PCI_CHIP_THUNDERLAN 0xF130 #define PCI_CHIP_NETFLEX3BNC 0xF150 /* NCR */ #define PCI_CHIP_53C810 0x0001 #define PCI_CHIP_53C820 0x0002 #define PCI_CHIP_53C825 0x0003 #define PCI_CHIP_53C815 0x0004 #define PCI_CHIP_53C810AP 0x0005 #define PCI_CHIP_53C860 0x0006 #define PCI_CHIP_53C896 0x000B #define PCI_CHIP_53C895 0x000C #define PCI_CHIP_53C885 0x000D #define PCI_CHIP_53C875 0x000F #define PCI_CHIP_53C875J 0x008F /* ATI */ #define PCI_CHIP_MACH32 0x4158 #define PCI_CHIP_MACH64CT 0x4354 #define PCI_CHIP_MACH64CX 0x4358 #define PCI_CHIP_MACH64ET 0x4554 #define PCI_CHIP_MACH64GB 0x4742 #define PCI_CHIP_MACH64GD 0x4744 #define PCI_CHIP_MACH64GI 0x4749 #define PCI_CHIP_MACH64GL 0x474C #define PCI_CHIP_MACH64GM 0x474D #define PCI_CHIP_MACH64GN 0x474E #define PCI_CHIP_MACH64GO 0x474F #define PCI_CHIP_MACH64GP 0x4750 #define PCI_CHIP_MACH64GQ 0x4751 #define PCI_CHIP_MACH64GR 0x4752 #define PCI_CHIP_MACH64GS 0x4753 #define PCI_CHIP_MACH64GT 0x4754 #define PCI_CHIP_MACH64GU 0x4755 #define PCI_CHIP_MACH64GV 0x4756 #define PCI_CHIP_MACH64GW 0x4757 #define PCI_CHIP_MACH64GX 0x4758 #define PCI_CHIP_MACH64GZ 0x475A #define PCI_CHIP_MACH64LB 0x4C42 #define PCI_CHIP_MACH64LD 0x4C44 #define PCI_CHIP_RAGE128LE 0x4C45 #define PCI_CHIP_RAGE128LF 0x4C46 #define PCI_CHIP_MACH64LG 0x4C47 #define PCI_CHIP_MACH64LI 0x4C49 #define PCI_CHIP_MACH64LM 0x4C4D #define PCI_CHIP_MACH64LN 0x4C4E #define PCI_CHIP_MACH64LP 0x4C50 #define PCI_CHIP_MACH64LR 0x4C52 #define PCI_CHIP_MACH64LS 0x4C53 #define PCI_CHIP_RAGE128MF 0x4D46 #define PCI_CHIP_RAGE128ML 0x4D4C #define PCI_CHIP_RAGE128PD 0x5044 #define PCI_CHIP_RAGE128PF 0x5046 #define PCI_CHIP_RAGE128PP 0x5050 #define PCI_CHIP_RAGE128PR 0x5052 #define PCI_CHIP_RADEON_QD 0x5144 #define PCI_CHIP_RADEON_QE 0x5145 #define PCI_CHIP_RADEON_QF 0x5146 #define PCI_CHIP_RADEON_QG 0x5147 #define PCI_CHIP_RADEON_VE 0x5159 #define PCI_CHIP_RAGE128RE 0x5245 #define PCI_CHIP_RAGE128RF 0x5246 #define PCI_CHIP_RAGE128RG 0x5247 #define PCI_CHIP_RAGE128RK 0x524B #define PCI_CHIP_RAGE128RL 0x524C #define PCI_CHIP_MACH64VT 0x5654 #define PCI_CHIP_MACH64VU 0x5655 #define PCI_CHIP_MACH64VV 0x5656 /* VLSI */ #define PCI_CHIP_82C592_FC1 0x0005 #define PCI_CHIP_82C593_FC1 0x0006 #define PCI_CHIP_82C594_AFC2 0x0007 #define PCI_CHIP_82C597_AFC2 0x0009 #define PCI_CHIP_82C541 0x000C #define PCI_CHIP_82C543 0x000D #define PCI_CHIP_VAS96011 0x0702 /* Avance Logic */ #define PCI_CHIP_ALG2064 0x2064 #define PCI_CHIP_ALG2301 0x2301 #define PCI_CHIP_ALG2501 0x2501 /* NS */ #define PCI_CHIP_87415 0x0002 #define PCI_CHIP_87410 0xD001 /* Tseng */ #define PCI_CHIP_ET4000_W32P_A 0x3202 #define PCI_CHIP_ET4000_W32P_B 0x3205 #define PCI_CHIP_ET4000_W32P_D 0x3206 #define PCI_CHIP_ET4000_W32P_C 0x3207 #define PCI_CHIP_ET6000 0x3208 #define PCI_CHIP_ET6300 0x4702 /* Weitek */ #define PCI_CHIP_P9000 0x9001 #define PCI_CHIP_P9100 0x9100 /* Digital */ #define PCI_CHIP_DC21050 0x0001 #define PCI_CHIP_DC21040_10 0x0002 #define PCI_CHIP_DEC21030 0x0004 #define PCI_CHIP_DC21040_100 0x0009 #define PCI_CHIP_TGA2 0x000D #define PCI_CHIP_DEFPA 0x000F #define PCI_CHIP_DC21041 0x0014 #define PCI_CHIP_DC21142 0x0019 #define PCI_CHIP_DC21052 0x0021 #define PCI_CHIP_DC21152 0x0024 /* Cirrus Logic */ #define PCI_CHIP_GD7548 0x0038 #define PCI_CHIP_GD7555 0x0040 #define PCI_CHIP_GD5430 0x00A0 #define PCI_CHIP_GD5434_4 0x00A4 #define PCI_CHIP_GD5434_8 0x00A8 #define PCI_CHIP_GD5436 0x00AC #define PCI_CHIP_GD5446 0x00B8 #define PCI_CHIP_GD5480 0x00BC #define PCI_CHIP_GD5462 0x00D0 #define PCI_CHIP_GD5464 0x00D4 #define PCI_CHIP_GD5464BD 0x00D5 #define PCI_CHIP_GD5465 0x00D6 #define PCI_CHIP_6729 0x1100 #define PCI_CHIP_6832 0x1110 #define PCI_CHIP_GD7542 0x1200 #define PCI_CHIP_GD7543 0x1202 #define PCI_CHIP_GD7541 0x1204 /* IBM */ #define PCI_CHIP_FIRE_CORAL 0x000A #define PCI_CHIP_TOKEN_RING 0x0018 #define PCI_CHIP_82G2675 0x001D #define PCI_CHIP_82351 0x0022 /* WD */ #define PCI_CHIP_7197 0x3296 /* AMD */ #define PCI_CHIP_79C970 0x2000 #define PCI_CHIP_53C974 0x2020 /* Trident */ #define PCI_CHIP_8400 0x8400 #define PCI_CHIP_8420 0x8420 #define PCI_CHIP_8500 0x8500 #define PCI_CHIP_8520 0x8520 #define PCI_CHIP_8600 0x8600 #define PCI_CHIP_8620 0x8620 #define PCI_CHIP_9320 0x9320 #define PCI_CHIP_9388 0x9388 #define PCI_CHIP_9397 0x9397 #define PCI_CHIP_939A 0x939A #define PCI_CHIP_9420 0x9420 #define PCI_CHIP_9440 0x9440 #define PCI_CHIP_9520 0x9520 #define PCI_CHIP_9525 0x9525 #define PCI_CHIP_9540 0x9540 #define PCI_CHIP_9660 0x9660 #define PCI_CHIP_9750 0x9750 #define PCI_CHIP_9850 0x9850 #define PCI_CHIP_9880 0x9880 #define PCI_CHIP_9910 0x9910 #define PCI_CHIP_9930 0x9930 /* ALI */ #define PCI_CHIP_M1435 0x1435 /* Matrox */ #define PCI_CHIP_MGA2085 0x0518 #define PCI_CHIP_MGA2064 0x0519 #define PCI_CHIP_MGA1064 0x051a #define PCI_CHIP_MGA2164 0x051b #define PCI_CHIP_MGA2164_AGP 0x051f #define PCI_CHIP_MGAG200_PCI 0x0520 #define PCI_CHIP_MGAG200 0x0521 #define PCI_CHIP_MGAG400 0x0525 #define PCI_CHIP_IMPRESSION 0x0D10 #define PCI_CHIP_MGAG100_PCI 0x1000 #define PCI_CHIP_MGAG100 0x1001 #define PCI_CARD_MILL_G200_SD 0xff00 #define PCI_CARD_PROD_G100_SD 0xff01 #define PCI_CARD_MYST_G200_SD 0xff02 #define PCI_CARD_MILL_G200_SG 0xff03 #define PCI_CARD_MARV_G200_SD 0xff04 /* Chips & Tech */ #define PCI_CHIP_65545 0x00D8 #define PCI_CHIP_65548 0x00DC #define PCI_CHIP_65550 0x00E0 #define PCI_CHIP_65554 0x00E4 #define PCI_CHIP_65555 0x00E5 #define PCI_CHIP_68554 0x00F4 #define PCI_CHIP_69000 0x00C0 #define PCI_CHIP_69030 0x0C30 /* Miro */ #define PCI_CHIP_ZR36050 0x5601 /* NEC */ #define PCI_CHIP_POWER_VR 0x0046 /* FD */ #define PCI_CHIP_TMC_18C30 0x0000 /* SiS */ #define PCI_CHIP_SG86C201 0x0001 #define PCI_CHIP_SG86C202 0x0002 #define PCI_CHIP_SG85C503 0x0008 #define PCI_CHIP_SIS5597 0x0200 #define PCI_CHIP_SG86C205 0x0205 #define PCI_CHIP_SG86C215 0x0215 #define PCI_CHIP_SG86C225 0x0225 #define PCI_CHIP_85C501 0x0406 #define PCI_CHIP_85C496 0x0496 #define PCI_CHIP_85C601 0x0601 #define PCI_CHIP_85C5107 0x5107 #define PCI_CHIP_85C5511 0x5511 #define PCI_CHIP_85C5513 0x5513 #define PCI_CHIP_SIS5571 0x5571 #define PCI_CHIP_SIS5597_2 0x5597 #define PCI_CHIP_SIS530 0x6306 #define PCI_CHIP_SIS6326 0x6326 #define PCI_CHIP_SIS7001 0x7001 #define PCI_CHIP_SIS300 0x0300 #define PCI_CHIP_SIS630 0x6300 #define PCI_CHIP_SIS540 0x5300 /* Agregado por Carlos Duclos & Manuel Jander */ #define PCI_CHIP_SIS82C204 0x0204 /* HP */ #define PCI_CHIP_J2585A 0x1030 #define PCI_CHIP_J2585B 0x1031 /* SMC/PCTECH */ #define PCI_CHIP_RZ1000 0x1000 #define PCI_CHIP_RZ1001 0x1001 /* DPT */ #define PCI_CHIP_SMART_CACHE 0xA400 /* Opti */ #define PCI_CHIP_92C178 0xC178 #define PCI_CHIP_82C557 0xC557 #define PCI_CHIP_82C558 0xC558 #define PCI_CHIP_82C621 0xC621 #define PCI_CHIP_82C700 0xC700 #define PCI_CHIP_82C701 0xC701 #define PCI_CHIP_82C814 0xC814 #define PCI_CHIP_82C822 0xC822 /* SGS */ #define PCI_CHIP_STG2000 0x0008 #define PCI_CHIP_STG1764 0x0009 /* BusLogic */ #define PCI_CHIP_946C_01 0x0140 #define PCI_CHIP_946C_10 0x1040 #define PCI_CHIP_FLASH_POINT 0x8130 /* Texas Instruments */ #define PCI_CHIP_TI_PERMEDIA 0x3d04 #define PCI_CHIP_TI_PERMEDIA2 0x3d07 #define PCI_CHIP_PCI_1130 0xAC12 #define PCI_CHIP_PCI_1131 0xAC15 /* Oak */ #define PCI_CHIP_OTI107 0x0107 /* Winbond */ #define PCI_CHIP_89C940 0x0940 /* Motorola */ #define PCI_CHIP_MPC105_EAGLE 0x0001 #define PCI_CHIP_MPC105_GRACKLE 0x0002 #define PCI_CHIP_RAVEN 0x4801 /* Promise */ #define PCI_CHIP_ULTRA_DMA 0x4D33 #define PCI_CHIP_DC5030 0x5300 /* Number Nine */ #define PCI_CHIP_I128 0x2309 #define PCI_CHIP_I128_2 0x2339 #define PCI_CHIP_I128_T2R 0x493D #define PCI_CHIP_I128_T2R4 0x5348 /* BrookTree */ #define PCI_CHIP_BT848 0x0350 #define PCI_CHIP_BT849 0x0351 /* NVIDIA */ #define PCI_CHIP_NV1 0x0008 #define PCI_CHIP_DAC64 0x0009 #define PCI_CHIP_TNT 0x0020 #define PCI_CHIP_TNT2 0x0028 #define PCI_CHIP_UTNT2 0x0029 /* Unknown TNT2 = 0x002A */ #define PCI_CHIP_VTNT2 0x002C #define PCI_CHIP_UVTNT2 0x002D #define PCI_CHIP_TNT2_A 0x002E #define PCI_CHIP_TNT2_B 0x002F #define PCI_CHIP_ITNT2 0x00A0 /* Aladdin TNT2 */ #define PCI_CHIP_GEFORCE256 0x0100 #define PCI_CHIP_GEFORCEDDR 0x0101 #define PCI_CHIP_QUADRO 0x0103 #define PCI_CHIP_GEFORCE2MX 0x0110 #define PCI_CHIP_GEFORCE2MXDDR 0x0111 #define PCI_CHIP_GEFORCE2GO 0x0112 #define PCI_CHIP_QUADRO2MXR 0x0113 #define PCI_CHIP_GEFORCE2GTS 0x0150 #define PCI_CHIP_GEFORCE2TI 0x0151 #define PCI_CHIP_GEFORCE2ULTRA 0x0152 #define PCI_CHIP_QUADRO2PRO 0x0153 #define PCI_CHIP_GEFORCE4MX_460 0x0170 #define PCI_CHIP_GEFORCE4MX_440 0x0171 #define PCI_CHIP_GEFORCE4MX_420 0x0172 #define PCI_CHIP_GEFORCE4MX_440SE 0x0173 #define PCI_CHIP_GEFORCE4GO_440 0x0174 #define PCI_CHIP_GEFORCE4GO_420 0x0175 #define PCI_CHIP_GEFORCE4GO_420_32M 0x0176 #define PCI_CHIP_GEFORCE4GO_460 0x0177 #define PCI_CHIP_QUADRO4XGL_500 0x0178 #define PCI_CHIP_GEFORCE4GO_440_64M 0x0179 /* Mac */ #define PCI_CHIP_GEFORCE4MX_MAC 0x0179 #define PCI_CHIP_QUADRO4NVS 0x017A #define PCI_CHIP_QUADRO4XGL_550 0x017B #define PCI_CHIP_QUADRO4GOGL_500 0x017C #define PCI_CHIP_GEFORCE4GO_410_16M 0x017D #define PCI_CHIP_GEFORCE4MX_440_AGP8X 0x0181 #define PCI_CHIP_GEFORCE4MX_440SE_AGP8X 0x0182 #define PCI_CHIP_GEFORCE4MX_420_AGP8X 0x0183 #define PCI_CHIP_GEFORCE4GO_448 0x0186 #define PCI_CHIP_GEFORCE4GO_488 0x0187 #define PCI_CHIP_QUADRO4_XGL_580 0x0188 #define PCI_CHIP_GEFORCE4MX_MAC_AGP8X 0x0189 /* Mac */ #define PCI_CHIP_QUADRO4_NVS_280 0x018A #define PCI_CHIP_QUADRO4_XGL_380 0x018B #define PCI_CHIP_GEFORCE2GPU 0x01A0 #define PCI_CHIP_GEFORCE4GPU 0x01F0 #define PCI_CHIP_GEFORCE3 0x0200 #define PCI_CHIP_GEFORCE3TI_200 0x0201 #define PCI_CHIP_GEFORCE3TI_500 0x0202 #define PCI_CHIP_QUADRO_DDC 0x0203 #define PCI_CHIP_GEFORCE4TI_4600 0x0250 #define PCI_CHIP_GEFORCE4TI_4400 0x0251 /* 0x0252 */ #define PCI_CHIP_GEFORCE4TI_4200 0x0253 #define PCI_CHIP_QUADRO4XGL_900 0x0258 #define PCI_CHIP_QUADRO4XGL_750 0x0259 #define PCI_CHIP_QUADRO4XGL_700 0x025B #define PCI_CHIP_GEFORCE4TI_4800 0x0280 #define PCI_CHIP_GEFORCE4TI_4200_AGP8X 0x0281 #define PCI_CHIP_GEFORCE4TI_4800SE 0x0282 #define PCI_CHIP_GEFORCE4GO_4200 0x0286 #define PCI_CHIP_QUADRO4XGL_980 0x0288 #define PCI_CHIP_QUADRO4XGL_780 0x0289 #define PCI_CHIP_QUADRO4GOGL_700 0x028C #define PCI_CHIP_GEFORCE3_MCPX 0x02A0 /* XBox */ #define PCI_CHIP_GEFORCEFX_5800ULTRA 0x0301 #define PCI_CHIP_GEFORCEFX_5800 0x0302 #define PCI_CHIP_QUADROFX_2000 0x0308 #define PCI_CHIP_QUADROFX_1000 0x0309 #define PCI_CHIP_GEFORCEFX_5600ULTRA 0x0311 #define PCI_CHIP_GEFORCEFX_5600 0x0312 /* 0x0313 */ #define PCI_CHIP_GEFORCEFX_5600SE 0x0314 /* 0x0316 */ /* 0x0317 */ #define PCI_CHIP_GEFORCEFXGO_5600 0x031A #define PCI_CHIP_GEFORCEFXGO_5650 0x031B #define PCI_CHIP_QUADROFXGO_700 0x031C /* 0x031D */ /* 0x031E */ /* 0x031F */ #define PCI_CHIP_GEFORCEFX_5200_X 0x0320 /* ??? */ #define PCI_CHIP_GEFORCEFX_5200ULTRA 0x0321 #define PCI_CHIP_GEFORCEFX_5200 0x0322 /* ??? */ #define PCI_CHIP_GEFORCEFX_5200SE 0x0323 #define PCI_CHIP_GEFORCEFXGO_5200 0x0324 #define PCI_CHIP_GEFORCEFXGO_5250 0x0325 #define PCI_CHIP_GEFORCEFXGO_5200_32M 0x0328 #define PCI_CHIP_GEFORCEFX_5200_MAC 0x0329 /* 0x0329 */ #define PCI_CHIP_QUADRO_NVS_280 0x032A #define PCI_CHIP_QUADROFX_500 0x032B #define PCI_CHIP_GEFORCEFXGO_5300 0x032C #define PCI_CHIP_GEFORCEFXGO_5100 0x032D /* 0x032F */ #define PCI_CHIP_GEFORCEFX_5900ULTRA 0x0330 #define PCI_CHIP_GEFORCEFX_5900 0x0331 #define PCI_CHIP_GEFORCEFX_5900XT 0x0332 #define PCI_CHIP_GEFORCEFX_5950ULTRA 0x0333 /* 0x0334 */ #define PCI_CHIP_QUADROFX_3000 0x0338 #define PCI_CHIP_GEFORCEFX_5700ULTRA 0x0341 #define PCI_CHIP_GEFORCEFX_5700 0x0342 #define PCI_CHIP_GEFORCEFX_5700LE 0x0343 #define PCI_CHIP_GEFORCEFX_5700VE 0x0344 /* 0x0345 */ #define PCI_CHIP_GEFORCEFXGO_5700 0x0347 /* ??? */ #define PCI_CHIP_GEFORCEFXGO_5700_X 0x0348 /* ??? */ /* 0x0349 */ /* 0x034B */ #define PCI_CHIP_QUADROFXGO_1000 0x034C #define PCI_CHIP_QUADROFX_1100 0x034E /* 0x034F */ /* NVIDIA & SGS */ #define PCI_CHIP_RIVA128 0x0018 /* IMS */ #define PCI_CHIP_IMSTT128 0x9128 #define PCI_CHIP_IMSTT3D 0x9135 /* Alliance Semiconductor */ #define PCI_CHIP_AP6410 0x3210 #define PCI_CHIP_AP6422 0x6422 #define PCI_CHIP_AT24 0x6424 #define PCI_CHIP_AT3D 0x643D /* 3dfx Interactive */ #define PCI_CHIP_VOODOO_GRAPHICS 0x0001 #define PCI_CHIP_VOODOO2 0x0002 #define PCI_CHIP_BANSHEE 0x0003 #define PCI_CHIP_VOODOO3 0x0005 #define PCI_CHIP_VOODOO5 0x0009 #define PCI_CARD_VOODOO3_2000 0x0036 #define PCI_CARD_VOODOO3_3000 0x003a /* Rendition */ #define PCI_CHIP_V1000 0x0001 #define PCI_CHIP_V2x00 0x2000 /* 3Dlabs */ #define PCI_CHIP_300SX 0x0001 #define PCI_CHIP_500TX 0x0002 #define PCI_CHIP_DELTA 0x0003 #define PCI_CHIP_PERMEDIA 0x0004 #define PCI_CHIP_MX 0x0006 #define PCI_CHIP_PERMEDIA2 0x0007 #define PCI_CHIP_GAMMA 0x0008 #define PCI_CHIP_PERMEDIA2V 0x0009 #define PCI_CHIP_PERMEDIA3 0x000A #define PCI_CHIP_PERMEDIA4 0x000C #define PCI_CHIP_R4 0x000D #define PCI_CHIP_GAMMA2 0x000E #define PCI_CHIP_R4ALT 0x0011 /* S3 */ #define PCI_CHIP_PLATO 0x0551 #define PCI_CHIP_VIRGE 0x5631 #define PCI_CHIP_TRIO 0x8811 #define PCI_CHIP_AURORA64VP 0x8812 #define PCI_CHIP_TRIO64UVP 0x8814 #define PCI_CHIP_VIRGE_VX 0x883D #define PCI_CHIP_868 0x8880 #define PCI_CHIP_928 0x88B0 #define PCI_CHIP_864_0 0x88C0 #define PCI_CHIP_864_1 0x88C1 #define PCI_CHIP_964_0 0x88D0 #define PCI_CHIP_964_1 0x88D1 #define PCI_CHIP_968 0x88F0 #define PCI_CHIP_TRIO64V2_DXGX 0x8901 #define PCI_CHIP_PLATO_PX 0x8902 #define PCI_CHIP_Trio3D 0x8904 #define PCI_CHIP_Trio3D_2X 0x8A13 #define PCI_CHIP_VIRGE_DXGX 0x8A01 #define PCI_CHIP_VIRGE_GX2 0x8A10 #define PCI_CHIP_SAVAGE3D 0x8A20 #define PCI_CHIP_SAVAGE3D_MV 0x8A21 #define PCI_CHIP_SAVAGE4 0x8A22 #define PCI_CHIP_SAVAGE2000 0x9102 #define PCI_CHIP_VIRGE_MX 0x8C01 #define PCI_CHIP_VIRGE_MXPLUS 0x8C01 #define PCI_CHIP_VIRGE_MXP 0x8C03 #define PCI_CHIP_PROSAVAGE_PM 0x8A25 #define PCI_CHIP_PROSAVAGE_KM 0x8A26 #define PCI_CHIP_SAVAGE_MX_MV 0x8c10 #define PCI_CHIP_SAVAGE_MX 0x8c11 #define PCI_CHIP_SAVAGE_IX_MV 0x8c12 #define PCI_CHIP_SAVAGE_IX 0x8c13 /* ARK Logic */ #define PCI_CHIP_1000PV 0xA091 #define PCI_CHIP_2000PV 0xA099 #define PCI_CHIP_2000MT 0xA0A1 #define PCI_CHIP_2000MI 0xA0A9 /* Tritech Microelectronics */ #define PCI_CHIP_TR25202 0xfc02 /* Neomagic */ #define PCI_CHIP_NM2070 0x0001 #define PCI_CHIP_NM2090 0x0002 #define PCI_CHIP_NM2093 0x0003 #define PCI_CHIP_NM2097 0x0083 #define PCI_CHIP_NM2160 0x0004 #define PCI_CHIP_NM2200 0x0005 #define PCI_CHIP_NM2230 0x0025 #define PCI_CHIP_NM2360 0x0006 #define PCI_CHIP_NM2380 0x0016 /* Intel */ #define PCI_CHIP_I815_BRIDGE 0x1130 #define PCI_CHIP_I815 0x1132 #define PCI_CHIP_I810_BRIDGE 0x7120 #define PCI_CHIP_I810 0x7121 /* graphics */ #define PCI_CHIP_I810_DC100_BRIDGE 0x7122 #define PCI_CHIP_I810_DC100 0x7123 /* graphics */ #define PCI_CHIP_I810_E_BRIDGE 0x7124 #define PCI_CHIP_I810_E 0x7125 /* graphics */ #define PCI_CHIP_I740_AGP 0x7800 #define PCI_CHIP_I810_IG 0x1112 /* graphics */ #define PCI_CHIP_I810_CFC 0x1132 /* graphics */ /* = I815?? */ #define PCI_CHIP_I830 0x3577 /* graphics */ #define PCI_CHIP_I845 0x2562 /* graphics */ #define PCI_CHIP_I855 0x3582 /* graphics */ #define PCI_CHIP_I865 0x2572 /* graphics */ /* Silicon Motion Inc. */ #define PCI_CHIP_SMI910 0x910 #define PCI_CHIP_SMI810 0x810 #define PCI_CHIP_SMI820 0x820 #define PCI_CHIP_SMI710 0x710 #define PCI_CHIP_SMI712 0x712 #define PCI_CHIP_SMI720 0x720 /* VMware */ #define PCI_CHIP_VMWARE0405 0x0405 #define PCI_CHIP_VMWARE0710 0x0710 /* * first the VendorId - VendorName mapping */ extern SymTabPtr xf86PCIVendorNameInfo; #ifdef INIT_PCI_VENDOR_NAME_INFO static SymTabRec xf86PCIVendorNameInfoData[] = { {PCI_VENDOR_REAL3D, "Real 3D"}, {PCI_VENDOR_COMPAQ, "Compaq"}, {PCI_VENDOR_NCR_1, "NCR"}, {PCI_VENDOR_ATI, "ATI"}, {PCI_VENDOR_VLSI, "VLSI"}, {PCI_VENDOR_AVANCE, "Avance Logic"}, {PCI_VENDOR_NS, "NS"}, {PCI_VENDOR_TSENG, "Tseng Labs"}, {PCI_VENDOR_WEITEK, "Weitek"}, {PCI_VENDOR_VIDEOLOGIC, "Video Logic"}, {PCI_VENDOR_DIGITAL, "Digital"}, {PCI_VENDOR_CIRRUS, "Cirrus Logic"}, {PCI_VENDOR_IBM, "IBM"}, {PCI_VENDOR_NCR_2, "NCR"}, {PCI_VENDOR_WD, "WD*"}, {PCI_VENDOR_AMD, "AMD"}, {PCI_VENDOR_TRIDENT, "Trident"}, {PCI_VENDOR_ALI, "ALI"}, {PCI_VENDOR_MATROX, "Matrox"}, {PCI_VENDOR_CHIPSTECH, "C&T"}, {PCI_VENDOR_MIRO, "Miro"}, {PCI_VENDOR_NEC, "NEC"}, {PCI_VENDOR_FD, "FD"}, {PCI_VENDOR_SIS, "SiS"}, {PCI_VENDOR_HP, "HP"}, {PCI_VENDOR_SMC_PCTECH, "SMC/PCTECH"}, {PCI_VENDOR_DPT, "DPT"}, {PCI_VENDOR_SGS, "SGS-Thomson"}, {PCI_VENDOR_BUSLOGIC, "BusLogic"}, {PCI_VENDOR_TI, "Texas Instruments"}, {PCI_VENDOR_SONY, "Sony"}, {PCI_VENDOR_OAK, "Oak"}, {PCI_VENDOR_WINBOND,"Winbond"}, {PCI_VENDOR_MOTOROLA, "Motorola"}, {PCI_VENDOR_OAK, "Promise"}, {PCI_VENDOR_NUMNINE, "Number Nine"}, {PCI_VENDOR_UMC, "UMC"}, {PCI_VENDOR_X , "X"}, {PCI_VENDOR_PICOP , "PICOP"}, {PCI_VENDOR_MYLEX, "Mylex"}, {PCI_VENDOR_APPLE, "Apple"}, {PCI_VENDOR_NEXGEN, "Nexgen"}, {PCI_VENDOR_QLOGIC, "QLogic"}, {PCI_VENDOR_CYRIX, "Cyrix"}, {PCI_VENDOR_LEADTEK, "Leadtek"}, {PCI_VENDOR_CONTAQ, "Contaq"}, {PCI_VENDOR_FOREX, "FOREX"}, {PCI_VENDOR_OLICOM, "Olicom"}, {PCI_VENDOR_SUN, "Sun"}, {PCI_VENDOR_DIAMOND, "Diamond"}, {PCI_VENDOR_CMD, "CMD"}, {PCI_VENDOR_APPIAN, "Appian Graphics"}, {PCI_VENDOR_VISION, "Vision"}, {PCI_VENDOR_BROOKTREE, "BrookTree"}, {PCI_VENDOR_SIERRA, "Sierra"}, {PCI_VENDOR_ACC, "ACC"}, {PCI_VENDOR_WINBOND_2, "Winbond"}, {PCI_VENDOR_DATABOOK, "Databook"}, {PCI_VENDOR_3COM, "3COM"}, {PCI_VENDOR_SMC, "SMC"}, {PCI_VENDOR_ALI_2, "ALI"}, {PCI_VENDOR_MITSUBISHI, "Mitsubishi"}, {PCI_VENDOR_SURECOM, "Surecom"}, {PCI_VENDOR_NEOMAGIC, "Neomagic"}, {PCI_VENDOR_ASP, "Advanced System Products"}, {PCI_VENDOR_CERN, "CERN"}, {PCI_VENDOR_NVIDIA, "NVidia"}, {PCI_VENDOR_IMS, "IMS"}, {PCI_VENDOR_TEKRAM, "Tekram"}, {PCI_VENDOR_TUNDRA, "Tundra"}, {PCI_VENDOR_AMCC, "AMCC"}, {PCI_VENDOR_INTEGRAPHICS, "Intergraphics"}, {PCI_VENDOR_REALTEC, "Realtek"}, {PCI_VENDOR_TRUEVISION, "Truevision"}, {PCI_VENDOR_INITIO, "Initio Corp"}, {PCI_VENDOR_CREATIVE_2, "Creative Labs"}, {PCI_VENDOR_SIGMADESIGNS_2, "Sigma Designs"}, {PCI_VENDOR_VIA, "VIA"}, {PCI_VENDOR_VORTEX, "Vortex"}, {PCI_VENDOR_EF, "EF"}, {PCI_VENDOR_FORE, "Fore Systems"}, {PCI_VENDOR_IMAGTEC, "Imaging Technology"}, {PCI_VENDOR_PLX, "PLX"}, {PCI_VENDOR_NVIDIA_SGS, "NVidia/SGS-Thomson"}, {PCI_VENDOR_NETGEAR, "Netgear"}, {PCI_VENDOR_ALLIANCE, "Alliance Semiconductor"}, {PCI_VENDOR_VMIC, "VMIC"}, {PCI_VENDOR_DIGI, "DIGI*"}, {PCI_VENDOR_MUTECH, "Mutech"}, {PCI_VENDOR_RENDITION, "Rendition"}, {PCI_VENDOR_TOSHIBA, "Toshiba"}, {PCI_VENDOR_RICOH, "Ricoh"}, {PCI_VENDOR_ZEINET, "Zeinet"}, {PCI_VENDOR_LITEON, "Lite-On"}, {PCI_VENDOR_3DFX, "3dfx Interactive"}, {PCI_VENDOR_SIGMADESIGNS, "Sigma Designs"}, {PCI_VENDOR_ENSONIQ, "Ensoniq"}, {PCI_VENDOR_ROCKWELL, "Rockwell"}, {PCI_VENDOR_YOKOGAWA, "YOKOGAWA"}, {PCI_VENDOR_TRITECH, "Tritech Microelectronics"}, {PCI_VENDOR_SYMPHONY, "Symphony"}, {PCI_VENDOR_TEKRAM_2, "Tekram"}, {PCI_VENDOR_3DLABS, "3Dlabs"}, {PCI_VENDOR_AVANCE_2, "Avance"}, {PCI_VENDOR_CREATIVE, "Creative Labs"}, {PCI_VENDOR_S3, "S3"}, {PCI_VENDOR_INTEL, "Intel"}, {PCI_VENDOR_ADAPTEC, "Adaptec"}, {PCI_VENDOR_ADAPTEC_2, "Adaptec"}, {PCI_VENDOR_ATRONICS, "Atronics"}, {PCI_VENDOR_ARK, "ARK Logic"}, {PCI_VENDOR_YAMAHA, "Yamaha"}, {PCI_VENDOR_SMI, "Silicon Motion Inc."}, {PCI_VENDOR_VMWARE, "VMware"}, {0,NULL} }; #endif /* Increase this as required */ #define MAX_DEV_PER_VENDOR 100 typedef struct { unsigned short VendorID; struct pciDevice { unsigned short DeviceID; char *DeviceName; CARD16 class; } Device[MAX_DEV_PER_VENDOR]; } pciVendorDeviceInfo; extern pciVendorDeviceInfo* xf86PCIVendorInfo; #ifdef INIT_PCI_VENDOR_INFO static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {PCI_VENDOR_REAL3D, { {PCI_CHIP_I740_PCI, "i740 (PCI)",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_COMPAQ, { {0x3033, "QVision 1280/p",0 }, {0xae10, "Smart-2/P RAID Controller",0}, {0xae32, "Netellignet 10/100",0 }, {0xae34, "Netellignet 10",0 }, {0xae35, "NetFlex 3",0 }, {0xae40, "Netellignet 10/100 Dual",0 }, {0xae43, "Netellignet 10/100 ProLiant",0 }, {0xb011, "Netellignet 10/100 Integrated",0 }, {0xf130, "ThunderLAN",0 }, {0xf150, "NetFlex 3 BNC",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_NCR_1, { {PCI_CHIP_53C810, "53c810",0}, {PCI_CHIP_53C820, "53c820",0}, {PCI_CHIP_53C825, "53c825",0}, {PCI_CHIP_53C815, "53c815",0}, {PCI_CHIP_53C810AP, "53c810AP",0}, {PCI_CHIP_53C860, "53c860",0}, {PCI_CHIP_53C896, "53c896",0}, {PCI_CHIP_53C895, "53c895",0}, {PCI_CHIP_53C885, "53c885",0}, {PCI_CHIP_53C875, "53c875",0}, {PCI_CHIP_53C875J, "53c875J",0}, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_ATI, { {PCI_CHIP_MACH32, "Mach32",0}, {PCI_CHIP_MACH64CT, "Mach64 CT",0}, {PCI_CHIP_MACH64CX, "Mach64 CX",0}, {PCI_CHIP_MACH64ET, "Mach64 ET",0}, {PCI_CHIP_MACH64GB, "Mach64 GB",0}, {PCI_CHIP_MACH64GD, "Mach64 GD",0}, {PCI_CHIP_MACH64GI, "Mach64 GI",0}, {PCI_CHIP_MACH64GL, "Mach64 GL",0}, {PCI_CHIP_MACH64GM, "Mach64 GM",0}, {PCI_CHIP_MACH64GN, "Mach64 GN",0}, {PCI_CHIP_MACH64GO, "Mach64 GO",0}, {PCI_CHIP_MACH64GP, "Mach64 GP",0}, {PCI_CHIP_MACH64GQ, "Mach64 GQ",0}, {PCI_CHIP_MACH64GR, "Mach64 GR",0}, {PCI_CHIP_MACH64GS, "Mach64 GS",0}, {PCI_CHIP_MACH64GT, "Mach64 GT",0}, {PCI_CHIP_MACH64GU, "Mach64 GU",0}, {PCI_CHIP_MACH64GV, "Mach64 GV",0}, {PCI_CHIP_MACH64GW, "Mach64 GW",0}, {PCI_CHIP_MACH64GX, "Mach64 GX",0}, {PCI_CHIP_MACH64GZ, "Mach64 GZ",0}, {PCI_CHIP_MACH64LB, "Mach64 LB",0}, {PCI_CHIP_MACH64LD, "Mach64 LD",0}, {PCI_CHIP_RAGE128LE, "Rage 128 Mobility LE",0}, {PCI_CHIP_RAGE128LF, "Rage 128 Mobility LF",0}, {PCI_CHIP_MACH64LG, "Mach64 LG",0}, {PCI_CHIP_MACH64LI, "Mach64 LI",0}, {PCI_CHIP_MACH64LM, "Mach64 LM",0}, {PCI_CHIP_MACH64LN, "Mach64 LN",0}, {PCI_CHIP_MACH64LP, "Mach64 LP",0}, {PCI_CHIP_MACH64LR, "Mach64 LR",0}, {PCI_CHIP_MACH64LS, "Mach64 LS",0}, {PCI_CHIP_RAGE128MF, "Rage 128 Mobility MF",0}, {PCI_CHIP_RAGE128ML, "Rage 128 Mobility ML",0}, {PCI_CHIP_RAGE128PD, "Rage 128 Pro PD",0}, {PCI_CHIP_RAGE128PF, "Rage 128 Pro PF",0}, {PCI_CHIP_RAGE128PP, "Rage 128 Pro PP",0}, {PCI_CHIP_RAGE128PR, "Rage 128 Pro PR",0}, {PCI_CHIP_RADEON_QD, "Radeon QD",0}, {PCI_CHIP_RADEON_QE, "Radeon QE",0}, {PCI_CHIP_RADEON_QF, "Radeon QF",0}, {PCI_CHIP_RADEON_QG, "Radeon QG",0}, {PCI_CHIP_RADEON_VE, "Radeon VE",0}, {PCI_CHIP_RAGE128RE, "Rage 128 RE",0}, {PCI_CHIP_RAGE128RF, "Rage 128 RF",0}, {PCI_CHIP_RAGE128RK, "Rage 128 RK",0}, {PCI_CHIP_RAGE128RL, "Rage 128 RL",0}, {PCI_CHIP_MACH64VT, "Mach64 VT",0}, {PCI_CHIP_MACH64VU, "Mach64 VU",0}, {PCI_CHIP_MACH64VV, "Mach64 VV",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_VLSI, { {0x0005, "82C592-FC1",0 }, {0x0006, "82C593-FC1",0 }, {0x0007, "82C594-AFC2",0 }, {0x0009, "82C597-AFC2",0 }, {0x000C, "82C541 Lynx",0 }, {0x000D, "82C543 Lynx ISA",0 }, {0x0702, "VAS96011",0 }, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_AVANCE, { {PCI_CHIP_ALG2301, "ALG2301",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_NS, { {0x0002, "87415",0 }, {0xD001, "87410",0 }, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_TSENG, { {PCI_CHIP_ET4000_W32P_A, "ET4000W32P revA",0}, {PCI_CHIP_ET4000_W32P_B, "ET4000W32P revB",0}, {PCI_CHIP_ET4000_W32P_C, "ET4000W32P revC",0}, {PCI_CHIP_ET4000_W32P_D, "ET4000W32P revD",0}, {PCI_CHIP_ET6000, "ET6000/6100",0}, {PCI_CHIP_ET6300, "ET6300",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_WEITEK, { {PCI_CHIP_P9000, "P9000",0}, {PCI_CHIP_P9100, "P9100",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_DIGITAL, { {PCI_CHIP_DEC21030, "21030/TGA",0}, {0x0001, "DC21050 PCI-PCI Bridge" /* print_pcibridge */,0 }, {0x0002, "DC21040 10Mb/s Ethernet",0 }, {0x0009, "DC21140 10/100 Mb/s Ethernet",0 }, {0x000D, "TGA2",0 }, {0x000F, "DEFPA (FDDI PCI)",0 }, {0x0014, "DC21041 10Mb/s Ethernet Plus",0 }, {0x0019, "DC21142 10/100 Mb/s Ethernet",0 }, {0x0021, "DC21052",0 }, {0x0024, "DC21152",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_CIRRUS, { {PCI_CHIP_GD5430, "GD5430",0}, {PCI_CHIP_GD5434_4, "GD5434",0}, {PCI_CHIP_GD5434_8, "GD5434",0}, {PCI_CHIP_GD5436, "GD5436",0}, {PCI_CHIP_GD5446, "GD5446",0}, {PCI_CHIP_GD5480, "GD5480",0}, {PCI_CHIP_GD5462, "GD5462",0}, {PCI_CHIP_GD5464, "GD5464",0}, {PCI_CHIP_GD5464BD, "GD5464BD",0}, {PCI_CHIP_GD5465, "GD5465",0}, {PCI_CHIP_GD7541, "GD7541",0}, {PCI_CHIP_GD7542, "GD7542",0}, {PCI_CHIP_GD7543, "GD7543",0}, {PCI_CHIP_GD7548, "GD7548",0}, {PCI_CHIP_GD7555, "GD7555",0}, #ifdef VENDOR_INCLUDE_NONVIDEO {0x6001, "CS4236B/CS4611 Audio" ,0}, #endif {0x0000, NULL,0}}}, {PCI_VENDOR_IBM, { {0x000A, "Fire Coral",0 }, {0x0018, "Token Ring",0 }, {0x001D, "82G2675",0 }, {0x0022, "82351 pci-pci bridge",0 }, {0x00B7, "256-bit Graphics Rasterizer",0 }, {0x0170, "RC1000 / GT 1000",0}, {0x0000, NULL,0}}}, #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_NCR_2, { {0x0000, NULL,0}}}, #endif #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_WD, { {0x3296, "WD 7197",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_AMD, { {0x2000, "79C970 Lance",0 }, {0x2020, "53C974 SCSI",0 }, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_TRIDENT, { {PCI_CHIP_9320, "TGUI 9320",0}, {PCI_CHIP_9420, "TGUI 9420",0}, {PCI_CHIP_9440, "TGUI 9440",0}, {PCI_CHIP_9660, "TGUI 96xx",0}, {PCI_CHIP_9388, "Cyber 9388",0}, {PCI_CHIP_9397, "Cyber 9397",0}, {PCI_CHIP_939A, "Cyber 939A/DVD",0}, {PCI_CHIP_9520, "Cyber 9520",0}, {PCI_CHIP_9525, "Cyber 9525/DVD",0}, {PCI_CHIP_9540, "Cyber 9540",0}, {PCI_CHIP_9750, "3DImage975",0}, {PCI_CHIP_9850, "3DImage985",0}, {PCI_CHIP_9880, "Blade3D",0}, {PCI_CHIP_9910, "Cyber/BladeXP",0}, {PCI_CHIP_9930, "CyberBlade/XPm",0}, {PCI_CHIP_8400, "CyberBlade/i7",0}, {PCI_CHIP_8420, "CyberBlade/DSTN/i7",0}, {PCI_CHIP_8500, "CyberBlade/i1",0}, {PCI_CHIP_8520, "CyberBlade/DSTN/i1",0}, {PCI_CHIP_8600, "CyberBlade/Ai1",0}, {PCI_CHIP_8620, "CyberBlade/DSTN/Ai1",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_ALI, { {0x1435, "M1435",0}, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_MATROX, { {PCI_CHIP_MGA2085, "MGA 2085PX",0}, {PCI_CHIP_MGA2064, "MGA 2064W",0}, {PCI_CHIP_MGA1064, "MGA 1064SG",0}, {PCI_CHIP_MGA2164, "MGA 2164W",0}, {PCI_CHIP_MGA2164_AGP, "MGA 2164W AGP",0}, {PCI_CHIP_MGAG200_PCI, "MGA G200 PCI",0}, {PCI_CHIP_MGAG200, "MGA G200 AGP",0}, {PCI_CHIP_MGAG400, "MGA G400 AGP",0}, {PCI_CHIP_MGAG100_PCI, "MGA G100 PCI",0}, {PCI_CHIP_MGAG100, "MGA G100 AGP",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_CHIPSTECH, { {PCI_CHIP_65545, "65545",0}, {PCI_CHIP_65548, "65548",0}, {PCI_CHIP_65550, "65550",0}, {PCI_CHIP_65554, "65554",0}, {PCI_CHIP_65555, "65555",0}, {PCI_CHIP_68554, "68554",0}, {PCI_CHIP_69000, "69000",0}, {PCI_CHIP_69030, "69030",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_MIRO, { {0x5601, "ZR36050",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_NEC, { {0x0046, "PowerVR PCX2",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_FD, { {0x0000, "TMC-18C30 (36C70)",0 }, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_SIS, { {PCI_CHIP_SG86C201, "SG86C201",0}, {PCI_CHIP_SG86C202, "SG86C202",0}, {PCI_CHIP_SG86C205, "SG86C205",0}, {PCI_CHIP_SG86C215, "SG86C215",0}, {PCI_CHIP_SG86C225, "SG86C225",0}, {PCI_CHIP_SIS5597, "5597",0}, {PCI_CHIP_SIS530, "530",0}, {PCI_CHIP_SIS6326, "6326",0}, {PCI_CHIP_SIS300, "300",0}, {PCI_CHIP_SIS630, "630",0}, {PCI_CHIP_SIS540, "540",0}, {PCI_CHIP_SIS82C204, "82C204",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_HP, { {0x1030, "J2585A",0 }, {0x1031, "J2585B",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_SMC_PCTECH, { {0x1000, "FDC 37C665/RZ1000",0 }, {0x1001, "FDC /RZ1001",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_DPT, { {0xA400, "SmartCache/Raid",0 }, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_SGS, { {PCI_CHIP_STG2000, "STG2000",0}, {PCI_CHIP_STG1764, "STG1764",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_BUSLOGIC, { {PCI_CHIP_946C_01, "946C 01",0}, {PCI_CHIP_946C_10, "946C 10",0}, {PCI_CHIP_FLASH_POINT, "FlashPoint",0}, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_TI, { {PCI_CHIP_TI_PERMEDIA, "Permedia",0}, {PCI_CHIP_TI_PERMEDIA2, "Permedia 2",0}, {PCI_CHIP_PCI_1130, "PCI 1130",0}, {PCI_CHIP_PCI_1131, "PCI 1131",0}, {0x8019, "TSB12LV23 IEEE1394/FireWire",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_SONY, { {0x8009, "CXD1947A IEEE1394/Firewire",0}, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_OAK, { {PCI_CHIP_OTI107, "OTI107",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_WINBOND, { {PCI_CHIP_89C940, "89C940 NE2000-PCI",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_MOTOROLA, { {PCI_CHIP_MPC105_EAGLE, "MPC105 Eagle",0}, {PCI_CHIP_MPC105_GRACKLE,"MPC105 Grackle",0}, {PCI_CHIP_RAVEN, "Raven",0}, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_OAK, { {PCI_CHIP_ULTRA_DMA, "IDE UltraDMA/33",0}, {PCI_CHIP_DC5030, "DC5030",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_NUMNINE, { {PCI_CHIP_I128, "Imagine 128",0}, {PCI_CHIP_I128_2, "Imagine 128 II",0}, {PCI_CHIP_I128_T2R, "Imagine 128 Rev 3D T2R",0}, {PCI_CHIP_I128_T2R4, "Imagine 128 Rev IV T2R4",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_UMC, { {0x0101, "UM8673F",0}, {0x673A, "UM8886BF",0}, {0x886A, "UM8886A",0}, {0x8881, "UM8881F",0}, {0x8886, "UM8886F",0}, {0x8891, "UM8891A",0}, {0x9017, "UM9017F",0}, {0xE886, "UM8886N",0}, {0xE891, "UM8891N",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_X, { {0x0001, "ITT AGX016",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_PICOP, { {0x0001, "PT86C52x Vesuvius",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_MYLEX, { {0x0010, "RAID Controller",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_APPLE, { {0x0001, "Bandit",0 }, {0x0002, "Grand Central",0 }, {0x000E, "Hydra",0 }, {0x0019, "Keylargo USB",0 }, {0x0020, "Uni-North AGP",0 }, {0x0022, "Keylargo I/O",0 }, {0x0000, NULL,0}}}, #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_NEXGEN, { {0x0000, NULL,0}}}, #endif {PCI_VENDOR_QLOGIC, { {0x1020, "ISP1020",0 }, {0x1022, "ISP1022",0 }, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_CYRIX, { {0x0000, "5510",0 }, {0x0001, "PCI Master",0 }, {0x0002, "5520",0 }, {0x0100, "5530 Kahlua Legacy",0 }, {0x0101, "5530 Kahlua SMI",0 }, {0x0102, "5530 Kahlua IDE",0 }, {0x0103, "5530 Kahlua Audio",0 }, {0x0104, "5530 Kahlua Video",0 }, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_LEADTEK, { {0x0000, NULL,0}}}, #endif {PCI_VENDOR_CONTAQ, { {0x0600, "82C599",0 }, {0xc693, "82C693",0 }, {0x0000, NULL,0}}}, #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_FOREX, { {0x0000, NULL,0}}}, #endif {PCI_VENDOR_OLICOM, { {0x0001, "OC-3136",0 }, {0x0011, "OC-2315",0 }, {0x0012, "OC-2325",0 }, {0x0013, "OC-2183",0 }, {0x0014, "OC-2326",0 }, {0x0021, "OC-6151",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_SUN, { {0x1000, "EBUS",0 }, {0x1001, "Happy Meal",0 }, {0x5000, "Advanced PCI bridge",0 }, {0x8000, "PCI Bus Module",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_CMD, { {0x0640, "640A",0 }, {0x0643, "643",0 }, {0x0646, "646",0 }, {0x0670, "670",0 }, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_APPIAN, { {0x3D32, "Jeronimo 2000 AGP",0 }, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_VISION, { {0x0001, "QD 8500",0 }, {0x0002, "QD 8580",0 }, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_BROOKTREE, { {PCI_CHIP_BT848, "848",0}, {PCI_CHIP_BT849, "849",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_SIERRA, { {0x0000, NULL,0}}}, {PCI_VENDOR_ACC, { {0x0000, NULL,0}}}, #endif {PCI_VENDOR_WINBOND_2, { {0x0001, "W83769F",0 }, {0x0105, "SL82C105",0 }, {0x0565, "W83C553",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_DATABOOK, { {0xB106, "DB87144",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_3COM, { {0x5900, "3C590 10bT",0 }, {0x5950, "3C595 100bTX",0 }, {0x5951, "3C595 100bT4",0 }, {0x5952, "3C595 10b-MII",0 }, {0x9000, "3C900 10bTPO",0 }, {0x9001, "3C900 10b Combo",0 }, /* Is it OK for 2 devices to have the same name ? */ {0x9005, "3C900 10b Combo",0 }, {0x9050, "3C905 100bTX",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_SMC, { {0x0005, "9432 TX",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_ALI_2, { {0x1445, "M1445",0 }, {0x1449, "M1449",0 }, {0x1451, "M1451",0 }, {0x1461, "M1461",0 }, {0x1489, "M1489",0 }, {0x1511, "M1511",0 }, {0x1513, "M1513",0 }, {0x1521, "M1521",0 }, {0x1523, "M1523",0 }, {0x1531, "M1531 Aladdin IV",0 }, {0x1533, "M1533 Aladdin IV",0 }, {0x5215, "M4803",0 }, {0x5219, "M5219",0 }, {0x5229, "M5229 TXpro",0 }, {0x0000, NULL,0}}}, #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_MITSUBISHI, { {0x0000, NULL,0}}}, #endif {PCI_VENDOR_SURECOM, { {0x0E34, "NE-34PCI Lan",0 }, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_NEOMAGIC, { {PCI_CHIP_NM2070, "NM2070",0}, {PCI_CHIP_NM2090, "NM2090",0}, {PCI_CHIP_NM2093, "NM2093",0}, {PCI_CHIP_NM2160, "NM2160",0}, {PCI_CHIP_NM2200, "NM2200",0}, {PCI_CHIP_NM2230, "NM2230 MagicMedia 256AV+",0}, {PCI_CHIP_NM2360, "NM2360",0}, {PCI_CHIP_NM2380, "NM2380",0}, #ifdef VENDOR_INCLUDE_NONVIDEO {0x8005, "NM2360 MagicMedia 256ZX Audio",0}, #endif {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_ASP, { { 0x1200, "ABP940",0 }, { 0x1300, "ABP940U",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_CERN, { { 0x0001, "STAR/RD24 SCI-PCI (PMC)",0 }, { 0x0002, "STAR/RD24 SCI-PCI (PMC)",0 }, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_NVIDIA, { {PCI_CHIP_NV1, "NV1",0}, {PCI_CHIP_DAC64, "DAC64",0}, {PCI_CHIP_TNT, "Riva TNT",0}, {PCI_CHIP_TNT2, "Riva TNT2",0}, {PCI_CHIP_UTNT2, "Riva Ultra TNT2",0}, {PCI_CHIP_VTNT2, "Riva Vanta",0}, {PCI_CHIP_UVTNT2, "Riva Ultra 64",0}, {PCI_CHIP_TNT2_A, "Riva TNT2 (A)",0}, {PCI_CHIP_TNT2_B, "Riva TNT2 (B)",0}, {PCI_CHIP_ITNT2, "Riva Integrated",0}, {PCI_CHIP_GEFORCE256, "GeForce 256",0}, {PCI_CHIP_GEFORCEDDR, "GeForce DDR",0}, {PCI_CHIP_QUADRO, "Quadro",0}, {PCI_CHIP_GEFORCE2MX, "GeForce2 MX",0}, {PCI_CHIP_GEFORCE2MXDDR, "GeForce2 MX DDR",0}, {PCI_CHIP_GEFORCE2GO, "GeForce2 Go",0}, {PCI_CHIP_QUADRO2MXR, "GeForce2 MXR",0}, {PCI_CHIP_GEFORCE2GTS, "GeForce2 GTS",0}, {PCI_CHIP_GEFORCE2TI, "GeForce2 Ti",0}, {PCI_CHIP_GEFORCE2ULTRA, "GeForce2 Ultra",0}, {PCI_CHIP_QUADRO2PRO, "Quadro 2 Pro",0}, {PCI_CHIP_GEFORCE4MX_460, "GeForce4 MX 460",0}, {PCI_CHIP_GEFORCE4MX_440, "GeForce4 MX 440",0}, {PCI_CHIP_GEFORCE4MX_420, "GeForce4 MX 420",0}, {PCI_CHIP_GEFORCE4MX_440SE, "GeForce4 MX 440-SE",0}, {PCI_CHIP_GEFORCE4GO_440, "GeForce4 440 Go",0}, {PCI_CHIP_GEFORCE4GO_420, "GeForce4 420 Go",0}, {PCI_CHIP_GEFORCE4GO_420_32M, "GeForce4 420 Go 32M",0}, {PCI_CHIP_GEFORCE4GO_460, "GeForce4 460 Go",0}, {PCI_CHIP_QUADRO4XGL_500, "Quadro4 500XGL",0}, {PCI_CHIP_GEFORCE4GO_440_64M, "GeForce4 440 Go 64M",0}, {PCI_CHIP_QUADRO4NVS, "Quadro4 200/400NVS",0}, {PCI_CHIP_QUADRO4XGL_550, "Quadro4 550XGL",0}, {PCI_CHIP_QUADRO4GOGL_500, "Quadro4 500 GoGL",0}, {PCI_CHIP_GEFORCE4GO_410_16M, "GeForce4 410 Go 16M",0}, {PCI_CHIP_GEFORCE4MX_440_AGP8X, "GeForce4 MX 440 with AGP8X",0}, {PCI_CHIP_GEFORCE4MX_440SE_AGP8X,"GeForce4 MX 440SE with AGP8X",0}, {PCI_CHIP_GEFORCE4MX_420_AGP8X, "GeForce4 MX 420 with AGP8X",0}, {PCI_CHIP_GEFORCE4GO_448, "GeForce4 448 Go",0}, {PCI_CHIP_GEFORCE4GO_488, "GeForce4 488 Go",0}, {PCI_CHIP_QUADRO4_XGL_580, "Quadro4 580 XGL",0}, {PCI_CHIP_QUADRO4_NVS_280, "Quadro4 280 NVS",0}, {PCI_CHIP_QUADRO4_XGL_380, "Quadro4 380 XGL",0}, {PCI_CHIP_GEFORCE2GPU, "GeForce2 Integrated GPU",0}, {PCI_CHIP_GEFORCE4GPU, "GeForce4 MX Integrated GPU",0}, {PCI_CHIP_GEFORCE3, "GeForce3",0}, {PCI_CHIP_GEFORCE3TI_200, "GeForce3 Ti 200",0}, {PCI_CHIP_GEFORCE3TI_500, "GeForce3 Ti 500",0}, {PCI_CHIP_QUADRO_DDC, "Quadro DDC",0}, {PCI_CHIP_GEFORCE4TI_4600, "GeForce4 Ti 4600",0}, {PCI_CHIP_GEFORCE4TI_4400, "GeForce4 Ti 4400",0}, {PCI_CHIP_GEFORCE4TI_4200, "GeForce4 Ti 4200",0}, {PCI_CHIP_QUADRO4XGL_900, "Quadro4 900XGL",0}, {PCI_CHIP_QUADRO4XGL_750, "Quadro4 750XGL",0}, {PCI_CHIP_QUADRO4XGL_700, "Quadro4 700XGL",0}, {PCI_CHIP_GEFORCE4TI_4800, "GeForce4 Ti 4800",0}, {PCI_CHIP_GEFORCE4TI_4200_AGP8X,"GeForce4 Ti 4200 with AGP8X",0}, {PCI_CHIP_GEFORCE4TI_4800SE, "GeForce4 Ti 4800 SE",0}, {PCI_CHIP_GEFORCE4GO_4200, "GeForce4 4200 Go",0}, {PCI_CHIP_QUADRO4XGL_980, "Quadro4 980 XGL",0}, {PCI_CHIP_QUADRO4XGL_780, "Quadro4 780 XGL",0}, {PCI_CHIP_QUADRO4GOGL_700, "Quadro4 700 GoGL",0}, {PCI_CHIP_GEFORCE3_MCPX, "GeForce3 Integrated MCPX GPU",0}, {PCI_CHIP_GEFORCEFX_5800ULTRA, "GeForce FX 5800 Ultra",0}, {PCI_CHIP_GEFORCEFX_5800, "GeForce FX 5800",0}, {PCI_CHIP_QUADROFX_2000, "Quadro FX 2000",0}, {PCI_CHIP_QUADROFX_1000, "Quadro FX 1000",0}, {PCI_CHIP_GEFORCEFX_5600ULTRA, "GeForce FX 5600 Ultra",0}, {PCI_CHIP_GEFORCEFX_5600, "GeForce FX 5600",0}, /* 0x0313 */ {PCI_CHIP_GEFORCEFX_5600SE, "GeForce FX 5600SE",0}, /* 0x0316 */ /* 0x0317 */ {PCI_CHIP_GEFORCEFXGO_5600, "GeForce FX Go5600",0}, {PCI_CHIP_GEFORCEFXGO_5650, "GeForce FX Go5650",0}, {PCI_CHIP_QUADROFXGO_700, "Quadro FX Go700",0}, /* 0x031D */ /* 0x031E */ /* 0x031F */ {PCI_CHIP_GEFORCEFX_5200_X, "GeForce FX 5200",0}, /* ??? */ {PCI_CHIP_GEFORCEFX_5200ULTRA, "GeForce FX 5200 Ultra",0}, {PCI_CHIP_GEFORCEFX_5200, "GeForce FX 5200",0}, {PCI_CHIP_GEFORCEFX_5200SE, "GeForce FX 5200SE",0}, {PCI_CHIP_GEFORCEFXGO_5200, "GeForce FX Go5200",0}, {PCI_CHIP_GEFORCEFXGO_5250, "GeForce FX Go5250",0}, {PCI_CHIP_GEFORCEFXGO_5200_32M, "GeForce FX Go5200 32M/64M",0}, /* 0x0329 */ {PCI_CHIP_QUADRO_NVS_280, "Quadro NVS 280 PCI",0}, {PCI_CHIP_QUADROFX_500, "Quadro FX 500",0}, {PCI_CHIP_GEFORCEFXGO_5300, "GeForce FX Go5300",0}, {PCI_CHIP_GEFORCEFXGO_5100, "GeForce FX Go5100",0}, /* 0x032F */ {PCI_CHIP_GEFORCEFX_5900ULTRA, "GeForce FX 5900 Ultra",0}, {PCI_CHIP_GEFORCEFX_5900, "GeForce FX 5900",0}, {PCI_CHIP_GEFORCEFX_5900XT, "GeForce FX 5900XT",0}, {PCI_CHIP_GEFORCEFX_5950ULTRA, "GeForce FX 5950 Ultra",0}, /* 0x0334 */ {PCI_CHIP_QUADROFX_3000, "Quadro FX 3000",0}, {PCI_CHIP_GEFORCEFX_5700ULTRA, "GeForce FX 5700 Ultra",0}, {PCI_CHIP_GEFORCEFX_5700, "GeForce FX 5700",0}, {PCI_CHIP_GEFORCEFX_5700LE, "GeForce FX 5700LE",0}, {PCI_CHIP_GEFORCEFX_5700VE, "GeForce FX 5700VE",0}, /* 0x0345 */ {PCI_CHIP_GEFORCEFXGO_5700, "GeForce FX Go5700",0}, /* ??? */ {PCI_CHIP_GEFORCEFXGO_5700_X, "GeForce FX Go5700",0}, /* ??? */ /* 0x0349 */ /* 0x034B */ {PCI_CHIP_QUADROFXGO_1000, "Quadro FX Go1000",0}, {PCI_CHIP_QUADROFX_1100, "Quadro FX 1100",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_IMS, { {PCI_CHIP_IMSTT128, "TwinTurbo 128", 0}, {PCI_CHIP_IMSTT3D, "TwinTurbo 3D", 0}, #ifdef VENDOR_INCLUDE_NONVIDEO {0x8849, "8849",0 }, #endif {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_TEKRAM, { {0x690C, "DC690C",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_TUNDRA, { {0x0000, "CA91C042 Universe",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_AMCC, { {0x8043, "Myrinet PCI (M2-PCI-32)",0 }, {0x807D, "S5933 PCI44",0 }, {0x809C, "S5933 Traquair HEPC3",0 }, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_INTEGRAPHICS, { {0x1680, "IGA-1680",0 }, {0x1682, "IGA-1682",0 }, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_REALTEC, { {0x8029, "8029",0 }, {0x8129, "8129",0 }, {0x8139, "RTL8139 10/100 Ethernet",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_TRUEVISION, { {0x000C, "Targa 1000",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_INITIO, { {0x9100, "320 P",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_SIGMADESIGNS_2, { {0x8300, "EM8300 MPEG2 decoder", 0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_VIA, { {0x0501, "VT 8501 MVP4 Host Bridge",0 }, {0x0505, "VT 82C505",0 }, {0x0561, "VT 82C505",0 }, {0x0571, "VT 82C586 MVP3 IDE Bridge",0 }, {0x0576, "VT 82C576 3V",0 }, {0x0586, "VT 82C586 MVP3 ISA Bridge",0 }, {0x0686, "VT 82C686 MVP4 ISA Bridge",0 }, {0x0597, "VT 82C598 MVP3 Host Bridge",0 }, {0x3038, "VT 82C586 MVP3 USB Controller",0 }, {0x3040, "VT 82C586B MVP3 ACPI Bridge",0 }, {0x3057, "VT 8501 MVP4 ACPI Bridge",0 }, {0x3058, "VT 8501 MVP4 MultiMedia",0 }, {0x3068, "VT 8501 MVP4 Modem",0 }, {0x8501, "VT 8501 MVP4 PCI/AGP Bridge",0 }, {0x8598, "VT 82C598 MVP3 PCI/AGP Bridge",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_VORTEX, { {0x0001, "GDT 6000b",0 }, {0x0000, NULL,0}}}, #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_EF, { {0x0000, NULL,0}}}, {PCI_VENDOR_FORE, { {0x0000, NULL,0}}}, {PCI_VENDOR_IMAGTEC, { {0x0000, NULL,0}}}, {PCI_VENDOR_PLX, { {0x0000, NULL,0}}}, #endif #endif {PCI_VENDOR_NVIDIA_SGS, { {PCI_CHIP_RIVA128, "Riva128",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_ALLIANCE, { {PCI_CHIP_AP6410, "ProMotion 6410",0}, {PCI_CHIP_AP6422, "ProMotion 6422",0}, {PCI_CHIP_AT24, "ProMotion AT24",0}, {PCI_CHIP_AT3D, "ProMotion AT3D",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_VMIC, { {0x0000, NULL,0}}}, {PCI_VENDOR_DIGI, { {0x0000, NULL,0}}}, #endif {PCI_VENDOR_MUTECH, { {0x0001, "MV1000",0 }, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_RENDITION, { {PCI_CHIP_V1000, "Verite 1000",0}, {PCI_CHIP_V2x00, "Verite 2100/2200",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_TOSHIBA, { {0x0000, NULL,0}}}, { PCI_VENDOR_RICOH, { { 0x0475, "RL5C475 PCI-CardBus bridge/PCMCIA",0 }, { 0x0000, NULL,0}}}, {PCI_VENDOR_ZEINET, { {0x0001, "1221",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_LITEON, { {0x0002, "82C168/9 PNIC 10/100BaseTX",0 }, {0xC115, "LC82C115 PNIC II 10/100BaseTX",0 }, {0x0000, NULL,0}}}, #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_SPECIALIX, { {0x0000, NULL,0}}}, {PCI_VENDOR_CONTROL, { {0x0000, NULL,0}}}, {PCI_VENDOR_CYCLADES, { {0x0000, NULL,0}}}, #endif #endif {PCI_VENDOR_3DFX, { {PCI_CHIP_VOODOO_GRAPHICS, "Voodoo Graphics",0}, {PCI_CHIP_VOODOO2, "Voodoo2",0}, {PCI_CHIP_BANSHEE, "Banshee",0}, {PCI_CHIP_VOODOO3, "Voodoo3",0}, {PCI_CHIP_VOODOO5, "Voodoo5",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_SIGMADESIGNS, { {0x6401, "REALmagic64/GX (SD 6425)",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_ENSONIQ, { {0x5000, "es1370 (AudioPCI)",0 }, {0x1371, "es1371",0 }, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_ROCKWELL, { {0x2005, "RS56/SP-PCI11P1 56K V90 modem/spkrphone",0 }, {0x0000, NULL,0}}}, #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_YOKOGAWA, { {0x0000, NULL,0}}}, #endif #endif {PCI_VENDOR_TRITECH, { {PCI_CHIP_TR25202, "Pyramid3D TR25202",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_NVIDIA_SGS, { {0x0018, "Riva128",0 }, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_SYMPHONY, { {0x0001, "82C101",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_TEKRAM_2, { {0xDC29, "DC290",0 }, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_3DLABS, { {PCI_CHIP_300SX, "GLINT 300SX",0}, {PCI_CHIP_500TX, "GLINT 500TX",0}, {PCI_CHIP_DELTA, "GLINT Delta",0}, {PCI_CHIP_PERMEDIA, "GLINT Permedia",0}, {PCI_CHIP_MX, "GLINT MX",0}, {PCI_CHIP_PERMEDIA2, "GLINT Permedia 2",0}, {PCI_CHIP_GAMMA, "GLINT Gamma",0}, {PCI_CHIP_PERMEDIA2V, "GLINT Permedia 2v",0}, {PCI_CHIP_PERMEDIA3, "GLINT Permedia 3",0}, {PCI_CHIP_PERMEDIA4, "GLINT Permedia 4",0}, {PCI_CHIP_R4, "GLINT R4",0}, {PCI_CHIP_R4ALT, "GLINT R4 (Alt)",0}, {PCI_CHIP_GAMMA2, "GLINT Gamma 2",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_AVANCE_2, { {PCI_CHIP_ALG2064, "ALG2064",0}, {PCI_CHIP_ALG2501, "ALG2501",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_S3, { {PCI_CHIP_PLATO, "PLATO/PX",0}, {PCI_CHIP_VIRGE, "ViRGE",0}, {PCI_CHIP_TRIO, "Trio32/64",0}, {PCI_CHIP_AURORA64VP, "Aurora64V+",0}, {PCI_CHIP_TRIO64UVP, "Trio64UV+",0}, {PCI_CHIP_TRIO64V2_DXGX,"Trio64V2/DX or /GX",0}, {PCI_CHIP_PLATO_PX, "PLATO/PX",0}, {PCI_CHIP_Trio3D, "Trio3D",0}, {PCI_CHIP_Trio3D_2X, "Trio3D/2X",0}, {PCI_CHIP_VIRGE_VX, "ViRGE/VX",0}, {PCI_CHIP_VIRGE_DXGX, "ViRGE/DX or /GX",0}, {PCI_CHIP_VIRGE_GX2, "ViRGE/GX2",0}, {PCI_CHIP_SAVAGE3D, "Savage3D (86E391)",0}, {PCI_CHIP_SAVAGE3D_MV, "Savage3D+MacroVision (86E390)",0}, {PCI_CHIP_SAVAGE4, "Savage4",0}, {PCI_CHIP_SAVAGE2000, "Savage2000",0}, {PCI_CHIP_SAVAGE_MX, "Savage/MX",0}, {PCI_CHIP_SAVAGE_MX_MV, "Savage/MX-MV",0}, {PCI_CHIP_SAVAGE_IX, "Savage/IX",0}, {PCI_CHIP_SAVAGE_IX_MV, "Savage/IX-MV",0}, {PCI_CHIP_PROSAVAGE_PM, "ProSavage PM133",0}, {PCI_CHIP_PROSAVAGE_KM, "ProSavage KM133",0}, {PCI_CHIP_VIRGE_MX, "ViRGE/MX",0}, {PCI_CHIP_VIRGE_MXPLUS, "ViRGE/MX+",0}, {PCI_CHIP_VIRGE_MXP, "ViRGE/MX+MV",0}, {PCI_CHIP_868, "868",0}, {PCI_CHIP_928, "928",0}, {PCI_CHIP_864_0, "864",0}, {PCI_CHIP_864_1, "864",0}, {PCI_CHIP_964_0, "964",0}, {PCI_CHIP_964_1, "964",0}, {PCI_CHIP_968, "968",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_INTEL,{ #ifdef VENDOR_INCLUDE_NONVIDEO {0x0482, "82375EB pci-eisa bridge",0}, {0x0483, "82424ZX cache dram controller",0}, {0x0484, "82378IB/ZB pci-isa bridge",0x0601}, {0x0486, "82430ZX Aries",0}, {0x04A3, "82434LX/NX pci cache mem controller",0}, {0x0960, "960RD processor/bridge",0}, {0x1221, "82092AA",0}, {0x1222, "82092AA",0}, {0x1223, "SAA7116",0}, {0x1226, "82596",0}, {0x1227, "82865",0}, {0x1229, "82557/8/9 10/100MBit network controller",0 }, {0x122D, "82437 Triton",0}, {0x122E, "82471 Triton",0}, {0x1230, "82371 bus-master IDE controller",0}, {0x1234, "82371MX bus-master IDE controller",0}, {0x1235, "82437MX",0}, {0x1237, "82441FX Natoma",0}, {0x124B, "82380FB",0}, {0x1250, "82439",0}, {0x7000, "82371 pci-isa bridge",0}, {0x7010, "82371 bus-master IDE controller",0}, {0x7020, "82371 bus-master IDE controller",0}, {0x7030, "82437VX",0}, {0x7100, "82439TX",0}, {0x7110, "82371AB PIIX4 ISA",0}, {0x7111, "82371AB PIIX4 IDE",0}, {0x7112, "82371AB PIIX4 USB",0}, {0x7113, "82371AB PIIX4 ACPI",0}, {0x7180, "82443LX PAC Host",0}, {0x7181, "82443LX PAC AGP",0}, {0x7190, "82443BX Host",0}, {0x7191, "82443BX AGP",0}, {0x7192, "82443BX Host (no AGP)",0}, {0x71a0, "82443GX Host",0}, {0x71a1, "82443GX AGP",0}, {0x71a2, "82443GX Host (no AGP)",0}, {0x84C4, "P6",0}, {0x84C5, "82450GX20",0}, #endif #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_CHIP_I740_AGP, "i740 (AGP)",0}, {PCI_CHIP_I810_BRIDGE, "i810 Bridge",0}, {PCI_CHIP_I810_DC100_BRIDGE, "i810-dc100 Bridge",0}, {PCI_CHIP_I810_E_BRIDGE,"i810e Bridge",0}, {PCI_CHIP_I815_BRIDGE, "i815 Bridge",0}, #endif {PCI_CHIP_I810, "i810",0}, {PCI_CHIP_I810_DC100, "i810-dc100",0}, {PCI_CHIP_I810_E, "i810e",0}, {PCI_CHIP_I810_IG, "i810-ig",0}, /* {PCI_CHIP_I810_CFC, "i810-cfc",0}, */ {PCI_CHIP_I815, "i815",0}, {PCI_CHIP_I830, "i830",0}, {PCI_CHIP_I845, "i845",0}, {PCI_CHIP_I855, "i855",0}, {PCI_CHIP_I865, "i865",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_ADAPTEC, { {0x0010, "2940U2",0 }, {0x1078, "7810",0 }, {0x5078, "7850",0 }, {0x5578, "7855",0 }, {0x6078, "7860",0 }, {0x6178, "2940AU",0 }, {0x7078, "7870",0 }, {0x7178, "2940",0 }, {0x7278, "7872",0 }, {0x7378, "398X",0 }, {0x7478, "2944",0 }, {0x7895, "7895",0 }, {0x8078, "7880",0 }, {0x8178, "2940U/UW",0 }, {0x8278, "3940U/UW",0 }, {0x8378, "389XU",0 }, {0x8478, "2944U",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_ADAPTEC_2, { {0x001F, "7890/7891",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_ATRONICS, { {0x2015, "IDE-2015PL",0 }, {0x0000, NULL,0}}}, {PCI_VENDOR_ARK, { {PCI_CHIP_1000PV, "1000PV",0}, {PCI_CHIP_2000PV, "2000PV",0}, {PCI_CHIP_2000MT, "2000MT",0}, {PCI_CHIP_2000MI, "2000MI",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_YAMAHA, { {0x000a, "YMF740-V Audio",0}, {0x0000, NULL,0}}}, #endif {PCI_VENDOR_SMI, { {PCI_CHIP_SMI910, "Lynx",0}, {PCI_CHIP_SMI810, "LynxE",0}, {PCI_CHIP_SMI820, "Lynx3D",0}, {PCI_CHIP_SMI710, "LynxEM",0}, {PCI_CHIP_SMI712, "LynxEM+",0}, {PCI_CHIP_SMI720, "Lynx3DM",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_VMWARE, { {PCI_CHIP_VMWARE0405, "PCI SVGA (FIFO)",0}, {PCI_CHIP_VMWARE0710, "LEGACY SVGA",0}, {0x0000, NULL,0}}}, {0x0000, { {0x0000, NULL,0}}}, }; #endif #ifdef DECLARE_CARD_DATASTRUCTURES /* Increase this as required */ #define MAX_CARD_PER_VENDOR 64 typedef void (*pciPrintProcPtr)(pciCfgRegs *); typedef struct { unsigned short VendorID; struct pciCard { unsigned short SubsystemID; char *CardName; CARD16 class; pciPrintProcPtr printFunc; } Device[MAX_CARD_PER_VENDOR]; } pciVendorCardInfo; extern pciVendorCardInfo* xf86PCICardInfo; #ifdef INIT_PCI_CARD_INFO #define NF (pciPrintProcPtr)NULL static pciVendorCardInfo xf86PCICardInfoData[] = { #ifdef VENDOR_INCLUDE_NONVIDEO { PCI_VENDOR_3COM, { { 0x9005, "PCI Combo ethernet card",0,NF }, { 0x0000, (char *)NULL,0, NF } } }, #endif #ifdef VENDOR_INCLUDE_NONVIDEO { PCI_VENDOR_ADAPTEC, { { 0x7881, "AHA-2940U/UW SCSI",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, #endif /* ATI card info deleted; unmaintainable */ #ifdef VENDOR_INCLUDE_NONVIDEO { PCI_VENDOR_COMPAQ, { { 0xC001, "NC3121",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_NCR_1, { { 0x1000, "SCSI HBA",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_REALTEC, { { 0x8139, "Generic",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_CREATIVE_2, { { 0x1017, "3D Blaster Banshee",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, {PCI_VENDOR_DIGITAL, { { 0x500A, "EtherWORKS 10/100",0, NF}, { 0x0000, (char *)NULL,0, NF } } }, #endif { PCI_VENDOR_SONY, { { 0x8051, "Vaio Video",0,NF }, #ifdef VENDOR_INCLUDE_NONVIDEO { 0x8052, "Vaio Audio",0,NF }, { 0x8054, "Vaio Firewire",0,NF }, { 0x8056, "Vaio Modem",0,NF }, { 0x8057, "Vaio Ethernet",0,NF }, #endif { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_DIAMOND, { { 0x0003, "Monster Fusion",0, NF }, { 0x00b8, "Fire GL1",0, NF }, { 0x0100, "Stealth II G460",0, NF }, { 0x0154, "Fire GL 1000 PRO",0, NF }, { 0x0172, "Fire GL2",0, NF }, { 0x0173, "Fire GL2",0, NF }, { 0x0550, "Viper 550",0, NF }, { 0x1092, "Viper 330",0, NF }, { 0x1103, "Fire GL 1000",0, NF }, { 0x2000, "Stealth II S220",0, NF }, { 0x2110, "Sonic Impact S70",0, NF }, { 0x4803, "Monster Fusion",0, NF }, { 0x6820, "Viper 770",0, NF }, { 0x8000, "C&T 69000",0, NF }, { 0x8760, "Fireport 40 Dual",0, NF }, { 0x8a10, "Stealth 3D 4000",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_APPIAN, { { 0x3d32, "Jeronimo 2000",0, NF }, { 0x3db3, "Jeronimo Pro",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_3DFX, { { PCI_CARD_VOODOO3_2000, "Voodoo3 2000",0, NF }, { PCI_CARD_VOODOO3_3000, "Voodoo3 3000",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_3DLABS, { { 0x0096, "Permedia",0, NF }, { 0x0098, "PermediaNT",0, NF }, { 0x0099, "PermediaLC",0, NF }, { 0x0100, "Permedia2 PCI",0, NF }, { 0x0101, "Permedia2 AGP",0, NF }, { 0x0102, "Oxygen GMX2000 PCI",0, NF }, { 0x0106, "Oxygen GMX2000 AGP",0, NF }, { 0x0116, "Oxygen GVX1 AGP",0, NF }, { 0x0121, "Oxygen VX1 PCI",0, NF }, { 0x0122, "Oxygen ACX AGP",0, NF }, { 0x0123, "Oxygen ACX PCI",0, NF }, { 0x0125, "Oxygen VX1 AGP",0, NF }, { 0x0127, "Permedia3 Create!",0, NF }, { 0x0134, "Oxygen GVX1 PCI",0, NF }, { 0x0136, "Oxygen GVX210 AGP",0, NF }, { 0x0140, "Oxygen VX1-16 AGP",0, NF }, { 0x0144, "Oxygen VX1-4X AGP",0, NF }, { 0x0400, "Oxygen GVX420 AGP",0, NF }, { 0x0800, "Oxygen VX1-1600SW PCI",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_ELSA, { { 0x0914, "Winner 1000",0, NF }, { 0x0930, "Winner 1000PRO 864",0, NF }, { 0x0931, "Winner 1000PRO Trio32",0, NF }, { 0x0932, "Winner 1000Trio Trio64",0, NF }, { 0x0933, "Winner 1000TrioV Trio64V+",0, NF }, { 0x0934, "Victory 3D",0, NF }, { 0x0935, "Winner 1000 T2D",0, NF }, { 0x0936, "Winner 1000PRO 868",0, NF }, { 0x0937, "Winner 1000PRO/X 868",0, NF }, { 0x0938, "Winner 1000ViRGE",0, NF }, { 0x0939, "Winner 1000ViRGE/DX",0, NF }, { 0x093a, "Winner 1000/T2DX",0, NF }, { 0x093b, "Winner DUO M5",0, NF }, { 0x093c, "Victory 1000",0, NF }, { 0x0940, "Winner 2000PRO 964/TVP3020",0, NF }, { 0x0941, "Winner 2000PRO/X 968/TVP3020",0, NF }, { 0x0942, "Winner 2000PRO/X 968/TVP3026",0, NF }, { 0x0943, "Winner 2000AVI 968/TVP3026",0, NF }, { 0x0948, "Winner 2000PRO-8 964/RGB528",0, NF }, { 0x094a, "Winner 2000PRO-8 968/RGB528",0, NF }, { 0x094b, "Winner 2000PRO-8 968/TVP3030",0, NF }, { 0x0950, "ViRGE/VX",0, NF }, { 0x0951, "Winner 2000AVI 3D",0, NF }, { 0x0952, "Winner 2000AVI 220",0, NF }, { 0x0960, "Winner 3000M",0, NF }, { 0x0962, "Winner 3000L",0, NF }, { 0x0964, "Winner 3000XL",0, NF }, { 0x096a, "Winner 3000Twin",0, NF }, { 0x096c, "Winner 3000LT",0, NF }, { 0x0980, "GLoria 4 TVP3026",0, NF }, { 0x0982, "GLoria 4 TVP3030",0, NF }, { 0x0981, "GLoria 8",0, NF }, { 0x0a10, "GLoria M",0, NF }, { 0x0a14, "GLoria S",0, NF }, { 0x0a31, "Winner 2000 Office",0, NF }, { 0x0a32, "GLoria Synergy P2C",0, NF }, { 0x0a33, "GLoria Synergy P2C",0, NF }, { 0x0a34, "GLoria Synergy P2V",0, NF }, { 0x0a35, "GLoria Synergy P2A",0, NF }, { 0x0a36, "Quad GLoria Synergy P2A",0, NF }, { 0x0a40, "GLoria MX",0, NF }, { 0x0a41, "GLoria XL",0, NF }, { 0x0a42, "GLoria XXL",0, NF }, { 0x0a43, "Winner 2000 Office P2V",0, NF }, { 0x0a44, "Winner 2000 Office P2A",0, NF }, { 0x0a80, "GLoria S MAC",0, NF }, { 0x0c10, "Victory Erazor 4",0, NF }, { 0x0c11, "Victory Erazor 8",0, NF }, { 0x0c12, "Winner 1000 R3D",0, NF }, { 0x0c13, "Winner 1000 ZX4",0, NF }, { 0x0c14, "Victory Erazor/LT SGRAM",0, NF }, { 0x0c15, "Victory Erazor/LT SDRAM",0, NF }, { 0x0c18, "Erazor II SGRAM",0, NF }, { 0x0c19, "Erazor II SDRAM video",0, NF }, { 0x0c1a, "Synergy Pro",0, NF }, { 0x0c1c, "Erazor II SDRAM",0, NF }, { 0x0c20, "Synergy II 32",0, NF }, { 0x0c21, "Synergy II 16",0, NF }, { 0x0c22, "Erazor III",0, NF }, { 0x0c23, "Erazor III video",0, NF }, { 0x0d10, "Victory II SGRAM",0, NF }, { 0x0d11, "Victory II SDRAM",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_HERCULES, { { 0x0001, "Thriller3D",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_IBM, { { 0x00ba, "Thinkpad 600 NeoMagic NM2160",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, {PCI_VENDOR_INTEL, { #ifdef VENDOR_INCLUDE_NONVIDEO { 0x0009, "PCI 10/100Mb/s ethernet card",0, NF }, /* Seattle AL440BX is 0x8080, is anything else ? */ { 0x8080, "motherboard",0, NF }, { 0x4d55, "Maui (MU) motherboard",0, NF }, #endif { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_MATROX, { { 0x1100, "Mystique",0, NF }, { 0x1000, "Millennium II",0, NF }, { 0x0100, "Millennium II",0, NF }, { 0x1200, "Millennium II",0, NF }, { PCI_CARD_MILL_G200_SD, "Millennium G200 SD",0, NF }, { PCI_CARD_PROD_G100_SD, "Produktiva G100 SD",0, NF }, { PCI_CARD_MYST_G200_SD, "Mystique G200 SD",0, NF }, { PCI_CARD_MILL_G200_SG, "Millennium G200 SG",0, NF }, { PCI_CARD_MARV_G200_SD, "Marvel G200 SD",0, NF }, { 0x1001, "Productiva G100 SG",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_SIS, { { 0x6306, "530 based motherboard",0, NF }, { 0x6326, "6326 based card",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, #ifdef VENDOR_INCLUDE_NONVIDEO { PCI_VENDOR_CREATIVE, { { 0x4c4c, "Sound Blaster PCI128",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, #endif { PCI_VENDOR_S3, { { 0x8904, "Trio3D",0, NF }, { 0x8a10, "Generic",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_NUMNINE, { { 0x8a10, "Reality 334",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_TOSHIBA, { { 0x0001, "4010CDT CT65555",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, #ifdef VENDOR_INCLUDE_NONVIDEO { PCI_VENDOR_LITEON, { { 0xc001, "LNE100TX Version 2.0",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_BUSLOGIC, { { 0x1040, "BT958",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_NETGEAR, { { 0xf004, "FA310-TX Rev. D2",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, #endif #if 0 { PCI_VENDOR_VMWARE, { {PCI_CHIP_VMWARE0405, "PCI SVGA (FIFO)",0, NF }, {PCI_CHIP_VMWARE0710, "LEGACY SVGA",0, NF }, {0x0000, NULL,0, NF } } }, #endif {0x0000, { {0x0000, NULL,0, NF } } }, }; #endif #endif #endif /* _XF86_PCIINFO_H */ nvtv-0.4.7/src/xf86str.h0000644000175000001440000000026307337247443010476 /* Hack to be able to use xf86PciInfo.h unmodified */ typedef struct { int token; /* id of the token */ const char * name; /* token name */ } SymTabRec, *SymTabPtr; nvtv-0.4.7/src/xfree.h0000644000175000001440000002132507712416354010261 /* NVTV xfree -- Dirk Thierbach * * Header: All definitions from xfree that are needed. * */ #ifndef _XFREE_H #define _XFREE_H 1 #include #include #include "miscstruct.h" #define __inline__ inline /* -------- vgahw/vgaHW.h -------- */ /* Standard VGA registers */ #define VGA_ATTR_INDEX 0x3C0 #define VGA_ATTR_DATA_W 0x3C0 #define VGA_ATTR_DATA_R 0x3C1 #define VGA_IN_STAT_0 0x3C2 /* read */ #define VGA_MISC_OUT_W 0x3C2 /* write */ #define VGA_ENABLE 0x3C3 #define VGA_SEQ_INDEX 0x3C4 #define VGA_SEQ_DATA 0x3C5 #define VGA_DAC_MASK 0x3C6 #define VGA_DAC_READ_ADDR 0x3C7 #define VGA_DAC_WRITE_ADDR 0x3C8 #define VGA_DAC_DATA 0x3C9 #define VGA_FEATURE_R 0x3CA /* read */ #define VGA_MISC_OUT_R 0x3CC /* read */ #define VGA_GRAPH_INDEX 0x3CE #define VGA_GRAPH_DATA 0x3CF #define VGA_IOBASE_MONO 0x3B0 #define VGA_IOBASE_COLOR 0x3D0 #define VGA_CRTC_INDEX_OFFSET 0x04 #define VGA_CRTC_DATA_OFFSET 0x05 #define VGA_IN_STAT_1_OFFSET 0x0A /* read */ #define VGA_FEATURE_W_OFFSET 0x0A /* write */ /**** common/xf86str.h */ /* Flags for driver messages */ typedef enum { X_PROBED, /* Value was probed */ X_CONFIG, /* Value was given in the config file */ X_DEFAULT, /* Value is a default */ X_CMDLINE, /* Value was given on the command line */ X_NOTICE, /* Notice */ X_ERROR, /* Error message */ X_WARNING, /* Warning message */ X_INFO, /* Informational message */ X_NONE, /* No prefix */ X_NOT_IMPLEMENTED /* Not implemented */ } MessageType; /* Video mode flags */ typedef enum { V_PHSYNC = 0x0001, V_NHSYNC = 0x0002, V_PVSYNC = 0x0004, V_NVSYNC = 0x0008, V_INTERLACE = 0x0010, V_DBLSCAN = 0x0020, V_CSYNC = 0x0040, V_PCSYNC = 0x0080, V_NCSYNC = 0x0100, V_HSKEW = 0x0200, /* hskew provided */ V_BCAST = 0x0400, V_PIXMUX = 0x1000, V_DBLCLK = 0x2000, V_CLKDIV2 = 0x4000 } ModeFlags; typedef enum { INTERLACE_HALVE_V = 0x0001 /* Halve V values for interlacing */ } CrtcAdjustFlags; /* Flags passed to ChipValidMode() */ typedef enum { MODECHECK_INITIAL = 0, MODECHECK_FINAL = 1 } ModeCheckFlags; /* These are possible return values for xf86CheckMode() and ValidMode() */ typedef enum { MODE_OK = 0, /* Mode OK */ MODE_HSYNC, /* hsync out of range */ MODE_VSYNC, /* vsync out of range */ MODE_H_ILLEGAL, /* mode has illegal horizontal timings */ MODE_V_ILLEGAL, /* mode has illegal horizontal timings */ MODE_BAD_WIDTH, /* requires an unsupported linepitch */ MODE_NOMODE, /* no mode with a maching name */ MODE_NO_INTERLACE, /* interlaced mode not supported */ MODE_NO_DBLESCAN, /* doublescan mode not supported */ MODE_NO_VSCAN, /* multiscan mode not supported */ MODE_MEM, /* insufficient video memory */ MODE_VIRTUAL_X, /* mode width too large for specified virtual size */ MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */ MODE_MEM_VIRT, /* insufficient video memory given virtual size */ MODE_NOCLOCK, /* no fixed clock available */ MODE_CLOCK_HIGH, /* clock required is too high */ MODE_CLOCK_LOW, /* clock required is too low */ MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */ MODE_BAD_HVALUE, /* horizontal timing was out of range */ MODE_BAD_VVALUE, /* vertical timing was out of range */ MODE_BAD_VSCAN, /* VScan value out of range */ MODE_HSYNC_NARROW, /* horizontal sync too narrow */ MODE_HSYNC_WIDE, /* horizontal sync too wide */ MODE_HBLANK_NARROW, /* horizontal blanking too narrow */ MODE_HBLANK_WIDE, /* horizontal blanking too wide */ MODE_VSYNC_NARROW, /* vertical sync too narrow */ MODE_VSYNC_WIDE, /* vertical sync too wide */ MODE_VBLANK_NARROW, /* vertical blanking too narrow */ MODE_VBLANK_WIDE, /* vertical blanking too wide */ MODE_PANEL, /* exceeds panel dimensions */ MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */ MODE_ONE_WIDTH, /* only one width is supported */ MODE_ONE_HEIGHT, /* only one height is supported */ MODE_ONE_SIZE, /* only one resolution is supported */ MODE_BAD = -2, /* unspecified reason */ MODE_ERROR = -1 /* error condition */ } ModeStatus; # define M_T_BUILTIN 0x01 /* built-in mode */ # define M_T_CLOCK_C (0x02 | M_T_BUILTIN) /* built-in mode - configure clock */ # define M_T_CRTC_C (0x04 | M_T_BUILTIN) /* built-in mode - configure CRTC */ # define M_T_CLOCK_CRTC_C (M_T_CLOCK_C | M_T_CRTC_C) /* built-in mode - configure CRTC and clock */ # define M_T_DEFAULT 0x10 /* (VESA) default modes */ /* Video mode */ typedef struct _DisplayModeRec { struct _DisplayModeRec * prev; struct _DisplayModeRec * next; char * name; /* identifier for the mode */ ModeStatus status; int type; /* These are the values that the user sees/provides */ int Clock; /* pixel clock freq */ int HDisplay; /* horizontal timing */ int HSyncStart; int HSyncEnd; int HTotal; int HSkew; int VDisplay; /* vertical timing */ int VSyncStart; int VSyncEnd; int VTotal; int VScan; int Flags; /* These are the values the hardware uses */ int ClockIndex; int SynthClock; /* Actual clock freq to * be programmed */ int CrtcHDisplay; int CrtcHBlankStart; int CrtcHSyncStart; int CrtcHSyncEnd; int CrtcHBlankEnd; int CrtcHTotal; int CrtcHSkew; int CrtcVDisplay; int CrtcVBlankStart; int CrtcVSyncStart; int CrtcVSyncEnd; int CrtcVBlankEnd; int CrtcVTotal; Bool CrtcHAdjusted; Bool CrtcVAdjusted; int PrivSize; INT32 * Private; int PrivFlags; float HSync, VRefresh; } DisplayModeRec, *DisplayModePtr; /* * memType is of the size of the addressable memory (machine size) * usually unsigned long. */ typedef pointer (*funcPointer)(void); typedef struct _ScrnInfoRec { int scrnIndex; /* Number of this screen */ /* ... */ DisplayModePtr currentMode; /* current mode */ /* ... */ pointer driverPrivate; /* Driver private area */ DevUnion * privates; /* Other privates can hook in * here */ } ScrnInfoRec; typedef struct _ScrnInfoRec *ScrnInfoPtr; /**** common/xf86.h */ extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */ /* ---------------- nv driver files ---------------- */ /**** nv_dac.c */ #define DDC_SDA_READ_MASK (1 << 3) #define DDC_SCL_READ_MASK (1 << 2) #define DDC_SDA_WRITE_MASK (1 << 4) #define DDC_SCL_WRITE_MASK (1 << 5) /**** riva_hw.h */ typedef struct _riva_hw_inst { CARD32 Architecture; CARD32 Version; CARD32 CrystalFreqKHz; CARD32 RamAmountKBytes; CARD32 MaxVClockFreqKHz; CARD32 RamBandwidthKBytesPerSec; CARD32 EnableIRQ; CARD32 IO; #if 1 /* from a different riva_hw ??? */ CARD32 VBlankBit; CARD32 FifoFreeCount; CARD32 FifoEmptyCount; #endif /* * Non-FIFO registers. */ volatile CARD32 *PCRTC; volatile CARD32 *PRAMDAC; volatile CARD32 *PFB; volatile CARD32 *PFIFO; volatile CARD32 *PGRAPH; volatile CARD32 *PEXTDEV; volatile CARD32 *PTIMER; volatile CARD32 *PMC; volatile CARD32 *PRAMIN; volatile CARD32 *FIFO; volatile CARD32 *CURSOR; volatile CARD32 *CURSORPOS; volatile CARD32 *VBLANKENABLE; volatile CARD32 *VBLANK; volatile CARD8 *PCIO; volatile CARD8 *PVIO; volatile CARD8 *PDIO; #if 1 volatile CARD32 *PVIDEO; /* extra */ volatile CARD32 *PTV; #endif /* Remaining entries cut */ #if 0 /* * Common chip functions. */ int (*Busy)(struct _riva_hw_inst *); void (*CalcStateExt)(struct _riva_hw_inst *,struct _riva_hw_state *,int,int,int,int,int,int,int,int,int,int,int,int,int); void (*LoadStateExt)(struct _riva_hw_inst *,struct _riva_hw_state *); void (*UnloadStateExt)(struct _riva_hw_inst *,struct _riva_hw_state *); void (*SetStartAddress)(struct _riva_hw_inst *,CARD32); void (*SetSurfaces2D)(struct _riva_hw_inst *,CARD32,CARD32); void (*SetSurfaces3D)(struct _riva_hw_inst *,CARD32,CARD32); int (*ShowHideCursor)(struct _riva_hw_inst *,int); void (*LockUnlock)(struct _riva_hw_inst *, int); /* * Current extended mode settings. */ struct _riva_hw_state *CurrentState; /* * FIFO registers. */ RivaRop *Rop; RivaPattern *Patt; RivaClip *Clip; RivaPixmap *Pixmap; RivaScreenBlt *Blt; RivaBitmap *Bitmap; RivaLine *Line; RivaTexturedTriangle03 *Tri03; RivaTexturedTriangle05 *Tri05; #endif } RIVA_HW_INST; #endif nvtv-0.4.7/man/0000777000175000001440000000000010041244623007027 5nvtv-0.4.7/man/Makefile.in0000644000175000001440000001567310041244623011024 # Makefile.in generated automatically by automake 1.4-p6 from Makefile.am # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : CC = @CC@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ MAKEINFO = @MAKEINFO@ OBJS_BACKEND = @OBJS_BACKEND@ OBJS_EXTRA = @OBJS_EXTRA@ OBJS_GUI = @OBJS_GUI@ PACKAGE = @PACKAGE@ PKG_CONFIG = @PKG_CONFIG@ PROGRAM = @PROGRAM@ VERSION = @VERSION@ WX_CFLAGS = @WX_CFLAGS@ WX_CFLAGS_ONLY = @WX_CFLAGS_ONLY@ WX_CONFIG_PATH = @WX_CONFIG_PATH@ WX_CPPFLAGS = @WX_CPPFLAGS@ WX_CXXFLAGS = @WX_CXXFLAGS@ WX_CXXFLAGS_ONLY = @WX_CXXFLAGS_ONLY@ WX_LIBS = @WX_LIBS@ WX_LIBS_STATIC = @WX_LIBS_STATIC@ WX_VERSION = @WX_VERSION@ man_MANS = nvtv.1x nvtvd.8 EXTRA_DIST = $(man_MANS) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../src/config.h CONFIG_CLEAN_FILES = man1dir = $(mandir)/man1 man8dir = $(mandir)/man8 MANS = $(man_MANS) NROFF = nroff DIST_COMMON = Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best all: all-redirect .SUFFIXES: $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps man/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status install-man1: $(mkinstalldirs) $(DESTDIR)$(man1dir) @list='$(man1_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ done uninstall-man1: @list='$(man1_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ rm -f $(DESTDIR)$(man1dir)/$$inst; \ done install-man8: $(mkinstalldirs) $(DESTDIR)$(man8dir) @list='$(man8_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.8*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \ $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \ done uninstall-man8: @list='$(man8_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.8*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \ rm -f $(DESTDIR)$(man8dir)/$$inst; \ done install-man: $(MANS) @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-man1 install-man8 uninstall-man: @$(NORMAL_UNINSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-man1 uninstall-man8 tags: TAGS TAGS: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = man distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done info-am: info: info-am dvi-am: dvi: dvi-am check-am: all-am check: check-am installcheck-am: installcheck: installcheck-am install-exec-am: install-exec: install-exec-am install-data-am: install-man install-data: install-data-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-am uninstall-am: uninstall-man uninstall: uninstall-am all-am: Makefile $(MANS) all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: $(mkinstalldirs) $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man8 mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: mostlyclean-am: mostlyclean-generic mostlyclean: mostlyclean-am clean-am: clean-generic mostlyclean-am clean: clean-am distclean-am: distclean-generic clean-am distclean: distclean-am maintainer-clean-am: maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-am .PHONY: install-man1 uninstall-man1 install-man8 uninstall-man8 \ install-man uninstall-man tags distdir info-am info dvi-am dvi check \ check-am installcheck-am installcheck install-exec-am install-exec \ install-data-am install-data install-am install uninstall-am uninstall \ all-redirect all-am all installdirs mostlyclean-generic \ distclean-generic clean-generic maintainer-clean-generic clean \ mostlyclean distclean maintainer-clean # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: nvtv-0.4.7/man/Makefile.am0000644000175000001440000000020707665363257011025 ## Process this file with automake to produce Makefile.in ## Used automake 1.4 man_MANS = nvtv.1x nvtvd.8 EXTRA_DIST = $(man_MANS) nvtv-0.4.7/man/nvtv.1x0000644000175000001440000001315610005305110010205 .TH NVTV "1" "March 2002" "User Commands" "User Commands" .SH NAME nvtv \(em GUI to control TV output hardware settings .SH DESCRIPTION nvtv is a small utility to control the output modes of TV-OUT encoders on many Nvidia-based video cards, as well as on the Voodoo3 video card. Use this with care, you may damage your hardware with a wrong set of options! You can find more detailed descritiptions of each option in the file .B /usr/share/doc/nvtv/USAGE.gz . .SH OPTIONS .TP \fB\-h\fR \fB\-\-help\fR Print help message .TP \fB\-\-display\fR hst:# X server to contact .TP \fB\-m\fR \fB\-\-tv\-off\fR TV off, switch to monitor .TP \fB\-t\fR \fB\-\-tv\-on\fR TV on .TP \fB\-b\fR \fB\-\-tv\-bars\fR Color bars .TP \fB\-p\fR \fB\-\-print\fR Calculate and print register values .TP \fB\-F\fR \fB\-\-fetch\fR Fetch current mode (use only for printing) .TP \fB\-l\fR \fB\-\-list\fR List available modes on stdout. Must be combined with -T if hardware is not accessible. Can be combined with -S. Fields are seperated by tabs, and contain TV system, resolution, size, overscan compenstation percentage, and aspect in that order. .TP \fB\-r\fR \fB\-\-resolution\fR x,y Select resolution (screen size in pixels) .TP \fB\-o\fR \fB\-\-overscan\fR x,y Select overscan compensation percentage (as float) .TP \fB\-s\fR \fB\-\-size\fR # Select size (for predefined modes) .TP \fB\-S\fR \fB\-\-system\fR NTSC,NTSC-J,PAL,PAL-60,PAL-NC,PAL-M,PAL-M60,PAL-X,SECAM Select the TV system. PAL-X is a pseudo-PAL system with slightly different subcarrier frequencies. .TP \fB\-C\fR \fB\-\-connector\fR AUTO, COMPOSITE, SVIDEO, BOTH, CONVERT Select the video connecter. CONVERT compensates for cheap SVideo to composite converter cables that don't merge both lines. FBAS and SVHS are still recognized for compatibility reasons. .TP \fB\-T\fR \fB\-\-chip\fR or : Select the encoder chip by I2C bus and address, or by type (BROOKTREE, CONEXANT, NVIDIA, CHRONTEL1,C HRONTEL2, PHILIPS1, PHILIPS2). CHRONTEL and PHILIPS default to CHRONTEL1 and PHILIPS1. .TP \fB\-A\fR \fB\-\-card-addr\fR :. Graphics card pci address (hexadecimal), as given by lspci. .TP \fB\-W\fR \fB\-\-win\-id\fR id Select window by numerical id .TP \fB\-w\fR \fB\-\-win\-name\fR name Select window by name .TP \fB\-c\fR \fB\-\-center\fR Center selected window .TP \fB\-X\fR \fB\-\-switch\-mode\fR Switch X mode .TP \fB\-1\fR Use first head .TP \fB\-2\fR Use second head (if available) .TP \fB\-q\fR \fB\-\-query\fR Query status of display (monitor, TV, flatpanel) .TP \fB\-P\fR \fB\-\-probe\fR Probe and print system information .TP \fB\-N\fR \fB\-\-nvdev\fR Enable usage of /dev/nv* devices .TP \fB\-g\fR \fB\-\-gui\fR Always use gui .TP \fB\-n\fR \fB\-\-no\-root\fR (only for debugging) .TP \fB\-d\fR \fB\-\-debug\fR (only for debugging) .TP \fB\-\-set\fR name:val Specify the setting \fIname\fR with value \fIval\fR (see below). .SH SETTINGS A complete list of all available settings can be obtained with the option \fB\-h\fR. The values may be adjusted according to the capabilities of the TV encoder chip, and not all encoders support all settings. Also, equal values may have different effects for different encoder chips. Settings include .TP .B Contrast from -100 (percent) to 100 (percent). .TP .B Saturation from -100 (percent) to 100 (percent). .TP .B Brightness# from -50 (percent) to 50 (percent). This setting and the two following settings change the TV signal directly and should be used carefully. Extreme values may degrade the signal up to the point where it cannot be properly displayed anymore. .TP .B Contrast# from -50 (percent) to 50 (percent). .TP .B Saturation# from -50 (percent) to 50 (percent). .TP .B Phase from -60 (degrees) to 60 (degrees). .TP .B Hue from -60 (degrees) to 60 (degrees). .TP .B Flicker Flicker filter, from 0 (percent) to 100 (percent). .TP .B AdaptFlicker Adaptive flicker filter, from 0 (percent) to 100 (percent). .TP .B LumaBandwidth Bandwidth filter for the luminance channel, from 0 (percent) to 100 (percent). Larger bandwidth gives more horizontal detail, but is also more sensitive to noise. .TP .B ChromaBandwidth Bandwidth filter for the chrominance channel, from 0 (percent) to 100 (percent). .TP .B Sharpness Sharpness (or text enhancement) filter, from 0 (percent) to 100 (percent). .TP .B CrossColor Cross color reduction filter, from 0 (percent) to 100 (percent). .TP .B Dualview Flag to dislay the image both on the monitor and the TV. Not supported for all modes. .TP .B Monochrome Flag to display TV image in monochrome. .TP .B Non-Interlaced Flag to display TV image in non-interlaced mode. Reduces vertical detail, but decreases flicker. .TP .B Macrovision Flag to enable macrovision. .TP .B FreeCarrier Flag to let the color carrier generator run free. .TP .B Colorfix Flag to fix the color format for Philips encoder chips. .TP .B AdjustCursor Flag to adjust cursor when in \fIshared view\fR dualhead mode. .TP .B ViewportCursor (flag) Flag to adjust the TV viewport by cursor when in \fIshared view\fR dualhead mode. .TP .B ViewportMonitor (flag) Flag to adjust the TV viewport by the monitor viewport when in \fIshared view\fR dualhead mode. .SH "SEE ALSO" The full documentation for .B nvtv is located in .B /usr/share/doc/nvtv/ directory. .SH "AUTHORS" .PP Dirk Thierbach .br dthierbach@gmx.de Eduard Bloch, for the the \fBDebian\fP system. .br blade@debian.org Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. nvtv-0.4.7/man/nvtvd.80000644000175000001440000000200507734021464010205 .TH NVTVD "8" "September 2003" "System Commands" "System Commands" .SH NAME nvtvd \(em backend server to control TV output hardware .SH DESCRIPTION nvtvd is a demon that accesses the TV output hardware. It can be controlled by \fBnvtv\fR through two pipes. You can use this demon if the user cannot gain root rights to start nvtv. .SS OPTIONS .TP \fB\-h\fR \fB\-\-help\fR print help message .TP \fB\-N\fR \fB\-\-nvdev\fR enable usage of /dev/nv* devices .TP \fB\-n\fR \fB\-\-null\fR use null backend (for debugging) .TP \fB\-d\fR \fB\-\-debug\fR don't detach from controlling terminal .TP \fB\-q\fR \fB\-\-quiet\fR no logging .SH "AUTHOR" .PP Dirk Thierbach .br dthierbach@gmx.de Eduard Bloch, for the the \fBDebian\fP system. .br blade@debian.org Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. nvtv-0.4.7/test/0000777000175000001440000000000010041244625007235 5nvtv-0.4.7/test/Makefile.in0000644000175000001440000002224610041244624011223 # Makefile.in generated automatically by automake 1.4-p6 from Makefile.am # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # TESTS = test SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : CC = @CC@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ MAKEINFO = @MAKEINFO@ OBJS_BACKEND = @OBJS_BACKEND@ OBJS_EXTRA = @OBJS_EXTRA@ OBJS_GUI = @OBJS_GUI@ PACKAGE = @PACKAGE@ PKG_CONFIG = @PKG_CONFIG@ PROGRAM = @PROGRAM@ VERSION = @VERSION@ WX_CFLAGS = @WX_CFLAGS@ WX_CFLAGS_ONLY = @WX_CFLAGS_ONLY@ WX_CONFIG_PATH = @WX_CONFIG_PATH@ WX_CPPFLAGS = @WX_CPPFLAGS@ WX_CXXFLAGS = @WX_CXXFLAGS@ WX_CXXFLAGS_ONLY = @WX_CXXFLAGS_ONLY@ WX_LIBS = @WX_LIBS@ WX_LIBS_STATIC = @WX_LIBS_STATIC@ WX_VERSION = @WX_VERSION@ check_PROGRAMS = tester life # from src/Makefile.am ... FIXME use a single? # without # include ($(srcdir)|$(top_srcdir))/filename GUI_SOURCES = gui.c gui_bt.c gui_cx.c gui_ch.c gui_ph.c gui_nx.c gui_nv.c gui_tdfx.c gui_i810.c SRCS_COMMON = libc_wrapper.c xf86i2c.c pipe.c tv_common.c tv_nv.c tv_tdfx.c tv_i810.c tv_null.c tv_bt.c tv_cx.c tv_nx.c tv_ch1_7007.c tv_ch2_7009.c tv_ph1_saa7102.c tv_ph2_saa7104.c data.c data_bt.c data_cx.c data_ch.c data_ph.c data_nx.c data_nv.c data_tdfx.c data_i810.c data_xbox.c data_vesa.c calc_bt.c back_direct.c back_nvidia.c back_tdfx.c back_i810.c back_null.c SRCS_TEST = test_mmio.c test_i2c.c test_record.c back_test.c card_direct.c noinst_HEADERS = back_test.h tester.h test_record.h tester_SOURCES = tester.c test_mmio.c test_i2c.c test_record.c back_test.c back_unix.c card_direct.c $(SRCS_COMMON) life_SOURCES = life.c nvtv.c actions.c print.c $(GUI_SOURCES) $(SRCS_TEST) $(SRCS_COMMON) AM_CPPFLAGS = -I../src -DTEST_HOOKS mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../src/config.h CONFIG_CLEAN_FILES = DEFS = @DEFS@ -I. -I$(srcdir) -I../src CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ tester_OBJECTS = tester.o test_mmio.o test_i2c.o test_record.o \ back_test.o back_unix.o card_direct.o libc_wrapper.o xf86i2c.o pipe.o \ tv_common.o tv_nv.o tv_tdfx.o tv_i810.o tv_null.o tv_bt.o tv_cx.o \ tv_nx.o tv_ch1_7007.o tv_ch2_7009.o tv_ph1_saa7102.o tv_ph2_saa7104.o \ data.o data_bt.o data_cx.o data_ch.o data_ph.o data_nx.o data_nv.o \ data_tdfx.o data_i810.o data_xbox.o data_vesa.o calc_bt.o back_direct.o \ back_nvidia.o back_tdfx.o back_i810.o back_null.o tester_LDADD = $(LDADD) tester_DEPENDENCIES = tester_LDFLAGS = life_OBJECTS = life.o nvtv.o actions.o print.o gui.o gui_bt.o gui_cx.o \ gui_ch.o gui_ph.o gui_nx.o gui_nv.o gui_tdfx.o gui_i810.o test_mmio.o \ test_i2c.o test_record.o back_test.o card_direct.o libc_wrapper.o \ xf86i2c.o pipe.o tv_common.o tv_nv.o tv_tdfx.o tv_i810.o tv_null.o \ tv_bt.o tv_cx.o tv_nx.o tv_ch1_7007.o tv_ch2_7009.o tv_ph1_saa7102.o \ tv_ph2_saa7104.o data.o data_bt.o data_cx.o data_ch.o data_ph.o \ data_nx.o data_nv.o data_tdfx.o data_i810.o data_xbox.o data_vesa.o \ calc_bt.o back_direct.o back_nvidia.o back_tdfx.o back_i810.o \ back_null.o life_LDADD = $(LDADD) life_DEPENDENCIES = life_LDFLAGS = CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ HEADERS = $(noinst_HEADERS) DIST_COMMON = Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best SOURCES = $(tester_SOURCES) $(life_SOURCES) OBJECTS = $(tester_OBJECTS) $(life_OBJECTS) all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .o .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps test/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status mostlyclean-checkPROGRAMS: clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) distclean-checkPROGRAMS: maintainer-clean-checkPROGRAMS: .c.o: $(COMPILE) -c $< .s.o: $(COMPILE) -c $< .S.o: $(COMPILE) -c $< mostlyclean-compile: -rm -f *.o core *.core clean-compile: distclean-compile: -rm -f *.tab.c maintainer-clean-compile: tester: $(tester_OBJECTS) $(tester_DEPENDENCIES) @rm -f tester $(LINK) $(tester_LDFLAGS) $(tester_OBJECTS) $(tester_LDADD) $(LIBS) life: $(life_OBJECTS) $(life_DEPENDENCIES) @rm -f life $(LINK) $(life_LDFLAGS) $(life_OBJECTS) $(life_LDADD) $(LIBS) tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ here=`pwd` && cd $(srcdir) \ && mkid -f$$here/ID $$unique $(LISP) TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) mostlyclean-tags: clean-tags: distclean-tags: -rm -f TAGS ID maintainer-clean-tags: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = test distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done info-am: info: info-am dvi-am: dvi: dvi-am check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) check: check-am installcheck-am: installcheck: installcheck-am install-exec-am: install-exec: install-exec-am install-data-am: install-data: install-data-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-am uninstall-am: uninstall: uninstall-am all-am: Makefile $(HEADERS) all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: mostlyclean-am: mostlyclean-checkPROGRAMS mostlyclean-compile \ mostlyclean-tags mostlyclean-generic mostlyclean: mostlyclean-am clean-am: clean-checkPROGRAMS clean-compile clean-tags clean-generic \ mostlyclean-am clean: clean-am distclean-am: distclean-checkPROGRAMS distclean-compile distclean-tags \ distclean-generic clean-am distclean: distclean-am maintainer-clean-am: maintainer-clean-checkPROGRAMS \ maintainer-clean-compile maintainer-clean-tags \ maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-am .PHONY: mostlyclean-checkPROGRAMS distclean-checkPROGRAMS \ clean-checkPROGRAMS maintainer-clean-checkPROGRAMS mostlyclean-compile \ distclean-compile clean-compile maintainer-clean-compile tags \ mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \ distdir info-am info dvi-am dvi check check-am installcheck-am \ installcheck install-exec-am install-exec install-data-am install-data \ install-am install uninstall-am uninstall all-redirect all-am all \ installdirs mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean # The C sources and includes are first taken from ., then from ../src vpath %.c .:../src # Kill defines (taken from ../src/config.h) # DEFS = -I. -I$(srcdir) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: nvtv-0.4.7/test/Makefile.am0000644000175000001440000000240010041235523011176 ## Process this file with automake to produce Makefile.in ## Used automake 1.4 # TESTS = test check_PROGRAMS = tester life # from src/Makefile.am ... FIXME use a single? # without # include ($(srcdir)|$(top_srcdir))/filename GUI_SOURCES = gui.c gui_bt.c gui_cx.c gui_ch.c gui_ph.c gui_nx.c \ gui_nv.c gui_tdfx.c gui_i810.c SRCS_COMMON = libc_wrapper.c xf86i2c.c pipe.c \ tv_common.c tv_nv.c tv_tdfx.c tv_i810.c \ tv_null.c tv_bt.c tv_cx.c tv_nx.c tv_ch1_7007.c tv_ch2_7009.c \ tv_ph1_saa7102.c tv_ph2_saa7104.c \ data.c data_bt.c data_cx.c data_ch.c data_ph.c data_nx.c \ data_nv.c data_tdfx.c data_i810.c data_xbox.c data_vesa.c calc_bt.c \ back_direct.c back_nvidia.c back_tdfx.c back_i810.c back_null.c SRCS_TEST = test_mmio.c test_i2c.c test_record.c \ back_test.c card_direct.c noinst_HEADERS = back_test.h tester.h test_record.h tester_SOURCES = tester.c test_mmio.c test_i2c.c test_record.c \ back_test.c back_unix.c card_direct.c $(SRCS_COMMON) life_SOURCES = life.c nvtv.c actions.c print.c $(GUI_SOURCES) \ $(SRCS_TEST) $(SRCS_COMMON) # The C sources and includes are first taken from ., then from ../src vpath %.c .:../src AM_CPPFLAGS = -I../src -DTEST_HOOKS # Kill defines (taken from ../src/config.h) # DEFS = -I. -I$(srcdir) nvtv-0.4.7/test/tester.c0000644000175000001440000001671310020723072010626 /* NVTV test -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: tester.c,v 1.3 2004/03/01 21:08:10 dthierbach Exp $ * * Contents: * * Main test file for regression tests (on simulated hardware) * */ #include "local.h" /* before everything else */ #include #include #include #include #include #include "backend.h" #include "back_test.h" #include "back_unix.h" #include "tester.h" /* -------- -------- */ void raise_msg (int class, char *format, ...) { va_list args; #ifndef NVTV_DEBUG if (class >= MSG_DEBUG) return; #endif switch (class) { case MSG_ABORT: fprintf (stderr, "Fatal: "); break; case MSG_WARNING: fprintf (stderr, "Warning: "); break; } va_start(args, format); vfprintf (stderr, format, args); va_end(args); fprintf (stderr, "\n"); if (class == MSG_ABORT) exit (1); } /* -------- Options -------- */ Bool testopt_snoop = FALSE; Bool testopt_log = FALSE; Bool testopt_dump = FALSE; int testopt_head = 0; int testopt_default = 0; static const char *short_options = "12dhi:ls"; static struct option long_options[] = {{"dump", no_argument, NULL, 'd'}, {"help", no_argument, NULL, 'h'}, {"init", required_argument, NULL, 'i'}, {"log", no_argument, NULL, 'l'}, {"snoop", no_argument, NULL, 's'}, {NULL, 0, NULL, 0} }; void usage (void) { fprintf (stderr, "usage: tester [-options ...] program card encoder [heads]\n\n"); fprintf (stderr, "where options include:\n"); fprintf (stderr, " -h --help print this message\n"); fprintf (stderr, " -s --snoop snoop real hardware interactions\n"); fprintf (stderr, " -l --log log all hardware accesses\n"); fprintf (stderr, " -d --dump dump registers at checkpoints\n"); fprintf (stderr, " -i --init 0/1 init bits to 0 or 1\n"); fprintf (stderr, " -1 force usage of first head\n"); fprintf (stderr, " -2 force usage of second head\n"); exit (1); } /* -------- -------- */ BackAccessPtr back_access = NULL; /* global backend */ BackCardPtr back_card = NULL; CardPtr testOpen (char *card_id) { CardPtr card; if (testopt_snoop) { if (! back_root_avail ()) { fprintf (stderr, "You are not root.\n"); exit (1); } printf ("==== config: ...\n"); printf ("---- test init\n"); card = back_root_init (); /* FIXME: substitute mapping */ } else { printf ("==== config: ...\n"); printf ("---- test init\n"); card = back_test_init (card_id); // FIXME } if (!card) { fprintf (stderr, "Cannot find card\n"); exit (1); } return card; } void testOff (char *card_id) { TVRegs main_regs; mmio_card = testOpen (card_id); recordPrint ("#### dump init"); printf ("---- test open card\n"); back_access->openCard (mmio_card); recordPrint ("#### dump open card"); /* get_vidmode (main_dpy, main_screen, &opt_res_x, &opt_res_y, &main_regs.crtc, data_card_func(main_card->type)->make) ->setMode (&main_regs); */ } void testSimple (char *card_id) { TVMode mon_mode, tv_mode; int main_head; mmio_card = testOpen (card_id); recordPrint ("#### dump init"); printf ("---- test open card\n"); back_access->openCard (mmio_card); recordPrint ("#### dump open card"); printf ("---- test encoder\n"); if (mmio_card->chips) { printf (" -- found %s\n", mmio_card->chips->name); } else { printf (" -- found none\n"); } printf ("---- test findBySize\n"); if (!back_card->findBySize (TV_SYSTEM_PAL, 800, 600, "Small", &tv_mode)) { printf (" -- no mode found\n"); return; } if (testopt_head != 0) { back_card->getHeads (&main_head, NULL, NULL, NULL); back_card->setHeads (-1, testopt_head, testopt_head); printf ("---- test head %i --> %i\n", main_head, testopt_head); /* FIXME do getTwinView, initSharedView */ } printf ("---- test getMode\n"); back_card->getMode (&mon_mode.regs); if (testopt_snoop) sleep (1); printf ("---- test setMode/tv\n"); back_card->setMode (&tv_mode.regs); recordPrint ("#### dump set mode/tv"); if (testopt_snoop) sleep (5); printf ("---- test setMode/mon\n"); back_card->setMode (&mon_mode.regs); recordPrint ("#### dump set mode/mon"); if (testopt_snoop) sleep (5); printf ("---- test closeCard\n"); back_access->closeCard (); recordPrint ("#### dump close card"); } int main (int argc, char *argv []) { int c = '?'; char* opt_prog; char* opt_card; char* opt_enc; char* opt_head; int i; opterr = 0; while ((c = getopt_long (argc, argv, short_options, long_options, NULL)) != EOF) { switch(c) { case 'h': /* Print usage */ case '?': usage(); break; case 's': testopt_snoop = TRUE; break; case 'd': testopt_dump = TRUE; break; case 'l': testopt_log = TRUE; break; case 'i': if (strcmp (optarg, "1") == 0) testopt_default = ~0; break; case '1': testopt_head = 1; break; case '2': testopt_head = 2; break; } } if (!testopt_log && !testopt_dump) { testopt_log = TRUE; testopt_dump = TRUE; } i = optind; if (i < argc) opt_prog = argv[i++]; else opt_prog = "simple"; if (i < argc) opt_card = argv[i++]; else opt_card = "nv11"; if (i < argc) opt_enc = argv[i++]; else opt_enc = "ch1"; if (i < argc) opt_head = argv[i++]; else opt_head = "mon"; configSetup (opt_card, opt_enc, opt_head); if (strcmp (opt_prog, "simple") == 0) testSimple (opt_card); else { fprintf (stderr, "Unknown test %s\n", opt_prog); } } /* back_card->getHeads back_card->setHeads back_card->setChip (chip, TRUE); back_card->setMode (&main_regs); back_card->setModeSettings (&main_mode.regs, &opt_set); back_card->getSettings (&opt_set); Regression tests are: init get mode find tv mode set tv mode on set different tv mode set tv mode off all on different architectures/encoders generate text files, and do diff... Bus 0: 0x88=PH1, 0x8A=BT, 0xEA=CH1 Bus 1: 0x88=PH2, 0x8A=CX, 0xEA=CH2 Specials: CX1 status read, error on 0xff subaddr CX2 status regs r/o, read on 0x01 never zero CH1/2 0xc0|0x0a check */ /* encoder ch1, ch2, cx1, cx2, ph1, ph2, all heads mon, tv, mon_tv, off_fp, tv_fp test simple nv11 ch1 test simple nv11 ch2 test simple nv11 cx1 test simple nv11 cx2 test simple nv11 ph1 test simple nv11 ph2 test simple nv4 cx1 ; nv15, nv17, nv18, nv20, nv25 test simple nv11 cx1 tv test simple nv11 cx1 mon_tv test simple nv11 cx1 off_fp test simple nv11 cx1 tv_fp test simple tdfx cx1 test simple i810 ch1 test simple i830 ch1 test simple i845 ch1 */ nvtv-0.4.7/test/test_mmio.c0000644000175000001440000001053110014466441011317 /* Linux only, for port access ... see mmio.h */ #include #include "local.h" #include "tv_i2c.h" #include "backend.h" #include "tester.h" #include "test_record.h" CardPtr mmio_card = NULL; void mmio_port_perm (unsigned long from, unsigned long num, int turn_on) { printf ("perm %04X - %04X %s\n", from, from+num, turn_on ? "on" : "off"); } CARD32 mmio_phys (void *base) { if (mmio_card && mmio_card->reg_mapped) { return (CARD32) (base - mmio_card->reg_mapped); } else { return (CARD32) base; } } CARD8 mmio_in8 (void* base, unsigned offset) { register CARD8 tmp; if (testopt_snoop) { tmp = *(volatile CARD8 *)(((CARD8*)(base)) + (offset)); recordWrite (ZONE_MMIO, mmio_phys (base) + offset, tmp, BIT8, "in "); } else { tmp = recordRead (ZONE_MMIO, (CARD32) base + offset, BIT8, "in "); } return tmp; } CARD16 mmio_in16 (void* base, unsigned offset) { register CARD16 tmp; if (testopt_snoop) { tmp = *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)); recordWrite (ZONE_MMIO, mmio_phys (base) + offset, tmp, BIT16, "in "); } else { tmp = recordRead (ZONE_MMIO, (CARD32) base + offset, BIT16, "in "); } return tmp; } CARD32 mmio_in32 (void* base, unsigned offset) { register CARD32 tmp; if (testopt_snoop) { tmp = *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)); recordWrite (ZONE_MMIO, mmio_phys (base) + offset, tmp, BIT32, "in "); } else { tmp =recordRead (ZONE_MMIO, (CARD32) base + offset, BIT32, "in "); } return tmp; } void mmio_out8 (void* base, unsigned offset, CARD8 val) { if (testopt_snoop) { *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) = (val); recordWrite (ZONE_MMIO, mmio_phys (base) + offset, val, BIT8, "out"); } else { recordWrite (ZONE_MMIO, (CARD32) base + offset, val, BIT8, "out"); } } void mmio_out16 (void* base, unsigned offset, CARD16 val) { if (testopt_snoop) { *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)) = (val); recordWrite (ZONE_MMIO, mmio_phys (base) + offset, val, BIT16, "out"); } else { recordWrite (ZONE_MMIO, (CARD32) base + offset, val, BIT16, "out"); } } void mmio_out32 (void* base, unsigned offset, CARD32 val) { if (testopt_snoop) { *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); recordWrite (ZONE_MMIO, mmio_phys (base) + offset, val, BIT32, "out"); } else { recordWrite (ZONE_MMIO, (CARD32) base + offset, val, BIT32, "out"); } } void mmio_and32 (void* base, unsigned offset, CARD32 val) { register CARD32 tmp; if (testopt_snoop) { tmp = *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)); recordWrite (ZONE_MMIO, mmio_phys (base) + offset, tmp, BIT32, "== "); tmp &= val; *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = tmp; recordWrite (ZONE_MMIO, mmio_phys (base) + offset, tmp, BIT32, "and"); } else { tmp = recordRead (ZONE_MMIO, (CARD32) base + offset, BIT32, "== "); recordWrite (ZONE_MMIO, (CARD32) base + offset, tmp & val, BIT32, "and"); } } void mmio_or32 (void* base, unsigned offset, CARD32 val) { register CARD32 tmp; if (testopt_snoop) { tmp = *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)); recordWrite (ZONE_MMIO, mmio_phys (base) + offset, tmp, BIT32, "== "); tmp |= val; *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = tmp; recordWrite (ZONE_MMIO, mmio_phys (base) + offset, tmp, BIT32, "or "); } else { tmp = recordRead (ZONE_MMIO, (CARD32) base + offset, BIT32, "== "); recordWrite (ZONE_MMIO, (CARD32) base + offset, tmp | val, BIT32, "or "); } } CARD8 port_inb (CARD16 port) { register CARD8 tmp; if (testopt_snoop) { tmp = inb(port); recordWrite (ZONE_PORT, port, tmp, BIT8, "in "); } else { tmp = recordRead (ZONE_PORT, port, BIT8, "in "); } return tmp; } CARD16 port_inw (CARD16 port) { register CARD16 tmp; if (testopt_snoop) { tmp = inw(port); recordWrite (ZONE_PORT, (CARD32) port, tmp, BIT16, "in "); } else { tmp = recordRead (ZONE_PORT, (CARD32) port, BIT16, "in "); } return tmp; } void port_outb (CARD16 port, CARD8 val) { if (testopt_snoop) outb (val, port); recordWrite (ZONE_PORT, (CARD32) port, val, BIT8, "out"); } void port_outw (CARD16 port, CARD16 val) { if (testopt_snoop) outw (val, port); recordWrite (ZONE_PORT, (CARD32) port, val, BIT16, "out"); } nvtv-0.4.7/test/test_i2c.c0000644000175000001440000001443110005513211011022 #include #include /* * This file replaces tv_i2c.c with two purposes: a) track I2C access; * and b) emulate it in a test environment. * */ #include "local.h" /* before everything else */ #include "xf86i2c.h" #include "tester.h" #include "test_record.h" /* ======================================== */ RecordDevicePtr TestFindDev (char *name, I2CSlaveAddr addr) { RecordDevicePtr *r; for (r = config->devices; *r; r++) { if (strcmp ((*r)->bus, name) == 0 && (*r)->dev == addr) return (*r); } return NULL; } int TestAccessCH1 (RecordDevice *this, int subaddr) { int result; if (subaddr != -1) this->current = subaddr; if (this->current == -1) return -1; result = this->current & 0x3f; if (this->current & 0x40) { this->current = (this->current & 0xc0) | ((this->current + 1) & 0x3f); } return result; } int TestAccessCH2 (RecordDevice *this, int subaddr) { if (subaddr != -1) this->current = subaddr; if (this->current == -1) return -1; return this->current & 0x7f; } int TestStatusCH (RecordDevice *this) { return -1; } int TestAccessPH (RecordDevice *this, int subaddr) { return subaddr; // FIXME } int TestStatusPH (RecordDevice *this) { return -1; // FIXME DAC } int TestAccessCX1 (RecordDevice *this, int subaddr) { int result; if (subaddr != -1) this->current = subaddr; if (this->current & 1) return -1; result = this->current; this->current = (this->current + 2) & 0xff; return result; } int TestAccessCX2 (RecordDevice *this, int subaddr) { int result; if (subaddr != -1) this->current = subaddr; result = this->current & ~1; this->current = (this->current + 2) & 0xff; return result; } int TestStatusCX (RecordDevice *this) { return (recordReadDirect (this->zone, 0xc4, BIT8) >> 5) & 0x6; } /* -------- -------- */ /* On TV0 for I810 ?? */ RecordDevice TestDeviceCH1 = { bus:"TV0", dev:0xea, zone: ZONE_CH1, current:0, access:TestAccessCH1, status:TestStatusCH}; /* On TV1 for I830 ?? */ RecordDevice TestDeviceCH2 = { bus:"TV1", dev:0xea, zone: ZONE_CH2, current:0, access:TestAccessCH2, status:TestStatusCH}; /* Must be on TV0 for TDFX */ RecordDevice TestDeviceCX1 = { bus:"TV0", dev:0x8a, zone: ZONE_CX1, current:0, access:TestAccessCX1, status:TestStatusCX}; RecordDevice TestDeviceCX2 = { bus:"TV1", dev:0x8a, zone: ZONE_CX2, current:0, access:TestAccessCX2, status:TestStatusCX}; RecordDevice TestDevicePH1 = { bus:"TV0", dev:0x88, zone: ZONE_PH1, current:0, access:TestAccessPH, status:TestStatusPH}; RecordDevice TestDevicePH2 = { bus:"TV1", dev:0x88, zone: ZONE_PH2, current:0, access:TestAccessPH, status:TestStatusPH}; /* -------- -------- */ Bool tvBusOk = TRUE; /* -------- I2C bus access -------- */ Bool TVProbeBus (I2CBusPtr bus, I2CSlaveAddr addr) { Bool result; if (testopt_snoop) { result = xf86I2CProbeAddress (bus, addr); } else { result = (TestFindDev (bus->BusName, addr) != NULL); } return result; } void TVWriteBus (I2CDevPtr d, I2CByte subaddr, I2CByte data) { RecordDevicePtr r = TestFindDev (d->pI2CBus->BusName, d->SlaveAddr); if (testopt_snoop) { if (!xf86I2CWriteByte (d, subaddr, data)) tvBusOk = FALSE; } else { if (!r) tvBusOk = FALSE; else if (r->access (r, subaddr) == -1) { tvBusOk = FALSE; return; } } if (!r) return; recordWrite (r->zone, r->access (r, subaddr), data, BIT8, "out"); } void TVWriteSeqBus (I2CDevPtr d, I2CByte subaddr, I2CByte *buf, int len) { RecordDevicePtr r = TestFindDev (d->pI2CBus->BusName, d->SlaveAddr); if (testopt_snoop) { if (!xf86I2CWriteBytes (d, subaddr, buf, len)) tvBusOk = FALSE; } else { if (!r) tvBusOk = FALSE; else if (r->access (r, subaddr) == -1) { tvBusOk = FALSE; return; } } if (!r) return; recordWrite (r->zone, r->access (r, subaddr), *buf++, BIT8, "out"); for (len--; len > 0; len--) recordWrite (r->zone, r->access (r, -1), *buf++, BIT8, "out"); } void TVReadBus (I2CDevPtr d, I2CByte subaddr, I2CByte *data) { RecordDevicePtr r = TestFindDev (d->pI2CBus->BusName, d->SlaveAddr); if (testopt_snoop) { if (!xf86I2CReadByte (d, subaddr, data)) tvBusOk = FALSE; if (!r || !tvBusOk) return; recordWrite (r->zone, r->access (r, subaddr), *data, BIT8, "in "); } else { if (!r) { tvBusOk = FALSE; return; } if (r->access (r, subaddr) == -1) { tvBusOk = FALSE; return; } *data = recordRead (r->zone, r->access (r, subaddr), BIT8, "in "); } } void TVReadSeqBus (I2CDevPtr d, I2CByte subaddr, I2CByte *buf, int len) { RecordDevicePtr r = TestFindDev (d->pI2CBus->BusName, d->SlaveAddr); if (testopt_snoop) { if (!xf86I2CWriteRead (d, &subaddr, 1, buf, len)) tvBusOk = FALSE; if (!r || !tvBusOk) return; recordWrite (r->zone, r->access (r, subaddr), *buf++, BIT8, "in "); for (len--; len > 0; len--) recordWrite (r->zone, r->access (r, -1), *buf++, BIT8, "in "); } else { if (!r) { tvBusOk = FALSE; return; } if (r->access (r, subaddr) == -1) { tvBusOk = FALSE; return; } *buf++ = recordRead (r->zone, r->access (r, subaddr), BIT8, "in "); for (len--; len > 0; len--) *buf++ = recordRead (r->zone, r->access (r, -1), BIT8, "in "); } } void TVStatusBus (I2CDevPtr d, I2CByte *data) { RecordDevicePtr r = TestFindDev (d->pI2CBus->BusName, d->SlaveAddr); if (testopt_snoop) { if (!xf86I2CReadStatus(d, data)) tvBusOk = FALSE; if (!r || !tvBusOk) return; recordWrite (r->zone, r->status (r), *data, BIT8, "st "); } else { if (!r) tvBusOk = FALSE; *data = recordRead (r->zone, r->status (r), BIT8, "st "); } } void TVStatusSeqBus (I2CDevPtr d, I2CByte *buf, int len) { RecordDevicePtr r = TestFindDev (d->pI2CBus->BusName, d->SlaveAddr); if (testopt_snoop) { if (!xf86I2CWriteRead (d, NULL, 0, buf, len)) tvBusOk = FALSE; if (!r || !tvBusOk) return; recordWrite (r->zone, r->status (r), *buf++, BIT8, "st "); for (len--; len > 0; len--) recordWrite (r->zone, r->status (r), *buf++, BIT8, "st "); } else { if (!r) { tvBusOk = FALSE; return; } *buf++ = recordRead (r->zone, r->status (r), BIT8, "st "); for (len--; len > 0; len--) *buf++ = recordRead (r->zone, r->status (r), BIT8, "st "); } } /* -------- -------- */ I2CBusPtr TestHookBus (I2CBusPtr I2CPtr) { return I2CPtr; } nvtv-0.4.7/test/test_record.c0000644000175000001440000006111510041236563011640 /* Record register writes */ #include #include #include #include "local.h" /* before anything else */ #include "tester.h" #include "test_record.h" /* Use a sorted single linked list for simplicity. Not fast, but that shouldn't matter. */ typedef struct _RecordEntry RecordEntry, *RecordEntryPtr; struct _RecordEntry { CARD32 addr; CARD32 data; RecordEntryPtr next; int count; }; /* -------- Zones -------- */ #define MAX_ZONE 30 #define END_ADDR 0xffffffff char* test_zones[] = {"mmio", "port", "<2>", "crt", "crt2", "seq", "seq2", "gr", "gr2", "ar", "ar2", "dac", "dac2", "<13>", "<14>", "nz", "%ch1", "%ch2", "%cx1", "%cx2", "%ph1", "%ph2"}; RecordSwitch test_nv_switches [] = { {ZONE_GR, 0, {ZONE_GR, -1, -1, ZONE_GR2}}, {ZONE_SEQ, 0, {ZONE_SEQ, -1, -1, ZONE_SEQ2}}, {-1, -1} }; RecordAccess test_nv_access [] = { {ZONE_MMIO, 0x0c0000, 0x0c0fff, BIT8}, /* PRMVIO */ {ZONE_MMIO, 0x601000, 0x601fff, BIT8}, /* PRMCIO */ {ZONE_MMIO, 0x603000, 0x603fff, BIT8}, /* PRMCIO2 */ {ZONE_MMIO, 0x681000, 0x681fff, BIT8}, /* PRMDIO */ {ZONE_MMIO, 0x683000, 0x683fff, BIT8}, /* PRMDIO2 */ {ZONE_MMIO, 0x000000, 0x7fffff, BIT32}, /* rest */ {ZONE_CRT, 0x00, 0xff, BIT8}, {ZONE_CRT2, 0x00, 0xff, BIT8}, {ZONE_AR, 0x00, 0x1f, BIT8}, {ZONE_AR2, 0x00, 0x1f, BIT8}, {ZONE_GR, 0x00, 0x0f, BIT8}, {ZONE_GR2, 0x00, 0x0f, BIT8}, {ZONE_SEQ, 0x00, 0x0f, BIT8}, {ZONE_SEQ2, 0x00, 0x0f, BIT8}, {ZONE_CH1, 0x00, 0x3f, BIT8}, {ZONE_CH2, 0x00, 0x7f, BIT8}, {ZONE_CX1, 0x00, 0xff, BIT8}, {ZONE_CX2, 0x00, 0xff, BIT8}, {ZONE_PH1, 0x00, 0xff, BIT8}, {ZONE_PH2, 0x00, 0xff, BIT8}, {0, 0, 0, BIT_NONE} }; RecordAccess test_tdfx_access [] = { {ZONE_MMIO, 0x00, 0xff, BIT32}, {ZONE_PORT, 0x3b4, 0x3b5, BIT8}, {ZONE_PORT, 0x3d4, 0x3d5, BIT8}, {ZONE_PORT, 0x3c0, 0x3ca, BIT8}, {ZONE_PORT, 0x3ce, 0x3cf, BIT8}, {ZONE_PORT, 0x3ba, 0x3ba, BIT8}, {ZONE_PORT, 0x3da, 0x3da, BIT8}, {ZONE_PORT, 0x46e8, 0x46e8, BIT8}, {ZONE_CRT, 0x00, 0x24, BIT8}, {ZONE_SEQ, 0x00, 0x04, BIT8}, {ZONE_GR, 0x00, 0x08, BIT8}, {ZONE_AR, 0x00, 0x14, BIT8}, {ZONE_CH1, 0x00, 0x3f, BIT8}, {ZONE_CH2, 0x00, 0x7f, BIT8}, {ZONE_CX1, 0x00, 0xff, BIT8}, {ZONE_CX2, 0x00, 0xff, BIT8}, {ZONE_PH1, 0x00, 0xff, BIT8}, {ZONE_PH2, 0x00, 0xff, BIT8}, {0, 0, 0, BIT_NONE} }; RecordAccess test_intel_access [] = { {ZONE_MMIO, 0x00000, 0x00fff, BIT8}, {ZONE_MMIO, 0x01000, 0x7ffff, BIT32}, {ZONE_CRT, 0x00, 0xff, BIT8}, {ZONE_SEQ, 0x00, 0x07, BIT8}, {ZONE_GR, 0x00, 0x1f, BIT8}, {ZONE_AR, 0x00, 0x14, BIT8}, {ZONE_CH1, 0x00, 0x3f, BIT8}, {ZONE_CH2, 0x00, 0x7f, BIT8}, {ZONE_CX1, 0x00, 0xff, BIT8}, {ZONE_CX2, 0x00, 0xff, BIT8}, {ZONE_PH1, 0x00, 0xff, BIT8}, {ZONE_PH2, 0x00, 0xff, BIT8}, {0, 0, 0, BIT_NONE} }; /* -------- Zone: Specials -------- */ RecordSpecial test_nv_special_main [] = { {0x6013d4, 0x6013d4, SPEC_INDEX, ZONE_CRT}, /* crt */ {0x6013d5, 0x6013d5, SPEC_DATA, ZONE_CRT}, {0x6033d4, 0x6033d4, SPEC_INDEX, ZONE_CRT2}, /* crt2 */ {0x6033d5, 0x6033d5, SPEC_DATA, ZONE_CRT2}, {0x0c03c4, 0x0c03c4, SPEC_INDEX, ZONE_SEQ}, /* seq */ {0x0c03c5, 0x0c03c5, SPEC_DATA, ZONE_SEQ}, {0x0c03ce, 0x0c03ce, SPEC_INDEX, ZONE_GR}, /* gr */ {0x0c03cf, 0x0c03cf, SPEC_DATA, ZONE_GR}, {0x00d220, 0x00d220, SPEC_INDEX, ZONE_NZ}, /* nz */ {0x00d224, 0x00d224, SPEC_DATA, ZONE_NZ}, {0x600808, 0x600808, SPEC_INCR, ZONE_MMIO}, /* PCRTC_RASTER */ {0x602808, 0x602808, SPEC_INCR, ZONE_MMIO}, /* PCRTC2_RASTER */ {0x0c03c2, 0x0c03c2, SPEC_FWD_W, 0x0c03cc}, /* W: misc, R: input stat */ {0x6013da, 0x6013da, SPEC_RESET_R, ZONE_AR}, /* AR reset */ {0x6013c0, 0x6013c0, SPEC_VGA_AR, ZONE_AR}, /* AR both index/data */ {0x6033da, 0x6033da, SPEC_RESET_R, ZONE_AR2}, /* AR reset */ {0x6033c0, 0x6033c0, SPEC_VGA_AR, ZONE_AR2}, /* AR both index/data */ {0, 0, SPEC_NONE} }; RecordSpecial test_nv_special_crt [] = { {0x36, 0x37, SPEC_NOLOG}, /* Primary I2C */ {0x3E, 0x3f, SPEC_NOLOG}, /* Secondary I2C */ {0x44, 0x44, SPEC_SWITCH, 0}, /* SEQ and AR switch */ {0x50, 0x51, SPEC_NOLOG}, /* Tertiary I2C */ {0, 0, SPEC_NONE} }; RecordSpecial test_tdfx_special_port [] = { {0x3d4, 0x3d4, SPEC_INDEX, ZONE_CRT}, /* crt */ {0x3d5, 0x3d5, SPEC_DATA, ZONE_CRT}, {0x3b4, 0x3b4, SPEC_INDEX, ZONE_CRT}, /* crt */ {0x3b5, 0x3b5, SPEC_DATA, ZONE_CRT}, }; RecordSpecial test_intel_special_main [] = { {0x003d4, 0x003d4, SPEC_INDEX, ZONE_CRT}, /* crt */ {0x003d5, 0x003d5, SPEC_DATA, ZONE_CRT}, {0x003b4, 0x003b4, SPEC_INDEX, ZONE_CRT}, /* crt */ {0x003b5, 0x003b5, SPEC_DATA, ZONE_CRT}, {0x003c4, 0x003c4, SPEC_INDEX, ZONE_SEQ}, {0x003c5, 0x003c5, SPEC_DATA, ZONE_SEQ}, {0x003ce, 0x003ce, SPEC_INDEX, ZONE_GR}, {0x003cf, 0x003cf, SPEC_DATA, ZONE_GR}, {0x003ba, 0x003ba, SPEC_RESET_R, ZONE_AR}, /* AR reset */ {0x003da, 0x003da, SPEC_RESET_R, ZONE_AR}, /* AR reset */ {0x003c0, 0x003c0, SPEC_VGA_AR, ZONE_AR}, /* AR both index/data */ {0x05010, 0x05020, SPEC_NOLOG}, /* GPIO registers */ {0, 0, SPEC_NONE} }; /* -------- */ RecordSpecial test_special_ch1 [] = { {0x10, 0x10, SPEC_READONLY}, /* CDR Connection detect */ {0x25, 0x25, SPEC_READONLY}, /* VID version id */ {0, 0, SPEC_NONE} }; RecordSpecial test_special_ch2 [] = { {0x20, 0x20, SPEC_READONLY}, /* CD Connection detect */ {0x4a, 0x4b, SPEC_READONLY}, /* VID/DID version/device id */ {0, 0, SPEC_NONE} }; RecordSpecial test_special_cx1 [] = { {0x00, 0x05, SPEC_READONLY}, /* Status registers */ {0, 0, SPEC_NONE} }; RecordSpecial test_special_cx2 [] = { {0x00, 0x07, SPEC_READONLY}, /* Status registers */ {0, 0, SPEC_NONE} }; RecordSpecial test_special_ph [] = { {0x00, 0x00, SPEC_READONLY}, /* Status byte */ {0x1b, 0x1b, SPEC_READONLY}, /* Monitor Sense Mode */ {0x1c, 0x1c, SPEC_READONLY}, /* Chip ID */ {0x80, 0x80, SPEC_READONLY}, /* FIFO Status */ {0, 0, SPEC_NONE} }; RecordSpecial* test_nv_specials [MAX_ZONE] = { /* 0 mmio */ test_nv_special_main, /* 1 port */ NULL, /* 2 ---- */ NULL, /* unused zone */ /* 3 crt */ test_nv_special_crt, /* 4 crt2 */ test_nv_special_crt, /* 5 seq */ NULL, /* 6 seq2 */ NULL, /* 7 gr */ NULL, /* 8 gr2 */ NULL, /* 9 ar */ NULL, /* 10 ar2 */ NULL, /* 11 dac */ NULL, /* 12 dac2 */ NULL, /* 13 ---- */ NULL, /* 14 ---- */ NULL, /* 15 nz */ NULL, /* 16 ch1 */ test_special_ch1, /* 17 ch2 */ test_special_ch2, /* 18 cx1 */ test_special_cx1, /* 19 cx2 */ test_special_cx2, /* 20 ph1 */ test_special_ph, /* 21 ph2 */ test_special_ph, NULL, NULL, NULL }; RecordSpecial* test_tdfx_specials [MAX_ZONE] = { /* 0 mmio */ NULL, /* test_tdfx_special_main, */ /* 1 port */ test_tdfx_special_port, /* 2 ---- */ NULL, /* unused zone */ /* 3 crt */ NULL, /* 4 crt2 */ NULL, /* 5 seq */ NULL, /* 6 seq2 */ NULL, /* 7 gr */ NULL, /* 8 gr2 */ NULL, /* 9 ar */ NULL, /* 10 ar2 */ NULL, /* 11 dac */ NULL, /* 12 dac2 */ NULL, /* 13 ---- */ NULL, /* 14 ---- */ NULL, /* 15 nz */ NULL, /* 16 ch1 */ test_special_ch1, /* 17 ch2 */ test_special_ch2, /* 18 cx1 */ test_special_cx1, /* 19 cx2 */ test_special_cx2, /* 20 ph1 */ test_special_ph, /* 21 ph2 */ test_special_ph, NULL, NULL, NULL }; RecordSpecial* test_intel_specials [MAX_ZONE] = { /* 0 mmio */ test_intel_special_main, /* 1 port */ NULL, /* test_intel_special_port, */ /* 2 ---- */ NULL, /* unused zone */ /* 3 crt */ NULL, /* 4 crt2 */ NULL, /* 5 seq */ NULL, /* 6 seq2 */ NULL, /* 7 gr */ NULL, /* 8 gr2 */ NULL, /* 9 ar */ NULL, /* 10 ar2 */ NULL, /* 11 dac */ NULL, /* 12 dac2 */ NULL, /* 13 ---- */ NULL, /* 14 ---- */ NULL, /* 15 nz */ NULL, /* 16 ch1 */ test_special_ch1, /* 17 ch2 */ test_special_ch2, /* 18 cx1 */ test_special_cx1, /* 19 cx2 */ test_special_cx2, /* 20 ph1 */ test_special_ph, /* 21 ph2 */ test_special_ph, NULL, NULL, NULL }; /* -------- Zone: Defaults -------- */ /* 68050C PLL coef 680508 VPLL1 680520 VPLL2 68x600 Gen Ctrl 1/2 68x608 Test Ctrl 1/2 60x804 PCRTC_Config? */ RecordDefault test_nv_assoc_default [] = { {0x600860, 0x00001110}, {0x602860, 0x00000000}, {END_ADDR, 0}, }; RecordInit test_nv_assoc_init [] = { {ZONE_MMIO, test_nv_assoc_default}, {ZONE_NONE, NULL} }; RecordDefault test_nv_two_default_main [] = { {0x000000, 0x00000000}, {END_ADDR, 0}, }; RecordDefault test_nv3_default_main [] = { {0x000000, 0x00030100}, /* "NV3 Rev A1" */ {END_ADDR, 0}, }; RecordInit test_nv3_init_main [] = { {ZONE_MMIO, test_nv3_default_main}, {ZONE_NONE, NULL} }; RecordDefault test_nv4_default_main [] = { {0x000000, 0x20004000}, /* "NV4 Rev A1-3" */ {END_ADDR, 0}, }; RecordInit test_nv4_init_main [] = { {ZONE_MMIO, test_nv4_default_main}, {ZONE_NONE, NULL} }; RecordDefault test_nv5_default_main [] = { {0x000000, 0x20104000}, /* "NV5/6 Rev A1" */ {END_ADDR, 0}, }; RecordInit test_nv5_init_main [] = { {ZONE_MMIO, test_nv5_default_main}, {ZONE_NONE, NULL} }; RecordDefault test_nv11_default_main [] = { {0x000000, 0x011000A1}, {0x101000, 0x803F4443}, {0x600860, 0x00001110}, {0x602860, 0x00000000}, {END_ADDR, 0}, }; RecordInit test_nv11_init_main [] = { {ZONE_MMIO, test_nv11_default_main}, {ZONE_NONE, NULL} }; RecordDefault test_nv17_default_main [] = { {0x000000, 0x017100A3}, {0x101000, 0x80C0D53F}, {0x600860, 0x00001110}, {0x602860, 0x00000000}, {END_ADDR, 0}, }; RecordInit test_nv17_init_main [] = { {ZONE_MMIO, test_nv17_default_main}, {ZONE_NONE, NULL} }; RecordDefault test_nv20_default_main [] = { {0x000000, 0x020100A5}, {0x101000, 0x87F85CFB}, {0x600860, 0x00000000}, {END_ADDR, 0}, }; RecordInit test_nv20_init_main [] = { {ZONE_MMIO, test_nv20_default_main}, {ZONE_NONE, NULL} }; RecordDefault test_nv25_default_main [] = { {0x000000, 0x025300A3}, {0x101000, 0x98C471AF}, {0x600860, 0x00011310}, {0x602860, 0x00020000}, {END_ADDR, 0}, }; RecordInit test_nv25_init_main [] = { {ZONE_MMIO, test_nv25_default_main}, {ZONE_NONE, NULL} }; RecordDefault test_xbox_default_main [] = { {0x000000, 0x02A00000}, {END_ADDR, 0}, }; /* ---- */ RecordDefault test_default_ch1 [] = { {0x10, 0x00}, /* CID = both */ {0x25, 0x50}, /* VID = CH7007A */ {END_ADDR, 0}, }; RecordDefault test_default_ch2 [] = { {0x20, 0x3e}, /* CD = all (DVIT + DACT0-3) */ {0x4a, 0x83}, /* VID = 7009A */ {0x4b, 0x17}, /* DID = 7009A,7011A */ {END_ADDR, 0}, }; RecordDefault test_default_cx1 [] = { {0x00, 0x21}, /* 000=BT869, rev=00001 */ {0x02, 0xf8}, /* both, field=0 */ {0x04, 0x12}, /* pll_lock=1, pal=1 */ {END_ADDR, 0}, }; RecordDefault test_default_cx2 [] = { {0x00, 0x60}, /* 011=CX25871, rev=00000 */ {0x02, 0xf8}, /* both, field=0 */ {0x04, 0x12}, /* pll_lock=1, pal=1 */ {0x06, 0xf0}, /* MON A-D, field=0 */ {END_ADDR, 0}, }; RecordDefault test_default_ph1 [] = { {0x00, 0x40}, /* ver=010 */ {0x1b, 0x00}, /* all DACs loaded */ {0x1c, 0x02}, /* SAA 7102/7108 */ {0x80, 0x00}, /* no overflow/underflow */ {END_ADDR, 0}, }; RecordDefault test_default_ph2 [] = { {0x00, 0xa0}, /* ver=101 */ {0x1b, 0x00}, /* all DACs loaded */ {0x1c, 0x04}, /* SAA 7104/7108A */ {0x80, 0x00}, /* no overflow/underflow */ {END_ADDR, 0}, }; /* -------- -------- */ RecordDefault test_default_nv_crt_mon [] = { {0x28, 0x00, mask:~0x80}, {0x33, 0x00, mask:~0x01}, {END_ADDR, 0}, }; RecordDefault test_default_nv_crt_tv [] = { {0x28, 0x80, mask:~0x80}, {0x33, 0x00, mask:~0x01}, {END_ADDR, 0}, }; RecordDefault test_default_nv_crt_fp [] = { {0x28, 0x80, mask:~0x80}, {0x33, 0x01, mask:~0x01}, {END_ADDR, 0}, }; RecordDefault test_default_intel_gr [] = { {0x1e, 0x00}, /* gr scratch (for locking) */ {0x1f, 0x00}, /* gr scratch (for locking) */ {END_ADDR, 0}, }; RecordInit test_intel_init_main [] = { {ZONE_GR, test_default_intel_gr}, {ZONE_NONE, NULL} }; /* -------- -------- */ RecordInit test_init_nv_mon [] = { {ZONE_CRT, test_default_nv_crt_mon}, {ZONE_CRT2, test_default_nv_crt_mon}, {ZONE_NONE, NULL} }; RecordInit test_init_nv_tv [] = { {ZONE_CRT, test_default_nv_crt_tv}, {ZONE_CRT2, test_default_nv_crt_mon}, {ZONE_NONE, NULL} }; RecordInit test_init_nv_mon_tv [] = { // {ZONE_MMIO, test_default_nv_mmio_two}, {ZONE_CRT, test_default_nv_crt_mon}, {ZONE_CRT2, test_default_nv_crt_tv}, {ZONE_NONE, NULL} }; RecordInit test_init_nv_off_fp [] = { // {ZONE_MMIO, test_default_nv_mmio_fp}, // {ZONE_CRT, test_default_nv_crt_off}, {ZONE_CRT2, test_default_nv_crt_fp}, {ZONE_NONE, NULL} }; RecordInit test_init_nv_tv_fp [] = { // {ZONE_MMIO, test_default_nv_mmio_fp}, {ZONE_CRT, test_default_nv_crt_tv}, {ZONE_CRT2, test_default_nv_crt_fp}, {ZONE_NONE, NULL} }; RecordInit test_init_i2c [] = { {ZONE_CH1, test_default_ch1}, {ZONE_CH2, test_default_ch2}, {ZONE_CX1, test_default_cx1}, {ZONE_CX2, test_default_cx2}, {ZONE_PH1, test_default_ph1}, {ZONE_PH2, test_default_ph2}, {ZONE_NONE, NULL} }; /* -------- -------- */ typedef struct { char *name; RecordInit* init; } ConfigDefault; ConfigDefault config_nv_heads [] = { {"mon", test_init_nv_mon}, {"tv", test_init_nv_tv}, {"mon_tv", test_init_nv_mon_tv}, {"off_fp", test_init_nv_off_fp}, {"tv_fp", test_init_nv_tv_fp}, {NULL, NULL} }; ConfigDefault config_defaults [] = { {"nv04", test_nv4_init_main}, {"nv05", test_nv5_init_main}, {"nv0a", NULL}, {"nv10", NULL}, {"nv11", test_nv11_init_main}, {"nv15", NULL}, {"nv17", test_nv17_init_main}, {"nv18", test_nv_assoc_init}, {"nv1a", test_nv_assoc_init}, {"nv1f", test_nv_assoc_init}, {"nv20", test_nv20_init_main}, {"nv25", test_nv25_init_main}, {"nv28", test_nv_assoc_init}, {"nv2a", NULL}, {"nv30", test_nv_assoc_init}, {"nv31", test_nv_assoc_init}, {"nv32", test_nv_assoc_init}, {"nv34", test_nv_assoc_init}, {"nv35", test_nv_assoc_init}, {"nv36", test_nv_assoc_init}, {"xbox", NULL}, {"i810", test_intel_init_main}, {"i830", test_intel_init_main}, {"i845", test_intel_init_main}, {"i855", test_intel_init_main}, {"i865", test_intel_init_main}, {"tdfx", NULL}, {NULL, NULL} }; /* -------- -------- */ typedef struct { char *name; RecordDevice** devices; } ConfigDevices; RecordDevice* test_no_devices[] = {NULL}; RecordDevice* test_ch1_devices[] = {&TestDeviceCH1, NULL}; RecordDevice* test_ch2_devices[] = {&TestDeviceCH2, NULL}; RecordDevice* test_cx1_devices[] = {&TestDeviceCX1, NULL}; RecordDevice* test_cx2_devices[] = {&TestDeviceCX2, NULL}; RecordDevice* test_ph1_devices[] = {&TestDevicePH1, NULL}; RecordDevice* test_ph2_devices[] = {&TestDevicePH2, NULL}; RecordDevice* test_all_devices[] = { &TestDeviceCH1, &TestDeviceCH2, &TestDeviceCX1, &TestDeviceCX2, &TestDevicePH1, &TestDevicePH2, NULL}; ConfigDevices config_devices [] = { {"none", test_no_devices}, {"ch1", test_ch1_devices}, {"ch2", test_ch2_devices}, {"cx1", test_cx1_devices}, {"cx2", test_cx2_devices}, {"ph1", test_ph1_devices}, {"ph2", test_ph2_devices}, {"all", test_all_devices}, {NULL, NULL} }; /* -------- -------- */ RecordConfig config_nv = { zone: test_zones, access: test_nv_access, switches: test_nv_switches, specials: test_nv_specials, devices: NULL, }; RecordConfig config_tdfx = { zone: test_zones, access: test_tdfx_access, switches: NULL, specials: test_tdfx_specials, devices: NULL, }; RecordConfig config_intel = { zone: test_zones, access: test_intel_access, switches: NULL, specials: test_intel_specials, devices: NULL, }; RecordConfig* config = NULL; RecordEntryPtr recordAccess (int zone, CARD32 addr, BitSize bits); void configDefault (int zone, RecordDefault *def) { RecordEntryPtr r; if (!def) return; for (; def->addr != END_ADDR; def++) { /* FIXME must find bits for init with mask ... */ r = recordAccess (zone, def->addr, (zone == ZONE_MMIO) ? BIT32 : BIT8); r->data &= def->mask; r->data |= def->data; // r->count = 0; /* Was present "before" */ } } void configInit (RecordInit *init) { if (!init) return; for (; init->defaults; init++) configDefault (init->zone, init->defaults); } void configSetup (char *card, char *enc, char *head) { ConfigDevices *p; ConfigDefault *q; if (strncmp (card, "nv", 2) == 0) { config = &config_nv; for (q = config_nv_heads; q->name; q++) { if (strcmp (q->name, head) == 0) { configInit (q->init); break; } } } else if (strncmp (card, "xbox", 4) == 0) { config = &config_nv; configDefault (ZONE_MMIO, test_xbox_default_main); configInit (test_init_nv_tv); } else if (strncmp (card, "i8", 2) == 0) { config = &config_intel; } else if (strncmp (card, "tdfx", 4) == 0) { config = &config_tdfx; } else { fprintf (stderr, "Cannot configure for card %s\n", card); exit (1); } configInit (test_init_i2c); for (q = config_defaults; q->name; q++) { if (strcmp (q->name, card) == 0) { configInit (q->init); break; } } for (p = config_devices; p->name; p++) { if (strcmp (p->name, enc) == 0) { config->devices = p->devices; break; } } if (!p->name) { fprintf (stderr, "Cannot configure for encoder(s) %s\n", enc); exit (1); } } int record_switches[MAX_SWITCH_NUM] = {0}; int record_index[MAX_ZONE]; /* FIXME init */ RecordEntryPtr record_roots[MAX_ZONE] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }; /* record_entry */ /* -------- -------- */ /* Find, and if necessary, create entry */ RecordEntryPtr recordAccess (int zone, CARD32 addr, BitSize bits) { RecordEntryPtr p, q, r; RecordDefault* d; q = NULL; p = record_roots[zone]; for (; p && p->addr < addr; p = p->next) q = p; if (p && p->addr == addr) return p; r = (RecordEntryPtr) malloc (sizeof (RecordEntry)); r->addr = addr; switch (bits) { case BIT8: r->data = testopt_default & 0xff; break; case BIT16: r->data = testopt_default & 0xffff; break; case BIT32: r->data = testopt_default & 0xffffffff; break; default: break; } r->next = p; r->count = 1; /* First access */ if (q) q->next = r; else record_roots[zone] = r; #if 0 /* See if the data has a default */ d = config->defaults[zone]; if (d) { for (; d->addr != END_ADDR; d++) { if (d->addr == addr) { r->data &= d->mask; r->data |= d->data; r->count = 0; /* Was present "before" */ break; } } } #endif return r; } /* Return special (non-zero) if addr in zone is special */ void recordSpecial (int zone, CARD32 addr, int *special, int *param) { RecordSpecial *s; if (special) *special = SPEC_NONE; if (param) *param = 0; s = config->specials[zone]; if (!s) return; for (; s->special != SPEC_NONE; s++) { if (s->low <= addr && addr <= s->high) { if (special) *special = s->special; if (param) *param = s->param; return; } } } /* Return TRUE if bit size is correct (zone 0 only) */ Bool recordBits (int zone, CARD32 addr, BitSize bits) { RecordAccess* r; for (r = config->access; r->bits != BIT_NONE; r++) { if (r->zone == zone && r->low <= addr && addr <= r->high) { if (r->bits == bits) return TRUE; break; } } if (r->bits == BIT_NONE) { printf ("BITS %06X zone %i out of range\n", addr & 0xffffff, zone); } else { printf ("BITS %06X zone %i wrong access %i/%i\n", addr & 0xffffff, zone, bits, r->bits); } return FALSE; } /* Switch zone if necessary */ int recordSwitch (int zone) { RecordSwitch* r; int res; if (config->switches) { for (r = config->switches; r->switcher != -1; r++) { if (r->zone == zone) { res = r->dest[record_switches[r->switcher]]; if (res == -1) { printf ("SWCH zone %i switch %i to invalid zone\n", zone, r->switcher); return zone; } // printf ("SWCH %-4s -> %-4s\n", config->zone[zone], config->zone[res]); return res; } } } return zone; } void recordPrintData (CARD32 data, BitSize bits) { switch (bits) { case BIT8: printf ("%02X", data); break; case BIT16: printf ("%04X", data); break; case BIT32: printf ("%08X", data); break; default: break; } } CARD32 recordReadDirect (int zone, CARD32 addr, BitSize bits) { RecordEntryPtr p = recordAccess (zone, addr, bits); return p->data; } CARD32 recordRead (int zone, CARD32 addr, BitSize bits, char *dir) { int special, param; RecordEntryPtr p; zone = recordSwitch (zone); addr &= 0xffffff; if (recordBits (zone, addr, bits)) { recordSpecial (zone, addr, &special, ¶m); switch (special) { case SPEC_INDEX: return record_index[param]; case SPEC_DATA: return recordRead (param, record_index[param], bits, dir); case SPEC_VGA_AR: printf ("vga read from attribute address reg\n"); /* fallthrough */ case SPEC_FLIP: if (record_index[param] & 1) { return recordRead (param, record_index[param] >> 1, bits, dir); } else { return record_index[param] >> 1; } case SPEC_RESET: case SPEC_RESET_R: record_index[param] &= ~1; return 0; case SPEC_FWD_R: return recordRead (zone, param, bits, dir); default: p = recordAccess (zone, addr, bits); if (testopt_log && special != SPEC_NOLOG) { printf ("%-4s %06X %s ", config->zone[zone], addr, dir); recordPrintData (p->data, bits); printf ("\n"); } if (special == SPEC_INCR) p->data++; return p->data; } } return 0; /* should never reach this */ } void recordWrite (int zone, CARD32 addr, CARD32 data, BitSize bits, char *dir) { int special, param; RecordEntryPtr p; zone = recordSwitch (zone); addr &= 0xffffff; if (recordBits (zone, addr, bits)) { recordSpecial (zone, addr, &special, ¶m); if (special == SPEC_READONLY) { if (testopt_log) { printf ("%-4s %06X %s r/o\n", config->zone[zone], addr, dir); return; } } switch (special) { case SPEC_INDEX: record_index[param] = data; return; case SPEC_DATA: recordWrite (param, record_index[param], data, bits, dir); return; case SPEC_VGA_AR: if ((record_index[param] & 1) == 0) { printf ("%-4s %06X ar\n", "vga", data); data &= 0x1f; } /* fallthrough */ case SPEC_FLIP: if (record_index[param] & 1) { recordWrite (param, record_index[param] >> 1, data, bits, dir); record_index[param] &= ~1; } else { record_index[param] = data << 1 | 1; } return; case SPEC_RESET: case SPEC_RESET_W: record_index[param] &= ~1; return; case SPEC_FWD_W: recordWrite (zone, param, data, bits, dir); return; default: p = recordAccess (zone, addr, bits); p->data = data; p->count++; if (special == SPEC_SWITCH) { if (data < MAX_SWITCH_VAL) record_switches [param] = data; } if (testopt_log && special != SPEC_NOLOG) { printf ("%-4s %06X %s ", config->zone[zone], addr, dir); recordPrintData (data, bits); printf (" (%i)\n", p->count); } return; } } } void recordPrint (char *title) { int zone; RecordEntryPtr p; if (testopt_dump) printf ("%s\n", title); for (zone = 0; zone < MAX_ZONE; zone++) { for (p = record_roots[zone]; p; p = p->next) { if (p->count > 0 && testopt_dump) { printf ("%-4s %06X = %08X (%i)\n", config->zone[zone], p->addr, p->data, p->count); } p->count = 0; } } } /* ====================================================================== */ #if 0 Checkpoints: compare with patterns mention all extra values (store extra values somewhere, and only report diff next time?) Automatically create patterns: do MMIO and recording parallel store initial values in defaults store actual values in test pattern */ #endif #if 0 A) monitor only, 0x680608, 0x00010000 /* Test Ctrl */ 0x682608, 0x00000000 /* Test Ctrl */ B) TV only, C) twin, D) FP only, 0x680608, 0x00010000 /* Test Ctrl */ 0x682608, 0x00010000 /* Test Ctrl */ E) FP twin #endif #if 0 SPECIALS 0x6013c1 /* SPEC_DATA_R() read_only */ 0x6813c7 /* palette read_mode address */ 0x6813c8 /* palette write_mode address */ 0x6813c9 /* palette data, auto_inc SPEC_DATA_INC */ crt index 44 -- associate VIO to head #endif nvtv-0.4.7/test/back_test.c0000644000175000001440000000575610041235237011270 /* NVTV test backend -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_test.c,v 1.3 2004/01/28 17:01:04 dthierbach Exp $ * * Contents: * * Backend for testing * */ #include "local.h" /* before everything else */ #include "backend.h" #include "back_direct.h" #include "back_test.h" #if 0 /* Setting dev to NULL will make card_direct operations ignore it */ static CardInfo test_card = { name: "", dev: NULL, reg_base:0xff000000, pio_base:0x300, arch: "No Architecture", chips: NULL, next: NULL }; #endif static CardInfo test_card_list [] = { {name:"nv04", pci_id:0x0020, type:CARD_NVIDIA}, {name:"nv05", pci_id:0x0028, type:CARD_NVIDIA}, {name:"nv0a", pci_id:0x00a0, type:CARD_NVIDIA}, {name:"nv10", pci_id:0x0100, type:CARD_NVIDIA}, {name:"nv11", pci_id:0x0110, type:CARD_NVIDIA}, {name:"nv15", pci_id:0x0150, type:CARD_NVIDIA}, {name:"nv17", pci_id:0x0170, type:CARD_NVIDIA}, {name:"nv18", pci_id:0x0181, type:CARD_NVIDIA}, {name:"nv1a", pci_id:0x01a0, type:CARD_NVIDIA}, {name:"nv1f", pci_id:0x01f0, type:CARD_NVIDIA}, {name:"nv20", pci_id:0x0200, type:CARD_NVIDIA}, {name:"nv25", pci_id:0x0250, type:CARD_NVIDIA}, {name:"nv28", pci_id:0x0280, type:CARD_NVIDIA}, {name:"nv2a", pci_id:0x02a0, type:CARD_NVIDIA}, {name:"nv30", pci_id:0x0300, type:CARD_NVIDIA}, {name:"nv31", pci_id:0x0310, type:CARD_NVIDIA}, {name:"nv32", pci_id:0x0320, type:CARD_NVIDIA}, {name:"nv34", pci_id:0x0340, type:CARD_NVIDIA}, {name:"nv35", pci_id:0x0350, type:CARD_NVIDIA}, {name:"nv36", pci_id:0x0360, type:CARD_NVIDIA}, {name:"xbox", pci_id:0x02a0, type:CARD_XBOX}, {name:"i810", pci_id:0x7121, type:CARD_I810}, {name:"i830", pci_id:0x3577, type:CARD_I810}, {name:"i845", pci_id:0x2562, type:CARD_I810}, {name:"i855", pci_id:0x3582, type:CARD_I810}, {name:"i865", pci_id:0x2572, type:CARD_I810}, {name:"tdfx", pci_id:0x0005, type:CARD_TDFX}, {name:NULL}, }; CardPtr back_test_init (char *id) { CardPtr p; back_access = &bdir_func; for (p = test_card_list; p->name; p++) { if (strcmp (id, p->name) == 0) break; } if (!p->name) return NULL; p->dev = NULL; p->arch = "Test Architecture"; p->chips = NULL; p->next = NULL; p->reg_base = 0xff000000; p->pio_base = 0x300; return p; } nvtv-0.4.7/test/life.c0000644000175000001440000000413210041235776010243 /* NVTV life -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id$ * * Contents: * * Main test file for life tests of gui (on simulated hardware) * */ #include "local.h" /* before everything else */ #include #include #include #include #include "backend.h" #include "back_test.h" #include "back_unix.h" #include "tester.h" /* -------- Options -------- */ Bool testopt_snoop = FALSE; Bool testopt_log = TRUE; Bool testopt_dump = FALSE; int testopt_default = 0; void life_usage (void) { fprintf (stderr, "usage: life card encoder heads [nvtv options]\n\n"); exit (1); } /* ---------- */ char* card_arg; Bool back_root_avail (void) { return TRUE; } CardPtr back_root_init (void) { return back_test_init (card_arg); } Bool back_nvdev_avail (Bool force) { return TRUE; } CardPtr back_nvdev_init (void) { return back_test_init (card_arg); } Bool back_client_avail (void) { return TRUE; } CardPtr back_client_init (void) { return back_test_init (card_arg); } Bool back_win_avail (void) { return TRUE; } CardPtr back_win_init (void) { return back_test_init (card_arg); } /* ---------- */ int main (int argc, char *argv []) { if (argc < 4) life_usage (); configSetup (argv[1], argv[2], argv[3]); card_arg = argv[1]; argv[3] = argv[0]; xmain (argc - 3, argv + 3); } nvtv-0.4.7/test/back_test.h0000644000175000001440000000214710005515126011262 /* NVTV test backend header -- Dirk Thierbach * * This file is part of nvtv, a tool for tv-output on NVidia cards. * * nvtv is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * nvtv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * $Id: back_test.h,v 1.1 2004/01/27 17:05:26 dthierbach Exp $ * * Contents: * * Header: Backend for testing * */ #ifndef _BACK_TEST_H #define _BACK_TEST_H #include "local.h" /* for Bool */ #include "backend.h" CardPtr back_test_init (char *id); #endif /* _BACK_TEST_H */ nvtv-0.4.7/test/tester.h0000644000175000001440000000405410014466573010643 #ifndef _TEST_H #define _TEST_H #include "backend.h" typedef enum { BIT_NONE, BIT8, BIT16, BIT32, } BitSize; enum { SPEC_NONE = 0, SPEC_NOLOG = 1, SPEC_READONLY = 2, SPEC_INDEX = 3, SPEC_DATA = 4, SPEC_INCR = 5, SPEC_FWD_W = 6, SPEC_FWD_R = 7, SPEC_RESET = 8, SPEC_RESET_R = 9, SPEC_RESET_W = 10, SPEC_FLIP = 11, SPEC_VGA_AR = 12, SPEC_SWITCH = 13, }; enum { ZONE_NONE = -1, ZONE_MMIO = 0, ZONE_PORT = 1, ZONE_CRT = 3, ZONE_CRT2 = 4, ZONE_SEQ = 5, ZONE_SEQ2 = 6, ZONE_GR = 7, ZONE_GR2 = 8, ZONE_AR = 9, ZONE_AR2 = 10, ZONE_DAC = 11, ZONE_DAC2 = 12, ZONE_NZ = 15, ZONE_CH1 = 16, ZONE_CH2 = 17, ZONE_CX1 = 18, ZONE_CX2 = 19, ZONE_PH1 = 20, ZONE_PH2 = 21, }; #define MAX_SWITCH_VAL 4 #define MAX_SWITCH_NUM 1 typedef struct { int zone; int switcher; int dest[MAX_SWITCH_VAL]; } RecordSwitch; typedef struct { int zone; CARD32 low, high; BitSize bits; } RecordAccess; typedef struct { CARD32 addr; CARD32 data; CARD32 mask; /* default 0 = full value */ } RecordDefault; typedef struct { CARD32 low, high; int special; int param; } RecordSpecial; typedef struct _RecordDevice *RecordDevicePtr; typedef struct _RecordDevice { char *bus; int dev; int (*access) (RecordDevicePtr this, int subaddr); int (*status) (RecordDevicePtr this); int zone; int current; } RecordDevice; typedef struct { int zone; RecordDefault* defaults; } RecordInit; typedef struct { char** zone; RecordAccess* access; RecordSwitch* switches; RecordSpecial** specials; RecordDevice** devices; } RecordConfig; /* -------- */ extern RecordDevice TestDeviceCH1, TestDeviceCH2, TestDeviceCX1, TestDeviceCX2, TestDevicePH1, TestDevicePH2; /* -------- */ extern Bool testopt_snoop; /* simulate on real hardware */ extern Bool testopt_log; /* log reads/writes to stdout */ extern Bool testopt_dump; extern int testopt_default; /* default value for empty entries */ extern CardPtr mmio_card; extern RecordConfig* config; #endif /* _TEST_H */ nvtv-0.4.7/test/test_record.h0000644000175000001440000000061610005513211011630 #ifndef _TEST_RECORD_H #define _TEST_RECORD_H #include "tester.h" CARD32 recordRead (int zone, CARD32 addr, BitSize bits, char* dir); void recordWrite (int zone, CARD32 addr, CARD32 data, BitSize bits, char* dir); CARD32 recordReadDirect (int zone, CARD32 addr, BitSize bits); void recordPrint (char *title); void configSetup (char *card, char *enc, char *head); #endif /* _TEST_RECORD_H */