summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/avr8/avr8.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/avr8/avr8.cpp')
-rw-r--r--src/devices/cpu/avr8/avr8.cpp49
1 files changed, 26 insertions, 23 deletions
diff --git a/src/devices/cpu/avr8/avr8.cpp b/src/devices/cpu/avr8/avr8.cpp
index f949ed0ef03..4f319b2131a 100644
--- a/src/devices/cpu/avr8/avr8.cpp
+++ b/src/devices/cpu/avr8/avr8.cpp
@@ -566,6 +566,9 @@ void avr8_device<NumTimers>::base_internal_map(address_map &map)
map(0x003f, 0x003f).w(FUNC(avr8_device::eecr_w));
map(0x0043, 0x0043).w(FUNC(avr8_device::gtccr_w));
map(0x0044, 0x0044).w(FUNC(avr8_device::tccr0a_w));
+ map(0x0045, 0x0045).w(FUNC(avr8_device::tccr0b_w));
+ map(0x0047, 0x0047).w(FUNC(avr8_device::ocr0a_w));
+ map(0x0048, 0x0048).w(FUNC(avr8_device::ocr0b_w));
map(0x004a, 0x004a).w(FUNC(avr8_device::gpior1_w));
map(0x004b, 0x004b).w(FUNC(avr8_device::gpior2_w));
map(0x004c, 0x004c).w(FUNC(avr8_device::spcr_w));
@@ -728,7 +731,7 @@ atmega168_device::atmega168_device(const machine_config &mconfig, const char *ta
//-------------------------------------------------
atmega328_device::atmega328_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : avr8_device<3>(mconfig, tag, owner, clock, ATMEGA328, 0x7fff, address_map_constructor(FUNC(atmega328_device::atmega328_internal_map), this))
+ : avr8_device<3>(mconfig, tag, owner, clock, ATMEGA328, 0x3fff, address_map_constructor(FUNC(atmega328_device::atmega328_internal_map), this))
{
}
@@ -737,7 +740,7 @@ atmega328_device::atmega328_device(const machine_config &mconfig, const char *ta
//-------------------------------------------------
atmega644_device::atmega644_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : avr8_device<3>(mconfig, tag, owner, clock, ATMEGA644, 0xffff, address_map_constructor(FUNC(atmega644_device::atmega644_internal_map), this))
+ : avr8_device<3>(mconfig, tag, owner, clock, ATMEGA644, 0x7fff, address_map_constructor(FUNC(atmega644_device::atmega644_internal_map), this))
{
}
@@ -746,7 +749,7 @@ atmega644_device::atmega644_device(const machine_config &mconfig, const char *ta
//-------------------------------------------------
atmega1280_device::atmega1280_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : avr8_device<6>(mconfig, tag, owner, clock, ATMEGA1280, 0x1ffff, address_map_constructor(FUNC(atmega1280_device::atmega1280_internal_map), this))
+ : avr8_device<6>(mconfig, tag, owner, clock, ATMEGA1280, 0xffff, address_map_constructor(FUNC(atmega1280_device::atmega1280_internal_map), this))
{
}
@@ -764,7 +767,7 @@ atmega2560_device::atmega2560_device(const machine_config &mconfig, const char *
//-------------------------------------------------
attiny15_device::attiny15_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : avr8_device<2>(mconfig, tag, owner, clock, ATTINY15, 0x03ff, address_map_constructor(FUNC(attiny15_device::attiny15_internal_map), this))
+ : avr8_device<2>(mconfig, tag, owner, clock, ATTINY15, 0x01ff, address_map_constructor(FUNC(attiny15_device::attiny15_internal_map), this))
{
}
@@ -1123,23 +1126,23 @@ void avr8_base_device::device_reset()
switch ((m_hfuses & (BOOTSZ1 | BOOTSZ0)) >> 1)
{
case 0:
- if (m_addr_mask <= 0x1fff) { m_boot_size = 1024; }
- else if (m_addr_mask <= 0xffff) { m_boot_size = 2048; }
+ if (m_addr_mask <= 0x3fff) { m_boot_size = 1024; }
+ else if (m_addr_mask <= 0x7fff) { m_boot_size = 2048; }
else { m_boot_size = 4096; }
break;
case 1:
- if (m_addr_mask <= 0x1fff) { m_boot_size = 512; }
- else if (m_addr_mask <= 0xffff) { m_boot_size = 1024; }
+ if (m_addr_mask <= 0x3fff) { m_boot_size = 512; }
+ else if (m_addr_mask <= 0x7fff) { m_boot_size = 1024; }
else { m_boot_size = 2048; }
break;
case 2:
- if (m_addr_mask <= 0x1fff) { m_boot_size = 256; }
- else if (m_addr_mask <= 0xffff) { m_boot_size = 512; }
+ if (m_addr_mask <= 0x3fff) { m_boot_size = 256; }
+ else if (m_addr_mask <= 0x7fff) { m_boot_size = 512; }
else { m_boot_size = 1024; }
break;
case 3:
- if (m_addr_mask <= 0x1fff) { m_boot_size = 128; }
- else if (m_addr_mask <= 0xffff) { m_boot_size = 256; }
+ if (m_addr_mask <= 0x3fff) { m_boot_size = 128; }
+ else if (m_addr_mask <= 0x7fff) { m_boot_size = 256; }
else { m_boot_size = 512; }
break;
default:
@@ -1217,7 +1220,7 @@ void avr8_base_device::state_string_export(const device_state_entry &entry, std:
case STATE_GENPC:
case STATE_GENPCBASE:
case AVR8_PC:
- str = string_format("%05x", m_pc << 1);
+ str = string_format("%05x", m_pc >> 1);
break;
case STATE_GENFLAGS:
str = string_format("%c%c%c%c%c%c%c%c",
@@ -1481,7 +1484,7 @@ void avr8_device<NumTimers>::timer0_tick_ctc_toggle()
m_timer_top[0] = 0;
LOGMASKED(LOG_TIMER0, "%s: timer0: Toggle OC0B on match\n", machine().describe_context());
m_r[PORTG] ^= (1 << 5);
- m_gpio_out_cb[PORTG](m_r[PORTG]);
+ m_gpio_out_cb[GPIOG](m_r[PORTG]);
}
m_r[TCNT0]++;
m_timer_prescale_count[0] -= m_timer_prescale[0];
@@ -1495,7 +1498,7 @@ void avr8_device<NumTimers>::timer0_tick_ctc_clear()
m_timer_top[0] = 0;
LOGMASKED(LOG_TIMER0, "[0] timer0: Clear OC0B on match\n", machine().describe_context());
m_r[PORTG] &= ~(1 << 5);
- m_gpio_out_cb[PORTG](m_r[PORTG]);
+ m_gpio_out_cb[GPIOG](m_r[PORTG]);
}
m_r[TCNT0]++;
m_timer_prescale_count[0] -= m_timer_prescale[0];
@@ -1509,7 +1512,7 @@ void avr8_device<NumTimers>::timer0_tick_ctc_set()
m_timer_top[0] = 0;
LOGMASKED(LOG_TIMER0, "%s: timer0: Set OC0B on match\n", machine().describe_context());
m_r[PORTG] |= (1 << 5);
- m_gpio_out_cb[PORTG](m_r[PORTG]);
+ m_gpio_out_cb[GPIOG](m_r[PORTG]);
}
m_r[TCNT0]++;
m_timer_prescale_count[0] -= m_timer_prescale[0];
@@ -1958,7 +1961,7 @@ void avr8_device<NumTimers>::update_timer_waveform_gen_mode(uint8_t t, uint8_t m
if (m_timer_top[t] == -1)
{
m_timer_top[t] = 0;
- LOGMASKED((LOG_TIMER0 + t), "%s: update_timer_waveform_gen_mode: Timer %d - Unsupported waveform generation type: %d\n", machine().describe_context(), t, mode);
+ LOGMASKED((LOG_TIMER0 << t), "%s: update_timer_waveform_gen_mode: Timer %d - Unsupported waveform generation type: %d\n", machine().describe_context(), t, mode);
}
}
@@ -2025,7 +2028,7 @@ void avr8_device<NumTimers>::timer2_tick_fast_pwm()
if (m_ocr2_not_reached_yet)
{
// Turn off
- m_r[PORTD] |= 1 << 7;
+ m_r[PORTD] &= ~(1 << 7);
m_gpio_out_cb[GPIOD](m_r[PORTD]);
m_ocr2_not_reached_yet = false;
}
@@ -2188,11 +2191,11 @@ void avr8_device<NumTimers>::update_timer_clock_source(uint8_t clock_select, con
const uint16_t old_prescale = s_prescale_values[(Timer == 2) ? 1 : 0][old_clock_select];
m_timer_prescale[Timer] = (uint16_t)prescale_divisor;
- LOGMASKED(LOG_TIMER0 + Timer, "%s: update_timer_clock_source: t = %d, cs = %d\n", machine().describe_context(), Timer, clock_select);
+ LOGMASKED(LOG_TIMER0 << Timer, "%s: update_timer_clock_source: t = %d, cs = %d\n", machine().describe_context(), Timer, clock_select);
if (prescale_divisor == -1)
{
- LOGMASKED(LOG_TIMER0 + Timer, "%s: timer%d: update_timer_clock_source: External trigger mode not implemented yet\n", machine().describe_context(), Timer);
+ LOGMASKED(LOG_TIMER0 << Timer, "%s: timer%d: update_timer_clock_source: External trigger mode not implemented yet\n", machine().describe_context(), Timer);
m_timer_prescale[Timer] = 0xffff;
}
@@ -2251,7 +2254,7 @@ void avr8_device<NumTimers>::timer5_tick()
m_timer_top[5] = 0;
LOGMASKED(LOG_TIMER5, "%s: timer5: Toggle OC5B on compare match\n", machine().describe_context());
m_r[PORTL] ^= 1 << 4;
- m_gpio_out_cb[PORTL](m_r[PORTL]);
+ m_gpio_out_cb[GPIOL](m_r[PORTL]);
}
break;
case 2: /* Clear OC5B on compare match */
@@ -2261,7 +2264,7 @@ void avr8_device<NumTimers>::timer5_tick()
// Clear OC5B
LOGMASKED(LOG_TIMER5, "%s: timer5: Clear OC5B on compare match\n", machine().describe_context());
m_r[PORTL] &= ~(1 << 4);
- m_gpio_out_cb[PORTL](m_r[PORTL]);
+ m_gpio_out_cb[GPIOL](m_r[PORTL]);
}
break;
case 3: /* Set OC5B on compare match */
@@ -2270,7 +2273,7 @@ void avr8_device<NumTimers>::timer5_tick()
m_timer_top[5] = 0;
LOGMASKED(LOG_TIMER5, "%s: timer5: Set OC5B on compare match\n", machine().describe_context());
m_r[PORTL] |= 1 << 4;
- m_gpio_out_cb[PORTL](m_r[PORTL]);
+ m_gpio_out_cb[GPIOL](m_r[PORTL]);
}
break;
}