#include <PUSMemoryLoad.h>
Inheritance diagram for PUSMemoryLoad:
This class is intended as a base for telecommand classes implementing the following subtypes of PUS service number 6:
setMaxNumberOfBlocks
must be called to set the maximum number of memory blocks that can be managed by this telecommand Method setMaxNumberData
must be called to set the maximum size of the internal buffer where the memory data are stored. The data to be loaded in memory are defined dynamically (normally by the telecommand loader component). The operations to define them are however left undefined by this class as they differ for the case of a memory load that uses the base plus offset mechanism (service subtype 1) and for the case of a memory load that uses absolute addresses (service subtype 2). In general, the definition of the memory load data can be done using the raw data load mechanism.
Execution of this telecommand can have two outcomes. The telecommand can either have a successful outcome (the return value of doAction
is ACTION_SUCCESS) or it can fail (the return value of doAction
is MEM_LOAD_PRE_CHECKSUM_FAILED or MEM_LOAD_POST_CHECKSUM_FAILED). A failure is declared if a checksum check has failed.
The PUS leaves some leeway in the definition of the structure of the application data for memory load telecommands. This implementation makes the following assumptions:
TD_PUSMemData
. TD_PUSMemData
to have size 1 (i.e. to be a char
or an unsigned char
). If this were not the case, then run time exceptions will arise on some processors (notably on the ERC32) due to alignment problems.
Definition at line 64 of file PUSMemoryLoad.h.
Public Member Functions | |
PUSMemoryLoad (void) | |
Instantiate a PUS memory load telecommand. | |
void | setMaxNumberBlocks (unsigned int max) |
Set the maximum number of memory blocks that can be managed by this telecommand. | |
unsigned int | getMaxNumberBlocks () const |
Get the maximum number of memory blocks that can be managed by this telecommand. | |
unsigned int | getNumberBlocks () const |
Get the number of memory blocks that are managed by this telecommand. | |
void | setMaxNumberData (unsigned int max) |
Set the maximum number of memory load data that can be managed by this telecommand. | |
unsigned int | getMaxNumberData () const |
Get the maximum number of memory data that can be managed by this telecommand. | |
TD_PUSMemData * | getStartAddress (unsigned int i) const |
Get the start address of the i-th currently loaded block. | |
TD_PUSMemLength | getLength (unsigned int i) const |
Get the length of the i-th currently loaded block. | |
unsigned short | getChecksum (unsigned int i) const |
Get the checksum of the i-th currently loaded block. | |
virtual bool | isObjectConfigured (void) |
Perform a class-specific configuration check on the telecommand: check that the maximum number of blocks and the maximum number of data have been defind. | |
Protected Member Functions | |
virtual TD_ActionOutcome | doAction (void) |
Load the memory load data in memory. | |
Protected Attributes | |
MemBlockType * | block |
The i-th item of this array holds the descriptor for the i-th memory block to be loaded. | |
TD_PUSNumberMemBlocks | maxNumberBlocks |
The maximum number of memory load blocks. | |
TD_PUSNumberMemBlocks | numberBlocks |
The number of memory load blocks that have actually been loaded into the telecommand. | |
TD_PUSMemData * | data |
This array holds all the memory load data for the currently defined blocks. | |
unsigned int | maxNumberData |
The maximum number of memory load data (this is the size of the array data . |
|
Instantiate a PUS memory load telecommand. The values of the internal data structures that are used to hold the telecommand application data are initialized to illegal values to signify that the telecommand is not yet configured. The telecommand type is set to PUS_TYPE_MEM. Definition at line 16 of file PUSMemoryLoad.cpp. |
|
Load the memory load data in memory.
If the checksum is defined, then for each block the checksum of the data are computed and compared with the value in the checksum field of the block. If the checksum check fails, then the method returns immediately with an outcome of MEM_LOAD_PRE_CHECKSUM_FAILED. A checksum is considered to be defined for a certain block if the checksum field for the block has a non-zero value. <p/> If an acknowledgement of completion of execution is required (this is ascertained by calling method
Implements PunctualAction. Definition at line 85 of file PUSMemoryLoad.cpp. |
|
Get the checksum of the i-th currently loaded block.
The block index i must lie in the interval [0,N-1] where N is the number of currently loaded blocks (the value returned by method
Definition at line 79 of file PUSMemoryLoad.cpp. |
|
Get the length of the i-th currently loaded block.
The block index i must lie in the interval [0,N-1] where N is the number of currently loaded blocks (the value returned by method
Definition at line 73 of file PUSMemoryLoad.cpp. |
|
Get the maximum number of memory blocks that can be managed by this telecommand.
Definition at line 41 of file PUSMemoryLoad.cpp. |
|
Get the maximum number of memory data that can be managed by this telecommand.
Definition at line 62 of file PUSMemoryLoad.cpp. |
|
Get the number of memory blocks that are managed by this telecommand. This number is read from the application data loaded into the telecommand.
Definition at line 46 of file PUSMemoryLoad.cpp. |
|
Get the start address of the i-th currently loaded block.
The block index i must lie in the interval [0,N-1] where N is the number of currently loaded blocks (the value returned by method
Definition at line 67 of file PUSMemoryLoad.cpp. |
|
Perform a class-specific configuration check on the telecommand: check that the maximum number of blocks and the maximum number of data have been defind.
Reimplemented from PUSTelecommand. Definition at line 132 of file PUSMemoryLoad.cpp. |
|
Set the maximum number of memory blocks that can be managed by this telecommand. This is an initialization method that should only be called once. A call to this method causes the internal data structures where the blocks are held to be allocated and initialized. Only positive values of the method argument are legal.
Definition at line 27 of file PUSMemoryLoad.cpp. |
|
Set the maximum number of memory load data that can be managed by this telecommand. This is an initialization method that should only be called once. A call to this method causes the internal data structures where the blocks are held to be allocated and initialized. Only positive values of the method argument are legal.
Definition at line 51 of file PUSMemoryLoad.cpp. |
|
This array holds all the memory load data for the currently defined blocks. If the length of the first block is N, then the first N locations of this array hold the memory load data for the first block. If the length of the second block is M, then the locations between N and N+M-1, hold the data memory load data for the second block. And so forth for the other blocks. Definition at line 114 of file PUSMemoryLoad.h. |