aboutsummaryrefslogtreecommitdiffstats
path: root/src/edf-hsb.c
blob: 9ace2cac945648241835b93ff6bd19af955cdda2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "litmus.h"
#include "edf-hsb.h"


typedef enum {
	EDF_HSB_SET_HRT,
	EDF_HSB_GET_HRT,
	EDF_HSB_CREATE_BE
} edf_hsb_setup_cmds_t;

typedef struct {
	int 		cpu;
	unsigned int	wcet;
	unsigned int 	period;
} setup_hrt_param_t;

typedef struct {
	unsigned int	wcet;
	unsigned int	period;
} create_be_param_t;

int set_hrt(int cpu, unsigned int  wcet, unsigned int  period)
{
	setup_hrt_param_t param;
	param.cpu    = cpu;
	param.wcet   = wcet;
	param.period = period;
	return scheduler_setup(EDF_HSB_SET_HRT, &param);
}

int get_hrt(int cpu, unsigned int *wcet, unsigned int *period)
{
	setup_hrt_param_t param;
	int ret;
	param.cpu    = cpu;
	ret = scheduler_setup(EDF_HSB_GET_HRT, &param);
	*wcet   = param.wcet;
	*period = param.period;
	return ret;
}

int create_be(unsigned int wcet, unsigned int period) 
{
	create_be_param_t param;
	param.wcet   = wcet;
	param.period = period;
	return scheduler_setup(EDF_HSB_CREATE_BE, &param);
}