GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> CCSDS / dev > ccsds_unit_test / mv2304


Interface   Data Structures   File List   Data Fields   Globals  

ccsds_unit_test.c File Reference

Function definitions for CCSDS package unit test program. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <CCSDS/ccsds_unit_test.h>
#include <CCSDS/CCSDS_pkt.h>
#include <CCSDS/CCSDS_dump.h>
#include <CCSDS/CCSDS_swap.h>
#include <CCSDS/CCSDS_pri.h>
#include <PBI/Endianness.h>
#include <MSG/MSG_pubdefs.h>
#include <MSG/MSG_printProc.h>
#include <PBS/PBS.h>
#include <PBS/TASK.h>
#include <PBS/MBA.h>
#include <CCSDS_pkt_private.h>

Functions

static int ccsds_pkt_test_sizeof (void)
static int ccsds_pkt_test_param (void)
static int ccsds_pkt_test_verify (void)
static int ccsds_pkt_test_set (void)
static int ccsds_pkt_test_get (void)
static int ccsds_pkt_test_chksum (void)
static int ccsds_swap_test_swap (void)
static int ccsds_pri_test_sizeof (void)
static int ccsds_pri_test_param (void)
static int ccsds_pri_test_verify (void)
static int ccsds_pri_test_get (void)
int ccsds_unit_test (void)
int main (int argc, char **argv)

Variables

static unsigned char * ccsds_pkt_cmd_buf_0
static unsigned char * ccsds_pkt_telem_buf_0
static unsigned short ccsds_pkt_cmd_buf_1 []
static unsigned short ccsds_pkt_cmd_buf_2 []
static unsigned short ccsds_pkt_cmd_buf_3 []
static unsigned short ccsds_pkt_telem_buf_1 []
static const char * dumpLine = "----------------------------------------------------------\n"


Detailed Description

Function definitions for CCSDS package unit test program.

Author:
D.L. Wood
Tests the following constituents:


Function Documentation

int ccsds_pkt_test_chksum ( void   )  [static]

Test that the ccsds_pkt checksum functions correctly calculate and insert checksum values for produced CCSDS packets. Test that the verify functions detect correct and incorrect checksum values for consumed packets.

Return values:
0 Success.
-1 Failure

References ccsds_pkt_cmd_buf_2, ccsds_pkt_cmd_buf_3, CCSDS_pktChksumCalc(), CCSDS_pktChksumInsert(), CCSDS_pktChksumVerify(), and dumpLine.

Referenced by ccsds_unit_test().

static int ccsds_pkt_test_get ( void   )  [static]

static int ccsds_pkt_test_param ( void   )  [static]

static int ccsds_pkt_test_set ( void   )  [static]

static int ccsds_pkt_test_sizeof ( void   )  [static]

Performs checks on return values from ccsds_pkt library functions.

Return values:
0 Success.
-1 Failure

References CCSDS_PKT_CHKSUM_SIZE, CCSDS_PKT_TYPE_CMD, CCSDS_PKT_TYPE_TELEM, CCSDS_pktChksumSizeof(), and CCSDS_pktHdrSizeof().

Referenced by ccsds_unit_test().

static int ccsds_pkt_test_verify ( void   )  [static]

Test that the ccsds_pkt header verification functions detect valid CCSDS packet headers and reject invalid CCSDS packet headers.

Return values:
0 Success.
-1 Failure

References ccsds_pkt_cmd_buf_1, ccsds_pkt_telem_buf_0, ccsds_pkt_telem_buf_1, CCSDS_PKT_TYPE_TELEM, CCSDS_pktHdrSizeof(), CCSDS_pktHdrVerify(), and dumpLine.

Referenced by ccsds_unit_test().

static int ccsds_pri_test_get ( void   )  [static]

static int ccsds_pri_test_param ( void   )  [static]

Performs invalid and out of range tests on parameters for ccsds_pri library functions.

Return values:
0 Success.
-1 Failure

References ccsds_pkt_telem_buf_0, ccsds_pkt_telem_buf_1, CCSDS_priHdrGetApid(), CCSDS_priHdrGetLength(), CCSDS_priHdrGetSeqCount(), CCSDS_priHdrGetSeqFlags(), CCSDS_priHdrGetType(), CCSDS_priHdrVerify(), dumpLine, and NULL.

Referenced by ccsds_unit_test().

static int ccsds_pri_test_sizeof ( void   )  [static]

Performs checks on return values from ccsds_pri library functions.

Return values:
0 Success.
-1 Failure

References CCSDS_PKT_PRI_SIZE, and CCSDS_priHdrSizeof().

Referenced by ccsds_unit_test().

static int ccsds_pri_test_verify ( void   )  [static]

Test that the ccsds_pri header verification functions detect valid CCSDS packet primary headers and reject invalid CCSDS packet primary headers.

Return values:
0 Success.
-1 Failure

References ccsds_pkt_cmd_buf_1, ccsds_pkt_telem_buf_0, ccsds_pkt_telem_buf_1, CCSDS_PKT_TYPE_TELEM, CCSDS_pktHdrSizeof(), CCSDS_priHdrVerify(), and dumpLine.

Referenced by ccsds_unit_test().

int ccsds_swap_test_swap ( void   )  [static]

Test that the ccsds_swap byte swapping functions correctly manipulate CCSDS packet headers from external to local format.

Return values:
0 Success.
-1 Failure

References ccsds_pkt_cmd_buf_0, ccsds_pkt_cmd_buf_1, ccsds_pkt_cmd_buf_2, ccsds_pkt_cmd_buf_3, ccsds_pkt_telem_buf_0, ccsds_pkt_telem_buf_1, CCSDS_PKT_TYPE_CMD, CCSDS_PKT_TYPE_TELEM, CCSDS_pktHdrSizeof(), CCSDS_priHdrSizeof(), CCSDS_swapPktHdr(), and CCSDS_swapPriHdr().

Referenced by ccsds_unit_test().

int ccsds_unit_test ( void   ) 

int main ( int  argc,
char **  argv 
)

The UNIX application entry point.

Parameters:
argc The number of command line args.
argv The list of command line args.
Return values:
0 Success.
-1 Failure.

References ccsds_unit_test().


Variable Documentation

A pointer to a scratch telecommand header buffer.

Referenced by ccsds_pkt_test_param(), ccsds_pkt_test_set(), ccsds_swap_test_swap(), and ccsds_unit_test().

Initial value:

{
        0x18b7,
        0x8345,
        0x0101,
        0x0ac7,
}
A binary image of a known telecommand header for checking packet header and checksum functions.

version = 1
type = telecommand
sec header = true
apid = 0xb7
seq flags = last
seq count = 0x345
length = 257
func code = 0xac7

Referenced by ccsds_pkt_test_get(), ccsds_pkt_test_param(), ccsds_pkt_test_verify(), ccsds_pri_test_get(), ccsds_pri_test_verify(), ccsds_swap_test_swap(), and ccsds_unit_test().

Initial value:

 
{
        0x1801,
        0xc040,
        0x0003,
        0x5634,
        0x01a6,
}
A binary image of a known telecommand header for checking packet header and checksum functions.

version = 1
type = telecommand
sec header = true
apid = 0x1
seq flags = none
seq count = 0x40
length = 2
func code = 0x5634
checksum = 0x01a6

Referenced by ccsds_pkt_test_chksum(), ccsds_pkt_test_get(), ccsds_pkt_test_param(), ccsds_pri_test_get(), ccsds_swap_test_swap(), and ccsds_unit_test().

Initial value:

 
{
        0x1804,
        0xf90b,
        0x0001,
        0x1000,
        0x0000,
}
A binary image of a known telecommand header for checking packet header and checksum functions. version = 1
type = telecommand
sec header = true
apid = 0x4
seq flags = none
seq count = 0x390b
length = 0
func code = 0x1000
checksum = 0x0000 (incorrect, actual checksum = 0x131)

Referenced by ccsds_pkt_test_chksum(), ccsds_pkt_test_get(), ccsds_pkt_test_param(), ccsds_pri_test_get(), ccsds_swap_test_swap(), and ccsds_unit_test().

Initial value:

 
{
        0x0898,
        0x0051,
        0x000f,
        0x3487,
        0xef21,
        0x0002,
        0x432a,
}
A binary image of a known telemetry header for checking packet header and checksum functions.

version = 1
type = telemetry
sec header = true
apid = 0x98
seq flags = middle
seq count = 0x51
length = 15
time sec = 0x3487ef21 time subsec = 0x2432a

Referenced by ccsds_pkt_test_get(), ccsds_pkt_test_param(), ccsds_pkt_test_verify(), ccsds_pri_test_get(), ccsds_pri_test_param(), ccsds_pri_test_verify(), ccsds_swap_test_swap(), and ccsds_unit_test().

dumpLine = "----------------------------------------------------------\n" [static]


Generated on Thu Mar 24 19:30:58 2011 by  doxygen 1.5.8