GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> MEM / V5-8-1 > mem_base / rad750
#include <string.h>
#include <CCSDS/CCSDS_pkt.h>
#include <MEM/MEM_cmddefs.h>
#include <MEM/MEM_load.h>
#include <MEM/MEM_msgs.h>
#include <MSG/MSG_pubdefs.h>
#include <mempriv.h>
#include <PBS/MBA.h>
Classes | |
struct | _mem_LoadContext |
Memory Load context. More... | |
Defines | |
#define | MEM_LOAD_KEY_VALID (0x124578ab) |
Load info 'valid' key value. | |
#define | MEM_LOAD_MEM_WRITE_MAX_WORDS (4096 / 4) |
Maximum number of words that can be loaded with a Memory Write telecommand. | |
#define | MEM_LOAD_MAX_STALL (1000) |
Maximum number of times that a load operation can make no progress before declaring a timeout failure. | |
Typedefs | |
typedef struct _mem_LoadContext | mem_LoadContext |
Typedef for _mem_LoadContext. | |
Enumerations | |
enum | mem_LoadState { MEM_LOAD_IDLE, MEM_LOAD_ACTIVE } |
Functions | |
static unsigned int | mem_loadCheckHandle (const MEM_LoadHandle handle, mem_LoadContext **context_pp, int check_state, mem_LoadState exp_state) |
Validate a Memory Load context handle. | |
static unsigned int | mem_loadUpdateStatus (mem_LoadContext *context_p, const unsigned int status) |
Update load context status. | |
static unsigned int | mem_loadResetContext (mem_LoadContext *context_p) |
Reset the state of a load context. | |
unsigned int | MEM_loadInit (void) |
Start the Memory Load system. | |
unsigned int | MEM_loadGetContext (MEM_LoadHandle *handle_p) |
Allocate a Memory Load context. | |
unsigned int | MEM_loadReleaseContext (MEM_LoadHandle handle) |
Release a Memory Load context. | |
unsigned int | MEM_loadGetInfo (const MEM_LoadHandle handle, MEM_LoadInfo *info_p) |
Get detailed information about a Memory Load context. | |
unsigned int | mem_loadStart (mem_LoadContext *context_p, const MEM_Descriptor *md_p, const unsigned char *data_p) |
unsigned int | MEM_loadPktMemory (MEM_LoadHandle handle, const void *pkt_p, const unsigned int len) |
Handle Memory Write telecommand packets. | |
unsigned int | MEM_loadPktPci (MEM_LoadHandle handle, const void *pkt_p, const unsigned int len) |
Handle Memory PCI Device Header Write telecommand packets. | |
unsigned int | MEM_loadPktReg (MEM_LoadHandle handle, const void *pkt_p, const unsigned int len) |
Handle Memory Processor Register Write telecommand packets. | |
unsigned int | MEM_loadWrite (MEM_LoadHandle handle) |
Write data for a Memory Load context. |
These functions handle Memory Write telecommands and the resulting load operations.
CVS $Id: memload.c,v 1.17 2011/03/29 01:58:53 apw Exp $
Typedef for _mem_LoadContext.
The typedef for _mem_LoadContext.
enum mem_LoadState |
unsigned int mem_loadCheckHandle | ( | const MEM_LoadHandle | handle, | |
mem_LoadContext ** | context_pp, | |||
int | check_state, | |||
mem_LoadState | exp_state | |||
) | [static] |
Validate a Memory Load context handle.
Validate a Memory Load context handle and return a pointer to the corresponding context.
handle | Handle for the context. | |
context_pp | Pointer to location to return context pointer. | |
check_state | Check context state? nonzero => yes, 0 => no. | |
exp_state | Expected context state. |
References MEM_LOAD_KEY_VALID, _mem_LoadContext::state, and _mem_LoadContext::valid_key.
Referenced by MEM_loadGetInfo(), MEM_loadPktMemory(), MEM_loadPktPci(), MEM_loadPktReg(), MEM_loadReleaseContext(), and MEM_loadWrite().
unsigned int MEM_loadGetContext | ( | MEM_LoadHandle * | handle_p | ) |
Allocate a Memory Load context.
Allocate a Memory Load context. This is analogous to a constructor for a context. This function returns only a handle to a context. The details of the context are hidden from the user. The MEM_loadGetInfo() function can be used to get detailed information about the context.
handle_p | Pointer to location to return context handle. |
handle_p | Pointer to location to return context handle. |
References MEM_LOAD_KEY_VALID, mem_loadResetContext(), mem_loadUpdateStatus(), and MEM_MSG.
unsigned int MEM_loadGetInfo | ( | const MEM_LoadHandle | handle, | |
MEM_LoadInfo * | info_p | |||
) |
Get detailed information about a Memory Load context.
Get information about a Memory Load context. The information returned is a subset of the context details that are normally hidden from the user.
handle | Handle for context. | |
info_p | Pointer to location to return context info. |
handle | Handle for context. | |
info_p | Pointer to location to return context info. |
References _MEM_Descriptor::addr, _MEM_Descriptor::bytes, _MEM_LoadInfo::is_active, _MEM_LoadInfo::map, _mem_LoadContext::md, MEM_LOAD_ACTIVE, mem_loadCheckHandle(), MEM_MSG, _MEM_Descriptor::memmap, _mem_LoadContext::offset, _MEM_LoadInfo::offset, _MEM_LoadInfo::start_addr, _mem_LoadContext::state, _mem_LoadContext::status, _MEM_LoadInfo::status, and _MEM_LoadInfo::total_bytes.
unsigned int MEM_loadInit | ( | void | ) |
Start the Memory Load system.
Start the Memory Load system. This function should be called once to initialize the internal state associated with the Memory Load telecommand handler.
unsigned int MEM_loadPktMemory | ( | MEM_LoadHandle | handle, | |
const void * | pkt_p, | |||
const unsigned int | len | |||
) |
Handle Memory Write telecommand packets.
Announces the arrival of a new Memory Write telecommand CCSDS packet.
handle | Handle for load context. | |
pkt_p | Pointer to packet. | |
len | Length of packet, in bytes. |
handle | Handle for load context. | |
pkt_p | Pointer to packet. | |
len | Length of packet, in bytes. |
References MEM_CreateDescriptor(), MEM_LOAD_IDLE, mem_loadCheckHandle(), mem_loadResetContext(), mem_loadStart(), mem_loadUpdateStatus(), and MEM_MSG.
unsigned int MEM_loadPktPci | ( | MEM_LoadHandle | handle, | |
const void * | pkt_p, | |||
const unsigned int | len | |||
) |
Handle Memory PCI Device Header Write telecommand packets.
Announces the arrival of a new Memory PCI Device Header Write telecommand CCSDS packet.
handle | Handle for load context. | |
pkt_p | Pointer to packet. | |
len | Length of packet, in bytes. |
handle | Handle for load context. | |
pkt_p | Pointer to packet. | |
len | Length of packet, in bytes. |
References MEM_CreateDescriptor(), MEM_LOAD_IDLE, mem_loadCheckHandle(), mem_loadResetContext(), mem_loadStart(), mem_loadUpdateStatus(), and MEM_MSG.
unsigned int MEM_loadPktReg | ( | MEM_LoadHandle | handle, | |
const void * | pkt_p, | |||
const unsigned int | len | |||
) |
Handle Memory Processor Register Write telecommand packets.
Announces the arrival of a new Memory Processor Register Write telecommand CCSDS packet.
handle | Handle for load context. | |
pkt_p | Pointer to packet. | |
len | Length of packet, in bytes. |
handle | Handle for load context. | |
pkt_p | Pointer to packet. | |
len | Length of packet, in bytes. |
References MEM_CreateDescriptor(), MEM_LOAD_IDLE, mem_loadCheckHandle(), mem_loadResetContext(), mem_loadStart(), mem_loadUpdateStatus(), and MEM_MSG.
unsigned int MEM_loadReleaseContext | ( | MEM_LoadHandle | handle | ) |
Release a Memory Load context.
Release a Memory Load context so that the memory associated to it can be re-allocated. This is analogous to a destructor for a context.
handle | Handle for context to release. |
handle | Handle for context to release. |
References mem_loadCheckHandle(), and MEM_MSG.
unsigned int mem_loadResetContext | ( | mem_LoadContext * | context_p | ) | [static] |
Reset the state of a load context.
Reset the state of a load context.
context_p | Pointer to load context. |
References MEM_LOAD_IDLE, MEM_LOAD_KEY_VALID, _mem_LoadContext::state, and _mem_LoadContext::valid_key.
Referenced by MEM_loadGetContext(), MEM_loadPktMemory(), MEM_loadPktPci(), and MEM_loadPktReg().
unsigned int mem_loadStart | ( | mem_LoadContext * | context_p, | |
const MEM_Descriptor * | md_p, | |||
const unsigned char * | data_p | |||
) |
Start a Memory Write operation. Updates the Memory Load context to reflect the start of a load operation.
context_p | Pointer to load context. | |
md_p | Pointer to target memory descriptor. | |
data_p | Pointer to buffer containing the data to write. |
References _MEM_Descriptor::bytes, _mem_LoadContext::cb_ptr, _mem_mapEntry::context_p, _mem_LoadContext::map_entry, _mem_LoadContext::md, MEM_LOAD_ACTIVE, MEM_MAP_ACCESS_WRITE_ANY, MEM_MSG, Mem_ValidateMemoryRange(), _mem_LoadContext::num_stall, _mem_LoadContext::source, and _mem_LoadContext::state.
Referenced by MEM_loadPktMemory(), MEM_loadPktPci(), and MEM_loadPktReg().
unsigned int mem_loadUpdateStatus | ( | mem_LoadContext * | context_p, | |
const unsigned int | status | |||
) | [static] |
Update load context status.
Update a load context with the specified status.
context_p | Pointer to load context. | |
status | Most recent function status. |
References _mem_LoadContext::status.
Referenced by MEM_loadGetContext(), MEM_loadPktMemory(), MEM_loadPktPci(), MEM_loadPktReg(), and MEM_loadWrite().
unsigned int MEM_loadWrite | ( | MEM_LoadHandle | handle | ) |
Write data for a Memory Load context.
Write another chunk of data for the specified Memory Load context. This function should be called repeatedly until all the data associated with the context has been written to memory. The status of the Memory Load operation can be obtained with the MEM_loadGetInfo() function.
handle | Handle for context in which to write the data. |
handle | Handle for context in which to write the data. |
References _MEM_Descriptor::addr, _MEM_Descriptor::bytes, _mem_LoadContext::cb_ptr, _mem_LoadContext::map_entry, _mem_LoadContext::md, MEM_LOAD_ACTIVE, MEM_LOAD_IDLE, mem_loadCheckHandle(), mem_loadUpdateStatus(), MEM_MSG, _mem_LoadContext::num_stall, _mem_LoadContext::offset, _mem_LoadContext::source, _mem_LoadContext::state, and _mem_mapEntry::write_cb.