atmega.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * QEMU ATmega MCU
  3. *
  4. * Copyright (c) 2019-2020 Philippe Mathieu-Daudé
  5. *
  6. * This work is licensed under the terms of the GNU GPLv2 or later.
  7. * See the COPYING file in the top-level directory.
  8. * SPDX-License-Identifier: GPL-2.0-or-later
  9. */
  10. #ifndef HW_AVR_ATMEGA_H
  11. #define HW_AVR_ATMEGA_H
  12. #include "hw/char/avr_usart.h"
  13. #include "hw/timer/avr_timer16.h"
  14. #include "hw/misc/avr_power.h"
  15. #include "target/avr/cpu.h"
  16. #define TYPE_ATMEGA_MCU "ATmega"
  17. #define TYPE_ATMEGA168_MCU "ATmega168"
  18. #define TYPE_ATMEGA328_MCU "ATmega328"
  19. #define TYPE_ATMEGA1280_MCU "ATmega1280"
  20. #define TYPE_ATMEGA2560_MCU "ATmega2560"
  21. #define ATMEGA_MCU(obj) OBJECT_CHECK(AtmegaMcuState, (obj), TYPE_ATMEGA_MCU)
  22. #define POWER_MAX 2
  23. #define USART_MAX 4
  24. #define TIMER_MAX 6
  25. #define GPIO_MAX 12
  26. typedef struct AtmegaMcuState {
  27. /*< private >*/
  28. SysBusDevice parent_obj;
  29. /*< public >*/
  30. AVRCPU cpu;
  31. MemoryRegion flash;
  32. MemoryRegion eeprom;
  33. MemoryRegion sram;
  34. DeviceState *io;
  35. AVRMaskState pwr[POWER_MAX];
  36. AVRUsartState usart[USART_MAX];
  37. AVRTimer16State timer[TIMER_MAX];
  38. uint64_t xtal_freq_hz;
  39. } AtmegaMcuState;
  40. #endif /* HW_AVR_ATMEGA_H */