summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2017-11-02 09:10:54 -0700
committerKeith Packard <keithp@keithp.com>2017-11-02 09:10:54 -0700
commit2418a1297af8f43e338067321779328c59b4a96c (patch)
tree76ecbecde63c62992f5cf4baa1b46bd966017110
parent83929cd290279963b01b2ccd52c70d61bdeff6b0 (diff)
altos: Add vblank signal to vga driver
Allow applications to sync with vblank. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/drivers/ao_vga.c6
-rw-r--r--src/drivers/ao_vga.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/src/drivers/ao_vga.c b/src/drivers/ao_vga.c
index 909e3109..59658caf 100644
--- a/src/drivers/ao_vga.c
+++ b/src/drivers/ao_vga.c
@@ -91,6 +91,8 @@ static uint32_t *scanline;
(en << STM_DMA_CCR_EN))
+uint8_t ao_vga_vblank;
+
void stm_tim2_isr(void)
{
int16_t line = stm_tim3.cnt;
@@ -111,6 +113,10 @@ void stm_tim2_isr(void)
if (((line - VBLANK_END) & 1))
scanline += AO_VGA_STRIDE;
} else {
+ if (line == VBLANK_START) {
+ ao_vga_vblank = 1;
+ ao_wakeup(&ao_vga_vblank);
+ }
scanline = ao_vga_fb;
}
stm_tim2.sr = 0;
diff --git a/src/drivers/ao_vga.h b/src/drivers/ao_vga.h
index 7d9d6b39..92cdb76c 100644
--- a/src/drivers/ao_vga.h
+++ b/src/drivers/ao_vga.h
@@ -36,4 +36,6 @@ extern uint32_t ao_vga_fb[AO_VGA_STRIDE * AO_VGA_HEIGHT];
extern const struct ao_bitmap ao_vga_bitmap;
+extern uint8_t ao_vga_vblank;
+
#endif /* _AO_VGA_H_ */