#include "avr/iom128.h"
/*
- * This is a template for all of the 128 devices, hopefuly
+ * This is a template for all of the 128 devices, hopefully
*/
-struct mcu_t {
+const struct mcu_t {
avr_t core;
avr_eeprom_t eeprom;
avr_flash_t selfprog;
.txen = AVR_IO_REGBIT(UCSR0B, TXEN0),
.rxen = AVR_IO_REGBIT(UCSR0B, RXEN0),
+ .ucsz = AVR_IO_REGBITS(UCSR0C, UCSZ00, 0x3), // 2 bits
+ .ucsz2 = AVR_IO_REGBIT(UCSR0B, UCSZ02), // 1 bits
.r_ucsra = UCSR0A,
.r_ucsrb = UCSR0B,
.txen = AVR_IO_REGBIT(UCSR1B, TXEN1),
.rxen = AVR_IO_REGBIT(UCSR1B, RXEN1),
+ .ucsz = AVR_IO_REGBITS(UCSR1C, UCSZ10, 0x3), // 2 bits
+ .ucsz2 = AVR_IO_REGBIT(UCSR1B, UCSZ12), // 1 bits
.r_ucsra = UCSR1A,
.r_ucsrb = UCSR1B,
.twi = {
.enable = AVR_IO_REGBIT(TWCR, TWIE),
- .raised = AVR_IO_REGBIT(TWSR, TWINT),
+ .raised = AVR_IO_REGBIT(TWCR, TWINT),
.vector = TWI_vect,
},
},
static avr_t * make()
{
- return &mcu_mega128.core;
+ return avr_core_allocate(&mcu_mega128.core, sizeof(struct mcu_t));
}
avr_kind_t mega128 = {