2011-04-03 16:49:04 +00:00
|
|
|
#ifndef __CSCHEDULER_H__
|
|
|
|
#define __CSCHEDULER_H__
|
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
#include "Tier1/CTask.h"
|
2011-04-14 19:43:46 +00:00
|
|
|
#include "Tier1/IScheduler.h"
|
2011-05-03 11:59:20 +00:00
|
|
|
#include "Tier1/CSemaphore.h"
|
2011-04-03 16:49:04 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include "Tier0/interrupts.h"
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace cb {
|
|
|
|
typedef struct STaskQueueNode {
|
|
|
|
CTask *Task;
|
|
|
|
struct STaskQueueNode *Next;
|
|
|
|
} TTaskQueueNode;
|
|
|
|
class CScheduler {
|
|
|
|
private:
|
2011-04-14 19:43:46 +00:00
|
|
|
IScheduler *m_CurrentScheduler;
|
2011-04-03 16:49:04 +00:00
|
|
|
|
2011-05-03 11:59:20 +00:00
|
|
|
static bool TimerTick(u32 Extra);
|
2011-04-03 16:49:04 +00:00
|
|
|
public:
|
|
|
|
CScheduler(void);
|
|
|
|
static void Enable(void);
|
|
|
|
static void AddTask(CTask *Task);
|
|
|
|
static CTask *GetCurrentTask(void);
|
2011-05-03 11:59:20 +00:00
|
|
|
static void NextTask(void);
|
|
|
|
|
|
|
|
static void DispatchAvailableSemaphore(CSemaphore *Semaphore);
|
2011-04-03 16:49:04 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|