1bad56236SAndrew Baumann /* 2bad56236SAndrew Baumann * Raspberry Pi emulation (c) 2012 Gregory Estrade 3bad56236SAndrew Baumann * Upstreaming code cleanup [including bcm2835_*] (c) 2013 Jan Petrous 4bad56236SAndrew Baumann * 5bad56236SAndrew Baumann * Rasperry Pi 2 emulation and refactoring Copyright (c) 2015, Microsoft 6bad56236SAndrew Baumann * Written by Andrew Baumann 7bad56236SAndrew Baumann * 86111a0c0SPhilippe Mathieu-Daudé * This work is licensed under the terms of the GNU GPL, version 2 or later. 96111a0c0SPhilippe Mathieu-Daudé * See the COPYING file in the top-level directory. 10bad56236SAndrew Baumann */ 11bad56236SAndrew Baumann 12bad56236SAndrew Baumann #ifndef BCM2836_H 13bad56236SAndrew Baumann #define BCM2836_H 14bad56236SAndrew Baumann 15bad56236SAndrew Baumann #include "hw/arm/bcm2835_peripherals.h" 16bad56236SAndrew Baumann #include "hw/intc/bcm2836_control.h" 17ec150c7eSMarkus Armbruster #include "target/arm/cpu.h" 18*db1015e9SEduardo Habkost #include "qom/object.h" 19bad56236SAndrew Baumann 20926dcdf0SPeter Maydell #define TYPE_BCM283X "bcm283x" 21*db1015e9SEduardo Habkost typedef struct BCM283XClass BCM283XClass; 22*db1015e9SEduardo Habkost typedef struct BCM283XState BCM283XState; 23926dcdf0SPeter Maydell #define BCM283X(obj) OBJECT_CHECK(BCM283XState, (obj), TYPE_BCM283X) 24bad56236SAndrew Baumann 25926dcdf0SPeter Maydell #define BCM283X_NCPUS 4 26bad56236SAndrew Baumann 270fd74f03SPeter Maydell /* These type names are for specific SoCs; other than instantiating 280fd74f03SPeter Maydell * them, code using these devices should always handle them via the 290fd74f03SPeter Maydell * BCM283x base class, so they have no BCM2836(obj) etc macros. 300fd74f03SPeter Maydell */ 310fd74f03SPeter Maydell #define TYPE_BCM2836 "bcm2836" 320fd74f03SPeter Maydell #define TYPE_BCM2837 "bcm2837" 330fd74f03SPeter Maydell 34*db1015e9SEduardo Habkost struct BCM283XState { 35bad56236SAndrew Baumann /*< private >*/ 36bad56236SAndrew Baumann DeviceState parent_obj; 37bad56236SAndrew Baumann /*< public >*/ 38bad56236SAndrew Baumann 39bad56236SAndrew Baumann uint32_t enabled_cpus; 40bad56236SAndrew Baumann 415e5e9ed6SPhilippe Mathieu-Daudé struct { 425e5e9ed6SPhilippe Mathieu-Daudé ARMCPU core; 435e5e9ed6SPhilippe Mathieu-Daudé } cpu[BCM283X_NCPUS]; 44bad56236SAndrew Baumann BCM2836ControlState control; 45bad56236SAndrew Baumann BCM2835PeripheralState peripherals; 46*db1015e9SEduardo Habkost }; 47bad56236SAndrew Baumann 480fd74f03SPeter Maydell typedef struct BCM283XInfo BCM283XInfo; 490fd74f03SPeter Maydell 50*db1015e9SEduardo Habkost struct BCM283XClass { 510fd74f03SPeter Maydell DeviceClass parent_class; 520fd74f03SPeter Maydell const BCM283XInfo *info; 53*db1015e9SEduardo Habkost }; 540fd74f03SPeter Maydell 550fd74f03SPeter Maydell #define BCM283X_CLASS(klass) \ 560fd74f03SPeter Maydell OBJECT_CLASS_CHECK(BCM283XClass, (klass), TYPE_BCM283X) 570fd74f03SPeter Maydell #define BCM283X_GET_CLASS(obj) \ 580fd74f03SPeter Maydell OBJECT_GET_CLASS(BCM283XClass, (obj), TYPE_BCM283X) 590fd74f03SPeter Maydell 60bad56236SAndrew Baumann #endif /* BCM2836_H */ 61