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

📄 host20_ap.c

📁 GM8120 linux driver.
💻 C
📖 第 1 页 / 共 5 页
字号:
// * Input: none// * OutPut: none//====================================================================void OTGH_AP_Suspend_Resume_Test(void){   UINT8 bCounter=0;    do{        bCounter++;        //<1>.Suspend System        printf(">>> Step1:Suspend System\n");        flib_Host20_Suspend();                mwHost20_Misc_Physuspend_Set();//08242005;;For Austin Phy Suspend                //Delay 100 ms        flib_Host20_TimerEnable(100);         mwHost20_Misc_Physuspend_Clr();//08242005;;For Austin Phy Suspend                //<2>.Resume        printf(">>> Step2:Issue resume signal...\n");        flib_Host20_Resume();             //<Step5>.Get Device Descriptor 10 times        printf(">>> Step5:Get Device Descriptors 10 times\n");                                OTGH_PT_GetDescriptor (10);              //<Step6>.Finish...         printf(">>> Suspend/Resume Test Finish...%d\n",bCounter);                                          }while(bCounter<100);}//====================================================================// * Function Name: OTGH_AP_RemoteWakeUp_Test                          // * Description: // * Input: none// * OutPut: none//====================================================================void OTGH_AP_RemoteWakeUp_Test(void){   UINT8 bItem;   UINT8 bCounter=0;    do{        bCounter++;        //<1>.Enable Remote Wakeup         printf(">>> Step1:Enable Remote Wakeup \n");        flib_OTGH_RemoteWakeEnable();              //<2>.Suspend System        printf(">>> Step2:Suspend System\n");        flib_Host20_Suspend();                                mwHost20_Misc_Physuspend_Set();//08242005;;For Austin Phy Suspend                        //<Step3>.Waiting for Remote WakeUp Signal & Issue resume signal...        printf(">>> Step3:Waiting for Remote WakeUp Signal & Issue resume signal...\n");//        bExitFlag=0;        sAttachDevice.bRemoteWakeUpDetected=0;              while(sAttachDevice.bRemoteWakeUpDetected==0);                     mwHost20_Misc_Physuspend_Clr();//08242005;;For Austin Phy Suspend              //<Step4>.Call flib_Host20_RemoteWakeUp_Processing 	        flib_Host20_RemoteWakeUp_Processing();        printf(">>> Step4:<1>.Detected Remote WakeUp Signal...\n");                                printf(">>>       <2>.Issue Resume Finihs...\n");                                            //Bruce;;08032005 ==> Enable the Asynchronous        flib_Host20_Asynchronous_Setting(HOST20_Enable);              //<Step5>.Get Device Descriptor 10 times        printf(">>> Step5:Get Device Descriptors 10 times\n");                                OTGH_PT_GetDescriptor (10);              //<Step6>.Finish...         printf(">>> Remote Wake Up Test PASS...%d\n",bCounter);                  if (bCounter<10)           { printf("*** press Enter'1' to retest...");              scanf("%d",(char *)&bItem);                      printf("\n");              }                                                }while((bCounter<10)&(bItem==1));      }//====================================================================// * Function Name: OTGH_AP_Plug_in_Test                          // * Description: bMode=0 =>Cold Plug (Remove USB Device)//                bMode=1 =>Hot Plug  (Without Remove USB Device)// * Input: none// * OutPut: none//====================================================================void OTGH_AP_Plug_in_Test(UINT8 bMode){   UINT32 wCounter=0;   do {      wCounter++;             printf("@@@ Waiting for Device Disconnect...\n");                                while(mwHost20_PORTSC_ConnectStatus_Rd()>0);                                         printf("@@@ Device already disconnect...\n");                                       if (bMode==0)          {         //For Cold Plug         OTGC_A_Bus_Drop();         printf("@@@ Drop VBUS ok...\n");              OTGC_A_Bus_Drive();      }      else 		 flib_Host20_Close(0);              //<2>.Waiting for Connect         printf("@@@ Enter DRD Host Mode...(Counter=%d)\n",(int)(wCounter));      printf("@@@ Waiting for Device Connect...\n");                                while(mwHost20_PORTSC_ConnectStatus_Rd()==0);           if (flib_OTGH_Init(10000,1,0)==1)   //john 0,0)==1)      {         if (flib_Host20_Enumerate(0,wCounter)==0)                        printf("??? Enumerate Fail...\n");      }	  else {		 printf("??? Host Init Fail...\n");      }   }while(wCounter<10);   if (bMode==1)      printf(">>> Hot Plug 10 times test finish...\n");   else 	  printf(">>> Cold Plug 10 times test finish...\n");}               		//====================================================================// * Function Name: OTGH_PT_CV_Like                          // * Description: //   <1>.Step1:flib_Host20_Close//   <2>.Step2:flib_Host20_Enumerate(1,X)//   <3>.Step3:Goto step1//// * Input: none// * OutPut: none//====================================================================void OTGH_PT_CV_Like(void){   UINT32 wAddress;	   UINT8  bExit,bFailCounter;   wAddress=1;//   bResult=1;   bExit=0;   do {            //<1>.Step1:flib_Host20_Close      flib_Host20_Close(0);      //OTGC_A_Bus_Drop();      //printf("@@@ Drop VBUS ok...\n");                  // OTGC_A_Bus_Drive();      //<2>.Step2:flib_Host20_Enumerate(1,X)      printf("*********************** Address=%d ******************* \n",wAddress);                 flib_Host20_TimerEnable(100);  //john reduce delay time 500                                  flib_OTGH_Init(10000,1,0);   //john 0,0);                  bFailCounter=0;      while(flib_Host20_Enumerate(0,wAddress)==0)      {         bFailCounter++;	         if (bFailCounter<4)         {            flib_Host20_Close(0);            printf("*********************** Address=%d Retry******************* \n",wAddress);	            flib_Host20_TimerEnable(500);               flib_OTGH_Init(10000,1,0);   //john 0,0);         }         else {            printf("?????????????????????????? Enumerate Fail...\n");            bExit=1;            OTGH_Error_Handle();         }       	      }         wAddress++;      if (wAddress==128)         bExit=1;       }while( bExit==0);   //<1>.Step1:flib_Host20_Close   flib_Host20_Close(0);          flib_OTGH_Init(10000,1,0);   //john 0,0);   //<2>.Step2:flib_Host20_Enumerate(1,X)   flib_Host20_Enumerate(1,3);	}//====================================================================// * Function Name: OTGH_PT_FrameNumber                          // * Description: // * Input: none// * OutPut: none//====================================================================void OTGH_PT_FrameNumber(void){ UINT32 *pwData; UINT32  wCounter,wPreData; UINT8   bTestFlag;    pwData=malloc(1000*2);   wCounter=0;//   bTemp=0;   bTestFlag=1;      do{     *(pwData+wCounter)=mwHost20_FrameIndex14Bit_Rd()>>3;       flib_Host20_TimerEnable(1);      wCounter++;     }while(wCounter<(2*1000));   wCounter=0;   wPreData=*(pwData+wCounter);   printf("Counter=%d ===> FrameNumber=%d  \n",wCounter,*(pwData+wCounter));    do{        wCounter++;       printf("Counter=%d  ===> FrameNumber=%d  \n",wCounter,*(pwData+wCounter));             if (*(pwData+wCounter)>(wPreData+3))         {         printf("Waring............\n");          bTestFlag=0;         }      if (*(pwData+wCounter)==(wPreData))         {         printf("Waring............\n");          bTestFlag=0;         }      wPreData=*(pwData+wCounter);          }while(wCounter<(2*1000-1));  		free(pwData);		if (bTestFlag==0)	    printf(">>> Test Fail...\n");	else      printf(">>> Frame Counter Test PASS...\n");			}//************************************************************************************************************//************************************************************************************************************//                          *** Group-3:Main Function ***//*************************************************************************************************************//************************************************************************************************************//====================================================================// * Function Name: OTGH_PT_Init                          // * Description: This function will init the variables.//   <1>.Variable init - INT//   <2>.Variable init - ISO//   <3>.Variable init - Bulk// * Input: none// * OutPut: none//====================================================================void OTGH_PT_Init(void){	   //<1>.Variable init - Control         sOTGH_PT_Control.bDataCounter_IN=0;                sOTGH_PT_Control.bDataCounter_OUT=0;         	            //<2>.Variable init - INT         sOTGH_PT_INT.bDataCounterIn=0;           sOTGH_PT_INT.bDataCounterOut=0;                         sOTGH_PT_INT.bMaxSize=13;                 sOTGH_PT_INT.bINT_Dir=0;   //<3>.Variable init - ISO         sOTGH_PT_ISO.bDataMax=255;         sOTGH_PT_ISO.bDataCounter=0;   //<4>.Variable init - Bulk  }	//====================================================================// * Function Name: OTGH_AP_Faraday                          // * Description: Main menu of path test// * Input: none// * OutPut: none//====================================================================void OTGH_AP_Faraday(void){	UINT8 Item;   OTGH_PT_Init();  do{	         printf("************* Host Mode Faraday Path Test AP ******************\n");     if (OTGC_Read_Current_ID()==0)                          printf("     1.Control => Control Command Test            \n");  if (OTGC_Read_Current_ID()==0)   if (OTGH_PT_ADVANCE_TEST==1)     if (psDevice_AP->bSpeed!=HOST20_Attach_Device_Speed_Low)             printf("     2.Control => Control Path Test (Size:1~20K-200)           \n");           if (psDevice_AP->saCD[0].sInterface[0].sED[0].bED_bmAttributes==OTGH_ED_BULK)                 printf("     3.Bulk In/Out Test          \n");          else if (psDevice_AP->saCD[0].sInterface[0].sED[0].bED_bmAttributes==OTGH_ED_ISO)                     	        	     {//For ISO         		 if (((psDevice_AP->saCD[0].sInterface[0].sED[0].bED_EndpointAddress)&BIT7) > 0)                    printf("     3.ISO-In Test          \n");         		 else                      printf("     3.ISO-Out Test          \n");         	     }else  if (psDevice_AP->saCD[0].sInterface[0].sED[0].bED_bmAttributes==OTGH_ED_INT)                        printf("     3.Interrupt In/Out Test          \n");                              if (psDevice_AP->saCD[0].sInterface[0].sED[2].bED_bmAttributes==OTGH_ED_INT)                 printf("     4.Int  => OTGH_PT_Interrupt_In_Out   \n");              printf("     9.Quit                  \n");              printf("******************************************************************\n");              printf("*** Please Input the Item:");               scanf("%d",(char *)&Item);              printf("\n");                     switch(Item)                            	{                          if (OTGC_Read_Current_ID()==0)                {case 1 :                                   OTGH_PT_Control_Command();                    			break;                     }   if (OTGC_Read_Current_ID()==0)      if (OTGH_PT_ADVANCE_TEST==1)                {                 case 2 :                                    if (psDevice_AP->bSpeed!=HOST20_Attach_Device_Speed_Low)                            OTGH_PT_Control_Path();              			break;                 }                

⌨️ 快捷键说明

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