in testsuites spwatchdog, when _Watchdog_Remove is called?

Chan Kim ckim at etri.re.kr
Thu Nov 19 12:18:59 UTC 2015


Hi rtems users and gurus,

I was trying to learn how to use watchdog in rtems and was following testsuites/sptests/spwatchdog.
There, Init task creates a timer and starts task 1 before killing itself. The beginning of task1 code looks like below. 
(This test is to see if watchdog timer works as intended.)
When I ran this code on our board(sparc), I learned _Watchdog_Remove function is called inside rtems_timer_fire_after function which I can understand because watchdog should be removed when the timer is newly armed.
After 3 seconds, the timer fires and Delayed_resume function runs which resumes task 1. 
After woken up, task 1 prints the time using Print_time() function.
But just before printing time, I noticed _Watchdog_Remove function is called. (This is surely after 3 seconds, just before printing time)
In what route, is the _Watchdog_Remove function is called after the task is resumed?(or is it during the resuming action?)
I know from grepping that _Watchdog_Remove is called in many timer related functions but this one I don't know where it's coming from. I would appreciate it if anyone tell me.

rtems_task Task_1(
  rtems_task_argument argument
)
{
  rtems_id          tmid;
  rtems_status_code status;
/* Get id */
  puts( "TA1 - rtems_timer_ident - identing timer 1" );
  status = rtems_timer_ident( Timer_name[ 1 ], &tmid );
  directive_failed( status, "rtems_timer_ident" );
  printf( "TA1 - timer 1 has id (0x%" PRIxrtems_id ")\n", tmid );
/* after which is allowed to fire */
  Print_time();
  puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" );
  status = rtems_timer_fire_after(
    tmid,
    3 * rtems_clock_get_ticks_per_second(),
    Delayed_resume,
    NULL
  );
  directive_failed( status, "rtems_timer_fire_after" );
  puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" );
  status = rtems_task_suspend( RTEMS_SELF );
  directive_failed( status, "rtems_task_suspend" );
  Print_time();
...continue..

Thansk!
Chan


More information about the users mailing list