Main Page

- Main Page
- Related Pages
- Files

- File List
- Globals

Functions
stack.c File Reference

Go to the source code of this file.

## Functions
Stack * | stack_new (StackFP_Pop pop, StackFP_Push push)
void | stack_construct (Stack *stack, StackFP_Pop pop, StackFP_Push push)
void | stack_destroy (void *stack)
uint32_t | stack_pop (Stack *stack, int bytes)
void | stack_push (Stack *stack, int bytes, uint32_t val)
HWStack * | hwstack_new (int depth)
void | hwstack_construct (HWStack *stack, int depth)
void | hwstack_destroy (void *stack)
VDevice * | sp_create (int addr, char *name, int rel_addr, void *data)
MemStack * | memstack_new (Memory *mem, int spl_addr)
void | memstack_construct (MemStack *stack, Memory *mem, int spl_addr)
void | memstack_destroy (void *stack)

## Detailed Description

Module for the definition of the stack.

Defines the classes stack, hw_stack, and mem_stack.

FIXME: Ted, I would really really really love to put in a description of what is the difference between these three classes and how they're used, but I don't understand it myself.

Definition in file stack.c.

## Function Documentation

Stack* stack_new | ( | StackFP_Pop | pop,
|  | StackFP_Push | push
| ) |  |

Allocates memory for a new Stack object.

This is a virtual method for higher level stack implementations and as such should not be used directly.

Definition at line 82 of file stack.c.

References avr_new, class_overload_destroy(), stack_construct(), and stack_destroy().

void stack_construct | ( | Stack * | stack,
|  | StackFP_Pop | pop,
|  | StackFP_Push | push
| ) |  |

Constructor for the Stack class.

This is a virtual method for higher level stack implementations and as such should not be used directly.

Definition at line 99 of file stack.c.

References avr_error, and class_construct().

Referenced by hwstack_construct(), memstack_construct(), and stack_new().

void stack_destroy | ( | void * | stack | ) |

Destructor for the Stack class.

This is a virtual method for higher level stack implementations and as such should not be used directly.

Definition at line 116 of file stack.c.

References class_destroy().

Referenced by hwstack_destroy(), memstack_destroy(), and stack_new().

uint32_t stack_pop | ( | Stack * | stack,
|  | int | bytes
| ) |  |

Pops a byte or a word off the stack and returns it.

Parameters

  stack | A pointer to the Stack object from which to pop
  bytes | Number of bytes to pop off the stack (1 to 4 bytes).

Returns
  The 1 to 4 bytes value popped from the stack.

This method provides access to the derived class's pop() method.

Definition at line 133 of file stack.c.

void stack_push | ( | Stack * | stack,
|  | int | bytes,
|  | uint32_t | val
| ) |  |

Pushes a byte or a word of data onto the stack.

Parameters

  stack | A pointer to the Stack object from which to pop.
  bytes | Size of the value being pushed onto the stack (1 to 4 bytes).
  val | The value to be pushed.

This method provides access to the derived class's push() method.

Definition at line 146 of file stack.c.

HWStack* hwstack_new | ( | int | depth | ) |

Allocate a new HWStack object.

This is the stack implementation used by devices which lack SRAM and only have a fixed size hardware stack (e.i., the at90s1200)

Definition at line 163 of file stack.c.

References avr_new, class_overload_destroy(), hwstack_construct(), and hwstack_destroy().

void hwstack_construct | ( | HWStack * | stack,
|  | int | depth
| ) |  |

Constructor for HWStack object.

Definition at line 177 of file stack.c.

References avr_error, avr_new0, and stack_construct().

Referenced by hwstack_new().

void hwstack_destroy | ( | void * | stack | ) |

Destructor for HWStack object.

Definition at line 191 of file stack.c.

References avr_free(), and stack_destroy().

Referenced by hwstack_new().

VDevice* sp_create | ( | int | addr,
|  | char * | name,
|  | int | rel_addr,
|  | void * | data
| ) |  |

Create the Stack Pointer VDevice.

This should only be used in the DevSuppDefn io reg init structure.

Definition at line 272 of file stack.c.

MemStack* memstack_new | ( | Memory * | mem,
|  | int | spl_addr
| ) |  |

Allocate a new MemStack object.

Definition at line 388 of file stack.c.

References avr_new, class_overload_destroy(), memstack_construct(), and memstack_destroy().

void memstack_construct | ( | MemStack * | stack,
|  | Memory * | mem,
|  | int | spl_addr
| ) |  |

Constructor for MemStack object.

Definition at line 402 of file stack.c.

References avr_error, class_ref(), mem_get_vdevice_by_addr(), and stack_construct().

Referenced by memstack_new().

void memstack_destroy | ( | void * | stack | ) |

Destructor for MemStack object.

Definition at line 423 of file stack.c.

References class_unref(), and stack_destroy().

Referenced by memstack_new().

Automatically generated by Doxygen 1.8.2 on Mon Aug 18 2014.