//----------------------------------------------------------------------------//
//                           GNU GPL OS/K                                     //
//                                                                            //
//  Authors:    spectral`                                                     //
//              NeoX                                                          //
//                                                                            //
//  Desc:       Scheduler header                                              //
//----------------------------------------------------------------------------//

#ifndef _KALKERN_BASE_H
#include <kernel/base.h>
#endif

//------------------------------------------//

#ifndef _KALKERN_SCHED_H
#define _KALKERN_SCHED_H

//------------------------------------------//

// Debug stuff
#define printdbg printf

// States for a process
#define STATE_RUNNING  0
#define STATE_RUNNABLE 1
#define STATE_BLOCKED  2

// Time in ticks a process should be run
#define DEF_PROC_TSLICE     5       // 20 ticks
#define TCR_PROC_TSLICE     20000   // 20000 ticks (time critical)

//------------------------------------------//

DECLARE_PER_CPU(IdlePrioProcs, ListHead_t *);
DECLARE_PER_CPU(ReglPrioProcs, ListHead_t *);
DECLARE_PER_CPU(ServPrioProcs, ListHead_t *);
DECLARE_PER_CPU(TimeCritProcs, ListHead_t *);

extern const char *PrioClassesNames[];

//------------------------------------------//

void SchedInit(void);
void SchedFini(void);

void SchedThisProc(Process_t *);
void SchedOnTick(void);

//------------------------------------------//

#endif