Ejemplo n.º 1
0
Archivo: main.c Proyecto: kunulee/f-stm
void pmu_stop(void){
  unsigned int cycle_count, overflow, counter0, counter1, counter2, counter3, counter4, counter5;

      disable_ccnt();            // Stop CCNT
      disable_pmn(0);            // Stop counter 0
      disable_pmn(1);            // Stop counter 1
      disable_pmn(2);            // Stop counter 2
      disable_pmn(3);            // Stop counter 3
      disable_pmn(4);            // Stop counter 4
      disable_pmn(5);            // Stop counter 5

      counter0 = read_pmn(0); // Read counter 0
      counter1 = read_pmn(1); // Read counter 1
      counter2 = read_pmn(2); // Read counter 2
      counter3 = read_pmn(3); // Read counter 3
      counter4 = read_pmn(4); // Read counter 4
      counter5 = read_pmn(5); // Read counter 5
      cycle_count = read_ccnt(); // Read CCNT
      overflow=read_flags();        //Check for overflow flag
      printf("%d\t%d %d %d %d %d %d\n", cycle_count/667, counter0/667, counter1/667, counter2/667 ,counter3/667,counter4/667,counter5/667);
 
 	if(overflow)
        printf("Warning Overflow Occured\n");
																																		                                                             // printf("Overflow: %d, Cycle Count: %d \n\n", overflow,cycle_count);
};
static void arm_cmplx_dot_prod_f32_test_render(float32_t *A,     
									 float32_t *B,   
									 uint32_t blockSize,  
									 float32_t *realResult,  
									 float32_t *imagResult)  
{   

#ifdef AVG_CYCLES 
	
	int i, avg_cycles, sum = 0; 
	unsigned int cycle_count_asm = 0; 
	 	 
  for(i=0; i<1000; i++) 
  { 
	  /* ----------------------------------------------------------------------   
	  **  Initialize the timer calculation.   
	  ** ------------------------------------------------------------------- */   
	  enable_ccnt(); 
	  enable_cntens(0x80000001); 
 
	  /* ----------------------------------------------------------------------   
	  ** Call the Complex Dot Product process function     
	  ** ------------------------------------------------------------------- */   
	   
	  arm_cmplx_dot_prod_f32(A, B, blockSize, realResult, imagResult);   
	   
	  /* ----------------------------------------------------------------------   
	  ** Calculate the execution time   
	  ** ------------------------------------------------------------------- */   
	   
	  cycle_count_asm = ccnt(); 
	  disable_ccnt(); 
	  /* copying cycles of the function called each time */ 
	  sum += cycle_count_asm;    
 
  } 
   
  avg_cycles = sum/1000; 
   
  printf("Cmplx_dot_prod_f32 Size = %d Cycles = %d\n", blockSize, avg_cycles);  
   
#else 
 
	/* ----------------------------------------------------------------------   
	** Call the Complex Dot Product process function     
	** ------------------------------------------------------------------- */   
	   
	arm_cmplx_dot_prod_f32(A, B, blockSize, realResult, imagResult);   
 
#endif	   
}