First, we extend all deadlines a litte to make sure we never have to
wait negative time. Second, we get the timer value at the end of the
wait and CPU-loop for the difference between the actual value and the
ideal (extended) value.
- ubb-vga.c (mode_db): added new mode "640x480/61"
- ubb-vga.c (setup, line): MSC_CLKRT is reset when the MSC resets. Moved
it from "setup" to "line".
- ubb-vga.c (clkrt, setup, line): pick the highest available MSC clock
and adjust the bus clock divider accordingly
- ubb-vga.c (main): added commented-out clock debugging output
- README: added XEN-1510T result for "640x480/61"
Two benefits:
1) We don't accumulate errors from the delay between the timer reset and
the deadline preceding it
2) In the future, we may use WAIT to wait for timer expiration, which
should cause less bus activity and is should also reduce jitter
- regs4740.h (TFR. TFSR, TFCR, TDHR): added more timer registers
- ubb-vga.c (until): renamed to "delay" and changed to measure relative
to the last deadline
- ubb-vga.c (line, hdelay, frame): replaced "until" with "delay"
- ubb-vga.c (hdelay, frame, session): reset the timer only once, at
the beginning of the session
- ubb-vga.c (frame): we didn't wait for the horizontal back porch of
the last image line
This caused 800x600 images to be cut off, because the line length is
not a multiple of 64 bytes.
- ubb-vga.c (session): make the allocation a multiple of the DMA
transfer size
- ubb-vga.c (line): round number of transfers up instead of down
- ubb-vga.c (mode_db): line duration of 800x600/54 was a bit to short
- ubb-vga.c (line): send a 0 word at the end of the line, to avoid
overscan (we use PIO to synchronize with CPU timing)
- ubb-vga.c (mode_db): updated line length of 640x480 resolutions for
correct termination
- ubb-vga.c (KEY_MASK): KEYINx lines on port D
- ubb-vga.c (session): run until keypress if the number of frames is
zero
- ubb-vga.c (main): set frames to zero if omitted
This is tricky: if we just make "mode" global, the whole timing may
fall apart, with the DMA locking up. So let's take small bisectable
steps to get there ...
- ubb-vga.c (struct mode), ubb-vga.h: moved mode entry declaration to
ubb-vga.h
- ubb-vga.c (mode_db): moved up
- ubb-vga.c (setup_noirq, line): moved DMA channel command setting to
per-session setup
- ubb-vga.c (setup_noirq, line): moved DMA request type setting to
per-session setup
- ubb-vga.c (line): added commend that the target address needs to be
set for each transfer, even if it doesn't change
Note that DMA is very sensitive to the video timing. At the moment,
only 800x600 mode works without locking up the DMA controller.
- ubb-vga.c (DMA, setup_noirq, cleanup_noirq, line): replaced MMC PIO
with DMA
- ubb-vga.c (frame): pass physical addresses to "line"
- ubb-vga.c (frame): detect if the DMA controller is stuck
- ubb-vga.c (ben_setup): use REG_WINDOW instead of calculating the
window size
- ubb-vga.c (PAGE_SIZS): we no longer need it - removed
- ubb-vga.c (line): shift bus width setting in MSC_CMDAT by the field
position, not the bit position
- ubb-vga.c (line): moved comment detailing the search for the
adjustment value to the mode database, so that we don't clutter
this function
- ubb-vga.sch: use resistive divider instead of diodes
- ubb-vga.sch, ubb-vga.c (VSYNC): moved VSYNC from DAT3 to CLK to make
all MMC data lines available for pixel data
- ubb-vga.sch, ubb-vga.c (R): moved red from DAT2 to DAT3 for convenient
access to the 4th channel
- ubb-vga.sch: added luminance (Y) channel
- ubb-vga.sch: added pull-down to HSYNC/CMD, for later use with the MMC
controller
- ubb-vga.c (pdfuns, pdfunc, ben_setup, setup): make UBB signals GPIOs,
in case someone left them in a different configuration
- README: added compatibility of double mode
- ubb-vga.c (usage, main): new option -d to double the number of set/clear
pairs (making lines longer and the apparent pixel clock slower)
- ubb-vga.c (grab, session, main): have a complete set/clear pair for each
pixel in double mode
- ubb-vga.c (line_pairs, line, frame, tricolor, grid, session): line
length is now kept in a variable, instead of hard-coding its value
and the values derived from it
- ubb-vga.c (line_cycles, line, hdelay): the total line duration is now
kept in a variable, instead of hard-coding it all over the place
- ubb-vga.c: added more section titles
- ubb-vga.c (pick, pattern): grouped pixel-generating functions with
image generation
- ubb-vga.c (usage, main): properly parse command-line options ("getopt"
is a bit of overkill at the moment but will be needed later)
The history of the split prefetch code:
Once up on a time, I thought that it was important to stay very close
to the "official" pixel clock. We could do this when copying 32 bit
words from cache to the GPIO set/clear registers, but not when
shifting 8 bit values as we do now.
One problem with 32 bit values is that transferring that amount of
data exceeds the time available in the hsync pulse. Hence the idea
to split the prefetch between hsync pulse and horizontal front porch.
Note that we also split prefetches between the two VGA lines of each
QVGA line. This commit does not change that mechanism.
- ubb-vga.c (line, frame): removed code fragments for prefetch split
between hsync pulse and front porch
- ubb-vga.c (line, frame): remove code fragments for measuring time
relative to the rising edge of hsync (and letting the prefetch time
control the hsync length), not the falling edge