mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-27 18:27:32 +02:00
ubb-vga.c: removed unused #defines and rearranged the code a little
This commit is contained in:
parent
fb153b2bf3
commit
554c6645d8
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user