USB-BDI
|
00001 /* USB-BDI Used for programming and debugging a MPC555 over USB 00002 * 00003 * Copyright 2005 NTB Interstate University of Applied Sciences of Technology Buchs 00004 * 00005 * This program is free software: you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation, either version 3 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 */ 00024 #include "fx2utils.h" 00025 #include "fx2regs.h" 00026 #include "delay.h" 00027 00032 void fx2_stall_ep0 (void){ 00033 EP0CS |= bmEPSTALL; 00034 } 00035 00041 void fx2_reset_data_toggle (unsigned char ep){ 00042 TOGCTL = ((ep & 0x80) >> 3 | (ep & 0x0f)); 00043 TOGCTL |= bmRESETTOGGLE; 00044 } 00045 00050 void fx2_renumerate (void){ 00051 USBCS |= bmDISCON | bmRENUM; 00052 00053 mdelay (250); 00054 00055 USBIRQ = 0xff; // clear any pending USB irqs... 00056 EPIRQ = 0xff; // they're from before the renumeration 00057 00058 EXIF &= ~bmEXIF_USBINT; 00059 00060 USBCS &= ~bmDISCON; // reconnect USB 00061 }