Root/ubb-vga/ubb-vga.h

1/*
2 * ubb-vga.h - Output video on UBB with more or less VGA timing
3 *
4 * Written 2011 by Werner Almesberger
5 * Copyright 2011 Werner Almesberger
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef UBB_VGA_H
14#define UBB_VGA_H
15
16#include <stdint.h>
17#include <sys/types.h>
18
19
20#define R_VAL (1 << 3)
21#define G_VAL (1 << 0)
22#define B_VAL (1 << 1)
23#define Y_VAL (1 << 2)
24
25
26struct mode {
27    const char *name; /* NULL for end of table */
28    int xres, yres;
29    int clkdiv; /* pixel clock = 336 MHz/(clkdiv+1) */
30    int vsync_lines; /* 2 lines, for official VGA */
31    int vfront_lines; /* 32 lines */
32    int vback_lines; /* 14 lines */
33    uint16_t hsync_cycles; /* 3.77 us */
34    uint16_t hback_cycles; /* 0.79 us */
35    uint16_t line_cycles; /* 31.77 us */
36};
37
38extern const struct mode *mode;
39
40
41void *map(off_t addr, size_t size);
42
43
44#define CYCLES(cy) ((cy)/112.0)
45
46
47/* ccube.c */
48
49uint8_t ccube_map(uint8_t r, uint8_t g, uint8_t b);
50void ccube_init(void);
51
52/* physmem.c */
53
54void **calloc_phys_vec(size_t n, size_t size);
55unsigned long *xlat_virt(void *const *v, size_t n);
56
57/* grabfb.c */
58
59void grabfb(void **f, int xres, int yres);
60
61/* tstimg.c */
62
63void tstimg(void **f, int xres, int yres);
64
65/* ppmimg.c */
66
67extern char *img_name;
68
69void ppmimg(void **f, int xres, int yres);
70
71#endif /* !UBB_VGA_H */
72

Archive Download this file

Branches:
master



interactive