1/* 2 * QEMU model of the XPPU 3 * 4 * Copyright (c) 2018 Xilinx Inc. 5 * 6 * Written by Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> 7 * 8 * Permission is hereby granted, free of charge, to any person obtaining a copy 9 * of this software and associated documentation files (the "Software"), to deal 10 * in the Software without restriction, including without limitation the rights 11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 * copies of the Software, and to permit persons to whom the Software is 13 * furnished to do so, subject to the following conditions: 14 * 15 * The above copyright notice and this permission notice shall be included in 16 * all copies or substantial portions of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 * THE SOFTWARE. 25 */ 26 27#include "qemu/osdep.h" 28#include "hw/i2c/i2c.h" 29#include "qemu/log.h" 30 31#define TYPE_DUMMY_I2C_DEVICE "i2c-dev-dummy" 32#define DEBUG_DUMMY_I2C_DEVICE 0 33#define DPRINT(fmt, args...) \ 34 if (DEBUG_DUMMY_I2C_DEVICE) { \ 35 qemu_log("%s: " fmt, __func__, ## args); \ 36 } 37 38static uint8_t dummyi2cdev_rx(I2CSlave *i2c) 39{ 40 return 0; 41} 42 43static int dummyi2cdev_tx(I2CSlave *i2c, uint8_t data) 44{ 45 return 0; 46} 47 48static void dummyi2cdev_class_init(ObjectClass *klass, void *data) 49{ 50 I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); 51 52 k->recv = dummyi2cdev_rx; 53 k->send = dummyi2cdev_tx; 54} 55 56static const TypeInfo dummyi2cdev_info = { 57 .name = TYPE_DUMMY_I2C_DEVICE, 58 .parent = TYPE_I2C_SLAVE, 59 .class_init = dummyi2cdev_class_init, 60}; 61 62static void dummyi2cdev_register_type(void) 63{ 64 type_register_static(&dummyi2cdev_info); 65} 66 67type_init(dummyi2cdev_register_type) 68