atmega.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #include "qom/object.h"
  17. #define TYPE_ATMEGA_MCU "ATmega"
  18. #define TYPE_ATMEGA168_MCU "ATmega168"
  19. #define TYPE_ATMEGA328_MCU "ATmega328"
  20. #define TYPE_ATMEGA1280_MCU "ATmega1280"
  21. #define TYPE_ATMEGA2560_MCU "ATmega2560"
  22. typedef struct AtmegaMcuState AtmegaMcuState;
  23. DECLARE_INSTANCE_CHECKER(AtmegaMcuState, ATMEGA_MCU,
  24. TYPE_ATMEGA_MCU)
  25. #define POWER_MAX 2
  26. #define USART_MAX 4
  27. #define TIMER_MAX 6
  28. #define GPIO_MAX 12
  29. struct AtmegaMcuState {
  30. /*< private >*/
  31. SysBusDevice parent_obj;
  32. /*< public >*/
  33. AVRCPU cpu;
  34. MemoryRegion flash;
  35. MemoryRegion eeprom;
  36. MemoryRegion sram;
  37. DeviceState *io;
  38. AVRMaskState pwr[POWER_MAX];
  39. AVRUsartState usart[USART_MAX];
  40. AVRTimer16State timer[TIMER_MAX];
  41. uint64_t xtal_freq_hz;
  42. };
  43. #endif /* HW_AVR_ATMEGA_H */