source: trunk/FirmwareFX2/fx2/fx2utils.c@ 53

Last change on this file since 53 was 4, checked in by demin, 15 years ago

initial commit

File size: 1.8 KB
Line 
1/* -*- c++ -*- */
2/*-----------------------------------------------------------------------------
3 * FX2 specific subroutines
4 *-----------------------------------------------------------------------------
5 * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2,
6 * Copyright 2003 Free Software Foundation, Inc.
7 *-----------------------------------------------------------------------------
8 * This code is part of usbjtag. usbjtag is free software; you can redistribute
9 * it and/or modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the License,
11 * or (at your option) any later version. usbjtag is distributed in the hope
12 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
13 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. You should have received a
15 * copy of the GNU General Public License along with this program in the file
16 * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin
17 * St, Fifth Floor, Boston, MA 02110-1301 USA
18 *-----------------------------------------------------------------------------
19 */
20
21#include "fx2utils.h"
22#include "fx2regs.h"
23#include "delay.h"
24
25void
26fx2_stall_ep0 (void)
27{
28 EP0CS |= bmEPSTALL;
29}
30
31void
32fx2_reset_data_toggle (unsigned char ep)
33{
34 TOGCTL = ((ep & 0x80) >> 3 | (ep & 0x0f));
35 TOGCTL |= bmRESETTOGGLE;
36}
37
38void
39fx2_renumerate (void)
40{
41 USBCS |= bmDISCON | bmRENUM;
42
43 // mdelay (1500); // FIXME why 1.5 seconds?
44 mdelay (250); // FIXME why 1.5 seconds?
45
46 USBIRQ = 0xff; // clear any pending USB irqs...
47 EPIRQ = 0xff; // they're from before the renumeration
48
49 EXIF &= ~bmEXIF_USBINT;
50
51 USBCS &= ~bmDISCON; // reconnect USB
52}
Note: See TracBrowser for help on using the repository browser.