GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LCS / dev > lcs_test / mv2304
#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_TestControl * | LCS_tcb |
Control block for LCS testing. | |
LCS_Cmd * | cmd |
A command used in the fragmentation test. | |
unsigned int | nomore |
Flag to discontinue the fragmenetation wake-up timer. |
CVS $Id: LCS_common.c,v 1.10 2011/03/28 22:49:56 apw Exp $
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.
prm | (in) User context parameter | |
wut | (in) Timer handle |
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 | |||
) |
Raw packet processing.
prm | (in) User context parameter | |
qitem | (in) Queue item | |
pay | (in) Queue item payload pointer | |
len | (in) Queue item payload length |
LCS_SUCCESS | Success |
References _LCS_CmdParam::beg, _LCS_TestQueue::byt, _LCS_Cmd::cid, _LCS_TestQueue::cnt, _LCS_Cmd::dmg, _LCS_Cmd::drp, _LCS_TestQueue::dst, _LCS_CmdParam::end, _LCS_TestControl::fpc, _LCS_Cmd::fqi, fragmentSet(), fragmentTimer(), _LCS_TestQueue::grd, LCS_dumpHex(), LCS_PAT_K_WORD, _LCS_Cmd::msg, _LCS_CmdParam::nid, _LCS_Cmd::out, _LCS_Cmd::ovr, _LCS_TestQueue::pat, _LCS_CmdParam::pgs, _LCS_CmdParam::pid, _LCS_Cmd::prm, _LCS_TestQueue::prm, _LCS_CmdParam::qid, _LCS_TestTask::rcv, _LCS_Cmd::rtn, _LCS_CmdParam::tid, _LCS_Cmd::tmr, _LCS_TestControl::tsk, _LCS_CmdParam::tst, and _LCS_Cmd::use.
Referenced by LCS_testAttach().
void LCS_clearRcv | ( | ITC_TaskID | tid, | |
ITC_QueueID | qid | |||
) |
Raw packet processing.
tid | (in) ITC task ID (-1 for all) | |
qid | (in) ITC queue ID (-1 for all) |
References _LCS_TestTask::msk, _LCS_TestTask::rcv, and _LCS_TestControl::tsk.
void LCS_dumpHex | ( | const void * | buf, | |
int | bef, | |||
int | aft | |||
) |
Simple hex dump.
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 | |||
) |
Raw packet processing.
tid | (in) ITC task ID | |
qid | (in) ITC queue ID |
References _LCS_CmdParam::beg, _LCS_TestQueue::byt, _LCS_TestQueue::cnt, _LCS_TestQueue::dst, _LCS_CmdParam::end, _LCS_TestQueue::grd, _LCS_TestTask::msk, _LCS_CmdParam::nid, _LCS_TestQueue::pat, _LCS_CmdParam::pgs, _LCS_CmdParam::pid, _LCS_TestQueue::prm, _LCS_CmdParam::qid, _LCS_TestTask::rcv, _LCS_CmdParam::tid, _LCS_TestControl::tsk, and _LCS_CmdParam::tst.
void LCS_freeBuffer | ( | ITC_QueueItem * | qitem, | |
unsigned int | status, | |||
void * | prm0, | |||
void * | prm1, | |||
void * | prm2, | |||
unsigned int | tx | |||
) |
Free allocated buffer.
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) |
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.
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) |
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).
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) |
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).
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 |
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).
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) |
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).
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 |
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.
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).
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 |
References LCS_PAT_K_WORD.
Referenced by LCS_testInitialize().