Rev 971 |
Rev 993 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
//fsf_basic_types.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
//
// Basic FSF(FIRST Scheduling Framework) common types
//=======================================================================
//
#include <time.h>
#include "fsf_opaque_types.h"
#include "fsf_configuration_parameters.h"
#ifndef _FSF_BASIC_TYPES_H_
#define _FSF_BASIC_TYPES_H_
// Definition of types and constants used in fsf modules
//
// Types for the core module
//
// Kind of workload expected in servers
typedef enum {FSF_BOUNDED, FSF_INDETERMINATE, FSF_OVERHEAD} fsf_workload_t;
// Constants for assigning default values
#define FSF_DEFAULT_WORKLOAD FSF_INDETERMINATE
#define FSF_DEFAULT_D_EQUALS_T false
#define FSF_DEFAULT_DEADLINE {0,0} //struct timespec
// Constants for omitting the assignment of values
// to specific arguments in calls to
// initialization functions
#define FSF_NULL_DEADLINE (struct timespec *)NULL
#define FSF_NULL_SIGNAL 0
/**
Possible values returned by fsf_get_renegotiation_status
*/
typedef enum {FSF_IN_PROGRESS,
FSF_REJECTED,
FSF_ADMITTED,
FSF_NOT_REQUESTED}
fsf_renegotiation_status_t;
/**
Contract parameters type; it is an opaque type (i.e. the internal
structure of this data type is implementation dependent). The user
can access and modify the parameters of a contract only with the
proper functions, and should never access the data directly.
*/
typedef FSF_CONTRACT_PARAMETERS_T_OPAQUE fsf_contract_parameters_t;
/**
Synchronization object handle type, this an opaque type
used to signaling of servers
*/
typedef FSF_SYNCH_OBJ_HANDLE_T_OPAQUE fsf_synch_obj_handle_t;
/**
Server Id type, that identifies a server created to manage a given
contract
*/
typedef int fsf_server_id_t; // => 0
/**
The type references a function that may become a thread's
code
*/
typedef void * (*fsf_thread_code_t) (void *);
/// List of contracts to negotiate
typedef struct {
int size;
fsf_contract_parameters_t* contracts[FSF_MAX_N_SERVERS];
} fsf_contracts_group_t;
/// List of servers to cancel
typedef struct {
int size;
fsf_server_id_t servers[FSF_MAX_N_SERVERS];
} fsf_servers_group_t;
//
// Types for the spare capacity module
//
// 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];
} 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
// Constants used in the specification of the spare capacity
// operations
#define FSF_MAX_QUALITY (2**32 -1)
#define FSF_MIN_QUALITY 0
#define FSF_MAX_IMPORTANCE FSF_N_IMPORTANCE_LEVELS
#define FSF_MIN_IMPORTANCE 1
//
// Types for the implementation specific module
//
//Implementation specific preemption level values
typedef unsigned long fsf_preemption_level_t;
// range 1..2**32-1
//
// Types for the shared objects module
//
// 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;
//
// Types for the hierarchical module
//
// Scheduling policies
typedef enum {FSF_FP, FSF_EDF, FSF_TABLE_DRIVEN, FSF_RR, FSF_NONE}
fsf_sched_policy_t;
// Scheduling policy and parameters
typedef struct {
fsf_sched_policy_t policy;
void * params;
} fsf_sched_params_t;
// The params member is a pointer to one of the
// following:
// FP: int (priority)
// EDF: struct timespec (deadline)
// RR: none
// TABLE_DRIVEN : struct fsf_table_driven_params_t
//Scheduling parameters for the table-driven policy
//list of target windows
typedef struct fsf_target_window {
struct timespec start;
struct timespec end;
struct timespec comp_time;
} fsf_target_window;
typedef struct {
int size;
fsf_target_window table[FSF_MAX_N_TARGET_WINDOWS];
} fsf_table_driven_params_t;
//Initialization information for a scheduling policy
typedef void * fsf_sched_init_info_t;
// It shall be one of the following:
// FP: none
// EDF: none
// RR: struct timespec (slice duration)
// TABLE_DRIVEN : struct timespec (schedule duration)
// Constant for assigning default values
#define FSF_DEFAULT_SCHED_POLICY FSF_NONE
//
// Types for the distributed services module
//
// Type designating the network ids. They need not
// be sequential numbers.
typedef unsigned int fsf_network_id_t;
#define FSF_DEFAULT_NETWORK_ID 1
#define FSF_NULL_NETWORK_ID 0
//opaque types for fsf endpoints
typedef FSF_SEND_ENDPOINT_T_OPAQUE fsf_send_endpoint_t;
typedef FSF_RECEIVE_ENDPOINT_T_OPAQUE fsf_receive_endpoint_t;
/**
\ingroup distjmodule
The node_address type specifies the node address in a
communication-protocol-independent way. The actual address is
obtained via a configuration dependent mapping function
*/
typedef unsigned int fsf_node_address_t;
/**
\ingroup distjmodule
The port type specifies the information that is necessary to get in
contact with the thread in the receiving node, in a
protocol-independent way. The actual port number is obtained via a
configuration dependent mapping function
*/
typedef unsigned int fsf_port_t;
// Error codes
#define FSF_ERR_BASE_VALUE 0x02004000
#define FSF_ERR_TOO_MANY_TASKS 0x02004001
#define FSF_ERR_BAD_ARGUMENT 0x02004002
#define FSF_ERR_INVALID_SYNCH_OBJ_HANDLE 0x02004003
#define FSF_ERR_NO_RENEGOTIATION_REQUESTED 0x02004004
#define FSF_ERR_CONTRACT_REJECTED 0x02004005
#define FSF_ERR_NOT_SCHEDULED_CALLING_THREAD 0x02004006
#define FSF_ERR_NOT_BOUND 0x02004007
#define FSF_ERR_UNKNOWN_SCHEDULED_THREAD 0x02004008
#define FSF_ERR_NOT_CONTRACTED_SERVER 0x02004009
#define FSF_ERR_NOT_SCHEDULED_THREAD 0x0200400A
#define FSF_ERR_TOO_MANY_SERVICE_JOBS 0x0200400B
#define FSF_ERR_TOO_MANY_SYNCH_OBJS 0x0200400C
#define FSF_ERR_TOO_MANY_SERVERS_IN_SYNCH_OBJ 0x0200400D
#define FSF_ERR_TOO_MANY_EVENTS_IN_SYNCH_OBJ 0x0200400E
#define FSF_ERR_INTERNAL_ERROR 0x0200400F
#define FSF_ERR_TOO_MANY_SERVERS 0x02004010
#define FSF_ERR_INVALID_SCHEDULER_REPLY 0x02004011
#define FSF_ERR_TOO_MANY_PENDING_REPLENISHMENTS 0x02004012
#define FSF_ERR_SYSTEM_ALREADY_INITIALIZED 0x02004013
#define FSF_ERR_SHARED_OBJ_ALREADY_INITIALIZED 0x02004014
#define FSF_ERR_SHARED_OBJ_NOT_INITIALIZED 0x02004015
#define FSF_ERR_SCHED_POLICY_NOT_COMPATIBLE 0x02004016
#define FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE 0x02004017
#define FSF_ERR_ALREADY_BOUND 0x02004018
#define FSF_ERR_WRONG_NETWORK 0x02004019
#define FSF_ERR_TOO_LARGE 0x0200401A
#define FSF_ERR_BUFFER_FULL 0x0200401B
#define FSF_ERR_NO_SPACE 0x0200401C
#define FSF_ERR_NO_MESSAGES 0x0200401D
#define FSF_WRN_MODULE_NOT_SUPPORTED 0x0200401E
#define FSF_ERR_SYSTEM_NOT_INITIALIZED 0x0200401F
#define FSF_ERR_TOO_MANY_SHARED_OBJS 0x02004020
#define FSF_ERR_LAST_VALUE 0x02004020
#endif // _FSF_BASIC_TYPES_H_