GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> CTDB / V5-5-6 > ctdb_bc_test_sim / rad750
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <CTDB/CTDB_bc.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_bc_test_private.h>
Defines | |
#define | BC_APID_CMD_RX 10 |
#define | BC_FUNC_CMD_RX 2 |
#define | BC_TELEM_RECV_PRI 150 |
#define | BC_TELEM_RECV_NAME "uTelemRx" |
#define | BC_CMD_TX_RECV_PRI 130 |
#define | BC_CMD_TX_RECV_NAME "uCmdTx" |
#define | MSG_PRI 210 |
#define | RT_APID_HKP 0x20e |
Functions | |
static void | bc_pkt_free (void *pkt, void *arg) |
static void | bc_pkt_telem (void) |
static void | bc_pkt_cmd_tx (void) |
static void | bc_pkt_telem_print (unsigned char *pkt, unsigned char *hdr, int wordCount) |
int | bc_init (void *addr, int busB, int hkpPrint) |
int | bc_start (void) |
int | bc_stop (void) |
int | bc_exit (void) |
int | bc_pkt_cmd_rx (unsigned int size) |
static unsigned int | bc_pkt_cmd_rx_parse (CLI_Control *cli, bc_test_config *config) |
static unsigned int | bc_start_parse (CLI_Control *cli, bc_test_config *config) |
static unsigned int | bc_stop_parse (CLI_Control *cli, bc_test_config *config) |
static unsigned int | exit_parse (CLI_Control *cli, bc_test_config *config) |
int | main (int argc, char **argv) |
Variables | |
bc_test_config | bcTestConfig |
static const char * | dumpLine |
static const char * | initMsg = "BC not initialized\n" |
#define BC_APID_CMD_RX 10 |
A fake CCSDS application ID to use for sent telecommand packets.
#define BC_CMD_TX_RECV_NAME "uCmdTx" |
The name of the telecommand receive task (VxWorks only).
Referenced by bc_start().
#define BC_CMD_TX_RECV_PRI 130 |
The priority to run the telecommand receive task (VxWorks only).
Referenced by bc_start().
#define BC_FUNC_CMD_RX 2 |
A fake function code to use for sent telecommand packets.
#define BC_TELEM_RECV_NAME "uTelemRx" |
The name of the telemetry receive task (VxWorks only).
Referenced by bc_start().
#define BC_TELEM_RECV_PRI 150 |
The priority to run the telemetry receive task (VxWorks only).
Referenced by bc_start().
#define MSG_PRI 210 |
The priority of the MSG output task.
Referenced by bc_init().
#define RT_APID_HKP 0x20e |
The fake CCSDS APID used by the RT test application for HKP telemetry test packets.
Referenced by bc_pkt_telem().
int bc_exit | ( | void | ) |
Stops the test application and releases resources.
0 | Success. | |
-1 | Failure. |
References _bc_test_config::bc, _bc_test_config::cmdTxRecvExit, _bc_test_config::cmdTxRecvTask, CTDB_bcExit(), _bc_test_config::initialized, initMsg, _bc_test_config::spawned, _bc_test_config::telemRecvExit, and _bc_test_config::telemRecvTask.
Referenced by main().
int bc_init | ( | void * | addr, | |
int | busB, | |||
int | hkpPrint | |||
) |
Initializes the test application. The device specific initialization is handled in bc_init_dev().
addr | Address of remote terminal (1553 RT or IP). | |
busB | Use 1553 bus side B as default. | |
hkpPrint | 0 = do not display HKP telemetry packets as they are received; 1 = display HKP telemetry packets as they are received |
0 | Success. | |
-1 | Failure. |
References _bc_test_config::bc, bc_init_dev(), _bc_test_config::cmdRxSeq, _bc_test_config::cmdRxVal, _bc_test_config::cmdTxRecvTask, CTDB_bcGet(), _bc_test_config::hkpPrint, _bc_test_config::initialized, MSG_PRI, _bc_test_config::spawned, and _bc_test_config::telemRecvTask.
Referenced by main().
int bc_pkt_cmd_rx | ( | unsigned int | size | ) |
Sends a test telecommand receive packet from the bus controller.
size | The size in bytes of faked test pattern data in packet. |
0 | Success. | |
-1 | Failure. |
References _bc_test_config::bc, bc_pkt_free(), _bc_test_config::cmdRxSeq, _bc_test_config::cmdRxVal, CO1553_MSG_SIZE, CTDB_bcPktCmdRxSend(), _bc_test_config::initialized, and initMsg.
Referenced by bc_pkt_cmd_rx_parse().
unsigned int bc_pkt_cmd_rx_parse | ( | CLI_Control * | cli, | |
bc_test_config * | config | |||
) | [static] |
CLI callback for "bc_pkt_cmd_rx" command.
cli | CLI control handle. | |
config | Application configuration. |
References bc_pkt_cmd_rx().
Referenced by main().
static void bc_pkt_cmd_tx | ( | void | ) | [static] |
Listens for and displays telecommand transmit packets arriving at the bus controller.
References _bc_test_config::bc, _bc_test_config::cmdTxRecvExit, CO1553_MSG_SIZE, CTDB_bcPktCmdTxFree(), CTDB_bcPktCmdTxRecv(), and dumpLine.
Referenced by bc_start().
static void bc_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 bc_pkt_cmd_rx().
static void bc_pkt_telem | ( | void | ) | [static] |
Listens for and displays telemetry packets arriving at the bus controller.
References _bc_test_config::bc, bc_pkt_telem_print(), CO1553_MSG_SIZE, CTDB_bcPktTelemFree(), CTDB_bcPktTelemRecv(), _bc_test_config::hkpPrint, RT_APID_HKP, and _bc_test_config::telemRecvExit.
Referenced by bc_start().
static void bc_pkt_telem_print | ( | unsigned char * | pkt, | |
unsigned char * | hdr, | |||
int | wordCount | |||
) | [static] |
Displays telemetry packet contents.
pkt | A pointer to the packet buffer. | |
hdr | A pointer | |
wordCount | The number of 16 bit words in the packet. |
References dumpLine.
Referenced by bc_pkt_telem().
int bc_start | ( | void | ) |
Starts the bus controller and packet receive tasks.
0 | Success. | |
-1 | Failure. |
References _bc_test_config::bc, BC_CMD_TX_RECV_NAME, BC_CMD_TX_RECV_PRI, bc_pkt_cmd_tx(), bc_pkt_telem(), BC_TELEM_RECV_NAME, BC_TELEM_RECV_PRI, _bc_test_config::cmdTxRecvExit, _bc_test_config::cmdTxRecvTask, CTDB_bcStart(), _bc_test_config::initialized, initMsg, _bc_test_config::spawned, _bc_test_config::telemRecvExit, and _bc_test_config::telemRecvTask.
Referenced by bc_start_parse().
unsigned int bc_start_parse | ( | CLI_Control * | cli, | |
bc_test_config * | config | |||
) | [static] |
CLI callback for "bc_start" command.
cli | CLI control handle. | |
config | Application configuration. |
References bc_start().
Referenced by main().
int bc_stop | ( | void | ) |
Stops the bus controller and packet receive tasks.
0 | Success. | |
-1 | Failure. |
References _bc_test_config::bc, _bc_test_config::cmdTxRecvExit, _bc_test_config::cmdTxRecvTask, CTDB_bcStop(), _bc_test_config::initialized, initMsg, _bc_test_config::spawned, _bc_test_config::telemRecvExit, and _bc_test_config::telemRecvTask.
Referenced by bc_stop_parse().
unsigned int bc_stop_parse | ( | CLI_Control * | cli, | |
bc_test_config * | config | |||
) | [static] |
unsigned int exit_parse | ( | CLI_Control * | cli, | |
bc_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 bc_exit(), bc_init(), bc_pkt_cmd_rx_parse(), bc_start_parse(), bc_stop_parse(), and exit_parse().
The global instance of the test application descriptor.
dumpLine [static] |
Initial value:
"-------------------------------------------------------------------------------\n"
Referenced by bc_pkt_cmd_tx(), and bc_pkt_telem_print().
initMsg = "BC not initialized\n" [static] |
An error message.
Referenced by bc_exit(), bc_pkt_cmd_rx(), bc_start(), and bc_stop().