1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-18 02:30:37 +02:00
Commit Graph

97 Commits

Author SHA1 Message Date
Werner Almesberger
319d8a044b tstimg.c (tstimg): adjust size and position of parameters according to yres 2011-05-01 23:19:57 -03:00
Werner Almesberger
4450a30456 ubb-vga.c (list_modes, usage, main): new option -l to list available modes 2011-05-01 23:12:38 -03:00
Werner Almesberger
b184fbbe74 ubb-vga.c (mode_db): cleanup and added approximations of standard modes 2011-05-01 23:00:35 -03:00
Werner Almesberger
9412c9debe ubb-vga: test image now shows detailed horizontal and vertical timing
- ubb-vga.c (CYCLES), ubb-vga.h: corrected conversion and moved to
  ubb-vga.h
- tstimg.c (printc): added characters '=' and '+'
- tstimg.c (tstimg): print detailed horizontal and vertical timing
2011-05-01 21:50:20 -03:00
Werner Almesberger
4b59dbf062 ubb-vga: express mode data in more common units and remove hard-coded constants
- ubb-vga.h (struct mode), ubb-vga.c (mode_db): replaced hsync_end with
  its constituends hsync_cycles and hback_cycles
- ubb-vga.h (struct mode), ubb-vga.c (mode_db): added vsync_lines,
  vfront_lines, and vback_lines
- ubb-vga.h (struct mode): changed "line_cycles" from "int" to
  "uint16_t"
- ubb-vga.c (line): don't hard-code horizontal back porch
- ubb-vga.c (line): don't hard-code sum of horizontal back porch and
  hsync
- ubb-vga.c (hdelay): don't hard-code hsync
- ubb-vga.c (frame): don't hard-code vsync and the vertical porches
- ubb-vga.c (frame): don't hard-code hsync and horizontal back porch
2011-05-01 20:59:38 -03:00
Werner Almesberger
aa2fc7101d ubb-vga.c (mode_db): added 1024x768, 53 Hz mode (56 MHz pixel clock) 2011-05-01 18:55:29 -03:00
Werner Almesberger
606dd63492 tstimc.c (tstimg): frame rate calculation didn't include the vsync pulse 2011-05-01 18:54:44 -03:00
Werner Almesberger
934a89bfa5 ubb-vga: added quick and dirty run-until-keypress mode
- 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
2011-05-01 16:41:32 -03:00
Werner Almesberger
30079397f5 tstimg.c (tstimg): display timing parameters 2011-05-01 15:23:19 -03:00
Werner Almesberger
eabd0b53f6 ubb-vga: make mode information global
- ubb-vga.c (mode), ubb-vga.h: made global
2011-05-01 15:17:30 -03:00
Werner Almesberger
f7eb220401 ubb-vga: gently prepare the code for sharing mode information
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
2011-05-01 15:17:01 -03:00
Werner Almesberger
90b087cea0 ubb-vga.c (struct mode, mode_db): removed no longer used field "line_words" 2011-05-01 14:47:16 -03:00
Werner Almesberger
7d16a0682d tstimg.c: completed the alphabet
- tstimg.c (printc): added diagonal to '0' (zero) to distinguish it from
  'O' (oh)
- tstimg.c (printc): added "nose" to '1' to better distinguish it from
  'I'
- tstimg.c (printc): completed the alphabet
- tstimg.c (printc): added '.' character
2011-05-01 14:29:11 -03:00
Werner Almesberger
9fb5c6f3f4 ubb-vga.c: moved some DMA settings from per-line to per-session setup
- 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
2011-05-01 13:54:54 -03:00
Werner Almesberger
b273f27c07 ubb-vga.c: DMA was set to transfer twice the amount needed, oops
- ubb-vga.c (line): removed unnecessary DMA channel reset
- ubb-vga.c (line): number of words is pixels/64, not pixels/32
2011-05-01 13:22:08 -03:00
Werner Almesberger
a8a0cfa22f ubb-vga.c: added (fragile) DMA support (locks up on anything but 800x600)
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
2011-05-01 12:22:23 -03:00
Werner Almesberger
64f3047144 ubb-vga.c: cleaned up setup process and prepared for DMA
- ubb-vga.c (setup): made "static"
- ubb-vga.c (setup_noirq, cleanup_noirq, session): added functions for
  setup tasks to perform with interrupts off
2011-04-29 22:48:01 -03:00
Werner Almesberger
8d803dda4c ubb-vga.c: housekeeping
- 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
2011-04-29 22:22:51 -03:00
Werner Almesberger
1a7b5015f1 regs4740.h: added DMAC registers; added virt to phys translation; cleanup
- regs4740.h (REG_PADDR): translate a register access to the
  corresponding physical address
- regs4740.h (REG_WINDOW): added register window size
- regs4740.h (CGU, INT, TCU, GPIO, MSC): prefix register group macros
  with an underscore, to avoid name collision with DMAC
- regs4740.h: added DMAC registers
- regs4740.h (MSC_NOP): should be MSC_NOB
2011-04-29 22:09:42 -03:00
Werner Almesberger
6cd21404cd physmem.c: added virtual to physical translation
- physmem.c (calloc_phys_vec): malloc the vector instead of sbrk'ing it
- ubb-vga.h (xlat_virt), physmem.c (xlat_one, xlat_virt): translate a
  vector of virtual addresses to physical addresses
2011-04-29 21:15:27 -03:00
Werner Almesberger
3a8e062c48 renamed ubb-vga.c to ubb-vga-old.c, ubb-vga2.c to ubb-vga.c; updated Makefile 2011-04-29 14:03:07 -03:00
Werner Almesberger
debe9cc351 physmem.c: align memory to word and page size
- physmem.c (align_sbrk): align the end of the data segment
- physmem.c (calloc_phys_vec): align the line pointer vector to a machine
  word, just in case
- physmem.c (calloc_phys_vec): crudely align the line buffers within
  pages, to avoid page-crossing within a line (yes, this does reduce
  noise)
2011-04-29 14:01:17 -03:00
Werner Almesberger
2cee702ff4 tstimg.c (grill): avoid fencepost errors (pixel at xres/yres) 2011-04-29 14:01:16 -03:00
Werner Almesberger
f608e561a2 ubb-vga2.c (main): fixed check for unknown resolution and call it "mode" 2011-04-29 14:00:58 -03:00
Werner Almesberger
a63579e119 ubb-vga2.c (line, frame): start line timer outside the "line" function
The indirection introduced with the non-contiguous frame buffer caused
significant horizontal distortions. We can compensate for them by
starting the timer before loading the line pointer and calling "line".
2011-04-29 13:28:22 -03:00
Werner Almesberger
623f3ccbe3 ubb-vga2: non-contiguous allocation of frame buffer memory
- ubb-vga.h (calloc_phys_vec), physmem.c: non-contiguous memory allocator
  (for now, without really considering any mapping to physical memory)
- Makefile (OBJS): added physmem.o
- ubb-vga.h (grabfb), grabfb.c (grabfb): API change for non-contiguous
  frame buffer
- ubb-vga.h (ppmimg), ppmimg.c (convert, ppmimg): API change for
  non-contiguous frame buffer
- ubb-vga.h (tstimg), tstimg.c (pixel, color_bars, grill, grid, sides,
  dot, line45, arc, printc, text, ctext, tstimg): API change for
  non-contiguous frame buffer
- tstimg.c (tstimg): we no longer need to clear the frame buffer
- ubb-vga.c (frame, session, main): use a vector of line buffers instead
  of a contiguous frame buffer
2011-04-29 13:04:02 -03:00
Werner Almesberger
71c9c7dd78 ubb-vga2: new option -m to select the display mode (resolution, timing)
- ubb-vga2.c (XREs, YRES, res, res_db, setup, line, hdelay, frame,
  session): replaced hard-coded display characteristics with a mode
  database
- ubb-vga2.c (usage, main): new option -m to select the display mode
- ubb-vga2.c (session): allocate frame buffer dynamically
- ubb-vga2.c (session): since we no longer prefetch, we don't need to
  allocate space beyond the end of the frame buffer
- ubb-vga2.c (line): resurrected "quick load" and extended it to fill the
  FIFO completely
2011-04-28 21:30:45 -03:00
Werner Almesberger
957491d209 ubb-vga2: instead of pointers to registers, use pointer plus offset (via macros)
- regs4740.h: macros to access selected Jz4740 registers
- ubb-vga2.c: replaced all pointers to registers with access macros
- ubb-vga2.c (line_cycles): we now seem to be 0.1 us slower
2011-04-28 18:41:00 -03:00
Werner Almesberger
cb5a6bd202 ubb-vga.sch: fixed typo in comment 2011-04-28 16:45:29 -03:00
Werner Almesberger
4480b32c50 ubb-vga2.c: corrected and improved loading of the first TX word
- ubb-vga2.c (line): write the first word to the TX FIFO after starting
  the command or it is lost
- ubb-vga2.c (line): fetch the first word while waiting for the back
  porch, making sure we have plenty of time for cache effects
- ubb-vga2.c (line): we no longer need to prefetch the first word of
  the next line
2011-04-28 12:30:22 -03:00
Werner Almesberger
e94b3bbcfc ubb-vga2.c (line, frame): don't pass prefetch pointer but just use *p 2011-04-28 11:57:21 -03:00
Werner Almesberger
6414d92412 ubb-vga2.c: move display resolution to #defines
- ubb-vga2.c (XRES, line_words, session): don't hard-code the X resolution
- ubb-vga2.c (YRES, line_words, frame, session): don't hard-code the Y
  resolution
2011-04-28 02:14:15 -03:00
Werner Almesberger
c8f19a0b4c ubb-vga.pro: commit pcbnew preferences (from local layout experiments) 2011-04-28 02:10:58 -03:00
Werner Almesberger
6558f56de6 ubb-vga2: replaced threshold-based color mapping with color cube model
- ubb-vga.h (ccube_init, ccube_map), ccube.c: color mapper based on
  proximity in color cube
- grabfb.c (pattern, grabfb), ppmimg.c (pattern, convert): use the color
  cube mapper instead of inferios threshold-based mapping
- ubb-vga2.c (session): initialize the color cube
- ubb-vga.h (thres), grabfb.c (thres), ubb-vga2.c (usage, main): removed
  the threshold along with the option (-l) to set it
- Makefile (OBJS): added ccube.o
2011-04-28 01:18:03 -03:00
Werner Almesberger
f0eda51391 ubb-vga/ppmimg.c (pattern): corrected the pattern for un-doubled pixels 2011-04-28 00:59:30 -03:00
Werner Almesberger
080978ade0 ubb-vga2: added support for showing a PPM image
- Makefile (OBJS): added ppm.o and ppmimg.o
- ppm.h (load_ppm), ppm.c: PPM file loader, adapted from
  eda-tools/schhist/ppmdiff/ppmdiff.c
- ubb-vga.h (img_name, ppmimg), ppmimg.c: PPM image to frame buffer
  converter
- ubb-vga2.c (usage, main): the threshold is now set with the option -l
- ubb-vga2.c (usage, main): if a second argument is given, treat it as
  a PPM file
- ubb-vga2.c (usage): also documented option -t
2011-04-28 00:38:13 -03:00
Werner Almesberger
19f43a77c9 ubb-vga2: added test image generator (option -t)
- tstimg.c: test image generator
- Makefile (OBJS): added tstimg.o
- Makefile (LDFLAGS): tstimg.c needs libm
- ubb-vga2.c (session, main): pass image generator as a function pointer
- ubb-vga2.c (main): new option -t to select the test image generator
2011-04-27 23:31:39 -03:00
Werner Almesberger
8643e457fa ubb-vga2: move image generation out of the main program
- ubb-vga2.c (session, grab): made the frame buffer "void *" and pass
  frame buffer resolution
- ubb-vga.h: color encoding and items shared between compilation units
- ubb-vga2.c (thres, pattern, grab), grabfb.c: move to grabfb.c
- ubb-vga2.c (map): make global, for use by grabfb.c
- ubb-vga2.c (pick, pattern, tricolor, grid): removed obsolete test
  image generators
- Makefile (OBJS, ubb-vga2): added grabfb.o
- Makefile (clean): remove only .o files
- Makefile (spotless): remove only executables
2011-04-27 20:59:29 -03:00
Werner Almesberger
625d9877ab ubb-vga2.c: make frame buffer fully VGA-sized; more cleanup
- ubb-vga2.c (frame, grab, session): keep all 480 lines in the frame
  buffer instead of duplicating them on output
- ubb-vga2.c (bad): make "static"
- ubb-vga2.c (session, main): removed the "single" argument
- ubb-vga2.c (main): complain about timeouts only if any occurred
2011-04-27 20:20:59 -03:00
Werner Almesberger
9a455c55fc ubb-vga2.c: code cleanup and some fine-tuning 2011-04-27 18:28:09 -03:00
Werner Almesberger
a759723ed1 ubb-vga: added driver based on the MMC controller (highly experimental)
- ubb-vga2.c: use the MMC controler to stream the pixel data
- Makefile (all, clean): added ubb-vga2
2011-04-27 17:21:30 -03:00
Werner Almesberger
a794c4b1b2 ubb-vga: avoid diodes; redesign for luminance bit (Y) and MMC controller
- 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
2011-04-27 16:48:07 -03:00
Werner Almesberger
ce1c6af24f ubb-vga/README: "single/double mode", not "single-double mode" 2011-04-25 00:06:25 -03:00
Werner Almesberger
e1e473edec renamed ubb-vga/res.fig to mapping.fig 2011-04-24 23:56:29 -03:00
Werner Almesberger
5df56a39b0 ubb-vga: documented single and double mode
- README: describe how single and double mode work
- res.fig: illustrate the mapping in single and double mode
2011-04-24 21:26:00 -03:00
Werner Almesberger
67107d0062 ubb-vga: option -d to double the number of set/clear pairs, improving resolution
- 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
2011-04-24 21:09:50 -03:00
Werner Almesberger
dab839ab66 ubb-vga.c: moved line length and timing to variables
- 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
2011-04-24 20:01:12 -03:00
Werner Almesberger
dae21696b3 ubb-vga.c: a bit more cleanup
- 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)
2011-04-24 19:43:26 -03:00
Werner Almesberger
554c6645d8 ubb-vga.c: removed unused #defines and rearranged the code a little 2011-04-24 12:12:36 -03:00
Werner Almesberger
fb153b2bf3 ubb-vga/README: added title and compatibility list 2011-04-24 12:02:48 -03:00