GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> MEM / V5-8-1 > mem_unit_test / linux-gcc
#include <string.h>
#include <CCSDS/CCSDS_msg.h>
#include <MEM/MEM_load.h>
#include <MEM/MEM_map.h>
#include <MEM/MEM_msgs.h>
#include <MSG/MSG_pubdefs.h>
#include <mem_unit_test.h>
Classes | |
struct | _mem_LoadInfo |
Load unit test descriptor. More... | |
Defines | |
#define | MEM_LOAD_MEM_WRITE_MAX_WORDS (4096 / 4) |
Maximum number of words that can be loaded with a Memory Write telecommand. | |
Typedefs | |
typedef struct _mem_LoadInfo | mem_LoadInfo |
Typedef for _mem_LoadInfo. | |
Functions | |
static int | mem_loadInit_wrap (test_Test_Descriptor *td_p, int id, mem_LoadInfo *info_p) |
Start the Memory Load system and verify the results. | |
static int | mem_loadGetInfo_wrap (test_Test_Descriptor *td_p, int id, mem_LoadInfo *info_p) |
Get and verify information for a load context. | |
static int | mem_loadGetContext_wrap (test_Test_Descriptor *td_p, int id, mem_LoadInfo *info_p) |
Get and verify a load context. | |
static int | mem_loadReleaseContext_wrap (test_Test_Descriptor *td_p, int id, mem_LoadInfo *info_p) |
Release and verify a load context. | |
static int | mem_loadPktMemory_wrap (test_Test_Descriptor *td_p, int id, mem_LoadInfo *info_p) |
Announce and verify arrival of Memory Write command. | |
static int | mem_loadPktPci_wrap (test_Test_Descriptor *td_p, int id, mem_LoadInfo *info_p) |
Announce and verify arrival of Memory PCI Device Header Write command. | |
static int | mem_loadPktReg_wrap (test_Test_Descriptor *td_p, int id, mem_LoadInfo *info_p) |
Announce and verify arrival of Memory Processor Register Write command. | |
static int | mem_loadWrite_wrap (test_Test_Descriptor *td_p, int id, mem_LoadInfo *info_p) |
Write and verify data for a load context. | |
static int | mem_loadMapInit_wrap (test_Test_Descriptor *td_p, int id, mem_LoadInfo *info_p) |
Start the Memory Map interface and verify the results. | |
static int | mem_loadMapAddEntry_wrap (test_Test_Descriptor *td_p, int id, mem_LoadInfo *info_p) |
Add an entry to the Memory Map and verify the results. | |
void | mem_LoadParam_test (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Test for Memory Load bad parameter handling. | |
void | mem_LoadContext_test (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Unit test for Memory Load context operations. | |
static int | mem_check_memory_write (test_Test_Descriptor *td_p, mem_LoadInfo *load_p, unsigned int pkt_bytes, unsigned int load_words) |
Verify Memory Write telecommands. | |
void | mem_LoadSize_test (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Unit test for Memory Write telecommands. | |
void | mem_LoadMemory_test (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Unit test for Memory Write telecommands. |
This is the unit test for the functions that handle Memory Load telecommands and the resulting load operations.
CVS $Id: mem_test_load.c,v 1.7 2011/03/29 01:58:52 apw Exp $
#define MEM_LOAD_MEM_WRITE_MAX_WORDS (4096 / 4) |
Maximum number of words that can be loaded with a Memory Write telecommand.
Maximum number of words that can be loaded with a Memory Write telecommand. Defined here to avoid including MEMCMD.h.
Referenced by mem_LoadSize_test().
int mem_check_memory_write | ( | test_Test_Descriptor * | td_p, | |
mem_LoadInfo * | load_p, | |||
unsigned int | pkt_bytes, | |||
unsigned int | load_words | |||
) | [static] |
Verify Memory Write telecommands.
Verify the handling of Memory Write telecommands.
td_p | Pointer to test descriptor. | |
load_p | Pointer to local load descriptor. | |
pkt_bytes | Value for the Memory Write command 'length' parm. | |
load_words | Value for the Memory Write command 'wordCount' parm. |
0 | Success. | |
-1 | Failure. |
References _mem_LoadInfo::dest, _mem_LoadInfo::exp_dest, _mem_LoadInfo::exp_info, _mem_LoadInfo::exp_info_status, _mem_LoadInfo::exp_status, _MEM_LoadInfo::is_active, _MEM_LoadInfo::map, mem_loadPktMemory_wrap(), mem_loadWrite_wrap(), _MEM_LoadInfo::offset, _mem_LoadInfo::pkt, _mem_LoadInfo::pkt_bytes, _mem_LoadInfo::pkt_p, _MEM_LoadInfo::start_addr, _MEM_LoadInfo::status, test_Memory_Compare(), test_Pop_State(), test_PrnFill32(), test_Push_State(), and _MEM_LoadInfo::total_bytes.
Referenced by mem_LoadSize_test().
void mem_LoadContext_test | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Unit test for Memory Load context operations.
Verify the handling of Memory Load context 'get', 'release', and 'info' operations.
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
0 | Success. | |
-1 | Failure. |
References _mem_LoadInfo::act_info, DIM, _test_Test_Descriptor::exec, _mem_LoadInfo::exp_info, _mem_LoadInfo::exp_info_status, _mem_LoadInfo::exp_status, _test_Test_Descriptor::fail, _mem_LoadInfo::handle, _mem_LoadInfo::handle_p, _mem_LoadInfo::info_p, mem_loadGetContext_wrap(), mem_loadGetInfo_wrap(), mem_loadInit_wrap(), mem_loadReleaseContext_wrap(), _MEM_LoadInfo::status, test_Pop_State(), and test_Push_State().
Referenced by mem_unit_test_func().
int mem_loadGetContext_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_LoadInfo * | info_p | |||
) | [static] |
Get and verify a load context.
Wrapper for the MEM_loadGetContext() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to load information. |
0 | Success. | |
-1 | Failure. |
References _mem_LoadInfo::exp_status, _mem_LoadInfo::handle_p, MEM_loadGetContext(), mem_loadGetInfo_wrap(), test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_LoadContext_test(), mem_LoadMemory_test(), mem_LoadParam_test(), and mem_LoadSize_test().
int mem_loadGetInfo_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_LoadInfo * | info_p | |||
) | [static] |
Get and verify information for a load context.
Wrapper for the MEM_loadGetInfo() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to load information. |
0 | Success. | |
-1 | Failure. |
References _mem_LoadInfo::exp_info, _mem_LoadInfo::exp_info_status, _mem_LoadInfo::handle, _mem_LoadInfo::info_p, MEM_loadGetInfo(), test_LoadInfo_Compare(), test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_LoadContext_test(), mem_loadGetContext_wrap(), mem_LoadMemory_test(), mem_LoadParam_test(), mem_loadPktMemory_wrap(), mem_loadPktPci_wrap(), mem_loadPktReg_wrap(), and mem_loadWrite_wrap().
int mem_loadInit_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_LoadInfo * | info_p | |||
) | [static] |
Start the Memory Load system and verify the results.
Wrapper for the MEM_loadInit() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to memory load test information. |
0 | Success. | |
-1 | Failure. |
References _mem_LoadInfo::exp_status, MEM_loadInit(), test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_LoadContext_test(), mem_LoadMemory_test(), mem_LoadParam_test(), and mem_LoadSize_test().
int mem_loadMapAddEntry_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_LoadInfo * | info_p | |||
) | [static] |
Add an entry to the Memory Map and verify the results.
Wrapper for the MEM_mapAddEntry() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to memory load test info. |
0 | Success. | |
-1 | Failure. |
References _mem_LoadInfo::exp_status, _mem_LoadInfo::map_access_flags, _mem_LoadInfo::map_num_bytes, _mem_LoadInfo::map_read_cb, _mem_LoadInfo::map_start_addr, _mem_LoadInfo::map_write_cb, MEM_mapAddEntry(), test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_LoadMemory_test(), and mem_LoadSize_test().
int mem_loadMapInit_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_LoadInfo * | info_p | |||
) | [static] |
Start the Memory Map interface and verify the results.
Wrapper for the MEM_mapInit() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to memory load test info. |
0 | Success. | |
-1 | Failure. |
References _mem_LoadInfo::exp_status, MEM_mapInit(), test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_LoadMemory_test(), and mem_LoadSize_test().
void mem_LoadMemory_test | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Unit test for Memory Write telecommands.
Verify the handling of Memory Write telecommands.
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
0 | Success. | |
-1 | Failure. |
References _mem_LoadInfo::act_info, _mem_LoadInfo::dest, _test_Test_Descriptor::exec, _mem_LoadInfo::exp_dest, _mem_LoadInfo::exp_info, _mem_LoadInfo::exp_info_status, _mem_LoadInfo::exp_status, _test_Test_Descriptor::fail, _mem_LoadInfo::handle, _mem_LoadInfo::handle_p, _mem_LoadInfo::info_p, _MEM_LoadInfo::is_active, _MEM_LoadInfo::map, _mem_LoadInfo::map_access_flags, _mem_LoadInfo::map_num_bytes, _mem_LoadInfo::map_read_cb, _mem_LoadInfo::map_start_addr, _mem_LoadInfo::map_write_cb, mem_loadGetContext_wrap(), mem_loadGetInfo_wrap(), mem_loadInit_wrap(), mem_loadMapAddEntry_wrap(), mem_loadMapInit_wrap(), mem_loadPktMemory_wrap(), mem_loadReleaseContext_wrap(), mem_loadWrite_wrap(), MEM_MAP_ACCESS_WRITE_32, MEM_mapRWGeneric(), _MEM_LoadInfo::offset, _mem_LoadInfo::pkt, _mem_LoadInfo::pkt_bytes, _mem_LoadInfo::pkt_p, _MEM_LoadInfo::start_addr, _MEM_LoadInfo::status, test_Memory_Compare(), test_Pop_State(), test_PrnFill32(), test_Push_State(), and _MEM_LoadInfo::total_bytes.
Referenced by mem_unit_test_func().
void mem_LoadParam_test | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Test for Memory Load bad parameter handling.
Verify the handling of bad parameters by the Memory Load functions.
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
0 | Success. | |
-1 | Failure. |
References _mem_LoadInfo::act_info, _test_Test_Descriptor::exec, _mem_LoadInfo::exp_info, _mem_LoadInfo::exp_info_status, _mem_LoadInfo::exp_status, _test_Test_Descriptor::fail, _mem_LoadInfo::handle, _mem_LoadInfo::handle_p, _mem_LoadInfo::info_p, mem_loadGetContext_wrap(), mem_loadGetInfo_wrap(), mem_loadInit_wrap(), mem_loadPktMemory_wrap(), mem_loadPktPci_wrap(), mem_loadPktReg_wrap(), mem_loadReleaseContext_wrap(), mem_loadWrite_wrap(), _mem_LoadInfo::pkt, _mem_LoadInfo::pkt_bytes, _mem_LoadInfo::pkt_p, _MEM_LoadInfo::status, test_Pop_State(), and test_Push_State().
Referenced by mem_unit_test_func().
int mem_loadPktMemory_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_LoadInfo * | info_p | |||
) | [static] |
Announce and verify arrival of Memory Write command.
Wrapper for the MEM_loadPktMemory() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to load information. |
0 | Success. | |
-1 | Failure. |
References _mem_LoadInfo::exp_status, _mem_LoadInfo::handle, mem_loadGetInfo_wrap(), MEM_loadPktMemory(), _mem_LoadInfo::pkt_bytes, _mem_LoadInfo::pkt_p, test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_check_memory_write(), mem_LoadMemory_test(), and mem_LoadParam_test().
int mem_loadPktPci_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_LoadInfo * | info_p | |||
) | [static] |
Announce and verify arrival of Memory PCI Device Header Write command.
Wrapper for the MEM_loadPktPci() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to load information. |
0 | Success. | |
-1 | Failure. |
References _mem_LoadInfo::exp_status, _mem_LoadInfo::handle, mem_loadGetInfo_wrap(), MEM_loadPktPci(), _mem_LoadInfo::pkt_bytes, _mem_LoadInfo::pkt_p, test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_LoadParam_test().
int mem_loadPktReg_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_LoadInfo * | info_p | |||
) | [static] |
Announce and verify arrival of Memory Processor Register Write command.
Wrapper for the MEM_loadPktReg() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to load information. |
0 | Success. | |
-1 | Failure. |
References _mem_LoadInfo::exp_status, _mem_LoadInfo::handle, mem_loadGetInfo_wrap(), MEM_loadPktReg(), _mem_LoadInfo::pkt_bytes, _mem_LoadInfo::pkt_p, test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_LoadParam_test().
int mem_loadReleaseContext_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_LoadInfo * | info_p | |||
) | [static] |
Release and verify a load context.
Wrapper for the MEM_loadReleaseContext() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to load information. |
0 | Success. | |
-1 | Failure. |
References _mem_LoadInfo::exp_status, _mem_LoadInfo::handle, MEM_loadReleaseContext(), test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_LoadContext_test(), mem_LoadMemory_test(), mem_LoadParam_test(), and mem_LoadSize_test().
void mem_LoadSize_test | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Unit test for Memory Write telecommands.
Verify the handling of Memory Write telecommands with various amounts of data.
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
0 | Success. | |
-1 | Failure. |
References _mem_LoadInfo::act_info, _mem_LoadInfo::dest, _test_Test_Descriptor::exec, _mem_LoadInfo::exp_info, _mem_LoadInfo::exp_info_status, _mem_LoadInfo::exp_status, _test_Test_Descriptor::fail, _mem_LoadInfo::handle, _mem_LoadInfo::handle_p, _mem_LoadInfo::info_p, _mem_LoadInfo::map_access_flags, _mem_LoadInfo::map_num_bytes, _mem_LoadInfo::map_read_cb, _mem_LoadInfo::map_start_addr, _mem_LoadInfo::map_write_cb, mem_check_memory_write(), MEM_LOAD_MEM_WRITE_MAX_WORDS, mem_loadGetContext_wrap(), mem_loadInit_wrap(), mem_loadMapAddEntry_wrap(), mem_loadMapInit_wrap(), mem_loadReleaseContext_wrap(), MEM_MAP_ACCESS_WRITE_32, MEM_mapRWGeneric(), _mem_LoadInfo::pkt, _mem_LoadInfo::pkt_p, _MEM_LoadInfo::status, test_Pop_State(), and test_Push_State().
Referenced by mem_unit_test_func().
int mem_loadWrite_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_LoadInfo * | info_p | |||
) | [static] |
Write and verify data for a load context.
Wrapper for the MEM_loadWrite() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to load information. |
0 | Success. | |
-1 | Failure. |
References _mem_LoadInfo::exp_status, _mem_LoadInfo::handle, mem_loadGetInfo_wrap(), MEM_loadWrite(), test_Delay(), test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_check_memory_write(), mem_LoadMemory_test(), and mem_LoadParam_test().