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_extint.h"
30 #include "avr_ioport.h"
31 #include "avr_timer8.h"
33 void tx5_init(struct avr_t * avr);
34 void tx5_reset(struct avr_t * avr);
37 * This is a template for all of the tinyx5 devices, hopefully
44 avr_timer8_t timer0, timer1;
49 #ifndef SIM_VECTOR_SIZE
50 #error SIM_VECTOR_SIZE is not declared
53 #error SIM_MMCU is not declared
56 struct mcu_t SIM_CORENAME = {
59 DEFAULT_CORE(SIM_VECTOR_SIZE),
64 AVR_EEPROM_DECLARE(EE_RDY_vect),
67 .port_ioctl = AVR_IOCTL_IOPORT_GETIRQ('B'),
69 .isc = { AVR_IO_REGBIT(MCUCR, ISC00), AVR_IO_REGBIT(MCUCR, ISC01) },
71 .enable = AVR_IO_REGBIT(GIMSK, INT0),
72 .raised = AVR_IO_REGBIT(GIFR, INTF0),
78 .name = 'B', .r_port = PORTB, .r_ddr = DDRB, .r_pin = PINB,
80 .enable = AVR_IO_REGBIT(GIMSK, PCIE),
81 .raised = AVR_IO_REGBIT(GIFR, PCIF),
82 .vector = PCINT0_vect,
88 .wgm = { AVR_IO_REGBIT(TCCR0A, WGM00), AVR_IO_REGBIT(TCCR0A, WGM01), AVR_IO_REGBIT(TCCR0B, WGM02) },
89 .cs = { AVR_IO_REGBIT(TCCR0B, CS00), AVR_IO_REGBIT(TCCR0B, CS01), AVR_IO_REGBIT(TCCR0B, CS02) },
90 .cs_div = { 0, 0, 3 /* 8 */, 6 /* 64 */, 8 /* 256 */, 10 /* 1024 */ },
97 .enable = AVR_IO_REGBIT(TIMSK, TOIE0),
98 .raised = AVR_IO_REGBIT(TIFR, TOV0),
99 .vector = TIMER0_OVF_vect,
102 .enable = AVR_IO_REGBIT(TIMSK, OCIE0A),
103 .raised = AVR_IO_REGBIT(TIFR, OCF0A),
104 .vector = TIMER0_COMPA_vect,
107 .enable = AVR_IO_REGBIT(TIMSK, OCIE0B),
108 .raised = AVR_IO_REGBIT(TIFR, OCF0B),
109 .vector = TIMER0_COMPB_vect,
115 .cs = { AVR_IO_REGBIT(TCCR1, CS10), AVR_IO_REGBIT(TCCR1, CS11), AVR_IO_REGBIT(TCCR1, CS12), AVR_IO_REGBIT(TCCR1, CS13) },
116 .cs_div = { 0, 0, 1 /* 2 */, 2 /* 4 */, 3 /* 8 */, 4 /* 16 */ },
124 .enable = AVR_IO_REGBIT(TIMSK, TOIE1),
125 .raised = AVR_IO_REGBIT(TIFR, TOV1),
126 .vector = TIMER1_OVF_vect,
129 .enable = AVR_IO_REGBIT(TIMSK, OCIE1A),
130 .raised = AVR_IO_REGBIT(TIFR, OCF1A),
131 .vector = TIMER1_COMPA_vect,
134 .enable = AVR_IO_REGBIT(TIMSK, OCIE1B),
135 .raised = AVR_IO_REGBIT(TIFR, OCF1B),
136 .vector = TIMER1_COMPB_vect,
142 #endif /* SIM_CORENAME */
144 #endif /* __SIM_TINYX5_H__ */