summaryrefslogtreecommitdiffstats
path: root/src/include/kernel/timemgr.H
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2010-10-04 17:48:47 -0500
committerPatrick Williams <iawillia@us.ibm.com>2010-10-04 17:48:47 -0500
commit3e9ed72a3b6442eaebadf26294e448862c3a4400 (patch)
treef3745143af3f1f87d99f3dec1256549195bf7fe1 /src/include/kernel/timemgr.H
parent706838262ce47efeb8f983920a218460b81f2dc3 (diff)
downloadblackbird-hostboot-3e9ed72a3b6442eaebadf26294e448862c3a4400.tar.gz
blackbird-hostboot-3e9ed72a3b6442eaebadf26294e448862c3a4400.zip
Add nanosleep syscall.
Diffstat (limited to 'src/include/kernel/timemgr.H')
-rw-r--r--src/include/kernel/timemgr.H43
1 files changed, 38 insertions, 5 deletions
diff --git a/src/include/kernel/timemgr.H b/src/include/kernel/timemgr.H
index 58381263f..78de82216 100644
--- a/src/include/kernel/timemgr.H
+++ b/src/include/kernel/timemgr.H
@@ -2,25 +2,58 @@
#define __KERNEL_TIMEMGR_H
#include <kernel/types.h>
+#include <kernel/ppcarch.H>
+
+#include <util/locked/pqueue.H>
+#include <kernel/spinlock.H>
+
+class Scheduler;
+
+struct _TimeManager_Delay_t
+{
+ _TimeManager_Delay_t * next;
+ _TimeManager_Delay_t * prev;
+ uint64_t key;
+ task_t* task;
+};
class TimeManager
{
public:
+ enum
+ {
+ TIMESLICE_PER_SEC = 1000,
+ };
+
static void init();
static uint64_t getTimeSliceCount()
{
- return iv_timeSlice;
+ return iv_timebaseFreq / TIMESLICE_PER_SEC;
};
+ static uint64_t getCurrentTimeBase()
+ {
+ return ppc_getTB();
+ };
+
+ static uint64_t convertSecToTicks(uint64_t i_sec, uint64_t i_nsec);
+
+ static void delayTask(task_t* t, uint64_t i_sec, uint64_t i_nsec);
+ static void checkReleaseTasks(Scheduler* s);
+
protected:
- TimeManager() {};
+ TimeManager() :
+ iv_taskList() {};
~TimeManager() {};
private:
void _init();
-
-
- static uint64_t iv_timeSlice;
+ void _delayTask(task_t* t, uint64_t i_sec, uint64_t i_nsec);
+ void _checkReleaseTasks(Scheduler* s);
+
+ Util::Locked::PQueue<_TimeManager_Delay_t, uint64_t,
+ true, Spinlock> iv_taskList;
+ static uint64_t iv_timebaseFreq;
};
#endif
OpenPOWER on IntegriCloud