From: Joel Holdsworth Date: Sat, 18 Feb 2012 16:43:25 +0000 (+0000) Subject: Rearranged main() in preparation for split according to device versions X-Git-Tag: sigrok-firmware-fx2lafw-0.1.0~71 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=1cbff47d1d2c78f62e8adb0896a9cecef9574bdd;p=sigrok-firmware-fx2lafw.git Rearranged main() in preparation for split according to device versions --- diff --git a/fx2lafw.c b/fx2lafw.c index f6995516..8b619857 100644 --- a/fx2lafw.c +++ b/fx2lafw.c @@ -404,7 +404,7 @@ void hispeed_isr(void) interrupt HISPEED_ISR CLEAR_HISPEED(); } -void main(void) +void fx2lafw_init(void) { /* Set DYN_OUT and ENH_PKT bits, as recommended by the TRM. */ REVCTL = bmNOAUTOARM | bmSKIPCOMMIT; @@ -435,11 +435,20 @@ void main(void) /* Perform the initial GPIF read. */ gpif_fifo_read(GPIF_EP2); +} - while (1) { - if (got_sud) { - handle_setupdata(); - got_sud = FALSE; - } +void fx2lafw_run(void) +{ + if (got_sud) { + handle_setupdata(); + got_sud = FALSE; } } + +void main(void) +{ + fx2lafw_init(); + + while(1) + fx2lafw_run(); +} diff --git a/fx2lafw.h b/fx2lafw.h new file mode 100644 index 00000000..bec4cb4e --- /dev/null +++ b/fx2lafw.h @@ -0,0 +1,30 @@ +/* + * This file is part of the fx2lafw project. + * + * Copyright (C) 2012 Joel Holdsworth + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * Performs setup common to all fx2lafw devices. + */ +void fx2lafw_init(void); + +/** + * Performs a single iteration of the main loop code which is common + * to all fx2lafw devices. + */ +void fx2lafw_run(void);