GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LCS / dev > lcs_test / mv2304


Interface   Data Structures   File List   Data Fields   Globals  

LCS_common.c File Reference

Common functions for LCS tests. More...

#include <stdio.h>
#include <string.h>
#include <PBS/FFS.ih>
#include <PBS/FPA.h>
#include <PBS/MBA.h>
#include <PBS/WCT.h>
#include <PBS/WUT.h>
#include <LCBD/LCB_cr.h>
#include <LCBD/LCBD_drv.h>
#include <LCBD/LCBC.h>
#include <IMM/FPM_pubdefs.h>
#include <ITC/ITC_drvdefs.h>
#include <ITC/ITC_pubdefs.h>
#include <LCS/LCS_drvdefs.h>
#include <LCS/LCS_msgs.h>
#include <LCS_prvdefs.h>
#include <LCS_prvtest.h>

Defines

#define LCS_L_CMD   ( 8 )
 Number of command buffers.
#define LCS_L_MSG   ( 16 )
 Number of message buffers.
#define LCS_L_PAGE   ( 0x200 )
 Length of a "page".
#define LCS_K_PAGE   ( 0x200 )
 Number of pages per FPA buffer.

Functions

static FORK_cb_status fragmentSet (FORK_cb_prm *prm, FORK_msg_hdr *msg)
 Force a fragmentation.
static WUT_cb_status fragmentTimer (void *prm, WUT_tmr *wut)
 Timer callback routine to queue a message back to a fork.
void * LRX_allocTest (ITC_Queue *queue, unsigned int siz, ITC_cb_Completion **rtn, void **cb0, void **cb1, void **cb2)
 Allocation plug-in (normal operation ... not testing).
unsigned int LCS_accumRcv (void *prm, const ITC_QueueItem *qitem, void *pay, unsigned int len)
 Raw packet processing.
void LCS_dumpHex (const void *buf, int bef, int aft)
 Simple hex dump.
void LCS_dumpRcv (ITC_TaskID tid, ITC_QueueID qid)
 Raw packet processing.
void LCS_clearRcv (ITC_TaskID tid, ITC_QueueID qid)
 Raw packet processing.
void LCS_freeBuffer (ITC_QueueItem *qitem, unsigned int status, void *prm0, void *prm1, void *prm2, unsigned int tx)
 Free allocated buffer.
void LCS_freeCCSDS (ITC_QueueItem *qitem, unsigned int status, void *prm0, void *prm1, void *prm2, unsigned int tx)
 Free allocated buffer.
unsigned int LCS_testAttach (ITC_TaskID tid)
 Attach LCS testability features to a task.
unsigned int LCS_testInitialize ()
 One time initialization of resources needed for LCS testing.
unsigned int LCS_sendCCSDS (unsigned int tst, unsigned int apid, int fst, int lst, int pgs, int beg, int end, ITC_cb_Completion *rtn, FPA_fcb *fcb, unsigned char *buf, LCS_Cmd *cmd)
 Send a message (no memory allocation).
unsigned int LCS_sendCPU (ITC_NodeID nid, ITC_TaskID tid, ITC_QueueID qid, ITC_ProtID pid, int pgs, int beg, int end)
 Send a message (automatic memory allocation).
unsigned int LCS_sendMessage (unsigned int tst, ITC_NodeID nid, ITC_TaskID tid, ITC_QueueID qid, ITC_ProtID pid, int pgs, int beg, int end, ITC_cb_Completion *rtn, FPA_fcb *fcb, unsigned char *buf, LCS_Cmd *cmd)
 Send a message (no memory allocation).
unsigned int LCS_sendSDI (unsigned int apid, int fst, int lst, int pgs, int beg, int end)
 Send a message (automatic memory allocation).

Variables

LCS_TestControlLCS_tcb
 Control block for LCS testing.
LCS_Cmdcmd
 A command used in the fragmentation test.
unsigned int nomore
 Flag to discontinue the fragmenetation wake-up timer.


Detailed Description

Common functions for LCS tests.

CVS $Id: LCS_common.c,v 1.10 2011/03/28 22:49:56 apw Exp $
Author:
A.P.Waite

Function Documentation

static FORK_cb_status fragmentSet ( FORK_cb_prm *  prm,
FORK_msg_hdr *  msg 
) [static]

Force a fragmentation.

fragmentSet() sets the LCB CSR register to introduce a fragment.

References _LCS_TestControl::fpc, fragmentTimer(), and _LCS_Cmd::tmr.

Referenced by LCS_accumRcv().

static WUT_cb_status fragmentTimer ( void *  prm,
WUT_tmr *  wut 
) [static]

Timer callback routine to queue a message back to a fork.

Parameters:
prm (in) User context parameter
wut (in) Timer handle
fragmentTimer() is the routine called at interrupt level by the timeout timer. It's responsible for getting the fragmentation flag set.

References _LCS_Cmd::fqi, and _LCS_Cmd::rtn.

Referenced by fragmentSet(), and LCS_accumRcv().

unsigned int LCS_accumRcv ( void *  prm,
const ITC_QueueItem *  qitem,
void *  pay,
unsigned int  len 
)

void LCS_clearRcv ( ITC_TaskID  tid,
ITC_QueueID  qid 
)

Raw packet processing.

Parameters:
tid (in) ITC task ID (-1 for all)
qid (in) ITC queue ID (-1 for all)
LCS_clearRcv() clears receive statistics

References _LCS_TestTask::msk, _LCS_TestTask::rcv, and _LCS_TestControl::tsk.

void LCS_dumpHex ( const void *  buf,
int  bef,
int  aft 
)

Simple hex dump.

Parameters:
buf Reference address
bef Offset from buf to begin dump (inclusive)
aft Offset from buf to end dump (exclusive)

Referenced by LCS_accumRcv(), LCS_freeBuffer(), and LCS_freeCCSDS().

void LCS_dumpRcv ( ITC_TaskID  tid,
ITC_QueueID  qid 
)

void LCS_freeBuffer ( ITC_QueueItem *  qitem,
unsigned int  status,
void *  prm0,
void *  prm1,
void *  prm2,
unsigned int  tx 
)

Free allocated buffer.

Parameters:
qitem (in) Queue item (unused)
status (in) Processing completion code (unused)
prm0 (in) User parameter 0 (unused)
prm1 (in) User parameter 1 (unused)
prm2 (in) User parameter 2 (unused)
tx (in) Tx/Rx free (1/0)
LCS_freeBuffer() frees a test packet.

References _LCS_Cmd::dmg, LCS_dumpHex(), LCS_L_PAGE, _LCS_Cmd::out, _LCS_Cmd::ovr, _LCS_CmdParam::pgs, _LCS_CmdParam::tst, and _LCS_Cmd::use.

Referenced by forkIntegrity(), LCS_sendCPU(), and LCS_sendMessage().

void LCS_freeCCSDS ( ITC_QueueItem *  qitem,
unsigned int  status,
void *  prm0,
void *  prm1,
void *  prm2,
unsigned int  tx 
)

Free allocated buffer.

Parameters:
qitem (in) Queue item (unused)
status (in) Processing completion code (unused)
prm0 (in) User parameter 0 (unused)
prm1 (in) User parameter 1 (unused)
prm2 (in) User parameter 2 (unused)
tx (in) Tx/Rx free (1/0)
LCS_freeBuffer() frees a test packet.

References _LCS_Cmd::dmg, LCS_dumpHex(), LCS_L_PAGE, _LCS_Cmd::out, _LCS_Cmd::ovr, and _LCS_Cmd::use.

Referenced by LCS_sendCCSDS(), and LCS_sendSDI().

unsigned int LCS_sendCCSDS ( unsigned int  tst,
unsigned int  apid,
int  fst,
int  lst,
int  pgs,
int  beg,
int  end,
ITC_cb_Completion *  rtn,
FPA_fcb *  fcb,
unsigned char *  buf,
LCS_Cmd cmd 
)

Send a message (no memory allocation).

Parameters:
tst (in) Test ID
apid (in) APID
fst (in) If true, set the "first" bit in CCSDS sequence flags
lst (in) If true, set the "last" bit in CCSDS sequence flags
pgs (in) Number of 512 byte pages to send
beg (in) Offset from perfect alignment at send head
end (in) Offset from perfect alignment at send tail
rtn (in) ITC completion routine
fcb (in) FPA control block
buf (in) Message buffer
cmd (in) Command buffer (can be null)
Return values:
LCS_GENERROR Failure
LCS_SUCCESS Success

References LCS_freeCCSDS(), and LCS_L_PAGE.

Referenced by LCS_sendSDI().

unsigned int LCS_sendCPU ( ITC_NodeID  nid,
ITC_TaskID  tid,
ITC_QueueID  qid,
ITC_ProtID  pid,
int  pgs,
int  beg,
int  end 
)

Send a message (automatic memory allocation).

Parameters:
nid (in) Destination node ID
tid (in) Destination task ID
qid (in) Destination queue ID
pid (in) Hardware protocol ID
pgs (in) Number of 512 byte pages to send
beg (in) Offset from perfect alignment at send head
end (in) Offset from perfect alignment at send tail
Return values:
LCS_GENERROR Failure
LCS_SUCCESS Success

References _LCS_TestControl::fpm, LCS_freeBuffer(), LCS_K_PAGE, and LCS_sendMessage().

unsigned int LCS_sendMessage ( unsigned int  tst,
ITC_NodeID  nid,
ITC_TaskID  tid,
ITC_QueueID  qid,
ITC_ProtID  pid,
int  pgs,
int  beg,
int  end,
ITC_cb_Completion *  rtn,
FPA_fcb *  fcb,
unsigned char *  buf,
LCS_Cmd cmd 
)

Send a message (no memory allocation).

Parameters:
tst (in) Test ID
nid (in) Destination node ID
tid (in) Destination task ID
qid (in) Destination queue ID
pid (in) Hardware protocol ID
pgs (in) Number of 512 byte pages to send
beg (in) Offset from perfect alignment at send head
end (in) Offset from perfect alignment at send tail
rtn (in) ITC completion routine
fcb (in) FPA control block
buf (in) Message buffer
cmd (in) Command buffer (can be null)
Return values:
LCS_GENERROR Failure
LCS_SUCCESS Success

References _LCS_CmdParam::beg, _LCS_CmdParam::end, LCS_freeBuffer(), LCS_L_PAGE, _LCS_CmdParam::nid, _LCS_CmdParam::pgs, _LCS_CmdParam::pid, _LCS_CmdParam::qid, _LCS_CmdParam::tid, and _LCS_CmdParam::tst.

Referenced by forkFragmentFrg(), forkFragmentPre(), forkIntegrity(), forkPriorityMax(), forkPriorityMin(), forkSpeed(), and LCS_sendCPU().

unsigned int LCS_sendSDI ( unsigned int  apid,
int  fst,
int  lst,
int  pgs,
int  beg,
int  end 
)

Send a message (automatic memory allocation).

Parameters:
apid (in) APID
fst (in) If true, set the "first" bit in CCSDS sequence flags
lst (in) If true, set the "last" bit in CCSDS sequence flags
pgs (in) Number of 512 byte pages to send
beg (in) Offset from perfect alignment at send head
end (in) Offset from perfect alignment at send tail
Return values:
LCS_GENERROR Failure
LCS_SUCCESS Success

References _LCS_TestControl::fpm, LCS_freeCCSDS(), LCS_K_PAGE, and LCS_sendCCSDS().

unsigned int LCS_testAttach ( ITC_TaskID  tid  ) 

Attach LCS testability features to a task.

Parameters:
tid (in) Task to "instrument"

References _LCS_TestTask::fpm, _LCS_TestTask::itc, LCS_accumRcv(), _LCS_TestTask::msk, and _LCS_TestControl::tsk.

void * LRX_allocTest ( ITC_Queue *  queue,
unsigned int  siz,
ITC_cb_Completion **  rtn,
void **  cb0,
void **  cb1,
void **  cb2 
)

Allocation plug-in (normal operation ... not testing).

Parameters:
queue (in) Queue handle
siz (in) Bytes to allocate
rtn (out) Memory deallocation callback routine
cb0 (out) Memory deallocation callback routine parameter 0
cb1 (out) Memory deallocation callback routine parameter 1
cb2 (out) Memory deallocation callback routine parameter 2
LRX_reset() performs common reset functions including checking for service shutdown handling.

References LCS_PAT_K_WORD.

Referenced by LCS_testInitialize().


Generated on Mon Mar 28 15:57:44 2011 by  doxygen 1.5.8