Data Structures | Typedefs | Functions

sart.h File Reference

#include "srterrno.h"
#include "srttypes.h"
Include dependency graph for sart.h:

Go to the source code of this file.

Data Structures

struct  srt_data_attr
struct  srt_task_attr
struct  srt_job_attr

Typedefs

typedef bool(* schd_checker )(const float u, const u_int n)

Functions

SRT_DATA * srt_data_create (const char *label, const char *kind)
srt_status srt_data_set_attr (SRT_DATA *data, srt_data_attr attr)
srt_status srt_data_get_attr (SRT_DATA *data, srt_data_attr *pattr)
SRT_RESOURCE * srt_res_create (const char *label, bool available)
srt_status srt_res_add_provision (SRT_RESOURCE *res, SRT_DATA *data)
srt_status srt_res_set_attr (SRT_RESOURCE *res, bool available)
SRT_JOB * srt_job_create (const char *label, SRT_POLICY policy)
srt_status srt_job_add_data (SRT_JOB *job, SRT_DATA *data)
srt_status srt_job_remove_data (SRT_JOB *job, SRT_DATA *data)
srt_status srt_job_add_task (SRT_JOB *job, SRT_TASK *task)
srt_status srt_job_remove_task (SRT_JOB *job, SRT_TASK *task)
srt_status srt_job_set_attr (SRT_JOB *job, srt_job_attr attr)
srt_status srt_job_get_attr (SRT_JOB *job, srt_job_attr *pattr)
SRT_DISJUNCTION * srt_disj_create (const char *label)
srt_status srt_disj_add_data (SRT_DISJUNCTION *disj, SRT_DATA *data)
srt_status srt_disj_add_disj (SRT_DISJUNCTION *disj, SRT_DISJUNCTION *disj2)
srt_status srt_disj_add_conj (SRT_DISJUNCTION *disj, SRT_CONJUNCTION *conj)
SRT_CONJUNCTION * srt_conj_create (const char *label)
srt_status srt_conj_add_data (SRT_CONJUNCTION *conj, SRT_DATA *data)
srt_status srt_conj_add_disj (SRT_CONJUNCTION *conj, SRT_DISJUNCTION *disj)
srt_status srt_conj_add_conj (SRT_CONJUNCTION *conj, SRT_CONJUNCTION *conj2)
SRT_TASK * srt_task_create (const char *label, u_int consumption)
srt_status srt_task_set_attr (SRT_TASK *task, srt_task_attr attr)
srt_status srt_task_get_attr (SRT_TASK *task, srt_task_attr *pattr)
srt_status srt_task_add_disj_input (SRT_TASK *task, SRT_DISJUNCTION *disj)
srt_status srt_task_add_conj_input (SRT_TASK *task, SRT_CONJUNCTION *conj)
srt_status srt_task_add_data_input (SRT_TASK *task, SRT_DATA *data)
srt_status srt_task_add_output (SRT_TASK *task, SRT_DATA *data)
srt_status srt_task_set_descriptor (SRT_TASK *task, void *descriptor)
void * srt_get_entity_by_name (const char *name)
srt_status srt_init (void)
srt_status srt_finish (void)
srt_status srt_chek_kb (void)
srt_status srt_test_solution (void)
srt_status srt_set_maxreason_time (long max_time)
srt_status srt_switch_context (void *os_data)
srt_status srt_set_sched_checker (schd_checker check_func)
srt_status srt_export_kb2dot (const char *filename)

Detailed Description

SeART APIs for initialization, Knowledge base description and manipulation, context switching and scheduling.


Typedef Documentation

typedef bool(* schd_checker)(const float u, const u_int n)

User defined routine for schedulability test .

Parameters:
u utilization factor
n number of tasks
Returns:
true if it's feasible otherwise false.

Function Documentation

srt_status srt_chek_kb ( void   ) 

Checking for the consistency of the SeART knowledge-base;

Returns:
ERR_OK if success
srt_status srt_conj_add_conj ( SRT_CONJUNCTION *  conj,
SRT_CONJUNCTION *  conj2 
)

Add CONJUNCTION entity to a DISJUNCTION

Parameters:
conj a pointer to SRT_CONJUNCTION structure
conj2 a pointer to SRT_CONJUNCTION structure
Returns:
ERR_OK if success
srt_status srt_conj_add_data ( SRT_CONJUNCTION *  conj,
SRT_DATA *  data 
)

Add DATA entity to a CONJUNCTION

Parameters:
conj a pointer to SRT_CONJUNCTION structure
data a pointer to SRT_DATA structure
Returns:
ERR_OK if success
srt_status srt_conj_add_disj ( SRT_CONJUNCTION *  conj,
SRT_DISJUNCTION *  disj 
)

Add DISJUNCTION entity to a CONJUNCTION

Parameters:
conj a pointer to SRT_CONJUNCTION structure
disj a pointer to SRT_DISJUNCTION structure
Returns:
ERR_OK if success
SRT_CONJUNCTION* srt_conj_create ( const char *  label  ) 

Create a CONJUNCTION concept in SeART Knowledge Base

Parameters:
label label
Returns:
a pointer to the SRT_CONJUNCTION structure if success; otherwise NULL.
SRT_DATA* srt_data_create ( const char *  label,
const char *  kind 
)

Create a DATA concept in SeART Knowledge Base

Parameters:
label label
kind type of data
Returns:
a pointer to the SRT_DATA structure if success; otherwise NULL.
srt_status srt_data_get_attr ( SRT_DATA *  data,
srt_data_attr pattr 
)

Get the attribute of Data

Parameters:
data a pointer to SRT_DATA structure
pattr a pointer to srt_data_attr structure to save the attributes
Returns:
ERR_OK if success
srt_status srt_data_set_attr ( SRT_DATA *  data,
srt_data_attr  attr 
)

Set the attribute of a DATA

Parameters:
data a pointer to SRT_DATA structure
attr srt_data_attr structure
Returns:
ERR_OK if success
srt_status srt_disj_add_conj ( SRT_DISJUNCTION *  disj,
SRT_CONJUNCTION *  conj 
)

Add CONJUNCTION entity to a DISJUNCTION

Parameters:
disj a pointer to SRT_DISJUNCTION structure
conj a pointer to SRT_CONJUNCTION structure
Returns:
ERR_OK if success
srt_status srt_disj_add_data ( SRT_DISJUNCTION *  disj,
SRT_DATA *  data 
)

Add DATA entity to a DISJUNCTION

Parameters:
disj a pointer to SRT_DISJUNCTION structure
data a pointer to SRT_DATA structure
Returns:
ERR_OK if success
srt_status srt_disj_add_disj ( SRT_DISJUNCTION *  disj,
SRT_DISJUNCTION *  disj2 
)

Add DISJUNCTION entity to a DISJUNCTION

Parameters:
disj a pointer to SRT_DISJUNCTION structure
disj2 a pointer to SRT_DISJUNCTION structure
Returns:
ERR_OK if success
SRT_DISJUNCTION* srt_disj_create ( const char *  label  ) 

Create a DISJUNCTION concept in SeART Knowledge Base

Parameters:
label label
Returns:
a pointer to the SRT_DISJUNCTION structure if success; otherwise NULL.
srt_status srt_export_kb2dot ( const char *  filename  ) 

Export SeART knowledge-base to a DOT graph file.

Parameters:
filename name of the output DOT file.
Returns:
ERR_OK if success.
srt_status srt_finish ( void   ) 

Ending SeART;

Returns:
ERR_OK if success

NOTE: srt_finish() must be called at the end of you program.

void* srt_get_entity_by_name ( const char *  name  ) 

Retrieve a SeART entity by its name;

Parameters:
name label of the entity
Returns:
a pointer to a SeART entity if success otherwise NULL;

NOTE: User must be aware of the type of the entity requested by its name!

srt_status srt_init ( void   ) 

Initializing SeART;

Returns:
ERR_OK if success

NOTE: srt_init() must be called before any other SeART APIs.

srt_status srt_job_add_data ( SRT_JOB *  job,
SRT_DATA *  data 
)

Add DATA necessity to a JOB

Parameters:
job a pointer to SRT_JOB structure
data a pointer to SRT_DATA structure
Returns:
ERR_OK if success
srt_status srt_job_add_task ( SRT_JOB *  job,
SRT_TASK *  task 
)

Add TASK necessity to a JOB

Parameters:
job a pointer to SRT_JOB structure
task a pointer to SRT_TASK structure
Returns:
ERR_OK if success
SRT_JOB* srt_job_create ( const char *  label,
SRT_POLICY  policy 
)

Create a JOB concept in SeART Knowledge Base

Parameters:
label label
policy ploicy concerning reasoning of job
Returns:
a pointer to the SRT_JOB structure if success; otherwise NULL.
srt_status srt_job_get_attr ( SRT_JOB *  job,
srt_job_attr pattr 
)

Set the attribute of Job

Parameters:
job a pointer to SRT_JOB structure
pattr a pointer to srt_job_attr structure to save the attributes
Returns:
ERR_OK if success
srt_status srt_job_remove_data ( SRT_JOB *  job,
SRT_DATA *  data 
)

Remove DATA necessity from a JOB

Parameters:
job a pointer to SRT_JOB structure
data a pointer to SRT_DATA structure
Returns:
ERR_OK if success
srt_status srt_job_remove_task ( SRT_JOB *  job,
SRT_TASK *  task 
)

Remove TASK necessity from a JOB

Parameters:
job a pointer to SRT_JOB structure
task a pointer to SRT_TASK structure
Returns:
ERR_OK if success
srt_status srt_job_set_attr ( SRT_JOB *  job,
srt_job_attr  attr 
)

Set the attribute of Job

Parameters:
job a pointer to SRT_JOB structure
attr srt_job_attr structure
Returns:
ERR_OK if success
srt_status srt_res_add_provision ( SRT_RESOURCE *  res,
SRT_DATA *  data 
)

Add provision to a RESOURCE

Parameters:
res a pointer to SRT_RESOURCE structure
data a pointer to SRT_DATA structure
Returns:
ERR_OK if success
SRT_RESOURCE* srt_res_create ( const char *  label,
bool  available 
)

Create a RESOURCE concept in SeART Knowledge Base

Parameters:
label label
available availability of resource
Returns:
a pointer to the SRT_RESOURCE structure if success; otherwise NULL.
srt_status srt_res_set_attr ( SRT_RESOURCE *  res,
bool  available 
)

Set availability attribute of a resource

Parameters:
res a pointer to SRT_RESOURCE structure
available attribute of resource
Returns:
ERR_OK if success
srt_status srt_set_maxreason_time ( long  max_time  ) 

Sets maximum allowed reasoning relative time. The reasoner will return the optimal solution has been found until max_time.

Returns:
ERR_OK if success
srt_status srt_set_sched_checker ( schd_checker  check_func  ) 

Set a user defined routine for schedulability test.

Parameters:
check_func a pointer to schd_checker function
Returns:
ERR_OK if success.
srt_status srt_switch_context ( void *  os_data  ) 

Reason the current SeART knowledge-base and switch to new context if any solution exists.

Parameters:
os_data OS dependent required data for low-level task manipulating. please refer to the document for the specific OS in the /arch folder.
Returns:
ERR_OK if success
srt_status srt_task_add_conj_input ( SRT_TASK *  task,
SRT_CONJUNCTION *  conj 
)

Add CONJUNCTION entity to the input of the task

Parameters:
task a pointer to SRT_TASK structure
conj a pointer to SRT_CONJUNCTION structure
Returns:
ERR_OK if success
srt_status srt_task_add_data_input ( SRT_TASK *  task,
SRT_DATA *  data 
)

Add DATA entity to the input of the task

Parameters:
task a pointer to SRT_TASK structure
data a pointer to SRT_DATA structure
Returns:
ERR_OK if success
srt_status srt_task_add_disj_input ( SRT_TASK *  task,
SRT_DISJUNCTION *  disj 
)

Add DISJUNCTION entity to the input of the task

Parameters:
task a pointer to SRT_TASK structure
disj a pointer to SRT_DISJUNCTION structure
Returns:
ERR_OK if success
srt_status srt_task_add_output ( SRT_TASK *  task,
SRT_DATA *  data 
)

Add Data entity to the output of a task

Parameters:
task a pointer to SRT_TASK structure
data a pointer to SRT_DATA structure
Returns:
ERR_OK if success
SRT_TASK* srt_task_create ( const char *  label,
u_int  consumption 
)

Create a TASK concept in SeART Knowledge Base

Parameters:
label label
consumption task worst case execution time
Returns:
a pointer to the SRT_TASK structure if success; otherwise NULL.
srt_status srt_task_get_attr ( SRT_TASK *  task,
srt_task_attr pattr 
)

Retrieve the attribute of a TASK

Parameters:
task a pointer to SRT_TASK structure
pattr a pointer to srt_task_attr structure to save the attributes
Returns:
ERR_OK if success
srt_status srt_task_set_attr ( SRT_TASK *  task,
srt_task_attr  attr 
)

Set the attribute of TASK

Parameters:
task a pointer to SRT_TASK structure
attr srt_task_attr structure
Returns:
ERR_OK if success
srt_status srt_task_set_descriptor ( SRT_TASK *  task,
void *  descriptor 
)

Set the OS dependent task descriptor. This descriptor will be used by SeART core to make relation between TASK concepts defined in the SeART knowledge-base and real operating system tasks.

Parameters:
task a pointer to SRT_TASK structure
descriptor a pointer to a OS dependent task descriptor. for detailed information about the type and structure of this descriptor, please refer to the document for the specific OS in the /arch folder.
Returns:
ERR_OK if success
srt_status srt_test_solution ( void   ) 

Checks whether any solution exist in SeART knowledge-base by the reasoner or not.

Returns:
ERR_OK if success