2 * @file frescan_sched_analysis.h
4 * @brief FRESCAN sched analysis queue
6 * This module contains the scheduling analysis data and functions for the
7 * admission tests and spare capacity distribution of the negotiation layer.
8 * It provides an easy API easy to understand and in the implementation part
9 * it makes call to the general sched analysis module of FRSH which is shared
10 * with the CPU contracts layer in FRSH.
12 * EXAMPLE of utilization:
16 * params.min_prio = 0;
17 * params.max_prio = 16;
18 * params.overhead = ...;
19 * frescan_sa_init(&scenario, ¶ms);
23 * fadt_freelist_alloc(&freelist_contracts, &id);
24 * frescan_sa_add_contract(&scenario, &contracts[id], id);
25 * frescan_sa_sched_test(&scenario, &success);
28 * frescan_sa_remove_contract(&scenario, id);
30 * frescan_sa_spare_capacity(&scenario);
31 * vres_id = to_vres(resource_type, resource_id, id);
32 * create vres runtime structures;
34 * for vres_id in active_vres_id {
35 * frescan_sa_get_final_values(&scenario,
38 * update vres runtime structures if necessary;
45 * frescan_sa_update_contract(&scenario, to_index(vres_id), &contract);
46 * frescan_sa_sched_test(&scenario, &success);
49 * frescan_sa_update_contract(&sa_data,
53 * frescan_sa_spare_capacity(&scenario);
54 * for vres_id in active_vres_id {
55 * frescan_sa_get_final_values(&scenario,
58 * update vres runtime structures if necessary;
64 * frescan_sa_remove_contract(&scenario, to_index(vres_id));
65 * frescan_sa_spare_capacity(&scenario);
71 * @author Daniel Sangorrin <daniel.sangorrin@unican.es>
75 #ifndef _FRESCAN_SCHED_ANALYSIS_H_
76 #define _FRESCAN_SCHED_ANALYSIS_H_
80 // #include "frsh_sa_scenario.h"
81 typedef int frsh_sa_scenario_t;
82 typedef int frsh_sa_init_params_t;
83 typedef int frsh_vres_index_t;
84 typedef int frescan_sa_final_values_t;
87 * frescan_sa_init() - init the scenario
90 extern int frescan_sa_init(frsh_sa_scenario_t *scenario, // in out
91 const frsh_sa_init_params_t *params); // in
94 * frescan_sa_add_contract() - add a contract to the scenario
97 extern int frescan_sa_add_contract(frsh_sa_scenario_t *scenario, // in out
98 const frsh_contract_t *contract, // in
99 frsh_vres_index_t id); // in
102 * frescan_sa_update_contract() - update a contract in the scenario
105 extern int frescan_sa_update_contract(frsh_sa_scenario_t *scenario, // in out
106 frsh_vres_index_t id, // in
107 const frsh_contract_t *contract);// in
110 * frescan_sa_remove_contract() - remove a contract from the scenario
113 extern int frescan_sa_remove_contract(frsh_sa_scenario_t *scenario, // in out
114 frsh_vres_index_t id); // in
117 * frescan_sa_sched_test() - perform a scheduling test on the scenario
120 extern int frescan_sa_sched_test(frsh_sa_scenario_t *scenario, // in out
121 bool *success); // out
124 * frescan_sa_spare_capacity() - distribute the remaining spare capacity
127 extern int frescan_sa_spare_capacity(frsh_sa_scenario_t *scenario); // in out
130 * sa_get_final_values() - get the final values
133 extern int sa_get_final_values(const frsh_sa_scenario_t *scenario, // in
134 frsh_vres_index_t id, // in
135 frescan_sa_final_values_t *final_values); // out
137 #endif // _FRESCAN_REQUESTS_QUEUE_H_