Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 983 → Rev 985

/shark/trunk/ports/first/fsf_include/fsf_hierarchical.h
54,10 → 54,7
//// TABLE_DRIVEN : struct timespec (schedule duration)
//
 
// Constants for assigning default values
#define FSF_DEFAULT_SCHED_POLICY FSF_NONE
 
 
/**
\ingroup hiermodule
 
213,6 → 210,8
@retval FSF_ERR_UNKNOWN_APPSCHEDULED_THREAD if the thread is attached to
an application defined scheduler different than the fsf scheduler
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the referenced server is not valid
@retval FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE: if the kind of workload
of the server is FSF_OVERHEAD
*/
int
fsf_bind_local_thread_to_server
/shark/trunk/ports/first/fsf_include/fsf_opaque_types.h
68,7 → 68,7
 
// utilization_set; => size = 0
// quality => DEFAULT_QUALITY;
// (range 0..100)
// (range 0..2**32-1)
// importance => DEFAULT_IMPORTANCE;
// (range 1..5)
//
/shark/trunk/ports/first/fsf_include/fsf_shared_objects.h
124,9 → 124,8
(remember that the function give back a pointer to a mutex!)
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if obj_handle or mutex are NULL
@retval FSF_ERR_SHARED_OBJ_NOT_INITIALIZED if the shared object identified
by obj_id does not exist
@retval FSF_ERR_BAD_ARGUMENT if obj_handle or mutex are NULL or obj_handle
is not correct or reference a wrong shared object
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
scheduled under the FSF
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or not
/shark/trunk/ports/first/fsf_include/fsf_distributed.h
28,15 → 28,20
 
\ingroup distjmodule
 
This operation identifies a contract as a bandwidth reservation on
the network identified by the network input parameter. Then the
contract negotiation is performed using the conventional
negotiation functions, including the possibility of grouping the
contract with others. If the network_id given is
FSF_NULL_NETWORK_ID, the contract is considered not to reserve
bandwidth in a network but to operate as any other regular
contract. It returns 0 if successful, or FSF_ERR_BAD_ARGUMENT if
contract is null or the network id is not valid.
This operation sets the network id attribute in the contract
pointed to by contract, to the value specified by network_id.
When a contract is negotiated, if network_id is FSF_NULL_NETWORK_ID
(which is the default value) the contract is negotiated for the
processing capacity of the node making the call. If network_id
represents a valid network identifier, the negotiation is carried
out for the specified network.
@param contract the pointer to the contract object
@param [in] network_id the network identifier
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if contract is null or the network
id is not valid.
*/
int
fsf_set_contract_network_id
46,13 → 51,20
/**
 
\ingroup distjmodule
This operation puts the network identification
corresponding to the contract parameters object
pointed to by contract in the variable pointed
to by network_id. If the contract is not a network
one and therefore has not a network_id set, it
puts the FSF_NULL_NETWORK_ID constant instead.
 
This operation puts the network identification corresponding to the
contract parameters object pointed to by contract in the variable
pointed to by network_id. If the contract is a regular one and
therefore has not a network_id set, it puts the FSF_NULL_NETWORK_ID
constant instead. it returns 0 if successful, or
FSF_ERR_BAD_ARGUMENT if any of the pointers is null.
@param [in] contract the pointer to the contract object
@param [out] network_id pointer to the variable that will contain
the network identifier
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if any of the pointers is null.
*/
int
fsf_get_contract_network_id
59,45 → 71,36
(const fsf_contract_parameters_t *contract,
fsf_network_id_t *network_id);
 
 
//Transmission services:
 
//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;
This operation creates a unidirectional input
data endpoint through which, after the
corresponding binding, it is possible to send
data. network_id identifies the network to use,
receiver specifies the communication protocol
dependent information that is necessary to
address the receiving node, and port specifies
the communication protocol dependent information
that is necessary to get in contact with the
desired destination.
 
/**
 
\ingroup distjmodule
 
This operation creates a unidirectional input data endpoint through
which, after the corresponding binding, it is possible to send
data. network_id identifies the network to use, receiver specifies
the communication protocol dependent information that is necessary
to address the receiving node, and port specifies the communication
protocol dependent information that is necessary to get in contact
with the desired destination. It returns 0 if successful. It
returns FSF_ERR_BAD_ARGUMENT if the endpoint is null, if the
network_id is not valid, or if the receiver or the port do not
conform to their expected formats.
@param [in] network_id the identifier ot the network to use
@param [in] receiver protocol dependent information used
to address the receiving node
@param [in] port protocol dependent information used
to get in contact with the desired destination process
@param [out] endpoint pointer to the variable that will
contain the send endpoint
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if endpoint is null, netwok_id
is not valid or if the receiver or the port do not conform
to their expected formats
*/
int
fsf_create_send_endpoint
109,11 → 112,16
/**
\ingroup distjmodule
 
This operation eliminates any resources reserved for the referenced
endpoint. If the endpoint is bound to a network server, it is
unbound from it and can not be further used to invoke send
operations on it. It returns 0 if successful, or
FSF_ERR_BAD_ARGUMENT if the endpoint is not valid.
This operation eliminates any resources reserved
for the referenced endpoint. If the endpoint is
bound to a network server, it is unbound from it
and can not be further used to invoke send
operations on it.
 
@param endpoint pointer to the endpoint to eliminate
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if endpoint is null, or not valid
*/
int
fsf_destroy_send_endpoint
122,11 → 130,26
/**
\ingroup distjmodule
 
This operation returns (except for those NULL arguments) in the
variables pointed to by network_id, receiver, or port, the
corresponding parameters used in the creation of the given send
endpoint. It returns 0 if successful, or FSF_ERR_BAD_ARGUMENT if
the endpoint is not valid.
This operation returns (except for those NULL
arguments) in the variables pointed to by
network_id, receiver, or port, the corresponding
parameters used in the creation of the given
send endpoint.
@param [in] endpoint pointer to the endpoint
@param [out] network_id pointer to variable the will contain
the network id
@param [out] receiver pointer to variable the will contain
the protocol dependent information used to address the
receiving node
@param [out] port pointer to variable the will contain
the protocol dependent information used to get in contact
with the desired destination process
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if endpoint is null, or not valid
or all the other pointers are NULL.
 
*/
int
fsf_get_send_endpoint_parameters
138,17 → 161,26
/**
\ingroup distjmodule
 
This operation associates a send endpoint with a server, which
means that messages sent through that endpoint will consume the
server's reserved bandwidth and its packets will be sent according
to the contract established for that server. If the endpoint is
already bound to another server, it is effectively unbound from it
and bound to the specified one. The operation returns 0 if
successful, or FSF_ERR_BAD_ARGUMENT if the endpoint or the server
are not valid, it also fails with a value of FSF_ERR_ALREADY_BOUND
if the server is already bound to some other send endpoint. It
fails with FSF_ERR_WRONG_NETWORK if the server network id is not
the same as the one in the endpoint */
This operation associates a send endpoint with a
server, which means that messages sent through
that endpoint will consume the server's reserved
bandwidth and its packets will be sent according
to the contract established for that server. If
the endpoint is already bound to another server,
it is effectively unbound from it and bound to
the specified one.
 
@param [in] server server id
@param endpoint pointer to the endpoint
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if endpoint is null, or not valid
or server is not valid.
@retval FSF_ERR_ALREADY_BOUND if the server is already
bound to some other send endpoint
@retval FSF_ERR_WRONG_NETWORK if the server network id
is not the same as the one in the endpoint
*/
int
fsf_bind_endpoint_to_server
(fsf_server_id_t server,
157,11 → 189,19
/**
\ingroup distjmodule
 
This operation unbinds a send endpoint from a server Endpoints with
no server associated cannot be used to send data, and they stay in
that state until they are either eliminated or bound again. The
operation fails with FSF_ERR_NOT_BOUND if the endpoint has no
server bound */
This operation unbinds a send endpoint from a
server. Endpoints with no server associated
cannot be used to send data, and they stay in
that state until they are either eliminated or
bound again.
@param endpoint pointer to the endpoint to unbind
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if endpoint is null, or not valid
@retval FSF_ERR_NOT_BOUND if the endpoint has no server
bound
*/
int
fsf_unbind_endpoint_from_server
(fsf_send_endpoint_t *endpoint);
169,11 → 209,17
/**
\ingroup distjmodule
 
This operation copies the id of the server that
is bound to the specified send endpoint into the
variable pointed to by server. It returns 0 if
successful, or FSF_ERR_BAD_ARGUMENT if the
endpoint is not valid or server is NULL
This operation copies the id of the server that
is bound to the specified send endpoint into the
variable pointed to by server.
 
@param [in] endpoint pointer to the endpoint
@param [out] server pointer to variable the will contain
the server id
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if endpoint is null, or not valid
or server is NULL.
*/
int
fsf_get_endpoint_server
184,18 → 230,27
/**
\ingroup distjmodule
 
This operation sends a message stored in msg and of length size
through the given endpoint. The operation is non-blocking and
returns immediately. An internal fsf service will schedule the
sending of messages and implement the communications sporadic
server corresponding to the network server bound to the given
endpoint. Messages sent through the same endpoint are received in
the same order in which they were sent It returns 0 if successful,
but it fails with FSF_ERR_BAD_ARGUMENT if endpoint is not valid; it
fails with FSF_ERR_NOT_BOUND is not bound to a valid server; it
fails with FSF_ERR_TOO_LARGE if the message is too large for the
network protocol; it fails with FSF_ERR_BUFFER_FULL if the sending
queue is full */
This operation sends a message stored in msg and of length size
through the given endpoint. The operation is non-blocking and
returns immediately. An internal fsf service will schedule the
sending of messages and implement the communications sporadic server
corresponding to the network server bound to the given endpoint.
Messages sent through the same endpoint are received in the same
order in which they were sent
 
@param endpoint pointer to the endpoint
@param [in] msg pointer to the message
@param [in] size number of bytes to transmitt
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if endpoint is null, or not valid
or msg is NULL
@retval FSF_ERR_NOT_BOUND if endpoint is not bound to a valid
server;
@retval FSF_ERR_TOO_LARGE if the message is too large for the
network protocol
@retval FSF_ERR_BUFFER_FULL if the sending queue is full
*/
int
fsf_send
(const fsf_send_endpoint_t *endpoint,
205,11 → 260,20
/**
\ingroup distjmodule
 
This operation creates a receive endpoint with all the information
that is necessary to receive information from the specified network
and port It returns 0 if successful, but it fails with
FSF_ERR_BAD_ARGUMENT if the port or the network id are not
valid. */
This operation creates a receive endpoint with all the information
that is necessary to receive information from the specified network
and port
@param [in] network_id the identifier ot the network to use
@param [in] port protocol dependent information used
to identify the calling process as an expecting destination
@param [out] endpoint pointer to the variable that will
contain the receive endpoint
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if endpoint is null, network_id
is not valid or if port do not conform to the expected format
*/
int
fsf_create_receive_endpoint
(fsf_network_id_t network_id,
219,20 → 283,30
/**
\ingroup distjmodule
 
If there are no messages available in the specified receive
endpoint this operation blocks the calling thread waiting for a
message to be received. When a message is available, if its size is
less than or equal to the buffersize, the function stores it in the
variable pointed to by buffer and puts the number of bytes received
in the variable pointed to by messagesize. The function fails with
FSF_ERR_NO_SPACE if the buffersize is too small for the message
received (in which case the message is lost), or with
FSF_ERR_BAD_ARGUMENT if the endpoint is not valid, or if buffer or
messagesize are NULL. Messages arriving at a receiver buffer that
is full will be silently discarded. The application is responsible
of reading the receive endpoints with appropriate regularity, or of
using a sequence number or some other mechanism to detect any lost
messages.*/
If there are no messages available in the specified receive endpoint
this operation blocks the calling thread waiting for a message to be
received. When a message is available, if its size is less than or
equal to the buffersize, the function stores it in the variable
pointed to by buffer and puts the number of bytes received in the
variable pointed to by messagesize. Messages arriving at a receiver
buffer that is full will be silently discarded. The application is
responsible of reading the receive endpoints with appropriate
regularity, or of using a sequence number or some other mechanism
to detect any lost messages.
@param endpoint pointer to the endpoint
@param [out] buffer pointer to the place that will contain
the message received
@param [in] buffersize size of the buffer space
@param [out] messagesize pointer to the variable that will contain
the number of bytes received
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if endpoint is null, or not valid
or if buffer or messagesize are NULL.
@retval FSF_ERR_NO_SPACE if the buffersize is too small for the
message received (in which case the message is lost).
*/
int
fsf_receive
(const fsf_receive_endpoint_t *endpoint,
243,10 → 317,26
/**
\ingroup distjmodule
 
This operation is the same as fsf_receive, except that if there are
no messages available in the specified receive endpoint at the time
of the call the operation returns with an error of
FSF_ERR_NO_MESSAGES */
This operation is the same as fsf_receive, except
that if there are no messages available in the
specified receive endpoint at the time of the call
the operation returns with an error
 
@param endpoint pointer to the endpoint
@param [out] buffer pointer to the place that will contain
the message received
@param [in] buffersize size of the buffer space
@param [out] messagesize pointer to the variable that will contain
the number of bytes received
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if endpoint is null, or not valid
or if buffer or messagesize are NULL.
@retval FSF_ERR_NO_SPACE if the buffersize is too small for the
message received (in which case the message is lost).
@retval FSF_ERR_NO_MESSAGES if there are no messages available
in the specified receive endpoint at the time of the call
*/
int
fsf_try_receive
(const fsf_receive_endpoint_t *endpoint,
257,26 → 347,73
/**
\ingroup distjmodule
 
This operation is used to calculate the minimum and/or maximum
budgets used in the preparation of network contracts. It puts in
the variable pointed to by budget the transmission time that it
takes to send a message of size msg_size through the network
designated by network_id, when there is no contention, but
including any network overheads It returns FSF_ERR_BAD_ARGUMENT if
network_id is not a valid identifier or if budget is a NULL
pointer.*/
int
fsf_tx_time
(fsf_network_id_t network_id,
size_t msg_size,
struct timespec *budget);
This operation is used to calculate a budget represented as
a time magnitude, for a specified network. If succesful, the
operation puts in the variable pointed to by budget the
transmission time that it takes to send a packet through the
network designated by network_id, when there is no contention,
but including any network overheads.
 
@param [in] network_id the identifier ot the network to use
@param [out] budget pointer to the variable tha will contain
the time it takes to transmitt a packet
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if network_id is not a valid
network identifier of if budget is a NULL pointer
*/
int
fsf_packet_tx_time
(fsf_network_id_t network_id,
struct timespec *budget);
 
/**
\ingroup distjmodule
 
This operation is used to obtain the maximum message size for the
specified network It returns FSF_ERR_BAD_ARGUMENT if network_id is
not a valid identifier or if max_msg_size is NULL */
This operation puts in the variable pointed to by
packet_size the maximum number of bytes that can be sent
in a packet through the network designated by network_id.
It is usually a configuration value and it helps the user
application to calculate the number of packets it will
need to reserve for the periodic transmision of its
messages and prepare the corresponding contracts.
 
@param [in] network_id the identifier ot the network to use
@param [out] packet_size pointer to the variable tha will contain
the maximum size in bytes of a packet
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if network_id is not a valid
network identifier of if packet_size is a NULL pointer
*/
int
fsf_packet_size
(fsf_network_id_t network_id,
size_t *packet_size);
 
 
/**
\ingroup distjmodule
 
This operation is used to obtain the maximum number of
packets of which a message can be formed, for the
specified network. A message is defined as the piece of
information used in a send operation. Since the value
returned by this operation is measured in packet units,
the effective size can be calculated multiplying this
value by the size of a packet. When the value returned by
this operation is larger than 1 it means the
implementation will make the partition of messages into
packets and its recomposition at the receiving node.
 
@param [in] network_id the identifier ot the network to use
@param [out] max_msg_size pointer to the variable tha will contain
the maximum number of packets sent in a single send operation
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if network_id is not a valid
network identifier of if max_msg_size is a NULL pointer
*/
int
fsf_max_message_size
(fsf_network_id_t network_id,
283,4 → 420,5
size_t *max_msg_size);
 
 
 
#endif // _FSF_DISTRIBUTED_H_
/shark/trunk/ports/first/fsf_include/fsf_basic_types.h
53,6 → 53,51
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
//
84,7 → 129,16
#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
//
135,6 → 189,7
// following:
// FP: int (priority)
// EDF: struct timespec (deadline)
// RR: none
// TABLE_DRIVEN : struct fsf_table_driven_params_t
 
 
157,8 → 212,13
// 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
//
170,7 → 230,32
#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
 
180,7 → 265,7
#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_THREAD 0x02004007
#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
/shark/trunk/ports/first/fsf_include/fsf_spare_capacity.h
26,11 → 26,6
#define FSF_SPARE_CAPACITY_MODULE_SUPPORTED 1
 
 
#define FSF_MAX_QUALITY 100
#define FSF_MIN_QUALITY 0
#define FSF_MAX_IMPORTANCE 5
#define FSF_MIN_IMPORTANCE 1
 
//// The definition of this types is in fsf_basic_types.h
//
//// Granularity of spare capacity requirements
/shark/trunk/ports/first/fsf_include/fsf_core.h
91,13 → 91,6
set its parameters.
*/
/*@{*/
/**
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;
 
/**
The operation receives a pointer to a contract parameters object
108,7 → 101,7
- the workload is unbounded (FSF_INDETERMINATE);
- the server deadline is equal to the period;
- the budget and deadline overrun are not notified;
- the granularity is set to "continuous";
- the granularity is set to "continuous" (FSF_CONTINUOUS);
- the quality and importance are set to the default values;
- the scheduling policy is FSF_NONE.
 
132,8 → 125,8
//
// granularity => DEFAULT_GRANULARITY;
// utilization_set; => size = 0
// quality => DEFAULT_QUALITY; (range 0..100)
// importance => DEFAULT_IMPORTANCE; (range 1..5)
// quality => DEFAULT_QUALITY; (0, range 0..2**32-1)
// importance => DEFAULT_IMPORTANCE; (1, range 1..5)
//
// preemption_level => 0; (range 1..2**32-1)
// critical_sections; => size = 0
140,8 → 133,11
 
// sched_policy => DEFAULT_SCHED_POLICY
// (FSF_NONE)
// network_id => FSF_NULL_NETWORK_ID;
// (0)
// granted_capacity_flag => false;
 
 
/**
The operation updates the specified contract parameters object by
setting its budget, period, and workload to the specified input
159,7 → 155,7
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if any of the pointers is NULL
or if only one of the timespec values is 0, and also if the workload
is not a proper value (FSF_INDETERMINATE or FSF_BOUNDED)
is not a proper value (FSF_INDETERMINATE, FSF_BOUNDED or FSF_OVERHEAD)
*/
int
fsf_set_contract_basic_parameters
273,6 → 269,13
 
\defgroup core_synch Synchronization objects
 
An abstract synchronization object is defined by the application.
This object can be used by an application to wait for an event to
arrive by invoking the fsf_schedule_triggered_job() operation. It
can also be used to signal the event either causing a waiting
server to wake up, or the event to be queued if no server is
waiting for it.
 
These objects are used to synchronize threads belonging to bounded
workload servers.
 
288,15 → 291,6
 
*/
/*@{*/
/**
An abstract synchronization object is defined by the application.
This object can be used by an application to wait for an event to
arrive by invoking the fsf_schedule_triggered_job() operation. It
can also be used to signal the event either causing a waiting
server to wake up, or the event to be queued if no server is
waiting for it.
*/
typedef FSF_SYNCH_OBJ_HANDLE_T_OPAQUE fsf_synch_obj_handle_t;
 
 
/**
440,11 → 434,13
main scheduler
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is
not scheduled under the FSF
@retval FSF_ERR_UNBOUND if the calling thread does not have a valid
@retval FSF_ERR_NOT_BOUND if the calling thread does not have a valid
server bound to it
@retval FSF_ERR_BAD_ARGUMENT if the workload of the server is not
FSF_BOUNDED
@retval FSF_ERR_BAD_ARGUMENT if abs_time is NULL
@retval FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE if the kind of workload of
the server is not FSF_BOUNDED
 
 
@sa fsf_schedule_triggered_job, fsf_timed_schedule_triggered_job
*/
int
507,7 → 503,8
taken.
 
@retval 0 if the operation is succesful
@retval FSF_ERR_INVALID_SYNCH_OBJ_HANDLE if the handle is not valid
@retval FSF_ERR_INVALID_SYNCH_OBJ_HANDLE if the synch_handle is not valid
@retval FSF_ERR_BAD_ARGUMENT if synch_handle is 0
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or not
running
@retval FSF_ERR_INTERNAL_ERROR erroneous binding or malfunction of
514,10 → 511,10
the FSF main scheduler
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread
is not scheduled under the FSF
@retval FSF_ERR_UNBOUND if the calling thread does not have
@retval FSF_ERR_NOT_BOUND if the calling thread does not have
a valid server bound to it
@retval FSF_ERR_BAD_ARGUMENT if the workload of the server is not
FSF_BOUNDED or the synch_handle given is not valid
@retval FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE: if the kind of workload
of the server is not FSF_BOUNDED
 
@sa fsf_schedule_triggered_job, fsf_schedule_timed_job
 
536,6 → 533,7
absolute timeout. The timed_out argument, indicates whether the
function returned because of a timeout or not
 
@retval FSF_ERR_INVALID_SYNCH_OBJ_HANDLE if the synch_handle is not valid
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or
not running
@retval FSF_ERR_INTERNAL_ERROR erroneous binding or malfunction
542,11 → 540,12
of the FSF main scheduler
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is
not scheduled under the FSF
@retval FSF_ERR_UNBOUND if the calling thread does not have a valid
@retval FSF_ERR_NOT_BOUND if the calling thread does not have a valid
server bound to it
@retval FSF_ERR_BAD_ARGUMENT if the workload of the server is not
FSF_BOUNDED, the synch_handle given is not valid or the abs_timeout
argument is NULL or its value is in the past
@retval FSF_ERR_BAD_ARGUMENT if synch_handle is 0, or the abs_timeout
argument is NULL, or its value is in the past
@retval FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE: if the kind of workload
of the server is not FSF_BOUNDED
 
@see fsf_schedule_triggered_job
*/
577,18 → 576,7
*/
/*@{*/
 
/**
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 *);
 
/**
The operation negotiates a contract for a new server. If the
on-line admission test is enabled it determines whether the
620,6 → 608,10
under the FSF
@retval FSF_ERR_BAD_ARGUMENT if the contract or server arguments
are NULL
@retval FSF_ERR_TOO_MANY_SERVERS if there is no space for more servers
(the maximum number of them is already
reached)
@retval FSF_ERR_CONTRACT_REJECTED if the contract is rejected
*/
int
fsf_negotiate_contract
642,7 → 634,7
 
The server is created with the FSF_NONE scheduling policy, which
means no hierarchical scheduling, and only one thread per server,
except for the case of background tasks (see below)
except for the case of background tasks.
 
If the contract is rejected, the thread is not created and the
corresponding error is returned.
657,7 → 649,9
 
@retval FSF_ERR_BAD_ARGUMENT if the contract or server arguments are NULL
@retval FSF_ERR_CONTRACT_REJECTED if the contract is rejected
@retval FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE if the kind of workload
in the contract is FSF_OVERHEAD
@retval others it may also return all the errors that may be returned
by the pthread_create()POSIX function call
 
680,7 → 674,7
 
The server is created with the FSF_NONE scheduling policy, which
means no hierarchical scheduling, and only one thread per server,
except for the case of background tasks (see below)
except for the case of background tasks.
 
Implementation dependent issue: In order to allow the usage of
application defined schedulers, the calling thread must not have
699,6 → 693,8
@retval FSF_ERR_BAD_ARGUMENT if the contract or server arguments
are NULL
@retval FSF_ERR_CONTRACT_REJECTED if the contract is rejected.
@retval FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE if the kind of workload
in the contract is FSF_OVERHEAD
*/
int
fsf_negotiate_contract_for_myself
731,8 → 727,10
expected format or valid range or the given thread does not exist
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the referenced server
is not valid
@retval FSF_ERR_ALREADY_BOUND if the thread is already bound to
another server.
@retval FSF_ERR_ALREADY_BOUND if the given server has a thread
already bound
@retval FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE if the kind of workload
in the contract is FSF_OVERHEAD
 
*/
int
781,7 → 779,7
@retval 0 if the operation is succesful
@return FSF_ERR_NOT_SCHEDULED_THREAD if the given thread is not scheduled
under the FSF
@return FSF_ERR_UNBOUND if the given thread does not have a valid
@return FSF_ERR_NOT_BOUND if the given thread does not have a valid
server bound to it
@return FSF_ERR_BAD_ARGUMENT if the given thread does not exist or the
server argument is NULL
859,6 → 857,7
running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server of the calling thread
has been cancelled or it is not valid
@retval FSF_ERR_REJECTED_CONTRACT if the renegotiation fails
*/
int
fsf_renegotiate_contract
913,14 → 912,6
union sigval sig_value);
 
/**
Possible values returned by fsf_get_renegotiation_status
*/
typedef enum {FSF_IN_PROGRESS,
FSF_REJECTED,
FSF_ADMITTED}
fsf_renegotiation_status_t;
 
/**
The operation reports on the status of the last renegotiation
operation enqueued for the specified server. It is callable even
after notification of the completion of such operation, if
945,21 → 936,11
fsf_renegotiation_status_t *renegotiation_status);
 
 
//Data types
////////////////////////////////////////////////////////////////////////
// CHANGE OF MODE: GROUPS OF CONTRACTS
////////////////////////////////////////////////////////////////////////
 
/// 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;
 
 
/**
This operation analizes the schedulability of the context that
results from negitiating the contracts specified in the
/shark/trunk/ports/first/fsf_include/fsf_configuration_parameters.h
43,7 → 43,7
// Maximum number of critical sections that can be stored in a
// contract parameters object
 
#define FSF_MAX_N_CRITICAL_SECTIONS 10
#define FSF_MAX_N_CRITICAL_SECTIONS 25
 
 
// Maximum number of utilization values (pairs of budget and period)
86,7 → 86,7
// thread, and it should be at least 1 level below the maximum of the
// system
 
#define FSF_SCHEDULER_PRIORITY 104
#define FSF_SCHEDULER_PRIORITY 29
 
 
// Real-time signal number reserved for the application scheduler to
124,12 → 124,12
 
// Initial period of the service thread (timespec)
 
#define FSF_SERVICE_THREAD_PERIOD {0,10000000} //0.1 seg //3.1 0.01
#define FSF_SERVICE_THREAD_PERIOD {0,10000000} //0.01 seg //3.1 0.01
 
 
// Initial budget of the service thread (timespec)
 
#define FSF_SERVICE_THREAD_BUDGET {0,1000000} //0.01 seg //3.1 0.001
#define FSF_SERVICE_THREAD_BUDGET {0,1000000} //0.001 seg //3.1 0.001
 
 
// Initial priority of the service thread, it has to be lower than the
155,7 → 155,7
 
//Maximum number of pending replenishments in each sporadic server
 
#define FSF_MAX_N_PENDING_REPLENISHMENTS 1050 //25
#define FSF_MAX_N_PENDING_REPLENISHMENTS 250
 
 
//Maximum number of target windows in a table driven schedule
184,4 → 184,18
#define FSF_MAX_SIZE_SHARED_OBJ_ID 65
 
 
//Maximum number of networks accesible from a node
 
#define FSF_MAX_N_NETWORK_IDS 1
 
//Maximum number of servers that can be given in a servers list
//to the group negotiation/cancellation primitive
 
#define FSF_MAX_N_SERVER_VALUES 10
 
//Maximum number of contracts that can be given in a contracts list
//to the group negotiation/cancellation primitive
 
#define FSF_MAX_N_CONTRACT_VALUES 10
 
#endif /* _FSF_CONFIGURATION_PARAMETERS_H_ */
/shark/trunk/ports/first/fsf_include/fsf_implementation_specific.h
1,92 → 1,117
//fsf_implementation_specific.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)
//implementation-defined optional functionality
//================================================
 
#include "fsf_basic_types.h"
#include "fsf_core.h"
 
 
#ifndef _FSF_IMPLEMENTATION_SPECIFIC_H_
#define _FSF_IMPLEMENTATION_SPECIFIC_H_
 
#define FSF_IMPLEMENTATION_SPECIFIC_MODULE_SUPPORTED 1
 
 
// The operations defined in this module are of optional use. They
// only work in the fixed priority implementation, and they may be
// used to enhance the behavior of the applications running under the
// fsf scheduler.
 
//// The definition of this type is in fsf_basic_types.h
//
//typedef unsigned long fsf_preemption_level_t;
// // range 1..2**32-1
 
 
//fsf_set_contract_preemption_level: The operation updates the
//specified contract parameters object by setting its preemption level
//to the specified input parameter.
 
int
fsf_set_contract_preemption_level
(fsf_contract_parameters_t *contract,
fsf_preemption_level_t preemption_level);
 
 
//fsf_get_contract_preemption_level: The operation obtains from the
//specified contract parameters object its preemption level and copies
//it to the place pointed to by the specified input parameter.
 
int
fsf_get_contract_preemption_level
(const fsf_contract_parameters_t *contract,
fsf_preemption_level_t *preemption_level);
 
 
//fsf_set_service_thread_preemption_level: this function sets the
//preemption level of the service thread to the specified value. The
//initial preemption level is a configurable parameter
 
int
fsf_set_service_thread_preemption_level
(fsf_preemption_level_t preemption_level);
 
//fsf_get_service_thread_preemption_level: this function stores the
//current preemption level of the service thread in the variable
//pointed to by preemption_level
 
int
fsf_get_service_thread_preemption_level
(fsf_preemption_level_t *preemption_level);
 
 
//fsf_thread_exit: There is a limitation in the current version of the
//MaRTE implementation that causes the information of a terminated
//thread to continue to be stored in the fsf scheduler, and the thread
//to continue to be counted in the number of threads. The
//fsf_thread_exit operation allows the implementation to delete the
//thread's information, and then terminate the thread. Therefore, it
//is recommended to use this function to terminate a thread under fsf.
 
//This operation shall terminate the calling thread, make the value
//value_ptr available to any successful join with the terminating
//thread, and unbind the thread from its associated server. After
//cleaning up the thread management data, it is unbound and the
//scheduling policy is changed to fixed priority before the posix
//pthread_exit() function is called.
 
void
fsf_thread_exit (void *value_ptr);
 
 
#endif // _FSF_IMPLEMENTATION_SPECIFIC_H_
//fsf_implementation_specific.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)
//implementation-defined optional functionality
//================================================
 
#include "fsf_basic_types.h"
#include "fsf_core.h"
 
 
#ifndef _FSF_IMPLEMENTATION_SPECIFIC_H_
#define _FSF_IMPLEMENTATION_SPECIFIC_H_
 
#define FSF_IMPLEMENTATION_SPECIFIC_MODULE_SUPPORTED 1
 
 
// The operations defined in this module are of optional use. They
// only work in the fixed priority implementation, and they may be
// used to enhance the behavior of the applications running under the
// fsf scheduler.
 
//// The definition of this type is in fsf_basic_types.h
//
//typedef unsigned long fsf_preemption_level_t;
// // range 1..2**32-1
 
 
//fsf_set_contract_preemption_level: The operation updates the
//specified contract parameters object by setting its preemption level
//to the specified input parameter.
 
int
fsf_set_contract_preemption_level
(fsf_contract_parameters_t *contract,
fsf_preemption_level_t preemption_level);
 
 
//fsf_get_contract_preemption_level: The operation obtains from the
//specified contract parameters object its preemption level and copies
//it to the place pointed to by the specified input parameter.
 
int
fsf_get_contract_preemption_level
(const fsf_contract_parameters_t *contract,
fsf_preemption_level_t *preemption_level);
 
 
//fsf_set_service_thread_preemption_level: this function sets the
//preemption level of the service thread to the specified value. The
//initial preemption level is a configurable parameter
 
int
fsf_set_service_thread_preemption_level
(fsf_preemption_level_t preemption_level);
 
//fsf_get_service_thread_preemption_level: this function stores the
//current preemption level of the service thread in the variable
//pointed to by preemption_level
 
int
fsf_get_service_thread_preemption_level
(fsf_preemption_level_t *preemption_level);
 
 
//fsf_thread_exit: There is a limitation in the current version of the
//MaRTE implementation that causes the information of a terminated
//thread to continue to be stored in the fsf scheduler, and the thread
//to continue to be counted in the number of threads. The
//fsf_thread_exit operation allows the implementation to delete the
//thread's information, and then terminate the thread. Therefore, it
//is recommended to use this function to terminate a thread under fsf.
 
//This operation shall terminate the calling thread, make the value
//value_ptr available to any successful join with the terminating
//thread, and unbind the thread from its associated server. After
//cleaning up the thread management data, it is unbound and the
//scheduling policy is changed to fixed priority before the posix
//pthread_exit() function is called.
 
void
fsf_thread_exit (void *value_ptr);
 
 
//fsf_set_shared_obj_preemption_level: The operation updates the
//specified shared object by setting its preemption level
//to the specified input parameter.
//OBSERVATION: if this value is changed being any contract that
//uses the resource already accepted, the system's behavior and
//particularly the acceptance tests correctness are not garantee
//and probably wrong.
 
int
fsf_set_shared_obj_preemption_level
(fsf_shared_obj_handle_t obj_handle,
fsf_preemption_level_t preemption_level);
 
 
//fsf_get_shared_obj_preemption_level: The operation obtains from the
//specified shared object its preemption level and copies
//it to the place pointed to by the specified input parameter.
 
int
fsf_get_shared_obj_preemption_level
(fsf_shared_obj_handle_t obj_handle,
fsf_preemption_level_t *preemption_level);
 
 
 
#endif // _FSF_IMPLEMENTATION_SPECIFIC_H_