00001 /* 00002 **************************************************************************** 00003 * 00004 * simulavr - A simulator for the Atmel AVR family of microcontrollers. 00005 * Copyright (C) 2001, 2002, 2003 Klaus Rudolph 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 **************************************************************************** 00022 */ 00023 #ifndef AT90CAN 00024 #define AT90CAN 00025 00026 #include "avrdevice.h" 00027 #include "hardware.h" 00028 #include "rwmem.h" 00029 #include "externalirq.h" 00030 #include "hwuart.h" 00031 #include "hwad.h" 00032 #include "hwacomp.h" 00033 #include "hwport.h" 00034 #include "hwspi.h" 00035 #include "hwtimer/timerprescaler.h" 00036 #include "hwtimer/hwtimer.h" 00037 #include "ioregs.h" //only for rampz here 00038 00039 #include <memory> 00040 00041 using std::auto_ptr; 00042 00049 class AvrDevice_at90canbase: public AvrDevice { 00050 00051 protected: 00052 Pin aref; 00053 HWPort porta; 00054 HWPort portb; 00055 HWPort portc; 00056 HWPort portd; 00057 HWPort porte; 00058 HWPort portf; 00059 HWPort portg; 00060 IOSpecialReg gtccr_reg; 00061 IOSpecialReg assr_reg; 00062 HWPrescaler prescaler013; 00063 HWPrescalerAsync prescaler2; 00064 ExternalIRQHandler* extirq01; 00065 IOSpecialReg* eicra_reg; 00066 IOSpecialReg* eicrb_reg; 00067 IOSpecialReg* eimsk_reg; 00068 IOSpecialReg* eifr_reg; 00069 HWAdmux admux; 00070 HWAd* ad; 00071 HWSpi* spi; 00072 HWAcomp* acomp; 00073 HWUsart* usart0; 00074 HWUsart* usart1; 00075 TimerIRQRegister* timerIrq0; 00076 HWTimer8_1C* timer0; 00077 ICaptureSource* inputCapture1; 00078 TimerIRQRegister* timerIrq1; 00079 HWTimer16_3C* timer1; 00080 TimerIRQRegister* timerIrq2; 00081 HWTimer8_1C* timer2; 00082 00083 ICaptureSource* inputCapture3; 00084 TimerIRQRegister* timerIrq3; 00085 HWTimer16_3C* timer3; 00086 00087 GPIORegister* gpior0_reg; 00088 GPIORegister* gpior1_reg; 00089 GPIORegister* gpior2_reg; 00090 00091 public: 00092 00097 AvrDevice_at90canbase(unsigned ram_bytes, unsigned flash_bytes, 00098 unsigned ee_bytes ); 00099 00100 ~AvrDevice_at90canbase(); 00101 00102 }; 00103 00105 class AvrDevice_at90can32: public AvrDevice_at90canbase { 00106 public: 00108 AvrDevice_at90can32() : AvrDevice_at90canbase(2 * 1024, 32 * 1024, 1024) {} 00109 }; 00110 00112 class AvrDevice_at90can64: public AvrDevice_at90canbase { 00113 public: 00115 AvrDevice_at90can64() : AvrDevice_at90canbase(4 * 1024, 64 * 1024, 2 * 1024) {} 00116 }; 00117 00119 class AvrDevice_at90can128: public AvrDevice_at90canbase { 00120 public: 00122 AvrDevice_at90can128() : AvrDevice_at90canbase(4 * 1024, 128 * 1024, 4 * 1024) {} 00123 }; 00124 00125 #endif