2
Copyright (C) 1998,1999,2000 T. Scott Dattalo
4
This file is part of the libgpsim library of gpsim
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Lesser General Public
8
License as published by the Free Software Foundation; either
9
version 2.1 of the License, or (at your option) any later version.
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Lesser General Public License for more details.
16
You should have received a copy of the GNU Lesser General Public
17
License along with this library; if not, see
18
<http://www.gnu.org/licenses/lgpl-2.1.html>.
30
//---------------------------------------------------------
32
class TMR0 : public SfrReg, public TriggerObject, public SignalSink
38
old_option, // Save option register contents here.
39
state; // Either on or off right now.
44
last_cycle; // can be negative ...
46
OPTION_REG *m_pOptionReg;
49
virtual void callback();
51
TMR0(Processor *, const char *pName );
53
virtual void release();
55
virtual void put(uint new_value);
56
virtual void put_value(uint new_value);
58
virtual uint get_value();
59
virtual void start(int new_value,int sync=0);
61
virtual void increment(); // Used when tmr0 is attached to an external clock
62
virtual void new_prescale();
63
virtual uint get_prescale();
64
virtual uint max_counts() {return 256;}
65
virtual bool get_t0cs();
66
virtual bool get_t0se();
67
virtual void set_t0if();
68
virtual void set_t0xcs(bool _t0xcs){t0xcs = _t0xcs;}
69
virtual bool get_t0xcs() {return t0xcs;}
70
virtual void reset(RESET_TYPE r);
71
virtual void callback_print();
72
virtual void clear_trigger();
74
virtual void set_cpu(Processor *, PortRegister *, uint pin,OPTION_REG *);
75
virtual void set_cpu(Processor *new_cpu, PinModule *pin,OPTION_REG *);
76
virtual void setSinkState(char);
79
void set_t1gcon(T1GCON *_t1gcon) { m_t1gcon = _t1gcon; }
80
void set_adcon2(ADCON2_TRIG *_adcon2) { m_adcon2 = _adcon2; }
81
void set_clc(CLC *_clc, int index);
91
ADCON2_TRIG *m_adcon2;
95
bool m_bLastClockedState;
96
bool t0xcs; // clock source is the capacitive sensing oscillator