// Automatically generated file. DO NOT EDIT.
// Generated by gen-device-avr.go from ATtiny9.atdf, see http://packs.download.atmel.com/

// +build avr,attiny9

// Device information for the ATtiny9.
package avr

import (
	"runtime/interrupt"
	"runtime/volatile"
	"unsafe"
)

// Some information about this device.
const (
	DEVICE = "ATtiny9"
	ARCH   = "AVR8L"
	FAMILY = "tinyAVR"
)

// Interrupts
const (
	IRQ_RESET      = 0 // External Reset, Power-on Reset and Watchdog Reset
	IRQ_INT0       = 1 // External Interrupt Request 0
	IRQ_PCINT0     = 2 // Pin Change Interrupt Request 0
	IRQ_TIM0_CAPT  = 3 // Timer/Counter0 Input Capture
	IRQ_TIM0_OVF   = 4 // Timer/Counter0 Overflow
	IRQ_TIM0_COMPA = 5 // Timer/Counter Compare Match A
	IRQ_TIM0_COMPB = 6 // Timer/Counter Compare Match B
	IRQ_ANA_COMP   = 7 // Analog Comparator
	IRQ_WDT        = 8 // Watchdog Time-out
	IRQ_VLM        = 9 // Vcc Voltage Level Monitor
	IRQ_max        = 9 // Highest interrupt number on this device.
)

// Map interrupt numbers to function names.
// These aren't real calls, they're removed by the compiler.
var (
	_ = interrupt.Register(IRQ_RESET, "__vector_RESET")
	_ = interrupt.Register(IRQ_INT0, "__vector_INT0")
	_ = interrupt.Register(IRQ_PCINT0, "__vector_PCINT0")
	_ = interrupt.Register(IRQ_TIM0_CAPT, "__vector_TIM0_CAPT")
	_ = interrupt.Register(IRQ_TIM0_OVF, "__vector_TIM0_OVF")
	_ = interrupt.Register(IRQ_TIM0_COMPA, "__vector_TIM0_COMPA")
	_ = interrupt.Register(IRQ_TIM0_COMPB, "__vector_TIM0_COMPB")
	_ = interrupt.Register(IRQ_ANA_COMP, "__vector_ANA_COMP")
	_ = interrupt.Register(IRQ_WDT, "__vector_WDT")
	_ = interrupt.Register(IRQ_VLM, "__vector_VLM")
)

// Peripherals.
var (
	// Fuses
	BYTE0 = (*volatile.Register8)(unsafe.Pointer(uintptr(0x0)))

	// Lockbits
	LOCKBIT = (*volatile.Register8)(unsafe.Pointer(uintptr(0x0)))

	// Analog Comparator
	ACSR  = (*volatile.Register8)(unsafe.Pointer(uintptr(0x1f)))
	DIDR0 = (*volatile.Register8)(unsafe.Pointer(uintptr(0x17)))

	// CPU Registers
	CCP    = (*volatile.Register8)(unsafe.Pointer(uintptr(0x3c)))
	SPL    = (*volatile.Register8)(unsafe.Pointer(uintptr(0x3d)))
	SPH    = (*volatile.Register8)(unsafe.Pointer(uintptr(0x3e)))
	SREG   = (*volatile.Register8)(unsafe.Pointer(uintptr(0x3f)))
	CLKMSR = (*volatile.Register8)(unsafe.Pointer(uintptr(0x37)))
	CLKPSR = (*volatile.Register8)(unsafe.Pointer(uintptr(0x36)))
	OSCCAL = (*volatile.Register8)(unsafe.Pointer(uintptr(0x39)))
	SMCR   = (*volatile.Register8)(unsafe.Pointer(uintptr(0x3a)))
	PRR    = (*volatile.Register8)(unsafe.Pointer(uintptr(0x35)))
	VLMCSR = (*volatile.Register8)(unsafe.Pointer(uintptr(0x34)))
	RSTFLR = (*volatile.Register8)(unsafe.Pointer(uintptr(0x3b)))
	NVMCSR = (*volatile.Register8)(unsafe.Pointer(uintptr(0x32)))
	NVMCMD = (*volatile.Register8)(unsafe.Pointer(uintptr(0x33)))

	// I/O Port
	PORTCR = (*volatile.Register8)(unsafe.Pointer(uintptr(0xc)))
	PUEB   = (*volatile.Register8)(unsafe.Pointer(uintptr(0x3)))
	DDRB   = (*volatile.Register8)(unsafe.Pointer(uintptr(0x1)))
	PINB   = (*volatile.Register8)(unsafe.Pointer(uintptr(0x0)))
	PORTB  = (*volatile.Register8)(unsafe.Pointer(uintptr(0x2)))

	// External Interrupts
	EICRA = (*volatile.Register8)(unsafe.Pointer(uintptr(0x15)))
	EIMSK = (*volatile.Register8)(unsafe.Pointer(uintptr(0x13)))
	EIFR  = (*volatile.Register8)(unsafe.Pointer(uintptr(0x14)))
	PCICR = (*volatile.Register8)(unsafe.Pointer(uintptr(0x12)))
	PCIFR = (*volatile.Register8)(unsafe.Pointer(uintptr(0x11)))
	PCMSK = (*volatile.Register8)(unsafe.Pointer(uintptr(0x10)))

	// Timer/Counter, 16-bit
	TCCR0A = (*volatile.Register8)(unsafe.Pointer(uintptr(0x2e)))
	TCCR0B = (*volatile.Register8)(unsafe.Pointer(uintptr(0x2d)))
	TCCR0C = (*volatile.Register8)(unsafe.Pointer(uintptr(0x2c)))
	TCNT0L = (*volatile.Register8)(unsafe.Pointer(uintptr(0x28)))
	TCNT0H = (*volatile.Register8)(unsafe.Pointer(uintptr(0x29)))
	OCR0AL = (*volatile.Register8)(unsafe.Pointer(uintptr(0x26)))
	OCR0AH = (*volatile.Register8)(unsafe.Pointer(uintptr(0x27)))
	OCR0BL = (*volatile.Register8)(unsafe.Pointer(uintptr(0x24)))
	OCR0BH = (*volatile.Register8)(unsafe.Pointer(uintptr(0x25)))
	ICR0L  = (*volatile.Register8)(unsafe.Pointer(uintptr(0x22)))
	ICR0H  = (*volatile.Register8)(unsafe.Pointer(uintptr(0x23)))
	TIMSK0 = (*volatile.Register8)(unsafe.Pointer(uintptr(0x2b)))
	TIFR0  = (*volatile.Register8)(unsafe.Pointer(uintptr(0x2a)))
	GTCCR  = (*volatile.Register8)(unsafe.Pointer(uintptr(0x2f)))

	// Watchdog Timer
	WDTCSR = (*volatile.Register8)(unsafe.Pointer(uintptr(0x31)))
)

// Bitfields for FUSE: Fuses
const (
	// BYTE0
	BYTE0_CKOUT    = 0x4 // Output external clock
	BYTE0_WDTON    = 0x2 // Watch dog timer always on
	BYTE0_RSTDISBL = 0x1 // Disable external reset
)

// Bitfields for LOCKBIT: Lockbits
const (
	// LOCKBIT
	LOCKBIT_LB0 = 0x1 // Memory Lock
	LOCKBIT_LB1 = 0x2 // Memory Lock
)

// Bitfields for AC: Analog Comparator
const (
	// ACSR: Analog Comparator Control And Status Register
	ACSR_ACD   = 0x80 // Analog Comparator Disable
	ACSR_ACO   = 0x20 // Analog Compare Output
	ACSR_ACI   = 0x10 // Analog Comparator Interrupt Flag
	ACSR_ACIE  = 0x8  // Analog Comparator Interrupt Enable
	ACSR_ACIC  = 0x4  // Analog Comparator Input Capture  Enable
	ACSR_ACIS0 = 0x1  // Analog Comparator Interrupt Mode Select bits
	ACSR_ACIS1 = 0x2  // Analog Comparator Interrupt Mode Select bits

	// DIDR0
	DIDR0_AIN1D = 0x2 // AIN1 Digital Input Disable
	DIDR0_AIN0D = 0x1 // AIN0 Digital Input Disable
)

// Bitfields for CPU: CPU Registers
const (
	// SREG: Status Register
	SREG_I = 0x80 // Global Interrupt Enable
	SREG_T = 0x40 // Bit Copy Storage
	SREG_H = 0x20 // Half Carry Flag
	SREG_S = 0x10 // Sign Bit
	SREG_V = 0x8  // Two's Complement Overflow Flag
	SREG_N = 0x4  // Negative Flag
	SREG_Z = 0x2  // Zero Flag
	SREG_C = 0x1  // Carry Flag

	// CLKMSR: Clock Main Settings Register
	CLKMSR_CLKMS0 = 0x1 // Clock Main Select Bits
	CLKMSR_CLKMS1 = 0x2 // Clock Main Select Bits

	// CLKPSR: Clock Prescale Register
	CLKPSR_CLKPS0 = 0x1 // Clock Prescaler Select Bits
	CLKPSR_CLKPS1 = 0x2 // Clock Prescaler Select Bits
	CLKPSR_CLKPS2 = 0x4 // Clock Prescaler Select Bits
	CLKPSR_CLKPS3 = 0x8 // Clock Prescaler Select Bits

	// SMCR: Sleep Mode Control Register
	SMCR_SM0 = 0x2 // Sleep Mode Select Bits
	SMCR_SM1 = 0x4 // Sleep Mode Select Bits
	SMCR_SM2 = 0x8 // Sleep Mode Select Bits
	SMCR_SE  = 0x1 // Sleep Enable

	// PRR: Power Reduction Register
	PRR_PRADC  = 0x2 // Power Reduction ADC
	PRR_PRTIM0 = 0x1 // Power Reduction Timer/Counter0

	// VLMCSR: Vcc Level Monitoring Control and Status Register
	VLMCSR_VLMF  = 0x80 // VLM Flag
	VLMCSR_VLMIE = 0x40 // VLM Interrupt Enable
	VLMCSR_VLM0  = 0x1  // Trigger Level of Voltage Level Monitor bits
	VLMCSR_VLM1  = 0x2  // Trigger Level of Voltage Level Monitor bits
	VLMCSR_VLM2  = 0x4  // Trigger Level of Voltage Level Monitor bits

	// RSTFLR: Reset Flag Register
	RSTFLR_WDRF  = 0x8 // Watchdog Reset Flag
	RSTFLR_EXTRF = 0x2 // External Reset Flag
	RSTFLR_PORF  = 0x1 // Power-on Reset Flag

	// NVMCSR: Non-Volatile Memory Control and Status Register
	NVMCSR_NVMBSY = 0x80 // Non-Volatile Memory Busy
)

// Bitfields for PORT: I/O Port
const (
	// PORTCR: Port Control Register
	PORTCR_BBMB = 0x2 // Break-Before-Make Mode Enable
)

// Bitfields for EXINT: External Interrupts
const (
	// EICRA: External Interrupt Control Register A
	EICRA_ISC01 = 0x2 // Interrupt Sense Control 0 Bit 1
	EICRA_ISC00 = 0x1 // Interrupt Sense Control 0 Bit 0

	// EIMSK: External Interrupt Mask register
	EIMSK_INT0 = 0x1 // External Interrupt Request 0 Enable

	// EIFR: External Interrupt Flag register
	EIFR_INTF0 = 0x1 // External Interrupt Flag 0

	// PCICR: Pin Change Interrupt Control Register
	PCICR_PCIE0 = 0x1 // Pin Change Interrupt Enable 0

	// PCIFR: Pin Change Interrupt Flag Register
	PCIFR_PCIF0 = 0x1 // Pin Change Interrupt Flag 0

	// PCMSK: Pin Change Mask Register
	PCMSK_PCINT0 = 0x1 // Pin Change Enable Masks
	PCMSK_PCINT1 = 0x2 // Pin Change Enable Masks
	PCMSK_PCINT2 = 0x4 // Pin Change Enable Masks
	PCMSK_PCINT3 = 0x8 // Pin Change Enable Masks
)

// Bitfields for TC16: Timer/Counter, 16-bit
const (
	// TCCR0A: Timer/Counter 0 Control Register A
	TCCR0A_COM0A0 = 0x40 // Compare Output Mode for Channel A bits
	TCCR0A_COM0A1 = 0x80 // Compare Output Mode for Channel A bits
	TCCR0A_COM0B0 = 0x10 // Compare Output Mode for Channel B bits
	TCCR0A_COM0B1 = 0x20 // Compare Output Mode for Channel B bits
	TCCR0A_WGM00  = 0x1  // Waveform Generation Mode
	TCCR0A_WGM01  = 0x2  // Waveform Generation Mode

	// TCCR0B: Timer/Counter 0 Control Register B
	TCCR0B_ICNC0 = 0x80 // Input Capture Noise Canceler
	TCCR0B_ICES0 = 0x40 // Input Capture Edge Select
	TCCR0B_WGM00 = 0x8  // Waveform Generation Mode
	TCCR0B_WGM01 = 0x10 // Waveform Generation Mode
	TCCR0B_CS00  = 0x1  // Clock Select
	TCCR0B_CS01  = 0x2  // Clock Select
	TCCR0B_CS02  = 0x4  // Clock Select

	// TCCR0C: Timer/Counter 0 Control Register C
	TCCR0C_FOC0A = 0x80 // Force Output Compare for Channel A
	TCCR0C_FOC0B = 0x40 // Force Output Compare for Channel B

	// TIMSK0: Timer Interrupt Mask Register 0
	TIMSK0_ICIE0  = 0x20 // Input Capture Interrupt Enable
	TIMSK0_OCIE0B = 0x4  // Output Compare B Match Interrupt Enable
	TIMSK0_OCIE0A = 0x2  // Output Compare A Match Interrupt Enable
	TIMSK0_TOIE0  = 0x1  // Overflow Interrupt Enable

	// TIFR0: Overflow Interrupt Enable
	TIFR0_ICF0  = 0x20 // Input Capture Flag
	TIFR0_OCF0B = 0x4  // Timer Output Compare Flag 0B
	TIFR0_OCF0A = 0x2  // Timer Output Compare Flag 0A
	TIFR0_TOV0  = 0x1  // Timer Overflow Flag

	// GTCCR: General Timer/Counter Control Register
	GTCCR_TSM = 0x80 // Timer Synchronization Mode
	GTCCR_PSR = 0x1  // Prescaler Reset
)

// Bitfields for WDT: Watchdog Timer
const (
	// WDTCSR: Watchdog Timer Control and Status Register
	WDTCSR_WDIF = 0x80 // Watchdog Timer Interrupt Flag
	WDTCSR_WDIE = 0x40 // Watchdog Timer Interrupt Enable
	WDTCSR_WDP0 = 0x1  // Watchdog Timer Prescaler Bits
	WDTCSR_WDP1 = 0x2  // Watchdog Timer Prescaler Bits
	WDTCSR_WDP2 = 0x4  // Watchdog Timer Prescaler Bits
	WDTCSR_WDP3 = 0x20 // Watchdog Timer Prescaler Bits
	WDTCSR_WDE  = 0x8  // Watch Dog Enable
)
