simulavr  1.1.0
hweeprom.h
Go to the documentation of this file.
1  /*
2  ****************************************************************************
3  *
4  * simulavr - A simulator for the Atmel AVR family of microcontrollers.
5  * Copyright (C) 2001, 2002, 2003 Klaus Rudolph
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  ****************************************************************************
22  *
23  * $Id$
24  */
25 
26 #ifndef HWEEPROM
27 #define HWEEPROM
28 
29 #include "rwmem.h"
30 #include "hardware.h"
31 #include "memory.h"
32 #include "traceval.h"
33 #include "irqsystem.h"
34 
35 class HWEeprom: public Hardware, public Memory, public TraceValueRegister {
36  protected:
38  unsigned int eear;
39  unsigned int eear_mask;
40  unsigned char eecr;
41  unsigned char eecr_mask;
42  unsigned char eedr;
44  unsigned int irqVectorNo;
47  int opState;
48  int opMode;
49  unsigned int opAddr;
54 
55  public:
56  enum {
60  };
61 
62  enum {
66  };
67 
68  enum {
70  CTRL_READ = 1,
73  CTRL_IRQ = 8,
76  CTRL_MODES = 48,
77  };
78 
79  HWEeprom(AvrDevice *core, HWIrqSystem *irqs, unsigned int size, unsigned int irqVec, int devMode = DEVMODE_NORMAL);
80  virtual ~HWEeprom();
81 
82  virtual unsigned int CpuCycle();
83  void Reset();
84  void ClearIrqFlag(unsigned int vector);
85 
86  void WriteMem(const unsigned char *, unsigned int offset, unsigned int size);
87  void WriteAtAddress(unsigned int, unsigned char);
88  unsigned char ReadFromAddress(unsigned int);
89 
90  void SetEearl(unsigned char);
91  void SetEearh(unsigned char);
92  void SetEedr(unsigned char);
93  void SetEecr(unsigned char);
94 
95  unsigned char GetEearl() {return eear & 0xff; }
96  unsigned char GetEearh() {return (eear >> 8) & 0xff; }
97  unsigned char GetEecr() { return eecr; }
98  unsigned char GetEedr() { return eedr; }
99 
102  eearl_reg,
103  eedr_reg,
104  eecr_reg;
105 };
106 
107 #endif
Basic AVR device, contains the core functionality.
Definition: avrdevice.h:66
unsigned char GetEearl()
Definition: hweeprom.h:95
int opMode
Definition: hweeprom.h:48
unsigned char ReadFromAddress(unsigned int)
Definition: hweeprom.cpp:284
IOReg< HWEeprom > eedr_reg
Definition: hweeprom.h:101
unsigned int opAddr
Definition: hweeprom.h:49
SystemClockOffset writeDoneTime
Definition: hweeprom.h:53
int opEnableCycles
Definition: hweeprom.h:45
unsigned int irqVectorNo
Definition: hweeprom.h:44
void ClearIrqFlag(unsigned int vector)
Definition: hweeprom.cpp:275
int opState
Definition: hweeprom.h:47
void WriteAtAddress(unsigned int, unsigned char)
Definition: hweeprom.cpp:280
HWIrqSystem * irqSystem
Definition: hweeprom.h:43
void SetEearh(unsigned char)
Definition: hweeprom.cpp:118
void SetEedr(unsigned char)
Definition: hweeprom.cpp:126
SystemClockOffset writeDelayTime
Definition: hweeprom.h:52
SystemClockOffset eraseDelayTime
Definition: hweeprom.h:51
void WriteMem(const unsigned char *, unsigned int offset, unsigned int size)
Definition: hweeprom.cpp:288
Build a register for TraceValue&#39;s.
Definition: traceval.h:442
void Reset()
Definition: hweeprom.cpp:97
unsigned char eedr
Definition: hweeprom.h:42
IOReg< HWEeprom > eearh_reg
Definition: hweeprom.h:101
HWEeprom(AvrDevice *core, HWIrqSystem *irqs, unsigned int size, unsigned int irqVec, int devMode=DEVMODE_NORMAL)
Definition: hweeprom.cpp:35
long long SystemClockOffset
unsigned char eecr_mask
Definition: hweeprom.h:41
unsigned int size
Definition: memory.h:41
void SetEecr(unsigned char)
Definition: hweeprom.cpp:132
IOReg< HWEeprom > eecr_reg
Definition: hweeprom.h:101
void SetEearl(unsigned char)
Definition: hweeprom.cpp:112
unsigned int eear_mask
Definition: hweeprom.h:39
unsigned char eecr
Definition: hweeprom.h:40
Hold a memory block and symbol informations.
Definition: memory.h:38
AvrDevice * core
Definition: hweeprom.h:37
virtual ~HWEeprom()
Definition: hweeprom.cpp:107
IOReg< HWEeprom > eearl_reg
Definition: hweeprom.h:101
unsigned char GetEecr()
Definition: hweeprom.h:97
int cpuHoldCycles
Definition: hweeprom.h:46
unsigned int eear
Definition: hweeprom.h:38
unsigned char GetEearh()
Definition: hweeprom.h:96
unsigned char GetEedr()
Definition: hweeprom.h:98
SystemClockOffset eraseWriteDelayTime
Definition: hweeprom.h:50
virtual unsigned int CpuCycle()
Definition: hweeprom.cpp:219