<div dir="ltr"><div><div>Hi guys,<br><br></div>Im trying to implement a single shot timer.<br><br></div>I derive from rtemsTimer class and replace virtual void triggered()=0<br><br><div>#include <rtems++/rtemsTimer.h><br>...<br><br>class Timer : public rtemsTimer {<br>public:<br>   Timer(const char* tname);<br>   virtual ~Timer();<br>private:<br>   void triggered();<br>};<br><br></div><div>in timer.cpp<br></div><div><br>void SynchTimer::triggered(){<br><br>   printf("hello Timer! \n");<br><br>}<br><br><br></div><div>Then I have the following task class who creates and fires a Timer object:<br><br>class TimerMngr : public rtemsTask{<br><br>public:<br>   TimerMngr(const char* tname);<br>   virtual ~TimerMngr();<br><br>private:<br>   void body(rtems_task_argument argument);<br><br>};<br></div><div><br><br></div><div>in timerMngr.cpp<br><br>TimerMngr::TimerMngr(const char* tname)<br>:   rtemsTask(tname,<br>      1,<br>      RTEMS_MINIMUM_STACK_SIZE,<br>      RTEMS_PREEMPT|RTEMS_TIMESLICE,<br>      0,<br>      RTEMS_NO_FLOATING_POINT,<br>      RTEMS_LOCAL)<br><br>{<br>   if(last_status_code()!=RTEMS_SUCCESSFUL)<br>      printf("SynchMngr::error when create()%d \n",<br>            last_status_code());<br>}<br></div><div><div><div><br><br><br>void TimerMngr::body(rtems_task_argument argument){<br><br>   printf("TimerMngr::body! \n");  [1] <br><br>   /* Create the Timer<br>    * *****************************/<br>   Timer* timer=new Timer("timer");<br><br>   printf("SynchMngr, CurrentTime! @ %d \n",getCurrentTime());  [2] <br><br><br>   /* start timer<br>    * *****************************/<br>   rtems_status_code status;<br>   status=synch_timer->fire_after(120);<br>   printf("synch_timer->fire_after() status %d \n",status); [3] <br><br><br>   wake_after(500);<br>   printf("SynchMngr, CurrentTime @ %d \n",getCurrentTime()); [4]<br><br>}<br><br clear="all">unsigned TimerMngr::getCurrentTime(){<br>   //rtems_unsigned32 time_stamp;<br>   unsigned time_stamp;<br>   time_stamp=0;<br>   rtems_status_code status;<br><br>   status=rtems_clock_get(RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH,&time_stamp);<br>   if(status!=RTEMS_SUCCESSFUL)<br>      printf("error with rtems_clock_get %d \n",status);<br><br>   return time_stamp;<br>}<br><br></div><div>When I run the app I get the first and second printf [1] y [2]. But just <br>"syn" from the 3erd printf [3].<br><br></div><div>In the conf file:<br><br>#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER<br>#define CONFIGURE_TICKS_PER_TIMESLICE      30 <br>#define CONFIGURE_MAXIMUM_TIMERS             4<br></div><div><br></div><div>Any suggestion?<br></div><div><br></div><div>Cheers,<br></div><div>Pablo<br></div><div><br>-- <br>MartÃnez, Pablo AgustÃn
</div></div></div></div>