Ejemplo n.º 1
0
//Stop the timer, update the frequency, and turn it back on
void throttle_timer(unsigned int freq) {

    timer_off();
    init_time_chip(freq); //Full throttle is 596591
    timer_on();
    installInterrupt(TIMER_INT_NUM, &_handle_timerInt, 3); //Make sure the normal handler is installed
}
Ejemplo n.º 2
0
void timerZero(int aigInt)
{
	cntResets++;
	// Do not interfere with functioncall!
	if(theDebugCodeClass.state == debugCode::DST_FUNCTIONEXECUTE)
	{
		// Retart timeout to postpone the hard stop
		timer_set(TIMER_MAT_DEBUG, TIMER_MAT_DEBUG);
	    timer_on();
	}
	else
	{
		theDebugCodeClass.setBack();		
		timer_off();
	}
}
Ejemplo n.º 3
0
void main()
{
	// ----- Инициализация алгоритма ------
    Init_Algo( &Gyro, &global_uartp[0] );
    
   // ----- Инициализация ------
    Init();

   // --- уст.длины пакета для UART
    global_cnrbuf = kk;//уст.длины пакета для UART
    global_kx     = kx;
    global_ky     = ky;

   // ----------
    interrupts (SIG_TMZ, timer_isr);    /* enable low priority timer interrupt */
    timer_set(a, a);              
    timer_on();                         /* start timer */
    while(1){};
}
Ejemplo n.º 4
0
void main()
{
    // ----- Генерирование таблици синуса -----
//    GenerateSineTable();

	// ----- Инициализация алгоритма ------
    Init_Algo( &Gyro, &global_uartp[0] );
    
   // ----- Инициализация ------
    Init();

   // --- уст.длины пакета для UART
    global_cnrbuf = kk;//уст.длины пакета для UART
    global_kx     = coef_AN;
    global_ky     = coef_N;

   // ----------
    interrupts (SIG_TMZ, timer_isr);    /* enable low priority timer interrupt */
    timer_set(a, a);              
    timer_on();                         /* start timer */
    while(1){};
}
Ejemplo n.º 5
0
WORD32
debugCode::prepareFctCall(WORD32 numInArgs, WORD32 numOutArgs, WORD32 fctID, WORD32* lFieldOut)
{
	WORD32 i;
	
	if(state != DST_FUNCTIONCALL)
	{
		// Set the number of parameters
		execute_numInArgs = numInArgs;
		execute_numOutArgs = numOutArgs;
		execute_fctCallID = fctID;
	
		// Allocate the fields to call one function
		ptrFieldCallIn = NEW2 float*[execute_numInArgs];
		ptrFieldCallOut  = NEW2 float*[execute_numOutArgs];
		numValuesIn = NEW2 WORD32[execute_numInArgs];
		numValuesOut = NEW2 WORD32[execute_numOutArgs];

		// For the output fields, we cann allocate fields already	
		for(i = 0; i < numOutArgs; i++)
		{
			ptrFieldCallOut[i] = NEW2 float[lFieldOut[i]];
			numValuesOut[i] = lFieldOut[i];
		}
	
		// Counters to collect fields
		inCounter = 0;
		outCounter = 0;
	
		state = DST_FUNCTIONCALL;
		
#ifdef USE_FCT_TIMEOUT
		// Start timeout
		timer_set(TIMER_MAT_DEBUG, TIMER_MAT_DEBUG);
	    timer_on();
#endif
		return(0);
	}
Ejemplo n.º 6
0
Archivo: timer.c Proyecto: saper/em400
// -----------------------------------------------------------------------
int timer_init(struct cfg_em400 *cfg)
{
	timer_step = cfg->timer_step;

	if ((timer_step < 2) || (timer_step > 100)) {
		return E_TIMER_VALUE;
	}

	LOG(L_CPU, 1, "Timer cycle: %i ms", timer_step);

	if (cfg->timer_start) {
		timer_on();
	} else {
		timer_off();
	}

	sem_init(&timer_quit, 0, 0);
	if (pthread_create(&timer_th, NULL, timer_thread, NULL)) {
		return E_THREAD;
	}

	return E_OK;
}