1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-24 00:20:38 +02:00

ubb-vga: added quick and dirty run-until-keypress mode

- ubb-vga.c (KEY_MASK): KEYINx lines on port D
- ubb-vga.c (session): run until keypress if the number of frames is
  zero
- ubb-vga.c (main): set frames to zero if omitted
This commit is contained in:
Werner Almesberger 2011-05-01 16:41:32 -03:00
parent 30079397f5
commit 934a89bfa5

View File

@ -109,6 +109,7 @@ const struct mode *mode = mode_db;
#define TIMER 7 #define TIMER 7
#define DMA 0 #define DMA 0
#define KEY_MASK 0x5f70000
static uint32_t old_icmr; static uint32_t old_icmr;
@ -378,13 +379,15 @@ static void session(void (*gen)(void **fb, int xres, int yres), int frames)
setup_noirq(); setup_noirq();
for (i = 0; i != frames; i++) { for (i = 0; !frames || i != frames; i++) {
frame(f_phys); frame(f_phys);
if (DTC(DMA)) { if (DTC(DMA)) {
fprintf(stderr, fprintf(stderr,
"DMA locked up. Need hardware reset.\n"); "DMA locked up. Need hardware reset.\n");
break; break;
} }
if (!frames && (PDPIN & KEY_MASK) != KEY_MASK)
break;
} }
cleanup_noirq(); cleanup_noirq();
@ -409,7 +412,7 @@ static void usage(const char *name)
int main(int argc, char *const *argv) int main(int argc, char *const *argv)
{ {
void (*gen)(void **fb, int xres, int yres) = grabfb; void (*gen)(void **fb, int xres, int yres) = grabfb;
int frames; int frames = 0;
int c; int c;
while ((c = getopt(argc, argv, "m:t")) != EOF) while ((c = getopt(argc, argv, "m:t")) != EOF)
@ -438,6 +441,8 @@ int main(int argc, char *const *argv)
case 1: case 1:
frames = atoi(argv[optind]); frames = atoi(argv[optind]);
break; break;
case 0:
break;
default: default:
usage(*argv); usage(*argv);
} }