GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LIM / V1-22-4 > lim_unit_test / mv2304
#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. |
** CVS $Id: LIM_task.h,v 1.6 2011/03/29 21:20:29 apw Exp $ **
enum _LIM_Task_State |
State for tasks.
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. |
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.
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. |
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.
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. |
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.
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. |
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.
task_p | Pointer to control info for the task. | |
valid | Bitmask of valid current states. | |
new_state | New state. |
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.
task_p | Pointer to control info for the task. | |
valid | Bitmask of valid current states. |
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.
task_p | Pointer to control information. | |
extra_pp | Location to return pointer to extra bytes. |
Referenced by SIM_check_parms(), SIM_check_stats(), SIM_clear_stats(), sim_handle_abort(), sim_handle_active(), sim_handle_calc_info(), sim_handle_closeout(), sim_handle_complete(), sim_handle_idle(), sim_handle_other(), sim_handle_reconfig(), sim_handle_repoint(), sim_handle_restart(), sim_handle_start(), sim_handle_stop(), sim_init_task(), sim_shutdown_task(), sim_stop_task(), TLM_check_no_tlm(), TLM_check_tlm(), tlm_dispatch_cmd(), tlm_dispatch_ctl(), tlm_dispatch_ctl_x(), TLM_init(), and TLM_tlm_rcvd().
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.
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. |
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.
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. |
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.
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. |
Referenced by sim_init_task(), and TLM_init().
unsigned int LIM_task_lock_access | ( | LIM_Task * | task_p | ) |
Lock access to task control information.
task_p | Pointer to control information. |
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.
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. |
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.
task_p | Pointer to control info for the task. |
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.
task_p | Pointer to control info for the task. | |
status | Current task shutdown status. |
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.
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. |
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.
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. |
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.
task_p | Pointer to control information for the task. |
Referenced by sim_stop_task(), and TLM_stop().
unsigned int LIM_task_unlock_access | ( | LIM_Task * | task_p | ) |
Unlock access to task control information.
task_p | Pointer to task control information. |