Subversion Repositories shark

Compare Revisions

Regard whitespace Rev 807 → Rev 808

/shark/trunk/ports/first/include/fsf_contract.h
56,11 → 56,52
fsf_preemption_level_t plevel; // Preemption_Level, range 1..2**32-1
} fsf_critical_section_data_t;
 
 
// Definition of basic types
 
typedef unsigned int fsf_shared_op_id_t;
typedef unsigned int fsf_shared_obj_id_t;
 
// Operations
// The first field contains the id of the related object
// the second field contains an identifier of the operation
// this identifier is unique for the object but needs not to be unique
// for the system. In other words, there can be two operations with the
// same identifier belonging to different shared objects: they are
// effectively two distinct operations; two different operations on the
// same object must have different identifiers
 
typedef struct {
fsf_shared_obj_id_t obj_id; // Object identification
fsf_shared_op_id_t op_id; // Operation Identification
struct timespec wcet; // Execution time
} fsf_shared_operation_t;
 
// Shared object
// the first field is the number of distinct operations on the
// shared object. It is initialized to 0.
// the second field is the id of the object, must be unique in the system.
// the third field is a list of shared operations.
 
 
 
 
typedef struct {
int size; // = 0
fsf_critical_section_data_t section[FSF_MAX_N_CRITICAL_SECTIONS];
} fsf_critical_sections_t;
 
typedef struct {
int size; // = 0
fsf_shared_obj_id_t obj_id; // object id
fsf_shared_operation_t shared_op[FSF_MAX_SHARED_OPERATION];
} fsf_shared_object_t;
 
typedef struct {
int size; // =0
fsf_shared_operation_t operation[FSF_MAX_SHARED_OPERATION];
} fsf_shared_operations_t;
 
typedef int fsf_scheduler_id_t;
 
#define FSF_SCHEDULER_POSIX 0
132,6 → 173,7
// preemption_level => 0; (range 1..2**32-1)
// critical_sections; => size = 0
 
int
fsf_set_contract_basic_parameters
(fsf_contract_parameters_t *contract,
218,6 → 260,8
//Only the utilization_values of the utilization_set that are in use, are
//copied (according to its size field).
 
 
/* OLD VERSION
int
fsf_set_contract_synchronization_parameters
(fsf_contract_parameters_t *contract,
228,6 → 272,8
//object by setting its preemption level and critical sections to the
//specified input parameters.
 
*/
 
int
fsf_get_contract_synchronization_parameters
(const fsf_contract_parameters_t *contract,
523,4 → 569,50
//on-line admission test enabled, or false otherwise.
 
 
// Mutex function
 
// Initialization
// here we initialize the second and third field of the structure
void fsf_init_shared_op(fsf_shared_operation_t *op,
fsf_shared_op_id_t op_id,
struct timespec wcet);
 
// initialization
// The shared object id is set equal to the second parameter.
void fsf_init_shared_object(fsf_shared_object_t *obj,
fsf_shared_obj_id_t id);
 
// Declare an operation
// This function is used to declare that a shared object has
// a synchronized operation on it.
// It checks if another operation with the same id has already been
// declared; if so, return false (-1).
// The obj_id field of the operation is set equal to the shared object id.
// the structure op is copied in the first free element in the array
// shared_op pof the structure obj. If there are no more free element,
// returns -1.
// Returns 0 if the operation has been completed, -1 otherwise.
 
int fsf_declare_shared_object_operation(fsf_shared_object_t *obj,
fsf_shared_operation_t *op);
 
 
int fsf_lock_object(fsf_shared_operation_t *op);
 
int fsf_unlock_object(fsf_shared_operation_t *op);
 
// set contract parameters
// specify a list of operations for each contract
// the list is specified as a pointer to an array.
// the size of the array is specified as third parameter
// returns 0 if all operations are correctly initialized
// returns -1 otherwise.
 
int fsf_set_contract_synchronization_parameters(
fsf_contract_parameters_t *contract,
const fsf_shared_operation_t *shared_ops,
size_t op_num);
 
 
 
#endif // _FSF_CONTRACT_H_