/shark/trunk/ports/first/include/fsf_shared_objects.h |
---|
0,0 → 1,117 |
//fsf_shared_objects.h |
//================================================== |
// FFFFFFIII RRRRR SSTTTTTTT |
// FF IIR RR SS |
// FF IR SS |
// FFFFFF RRRR SSSSST |
// FF FI RRR SS |
// FF II RRR SS |
// FF IIIIIR RS |
// |
// FSF(FIRST Scheduling Framework) |
// shared objects functionality |
//==================================================== |
#include <pthread.h> |
#include "fsf_basic_types.h" |
#include "fsf_core.h" |
#ifndef _FSF_SHARED_OBJECTS_H_ |
#define _FSF_SHARED_OBJECTS_H_ |
#define FSF_SHARED_OBJECTS_MODULE_SUPPORTED 1 |
// These constants are defined in the fsf_configuration_parameters.h |
// file: |
//#define FSF_MAX_N_SHARED_OBJECTS 100 |
//#define FSF_MAX_N_CRITICAL_SECTIONS 20 |
//// The definition of this types is in fsf_basic_types.h |
// |
//// Shared object identifier (null character terminated string) |
//typedef char * fsf_shared_obj_id_t; |
// |
//// Shared object handle (opaque type) |
//typedef FSF_SHARED_OBJ_HANDLE_T_OPAQUE fsf_shared_obj_handle_t; |
// |
//// Critical section data |
//typedef struct { |
// fsf_shared_obj_handle_t obj_handle; |
// struct timespec wcet; //Execution time |
//} fsf_critical_section_data_t; |
// |
//// List of critical sections |
//typedef struct { |
// int size; // = 0 |
// fsf_critical_section_data_t |
// section[FSF_MAX_N_CRITICAL_SECTIONS]; |
//} fsf_critical_sections_t; |
// |
///////////////////////////////////////////////////// |
// SHARED OBJECTS & OPERATIONS MANAGEMENT |
///////////////////////////////////////////////////// |
// fsf_init_shared_object: Initialization of shared objects. If the |
// object identified by obj_id does not yet exist it is created, a |
// handle to the object is returned in the variable pointed to by |
// obj_handle, and the specified mutex is initialized with the |
// appropriate attributes necessary for the current implementation. |
// If the object already exists, the function fails. |
int fsf_init_shared_object |
(fsf_shared_obj_id_t obj_id, |
fsf_shared_obj_handle_t *obj_handle, |
pthread_mutex_t *mutex); |
// fsf_get_shared_object_handle: getting the handle of shared |
// objects. If the object already exists a handle to the object is |
// returned in the variable pointed to by obj_handle. Otherwise, an |
// error code is returned by the function. |
int fsf_get_shared_object_handle |
(fsf_shared_obj_id_t obj_id, |
fsf_shared_obj_handle_t *obj_handle); |
// fsf_get_shared_object_mutex: getting the mutex of shared |
// objects. If the object exists, a pointer to its associated mutex is |
// returned in the variable pointed to by mutex. Otherwise, an error |
// code is returned by the function. |
int fsf_get_shared_object_mutex |
(fsf_shared_obj_handle_t obj_handle, |
pthread_mutex_t **mutex); |
///////////////////////////////////////////////////// |
// CONTRACT PARAMETERS |
///////////////////////////////////////////////////// |
//fsf_set_contract_synchronization_parameters: The operation updates |
//the specified contract parameters object by setting its critical |
//sections to the specified input parameter. |
int |
fsf_set_contract_synchronization_parameters |
(fsf_contract_parameters_t *contract, |
const fsf_critical_sections_t *critical_sections); |
//fsf_get_contract_synchronization_parameters: The operation obtains |
//from the specified contract parameters object its critical sections, |
//and copies them to the places pointed to by the specified input |
//parameter. Only those critical_section_data records that are in use |
//in the critical_sections structure are copied (according to its size |
//field). |
int |
fsf_get_contract_synchronization_parameters |
(const fsf_contract_parameters_t *contract, |
fsf_critical_sections_t *critical_sections); |
#endif // _FSF_SHARED_OBJECTS_H_ |
/shark/trunk/ports/first/include/fsf.h |
---|
0,0 → 1,97 |
//fsf.h |
//=========================================================== |
// FFFFFFIII RRRRR SSTTTTTTT |
// FF IIR RR SS |
// FF IR SS |
// FFFFFF RRRR SSSSST |
// FF FI RRR SS |
// FF II RRR SS |
// FF IIIIIR RS |
// |
// FSF(FIRST Scheduling Framework) available functionality |
//============================================================ |
#include "fsf_configuration_parameters.h" |
#include "fsf_opaque_types.h" |
#include "fsf_basic_types.h" |
#include "fsf_core.h" |
#include "fsf_implementation_specific.h" |
// Configure theses modules by commenting out the appropiate lines |
#include "fsf_hierarchical.h" // |
#include "fsf_shared_objects.h" |
#include "fsf_dynamic_reclaiming.h" // |
#include "fsf_spare_capacity.h" |
//#include "fsf_distributed_services.h" |
#ifndef _FSF_H_ |
#define _FSF_H_ |
#ifndef FSF_HIERARCHICAL_MODULE_SUPPORTED |
#define FSF_HIERARCHICAL_MODULE_SUPPORTED 0 |
#endif //FSF_HIERARCHICAL_MODULE_SUPPORTED |
#ifndef FSF_SHARED_OBJECTS_MODULE_SUPPORTED |
#define FSF_SHARED_OBJECTS_MODULE_SUPPORTED 0 |
#endif //FSF_SHARED_OBJECTS_MODULE_SUPPORTED |
#ifndef FSF_DYNAMIC_RECLAIMING_MODULE_SUPPORTED |
#define FSF_DYNAMIC_RECLAIMING_MODULE_SUPPORTED 0 |
#endif //FSF_DYNAMIC_RECLAIMING_MODULE_SUPPORTED |
#ifndef FSF_SPARE_CAPACITY_MODULE_SUPPORTED |
#define FSF_SPARE_CAPACITY_MODULE_SUPPORTED 0 |
//Return warnings if spare_capacity module is not included: |
//get rid of the pritfs (t.b.d) |
#define fsf_set_contract_reclamation_parameters \ |
(contract, budget_max, period_min, granularity,\ |
utilization_set, quality, importance) \ |
( FSF_WRN_MODULE_NOT SUPPORTED ) |
#define fsf_get_contract_reclamation_parameters \ |
(contract, budget_max, period_min, granularity,\ |
utilization_set, quality, importance) \ |
( FSF_WRN_MODULE_NOT SUPPORTED ) |
#define fsf_request_change_quality_and_importance\ |
(server, new_importance, new_quality) \ |
( FSF_WRN_MODULE_NOT SUPPORTED ) |
#define fsf_get_total_quality (server,total_quality)\ |
( FSF_WRN_MODULE_NOT SUPPORTED ) |
#endif //FSF_SPARE_CAPACITY_MODULE_SUPPORTED |
#ifndef FSF_DISTRIBUTED_SERVICES_MODULE_SUPPORTED |
#define FSF_DISTRIBUTED_SERVICES_MODULE_SUPPORTED 0 |
#else |
//system topology, it is the same in all the |
//nodes involved |
fsf_system_topology_t system = |
{ 1, // number of networks |
{ 1, //network id |
3, //number of nodes |
// in the network |
{ 1, 2, 3, 0, 0 } //node ids |
}, |
{ 0, 0, { 0, 0, 0, 0, 0 } }, |
{ 0, 0, { 0, 0, 0, 0, 0 } }, |
{ 0, 0, { 0, 0, 0, 0, 0 } } |
} |
//this value should be different in each node. |
//But may be modified on-line before starting |
//network/remote negotiations |
fsf_node_id_t local_node_id = 1; |
#endif //FSF_DISTRIBUTED_SERVICES_MODULE_SUPPORTED |
#endif // _FSF_H_ |
/shark/trunk/ports/first/include/fsf_spare_capacity.h |
---|
0,0 → 1,127 |
//fsf_spare_capacity.h |
//=================================================== |
// FFFFFFIII RRRRR SSTTTTTTT |
// FF IIR RR SS |
// FF IR SS |
// FFFFFF RRRR SSSSST |
// FF FI RRR SS |
// FF II RRR SS |
// FF IIIIIR RS |
// |
// FSF(FIRST Scheduling Framework) |
// spare capacity sharing functionality |
//=================================================== |
#include "fsf_basic_types.h" |
#include "fsf_core.h" |
#include "fsf_server.h" |
#include <ll/sys/types.h> |
#ifndef _FSF_SPARE_CAPACITY_H_ |
#define _FSF_SPARE_CAPACITY_H_ |
#define FSF_SPARE_CAPACITY_MODULE_SUPPORTED 1 |
typedef DWORD uint32_t; |
//// The definition of this types is in fsf_basic_types.h |
// |
//// Granularity of spare capacity requirements |
//typedef enum {FSF_CONTINUOUS, FSF_DISCRETE} fsf_granularity_t; |
// |
//// Utilization (budget and period) value |
//typedef struct { |
// struct timespec budget; // Execution time |
// struct timespec period; // Period |
//} fsf_utilization_value_t; |
// |
////List of utilization values |
//typedef struct { |
// int size; // = 0 |
// fsf_utilization_value_t |
// value[FSF_MAX_N_UTILIZATION_VALUES]; |
// //unit change to value..... |
//} fsf_utilization_set_t; |
// |
// |
//// Constants for assigning default values |
//#define FSF_DEFAULT_GRANULARITY FSF_CONTINUOUS |
//#define FSF_DEFAULT_QUALITY 0 |
//#define FSF_DEFAULT_IMPORTANCE 1 |
// |
// |
//// Constants for omitting the assignment of values to specific |
//// arguments in calls to initialization functions |
// |
//#define FSF_NULL_UTILIZATION_SET (fsf_utilization_set_t *)NULL |
// |
//fsf_set_contract_reclamation_parameters: The operation updates the |
//specified contract parameters object by setting its maximum usable |
//budget, minimum period, granularity, utilization set, quality, and |
//importance to the specified input parameters. |
int |
fsf_set_contract_reclamation_parameters |
(fsf_contract_parameters_t *contract, |
const struct timespec *budget_max, |
const struct timespec *period_min, |
fsf_granularity_t granularity, |
const fsf_utilization_set_t *utilization_set, |
int quality, |
int importance); |
//fsf_get_contract_reclamation_parameters: The operation obtains from |
//the specified contract parameters object its granularity, |
//utilization set, quality, and importance. Then copies them to the |
//variables pointed to by the specified input parameters. Only the |
//utilization_values of the utilization_set that are in use, are |
//copied (according to its size field). |
int |
fsf_get_contract_reclamation_parameters |
(const fsf_contract_parameters_t *contract, |
struct timespec *budget_max, |
struct timespec *period_min, |
fsf_granularity_t *granularity, |
fsf_utilization_set_t *utilization_set, |
int *quality, |
int *importance); |
//fsf_request_change_quality_and_importance: The operation enqueues a |
//request to change the quality and importance parameters of the |
//specified server, and returns immediately. The change operation is |
//performed as soon as it is practical; meanwhile the system operation |
//will continue normally. |
int |
fsf_request_change_quality_and_importance |
(fsf_server_id_t server, |
int new_importance, |
int new_quality); |
//fsf_get_total_quality: This operation calculates the sum of the |
//quality parameters for all servers in the system of importance level |
//equal to that of the specified server, and stores it in the variable |
//pointed to by total_quality. |
int |
fsf_get_total_quality |
(fsf_server_id_t server, int *total_quality); |
//fsf_get_available_capacity: This operation stores in the variable |
//pointed to by capacity the spare capacity currently assigned to the |
//importance level of the specified server. The capacity is the number |
//obtained divided by UINT32_MAX, and it represents the processor or |
//network utilization. |
int |
fsf_get_available_capacity ( |
fsf_server_id_t server, uint32_t *capacity); |
#endif // _FSF_SPARE_CAPACITY_H_ |