mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-19 06:10:17 +02:00
ubb-vga: new option -2 to keep on refreshing the LCD display (experimental)
"Experimental" means that it doesn't seem to work at the moment. - regs4740.h (_LCD, LCDCTRL): added the LCD control register - ubb-vga.c (old_lcdctrl, tame_lcd, restore_lcd): make the LCD controller use short bursts, to reduce the bus access latency for other users - ubb-vga.c (keep_lcd, setup_noirq, cleanup_noirq, usage, main): new option -2 to keep on refreshing the LCD display
This commit is contained in:
parent
f7e8fbbaea
commit
ba1d297643
@ -30,6 +30,7 @@
|
|||||||
#define _GPIO(n) REG(0x0010000+(n))
|
#define _GPIO(n) REG(0x0010000+(n))
|
||||||
#define _MSC(n) REG(0x0021000+(n))
|
#define _MSC(n) REG(0x0021000+(n))
|
||||||
#define _DMAC(n) REG(0x3020000+(n))
|
#define _DMAC(n) REG(0x3020000+(n))
|
||||||
|
#define _LCD(n) REG(0x3050000+(n))
|
||||||
|
|
||||||
#define CLKGR _CGU(0x0020) /* Clock Gate */
|
#define CLKGR _CGU(0x0020) /* Clock Gate */
|
||||||
#define MSCCDR _CGU(0x0068) /* MSC device clock divider */
|
#define MSCCDR _CGU(0x0068) /* MSC device clock divider */
|
||||||
@ -80,4 +81,6 @@
|
|||||||
#define DMAC _DMAC(0x300) /* DMA control */
|
#define DMAC _DMAC(0x300) /* DMA control */
|
||||||
#define DDR _DMAC(0x308) /* DMA doorbell */
|
#define DDR _DMAC(0x308) /* DMA doorbell */
|
||||||
|
|
||||||
|
#define LCDCTRL _LCD(0x30) /* LCD control */
|
||||||
|
|
||||||
#endif /* !REGS4740_H */
|
#endif /* !REGS4740_H */
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
static volatile void *base;
|
static volatile void *base;
|
||||||
|
|
||||||
static int bad;
|
static int bad;
|
||||||
|
static int keep_lcd = 0;
|
||||||
|
|
||||||
|
|
||||||
#define US(us) ((uint16_t) ((us)*112))
|
#define US(us) ((uint16_t) ((us)*112))
|
||||||
@ -141,6 +142,7 @@ static uint32_t clkrt = 0;
|
|||||||
|
|
||||||
static uint32_t old_icmr;
|
static uint32_t old_icmr;
|
||||||
static uint32_t old_clkgr;
|
static uint32_t old_clkgr;
|
||||||
|
static uint32_t old_lcdctrl;
|
||||||
|
|
||||||
|
|
||||||
static void disable_interrupts(void)
|
static void disable_interrupts(void)
|
||||||
@ -181,6 +183,20 @@ static void enable_lcd(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void tame_lcd(void)
|
||||||
|
{
|
||||||
|
old_lcdctrl = LCDCTRL;
|
||||||
|
/* LCDCTRL.BST = 0, for 4 word burst, the shortest available */
|
||||||
|
LCDCTRL = old_lcdctrl & 0xfffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void restore_lcd(void)
|
||||||
|
{
|
||||||
|
LCDCTRL = old_lcdctrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void get_timer(void)
|
static void get_timer(void)
|
||||||
{
|
{
|
||||||
TSCR = 1 << TIMER; /* enable clock */
|
TSCR = 1 << TIMER; /* enable clock */
|
||||||
@ -269,6 +285,9 @@ static void setup(void)
|
|||||||
|
|
||||||
static void setup_noirq(void)
|
static void setup_noirq(void)
|
||||||
{
|
{
|
||||||
|
if (keep_lcd)
|
||||||
|
tame_lcd();
|
||||||
|
else
|
||||||
disable_lcd();
|
disable_lcd();
|
||||||
get_timer();
|
get_timer();
|
||||||
|
|
||||||
@ -290,6 +309,9 @@ static void cleanup_noirq(void)
|
|||||||
DCS(DMA) = 0;
|
DCS(DMA) = 0;
|
||||||
|
|
||||||
release_timer();
|
release_timer();
|
||||||
|
if (keep_lcd)
|
||||||
|
restore_lcd();
|
||||||
|
else
|
||||||
enable_lcd();
|
enable_lcd();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,10 +470,11 @@ static void list_modes(void)
|
|||||||
static void usage(const char *name)
|
static void usage(const char *name)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"usage: %s [-t] [-r resolution] [frames [file]]\n"
|
"usage: %s [-2] [-t] [-r resolution] [frames [file]]\n"
|
||||||
" %s -l\n\n"
|
" %s -l\n\n"
|
||||||
" frames number of frames to display\n"
|
" frames number of frames to display\n"
|
||||||
" file PPM file\n\n"
|
" file PPM file\n\n"
|
||||||
|
" -2 keep on refreshing the LCD display (experimental)\n"
|
||||||
" -l list available modes\n"
|
" -l list available modes\n"
|
||||||
" -m mode select the display mode, default \"%s\"\n"
|
" -m mode select the display mode, default \"%s\"\n"
|
||||||
" -t generate a test image\n"
|
" -t generate a test image\n"
|
||||||
@ -466,8 +489,11 @@ int main(int argc, char *const *argv)
|
|||||||
int frames = 0;
|
int frames = 0;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "lm:t")) != EOF)
|
while ((c = getopt(argc, argv, "2lm:t")) != EOF)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case '2':
|
||||||
|
keep_lcd = 1;
|
||||||
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
list_modes();
|
list_modes();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user