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

📄 usbjtag.c

📁 altera的usb下载线的制作资料
💻 C
📖 第 1 页 / 共 2 页
字号:
            ClockBytes -= m;            i += m;                     if(WriteOnly) /* Shift out 8 bits from d */            {               while(m--) ShiftOut(XAUTODAT1);            }            else /* Shift in 8 bits at the other end  */            {               while(m--) OutputByte(ShiftInOut(XAUTODAT1));            }        }        else        {            BYTE d = XAUTODAT1;            WriteOnly = (d & bmBIT6) ? FALSE : TRUE;            /* Please do NOT change the interpretation of the               bits in the data sent over USB here, as that would               render your adapter implementation  incompatible with               all other implementations based on this code! Modify only               the TCK,TMS,TDI,TDO definitions at the very top of this               source file to match your circuit. */             if(d & bmBIT7)            {               /* Prepare byte transfer, do nothing else yet */               ClockBytes = d & 0x3F;            }            else            {               /* Set state of output pins */               TCK = (d & bmBIT0) ? 1 : 0;               TMS = (d & bmBIT1) ? 1 : 0;               TDI = (d & bmBIT4) ? 1 : 0;               /* Optionally read state of input pins and put it in output buffer */               if(!WriteOnly) OutputByte(2|TDO);            };            i++;         };      };      SYNCDELAY;      EP2BCL = 0x80; // Re-arm endpoint 2   };}BOOL TD_Suspend(void)          // Called before the device goes into suspend mode{   return(TRUE);}BOOL TD_Resume(void)          // Called after the device resumes{   return(TRUE);}//-----------------------------------------------------------------------------// Device Request hooks//   The following hooks are called by the end point 0 device request parser.//-----------------------------------------------------------------------------BOOL DR_GetDescriptor(void){   return(TRUE);}BOOL DR_SetConfiguration(void)   // Called when a Set Configuration command is received{   Configuration = SETUPDAT[2];   return(TRUE);            // Handled by user code}BOOL DR_GetConfiguration(void)   // Called when a Get Configuration command is received{   EP0BUF[0] = Configuration;   EP0BCH = 0;   EP0BCL = 1;   return(TRUE);            // Handled by user code}BOOL DR_SetInterface(void)       // Called when a Set Interface command is received{   AlternateSetting = SETUPDAT[2];   return(TRUE);            // Handled by user code}BOOL DR_GetInterface(void)       // Called when a Set Interface command is received{   EP0BUF[0] = AlternateSetting;   EP0BCH = 0;   EP0BCL = 1;   return(TRUE);            // Handled by user code}BOOL DR_GetStatus(void){   if(SETUPDAT[0]==0x40)   {      Running = 1;      return FALSE;   };   return(TRUE);}BOOL DR_ClearFeature(void){   return(TRUE);}BOOL DR_SetFeature(void){   return(TRUE);}BOOL DR_VendorCmnd(void){   if(SETUPDAT[1] == 0x90) // READ EEPROM   {      BYTE addr = (SETUPDAT[4]<<1) & 0x7F;      EP0BUF[0] = PROM[addr];      EP0BUF[1] = PROM[addr+1];   }   else   {      EP0BUF[0] = 0x36;      EP0BUF[1] = 0x83;   }   EP0BCH = 0;   EP0BCL = 2; // Arm endpoint with # bytes to transfer   EP0CS |= bmHSNAK; // Acknowledge handshake phase of device request   return(FALSE); // no error; command handled OK}//-----------------------------------------------------------------------------// USB Interrupt Handlers//   The following functions are called by the USB interrupt jump table.//-----------------------------------------------------------------------------// Setup Data Available Interrupt Handlervoid ISR_Sudav(void) interrupt 0{   GotSUD = TRUE;            // Set flag   EZUSB_IRQ_CLEAR();   USBIRQ = bmSUDAV;         // Clear SUDAV IRQ}// Setup Token Interrupt Handlervoid ISR_Sutok(void) interrupt 0{   EZUSB_IRQ_CLEAR();   USBIRQ = bmSUTOK;         // Clear SUTOK IRQ}void ISR_Sof(void) interrupt 0{   EZUSB_IRQ_CLEAR();   USBIRQ = bmSOF;            // Clear SOF IRQ}void ISR_Ures(void) interrupt 0{   if (EZUSB_HIGHSPEED())   {      pConfigDscr = pHighSpeedConfigDscr;      pOtherConfigDscr = pFullSpeedConfigDscr;   }   else   {      pConfigDscr = pFullSpeedConfigDscr;      pOtherConfigDscr = pHighSpeedConfigDscr;   }      EZUSB_IRQ_CLEAR();   USBIRQ = bmURES;         // Clear URES IRQ}void ISR_Susp(void) interrupt 0{   Sleep = TRUE;   EZUSB_IRQ_CLEAR();   USBIRQ = bmSUSP;}void ISR_Highspeed(void) interrupt 0{   if (EZUSB_HIGHSPEED())   {      pConfigDscr = pHighSpeedConfigDscr;      pOtherConfigDscr = pFullSpeedConfigDscr;   }   else   {      pConfigDscr = pFullSpeedConfigDscr;      pOtherConfigDscr = pHighSpeedConfigDscr;   }   EZUSB_IRQ_CLEAR();   USBIRQ = bmHSGRANT;}void ISR_Ep0ack(void) interrupt 0{}void ISR_Stub(void) interrupt 0{}void ISR_Ep0in(void) interrupt 0{}void ISR_Ep0out(void) interrupt 0{}void ISR_Ep1in(void) interrupt 0{}void ISR_Ep1out(void) interrupt 0{}void ISR_Ep2inout(void) interrupt 0{}void ISR_Ep4inout(void) interrupt 0{}void ISR_Ep6inout(void) interrupt 0{}void ISR_Ep8inout(void) interrupt 0{}void ISR_Ibn(void) interrupt 0{}void ISR_Ep0pingnak(void) interrupt 0{}void ISR_Ep1pingnak(void) interrupt 0{}void ISR_Ep2pingnak(void) interrupt 0{}void ISR_Ep4pingnak(void) interrupt 0{}void ISR_Ep6pingnak(void) interrupt 0{}void ISR_Ep8pingnak(void) interrupt 0{}void ISR_Errorlimit(void) interrupt 0{}void ISR_Ep2piderror(void) interrupt 0{}void ISR_Ep4piderror(void) interrupt 0{}void ISR_Ep6piderror(void) interrupt 0{}void ISR_Ep8piderror(void) interrupt 0{}void ISR_Ep2pflag(void) interrupt 0{}void ISR_Ep4pflag(void) interrupt 0{}void ISR_Ep6pflag(void) interrupt 0{}void ISR_Ep8pflag(void) interrupt 0{}void ISR_Ep2eflag(void) interrupt 0{}void ISR_Ep4eflag(void) interrupt 0{}void ISR_Ep6eflag(void) interrupt 0{}void ISR_Ep8eflag(void) interrupt 0{}void ISR_Ep2fflag(void) interrupt 0{}void ISR_Ep4fflag(void) interrupt 0{}void ISR_Ep6fflag(void) interrupt 0{}void ISR_Ep8fflag(void) interrupt 0{}void ISR_GpifComplete(void) interrupt 0{}void ISR_GpifWaveform(void) interrupt 0{}

⌨️ 快捷键说明

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