4 Copyright 2008, 2009 Michel Pollet <buserror@gmail.com>
5 Jon Escombe <lists@dresco.co.uk>
7 This file is part of simavr.
9 simavr is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 simavr is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with simavr. If not, see <http://www.gnu.org/licenses/>.
24 #ifndef __SIM_TINYX5_H__
25 #define __SIM_TINYX5_H__
27 #include "sim_core_declare.h"
28 #include "avr_eeprom.h"
29 #include "avr_ioport.h"
30 #include "avr_timer8.h"
32 void tx5_init(struct avr_t * avr);
33 void tx5_reset(struct avr_t * avr);
36 * This is a template for all of the tinyx5 devices, hopefully
42 avr_timer8_t timer0, timer1;
47 #ifndef SIM_VECTOR_SIZE
48 #error SIM_VECTOR_SIZE is not declared
51 #error SIM_MMCU is not declared
54 struct mcu_t SIM_CORENAME = {
57 DEFAULT_CORE(SIM_VECTOR_SIZE),
62 AVR_EEPROM_DECLARE(EE_RDY_vect),
64 .name = 'B', .r_port = PORTB, .r_ddr = DDRB, .r_pin = PINB,
66 .enable = AVR_IO_REGBIT(GIMSK, PCIE),
67 .raised = AVR_IO_REGBIT(GIFR, PCIF),
68 .vector = PCINT0_vect,
74 .wgm = { AVR_IO_REGBIT(TCCR0A, WGM00), AVR_IO_REGBIT(TCCR0A, WGM01), AVR_IO_REGBIT(TCCR0B, WGM02) },
75 .cs = { AVR_IO_REGBIT(TCCR0B, CS00), AVR_IO_REGBIT(TCCR0B, CS01), AVR_IO_REGBIT(TCCR0B, CS02) },
76 .cs_div = { 0, 0, 3 /* 8 */, 6 /* 64 */, 8 /* 256 */, 10 /* 1024 */ },
83 .enable = AVR_IO_REGBIT(TIMSK, TOIE0),
84 .raised = AVR_IO_REGBIT(TIFR, TOV0),
85 .vector = TIMER0_OVF_vect,
88 .enable = AVR_IO_REGBIT(TIMSK, OCIE0A),
89 .raised = AVR_IO_REGBIT(TIFR, OCF0A),
90 .vector = TIMER0_COMPA_vect,
93 .enable = AVR_IO_REGBIT(TIMSK, OCIE0B),
94 .raised = AVR_IO_REGBIT(TIFR, OCF0B),
95 .vector = TIMER0_COMPB_vect,
101 .cs = { AVR_IO_REGBIT(TCCR1, CS10), AVR_IO_REGBIT(TCCR1, CS11), AVR_IO_REGBIT(TCCR1, CS12), AVR_IO_REGBIT(TCCR1, CS13) },
102 .cs_div = { 0, 0, 1 /* 2 */, 2 /* 4 */, 3 /* 8 */, 4 /* 16 */ },
110 .enable = AVR_IO_REGBIT(TIMSK, TOIE1),
111 .raised = AVR_IO_REGBIT(TIFR, TOV1),
112 .vector = TIMER1_OVF_vect,
115 .enable = AVR_IO_REGBIT(TIMSK, OCIE1A),
116 .raised = AVR_IO_REGBIT(TIFR, OCF1A),
117 .vector = TIMER1_COMPA_vect,
120 .enable = AVR_IO_REGBIT(TIMSK, OCIE1B),
121 .raised = AVR_IO_REGBIT(TIFR, OCF1B),
122 .vector = TIMER1_COMPB_vect,
128 #endif /* SIM_CORENAME */
130 #endif /* __SIM_TINYX5_H__ */