⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 discon.c

📁 fx2 slavefifo方式
💻 C
字号:
#include <EZUSB.H>
#include <EZRegs.h>
#include <Fx.h>

void EZUSB_Discon(BOOL renum)
{

   USBCS |=bmDISCON;       // added for FX first silicon keeper problem
   WRITEDELAY();           // allow for register write recovery time
   USBCS &=~bmDISCOE;      // Tristate the disconnect pin
   WRITEDELAY();           // allow for register write recovery time
   USBCS |=bmDISCON;       // Set this high to disconnect USB
   if(renum)               // If renumerate
      USBCS |=bmRENUM;     // then set renumerate bit
		
   EZUSB_Delay(1500);      // Wait 1500 ms  (SHK -- If you don't wait this long, some hubs and hosts will not see the disconnect.)

   if (CPUCS & CPUCS_48MHZ)
      EZUSB_Delay(1500);   // Wait 1500 ms  (SHK -- If you don't wait this long, some hubs and hosts will not see the disconnect.)

   USBIRQ = 0xff;          // Clear any pending USB interrupt requests.  They're for our old life.
   IN07IRQ = 0xff;         // clear old activity
   OUT07IRQ = 0xff;
   EZUSB_IRQ_CLEAR();

   USBCS &=~bmDISCON;      // reconnect USB
   WRITEDELAY();           // allow for register write recovery time
   USBCS |=bmDISCOE;       // Release Tristated disconnect pin
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -