Diamond XF86 clock setting program:
Allows XF86 to automatically program the SpeedStar's clocks.

Eric Vought (adfh@plato.simons-rock.edu)

________________________________________

This is a modified version of the program originally written by Frank
Klemm (pfk@rz.uni-jena.de) for MSDOS and ported to linux.

The original README file is in README.orig.

Freq was written to set the clock of a diamond video card so that modes
other than the VESA 640x480x256 could be used with XF86.  It allows the user
to program crystals 0-2, crystal two being the safest bet.

Originally, freq took two parameters, the first was the frequency in hertz.
The second was the crystal to set. The user would start up XWindows in
640x480, use freq to sink the clock, then switch modes.  Because only clock
two was really safe to program, this would limit the user to three graphics
modes: the clock setting for 640x480 on crystal 1, text mode on crystal 2,
and the programmed mode on crystal 3, not to mention that the manual
settings and the mad flickering as the clock synched was unsightly.

XF86 has an XConfig option to use a custom clock generator, ClockProg.
ClockProg provides a command for X to call when it needs to change modes.
All that was needed was a way to get the parameters that X passed and the
parameters that freq expected to match up and X windows would do all the
work for us.  To that end, I modified main in freq.c to convert the
parameters passed by X to the ones that freq required internally.

Setting Up:

The file XF86Config in this directory is my personal configuration file.
I have a SpeedStar X24 and a Gateway 2000 Crystal Scan 1024NI. At this
point I only have two graphics modes set up, 640x480 and 856x646.

First, copy freq to somewhere on your path.  It was compiled on Slackware
2.0 with GCC 2.6.1. The source code is also provided (the original freq.c
is in freq.orig.c) if you need to compile from scratch. Set the user ID bit
if you plan to run X while not root, otherwise, it will not run.

Modify your X config file to use the new program.  This assumes you have
already chosen several video modes and have the data available.  If not,
do that first.

The "Clocks" parameter should contain a list of frequencies that X will be
allowed to use.  There should be one entry for each of your graphics modes.
They do not correspond to the physical crystal settings.
One of them should be the text mode frequency (28.1 khz on my setup). See my
XConfig for an example Clocks line.

The "ClockProg" line has the following syntax:

ClockProg "<Command>" [text clock]
where <Command> is the command line to run freq (/usr/X11/bin/freq on my
system), and [text clock] optionally specifies the text mode clock to set
when exiting or switching to a virtual terminal.  If you do not set this,
your screen may not restore properly.

Now, when X starts, it will look at the dot clock for your default mode,
pass it as a parameter to freq, and program the clock.  It will call freq
again every time it needs to change modes.  As long as the required dot
clock is listed in your Clocks line, it should work. I have had no problems
so far.

For more information on Clocks, ClockProg, or the configuration file, pull
the man page on XF86Config.

Incidently, with this setup, if another program (like dosemu) programs your
clock on you and messes with your display, switching modes with C-A-+ or
switching VT's should fix the problem.   
