GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LIM / V1-20-0

Constituent: lim_unit_test     Tag: sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

lim_util_sim.c File Reference

Simulate LCI, LDF, LPA, and LTC tasks. More...

#include <string.h>
#include "CCSDS/CCSDS_pkt.h"
#include "ITC/ITC_pubdefs.h"
#include "LIM/LIM_msgs.h"
#include "MSG/MSG_pubdefs.h"
#include "PBS/SEM.h"
#include "PBS/WUT.h"
#include "../src/LIM_pool.h"
#include "../src/LIM_task.h"
#include "lim_unit_test.h"
#include "lim_util_sim.h"

Include dependency graph for lim_util_sim.c:


Data Structures

struct  _SIM_Control
 Control information for simulated tasks. More...

Typedefs

typedef _SIM_Control SIM_Control
 Typedef for _SIM_Control.

Functions

static WUT_cb_status sim_wut_handler (void *prm, WUT_tmr *wut)
 Handle wake-up timer expiration.
static unsigned int sim_handle_abort (void *prm, const ITC_QueueItem *qitem_p, void *pay_p, unsigned int len)
 Handle Abort commands.
static unsigned int sim_handle_active (void *prm, const ITC_QueueItem *qitem_p, void *pay_p, unsigned int len)
 Handle Active commands.
static unsigned int sim_handle_calc_info (void *prm, const ITC_QueueItem *qitem_p, void *pay_p, unsigned int len)
 Handle Calc-Info commands.
static unsigned int sim_handle_closeout (void *prm, const ITC_QueueItem *qitem_p, void *pay_p, unsigned int len)
 Handle Closeout commands.
static unsigned int sim_handle_complete (void *prm, const ITC_QueueItem *qitem_p, void *pay_p, unsigned int len)
 Handle Complete commands.
static unsigned int sim_handle_idle (void *prm, const ITC_QueueItem *qitem_p, void *pay_p, unsigned int len)
 Handle Idle commands.
static unsigned int sim_handle_other (void *prm, const ITC_QueueItem *qitem_p, void *pay_p, unsigned int len)
 Handle Other commands.
static unsigned int sim_handle_reconfig (void *prm, const ITC_QueueItem *qitem_p, void *pay_p, unsigned int len)
 Handle Reconfig commands.
static unsigned int sim_handle_repoint (void *prm, const ITC_QueueItem *qitem_p, void *pay_p, unsigned int len)
 Handle Repoint commands.
static unsigned int sim_start_timer (SIM_Control *sim_p, const ITC_QueueItem *qitem_p, unsigned int delay_usecs)
 Start a timer that will send a Complete message.
static unsigned int sim_handle_start (void *prm, const ITC_QueueItem *qitem_p, void *pay_p, unsigned int len)
 Handle Start commands.
static unsigned int sim_handle_restart (void *prm, const ITC_QueueItem *qitem_p, void *pay_p, unsigned int len)
 Handle Restart commands.
static unsigned int sim_handle_stop (void *prm, const ITC_QueueItem *qitem_p, void *pay_p, unsigned int len)
 Handle Stop commands.
static unsigned int sim_handle_bulk (void *prm, const ITC_QueueItem *qitem_p, void *pay_p, unsigned int len)
 Handle BULK queue messages.
static int sim_init_task (test_Test_Descriptor *td_p, int id, LIM_Task **task_pp, char *name, ITC_TaskID tid, ITC_ApidDef *apid_def_1_p, ITC_ApidDef *apid_def_2_p, ITC_ApidDef *apid_def_3_p, ITC_cb_Processor *bulk_cb_p)
 Initialize a single simulated task.
int SIM_init_tasks (test_Test_Descriptor *td_p)
 Initialize the simulated tasks.
int SIM_start_tasks (test_Test_Descriptor *td_p)
 Start the simulated tasks.
static int sim_stop_task (test_Test_Descriptor *td_p, int id, LIM_Task *task_p)
 Stop a single simulated task.
int SIM_stop_tasks (test_Test_Descriptor *td_p)
 Stop the simulated tasks.
static int sim_shutdown_task (test_Test_Descriptor *td_p, int id, LIM_Task *task_p)
 Shutdown a single simulated task.
int SIM_shutdown_tasks (test_Test_Descriptor *td_p)
 Shutdown the simulated tasks.
void SIM_clear_stats (test_Test_Descriptor *td_p)
 Clear simulated task statistics.
int SIM_check_stats (test_Test_Descriptor *td_p, test_Cmd_Counts *exp_lci_p, test_Cmd_Counts *exp_ldf_p, test_Cmd_Counts *exp_lpa_p, test_Cmd_Counts *exp_ltc_p)
 Verify expected simulated task statistics.
int SIM_check_parms (test_Test_Descriptor *td_p, test_Start_Parms *exp_lpa_p)
 Verify expected simulated task start parameters.

Variables

static ITC_CommandItem sim_Item_GBM []
 GBM Dispatch table.
static ITC_CommandItem sim_Item_LCI []
 LCI Dispatch table.
static ITC_CommandItem sim_Item_LDF []
 LDF Dispatch table.
static ITC_CommandItem sim_Item_LPA []
 LPA Dispatch table.
static ITC_CommandItem sim_Item_LPA_IDLE []
 LPA_IDLE Dispatch table.
static ITC_CommandItem sim_Item_LTC []
 LTC Dispatch table.
static ITC_CommandList sim_List_GBM = { DIM (sim_Item_GBM), 0, sim_Item_GBM }
 GBM Dispatch control block.
static ITC_CommandList sim_List_LCI = { DIM (sim_Item_LCI), 0, sim_Item_LCI }
 LCI Dispatch control block.
static ITC_CommandList sim_List_LDF = { DIM (sim_Item_LDF), 0, sim_Item_LDF }
 LDF Dispatch control block.
static ITC_CommandList sim_List_LPA = { DIM (sim_Item_LPA), 0, sim_Item_LPA }
 LPA Dispatch control block.
static ITC_CommandList sim_List_LTC = { DIM (sim_Item_LTC), 0, sim_Item_LTC }
 LTC Dispatch control block.
static ITC_CommandList sim_List_LPA_IDLE
 LPA_IDLE Dispatch control block.
static ITC_ApidDef sim_Def_GBM = { SIM_APID_GBM, 0, &sim_List_GBM }
 GBM APID control block.
static ITC_ApidDef sim_Def_LCI = { SIM_APID_LCI, 0, &sim_List_LCI }
 LCI APID control block.
static ITC_ApidDef sim_Def_LDF = { SIM_APID_LDF, 0, &sim_List_LDF }
 LDF APID control block.
static ITC_ApidDef sim_Def_LPA = { SIM_APID_LPA, 0, &sim_List_LPA }
 LPA APID control block.
static ITC_ApidDef sim_Def_LTC = { SIM_APID_LTC, 0, &sim_List_LTC }
 LTC APID control block.
static ITC_ApidDef sim_Def_LPA_IDLE
 LPA APID control block.

Detailed Description

Simulate LCI, LDF, LPA, and LTC tasks.

**  CVS $Id: lim_util_sim.c,v 1.27 2008/08/30 01:17:46 dmay Exp $
**  

Function Documentation

int SIM_check_parms test_Test_Descriptor td_p,
test_Start_Parms exp_lpa_p
 

Verify expected simulated task start parameters.

Parameters:
td_p Pointer to test descriptor.
exp_lpa_p Pointer to expected LPA task start parameters.
Return values:
0 Success.
-1 Failure.

int SIM_check_stats test_Test_Descriptor td_p,
test_Cmd_Counts exp_lci_p,
test_Cmd_Counts exp_ldf_p,
test_Cmd_Counts exp_lpa_p,
test_Cmd_Counts exp_ltc_p
 

Verify expected simulated task statistics.

Parameters:
td_p Pointer to test descriptor.
exp_lci_p Pointer to expected LCI task counts.
exp_ldf_p Pointer to expected LDF task counts.
exp_lpa_p Pointer to expected LPA task counts.
exp_ltc_p Pointer to expected LTC task counts.
Return values:
0 Success.
-1 Failure.

void SIM_clear_stats test_Test_Descriptor td_p  ) 
 

Clear simulated task statistics.

Parameters:
td_p Pointer to test descriptor.
Returns:
Nothing.

unsigned int sim_handle_abort void *  prm,
const ITC_QueueItem *  qitem_p,
void *  pay_p,
unsigned int  len
[static]
 

Handle Abort commands.

Parameters:
prm Context parameter (pointer to task control info).
qitem_p Pointer to queue item.
pay_p Pointer to queue item payload.
len Length of queue item payload, in bytes.
Returns:
MSG code.

unsigned int sim_handle_active void *  prm,
const ITC_QueueItem *  qitem_p,
void *  pay_p,
unsigned int  len
[static]
 

Handle Active commands.

Parameters:
prm Context parameter (pointer to task control info).
qitem_p Pointer to queue item.
pay_p Pointer to queue item payload.
len Length of queue item payload, in bytes.
Returns:
MSG code.

unsigned int sim_handle_bulk void *  prm,
const ITC_QueueItem *  qitem_p,
void *  pay_p,
unsigned int  len
[static]
 

Handle BULK queue messages.

Parameters:
prm Context parameter (pointer to task control info).
qitem_p Pointer to queue item.
pay_p Pointer to queue item payload.
len Length of queue item payload, in bytes.
Returns:
MSG code.

unsigned int sim_handle_calc_info void *  prm,
const ITC_QueueItem *  qitem_p,
void *  pay_p,
unsigned int  len
[static]
 

Handle Calc-Info commands.

Parameters:
prm Context parameter (pointer to task control info).
qitem_p Pointer to queue item.
pay_p Pointer to queue item payload.
len Length of queue item payload, in bytes.
Returns:
MSG code.

unsigned int sim_handle_closeout void *  prm,
const ITC_QueueItem *  qitem_p,
void *  pay_p,
unsigned int  len
[static]
 

Handle Closeout commands.

Parameters:
prm Context parameter (pointer to task control info).
qitem_p Pointer to queue item.
pay_p Pointer to queue item payload.
len Length of queue item payload, in bytes.
Returns:
MSG code.

unsigned int sim_handle_complete void *  prm,
const ITC_QueueItem *  qitem_p,
void *  pay_p,
unsigned int  len
[static]
 

Handle Complete commands.

Parameters:
prm Context parameter (pointer to task control info).
qitem_p Pointer to queue item.
pay_p Pointer to queue item payload.
len Length of queue item payload, in bytes.
Returns:
MSG code.

unsigned int sim_handle_idle void *  prm,
const ITC_QueueItem *  qitem_p,
void *  pay_p,
unsigned int  len
[static]
 

Handle Idle commands.

Parameters:
prm Context parameter (pointer to task control info).
qitem_p Pointer to queue item.
pay_p Pointer to queue item payload.
len Length of queue item payload, in bytes.
Returns:
MSG code.

unsigned int sim_handle_other void *  prm,
const ITC_QueueItem *  qitem_p,
void *  pay_p,
unsigned int  len
[static]
 

Handle Other commands.

Parameters:
prm Context parameter (pointer to task control info).
qitem_p Pointer to queue item.
pay_p Pointer to queue item payload.
len Length of queue item payload, in bytes.
Returns:
MSG code.

unsigned int sim_handle_reconfig void *  prm,
const ITC_QueueItem *  qitem_p,
void *  pay_p,
unsigned int  len
[static]
 

Handle Reconfig commands.

Parameters:
prm Context parameter (pointer to task control info).
qitem_p Pointer to queue item.
pay_p Pointer to queue item payload.
len Length of queue item payload, in bytes.
Returns:
MSG code.

unsigned int sim_handle_repoint void *  prm,
const ITC_QueueItem *  qitem_p,
void *  pay_p,
unsigned int  len
[static]
 

Handle Repoint commands.

Parameters:
prm Context parameter (pointer to task control info).
qitem_p Pointer to queue item.
pay_p Pointer to queue item payload.
len Length of queue item payload, in bytes.
Returns:
MSG code.

unsigned int sim_handle_restart void *  prm,
const ITC_QueueItem *  qitem_p,
void *  pay_p,
unsigned int  len
[static]
 

Handle Restart commands.

Parameters:
prm Context parameter (pointer to task control info).
qitem_p Pointer to queue item.
pay_p Pointer to queue item payload.
len Length of queue item payload, in bytes.
Returns:
MSG code.

unsigned int sim_handle_start void *  prm,
const ITC_QueueItem *  qitem_p,
void *  pay_p,
unsigned int  len
[static]
 

Handle Start commands.

Parameters:
prm Context parameter (pointer to task control info).
qitem_p Pointer to queue item.
pay_p Pointer to queue item payload.
len Length of queue item payload, in bytes.
Returns:
MSG code.

unsigned int sim_handle_stop void *  prm,
const ITC_QueueItem *  qitem_p,
void *  pay_p,
unsigned int  len
[static]
 

Handle Stop commands.

Parameters:
prm Context parameter (pointer to task control info).
qitem_p Pointer to queue item.
pay_p Pointer to queue item payload.
len Length of queue item payload, in bytes.
Returns:
MSG code.

int sim_init_task test_Test_Descriptor td_p,
int  id,
LIM_Task **  task_pp,
char *  name,
ITC_TaskID  tid,
ITC_ApidDef *  apid_def_1_p,
ITC_ApidDef *  apid_def_2_p,
ITC_ApidDef *  apid_def_3_p,
ITC_cb_Processor *  bulk_cb_p
[static]
 

Initialize a single simulated task.

Parameters:
td_p Pointer to test descriptor.
id ID to use for user messages.
task_pp Location to store pointer to task control info.
name Name of the task.
tid ID of the task.
apid_def_1_p Pointer to first set of cmd handler definitions.
apid_def_2_p Pointer to second set of cmd handler definitions.
apid_def_3_p Pointer to third set of cmd handler definitions.
bulk_cb_p Callback function for BULK queue messages.
Return values:
0 Success.
-1 Failure.

int SIM_init_tasks test_Test_Descriptor td_p  ) 
 

Initialize the simulated tasks.

Parameters:
td_p Pointer to test descriptor.
Return values:
0 Success.
-1 Failure.

int sim_shutdown_task test_Test_Descriptor td_p,
int  id,
LIM_Task task_p
[static]
 

Shutdown a single simulated task.

Parameters:
td_p Pointer to test descriptor.
id ID to use for user messages.
task_p Pointer to control information for the task.
Return values:
0 Success.
-1 Failure.

int SIM_shutdown_tasks test_Test_Descriptor td_p  ) 
 

Shutdown the simulated tasks.

Parameters:
td_p Pointer to test descriptor.
Return values:
0 Success.
-1 Failure.

int SIM_start_tasks test_Test_Descriptor td_p  ) 
 

Start the simulated tasks.

Parameters:
td_p Pointer to test descriptor.
Return values:
0 Success.
-1 Failure.

unsigned int sim_start_timer SIM_Control sim_p,
const ITC_QueueItem *  qitem_p,
unsigned int  delay_usecs
[static]
 

Start a timer that will send a Complete message.

Parameters:
sim_p Pointer to task control info.
qitem_p Pointer to queue item of the incoming command.
delay_usecs Completion delay, in microseconds.
Returns:
MSG code.

int sim_stop_task test_Test_Descriptor td_p,
int  id,
LIM_Task task_p
[static]
 

Stop a single simulated task.

Parameters:
td_p Pointer to test descriptor.
id ID to use for user messages.
task_p Pointer to control information for the task.
Return values:
0 Success.
-1 Failure.

int SIM_stop_tasks test_Test_Descriptor td_p  ) 
 

Stop the simulated tasks.

Parameters:
td_p Pointer to test descriptor.
Return values:
0 Success.
-1 Failure.

WUT_cb_status sim_wut_handler void *  prm,
WUT_tmr *  wut
[static]
 

Handle wake-up timer expiration.

Parameters:
prm Pointer to simulated task control info.
wut Pointer to wake-up timer.
Returns:
WUT status.


Variable Documentation

ITC_ApidDef sim_Def_LPA_IDLE [static]
 

Initial value:

 { SIM_APID_LPA_IDLE,
                                         0,
                                         &sim_List_LPA_IDLE }
LPA APID control block.

ITC_CommandItem sim_Item_GBM [static]
 

Initial value:

    {
        { SIM_FC_GBM_CALC_INFO, 10, &sim_handle_calc_info },
        { SIM_FC_GBM_CLOSEOUT,  10, &sim_handle_closeout  },
        { SIM_FC_GBM_REPOINT,   10, &sim_handle_repoint   },
    }
GBM Dispatch table.

ITC_CommandItem sim_Item_LCI [static]
 

Initial value:

    {
        { SIM_FC_CAL_START, 10, &sim_handle_start },
        { SIM_FC_CAL_ABORT, 10, &sim_handle_abort },
        { SIM_FC_CAL_OTHER, 10, &sim_handle_other },
    }
LCI Dispatch table.

ITC_CommandItem sim_Item_LDF [static]
 

Initial value:

    {
        { SIM_FC_DIAG_START, 10, &sim_handle_start },
        { SIM_FC_DIAG_ABORT, 10, &sim_handle_abort },
        { SIM_FC_DIAG_OTHER, 10, &sim_handle_other },
    }
LDF Dispatch table.

ITC_CommandItem sim_Item_LPA [static]
 

Initial value:

    {
        { SIM_FC_PHYS_START,   10, &sim_handle_start  },
        { SIM_FC_PHYS_STOP,    10, &sim_handle_stop   },
        { SIM_FC_PHYS_ACTIVE,  10, &sim_handle_active },
        { SIM_FC_PHYS_IDLE_1,  10, &sim_handle_idle   },
    }
LPA Dispatch table.

ITC_CommandItem sim_Item_LPA_IDLE [static]
 

Initial value:

    {
        { SIM_FC_PHYS_IDLE_2,  10, &sim_handle_idle   },
    }
LPA_IDLE Dispatch table.

ITC_CommandItem sim_Item_LTC [static]
 

Initial value:

    {
        { SIM_FC_LTC_STOP, 10, &sim_handle_stop },
    }
LTC Dispatch table.

ITC_CommandList sim_List_LPA_IDLE [static]
 

Initial value:

LPA_IDLE Dispatch control block.


Generated on Thu Oct 30 01:50:19 2008 by  doxygen 1.4.4