# HG changeset patch # User Paul Boddie # Date 1456268273 -3600 # Node ID 9e40bad33af1a381161eb18f11586be0d643c7ac # Parent f359a433cb1a3bb191118093f5c11e2b66cf6cf1 Pass parameters to the plot_pattern function. Removed long-redundant variable declaration. diff -r f359a433cb1a -r 9e40bad33af1 stage2/irq.c --- a/stage2/irq.c Tue Feb 23 23:39:38 2016 +0100 +++ b/stage2/irq.c Tue Feb 23 23:57:53 2016 +0100 @@ -1,7 +1,7 @@ /* * Interrupt handling. * - * Copyright (C) 2015 Paul Boddie + * Copyright (C) 2015, 2016 Paul Boddie * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,33 +28,31 @@ #include "lcd.h" #include "jzlcd.h" #include "cpu.h" +#include "irq.h" extern vidinfo_t panel_info; -static unsigned short pixel_type; -static unsigned short x, y; -extern unsigned long lastdec; -void next_pixel() +void next_pixel(unsigned short *x, unsigned short *y) { - x++; - if (x >= panel_info.vl_col) { - x = 0; - y++; - if (y >= panel_info.vl_row) - y = 0; + (*x)++; + if (*x >= panel_info.vl_col) { + *x = 0; + (*y)++; + if (*y >= panel_info.vl_row) + *y = 0; } } /* Tasks. */ -void plot_pattern() +void plot_pattern(unsigned short pixel_type, unsigned short x, unsigned short y) { while (1) { if (pixel_type) test_pixel(x, y); else clear_pixel(x, y); - next_pixel(); + next_pixel(&x, &y); udelay(100); } } @@ -64,7 +62,6 @@ void irq_init() { timer_init_irq(); - x = 0; y = 0; pixel_type = 1; handle_error_level(); init_interrupts(); enable_interrupts(); @@ -80,7 +77,7 @@ /* Update the pixel type. */ - pixel_type = __gpio_get_pin(GPIO_POWER); + /* pixel_type = __gpio_get_pin(GPIO_POWER); */ /* Clear interrupt status. */ @@ -100,7 +97,7 @@ void start_task() { enter_user_mode(); - plot_pattern(); + plot_pattern(1, 0, 0); } void tlb_handle()