diff options
Diffstat (limited to 'src/include/kernel/timemgr.H')
-rw-r--r-- | src/include/kernel/timemgr.H | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/src/include/kernel/timemgr.H b/src/include/kernel/timemgr.H index 0590dedff..96950b928 100644 --- a/src/include/kernel/timemgr.H +++ b/src/include/kernel/timemgr.H @@ -47,28 +47,32 @@ struct _TimeManager_Delay_t class TimeManager { public: - enum - { + enum + { /** Number of time-slices to allow per second. * * Context length becomes (1/TIMESLICE_PER_SECOND) sec. */ - TIMESLICE_PER_SEC = 1000, - }; + TIMESLICE_PER_SEC = 1000, + }; /** Initialize the time subsystem. */ - static void init(); + static void init(); + + /** Initialize the task-delay structures for a CPU. */ + static void init_cpu(cpu_t* cpu); + /** Return the number of ticks per time-slice. */ - static uint64_t getTimeSliceCount() - { - return iv_timebaseFreq / TIMESLICE_PER_SEC; - }; + static uint64_t getTimeSliceCount() + { + return iv_timebaseFreq / TIMESLICE_PER_SEC; + }; /** Returns the value of the processor timebase register. */ - static uint64_t getCurrentTimeBase() - { - return getTB(); - }; + static uint64_t getCurrentTimeBase() + { + return getTB(); + }; /** Converts seconds/nsecs to timebase ticks. * @@ -80,7 +84,7 @@ class TimeManager * * @return Number of timebase ticks. */ - static uint64_t convertSecToTicks(uint64_t i_sec, uint64_t i_nsec); + static uint64_t convertSecToTicks(uint64_t i_sec, uint64_t i_nsec); /** Converts timebase ticks to seconds/nsecs. * * @param[in] i_ticks - Number of ticks. @@ -96,23 +100,27 @@ class TimeManager * @param[in] i_sec - Seconds. * @param[in] i_nsec - Nsecs. */ - static void delayTask(task_t* t, uint64_t i_sec, uint64_t i_nsec); + static void delayTask(task_t* t, uint64_t i_sec, uint64_t i_nsec); /** Checks the sleep queue to determine if any tasks should be woken. */ - static void checkReleaseTasks(Scheduler* s); + static void checkReleaseTasks(Scheduler* s); protected: - TimeManager() {}; - ~TimeManager() {}; + TimeManager() {}; + ~TimeManager() {}; private: - void _init(); - 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> - iv_taskList[KERNEL_MAX_SUPPORTED_CPUS]; + typedef Util::Locked::PQueue<_TimeManager_Delay_t, uint64_t> + delaylist_t; + + void _init(); + void _init_cpu(cpu_t* cpu); + void _delayTask(task_t* t, uint64_t i_sec, uint64_t i_nsec); + void _checkReleaseTasks(Scheduler* s); + inline delaylist_t* _get_delaylist(); + /** Frequency of the timebase register in Hz. (ticks per second) */ - static uint64_t iv_timebaseFreq; + static uint64_t iv_timebaseFreq; }; #endif |