00001 #ifndef TIMER_HPP 00002 #define TIMER_HPP 00003 00004 #include <assert.h> 00005 #include <stdio.h> 00006 #include <stdlib.h> 00007 #include <sys/syspage.h> 00008 #include <sys/neutrino.h> 00009 #include <sys/netmgr.h> 00010 00011 #include <j2k/nto/Basic_PThread.hpp> 00012 00013 class my_timer : public Basic_PThread 00014 { 00015 public: 00016 my_timer( unsigned long); 00017 virtual ~my_timer(); 00018 void set_timer(); 00019 int getChid(); 00020 void WaitForPulse(); 00021 00022 virtual void run(); 00023 virtual void tick() = 0; 00024 00025 private: 00026 int chid; 00027 int pulse_id; 00028 timer_t timer_id; 00029 struct sigevent event; 00030 struct itimerspec timer; 00031 struct _clockperiod clkper; 00032 struct _pulse pulse; 00033 00034 }; 00035 00036 typedef my_timer Timer; 00037 00038 #endif