Memory Class Reference

Hold a memory block and symbol informations. More...

#include <memory.h>

Inheritance diagram for Memory:
Inheritance graph
[legend]
Collaboration diagram for Memory:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Memory (int size)
 ~Memory ()
std::string GetSymbolAtAddress (unsigned int add)
unsigned int GetAddressAtSymbol (const std::string &s)
void AddSymbol (std::pair< unsigned int, std::string > p)
unsigned int GetSize ()
virtual void WriteMem (unsigned char *, unsigned int offset, unsigned int size)=0

Public Attributes

unsigned char * myMemory
std::multimap< unsigned int,
std::string > 
sym

Protected Attributes

unsigned int size

Detailed Description

Hold a memory block and symbol informations.

Memory class to hold memory content and symbol informations to map symbols to addresses and vice versa.

Definition at line 38 of file memory.h.


Constructor & Destructor Documentation

Memory::Memory ( int  size  ) 

Creates the memory block

Parameters:
size the memory block size

Definition at line 109 of file memory.cpp.

References avr_new, myMemory, and size.

Memory::~Memory (  )  [inline]

Destructor, frees myMemory

Definition at line 56 of file memory.h.

References avr_free(), and myMemory.

Here is the call graph for this function:


Member Function Documentation

void Memory::AddSymbol ( std::pair< unsigned int, std::string >  p  )  [inline]

Add the (address, symbol) pair

Parameters:
p a std::pair with address and symbol string

Definition at line 82 of file memory.h.

References sym.

Referenced by AvrDevice::Load().

Here is the caller graph for this function:

unsigned int Memory::GetAddressAtSymbol ( const std::string &  s  ) 

Returns the address for a symbol

If the given string is a hex string, the hex value will be converted and returned. If the symbol isn't found, program aborts.

Parameters:
s the symbol string or hex string
Returns:
address for symbol or value of hex string
Todo:
if the symbol isn't found, it aborts with a message. Maybe it should raise a exeption to handle this on the caller side?

Definition at line 35 of file memory.cpp.

References avr_error, avr_free(), avr_new, and sym.

Referenced by AvrDevice::RegisterTerminationSymbol().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int Memory::GetSize (  )  [inline]
string Memory::GetSymbolAtAddress ( unsigned int  add  ) 

Return string with symbols found at address

Seeks for symbols, which are registered for the given address. If the address isn't equal to a symbol address, but before the next one, then a offset to symbol address will be added. Returns a empty string, if nothing is found. (in case of no given symbols!)

Parameters:
add the given address
Returns:
a string with all found symbols, concatenated by ','

Definition at line 67 of file memory.cpp.

References sym.

Referenced by HWSpi::SetSPSR(), AvrDevice::Step(), avr_op_LPM_Z_incr::Trace(), avr_op_LPM::Trace(), avr_op_LPM_Z::Trace(), avr_op_JMP::Trace(), avr_op_BRBS::Trace(), and avr_op_BRBC::Trace().

Here is the caller graph for this function:

virtual void Memory::WriteMem ( unsigned char *  ,
unsigned int  offset,
unsigned int  size 
) [pure virtual]

Write memory data to memory

Implemented in AvrFlash, HWEeprom, and Data.


Member Data Documentation

unsigned char* Memory::myMemory
unsigned int Memory::size [protected]
std::multimap<unsigned int, std::string> Memory::sym

address to symbol map

Definition at line 48 of file memory.h.

Referenced by AddSymbol(), GetAddressAtSymbol(), and GetSymbolAtAddress().


The documentation for this class was generated from the following files:
Generated on Sun Feb 12 16:52:52 2012 for Simulavr by  doxygen 1.6.3