Fixed problem in DeviceSettings::strParam, returned wrong string
[avr-sim.git] / src / Flash.h
blob215a8484702ec41f10cf97105d500eb20466f33a
1 #ifndef AVR_FLASH_H
2 #define AVR_FLASH_H
4 #include "Hardware.h"
5 #include "Memory.h"
6 #include <vector>
8 namespace avr {
10 class Instruction;
12 /**
13 * @author Tom Haber
14 * @date Apr 21, 2008
15 * @brief Flash memory in the AVR chip
17 * This class represents the Flash memory in the chip.
18 * It allows read and write operations
20 class Flash : public Hardware, public Memory {
21 public:
22 Flash(Bus & bus, unsigned int size, int pagesize);
23 ~Flash();
25 public:
26 /**
27 * Fill a block of flash memory with the specified value.
29 * \exception AccessViolation { When the write exceeds
30 * amount of memory, this exception is thrown }
32 void fill(unsigned int offset, byte val, unsigned int size = 1);
34 public:
35 void storeProgramMemory(dword Z, byte r0, byte r1);
37 private:
38 void pageErase();
39 void pageWrite();
40 void resetRWW();
42 public:
43 bool attachReg(const char *name, IORegister *reg);
44 bool finishBuild();
45 void regChanged( IORegister *reg );
46 void step();
48 private:
49 // For reprogramming..
50 IORegister *spmcsr;
51 int pagebits;
52 int pagemask;
54 unsigned char *buffer;
55 int pageoffset;
56 int pagenum;
57 int state;
62 #endif /*AVR_FLASH_H*/