From f4b8df2dc232bc3f111c27212e54b6cbb8fe6851 Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Tue, 10 Aug 2010 22:51:31 +0100 Subject: [PATCH] core: Add PORTA support for Attiny2313 The Attiny2313 has a PORTA, the pins for it are normally used for reset and the crystal, but it is possible to use them if you use the internal R/C oscilator. Simavr didn't support this port on a Attiny2313 yet, so I added it myself. Signed-off-by: Wander Winkelhorst Signed-off-by: Michel Pollet --- simavr/cores/sim_tiny2313.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/simavr/cores/sim_tiny2313.c b/simavr/cores/sim_tiny2313.c index e0af609..d9136f3 100644 --- a/simavr/cores/sim_tiny2313.c +++ b/simavr/cores/sim_tiny2313.c @@ -43,7 +43,7 @@ static struct mcu_t { avr_eeprom_t eeprom; avr_watchdog_t watchdog; avr_extint_t extint; - avr_ioport_t portb, portd; + avr_ioport_t porta, portb, portd; avr_uart_t uart; avr_timer_t timer0,timer1; } mcu = { @@ -60,6 +60,9 @@ static struct mcu_t { AVR_EXTINT_TINY_DECLARE(0, 'D', 2, EIFR), AVR_EXTINT_TINY_DECLARE(1, 'D', 3, EIFR), }, + .porta = { // port A has no PCInts.. + .name = 'A', .r_port = PORTA, .r_ddr = DDRA, .r_pin = PINA, + }, .portb = { .name = 'B', .r_port = PORTB, .r_ddr = DDRB, .r_pin = PINB, .pcint = { @@ -226,6 +229,7 @@ static void init(struct avr_t * avr) avr_eeprom_init(avr, &mcu->eeprom); avr_watchdog_init(avr, &mcu->watchdog); avr_extint_init(avr, &mcu->extint); + avr_ioport_init(avr, &mcu->porta); avr_ioport_init(avr, &mcu->portb); avr_ioport_init(avr, &mcu->portd); avr_uart_init(avr, &mcu->uart); -- 2.20.1