Main Page | File List | Globals | Related Pages

memory.c File Reference

Memory access functions. More...

Go to the source code of this file.

Functions

Memory * mem_new (void)
void mem_construct (Memory *mem)
void mem_destroy (void *mem)
void mem_attach (Memory *mem, VDevice *dev)
VDevice * mem_get_vdevice_by_addr (Memory *mem, int addr)
VDevice * mem_get_vdevice_by_name (Memory *mem, char *name)
uint8_t mem_read (Memory *mem, int addr)
void mem_write (Memory *mem, int addr, uint8_t val)
void mem_reset (Memory *mem)
void mem_io_fetch (Memory *mem, int addr, uint8_t *val, char *buf, int bufsiz)
void mem_dump_core (Memory *mem, FILE *f_core)


Detailed Description

Memory access functions.

This module provides functions for reading and writing to simulated memory. The Memory class is a subclass of AvrClass.

Definition in file memory.c.


Function Documentation

Memory* mem_new void   ) 
 

Allocates memory for a new memory object.

Definition at line 66 of file memory.c.

References avr_new, class_overload_destroy(), mem_construct(), and mem_destroy().

Referenced by avr_core_construct().

void mem_construct Memory *  mem  ) 
 

Constructor for the memory object.

Definition at line 80 of file memory.c.

References avr_error, and class_construct().

Referenced by mem_new().

void mem_destroy void *  mem  ) 
 

Descructor for the memory object.

Definition at line 93 of file memory.c.

References class_destroy(), and dlist_delete_all().

Referenced by mem_new().

void mem_attach Memory *  mem,
VDevice *  dev
 

Attach a device to the device list.

Devices that are accessed more often should be attached last so that they will be at the front of the list.

A default virtual device can be overridden by attaching a new device ahead of it in the list. Definition at line 114 of file memory.c.

References avr_error, and dlist_add_head().

Referenced by memstack_construct().

VDevice* mem_get_vdevice_by_addr Memory *  mem,
int  addr
 

Find the VDevice associated with the given address.

Definition at line 129 of file memory.c.

References dlist_lookup(), and vdev_addr_cmp().

Referenced by mem_io_fetch(), mem_read(), and mem_write().

VDevice* mem_get_vdevice_by_name Memory *  mem,
char *  name
 

Find the VDevice associated with the given name.

Definition at line 138 of file memory.c.

References dlist_lookup(), and vdev_name_cmp().

Referenced by avr_core_add_ext_rd_wr(), avr_core_get_sizes(), and avr_core_load_eeprom().

uint8_t mem_read Memory *  mem,
int  addr
 

Reads byte from memory and sanity-checks for valid address.

Parameters:
mem A pointer to the memory object
addr The address to be read
Returns:
The byte found at that address addr
Definition at line 152 of file memory.c.

References avr_warning, mem_get_vdevice_by_addr(), and vdev_read().

void mem_write Memory *  mem,
int  addr,
uint8_t  val
 

Writes byte to memory and updates display for io registers.

Parameters:
mem A pointer to a memory object
addr The address to be written to
val The value to be written there
Definition at line 173 of file memory.c.

References avr_warning, display_io_reg(), mem_get_vdevice_by_addr(), and vdev_write().

void mem_reset Memory *  mem  ) 
 

Resets every device in the memory object.

Parameters:
mem A pointer to the memory object.
Definition at line 203 of file memory.c.

References dlist_iterator().

Referenced by avr_core_reset().

void mem_io_fetch Memory *  mem,
int  addr,
uint8_t *  val,
char *  buf,
int  bufsiz
 

Fetch the name and value of the io register (addr).

Parameters:
mem A pointer to the memory object.
addr The address to fetch from.
val A pointer where the value of the register is to be copied.
buf A pointer to where the name of the register should be copied.
bufsiz The maximum size of the the buf string.
Definition at line 233 of file memory.c.

References mem_get_vdevice_by_addr(), port_ext_disable(), port_ext_enable(), vdev_get_name(), vdev_get_reg_name(), and vdev_read().

Referenced by avr_core_io_display_names().

void mem_dump_core Memory *  mem,
FILE *  f_core
 

Dump all the various memory locations to a file descriptor in text format.

Parameters:
mem A memory object.
f_core An open file descriptor.
Definition at line 386 of file memory.c.

Referenced by avr_core_dump_core().


Automatically generated by Doxygen 1.3.8 on 11 Aug 2004.