# HG changeset patch # User Paul Boddie # Date 1541288600 -3600 # Node ID 3783422f5bdc58b409ca29021e046f3406989960 # Parent 254ee12221e275699dd9252be7b494bc13b4c7f3 Introduced a function to wait for the end of the visible region. diff -r 254ee12221e2 -r 3783422f5bdc examples/vga/main.c --- a/examples/vga/main.c Sat Nov 03 14:05:05 2018 +0100 +++ b/examples/vga/main.c Sun Nov 04 00:43:20 2018 +0100 @@ -164,6 +164,7 @@ x, y, 0x8c, 1); wait(delay); + vga_wait_visible(); /* Copy to the display from the store, restoring the original background. */ @@ -335,7 +336,7 @@ /* Move a sprite around on the screen with a delay between each movement. */ - animate(1 << 21); + animate(1 << 18); } diff -r 254ee12221e2 -r 3783422f5bdc include/vga_display.h --- a/include/vga_display.h Sat Nov 03 14:05:05 2018 +0100 +++ b/include/vga_display.h Sun Nov 04 00:43:20 2018 +0100 @@ -84,6 +84,10 @@ void vga_configure_zero_channel(int channel, int int_num, int initiating, uint32_t output); +/* Access-related operations. */ + +void vga_wait_visible(void); + /* Interrupt handlers. */ void vga_interrupt_handler(void); diff -r 254ee12221e2 -r 3783422f5bdc lib/vga_display.c --- a/lib/vga_display.c Sat Nov 03 14:05:05 2018 +0100 +++ b/lib/vga_display.c Sun Nov 04 00:43:20 2018 +0100 @@ -243,6 +243,16 @@ +/* Wait for the visible region to be completed. */ + +void vga_wait_visible(void) +{ + while (((volatile void (*)()) vga_display.state_handler) == visible_active) + __asm__ __volatile__("wait"); +} + + + /* Display state machine interrupt handler. */ void vga_interrupt_handler(void)