#include "frescan_config.h" // FRESCAN_MLOCK_T, FRESCAN_MX_XXX
#include "frescan_packets.h" // frescan_packet_t
+#include "frsh.h" // for frsh_contract_t
+#include "fsa.h" // for frsh_sa_scenario_t
+
/**
* frescan_repl_op_t - a replenishment operation
*
*
* @budget: the budget in CAN 8-byte frames
* @period: the replenishment period for the server
- * @prio: the priority for the server TODO: this should be a return value
+ * @prio: the priority of the server
*/
typedef struct {
frescan_budget_t budget;
struct timespec period;
-} frescan_budget_period_t;
-
-typedef struct {
- frescan_budget_period_t values;
frescan_prio_t prio;
} frescan_server_params_t;
typedef struct {
frescan_server_params_t params;
- frescan_network_t net;
- frescan_ss_t id;
- frescan_budget_t current_budget;
- frescan_prio_t current_priority;
- frescan_budget_t pending_packets;
- frescan_repl_op_t replenishments;
- timer_t repl_timer;
- struct timespec act_time;
- frescan_packet_t packet_list;
- struct list_head servers_list;
+ frescan_network_t net;
+ frescan_ss_t id;
+ frescan_budget_t current_budget;
+ frescan_prio_t current_priority;
+ frescan_budget_t pending_packets;
+ frescan_repl_op_t replenishments;
+ timer_t repl_timer;
+ struct timespec act_time;
+ frescan_packet_t packet_list;
+ struct list_head servers_list;
} frescan_server_data_t;
/**
extern frescan_server_data_t the_active_servers[FRESCAN_MX_NETWORKS];
/**
- * frescan_contract_t
+ * frescan_sa_vres_t - a frescan vres
+ *
+ * @contract: the contract of the virtual resource
+ * @node: the node where the vres belongs to
+ * @ss: the sporadic server identifier
+ * @list: the list of vres. Note that this is the list of all the vres
+ * in the network instace. As this is a master-slave protocol the master
+ * knows everything about the contracts of the rest of nodes.
*/
+typedef enum {
+ FRESCAN_SA_PERIOD_DEC = 1<<5,
+ FRESCAN_SA_PERIOD_INC = 1<<4,
+ FRESCAN_SA_BUDGET_DEC = 1<<3,
+ FRESCAN_SA_BUDGET_INC = 1<<2,
+ FRESCAN_SA_PRIO_DEC = 1<<1,
+ FRESCAN_SA_PRIO_INC = 1
+} frescan_sa_mode_change_type_t;
+
typedef struct {
- frescan_budget_period_t min_values;
- frescan_budget_period_t max_values;
- frescan_prio_t prio;
-} frescan_contract_t;
+ frsh_contract_t contract;
+ frescan_node_t node;
+ frescan_ss_t ss;
+ frsh_sa_vres_id_t fsa_vres_global_id;
+ struct list_head list;
+ // mode change variables
+ frsh_sa_time_t old_c;
+ frsh_sa_time_t old_t;
+ frsh_sa_prio_t old_p;
+ frescan_sa_mode_change_type_t mode_change_type;
+ struct list_head mode_change_list;
+} frescan_sa_vres_t;
/**
- * frescan_sa_xxx scheduling analysis types
+ * frescan_sa_scenario_t - the scheduling analysis scenario
*/
-typedef struct {
- frescan_prio_t server_prio;
-} frescan_sa_final_values_t;
-
-typedef struct {
- frescan_contract_t contract;
- frescan_node_t node;
- frescan_ss_t ss;
- frescan_sa_final_values_t final_values;
- struct list_head list;
-} frescan_sa_contract_t;
-
typedef struct {
frescan_prio_t max_prio;
frescan_prio_t min_prio;
} frescan_sa_init_params_t;
typedef struct {
- frescan_sa_contract_t contracts[FRESCAN_MX_NODES][FRESCAN_MX_IDS];
- frescan_sa_contract_t contracts_head;
frescan_sa_init_params_t init_params;
+ frescan_sa_vres_t vres_pool[FRESCAN_MX_NODES][FRESCAN_MX_IDS];
+ frescan_sa_vres_t vres_head;
+ freelist_t fsa_id_freelist;
+ frsh_sa_scenario_t fsa_scenario;
} frescan_sa_scenario_t;
/**
frescan_packet_t *id_queues[FRESCAN_MX_NODES][FRESCAN_MX_IDS]; // TODO: alloc at init
frescan_packet_t *id_fp_queues[FRESCAN_MX_NODES][FRESCAN_MX_PRIOS]; // TODO: alloc at init
frescan_sa_scenario_t scenario;
+ struct list_head mode_change_budget_inc_list_head[FRESCAN_MX_NODES];
+ struct list_head mode_change_budget_dec_list_head[FRESCAN_MX_NODES];
} frescan_network_data_t;
extern frescan_network_data_t the_networks[FRESCAN_MX_NETWORKS];