GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LIM / dev > lim_unit_test / sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

LIM_task.h File Reference

Interface to the functions found in LIM_task.c. More...

#include <ITC/ITC_drvdefs.h>
#include <ITC/ITC_pubdefs.h>
#include <PBS/MTX.ih>

Typedefs

typedef enum _LIM_Task_State LIM_Task_State
 Typedef for _LIM_Task_State.
typedef struct _LIM_Task LIM_Task
 Typedef for opaque _LIM_Task structure.

Enumerations

enum  _LIM_Task_State {
  LIM_TASK_STATE_UNINITIALIZED = 1 << 0,
  LIM_TASK_STATE_INITIALIZING = 1 << 1,
  LIM_TASK_STATE_INIT_FAIL = 1 << 2,
  LIM_TASK_STATE_INITIALIZED = 1 << 3,
  LIM_TASK_STATE_SHUTDOWN = 1 << 4,
  LIM_TASK_STATE_SHUTDOWN_FAIL = 1 << 5,
  LIM_TASK_STATE_STARTING = 1 << 6,
  LIM_TASK_STATE_START_FAIL = 1 << 7,
  LIM_TASK_STATE_STARTED = 1 << 8,
  LIM_TASK_STATE_STOPPING = 1 << 9,
  LIM_TASK_STATE_STOP_FAIL = 1 << 10,
  LIM_TASK_STATE_BUSY = 1 << 31
}
 State for tasks. More...

Functions

unsigned int LIM_task_lock_access (LIM_Task *task_p)
 Lock access to task control information.
unsigned int LIM_task_unlock_access (LIM_Task *task_p)
 Unlock access to task control information.
unsigned int LIM_task_check_state (LIM_Task *task_p, unsigned int valid)
 Check the state of a task.
unsigned int LIM_task_change_state (LIM_Task *task_p, unsigned int valid, LIM_Task_State new_state)
 Change the state of a task.
unsigned int LIM_task_get_extra_ptr (LIM_Task *task_p, void **extra_pp)
 Get a pointer to the 'extra' bytes allocated for the task.
unsigned int LIM_task_init_begin_with_db (LIM_Task **task_pp, char *req_name, char *def_name, ITC_TaskID tid, unsigned int extra_bytes)
 Begin task initialization using CPU_DB.
unsigned int LIM_task_init_begin (LIM_Task **task_pp, char *name, ITC_TaskID tid, unsigned int extra_bytes)
 Begin task initialization.
unsigned int LIM_task_init_end (LIM_Task *task_p, ITC_cb_Memory *conf_alloc_p, void *conf_alloc_prm, unsigned int status)
 Finish task Initialization.
unsigned int LIM_task_add_queue (LIM_Task *task_p, ITC_QueueID queue_id, ITC_cb_Memory *alloc_p, void *alloc_prm, ITC_cb_Dispatch *dispatch_p)
 Add a queue and a memory allocator to a task.
unsigned int LIM_task_add_apid (LIM_Task *task_p, ITC_QueueID queue_id, ITC_ApidDef *apid_def_p, void *parm)
 Add command handlers to a task.
unsigned int LIM_task_add_raw (LIM_Task *task_p, ITC_QueueID queue_id, ITC_cb_Processor *cb_p, void *parm)
 Add a RAW dispatch command handler to a task.
unsigned int LIM_task_shutdown_begin (LIM_Task *task_p)
 Shut down a task.
unsigned int LIM_task_shutdown_end (LIM_Task *task_p, unsigned int status)
 Finish task shutdown.
unsigned int LIM_task_remove_queue (LIM_Task *task_p, ITC_QueueID queue_id, ITC_cb_Memory *alloc_p)
 Remove a queue and a memory allocator from a task.
unsigned int LIM_task_start_with_db (LIM_Task *task_p, TASK_attr *req_attr_p, TASK_attr *def_attr_p)
 Start a task using CPU_DB.
unsigned int LIM_task_start (LIM_Task *task_p, TASK_attr *attr_p)
 Start a task.
unsigned int LIM_task_stop (LIM_Task *task_p)
 Stop a task.


Detailed Description

Interface to the functions found in LIM_task.c.

**  CVS $Id: LIM_task.h,v 1.6 2011/03/29 21:20:29 apw Exp $
**  

Enumeration Type Documentation

State for tasks.

Enumerator:
LIM_TASK_STATE_UNINITIALIZED  The task has not been initialized. Use LIM_task_init() to initialize it.
LIM_TASK_STATE_INITIALIZING  The task is in the process of being initialized by LIM_task_init().
LIM_TASK_STATE_INIT_FAIL  LIM_task_init() failed - use LIM_task_shutdown() to return to LIM_TASK_STATE_UNINITIALIZED.
LIM_TASK_STATE_INITIALIZED  The task has been initialized by LIM_task_init() and is ready to be started by LIM_task_start() or shutdown by LIM_task_shutdown().
LIM_TASK_STATE_SHUTDOWN  The task is in the process of being shutdown by LIM_task_shutdown().
LIM_TASK_STATE_SHUTDOWN_FAIL  LIM_task_shutdown() failed - use LIM_task_shutdown() to return to LIM_TASK_STATE_UNINITIALIZED.
LIM_TASK_STATE_STARTING  The task is in the process of being started by LIM_task_start().
LIM_TASK_STATE_START_FAIL  LIM_task_start() failed - use LIM_task_stop() to return to LIM_TASK_STATE_INITIALIZED.
LIM_TASK_STATE_STARTED  The task has been started by LIM_task_start() and can be stopped by LIM_task_stop().
LIM_TASK_STATE_STOPPING  The task is in the process of being stopped by LIM_task_stop().
LIM_TASK_STATE_STOP_FAIL  LIM_task_stop() failed - use LIM_task_stop() again to return to LIM_TASK_STATE_INITIALIZED.
LIM_TASK_STATE_BUSY  A function is busy updating the task control information.


Function Documentation

unsigned int LIM_task_add_apid ( LIM_Task task_p,
ITC_QueueID  queue_id,
ITC_ApidDef *  apid_def_p,
void *  parm 
)

Add command handlers to a task.

Parameters:
task_p Pointer to control information for the task.
queue_id ID of the queue that handles the commands.
apid_def_p Pointer to command handler definitions.
parm User context parameter for the command handlers.
Returns:
MSG code.

Referenced by sim_init_task().

unsigned int LIM_task_add_queue ( LIM_Task task_p,
ITC_QueueID  queue_id,
ITC_cb_Memory *  alloc_p,
void *  alloc_prm,
ITC_cb_Dispatch *  dispatch_p 
)

Add a queue and a memory allocator to a task.

Parameters:
task_p Pointer to control information for the task.
queue_id ID of the queue to add.
alloc_p Pointer to memory allocator for incoming packets.
alloc_prm User context parameter for the memory allocator.
dispatch_p Pointer to dispatch function for the queue.
Returns:
MSG code.

Referenced by sim_init_task(), and TLM_init().

unsigned int LIM_task_add_raw ( LIM_Task task_p,
ITC_QueueID  queue_id,
ITC_cb_Processor *  cb_p,
void *  parm 
)

Add a RAW dispatch command handler to a task.

Parameters:
task_p Pointer to control information for the task.
queue_id ID of the queue that handles the commands.
cb_p Pointer to command handler function.
parm User context parameter for the command handler.
Returns:
MSG code.

Referenced by sim_init_task().

unsigned int LIM_task_change_state ( LIM_Task task_p,
unsigned int  valid,
LIM_Task_State  new_state 
)

Change the state of a task.

Parameters:
task_p Pointer to control info for the task.
valid Bitmask of valid current states.
new_state New state.
Returns:
MSG code.

unsigned int LIM_task_check_state ( LIM_Task task_p,
unsigned int  valid 
)

Check the state of a task.

Checks that current state of a task and verifies that it is one of the specified valid states.

Parameters:
task_p Pointer to control info for the task.
valid Bitmask of valid current states.
Returns:
MSG code.

unsigned int LIM_task_get_extra_ptr ( LIM_Task task_p,
void **  extra_pp 
)

unsigned int LIM_task_init_begin ( LIM_Task **  task_pp,
char *  name,
ITC_TaskID  tid,
unsigned int  extra_bytes 
)

Begin task initialization.

This function is a wrapper for the LIM_task_init_begin_with_db function. After calling this function, the LIM_task_add_queue() and LIM_task_add_apid() functions should be used to add queues and command handlers to the task. The LIM_task_init_end() function should then be called to finish the initialization process and transition the task to the INITIALIZED state.

Parameters:
task_pp Location to store pointer to task control info.
name Name of the task.
tid ID of the task.
extra_bytes Number of extra bytes to allocate for control information, in addition to the amount needed for LIM_Task.
Returns:
MSG code.

Referenced by sim_init_task(), and TLM_init().

unsigned int LIM_task_init_begin_with_db ( LIM_Task **  task_pp,
char *  req_name,
char *  def_name,
ITC_TaskID  tid,
unsigned int  extra_bytes 
)

Begin task initialization using CPU_DB.

This function begins the task initialization process by allocating memory for task control information and creating the task. It uses the CPU_DB database to determine the name of the task if the requested name is NULL. When this function returns without an error, the task will be in the INITIALIZING state. After calling this function, the LIM_task_add_queue() and LIM_task_add_apid() functions should be used to add queues and command handlers to the task. The LIM_task_init_end() function should then be called to finish the initialization process and transition the task to the INITIALIZED state.

Parameters:
task_pp Location to store pointer to task control info.
req_name Requested task name.
def_name Default task name (should CPU_DB access fail).
tid ID of the task.
extra_bytes Number of extra bytes to allocate for control information, in addition to the amount needed for LIM_Task.
Returns:
MSG code.

unsigned int LIM_task_init_end ( LIM_Task task_p,
ITC_cb_Memory *  conf_alloc_p,
void *  conf_alloc_prm,
unsigned int  status 
)

Finish task Initialization.

This function finishes the task initialization process by attaching command confirmation memory. If successful, it transitions the task to the INITIALIZED state. This function should be called only if the current task state has been set to INITIALIZING by the LIM_task_init_begin() function. If task initialization fails, this function sets the task state to INIT_FAIL.

Parameters:
task_p Pointer to control information for the task.
conf_alloc_p Pointer to cmd confirmation memory allocator.
conf_alloc_prm Parm for cmd confirmation memory allocator.
status Current task initialization status.
Returns:
MSG code.

Referenced by sim_init_task(), and TLM_init().

unsigned int LIM_task_lock_access ( LIM_Task task_p  ) 

Lock access to task control information.

Parameters:
task_p Pointer to control information.
Returns:
MSG code.

unsigned int LIM_task_remove_queue ( LIM_Task task_p,
ITC_QueueID  queue_id,
ITC_cb_Memory *  alloc_p 
)

Remove a queue and a memory allocator from a task.

Parameters:
task_p Pointer to control information for the task.
queue_id ID of the queue to remove.
alloc_p Pointer to memory allocator for incoming packets.
Returns:
MSG code.

Referenced by sim_shutdown_task(), and TLM_shutdown().

unsigned int LIM_task_shutdown_begin ( LIM_Task task_p  ) 

Shut down a task.

This function begins the task shutdown process by transitioning the task to the SHUTDOWN state, detaching command handlers, detaching command and command confirmation memory, removing ITC queues, and deleting the task. When this function returns, the task will be in the SHUTDOWN state. The LIM_task_shutdown_end() function should be called to finish the shutdown process and transition the task to the UNINITIALIZED state.

Parameters:
task_p Pointer to control info for the task.
Returns:
MSG code.

Referenced by sim_shutdown_task(), and TLM_shutdown().

unsigned int LIM_task_shutdown_end ( LIM_Task task_p,
unsigned int  status 
)

Finish task shutdown.

This function finished the task shutdown process by transitions the task to the UNINITIALIZED state. This function should be called only if the current task state has been set to SHUTDOWN by the LIM_task_shutdown_begin() function. If task shutdown fails, this function sets the task state to SHUTDOWN_FAIL.

Parameters:
task_p Pointer to control info for the task.
status Current task shutdown status.
Returns:
MSG code.

Referenced by sim_shutdown_task(), and TLM_shutdown().

unsigned int LIM_task_start ( LIM_Task task_p,
TASK_attr *  attr_p 
)

Start a task.

This function is a wrapper for LIM_task_start_with_db, which starts a task and transitions it to the STARTED state. The LIM_task_init() function must be called before this function is called.

Parameters:
task_p Pointer to control information for the task.
attr_p Pointer to task attributes. Default task attributes (with the name from task_p and a priority of 100) will be used if this value is NULL.
Returns:
MSG code.

Referenced by SIM_start_tasks(), and TLM_start().

unsigned int LIM_task_start_with_db ( LIM_Task task_p,
TASK_attr *  req_attr_p,
TASK_attr *  def_attr_p 
)

Start a task using CPU_DB.

This function starts a task and transitions it to the STARTED state. The LIM_task_init() function must be called before this function is called.

Parameters:
task_p Pointer to control information for the task.
req_attr_p Pointer to requested task attributes.
def_attr_p Pointer to default task attributes.
Returns:
MSG code.

unsigned int LIM_task_stop ( LIM_Task task_p  ) 

Stop a task.

This function stops a task and transitions it to the INITIALIZED state. This function must be called before the LIM_task_shutdown() function is called.

Parameters:
task_p Pointer to control information for the task.
Returns:
MSG code.

Referenced by sim_stop_task(), and TLM_stop().

unsigned int LIM_task_unlock_access ( LIM_Task task_p  ) 

Unlock access to task control information.

Parameters:
task_p Pointer to task control information.
Returns:
MSG code.


Generated on Wed Mar 30 15:28:22 2011 by  doxygen 1.5.8