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

📄 srio.c

📁 RapidIO boot code CPU配置交换芯片代码
💻 C
📖 第 1 页 / 共 2 页
字号:

 
  /********************************************************************
  STEP 4: After booting etc, software may be written on the agent devices
  to access the memory location on the host. This function sets up the
  host to accept incoming rio trasactions in the same manner as the agent
  i.e. catch the bottom 16MBytes of the RIO memory map and re-direct to
  local memory 0x01000000-0x01FFFFFF.
  Also set up the host so that agents will be able to access it through the
  LCSBACSR in the same manner that the host accesses the agent
  NOTE: These steps are not required for this application as the agents do not
  atempt to read back to the host, however, put them in here for future use.
  *********************************************************************/
  local_setup_inbound_window ();
  local_srio->lcsbacsr = CCSR_ADDR_ON_RIO >> SHIFT_RIO_ADDR_TO_LCSBACSR;
  printf
    (" ---- Provided LCSBASCR and memory access back to local processor ---- \n\n");
 /*lyh 2007-2-2 17:19*/
 #endif  
/*end*/
  printf("Enabling inbound doorbells \n"); 
  enable_ib_dbs();  
  printf("Enabling inbound data messages \n"); 
 /*disable by lyh 2007-1-26 19:25 add ( UINT32) to clear the warning
  enable_ib_msgs(message_unit1,  ib_message_q1, MAX_IB_MSG, MESSAGES_IN_IBQ);
  enable_ib_msgs(message_unit2,  ib_message_q2, MAX_IB_MSG, MESSAGES_IN_IBQ);
   */
  enable_ib_msgs(message_unit1,  ib_message_q1, ( UINT32)MAX_IB_MSG, ( UINT32)MESSAGES_IN_IBQ);
  enable_ib_msgs(message_unit2,  ib_message_q2, ( UINT32)MAX_IB_MSG, ( UINT32)MESSAGES_IN_IBQ);
  printf("Enabling direct mode data messaging \n"); 
   /*disable by lyh 2007-1-26 19:25 to clear the warning
  enable_ob_msg_ch(message_unit1, ob_message_q1,MESSAGES_IN_OBQ ); 
  enable_ob_msg_ch(message_unit2, ob_message_q2,MESSAGES_IN_OBQ );
  */ 
   enable_ob_msg_ch(message_unit1, ob_message_q1,( UINT32)MESSAGES_IN_OBQ ); 
  enable_ob_msg_ch(message_unit2, ob_message_q2,( UINT32)MESSAGES_IN_OBQ );
	/*changed by Andy*/
	result = datamessagetest(message_unit1); 
	 if (result != SUCCESS) {
    printf ("data message send failure %d \n", result);
    return result;
  }
  else {
  	printf("Data message send successfully! \n", result); 
  }
/*
   printf("local pescsr = 0x%08x \n", local_srio->p0escsr);
  if(local_srio->p0escsr & 0x00010000) 
 	opportstops++;
  if(local_srio->p0escsr & 0x00000100) 
  	ipportstops++;
*/  	

  		      
  /*********************************************************************
  STEP 5: Present the user with a menu to select a number of options
  *********************************************************************/
  	print_menu ();
 /*add by lyh ,no use the shell*/
 #if 0 	
  	
  	while (1) {
    /*	input = getc();*/ /*disable by lyh 2007-1-26 17:36 getc ();*/

    /****************************************************************
    option to quit
    ****************************************************************/
    	if ((input == 'q') || (input == 'Q'))
      		break;

    /****************************************************************
    option to boot agent processors
    ****************************************************************/
    	else if ((input == 'b') || (input == 'B')) {
      		if (system_type == FABRIC_SYSTEM) 
      		{
        		printf ("B. Boot processor. Which processor number ?  ");
        		/*lyh ,2007-1-26 17:56*/
        	/*	input = getc ();*/
	    		device = input - 48;
	    		if((device > hostdeviceid) & (device < nextdevid))
		   			printf("%d \n", device);
	    		else
	    		{	 
        			printf ("%d is not a valid deviceid \n", device);
		    		device = 0;
	    		}
    		}
    		else
       			device = hostdeviceid+1;
        
   			if(device != 0)
   			{
       			result = rio_boot (device);
       			if (result == SUCCESS) 
	   			{
       			}
       			else
          			printf ("rio_boot returned error code 0x%08x \n", result);
  			}
  		} 	
      
    	else if ((system_type == FABRIC_SYSTEM) &
             ((input == 'd') || (input == 'D'))) 
		{
			printf("Running doorbell test.\n"); 
			printf("Sending doorbells to myself, polling to receive \n"); 
			doorbelltest(); 
		}
 
  		else if ((system_type == FABRIC_SYSTEM) &
       		((input == 'm') || (input == 'M'))) 
		{
			printf("Running data message test.\n"); 
			printf("Sending data messages to myself, polling to receive \n"); 
			datamessagetest(message_unit1); 
		}

      
    /****************************************************************
    option to print switch information
    ****************************************************************/
    	else if ((system_type == FABRIC_SYSTEM) &
             ((input == 's') || (input == 'S'))) 
        {
      		printf ("S. Print Switch info\n");
      		print_switch_info ();
    	}
    
    
    /****************************************************************
    option to read the rio information from the processors
    ***************************************************************/
    	else if ((input == 'r') || (input == 'R'))
    	{
      		printf("R. Read RIO information for which device number ? \n");
      		/*disable by lyh 2007-1-26 17:57
      		input = getc ();*/
      		device = input - 48;
      		if((device >= hostdeviceid ) & (device < nextdevid))
      		{
				printf("%d \n", device);
				print_rioport_info (device);
			} else {	 
        		printf ("%d is not a valid deviceid \n", device);
			}           
    	}

    /****************************************************************
    option to run tests
    ****************************************************************/
    	else if ((input == 't') || (input == 'T'))
    	{
      		printf ("T. Which demo do you want to run ? \n");
      		printf ("A = execute 100 32bit writes to agent, read back and compare \n");
      		printf ("B = DMA transfer 64kbytes block to agent, read back and compare  \n");
      	/*disable by lyh 2007-1-26 17:57
      		input = getc ();*/
        	if (system_type == FABRIC_SYSTEM) 
      		{
          		printf("On which device do you want to run demo %c  ? \n", input);
          	/*disable by lyh 2007-1-26 17:57
      		input = getc ();*/
	  			device = input2 - 48; 
      		}
      		else
      		{
      		device = hostdeviceid+1;
      		}
      		if ((device >= hostdeviceid) & (device < nextdevid))
      		{
      	   	if(device == hostdeviceid)
		   			printf("loopback test to self, through switch\n"); 

	   			if ((input == 'a') || (input == 'A'))
            		result = testa (device);

	    			else if ((input == 'b') || (input == 'B'))
    					result = testb(device, 4*1024, 16, 0);

      			else if ((input == 'c') || (input == 'C'))
    					result = testb(device, 8*1024, 16, 0);

	    			else if ((input == 'd') || (input == 'D'))
    					result = testb(device, 1024*1024, 16, 0);

	    			else if ((input == 'e') || (input == 'E'))
    					result = testb(device, 4*1024*1024, 16, 0);

	    			else if ((input == 'f') || (input == 'F'))
						result = testc(device, 1000, 0);

	   			else if ((input == 's') || (input == 'S'))
						result = testc(device, 1000, 1);

	   			else if ((input == 't') || (input == 'T'))
						result = testc(device, 100000, 1);

	   			else if ((input == 'u') || (input == 'U'))
    					result = testb(device, 8*1024, 16, 1);

	  			 	else if ((input == 'v') || (input == 'V'))
    					result = testb(device, 1024*1024, 16, 1);

	 		   	else if ((input == 'w') || (input == 'W'))
    					result = testb(device, 4*1024*1024, 16, 1);

	  			  	else if ((input == 'x') || (input == 'x'))
    					result = testb(device, 8*1024, 1024, 1);

	 		   	else if ((input == 'y') || (input == 'Y'))
    					result = testb(device, 1024*1024, 1024, 1);

	  			  	else if ((input == 'z') || (input == 'Z'))
    					result = testb(device, 4*1024*1024, 1024, 1);

	   			else
	    			printf("Not a valid test \n"); 
	    
      		}
      		else
      		{
	  			printf("Not a valid device ID \n"); 
      		}
         
    	}

    /****************************************************************
    Default option, print menu
    ****************************************************************/
    	else
      		print_menu ();

    /****************************************************************
    always re-print cursor after every command
    ****************************************************************/
    printf (">");
  }
  
#endif  
/* 
#endif */   /*DBUG_MPC8548_SRIO*/
/*add by lyh 2007-1-26 19:36 to clear the diab warning */


return 1;

} /*end of srio */

/********************************************************************
User interface function to print out all the available options
********************************************************************/
void
print_menu (void)
{
  int i;
  
  printf ("\n\nHost processor is deviceid %d \n", hostdeviceid);
  printf ("Discovered %d agent processors \n", nextdevid-1);
  if(nextdevid-1)
  {
  	printf("With deviceID = ");
	for(i=1;i<nextdevid;i++)
	{
		printf(" %d  ", i);
	}  
	printf("\n");
  } 
  printf ("Options : \n");
 /* printf ("b = boot another processor\n");*/
  printf ("h = print this list of options\n");
  printf ("q = quit this application \n");
  if (system_type == FABRIC_SYSTEM)
  {
    printf ("s = read back info from tsi568 \n");
    printf ("d = run doorbell test \n"); 
    printf ("m = run data message test \n"); 
  }
  printf ("r = SRIO setup and status \n");
  printf ("t = run one of the NREAD/NWRITE demos \n");
}

/********************************************************************
User interface function to print out information about the status of
the rapidio switch
********************************************************************/
void
print_switch_info (void)
{

  int i; 
  UINT32 numport;

  MAINT_READ (0xFF, 0x00, TSI568_SW_PORT, numport);
  numport = numport >> 8;
  printf("port       err_status     ctl  \n"); 
  for(i=0;i<numport;i++)
  {
	print_perport_info(i);
  }
 
 }

void
print_perport_info (int port)
{
  
   UINT32 temp;

  
   
  printf("port %2d    ",port); 
  MAINT_READ (0xFF, 0x00, (P0_ERR_STATUS_OFFSET + (TSI568_PORT_STRIDE * port)), temp);
  printf("  0x%08x  ", temp);
  MAINT_READ (0xFF, 0x00, (P0_CTL_OFFSET + (TSI568_PORT_STRIDE * port)), temp);
  printf("  0x%08x  \n" , temp);
  }

/********************************************************************
User interface function to print out information about the status of
the rapidIO ports of all devices in the system
********************************************************************/
void
print_rioport_info (int device_id)
{
  int ok = 0;
  volatile ccsr_srio_t *target_rio;
  char input;

  target_rio = srio_device[device_id].srio;
  
  
  if (target_rio != NULL) {
    printf ("Rio port information from device %d \n", device_id);
    printf ("didcar   = 0x%08x       bdidcsr = 0x%08x\n", target_rio->didcar,
            target_rio->bdidcsr);
    printf ("predr    = 0x%08x       pnfedr  = 0x%08x\n", target_rio->predr,
            target_rio->pnfedr);
    printf ("pccsr   = 0x%08x       pescsr  = 0x%08x\n", target_rio->p0ccsr,
    	    target_rio->p0escsr);	    
    printf ("row0 :                 tar=0x%08x, ar=0x%08x  \n",
            target_rio->rowtar0, target_rio->rowar0);
    printf ("row1 : bar=0x%08x, tar=0x%08x, ar=0x%08x  \n",
            target_rio->rowbar1, target_rio->rowtar1, target_rio->rowar1);
    printf ("row2 : bar=0x%08x, tar=0x%08x, ar=0x%08x  \n",
            target_rio->rowbar2, target_rio->rowtar2, target_rio->rowar2);
    printf ("row3 : bar=0x%08x, tar=0x%08x, ar=0x%08x  \n",
            target_rio->rowbar3, target_rio->rowtar3, target_rio->rowar3);
    printf ("row4 : bar=0x%08x, tar=0x%08x, ar=0x%08x  \n",
            target_rio->rowbar4, target_rio->rowtar4, target_rio->rowar4);
    printf ("row5 : bar=0x%08x, tar=0x%08x, ar=0x%08x  \n",
            target_rio->rowbar5, target_rio->rowtar5, target_rio->rowar5);
    printf ("row6 : bar=0x%08x, tar=0x%08x, ar=0x%08x  \n",
            target_rio->rowbar6, target_rio->rowtar6, target_rio->rowar6);
    printf ("row7 : bar=0x%08x, tar=0x%08x, ar=0x%08x  \n",
            target_rio->rowbar7, target_rio->rowtar7, target_rio->rowar7);
    printf ("row8 : bar=0x%08x, tar=0x%08x, ar=0x%08x  \n",
            target_rio->rowbar8, target_rio->rowtar8, target_rio->rowar8);
    printf ("riw0 :                 tar=0x%08x, ar=0x%08x  \n",
            target_rio->riwtar0, target_rio->riwar0);
    printf ("riw1 : bar=0x%08x, tar=0x%08x, ar=0x%08x  \n",
            target_rio->riwbar1, target_rio->riwtar1, target_rio->riwar1);
    printf ("riw2 : bar=0x%08x, tar=0x%08x, ar=0x%08x  \n",
            target_rio->riwbar2, target_rio->riwtar2, target_rio->riwar2);
    printf ("riw3 : bar=0x%08x, tar=0x%08x, ar=0x%08x  \n",
            target_rio->riwbar3, target_rio->riwtar3, target_rio->riwar3);
    printf ("riw4 : bar=0x%08x, tar=0x%08x, ar=0x%08x  \n",
            target_rio->riwbar4, target_rio->riwtar4, target_rio->riwar4);
  }
  else
  {
  	printf("Don't have a pointer to deviceid %d's srio \n", device_id);
  }
}

⌨️ 快捷键说明

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