32 #include "avrmalloc.h"
54 static uint8_t sram_read (VDevice *dev,
int addr);
55 static void sram_write (VDevice *dev,
int addr, uint8_t val);
56 static void sram_reset (VDevice *dev);
59 sram_new (
int base,
int size)
64 sram_construct (sram, base, size);
71 sram_construct (SRAM *sram,
int base,
int size)
76 sram->stor = storage_new (base, size);
77 vdev_construct ((VDevice *)sram, sram_read, sram_write, sram_reset,
82 sram_destroy (
void *sram)
84 SRAM *_sram = (SRAM *)sram;
95 sram_get_size (SRAM *sram)
97 return storage_get_size (sram->stor);
101 sram_get_base (SRAM *sram)
103 return storage_get_base (sram->stor);
107 sram_read (VDevice *dev,
int addr)
109 SRAM *sram = (SRAM *)dev;
111 return storage_readb (sram->stor, addr);
115 sram_write (VDevice *dev,
int addr, uint8_t val)
117 SRAM *sram = (SRAM *)dev;
121 storage_writeb (sram->stor, addr, val);
125 sram_reset (VDevice *dev)