Fixed problem in DeviceSettings::strParam, returned wrong string
[avr-sim.git] / src / Eeprom.h
blob8d145a6c810b31a624aa5138e3f7ae25468091a0
1 #ifndef AVR_EEPROM_H
2 #define AVR_EEPROM_H
4 #include "Memory.h"
5 #include "Hardware.h"
7 namespace avr {
9 /**
10 * @author Tom Haber
11 * @date Apr 21, 2008
12 * @brief Electrically Erasable Programmable Read-Only Memory
14 * This class represents the Eeprom memory in the chip.
16 class Eeprom : public Hardware, public Memory {
17 public:
18 Eeprom(Bus & bus, unsigned int size, unsigned int rdyVec);
19 ~Eeprom();
21 public:
22 void writeToAddress(unsigned int addr, unsigned char val);
23 unsigned char readFromAddress(unsigned int addr);
25 public:
26 bool attachReg(const char *name, IORegister *reg);
27 void regChanged( IORegister *reg );
28 void step();
30 private:
31 void setEECR( unsigned char eecr );
33 private:
34 unsigned int eear;
35 unsigned int rdyVec;
36 unsigned char oldEecr;
38 enum {
39 READY,
40 READ,
41 WRITE,
42 WRITE_ENABLED
43 } state;
45 static const unsigned int writeEnableCycles = 4;
46 static const unsigned int readCycles = 4;
47 static const unsigned int writeCycles = 2;
49 private:
50 IORegister *eearl;
51 IORegister *eearh;
52 IORegister *eecr;
53 IORegister *eedr;
58 #endif /*AVR_EEPROM_H*/