1*819ce6b2SPhilippe Mathieu-Daudé /* 2*819ce6b2SPhilippe Mathieu-Daudé * QEMU M48T59 and M48T08 NVRAM emulation 3*819ce6b2SPhilippe Mathieu-Daudé * 4*819ce6b2SPhilippe Mathieu-Daudé * Copyright (c) 2003-2005, 2007 Jocelyn Mayer 5*819ce6b2SPhilippe Mathieu-Daudé * Copyright (c) 2013 Hervé Poussineau 6*819ce6b2SPhilippe Mathieu-Daudé * 7*819ce6b2SPhilippe Mathieu-Daudé * Permission is hereby granted, free of charge, to any person obtaining a copy 8*819ce6b2SPhilippe Mathieu-Daudé * of this software and associated documentation files (the "Software"), to deal 9*819ce6b2SPhilippe Mathieu-Daudé * in the Software without restriction, including without limitation the rights 10*819ce6b2SPhilippe Mathieu-Daudé * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11*819ce6b2SPhilippe Mathieu-Daudé * copies of the Software, and to permit persons to whom the Software is 12*819ce6b2SPhilippe Mathieu-Daudé * furnished to do so, subject to the following conditions: 13*819ce6b2SPhilippe Mathieu-Daudé * 14*819ce6b2SPhilippe Mathieu-Daudé * The above copyright notice and this permission notice shall be included in 15*819ce6b2SPhilippe Mathieu-Daudé * all copies or substantial portions of the Software. 16*819ce6b2SPhilippe Mathieu-Daudé * 17*819ce6b2SPhilippe Mathieu-Daudé * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18*819ce6b2SPhilippe Mathieu-Daudé * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19*819ce6b2SPhilippe Mathieu-Daudé * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20*819ce6b2SPhilippe Mathieu-Daudé * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21*819ce6b2SPhilippe Mathieu-Daudé * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22*819ce6b2SPhilippe Mathieu-Daudé * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23*819ce6b2SPhilippe Mathieu-Daudé * THE SOFTWARE. 24*819ce6b2SPhilippe Mathieu-Daudé */ 25*819ce6b2SPhilippe Mathieu-Daudé 26*819ce6b2SPhilippe Mathieu-Daudé #ifndef HW_RTC_M48T59_H 27*819ce6b2SPhilippe Mathieu-Daudé #define HW_RTC_M48T59_H 28*819ce6b2SPhilippe Mathieu-Daudé 29*819ce6b2SPhilippe Mathieu-Daudé #include "exec/hwaddr.h" 30*819ce6b2SPhilippe Mathieu-Daudé #include "qom/object.h" 31*819ce6b2SPhilippe Mathieu-Daudé 32*819ce6b2SPhilippe Mathieu-Daudé #define TYPE_NVRAM "nvram" 33*819ce6b2SPhilippe Mathieu-Daudé 34*819ce6b2SPhilippe Mathieu-Daudé #define NVRAM_CLASS(klass) \ 35*819ce6b2SPhilippe Mathieu-Daudé OBJECT_CLASS_CHECK(NvramClass, (klass), TYPE_NVRAM) 36*819ce6b2SPhilippe Mathieu-Daudé #define NVRAM_GET_CLASS(obj) \ 37*819ce6b2SPhilippe Mathieu-Daudé OBJECT_GET_CLASS(NvramClass, (obj), TYPE_NVRAM) 38*819ce6b2SPhilippe Mathieu-Daudé #define NVRAM(obj) \ 39*819ce6b2SPhilippe Mathieu-Daudé INTERFACE_CHECK(Nvram, (obj), TYPE_NVRAM) 40*819ce6b2SPhilippe Mathieu-Daudé 41*819ce6b2SPhilippe Mathieu-Daudé typedef struct Nvram Nvram; 42*819ce6b2SPhilippe Mathieu-Daudé 43*819ce6b2SPhilippe Mathieu-Daudé typedef struct NvramClass { 44*819ce6b2SPhilippe Mathieu-Daudé InterfaceClass parent; 45*819ce6b2SPhilippe Mathieu-Daudé 46*819ce6b2SPhilippe Mathieu-Daudé uint32_t (*read)(Nvram *obj, uint32_t addr); 47*819ce6b2SPhilippe Mathieu-Daudé void (*write)(Nvram *obj, uint32_t addr, uint32_t val); 48*819ce6b2SPhilippe Mathieu-Daudé void (*toggle_lock)(Nvram *obj, int lock); 49*819ce6b2SPhilippe Mathieu-Daudé } NvramClass; 50*819ce6b2SPhilippe Mathieu-Daudé 51*819ce6b2SPhilippe Mathieu-Daudé Nvram *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size, 52*819ce6b2SPhilippe Mathieu-Daudé int base_year, int type); 53*819ce6b2SPhilippe Mathieu-Daudé Nvram *m48t59_init(qemu_irq IRQ, hwaddr mem_base, 54*819ce6b2SPhilippe Mathieu-Daudé uint32_t io_base, uint16_t size, int base_year, 55*819ce6b2SPhilippe Mathieu-Daudé int type); 56*819ce6b2SPhilippe Mathieu-Daudé 57*819ce6b2SPhilippe Mathieu-Daudé #endif /* HW_M48T59_H */ 58