GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> CTDB / V5-5-6 > ctdb_rt_test_sim / linux-gcc
#include <stdio.h>
#include <stdlib.h>
#include <CTDB/CTDB_rt.h>
#include <CTDB/CO1553_util.h>
#include <CCSDS/CCSDS_pkt.h>
#include <CCSDS/CCSDS_dump.h>
#include <CCSDS/CCSDS_swap.h>
#include <PBS/PBS.h>
#include <PBS/TASK.h>
#include <PBS/TOC.h>
#include <PBS/TOV.h>
#include <PBS/MBA.h>
#include <MSG/MSG_pubdefs.h>
#include <MSG/MSG_printProc.h>
#include <CLI/CLI_pubdefs.h>
#include <ctdb_rt_test_private.h>
Defines | |
#define | RT_CMD_RECV_PRI 150 |
#define | RT_CMD_RECV_NAME "uCmdRx" |
#define | MSG_PRI 210 |
#define | RT_APID_TELEM 0x260 |
#define | RT_APID_CMD_TX 0x600 |
#define | RT_FUNC_CMD_TX 0 |
Functions | |
static void | rt_pkt_free (void *pkt, void *arg) |
static void | rt_pkt_cmd_rx (void) |
int | rt_init (void *addr) |
int | rt_start (void) |
int | rt_stop (void) |
int | rt_exit (void) |
int | rt_diag (void) |
int | rt_clear (void) |
int | rt_pkt_telem (unsigned int size, int priority) |
int | rt_pkt_cmd_tx (unsigned int size) |
static unsigned int | rt_pkt_telem_parse (CLI_Control *cli, rt_test_config *config) |
static unsigned int | rt_pkt_cmd_tx_parse (CLI_Control *cli, rt_test_config *config) |
static unsigned int | rt_start_parse (CLI_Control *cli, rt_test_config *config) |
static unsigned int | rt_stop_parse (CLI_Control *cli, rt_test_config *config) |
static unsigned int | exit_parse (CLI_Control *cli, rt_test_config *config) |
int | main (int argc, char **argv) |
Variables | |
rt_test_config | rtTestConfig |
static const char * | dumpLine |
static const char * | initMsg = "RT not initialized\n" |
#define MSG_PRI 210 |
The priority of the MSG output task.
Referenced by rt_init().
#define RT_APID_CMD_TX 0x600 |
A fake CCSDS application ID to use for sent telecommand packets.
Referenced by rt_pkt_cmd_tx().
#define RT_APID_TELEM 0x260 |
A fake CCSDS application ID to use for sent telemetry packets.
Referenced by rt_pkt_telem().
#define RT_CMD_RECV_NAME "uCmdRx" |
The name of the telecommand receive task (VxWorks only).
Referenced by rt_start().
#define RT_CMD_RECV_PRI 150 |
The priority to run the telecommand receive task (VxWorks only).
Referenced by rt_start().
#define RT_FUNC_CMD_TX 0 |
A fake function code to use for sent telecommand packets.
Referenced by rt_pkt_cmd_tx().
unsigned int exit_parse | ( | CLI_Control * | cli, | |
rt_test_config * | config | |||
) | [static] |
CLI callback for "exit" command.
cli | CLI control handle. | |
config | Application configuration. |
Referenced by main().
int main | ( | int | argc, | |
char ** | argv | |||
) |
UNIX entry point for test application.
argc | The number of command line args. | |
argv | Pointers to the command line args. |
0 | Success. | |
-1 | Failure. |
References exit_parse(), rt_exit(), rt_init(), rt_pkt_cmd_tx_parse(), rt_pkt_telem_parse(), rt_start_parse(), and rt_stop_parse().
int rt_clear | ( | void | ) |
Resets remote terminal diagnostics.
0 | Success. | |
-1 | Failure. |
References CTDB_rtDiagClear(), _rt_test_config::initialized, initMsg, and _rt_test_config::rt.
int rt_diag | ( | void | ) |
Displays remote terminal diagnostics.
0 | Success. | |
-1 | Failure. |
References _CTDB_RT_Diag::cmd_rx_byte_count, _CTDB_RT_Diag::cmd_rx_pkt_count, _CTDB_RT_Diag::cmd_tx_byte_count, _CTDB_RT_Diag::cmd_tx_pkt_count, CTDB_rtDiagGet(), _CTDB_RT_Diag::error_count, _CTDB_RT_Diag::hkp_byte_count, _CTDB_RT_Diag::hkp_pkt_count, _rt_test_config::initialized, initMsg, _CTDB_RT_Diag::intr_count, _rt_test_config::rt, _CTDB_RT_Diag::telem_byte_count, and _CTDB_RT_Diag::telem_pkt_count.
int rt_exit | ( | void | ) |
Stops the test application and releases resources.
0 | Success. | |
-1 | Failure. |
References _rt_test_config::cmdRecvExit, _rt_test_config::cmdRecvTask, CTDB_rtExit(), _rt_test_config::initialized, initMsg, _rt_test_config::rt, and _rt_test_config::spawned.
Referenced by main().
int rt_init | ( | void * | addr | ) |
Initializes the test application. The device specific initialization is handled in rt_init_dev().
addr | The remote terminal address (1553 RT or IP). |
0 | Success. | |
-1 | Failure. |
References _rt_test_config::cmdRecvTask, _rt_test_config::cmdTxSeq, _rt_test_config::cmdTxVal, CTDB_rtGet(), _rt_test_config::hkpSeq, _rt_test_config::initialized, MSG_PRI, _rt_test_config::rt, rt_init_dev(), _rt_test_config::spawned, _rt_test_config::telemSeq, and _rt_test_config::telemVal.
Referenced by main().
static void rt_pkt_cmd_rx | ( | void | ) | [static] |
Listens for and displays telecommand receive packets arriving at the remote terminal.
References _rt_test_config::cmdRecvExit, CO1553_MSG_SIZE, CTDB_rtPktCmdRxFree(), CTDB_rtPktCmdRxRecv(), dumpLine, and _rt_test_config::rt.
Referenced by rt_start().
int rt_pkt_cmd_tx | ( | unsigned int | size | ) |
Sends a test telecommand transmit packet from the remote terminal.
size | The size in bytes of faked test pattern data in packet. |
0 | Success. | |
-1 | Failure. |
References _rt_test_config::cmdTxSeq, _rt_test_config::cmdTxVal, CO1553_MSG_SIZE, CTDB_rtPktCmdTxSend(), _rt_test_config::initialized, initMsg, _rt_test_config::rt, RT_APID_CMD_TX, RT_FUNC_CMD_TX, and rt_pkt_free().
Referenced by rt_pkt_cmd_tx_parse().
unsigned int rt_pkt_cmd_tx_parse | ( | CLI_Control * | cli, | |
rt_test_config * | config | |||
) | [static] |
CLI callback for "rt_pkt_cmd_tx" command.
cli | CLI control handle. | |
config | Application configuration. |
References rt_pkt_cmd_tx().
Referenced by main().
static void rt_pkt_free | ( | void * | pkt, | |
void * | arg | |||
) | [static] |
Packet release callback used by test application.
pkt | A pointer to the packet buffer. | |
arg | User defined argument. |
Referenced by rt_pkt_cmd_tx(), and rt_pkt_telem().
int rt_pkt_telem | ( | unsigned int | size, | |
int | priority | |||
) |
Sends a test telemetry packet from the remote terminal.
size | The size in bytes of faked test pattern data in packet. | |
priority | The packet send priority: CTDB_RT_PRIORITY_HIGH or CTDB_RT_PRIORITY_LOW. |
0 | Success. | |
-1 | Failure. |
References CO1553_MSG_SIZE, CTDB_rtPktTelemSend(), _rt_test_config::initialized, initMsg, _rt_test_config::rt, RT_APID_TELEM, rt_pkt_free(), _rt_test_config::telemSeq, and _rt_test_config::telemVal.
Referenced by rt_pkt_telem_parse().
unsigned int rt_pkt_telem_parse | ( | CLI_Control * | cli, | |
rt_test_config * | config | |||
) | [static] |
CLI callback for "rt_pkt_telem" command.
cli | CLI control handle. | |
config | Application configuration. |
References CTDB_RT_PRIORITY_LOW, and rt_pkt_telem().
Referenced by main().
int rt_start | ( | void | ) |
Starts the remote terminal and packet receive tasks.
0 | Success. | |
-1 | Failure. |
References _rt_test_config::cmdRecvExit, _rt_test_config::cmdRecvTask, CTDB_rtStart(), _rt_test_config::initialized, initMsg, _rt_test_config::rt, RT_CMD_RECV_NAME, RT_CMD_RECV_PRI, rt_pkt_cmd_rx(), and _rt_test_config::spawned.
Referenced by rt_start_parse().
unsigned int rt_start_parse | ( | CLI_Control * | cli, | |
rt_test_config * | config | |||
) | [static] |
CLI callback for "rt_start" command.
cli | CLI control handle. | |
config | Application configuration. |
References rt_start().
Referenced by main().
int rt_stop | ( | void | ) |
Stops the remote terminal and packet receive tasks.
0 | Success. | |
-1 | Failure. |
References _rt_test_config::cmdRecvExit, _rt_test_config::cmdRecvTask, CTDB_rtStop(), _rt_test_config::initialized, initMsg, _rt_test_config::rt, and _rt_test_config::spawned.
Referenced by rt_stop_parse().
unsigned int rt_stop_parse | ( | CLI_Control * | cli, | |
rt_test_config * | config | |||
) | [static] |
dumpLine [static] |
Initial value:
"-------------------------------------------------------------------------------\n"
Referenced by rt_pkt_cmd_rx().
initMsg = "RT not initialized\n" [static] |
An error message.
Referenced by rt_clear(), rt_diag(), rt_exit(), rt_pkt_cmd_tx(), rt_pkt_telem(), rt_start(), and rt_stop().
The global instance of the test application descriptor.