RTEMS Timer problem

hwulf at et-inf.fho-emden.de hwulf at et-inf.fho-emden.de
Tue Apr 3 14:48:28 UTC 2007


Hi,

I wanted to configure a timer, whose ISR sends an event to a user task.
But unfortunately, the timer doesn't seem to expire.
I already defined CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER and
CONFIGURE_MAXIMUM_TIMERS 3 in the main module.

Are there some other configurations or processor-registers to set in
order to get the timer started?

Below is the code of the user task and the important functions from my
timer module.

I'm running the RTEMS program in TSIM.

I thank you very much for every advice in advance!

Kind regards,
  Hank


/******************************************************************************
  *
  * USER_TASK1
  *
  *  
****************************************************************************/
rtems_task user_task_1(rtems_task_argument unused)
{
	rtems_status_code status;
	rtems_event_set task1_event;

	printf("Task 1: Creating Timer\n");
	createTimer(&tTimer[0], Timer_name[0], TIMER_PERIODIC, 100);
	printf("Task 1: Activating Timer\n");
	activateTimer(tTimer[0]);

	while(TRUE)
	{
		int i = 0;
		waitForTimerEvent(task1_event, 2*TIMER_INTERVAL);
		i++;
		printf("Task 1: Event #%i received", i);
	}

	return(status);
}


......

rtems_timer_service_routine timerISR(rtems_id timer_id, void *user_data)
{
	int i;

	/* restart timer with the same interval */
	rtems_timer_reset(timer_id);

	/* send event to particular task */
	for(i = 0; i < MAXIMUM_TIMER_TASKS; i++)
		if(Timer_id[i] == timer_id)
		{
			rtems_event_send(Task_id[i], RTEMS_EVENT_0);
			break;
		}
}

......

rtems_status_code createTimer(struct obdhtimer_t *tTimer, rtems_name  
name, enum timer_mode mode, rtems_interval interval)
{
	rtems_status_code status;

	tTimer->mode = mode;
	tTimer->interval = interval;

	status = rtems_timer_create(name, &(tTimer->id));

	return(status);
}

......

rtems_status_code activateTimer(struct obdhtimer_t tTimer)
{
	rtems_status_code status;

	status = rtems_timer_fire_after(tTimer.id, tTimer.interval, timerISR, NULL);

	return(status);
}

......

rtems_status_code waitForTimerEvent(rtems_event_set *event_out,  
rtems_interval timeout)
{
	rtems_status_code status;

	status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT |  
RTEMS_EVENT_ANY, timeout, event_out);

	return(status);
}




More information about the users mailing list