CLEAR_HISPEED();
}
-void main(void)
+void fx2lafw_init(void)
{
/* Set DYN_OUT and ENH_PKT bits, as recommended by the TRM. */
REVCTL = bmNOAUTOARM | bmSKIPCOMMIT;
/* 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();
+}
--- /dev/null
+/*
+ * This file is part of the fx2lafw project.
+ *
+ * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * 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);