HWStack Class Reference

Implements a stack register with stack logic. More...

#include <hwstack.h>

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

List of all members.

Public Member Functions

 HWStack (AvrDevice *core)
 Creates a stack instance.
 ~HWStack ()
virtual void Push (unsigned char val)=0
 Pushs one byte to stack.
virtual unsigned char Pop ()=0
 Pops one byte from stack.
virtual void PushAddr (unsigned long addr)=0
 Pushs a address to stack.
virtual unsigned long PopAddr ()=0
 Pops a address from stack.
virtual void Reset ()
 Resets stack pointer and listener table.
unsigned long GetStackPointer () const
 Returns current stack pointer value.
void SetStackPointer (unsigned long val)
 Sets current stack pointer value (used by GDB interface).
void SetReturnPoint (unsigned long stackPointer, Funktor *listener)
 Subscribes a Listener for a return address.
void ResetLowestStackpointer (void)
 Sets lowest stack marker back to current stackpointer.
unsigned long GetLowestStackpointer (void)
 Gets back the lowest stack pointer (for measuring stack usage).

Public Attributes

ThreadList m_ThreadList

Protected Member Functions

void CheckReturnPoints ()
 Run functions registered for current stack address and delete them.

Protected Attributes

AvrDevicecore
 Link to device.
uint32_t stackPointer
 current value of stack pointer
uint32_t lowestStackPointer
 marker: lowest stackpointer used by program
std::multimap< unsigned long,
Funktor * > 
returnPointList
 Maps adresses to listeners for return addresses.

Detailed Description

Implements a stack register with stack logic.

This is the base class for all 2 different stack types. It holds the interface for pushing and poping bytes and addresses from stack by core and for interrupt

Definition at line 91 of file hwstack.h.


Constructor & Destructor Documentation

HWStack::HWStack ( AvrDevice core  ) 

Creates a stack instance.

Definition at line 35 of file hwstack.cpp.

References Reset().

Here is the call graph for this function:

HWStack::~HWStack (  )  [inline]

Definition at line 106 of file hwstack.h.


Member Function Documentation

void HWStack::CheckReturnPoints (  )  [protected]

Run functions registered for current stack address and delete them.

Definition at line 47 of file hwstack.cpp.

References returnPointList, and stackPointer.

Referenced by HWStackSram::Pop(), HWStackSram::Push(), HWStackSram::SetSph(), and HWStackSram::SetSpl().

Here is the caller graph for this function:

unsigned long HWStack::GetLowestStackpointer ( void   )  [inline]

Gets back the lowest stack pointer (for measuring stack usage).

Definition at line 127 of file hwstack.h.

References lowestStackPointer.

unsigned long HWStack::GetStackPointer (  )  const [inline]

Returns current stack pointer value.

Definition at line 116 of file hwstack.h.

References stackPointer.

Referenced by GdbServer::gdb_read_register(), GdbServer::gdb_read_registers(), ThreadList::OnCall(), GdbServer::SendPosition(), and AvrDevice::Step().

Here is the caller graph for this function:

virtual unsigned char HWStack::Pop (  )  [pure virtual]

Pops one byte from stack.

Implemented in HWStackSram, and ThreeLevelStack.

Referenced by avr_op_POP::operator()().

Here is the caller graph for this function:

virtual unsigned long HWStack::PopAddr (  )  [pure virtual]

Pops a address from stack.

Implemented in HWStackSram, and ThreeLevelStack.

Referenced by avr_op_RETI::operator()(), and avr_op_RET::operator()().

Here is the caller graph for this function:

virtual void HWStack::Push ( unsigned char  val  )  [pure virtual]

Pushs one byte to stack.

Implemented in HWStackSram, and ThreeLevelStack.

Referenced by avr_op_PUSH::operator()().

Here is the caller graph for this function:

virtual void HWStack::PushAddr ( unsigned long  addr  )  [pure virtual]

Pushs a address to stack.

Implemented in HWStackSram, and ThreeLevelStack.

Referenced by avr_op_RCALL::operator()(), avr_op_ICALL::operator()(), avr_op_EICALL::operator()(), avr_op_CALL::operator()(), and AvrDevice::Step().

Here is the caller graph for this function:

void HWStack::Reset ( void   )  [virtual]

Resets stack pointer and listener table.

Reimplemented in HWStackSram, and ThreeLevelStack.

Definition at line 41 of file hwstack.cpp.

References lowestStackPointer, returnPointList, and stackPointer.

Referenced by HWStack().

Here is the caller graph for this function:

void HWStack::ResetLowestStackpointer ( void   )  [inline]

Sets lowest stack marker back to current stackpointer.

Definition at line 125 of file hwstack.h.

References lowestStackPointer, and stackPointer.

void HWStack::SetReturnPoint ( unsigned long  stackPointer,
Funktor listener 
)

Subscribes a Listener for a return address.

Attention! SetReturnPoint must get a COPY of a Funktor because it self destroy this functor after usage!

Definition at line 58 of file hwstack.cpp.

References returnPointList.

Referenced by AvrDevice::Step().

Here is the caller graph for this function:

void HWStack::SetStackPointer ( unsigned long  val  )  [inline]

Sets current stack pointer value (used by GDB interface).

Definition at line 118 of file hwstack.h.

References stackPointer.

Referenced by GdbServer::gdb_write_register(), and GdbServer::gdb_write_registers().

Here is the caller graph for this function:


Member Data Documentation

AvrDevice* HWStack::core [protected]

marker: lowest stackpointer used by program

Definition at line 96 of file hwstack.h.

Referenced by GetLowestStackpointer(), HWStackSram::Push(), ThreeLevelStack::PushAddr(), ThreeLevelStack::Reset(), HWStackSram::Reset(), Reset(), and ResetLowestStackpointer().

std::multimap<unsigned long, Funktor*> HWStack::returnPointList [protected]

Maps adresses to listeners for return addresses.

Definition at line 97 of file hwstack.h.

Referenced by CheckReturnPoints(), ThreeLevelStack::Reset(), HWStackSram::Reset(), Reset(), and SetReturnPoint().


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