OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.61/] [tools/] [fx2/] [src/] [lib/] [fx2utils.c] - Diff between revs 17 and 26

Only display areas with differences | Details | Blame | View Log

Rev 17 Rev 26
/* -*- c++ -*- */
/* -*- c++ -*- */
/* $Id: fx2utils.c 395 2011-07-17 22:02:55Z mueller $ */
/* $Id: fx2utils.c 395 2011-07-17 22:02:55Z mueller $ */
/*-----------------------------------------------------------------------------
/*-----------------------------------------------------------------------------
 * FX2 specific subroutines
 * FX2 specific subroutines
 *-----------------------------------------------------------------------------
 *-----------------------------------------------------------------------------
 * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2,
 * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2,
 * Copyright 2003 Free Software Foundation, Inc.
 * Copyright 2003 Free Software Foundation, Inc.
 *-----------------------------------------------------------------------------
 *-----------------------------------------------------------------------------
 * This code is part of usbjtag. usbjtag is free software; you can redistribute
 * This code is part of usbjtag. usbjtag is free software; you can redistribute
 * it and/or modify it under the terms of the GNU General Public License as
 * 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,
 * published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version. usbjtag is distributed in the hope
 * or (at your option) any later version. usbjtag is distributed in the hope
 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.  You should have received a
 * GNU General Public License for more details.  You should have received a
 * copy of the GNU General Public License along with this program in the file
 * copy of the GNU General Public License along with this program in the file
 * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin
 * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin
 * St, Fifth Floor, Boston, MA  02110-1301  USA
 * St, Fifth Floor, Boston, MA  02110-1301  USA
 *-----------------------------------------------------------------------------
 *-----------------------------------------------------------------------------
 */
 */
 
 
#include "fx2utils.h"
#include "fx2utils.h"
#include "fx2regs.h"
#include "fx2regs.h"
#include "delay.h"
#include "delay.h"
 
 
void
void
fx2_stall_ep0 (void)
fx2_stall_ep0 (void)
{
{
  EP0CS |= bmEPSTALL;
  EP0CS |= bmEPSTALL;
}
}
 
 
void
void
fx2_reset_data_toggle (unsigned char ep)
fx2_reset_data_toggle (unsigned char ep)
{
{
  TOGCTL = ((ep & 0x80) >> 3 | (ep & 0x0f));
  TOGCTL = ((ep & 0x80) >> 3 | (ep & 0x0f));
  TOGCTL |= bmRESETTOGGLE;
  TOGCTL |= bmRESETTOGGLE;
}
}
 
 
void
void
fx2_renumerate (void)
fx2_renumerate (void)
{
{
  USBCS |= bmDISCON | bmRENUM;
  USBCS |= bmDISCON | bmRENUM;
 
 
  // mdelay (1500);             // FIXME why 1.5 seconds?
  // mdelay (1500);             // FIXME why 1.5 seconds?
  mdelay (250);                 // FIXME why 1.5 seconds?
  mdelay (250);                 // FIXME why 1.5 seconds?
 
 
  USBIRQ = 0xff;                // clear any pending USB irqs...
  USBIRQ = 0xff;                // clear any pending USB irqs...
  EPIRQ =  0xff;                //   they're from before the renumeration
  EPIRQ =  0xff;                //   they're from before the renumeration
 
 
  EXIF &= ~bmEXIF_USBINT;
  EXIF &= ~bmEXIF_USBINT;
 
 
  USBCS &= ~bmDISCON;           // reconnect USB
  USBCS &= ~bmDISCON;           // reconnect USB
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.