Exemplo n.º 1
0
Arquivo: main.c Projeto: g8ecj/turbine
static void init(void)
{

	/* Initialize debugging module (allow kprintf(), etc.) */
//	kdbg_init();
	/* Initialize system timer */
	timer_init();

	/*
	 * XXX: Arduino has a single UART port that was previously
	 * initialized for debugging purpose.
	 * In order to activate the serial driver you should disable 
	 * the debugging module.
	 */
	/* Initialize UART0 */
	ser_init(&serial, SER_UART0);
	/* Configure UART0 to work at 115.200 bps */
	ser_setbaudrate(&serial, 115200);

	/* Enable all the interrupts now the basic stuff is initialised */
	IRQ_ENABLE;

	// set clock up using last values from eeprom
	rtc_init();
	// read a few more values out of eeprom and init the display etc
	load_eeprom_values();
	ui_init();
	measure_init();
	control_init();
	rpm_init();
	graph_init();
	log_init();

}
Exemplo n.º 2
0
int
main (int argc, char **argv)
{
  struct rlimit rlim;

  rlim.rlim_cur = RLIM_INFINITY;
  rlim.rlim_max = RLIM_INFINITY;
  setrlimit (RLIMIT_STACK, &rlim);

  memset (big, 0xaa, sizeof (big));

  if (argc > 1)
    {
      maxlevel = atol (argv[1]);
      if (argc > 2)
	iterations = atol (argv[2]);
    }

  measure_init ();

  unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_NONE);
  doit ("no cache        ");

  unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_GLOBAL);
  doit ("global cache    ");

  unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_PER_THREAD);
  doit ("per-thread cache");

  return 0;
}
Exemplo n.º 3
0
Arquivo: ex2.c Projeto: hellfyre/pr1
int main(void) {
  unsigned int time[100], time_tmp, time_max;

  measure_init();

  for (int i=0; i<100; i++) {
    measure_start();
    time_tmp = measure_end();
    time[i] = time_tmp;
  }

  time_max = time[0];
  for (int i=0; i<100; i++) {
    printf("%d %d\n", i+1, time[i]);
    if (time[i] > time_max) time_max = time[i];
  }
  printf("max: %d\n", time_max);
}
Exemplo n.º 4
0
Arquivo: ex2a.c Projeto: hellfyre/pr1
int main(int argc, char **argv) {
  static int local_rank = -1;
  static long time = 0;

  int i, curr_size;
  int max_elements = 1000 * 100;
  int *foobar = malloc( sizeof(int) * max_elements);
  for (i=0; i<max_elements; i++) {
    foobar[i] = 42;
  }
  MPI_Status somestatus;

  measure_init();

  MPI_Init(&argc, &argv);

    MPI_Comm_rank(MPI_COMM_WORLD, &local_rank);

    if ( local_rank == 0 ) {
      for (i=1; i<=25; i++) {
        curr_size = 1000 * i;
        //printf("i: %d curr_size: %d\n", i, curr_size);
        MPI_Barrier(MPI_COMM_WORLD);
        measure_start();
        MPI_Send(foobar, curr_size, MPI_INT, 1, 0, MPI_COMM_WORLD);
        MPI_Recv(foobar, curr_size, MPI_INT, 1, 0, MPI_COMM_WORLD, &somestatus);
        time = measure_end();
        printf("%d %ld\n", (curr_size*4)/1000, time);
      }
    }
    else {
      for (i=1; i<=25; i++) {
        curr_size = 1000 * i;
        MPI_Barrier(MPI_COMM_WORLD);
        MPI_Recv(foobar, curr_size, MPI_INT, 0, 0, MPI_COMM_WORLD, &somestatus);
        MPI_Send(foobar, curr_size, MPI_INT, 0, 0, MPI_COMM_WORLD);
      }
    }

  MPI_Finalize();

}
/* ************************************************** */
int do_init(void) {
    if (das_init()             ||  /* das        */
	sodas_init()           ||  /* sodas      */
	spadas_init()          ||  /* spadas     */
	hadas_init()           ||  /* hadas      */
	rng_init()             ||  /* rng        */
	timer_init()           ||  /* timer      */
	bundle_init()          ||  /* bundle     */
	entity_init()          ||  /* entity     */
	monitor_init()         ||  /* monitor    */
	measure_init()         ||  /* mesure     */
	medium_init()          ||  /* medium     */
	mobility_init()        ||  /* mobility   */
	modulation_init()      ||  /* modulation */
	noise_init()           ||  /* noise      */
	node_init()            ||  /* node       */
	packet_init()          ||  /* packet     */
	scheduler_init()) {        /* scheduler  */
        return -1;
    }
    return 0;
}
Exemplo n.º 6
0
Arquivo: ex4.c Projeto: hellfyre/pr1
int main (){
 long int xmax, j;
 long int n = 2,i;
 long int x[1048560];
 static long leTime = 0;
 
 measure_init();
 init_array(x, 1048560, 1);

 for(j=0;j<20;j++){
  measure_start();

  for (xmax = x[0], i = 1; i < n; i++){
       xmax = x[i] < xmax ? xmax : x[i];
  } 
  
 leTime = measure_end();

 printf ("%ld;%ld\n", n, leTime);
 n=n*2;
 }
 return 0;
}
Exemplo n.º 7
0
int main()
{
    struct sTaskTimesStruct *pTtime_pointer = &Ttime;

/*----------------------------------------------------------------------------*/
/*                                SYSTEM INIT                                      */
/*----------------------------------------------------------------------------*/    
    _SWDTEN = 0; // Disable WDT
    
    OSCCONbits.COSC = 0b111;
    OSCCONbits.NOSC = 0b111;
    OSCCONbits.CF = 0;
    while(OSCCONbits.LOCK!=1) {}; // Wait for PLL to lock
    
    SET_CPU_IPL(0b111);            // Force CPU interrupt priority to max.All user masked interrupts with ptiority from 0 to 7 are Disabled.(Safe version)            
     
/*----------------------------------------------------------------------------*/
/*                                MAIN PROGRAM                                  */
/*----------------------------------------------------------------------------*/
    /* INIT */
    delay_ms(10);
    
    if(EE_CheckEEprom() == S_OK)
    {
        /* Parameters Read */
        ee_param_act(1,1);     // INIT and put in PARACT_PARAMS_READ_ALL state
        ee_param_act(0,0);    // RUN read all parameters. NO NEED REINIT!
    }
    
    IF_DigitalIO_Init();
    IF_LCDInit();
    trace_init_first();
    IF_SysTmr1_Init();
    IF_SysTmr2_Init();
    IF_SysTmr3_Init();
    IF_ADC_INIT();
    state_machine_init();
    triac_control_init();
    measure_init();
    temp_ctrl_init();
    
    /* END INIT */
    
    IF_LCDPutc('\f');
    IF_LCDPuts("    SSTU 4.0");
    IF_LCDPutc('\n');
    IF_LCDPuts("     V");
    IF_LCDPutn((FIRMWARE_BASE_VERSION / 100));
    IF_LCDPutc('.');
    IF_LCDPutn(FIRMWARE_SUB_VERSION);
    
    delay_ms(200);
    
    INTCON1bits.NSTDIS = 0;    // Enable Nested Interrupts
    SET_CPU_IPL(0b000);        // Force CPU interrupt priority to low. All user masked interrupts with ptiority from 0 to 7 are Enabled.(Safe version)
    
    IF_Uart_Init(38400);
    
    ClrWdt();         // Clear WDT
    _SWDTEN = 1;    // Enable WDT    
    
    while(1)
    {
    /* BACKGROUND LOOP. */
        
        if(!_is_task1_execute() && !_is_task2_execute()) Sirem_Engine(); // Serial Communication run in background loop    
        
        Idle();
    
        if(!_is_task1_execute() && !_is_task2_execute()) TaskTimesCalc(pTtime_pointer);
        
        Idle();
        
        if(!_is_task1_execute() && !_is_task2_execute()) ee_param_act(0,0); // Online parameters actualization in background
        
        Idle();
        
        if(!_is_task1_execute() && !_is_task2_execute()) Params_check_limit();

        ClrWdt();    //<------ Clear Watchdog timer

        Idle();
    }

    return(0);
}
Exemplo n.º 8
0
int main()
{

/*----------------------------------------------------------------------------*/
/*								SYSTEM INIT			                          */
/*----------------------------------------------------------------------------*/	
	_SWDTEN = 0; // Disable WDT
	
	OSCCONbits.COSC = 0b11;
	OSCCONbits.NOSC = 0b11;
	OSCCONbits.CF = 0;
	while(OSCCONbits.LOCK!=1) {;}; // Wait for PLL to lock
	
	SET_CPU_IPL(0b111);			// Force CPU interrupt priority to max.All user masked interrupts with ptiority from 0 to 7 are Disabled.(Safe version)
	 
	delay_ms(5);
/*----------------------------------------------------------------------------*/
/*								MAIN PROGRAM		                          */
/*----------------------------------------------------------------------------*/
	/* INIT */
	DSP_Engine_Init();
	
	/* Parameters Read */
	ee_param_act(1,1); 	// INIT and put in PARACT_PARAMS_READ_ALL state
	ee_param_act(0,0);	// RUN read all parameters. NO NEED REINIT!
	
	/* HW Modules Init */
	IF_DigitalIO_Init();
	IF_PWM_Init();
	IF_DigitalIO_Init();
	IF_SysTmr1_Init();
	IF_SysTmr2_Init();
	IF_SysTmr3_Init();
	IF_Uart_Init(38400);
	IF_ADC_INIT();
	
	/* Software Modules Init */
	Task_Init();
	Task1_Stack_Usage_Calc(_get_sTimes(), 1);
	trace_init_first();
	measure_init();
	VF_ControlInit();
	init_ramp1(0);
	init_ramp2(0);
	

	/* END INIT */
	
	INTCON1bits.NSTDIS = 0;	// Enable Nested Interrupts
	SET_CPU_IPL(0b000);		// Force CPU interrupt priority to low. All user masked interrupts with ptiority from 0 to 7 are Enabled.(Safe version)
	
	
	
	ClrWdt(); 		// Clear WDT
	//_SWDTEN = 1;	// Enable WDT	
	
	while(1)
	{
	/* BACKGROUND LOOP. */
		
		ee_param_act(0,0); // Online parameters actualization in background
		
		Sirem_Engine(); // Serial Communication run in background loop	
		
		adc_par_convert();
		
		TaskTimesCalc(_get_sTimes());
		
		VF_Par_Convert();
		
		
	}

	return(0);
}