亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? d13driver.c

?? zlg開發套件ucos系統下讀寫e2prom源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
		}
		else if(i_st &D13REG_INTSRC_SUSPEND){ 
		    usb_suspend();							//ISP1181B掛起中斷處理				deal with the suspend interrupt of
		    bEPPflags.bits.suspend = 1;				//									ISP1181B					
		}
		else if(i_st & D13REG_INTSRC_EOT)
			dma_eot();								//DMA傳輸結束處理					deal with the end of DMA transfer
		else if(i_st & D13REG_INTSRC_RESUME){
			D13_LockDevice(0xAA37);					//解鎖設備,重新使能其它寄存器		unlock the device,enable all register 
			//添加恢復系統所有元件正常功能代碼
		}										  	
		else {
			if(i_st & D13REG_INTSRC_EP0IN)	
				ep0_txdone();						 //控制端點發送數據處理				deal with the transmit of control endpoint IN	
			if(i_st & D13REG_INTSRC_EP0OUT)     
				ep0_rxdone();						 //控制端點接收數據處理				deal with the receive of control endpoint OUT
			if(i_st & D13REG_INTSRC_EP01)
				USB_WriteISR(&UsbSend_EP01,EPINDEX4EP01,16,1);		//端點 1 發送數據處理	deal with the transmit of endpoint 1
			if(i_st & D13REG_INTSRC_EP02)			
				USB_ReadISR(&UsbRec_EP02,EPINDEX4EP02,16,1);		//端點 2 接收數據處理	deal with the receive of endpoint 2	
			if(i_st & D13REG_INTSRC_EP03)
				USB_WriteISR(&UsbSend_EP03,EPINDEX4EP03,64,2);		//端點 3 發送數據處理	deal with the transmit of endpoint 3
			if(i_st & D13REG_INTSRC_EP04)			
				USB_ReadISR(&UsbRec_EP04,EPINDEX4EP04,64,2);		//端點 4 接收數據處理	deal with the receive of endpoint 4	
			if(i_st & D13REG_INTSRC_EP05)
				USB_WriteISR(&UsbSend_EP05,EPINDEX4EP05,64,2);		//端點 5 發送數據處理	deal with the transmit of endpoint 5
			if(i_st & D13REG_INTSRC_EP06)			
				USB_ReadISR(&UsbRec_EP06,EPINDEX4EP06,64,2);		//端點 6 接收數據處理	deal with the receive of endpoint 6			
		}
	}
	//add for ARM
	CLR_INTD13();									//清除 ISP1181B 的中斷標志			clear the interrupt flag of ISP1181B
	CLR_INT();										//通知中斷結束						info ARM the end of the interrupt
   	
   	OS_EXIT_CRITICAL();							    //退出中斷服務程序時開中斷			enable all interrupt when interrupt rountine exit

}							

/***********************************************************************************************************************
** 函數名稱: void TaskSetup(void *pdata)			Name:	    void TaskSetup(void *pdata)
** 功能描述: 控制傳輸處理							Function:   deal with control transfer
** 輸	 入: void *pdata  任務參數					Input:		void *pdata:   parameter of the task
** 輸	 出: 無										Output:	    NULL
** 注	 意: 該任務的優先級應高于其它任務,才能在	Note:		the prior of the task must be higher than other,so 
			 任何情況下傳輸SETUP包								it will be sucessful when tranfering SETUP packet										 
************************************************************************************************************************/
void  TaskSetup(void *pdata)
{
#if OS_CRITICAL_METHOD == 3       /* Allocate storage for CPU status register */
	OS_CPU_SR  cpu_sr;
#endif
	INT8U err;
	
	pdata = pdata;                /* Prevent compiler warning */
	for (;;)
	{
		OSSemPend(pSetup_Event,0,&err);		//等待Setup包		 wait for SETUP packet
		if (err == OS_NO_ERR){				//接收到Setup包 	 have received SETUP packet
			OS_ENTER_CRITICAL();			//關中斷			 disable all interrupt
			control_handler();				//進行控制傳輸處理	 deal with control transfer
			OS_EXIT_CRITICAL();			    //開中斷			 enable all interrupt
		}
	}
}
	
/************************************************************************************************************************
** 函數名稱:  USB_ReadISR()										Name:		USB_ReadISR()
** 功能描述:  USB 端點接收中斷服務程序							Function:	the reception interrupt service of USB endpoint 
** 輸   入:  CTRL_USB *pUsb:  USB接收與發送控制結構體指針		Input:		CTRL_USB *pUsb: the CTRL_USB structure
			  INT8U		endp:  端點索引號									INT8U	  endp: the index of endpoint
			  INT32U eppsize:  端點最大信息包大小							INT32U eppsize: max size of the endpoint
			  INT8U buffnums:  該端點緩沖區個數								INT8U buffnums: numbers of endpoint buffer
** 輸   出:  無												Output:		NULL
*************************************************************************************************************************/
void USB_ReadISR(CTRL_USB *pUsb,INT8U endp,INT32U eppsize,INT8U buffnums)
{
	INT8U *pBuff,endpstatus,i;
	INT32U len;
	
	D13_GetEndpointStatusWInteruptClear(endp);		   //清空該端點的中斷標志     clear the flag of the endpoint interrupt register
	
	if (pUsb->Grp != 0){						   	   //有任務在等待接收         exist task waiting for reception
		if (pUsb->Sem == 0){					   	   //沒有任務占用該端點       no task use the endpoint
			pUsb->Prio = USB_GetHighPrio(pUsb);        //取等待任務列表中優先級最高的任務的優先級 get the highest prior of wating table
			pUsb->Cnt  = 0;				   			   //接收計數清0              counter clear to zero
			pUsb->Sem  = 1; 				   		   //標志有任務獨占了該端點   flag that task use the endpoint
		}
		pBuff = pUsb->pBuff[pUsb->Prio];		  	   //取得接收指針 			  get the pointer of reception
		
		for (i = 0; i < buffnums; i++){											
			len = pUsb->Max[pUsb->Prio] - pUsb->Cnt;   //計算未接收字節數         calculate the numbers of bytes that will be received
			if (len > 0){
				if (len >= eppsize)											
					len = (INT8U)D13_ReadEndpoint(endp,(INT8U)eppsize,pBuff + pUsb->Cnt);//接收整個緩沖區 receive a endpoint buffer
				else
					len = (INT8U)D13_ReadEndpoint(endp,(INT8U)len,pBuff + pUsb->Cnt); 	 //接收len個字節  receive len bytes
				pUsb->Cnt = pUsb->Cnt + len;		    //計數器計數 counter counting 
			}		

			if (pUsb->Cnt >= pUsb->Max[pUsb->Prio]){	//如果接收完畢 				      if the reception is finished
 				pUsb->Max[pUsb->Prio] = 0;				//接收完成標志置0,表示正確接收    set zero indicate reception is correct
	   	  		pUsb->Sem  = 0;							//釋放該端點接收資源		      release of the resourece of endpoint reception
	   	  		USB_DelPrio(pUsb,pUsb->Prio);			//將該任務從等待隊列中刪除	      delete the task from waiting table
	  			OSTimeDlyResume(pUsb->Prio);		    //使該接收任務就緒			      resume the reception task
	  			break;
	  	 	}
			
			endpstatus = D13_GetEndpointStatusWOInteruptClear(endp); //讀該端點狀態寄存器 			  read endpoint status register
			if ((endpstatus & 0x60) == 0)  
				break;												 //如果緩沖為空,立即跳出循環	  if buffer is null,break
			else if(i == 0)
				D13_GetEndpointStatusWInteruptClear(endp); 			
		}//end of for()
	}//end of if (pUsb->Grp != 0)
	else{
	    for (i = 0; i < buffnums; i++){								 //沒有任務接收數據,清空該端點接收緩沖區
			D13_ClearBuffer(endp);									 //清空接收緩沖區
			endpstatus = D13_GetEndpointStatusWOInteruptClear(endp); //讀該端點狀態寄存器 			  read endpoint status register
			if ((endpstatus & 0x60) == 0)  
				break;												 //如果緩沖為空,無須清空		  if buffer is null,break
			else if(i == 0)
				D13_GetEndpointStatusWInteruptClear(endp);
		}//end of for()
	}
}										//no task is ready to receive data,clear the endpoint buffer


/************************************************************************************************************************
** 函數名稱:  USB_WriteISR()									Name:		USB_WriteISR()
** 功能描述:  USB 端點發送中斷服務程序							Function:	the transmittion interrupt service of USB endpoint
** 輸   入:  CTRL_USB *pUsb:  USB接收與發送控制結構體指針		Input:		CTRL_USB *pUsb: the CTRL_USB structure
			  INT8U		endp:  端點索引號									INT8U	  endp: the index of endpoint
			  INT32U eppsize:  端點最大信息包大小							INT32U eppsize: max size of the endpoint
			  INT8U buffnums:  該端點緩沖區個數								INT8U buffnums: numbers of endpoint buffer
** 輸   出:  無												Output:		NULL
*************************************************************************************************************************/
void USB_WriteISR(CTRL_USB *pUsb,INT8U endp,INT32U eppsize,INT8U buffnums)
{
	INT32U len;
	INT8U *pBuff,i,endpstatus,status;
	
	endpstatus = D13_GetEndpointStatusWInteruptClear(endp);	//清空對應端點的中斷標志位
	if (pUsb->Grp != 0){
		if (pUsb->Cnt >= pUsb->Max[pUsb->Prio]){													//獨占任務全部數據寫入緩沖區  the task of transmittion have write all data into the buffer
			endpstatus = D13_GetEndpointStatusWOInteruptClear(endp) & 0x60;
			if (endpstatus == 0){							//緩沖區中的數據全部發送完畢  all the data in buffer is all send
				pUsb->Sem  = 0;								//釋放該端點的發送資源		  release the transmittion resource of the endpoint
				pUsb->Max[pUsb->Prio] = 0;					//置正確發送標志為0			  flag trasmittion is correct
				USB_DelPrio(pUsb,pUsb->Prio);				//將該任務從等待隊列中刪除	  delete the task from waiting table
				OSTimeDlyResume(pUsb->Prio);	    		//使該任務就緒				  resume the task
			}
		}
	}
	else
  		return;
  	
  	if (pUsb->Grp != 0){									//有任務在等待發送數據		  exist task waiting for transmitting data
    	if (pUsb->Sem == 0){								//該發送端點可以使用		  no task use the endpoint
			pUsb->Prio = USB_GetHighPrio(pUsb);
			pUsb->Cnt  = 0;									//發送計數清0				  clear the counter to zero
			pUsb->Sem  = 1; 								//使該任務獨占該發送資源	  flag that task use the endpoint
		}
		pBuff = pUsb->pBuff[pUsb->Prio];					//得到發送緩沖區指針		  get the pointer of send buffer

		for (i = 0; i < buffnums; i++){
			status = (D13_GetEndpointStatusWOInteruptClear(endp) & 0x60);
			if (status == 0x60)  break;						//如果緩沖區全部都滿,那么不可以再寫入//if buffer is full,break
															
			len = pUsb->Max[pUsb->Prio] - pUsb->Cnt;
			if (len > 0){		   							//有空的緩沖區且等待發送字節數大于0  buffer is empty and len above zero
				if (len >= eppsize)			   				//寫滿緩沖區				  write an entire buffer
					len = D13_WriteEndpoint(endp,(INT8U)eppsize,pBuff + pUsb->Cnt); 
				else						   				//寫len個字節				  write len length bytes into buffer
					len = D13_WriteEndpoint(endp,(INT8U)len,pBuff + pUsb->Cnt);  
				pUsb->Cnt = pUsb->Cnt + len;      			//發送計數器更新計數     	  counter is counting 
			}//end of if (len > 0)
		}//end of for()	
	}//end of if (pUsb->Grp != 0)	
}

/*************************************************************************************************************************
** 函數名稱: USB_ReadPort()									  Name:		  USB_ReadPort()
** 功能描述: 讀端點											  Function:	  read data from endpoint
** 輸   入: INT8U	   endp:  端點索引號 	  				  Input:	  INT8U	    endp: the index of endpoint
  		     INT8U buffnums:  該端點的緩沖區個數						  INT8U buffnums: numbers of endpoint buffer
  		     CTRL_USB *pUsb:  USB接收與發送控制結構體指針				  CTRL_USB *pUsb: the CTRL_USB structure
			 INT32U     len:  接收字節個數								  INT32U     len: the numbers(Bytes) that will be received
			 INT8U *recbuff:  接收緩沖區								  INT8U *recbuff: the reception buffer
			 INT16U	timeout:  等待超時時間								  INT16U timeout: waiting timeout
** 輸	 出: 0:	讀成功       > 0 讀失敗(錯誤碼)				  Output:	  0:  sucessfully	 >0: fail (it is error code)
**************************************************************************************************************************/
INT8U USB_ReadPort(INT8U endp,INT8U buffnums,CTRL_USB *pUsb,INT32U len,INT8U *recbuff,INT16U timeout)
{
	INT8U err;
	
	err = USB_RW_Param(pUsb,len,recbuff);			//填寫USB接收或發送控制塊參數	filled CTRL_USB struct with parameter
	if (err != USB_NO_ERR)   return err;	
	
	OS_ENTER_CRITICAL();
	if (pUsb->Max[OSPrioCur] != 0){					//如果還沒接收完成				if reception is not finished
		OS_EXIT_CRITICAL();
		OSTimeDly(timeout);							//定義超時等待					define timeout
	}	
	OS_EXIT_CRITICAL();
	
	return (USB_RW_Result(endp,buffnums,pUsb,1,timeout));	//返回接收結果			return the result of reception
}

/*************************************************************************************************************************
** 函數名稱: USB_WritePort()								   Name:	  USB_WritePort()
** 功能描述: 寫端點											   Function:  write data to endpoint
** 輸	 入: INT8U endp		  : 端點索引號					   Input:	  INT8U	    endp: the index of endpoint
			 INT32U eppsize   : 該端點的的信息包大小					  INT32U eppsize: max size of the endpoint
			 INT8U buffnums   : 該端點發送緩沖區個數					  INT8U buffnums: numbers of endpoint buffer
			 CTRL_USB *pUsb   : 該端點的接收或發送控制塊指針			  CTRL_USB *pUsb: the CTRL_USB structure
			 INT8U  *sendbuff : 發送數據字節指針						  INT8U *recbuff: the transmittion buffer
			 INT32U   len	  : 發送數據字節長度						  INT32U     len: the numbers(Bytes) that will be transmitted
			 INT16U	timeout	  : 等待超時時間							  INT16U timeout: waiting timeout
** 輸	 出: 0   發送成功    > 0 發送失敗(錯誤碼)			   Output:	  0:  sucessfully	 >0: fail (it is error code)
**************************************************************************************************************************/
INT8U USB_WritePort(INT8U endp,INT32U eppsize,INT8U buffnums,CTRL_USB *pUsb,
					INT8U *sendbuff,INT32U len,INT16U timeout)
{
	INT8U err,i;
	INT32U length;

	err = USB_RW_Param(pUsb,len,sendbuff);				//填寫USB接收或發送控制塊參數	filled CTRL_USB struct with parameter

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品夜夜嗨av一区二区三区| 无码av中文一区二区三区桃花岛| 欧美国产禁国产网站cc| 亚洲视频每日更新| 奇米精品一区二区三区在线观看 | 欧美一级在线视频| 国产精品丝袜一区| 久久亚洲春色中文字幕久久久| 一区二区三区四区中文字幕| 国产资源精品在线观看| 欧美日本韩国一区二区三区视频 | 麻豆高清免费国产一区| 91精品福利在线| 国产精品私人影院| 国内精品视频666| 7878成人国产在线观看| 亚洲欧美日韩国产一区二区三区 | 国产欧美一区二区精品性| 日韩福利电影在线观看| 在线看国产一区二区| 亚洲欧美在线另类| 懂色av一区二区三区免费观看| 日韩视频一区二区三区| 亚洲国产va精品久久久不卡综合| aaa亚洲精品一二三区| 久久精品视频一区二区三区| 久久超碰97中文字幕| 日韩欧美国产麻豆| 免费欧美在线视频| 欧美一区二区播放| 日韩国产成人精品| 日韩欧美中文一区| 欧美自拍偷拍一区| 亚洲一区二区三区国产| 色呦呦网站一区| 一区二区三区中文字幕| 在线视频中文字幕一区二区| 悠悠色在线精品| 欧美亚洲综合一区| 亚洲成国产人片在线观看| 欧美性生活一区| 日韩电影免费在线| 精品国产免费人成在线观看| 精品亚洲免费视频| 国产欧美精品区一区二区三区| 国产99久久久国产精品潘金网站| 国产亚洲精品7777| 99久久国产综合精品色伊| 樱桃国产成人精品视频| 欧美精选午夜久久久乱码6080| 日韩精品一二区| 久久综合九色综合欧美亚洲| 国产很黄免费观看久久| 国产精品国产精品国产专区不片| 色婷婷综合久久久中文字幕| 无码av免费一区二区三区试看 | 欧美三级电影网站| 日本美女一区二区三区视频| 国产亚洲欧美日韩日本| 一区二区三区高清不卡| 91麻豆精品视频| 亚洲电影在线免费观看| 天堂一区二区在线免费观看| 日韩亚洲欧美在线| 99久久综合国产精品| 午夜精品福利视频网站| 久久精品视频免费观看| 欧美日韩在线免费视频| 国产一区二区在线观看视频| 亚洲欧美韩国综合色| 欧美一区二区三区免费观看视频| 国产伦精品一区二区三区免费| 亚洲精品视频在线看| 88在线观看91蜜桃国自产| 成人网在线免费视频| 日本不卡一二三区黄网| ...xxx性欧美| 日韩一卡二卡三卡国产欧美| 成年人午夜久久久| 国产中文字幕一区| 亚洲国产精品久久久久婷婷884 | 九九热在线视频观看这里只有精品| 国产日韩欧美精品一区| 在线不卡免费av| 国产福利精品一区| 亚洲3atv精品一区二区三区| 精品免费视频一区二区| 日本韩国精品一区二区在线观看| 日韩电影网1区2区| 亚洲一二三四在线| 国产精品福利av| 欧美r级电影在线观看| 欧美日韩一区二区在线视频| 欧美精品久久久久久久多人混战| 91丨九色丨蝌蚪丨老版| 国产精品一级片| 玖玖九九国产精品| 偷窥少妇高潮呻吟av久久免费| 亚洲日韩欧美一区二区在线| 久久久精品中文字幕麻豆发布| 91精品国产乱| 欧美精选一区二区| 欧美无人高清视频在线观看| 欧美综合视频在线观看| 在线观看一区二区视频| 91美女片黄在线观看| 成人a区在线观看| 处破女av一区二区| 懂色av噜噜一区二区三区av| 国产精品12区| 国产经典欧美精品| 国产白丝网站精品污在线入口| 国产精品影视在线观看| 国产精品自拍av| 国产乱子轮精品视频| 国产成人综合自拍| 成人动漫一区二区三区| www.亚洲激情.com| 91丝袜呻吟高潮美腿白嫩在线观看| 成人黄色片在线观看| 91视频观看视频| 欧美性大战久久久久久久| 欧美日韩国产在线观看| 日韩一区二区视频| www久久久久| 国产精品三级电影| 自拍偷拍国产精品| 亚洲一二三四在线| 奇米综合一区二区三区精品视频| 三级久久三级久久| 久久99精品国产.久久久久久| 国内精品视频666| 99精品热视频| 欧美日韩亚洲高清一区二区| 91精品国产综合久久国产大片| 91精品国产黑色紧身裤美女| www国产精品av| 亚洲日本va在线观看| 亚洲第一激情av| 国精产品一区一区三区mba视频| 国产成a人亚洲精品| 欧洲一区在线电影| 久久综合久久综合久久综合| 中文字幕在线视频一区| 亚洲成a人v欧美综合天堂下载 | 久久久久高清精品| 亚洲欧美激情一区二区| 蜜桃一区二区三区在线| 国产毛片精品视频| 欧美性猛交xxxx乱大交退制版| 日韩女优av电影在线观看| 中文字幕一区二区三区在线不卡| 一区二区久久久| 国产一区二区三区蝌蚪| 91麻豆高清视频| 精品国产免费一区二区三区四区| 亚洲天堂网中文字| 久久99久久久久| 91官网在线观看| 国产欧美日韩另类一区| 亚洲va在线va天堂| 成人性视频免费网站| 欧美日韩1234| 亚洲欧洲日韩一区二区三区| 日韩国产一区二| 91视频观看免费| 欧美国产视频在线| 久久电影网站中文字幕| 色婷婷av久久久久久久| 欧美国产精品久久| 久久精品噜噜噜成人av农村| 欧美在线影院一区二区| 国产精品二三区| 国产自产v一区二区三区c| 777a∨成人精品桃花网| 亚洲欧美电影一区二区| 成人性视频免费网站| 欧美xxxxx裸体时装秀| 亚洲国产一区二区a毛片| 成人爱爱电影网址| 日本一区二区三区国色天香| 看国产成人h片视频| 欧美精品xxxxbbbb| 亚洲综合区在线| 91免费视频网址| 国产精品初高中害羞小美女文| 国产一区二区在线视频| 26uuu亚洲综合色| 国产专区综合网| 2017欧美狠狠色| 国产综合色产在线精品| 精品国产91久久久久久久妲己| 免费美女久久99| 精品国产免费人成电影在线观看四季 | 99久久精品国产一区| 欧美激情一二三区| 成人av动漫网站| 一区二区在线观看视频 | 精品剧情在线观看| 加勒比av一区二区|