和一楼一样,用代码框显示是:irqValue = *USB_COMMAND; //xiejin 地址是0x4004
switch(irqValue)//xiejin 判断中断类曛荆餮分凶飨嘤Φ拇?
{
case SX2_INT_SETUP:
/* endpoint 0 setup */
/* next eight interrupts are setup data */
/* parse the interrupt register value */
setupDat = TRUE;
setupCnt = 0;
/* send read register command to SX2 */
*USB_COMMAND = 0xC0 | SX2_SETUP;
break;
case SX2_INT_EP0BUF:
/* endpoint 0 ready */
sx2EP0Buf = TRUE;
break;
case SX2_INT_FLAGS:
/* FIFO flags -FF,PF,EF */
FLAGS_READ = TRUE;
if(CyUsbSendReady ==1)
CY_DataDeal();
break;
case SX2_INT_ENUMOK:
/* enumeration successful */
sx2EnumOK = TRUE;
break;
case SX2_INT_BUSACTIVITY:
/* detected either an absence or resumption of activity on the USB bus. */
/* Indicates that the host is either suspending or resuming or that a */
/* self-powered device has been plugged into or unplugged from the USB. */
/* If the SX2 is bus-powered, the host processor should put the SX2 into */
/* a low-power mode after detecting a USB suspend condition. */
sx2BusActivity = TRUE;
LED = 0; //USB数据线拔出后熄灭LED
ReloadDesctbl = 1;
CY_DataDeal();
break;
case SX2_INT_READY:
/* awakened from low power mode via wakeup pin */
/* or completed power on self test */
sx2Ready = TRUE;
break;
default:
break;
}
|