1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-07-01 02:44:32 +03:00

ubb-vga.c: removed unused #defines and rearranged the code a little

This commit is contained in:
Werner Almesberger 2011-04-24 12:12:36 -03:00
parent fb153b2bf3
commit 554c6645d8

View File

@ -35,6 +35,12 @@
#include <sys/mman.h>
static uint8_t thres = 63;
/* ----- I/O pin assignment ------------------------------------------------ */
#define DAT0 (1 << 10)
#define DAT1 (1 << 11)
#define DAT2 (1 << 12)
@ -48,18 +54,15 @@
#define HSYNC CMD
#define VSYNC DAT3
/* ----- Ben hardware ------------------------------------------------------ */
#define TIMER 7
#define PAGE_SIZE 4096
#define SOC_BASE 0x10000000
#define DEFAULT_COUNT (1000*1000)
static uint8_t thres = 63;
/* ----- Ben hardware ------------------------------------------------------ */
static volatile uint32_t *icmr, *icmsr, *icmcr;
@ -97,7 +100,7 @@ static void enable_interrupts(void)
/*
* @@@ Disabling the LCD clock will halng operations that depend on the LCD
* @@@ Disabling the LCD clock will hang operations that depend on the LCD
* subsystem to advance. This includes the screen saver.
*/
@ -196,6 +199,33 @@ static void cleanup(void)
}
/* ----- Prefetch and delay logic ------------------------------------------ */
#define BURST 32
static inline void prefetch(const uint8_t *prefetch, int words)
{
volatile const uint8_t *p = prefetch;
while (p != prefetch+words) {
(void) *p;
p += BURST;
}
}
#define US(us) ((uint16_t) ((us)*112))
static void until(uint16_t cycles)
{
while ((*tcnt & 0xffff) < cycles);
}
/* ----- Interface --------------------------------------------------------- */
@ -219,38 +249,6 @@ static uint32_t pattern(int set, int r, int g, int b)
}
#define BURST 32
#define PREFETCH_HSYNC 160
#define PREFETCH_HFRONT (160-PREFETCH_HSYNC)
#define DELAY_HFRONT 30
#define DELAY_HBACK 40
//#define DELAY_VSYNC 3500
//#define DELAY_VFRONT 56000
//#define DELAY_VBACK 28000
#define DELAY_VFRONT 1500
#define DELAY_LINE 1800
#define DELAY_HSYNC 210
static inline void prefetch(const uint8_t *prefetch, int words)
{
volatile const uint8_t *p = prefetch;
while (p != prefetch+words) {
(void) *p;
p += BURST;
}
}
static void until(uint16_t cycles)
{
while ((*tcnt & 0xffff) < cycles);
}
#define US(us) ((uint16_t) ((us)*112))
static void line(const uint8_t *line, const uint8_t *fetch)
{
const uint8_t *p = line;
@ -284,7 +282,7 @@ static void hdelay(int cycles)
until(US(3.77));
*pddats = HSYNC;
until(US(31.77));
until(US(36));
until(US(36));
}
}