From 2418a1297af8f43e338067321779328c59b4a96c Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 2 Nov 2017 09:10:54 -0700 Subject: [PATCH] altos: Add vblank signal to vga driver Allow applications to sync with vblank. Signed-off-by: Keith Packard --- src/drivers/ao_vga.c | 6 ++++++ src/drivers/ao_vga.h | 2 ++ 2 files changed, 8 insertions(+) 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_ */ -- 2.30.2