GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> MEM / V5-8-1 > mem_scp / linux-gcc
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <MSG/MSG_pubdefs.h>
#include <CCSDS/CCSDS_pkt.h>
#include <CCSDS/CCSDS_swap.h>
#include <ITC/ITC_dump.h>
#include <ITC/ITC_pubdefs.h>
#include <MEM/MEM_dump_cmd.h>
#include <MEM/MEM_send_cmd.h>
#include <MEM/MEM_msgs.h>
#include <PBS/BSWP.h>
#include <PBS/MBA.h>
#include <ZLIB/zlib.h>
#include <Memmap.h>
#include <CLI/CLI_pubdefs.h>
Defines | |
#define | TFFS_NVRAM_SIZE 256 |
The size, in bytes, to reserve for NVRAM storage. | |
Typedefs | |
typedef void(* | MEM_DumpCB )(char *pkt) |
MEM command dump callback pointer. | |
Functions | |
int | MEM_setDisplayLevelCmd (int level) |
Set the verbosity level of the MEM command display. | |
static void | mem_free_cb (ITC_QueueItem *qitem_p, unsigned int status, void *parm_0, void *parm_1, void *parm_2, unsigned int tx) |
ITC callback to free command packet memory. | |
static unsigned int | mem_send_command (unsigned int num_parms, unsigned int *parm_bytes, unsigned int *parm_values, unsigned int func_code, MEM_DumpCB dump_func_p) |
Send a Memory command. | |
unsigned int | MEM_sendCancel (unsigned int unit) |
Send the Memory Dump Cancel command. | |
unsigned int | MEM_sendDump (unsigned int unit, unsigned int start, unsigned int count) |
Send the Memory Data Dump (to 1553) command. | |
unsigned int | MEM_sendSsrDump (unsigned int unit, unsigned int start, unsigned int count) |
Send the Memory Data Dump (to SSR) command. | |
unsigned int | MEM_sendLoad (unsigned int unit, unsigned int address, unsigned int value) |
Send the Memory Write command. | |
static unsigned int | mem_load_buffer (unsigned int unit, unsigned int address, unsigned int num_words, unsigned int *buf_p) |
Use the Memory Write command to load a buffer of data. | |
unsigned int | MEM_sendPciDump (unsigned int unit, unsigned int tran, unsigned int bus, unsigned int device, unsigned int function) |
Send the PCI Device Header Dump command. | |
unsigned int | MEM_sendPciLoad (unsigned int unit, unsigned int bus, unsigned int device, unsigned int function, unsigned int offset, unsigned int value) |
Send the PCI Device Header Write command. | |
unsigned int | MEM_sendPoolDump (unsigned int unit, unsigned int tran, unsigned int pool) |
Send the Memory Pool Status Dump command. | |
unsigned int | MEM_sendRegDump (unsigned int unit, unsigned int tran) |
Send the Processor Register Dump command. | |
unsigned int | MEM_sendRegLoad (unsigned int unit, unsigned int offset, unsigned int value) |
Send the Processor Register Write command. | |
unsigned int | MEM_sendSymRelDump (unsigned int unit, unsigned int tran, unsigned int offset, unsigned int count, unsigned char *name) |
Send the Memory Dump to 1553 Symbol Relative command. | |
unsigned int | MEM_sendSymRelSsrDump (unsigned int unit, unsigned int tran, unsigned int offset, unsigned int count, unsigned char *name) |
Send the Memory Dump to SSR Symbol Relative command. | |
unsigned int | MEM_sendSymValDump (unsigned int unit, unsigned char *name) |
Send the Memory Symbol Lookup command. | |
unsigned int | MEM_loadBankHeader (unsigned int lat_unit, unsigned int address, unsigned int rtos_bytes, unsigned int sbc_0_bytes, unsigned int sbc_1_bytes) |
Load a bank header into SIB EEPROM. | |
static unsigned int | MEM_loadBankHeader_cli (CLI_Control *cli, void *prm) |
CLI callback for the "MEM_loadBankHeader" command. | |
static unsigned int | MEM_sendCancel_cli (CLI_Control *cli, void *prm) |
CLI callback for the "MEM_sendCancel" command. | |
static unsigned int | MEM_sendDump_cli (CLI_Control *cli, void *prm) |
CLI callback for the "MEM_sendDump" command. | |
static unsigned int | MEM_sendSsrDump_cli (CLI_Control *cli, void *prm) |
CLI callback for the "MEM_sendSsrDump" command. | |
static unsigned int | MEM_sendLoad_cli (CLI_Control *cli, void *prm) |
CLI callback for the "MEM_sendLoad" command. | |
static unsigned int | MEM_sendPciDump_cli (CLI_Control *cli, void *prm) |
CLI callback for the "MEM_sendPciDump" command. | |
static unsigned int | MEM_sendPciLoad_cli (CLI_Control *cli, void *prm) |
CLI callback for the "MEM_sendPciLoad" command. | |
static unsigned int | MEM_sendPoolDump_cli (CLI_Control *cli, void *prm) |
CLI callback for the "MEM_sendPoolDump" command. | |
static unsigned int | MEM_sendRegDump_cli (CLI_Control *cli, void *prm) |
CLI callback for the "MEM_sendRegDump" command. | |
static unsigned int | MEM_sendRegLoad_cli (CLI_Control *cli, void *prm) |
CLI callback for the "MEM_sendRegLoad" command. | |
static unsigned int | MEM_sendSymRelDump_cli (CLI_Control *cli, void *prm) |
CLI callback for the "MEM_sendSymRelDump" command. | |
static unsigned int | MEM_sendSymValDump_cli (CLI_Control *cli, void *prm) |
CLI callback for the "MEM_sendSymValDump" command. | |
static unsigned int | MEM_setDisplayLevelCmd_cli (CLI_Control *cli, void *prm) |
CLI callback for the "MEM_setDisplayLevelCmd" command. | |
unsigned int | MEM_addSendSyntax (CLI_Syntax *syntax) |
Add MEM send commands to the command-line syntax. | |
unsigned int | MEM_addSyntaxSCP (CLI_Syntax *syntax) |
Add MEM commands to the command-line syntax for SCP. | |
Variables | |
int | MEM_displayLevelCmd = 1 |
The verbosity level of the MEM command display. |
CVS $Id: MEM_send_cmd.c,v 1.15 2011/03/29 01:58:52 apw Exp $
These functions use standard ITC message functions to send MEM telecommands to an SIU. Depending on a command's latUnit parameter value, the SIU either handles the command or forwards it to an EPU. ITC ensures that the commands reach the intended target - even if the command is sent from an SIU in an LCP environment.
#define TFFS_NVRAM_SIZE 256 |
The size, in bytes, to reserve for NVRAM storage.
This is the value specified in a SIB EEPROM bank header as the number of bytes to reserve for NVRAM storage.
Referenced by MEM_loadBankHeader().
unsigned int MEM_addSendSyntax | ( | CLI_Syntax * | syntax | ) |
Add MEM send commands to the command-line syntax.
syntax | Syntax handle. |
References MEM_loadBankHeader_cli(), MEM_sendCancel_cli(), MEM_sendDump_cli(), MEM_sendLoad_cli(), MEM_sendPciDump_cli(), MEM_sendPciLoad_cli(), MEM_sendPoolDump_cli(), MEM_sendRegDump_cli(), MEM_sendRegLoad_cli(), MEM_sendSsrDump_cli(), MEM_sendSymRelDump_cli(), MEM_sendSymValDump_cli(), and MEM_setDisplayLevelCmd_cli().
Referenced by MEM_addSyntaxSCP().
unsigned int MEM_addSyntaxSCP | ( | CLI_Syntax * | syntax | ) |
Add MEM commands to the command-line syntax for SCP.
Adds MEM commands to the command-line syntax when running in an SCP environment. This is the only MEM command-line syntax function called by SCP, so it must add both send and dump commands.
syntax | Syntax handle. |
References MEM_addDumpSyntax(), and MEM_addSendSyntax().
void mem_free_cb | ( | ITC_QueueItem * | qitem_p, | |
unsigned int | status, | |||
void * | parm_0, | |||
void * | parm_1, | |||
void * | parm_2, | |||
unsigned int | tx | |||
) | [static] |
ITC callback to free command packet memory.
qitem_p | Pointer to packet's queue item. | |
status | Status of packet transmission. | |
parm_0 | Callback parameter 0 - first item to free. | |
parm_1 | Callback parameter 1 - second item to free. | |
parm_2 | Callback parameter 2 - third item to free. | |
tx | Flag indicating sender-side failure (unused). |
Referenced by mem_send_command().
unsigned int mem_load_buffer | ( | unsigned int | unit, | |
unsigned int | address, | |||
unsigned int | num_words, | |||
unsigned int * | buf_p | |||
) | [static] |
Use the Memory Write command to load a buffer of data.
unit | LAT unit to receive the cmd (0 => SIU, 1 => EPU0, ...). | |
address | Starting address. | |
num_words | Number of 32-bit values to load. | |
buf_p | Pointer to buffer of 32-bit values to load. |
0 | Success. | |
Nonzero | Failure. |
References MEM_dumpLoad(), and mem_send_command().
Referenced by MEM_loadBankHeader().
unsigned int MEM_loadBankHeader | ( | unsigned int | lat_unit, | |
unsigned int | address, | |||
unsigned int | rtos_bytes, | |||
unsigned int | sbc_0_bytes, | |||
unsigned int | sbc_1_bytes | |||
) |
Load a bank header into SIB EEPROM.
lat_unit | Unit (CPU) to load (0=SIU, 1=EPU0, ...). | |
address | The base address of the bank header. | |
rtos_bytes | Size reserved for RTOS file, in bytes. | |
sbc_0_bytes | Size reserved for SBC 0 file, in bytes. | |
sbc_1_bytes | Size reserved for SBC 1 file, in bytes. |
References mem_load_buffer(), MEM_sendDump(), and TFFS_NVRAM_SIZE.
Referenced by MEM_loadBankHeader_cli().
unsigned int MEM_loadBankHeader_cli | ( | CLI_Control * | cli, | |
void * | prm | |||
) | [static] |
CLI callback for the "MEM_loadBankHeader" command.
cli | CLI control handle. | |
prm | User parameter (unused). |
0 | Success. | |
Nonzero | Failure. |
References MEM_loadBankHeader().
Referenced by MEM_addSendSyntax().
unsigned int mem_send_command | ( | unsigned int | num_parms, | |
unsigned int * | parm_bytes, | |||
unsigned int * | parm_values, | |||
unsigned int | func_code, | |||
MEM_DumpCB | dump_func_p | |||
) | [static] |
Send a Memory command.
num_parms | Number of command parameters. | |
parm_bytes | Pointer to array of parameter sizes, in bytes. | |
parm_values | Pointer to array of parameter values. | |
func_code | Function code of the command. | |
dump_func_p | Pointer to function that dumps the command payload. |
0 | Success. | |
Nonzero | Failure. |
References mem_free_cb().
Referenced by mem_load_buffer(), MEM_sendCancel(), MEM_sendDump(), MEM_sendLoad(), MEM_sendPciDump(), MEM_sendPciLoad(), MEM_sendPoolDump(), MEM_sendRegDump(), MEM_sendRegLoad(), MEM_sendSsrDump(), MEM_sendSymRelDump(), MEM_sendSymRelSsrDump(), and MEM_sendSymValDump().
unsigned int MEM_sendCancel | ( | unsigned int | unit | ) |
Send the Memory Dump Cancel command.
unit | LAT unit to receive the command (0 => SIU, 1 => EPU0, ...). |
0 | Success. | |
Nonzero | Failure. |
References MEM_dumpCancel(), and mem_send_command().
Referenced by MEM_sendCancel_cli().
unsigned int MEM_sendCancel_cli | ( | CLI_Control * | cli, | |
void * | prm | |||
) | [static] |
CLI callback for the "MEM_sendCancel" command.
cli | CLI control handle. | |
prm | User parameter (unused). |
0 | Success. | |
Nonzero | Failure. |
References MEM_sendCancel().
Referenced by MEM_addSendSyntax().
unsigned int MEM_sendDump | ( | unsigned int | unit, | |
unsigned int | start, | |||
unsigned int | count | |||
) |
Send the Memory Data Dump (to 1553) command.
unit | LAT unit to receive the command (0 => SIU, 1 => EPU0, ...). | |
start | Starting address. | |
count | Number of 32-bit words to dump. |
0 | Success. | |
Nonzero | Failure. |
References MEM_dumpDump(), and mem_send_command().
Referenced by MEM_loadBankHeader(), and MEM_sendDump_cli().
unsigned int MEM_sendDump_cli | ( | CLI_Control * | cli, | |
void * | prm | |||
) | [static] |
CLI callback for the "MEM_sendDump" command.
cli | CLI control handle. | |
prm | User parameter (unused). |
0 | Success. | |
Nonzero | Failure. |
References MEM_sendDump().
Referenced by MEM_addSendSyntax().
unsigned int MEM_sendLoad | ( | unsigned int | unit, | |
unsigned int | address, | |||
unsigned int | value | |||
) |
Send the Memory Write command.
unit | LAT unit to receive the cmd (0 => SIU, 1 => EPU0, ...). | |
address | Starting address. | |
value | 32-bit value to load. |
0 | Success. | |
Nonzero | Failure. |
References MEM_dumpLoad(), and mem_send_command().
Referenced by MEM_sendLoad_cli().
unsigned int MEM_sendLoad_cli | ( | CLI_Control * | cli, | |
void * | prm | |||
) | [static] |
CLI callback for the "MEM_sendLoad" command.
cli | CLI control handle. | |
prm | User parameter (unused). |
0 | Success. | |
Nonzero | Failure. |
References MEM_sendLoad().
Referenced by MEM_addSendSyntax().
unsigned int MEM_sendPciDump | ( | unsigned int | unit, | |
unsigned int | tran, | |||
unsigned int | bus, | |||
unsigned int | device, | |||
unsigned int | function | |||
) |
Send the PCI Device Header Dump command.
unit | LAT unit to receive the cmd (0 => SIU, 1 => EPU0, ...). | |
tran | Transaction ID to be echoed in the response telemetry. | |
bus | Bus portion of the PCI header address. | |
device | Device portion of the PCI header address. | |
function | Function portion of the PCI header address. |
0 | Success. | |
Nonzero | Failure. |
References MEM_dumpPci(), and mem_send_command().
Referenced by MEM_sendPciDump_cli().
unsigned int MEM_sendPciDump_cli | ( | CLI_Control * | cli, | |
void * | prm | |||
) | [static] |
CLI callback for the "MEM_sendPciDump" command.
cli | CLI control handle. | |
prm | User parameter (unused). |
0 | Success. | |
Nonzero | Failure. |
References MEM_sendPciDump().
Referenced by MEM_addSendSyntax().
unsigned int MEM_sendPciLoad | ( | unsigned int | unit, | |
unsigned int | bus, | |||
unsigned int | device, | |||
unsigned int | function, | |||
unsigned int | offset, | |||
unsigned int | value | |||
) |
Send the PCI Device Header Write command.
unit | LAT unit to receive the cmd (0 => SIU, 1 => EPU0, ...). | |
bus | Bus portion of the PCI header address. | |
device | Device portion of the PCI header address. | |
function | Function portion of the PCI header address. | |
offset | Offset portion of the PCI header address. | |
value | Data value to write. |
0 | Success. | |
Nonzero | Failure. |
References MEM_dumpPciLoad(), and mem_send_command().
Referenced by MEM_sendPciLoad_cli().
unsigned int MEM_sendPciLoad_cli | ( | CLI_Control * | cli, | |
void * | prm | |||
) | [static] |
CLI callback for the "MEM_sendPciLoad" command.
cli | CLI control handle. | |
prm | User parameter (unused). |
0 | Success. | |
Nonzero | Failure. |
References MEM_sendPciLoad().
Referenced by MEM_addSendSyntax().
unsigned int MEM_sendPoolDump | ( | unsigned int | unit, | |
unsigned int | tran, | |||
unsigned int | pool | |||
) |
Send the Memory Pool Status Dump command.
unit | LAT unit to receive the cmd (0 => SIU, 1 => EPU0, ...). | |
tran | Transaction ID to be echoed in the response telemetry. | |
pool | Pool ID (0 => system, 1 => application). |
0 | Success. | |
Nonzero | Failure. |
References MEM_dumpPool(), and mem_send_command().
Referenced by MEM_sendPoolDump_cli().
unsigned int MEM_sendPoolDump_cli | ( | CLI_Control * | cli, | |
void * | prm | |||
) | [static] |
CLI callback for the "MEM_sendPoolDump" command.
cli | CLI control handle. | |
prm | User parameter (unused). |
0 | Success. | |
Nonzero | Failure. |
References MEM_sendPoolDump().
Referenced by MEM_addSendSyntax().
unsigned int MEM_sendRegDump | ( | unsigned int | unit, | |
unsigned int | tran | |||
) |
Send the Processor Register Dump command.
unit | LAT unit to receive the command (0 => SIU, 1 => EPU0, ...). | |
tran | Transaction ID to be echoed in the response telemetry. |
0 | Success. | |
Nonzero | Failure. |
References MEM_dumpReg(), and mem_send_command().
Referenced by MEM_sendRegDump_cli().
unsigned int MEM_sendRegDump_cli | ( | CLI_Control * | cli, | |
void * | prm | |||
) | [static] |
CLI callback for the "MEM_sendRegDump" command.
cli | CLI control handle. | |
prm | User parameter (unused). |
0 | Success. | |
Nonzero | Failure. |
References MEM_sendRegDump().
Referenced by MEM_addSendSyntax().
unsigned int MEM_sendRegLoad | ( | unsigned int | unit, | |
unsigned int | offset, | |||
unsigned int | value | |||
) |
Send the Processor Register Write command.
unit | LAT unit to receive the cmd (0 => SIU, 1 => EPU0, ...). | |
offset | Starting offset. | |
value | 32-bit value to load. |
0 | Success. | |
Nonzero | Failure. |
References MEM_dumpRegLoad(), and mem_send_command().
Referenced by MEM_sendRegLoad_cli().
unsigned int MEM_sendRegLoad_cli | ( | CLI_Control * | cli, | |
void * | prm | |||
) | [static] |
CLI callback for the "MEM_sendRegLoad" command.
cli | CLI control handle. | |
prm | User parameter (unused). |
0 | Success. | |
Nonzero | Failure. |
References MEM_sendRegLoad().
Referenced by MEM_addSendSyntax().
unsigned int MEM_sendSsrDump | ( | unsigned int | unit, | |
unsigned int | start, | |||
unsigned int | count | |||
) |
Send the Memory Data Dump (to SSR) command.
unit | LAT unit to receive the command (0 => SIU, 1 => EPU0, ...). | |
start | Starting address. | |
count | Number of 32-bit words to dump. |
0 | Success. | |
Nonzero | Failure. |
References MEM_dumpDump(), and mem_send_command().
Referenced by MEM_sendSsrDump_cli().
unsigned int MEM_sendSsrDump_cli | ( | CLI_Control * | cli, | |
void * | prm | |||
) | [static] |
CLI callback for the "MEM_sendSsrDump" command.
cli | CLI control handle. | |
prm | User parameter (unused). |
0 | Success. | |
Nonzero | Failure. |
References MEM_sendSsrDump().
Referenced by MEM_addSendSyntax().
unsigned int MEM_sendSymRelDump | ( | unsigned int | unit, | |
unsigned int | tran, | |||
unsigned int | offset, | |||
unsigned int | count, | |||
unsigned char * | name | |||
) |
Send the Memory Dump to 1553 Symbol Relative command.
unit | LAT unit to receive the cmd (0 => SIU, 1 => EPU0, ...). | |
tran | Transaction ID to be echoed in the response telemetry. | |
offset | Starting offset, relative to the symbol. | |
count | Number of 32-bit words to dump. | |
name | Name of the symbol. |
0 | Success. | |
Nonzero | Failure. |
References MEM_dumpSymRel(), and mem_send_command().
Referenced by MEM_sendSymRelDump_cli().
unsigned int MEM_sendSymRelDump_cli | ( | CLI_Control * | cli, | |
void * | prm | |||
) | [static] |
CLI callback for the "MEM_sendSymRelDump" command.
cli | CLI control handle. | |
prm | User parameter (unused). |
0 | Success. | |
Nonzero | Failure. |
References MEM_sendSymRelDump().
Referenced by MEM_addSendSyntax().
unsigned int MEM_sendSymRelSsrDump | ( | unsigned int | unit, | |
unsigned int | tran, | |||
unsigned int | offset, | |||
unsigned int | count, | |||
unsigned char * | name | |||
) |
Send the Memory Dump to SSR Symbol Relative command.
unit | LAT unit to receive the cmd (0 => SIU, 1 => EPU0, ...). | |
tran | Transaction ID to be echoed in the response telemetry. | |
offset | Starting offset, relative to the symbol. | |
count | Number of 32-bit words to dump. | |
name | Name of the symbol. |
0 | Success. | |
Nonzero | Failure. |
References MEM_dumpSymRel(), and mem_send_command().
unsigned int MEM_sendSymValDump | ( | unsigned int | unit, | |
unsigned char * | name | |||
) |
Send the Memory Symbol Lookup command.
unit | LAT unit to receive the cmd (0 => SIU, 1 => EPU0, ...). | |
name | Name of the symbol. |
0 | Success. | |
Nonzero | Failure. |
References MEM_dumpSymVal(), and mem_send_command().
Referenced by MEM_sendSymValDump_cli().
unsigned int MEM_sendSymValDump_cli | ( | CLI_Control * | cli, | |
void * | prm | |||
) | [static] |
CLI callback for the "MEM_sendSymValDump" command.
cli | CLI control handle. | |
prm | User parameter (unused). |
0 | Success. | |
Nonzero | Failure. |
References MEM_sendSymValDump().
Referenced by MEM_addSendSyntax().
int MEM_setDisplayLevelCmd | ( | int | level | ) |
Set the verbosity level of the MEM command display.
level | Level of verbosity - set higher to display more. |
Referenced by MEM_setDisplayLevelCmd_cli().
unsigned int MEM_setDisplayLevelCmd_cli | ( | CLI_Control * | cli, | |
void * | prm | |||
) | [static] |
CLI callback for the "MEM_setDisplayLevelCmd" command.
cli | CLI control handle. | |
prm | User parameter (unused). |
0 | Success. | |
Nonzero | Failure. |
References MEM_setDisplayLevelCmd().
Referenced by MEM_addSendSyntax().
int MEM_displayLevelCmd = 1 |
The verbosity level of the MEM command display.
This variable determines the amount of information that is displayed for each MEM telecommand that is sent. The higher the value, the more information that is displayed. Use MEM_setDisplayLevelCmd() to change this value.