2 * Copyright (C) 2009 Ubixum, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #include <fx2macros.h>
21 #include <autovector.h>
35 volatile bit dosud=FALSE;
36 volatile bit dosuspend=FALSE;
39 extern void main_loop();
40 extern void main_init();
46 SETCPUFREQ(CLK_48M); // required for sio0_init
47 // main_init can still set this to whatever you want.
48 sio0_init(57600); // needed for printf if debug defined
64 // iic files (c2 load) don't need to renumerate/delay
84 printf ( "I'm going to Suspend.\n" );
85 WAKEUPCS |= bmWU|bmWU2; // make sure ext wakeups are cleared
97 } while ( !remote_wakeup_allowed && REMOTE_WAKEUP());
98 printf ( "I'm going to wake up.\n");
102 if ( REMOTE_WAKEUP() ) {
104 USBCS |= bmSIGRESUME;
106 USBCS &= ~bmSIGRESUME;
115 void resume_isr() __interrupt RESUME_ISR {
119 void sudav_isr() __interrupt SUDAV_ISR {
123 void usbreset_isr() __interrupt USBRESET_ISR {
124 handle_hispeed(FALSE);
127 void hispeed_isr() __interrupt HISPEED_ISR {
128 handle_hispeed(TRUE);
132 void suspend_isr() __interrupt SUSPEND_ISR {