GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> MEM / V5-8-2 > mem / sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

MEM_control.c File Reference

MEM application-level control functions. More...

#include <string.h>
#include <CDM/CDM_pubdefs.h>
#include <ITC/ITC_pubdefs.h>
#include <LCBD/LCBD.h>
#include <MSG/MSG_pubdefs.h>
#include <PBS/FPA.h>
#include <PBS/INT.ih>
#include <PBS/MBA.h>
#include <PBS/MTX.h>
#include <PBS/WUT.h>
#include <MEM/MEM_cmdxtrn.h>
#include <MEM/MEM_dump.h>
#include <MEM/MEM_load.h>
#include <MEM/MEM_map.h>
#include <MEM/MEM_msgs.h>
#include <MEM/MEM_pubdefs.h>
#include <MEM_DB/MEM_DB_schema.h>
#include <MEM_control.h>
#include <Memmap.h>

Defines

#define INT_FAKE_OK
 Acknowledges that we realize interrupts can't be disabled on host machines.

Functions

static void * mem_surom_read (void *dest_p, const void *source_p, const size_t nbytes, void *context_p, size_t *bytes_read_p)
 RAD750 SUROM read callback function.
void * MEM_readSurom (void *dst_p, const void *src_p, const unsigned int num_bytes)
 Read RAD750 SUROM.
static unsigned int mem_map_init (MEM_Control *ctl_p)
 Init the memory map for dumps and loads.
static unsigned int mem_pool_init (FPA_fcb **fcb_pp, void **buf_pp, int *in_use_p, unsigned int num_pkt, unsigned int pkt_bytes)
 Initialize an FPA pool.
static unsigned int mem_pool_free (FPA_fcb **fcb_pp, void **buf_pp, int *in_use_p)
 Free an FPA pool.
static unsigned int mem_create_control_block (void)
 Allocate and adopt a MEM control information block.
static unsigned int mem_lock_access (MEM_Control *ctl_p)
 Lock access to a MEM control block.
static unsigned int mem_unlock_access (MEM_Control *ctl_p, unsigned int status)
 Unlock access to a MEM control block.
static unsigned int mem_change_state (MEM_Control *ctl_p, unsigned int valid_states, MEM_Control_State new_state)
 Change the state of the MEM functions.
unsigned int MEM_initialize (ITC_Task *task_p, ITC_TaskID tid)
 Initialize the MEM application-level functions.
unsigned int MEM_init (void)
 Initialize the MEM application-level functions using CDM.
unsigned int MEM_shutdown (void)
 Shutdown the MEM functions.
unsigned int MEM_updateStats (MEM_Control *ctl_p, unsigned int msg_status, unsigned int fcode)
 Common routine to update MEM command statistics.
unsigned int MEM_getInfo (MEM_Info *info_p)
 Get current state of the MEM application-level functions.

Variables

MEM_ControlMem_control_p = NULL
 Pointer to the MEM control information block.
unsigned char mem_sim_ram_buf [1024]
 Buffer of simulated RAM for memory dumps and loads.


Detailed Description

MEM application-level control functions.

**  CVS $Id: MEM_control.c,v 1.25 2011/03/29 01:58:52 apw Exp $
**  

Control functions for the application-level portion of the MEM package. These functions are used within the context of another task, so they do not actually start and configure a task of their own.


Function Documentation

unsigned int mem_change_state ( MEM_Control ctl_p,
unsigned int  valid_states,
MEM_Control_State  new_state 
) [static]

Change the state of the MEM functions.

Parameters:
ctl_p Pointer to MEM control block.
valid_states Bitmask of valid current states.
new_state New state.
Returns:
MSG code.

References mem_lock_access(), mem_unlock_access(), and _MEM_Control::state.

Referenced by MEM_initialize(), and MEM_shutdown().

unsigned int mem_create_control_block ( void   )  [static]

Allocate and adopt a MEM control information block.

Returns:
MSG code.

References MEM_STATE_UNINITIALIZED, _MEM_Control::mtx, and _MEM_Control::state.

Referenced by MEM_initialize().

unsigned int MEM_getInfo ( MEM_Info info_p  ) 

Get current state of the MEM application-level functions.

Parameters:
info_p Pointer to location to return state information.
Returns:
MSG code.

References _MEM_Control::info, mem_lock_access(), MEM_STATE_INITIALIZED, mem_unlock_access(), and _MEM_Control::state.

unsigned int MEM_init ( void   ) 

Initialize the MEM application-level functions using CDM.

This function is a wrapper for MEM_initialize() that uses CDM to determine its parameters.

Returns:
Zero if successful.

A MSG code if an error occurs.

References MEM_initialize().

unsigned int MEM_initialize ( ITC_Task *  task_p,
ITC_TaskID  tid 
)

Initialize the MEM application-level functions.

This function initializes the application-level portion of the MEM package and transitions it to the INITIALIZED state. It should be the first MEM function called when using the MEM package.

At the application level, there is no MEM task. Instead, the handlers for the MEM telecommands are attached to another task. If a valid value is provided for either the task_p or the tid parameter, then this function will attach the MEM command handlers to the corresponding task. If neither parameter is specified (by setting task_p to NULL and tid to -1), then it is assumed that the controlling task will attach the MEM command handlers.

Parameters:
task_p Pointer to controlling task's description block.
tid ID of the controlling task.
Returns:
Zero if successful.

An error MSG code if the MEM package has already been initialized or an error occurs.

References _MEM_Control::dump_active, _MEM_Control::dump_dest_nid, _MEM_Control::dump_fcode, _MEM_Control::dump_handle, _MEM_Control::dump_tran_id, _MEM_Control::load_handle, _MEM_Control::max_dump_pkts, MEM_Apid644, mem_change_state(), mem_create_control_block(), MEM_dumpGetContext(), MEM_dumpInit(), MEM_loadGetContext(), MEM_loadInit(), mem_map_init(), mem_pool_init(), MEM_STATE_INIT_FAIL, MEM_STATE_INITIALIZED, MEM_STATE_INITIALIZING, MEM_STATE_UNINITIALIZED, MEM_updateStats(), _MEM_Control::my_nid, _MEM_Control::my_tid, _MEM_Control::num_dump_pkts, _MEM_Control::pkt_buf_p, _MEM_Control::pkt_fcb_p, _MEM_Control::pkt_in_use, _MEM_Control::poll_enabled, _MEM_Control::poll_usecs, _MEM_Control::retries, _MEM_Control::retry_qitem_p, _MEM_Control::state, _MEM_Control::task_p, and _MEM_Control::wut_handle.

Referenced by MEM_init().

unsigned int mem_lock_access ( MEM_Control ctl_p  )  [static]

Lock access to a MEM control block.

Parameters:
ctl_p Pointer to MEM control block.
Returns:
MSG code.

References _MEM_Control::mtx.

Referenced by mem_change_state(), MEM_getInfo(), and MEM_updateStats().

unsigned int mem_map_init ( MEM_Control ctl_p  )  [static]

unsigned int mem_pool_free ( FPA_fcb **  fcb_pp,
void **  buf_pp,
int *  in_use_p 
) [static]

Free an FPA pool.

Parameters:
fcb_pp Pointer to FPA control block pointer.
buf_pp Pointer to pool data buffer pointer.
in_use_p Pointer to count of packets in use.
Returns:
MSG code.

Referenced by MEM_shutdown().

unsigned int mem_pool_init ( FPA_fcb **  fcb_pp,
void **  buf_pp,
int *  in_use_p,
unsigned int  num_pkt,
unsigned int  pkt_bytes 
) [static]

Initialize an FPA pool.

Parameters:
fcb_pp Pointer to location to store FPA control block pointer.
buf_pp Pointer to location to store pool data buffer pointer.
in_use_p Pointer to count of packets in use.
num_pkt Number of packets to include in the pool.
pkt_bytes Size of each packet, in bytes.
Returns:
MSG code.

Referenced by MEM_initialize().

void * MEM_readSurom ( void *  dst_p,
const void *  src_p,
const unsigned int  num_bytes 
)

Read RAD750 SUROM.

Parameters:
dst_p Pointer to destination of the memory read.
src_p Pointer to source of the memory read.
num_bytes Number of bytes to read.
Returns:
dest_p if no error occurred, NULL if an error occurred.

References mem_surom_read().

unsigned int MEM_shutdown ( void   ) 

Shutdown the MEM functions.

This function shuts down the MEM package and transitions it back to the UNINITIALIZED state. It can be called only if the current MEM state is INITIALIZED, INIT_FAIL, or SHUTDOWN_FAIL.

Returns:
Zero if successful.

An error MSG code if the MEM package is in an invalid state or an error occurs.

References _MEM_Control::dump_handle, _MEM_Control::load_handle, MEM_Apid644, mem_change_state(), MEM_dumpReleaseContext(), MEM_loadReleaseContext(), mem_pool_free(), MEM_STATE_INIT_FAIL, MEM_STATE_INITIALIZED, MEM_STATE_SHUTDOWN, MEM_STATE_SHUTDOWN_FAIL, MEM_STATE_UNINITIALIZED, MEM_updateStats(), _MEM_Control::pkt_buf_p, _MEM_Control::pkt_fcb_p, _MEM_Control::pkt_in_use, _MEM_Control::state, _MEM_Control::task_p, and _MEM_Control::wut_handle.

void * mem_surom_read ( void *  dest_p,
const void *  source_p,
const size_t  nbytes,
void *  context_p,
size_t *  bytes_read_p 
) [static]

RAD750 SUROM read callback function.

RAD750 SUROM read function that is suitable for use as a memory map table entry callback function.

Parameters:
dest_p Pointer to destination of the memory read.
source_p Pointer to source of the memory read.
nbytes Number of bytes to read.
context_p Generic context pointer (unused).
bytes_read_p Pointer to location to return number of bytes read.
Returns:
dest_p if no error occurred, NULL if an error occurred.

Referenced by mem_map_init(), and MEM_readSurom().

unsigned int mem_unlock_access ( MEM_Control ctl_p,
unsigned int  status 
) [static]

Unlock access to a MEM control block.

Parameters:
ctl_p Pointer to MEM control block.
status Previous status code.
Returns:
MSG code.

References _MEM_Control::mtx.

Referenced by mem_change_state(), MEM_getInfo(), and MEM_updateStats().

unsigned int MEM_updateStats ( MEM_Control ctl_p,
unsigned int  msg_status,
unsigned int  fcode 
)


Variable Documentation

Pointer to the MEM control information block.

Control block for MEM.

Pointer to the control block (state) for the MEM application-level functions.

Referenced by MEM_LMEMDUMPCANCEL(), MEM_LMEMDUMPMEM(), MEM_LMEMDUMPNEXT(), MEM_LMEMDUMPPCI(), MEM_LMEMDUMPPOOL(), MEM_LMEMDUMPREG(), MEM_LMEMDUMPSYMREL(), MEM_LMEMDUMPSYMVAL(), MEM_LMEMLOADMEM(), MEM_LMEMLOADPCI(), MEM_LMEMLOADREG(), and MEM_LMEMNOOP().

unsigned char mem_sim_ram_buf

Initial value:

    {
        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
    }
Buffer of simulated RAM for memory dumps and loads.

This buffer simulates the RAD750 RAM in a host environment.


Generated on Wed Nov 21 21:07:12 2012 by  doxygen 1.5.8