Date:2011-04-24 17:12:36 (12 years 11 months ago)
Author:Werner Almesberger
Commit:554c6645d8a50d54306989783eb13dc2487d68a6
Message:ubb-vga.c: removed unused #defines and rearranged the code a little

Files: ubb-vga/ubb-vga.c (6 diffs)

Change Details

ubb-vga/ubb-vga.c
3535#include <sys/mman.h>
3636
3737
38static uint8_t thres = 63;
39
40
41/* ----- I/O pin assignment ------------------------------------------------ */
42
43
3844#define DAT0 (1 << 10)
3945#define DAT1 (1 << 11)
4046#define DAT2 (1 << 12)
...... 
4854#define HSYNC CMD
4955#define VSYNC DAT3
5056
51#define TIMER 7
52
5357
54#define PAGE_SIZE 4096
55#define SOC_BASE 0x10000000
56#define DEFAULT_COUNT (1000*1000)
58/* ----- Ben hardware ------------------------------------------------------ */
5759
5860
59static uint8_t thres = 63;
61#define TIMER 7
6062
6163
62/* ----- Ben hardware ------------------------------------------------------ */
64#define PAGE_SIZE 4096
65#define SOC_BASE 0x10000000
6366
6467
6568static volatile uint32_t *icmr, *icmsr, *icmcr;
...... 
97100
98101
99102/*
100 * @@@ Disabling the LCD clock will halng operations that depend on the LCD
103 * @@@ Disabling the LCD clock will hang operations that depend on the LCD
101104 * subsystem to advance. This includes the screen saver.
102105 */
103106
...... 
196199}
197200
198201
199/* ----- Interface --------------------------------------------------------- */
200
201
202void setup(void)
203{
204    mlockall(MCL_CURRENT | MCL_FUTURE);
205    ben_setup();
206    *pddirs = R | G | B | HSYNC | VSYNC;
207}
208
209
210static uint32_t pick(int set, int bit, uint32_t val)
211{
212    return set == bit ? val >> 8 : 0;
213}
214
215202
216static uint32_t pattern(int set, int r, int g, int b)
217{
218    return pick(set, r, R) | pick(set, g, G) | pick(set, b, B);
219}
203/* ----- Prefetch and delay logic ------------------------------------------ */
220204
221205
222206#define BURST 32
223207
224#define PREFETCH_HSYNC 160
225#define PREFETCH_HFRONT (160-PREFETCH_HSYNC)
226#define DELAY_HFRONT 30
227#define DELAY_HBACK 40
228//#define DELAY_VSYNC 3500
229//#define DELAY_VFRONT 56000
230//#define DELAY_VBACK 28000
231#define DELAY_VFRONT 1500
232#define DELAY_LINE 1800
233#define DELAY_HSYNC 210
234
235208
236209static inline void prefetch(const uint8_t *prefetch, int words)
237210{
...... 
244217}
245218
246219
220#define US(us) ((uint16_t) ((us)*112))
221
222
247223static void until(uint16_t cycles)
248224{
249225    while ((*tcnt & 0xffff) < cycles);
250226}
251227
252#define US(us) ((uint16_t) ((us)*112))
228
229/* ----- Interface --------------------------------------------------------- */
230
231
232void setup(void)
233{
234    mlockall(MCL_CURRENT | MCL_FUTURE);
235    ben_setup();
236    *pddirs = R | G | B | HSYNC | VSYNC;
237}
238
239
240static uint32_t pick(int set, int bit, uint32_t val)
241{
242    return set == bit ? val >> 8 : 0;
243}
244
245
246static uint32_t pattern(int set, int r, int g, int b)
247{
248    return pick(set, r, R) | pick(set, g, G) | pick(set, b, B);
249}
250
253251
254252static void line(const uint8_t *line, const uint8_t *fetch)
255253{
...... 
284282        until(US(3.77));
285283        *pddats = HSYNC;
286284        until(US(31.77));
287    until(US(36));
285        until(US(36));
288286    }
289287}
290288

Archive Download the corresponding diff file

Branches:
master



interactive