158ac482aSKONRAD Frederic /* 258ac482aSKONRAD Frederic * xlnx_dp.h 358ac482aSKONRAD Frederic * 458ac482aSKONRAD Frederic * Copyright (C) 2015 : GreenSocs Ltd 558ac482aSKONRAD Frederic * http://www.greensocs.com/ , email: info@greensocs.com 658ac482aSKONRAD Frederic * 758ac482aSKONRAD Frederic * Developed by : 858ac482aSKONRAD Frederic * Frederic Konrad <fred.konrad@greensocs.com> 958ac482aSKONRAD Frederic * 1058ac482aSKONRAD Frederic * This program is free software; you can redistribute it and/or modify 1158ac482aSKONRAD Frederic * it under the terms of the GNU General Public License as published by 1258ac482aSKONRAD Frederic * the Free Software Foundation, either version 2 of the License, or 1358ac482aSKONRAD Frederic * (at your option) any later version. 1458ac482aSKONRAD Frederic * 1558ac482aSKONRAD Frederic * This program is distributed in the hope that it will be useful, 1658ac482aSKONRAD Frederic * but WITHOUT ANY WARRANTY; without even the implied warranty of 1758ac482aSKONRAD Frederic * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1858ac482aSKONRAD Frederic * GNU General Public License for more details. 1958ac482aSKONRAD Frederic * 2058ac482aSKONRAD Frederic * You should have received a copy of the GNU General Public License along 2158ac482aSKONRAD Frederic * with this program; if not, see <http://www.gnu.org/licenses/>. 2258ac482aSKONRAD Frederic * 2358ac482aSKONRAD Frederic */ 2458ac482aSKONRAD Frederic 2558ac482aSKONRAD Frederic #include "hw/sysbus.h" 2658ac482aSKONRAD Frederic #include "ui/console.h" 27*e0dadc1eSPeter Maydell #include "hw/misc/auxbus.h" 2858ac482aSKONRAD Frederic #include "hw/i2c/i2c.h" 2958ac482aSKONRAD Frederic #include "hw/display/dpcd.h" 3058ac482aSKONRAD Frederic #include "hw/i2c/i2c-ddc.h" 3158ac482aSKONRAD Frederic #include "qemu/fifo8.h" 3258ac482aSKONRAD Frederic #include "hw/dma/xlnx_dpdma.h" 3358ac482aSKONRAD Frederic #include "audio/audio.h" 3458ac482aSKONRAD Frederic 3558ac482aSKONRAD Frederic #ifndef XLNX_DP_H 3658ac482aSKONRAD Frederic #define XLNX_DP_H 3758ac482aSKONRAD Frederic 3858ac482aSKONRAD Frederic #define AUD_CHBUF_MAX_DEPTH 32768 3958ac482aSKONRAD Frederic #define MAX_QEMU_BUFFER_SIZE 4096 4058ac482aSKONRAD Frederic 4158ac482aSKONRAD Frederic #define DP_CORE_REG_ARRAY_SIZE (0x3AF >> 2) 4258ac482aSKONRAD Frederic #define DP_AVBUF_REG_ARRAY_SIZE (0x238 >> 2) 4358ac482aSKONRAD Frederic #define DP_VBLEND_REG_ARRAY_SIZE (0x1DF >> 2) 4458ac482aSKONRAD Frederic #define DP_AUDIO_REG_ARRAY_SIZE (0x50 >> 2) 4558ac482aSKONRAD Frederic 4658ac482aSKONRAD Frederic struct PixmanPlane { 4758ac482aSKONRAD Frederic pixman_format_code_t format; 4858ac482aSKONRAD Frederic DisplaySurface *surface; 4958ac482aSKONRAD Frederic }; 5058ac482aSKONRAD Frederic 5158ac482aSKONRAD Frederic typedef struct XlnxDPState { 5258ac482aSKONRAD Frederic /*< private >*/ 5358ac482aSKONRAD Frederic SysBusDevice parent_obj; 5458ac482aSKONRAD Frederic 5558ac482aSKONRAD Frederic /* < public >*/ 5658ac482aSKONRAD Frederic MemoryRegion container; 5758ac482aSKONRAD Frederic 5858ac482aSKONRAD Frederic uint32_t core_registers[DP_CORE_REG_ARRAY_SIZE]; 5958ac482aSKONRAD Frederic MemoryRegion core_iomem; 6058ac482aSKONRAD Frederic 6158ac482aSKONRAD Frederic uint32_t avbufm_registers[DP_AVBUF_REG_ARRAY_SIZE]; 6258ac482aSKONRAD Frederic MemoryRegion avbufm_iomem; 6358ac482aSKONRAD Frederic 6458ac482aSKONRAD Frederic uint32_t vblend_registers[DP_VBLEND_REG_ARRAY_SIZE]; 6558ac482aSKONRAD Frederic MemoryRegion vblend_iomem; 6658ac482aSKONRAD Frederic 6758ac482aSKONRAD Frederic uint32_t audio_registers[DP_AUDIO_REG_ARRAY_SIZE]; 6858ac482aSKONRAD Frederic MemoryRegion audio_iomem; 6958ac482aSKONRAD Frederic 7058ac482aSKONRAD Frederic QemuConsole *console; 7158ac482aSKONRAD Frederic 7258ac482aSKONRAD Frederic /* 7358ac482aSKONRAD Frederic * This is the planes used to display in console. When the blending is 7458ac482aSKONRAD Frederic * enabled bout_plane is displayed in console else it's g_plane. 7558ac482aSKONRAD Frederic */ 7658ac482aSKONRAD Frederic struct PixmanPlane g_plane; 7758ac482aSKONRAD Frederic struct PixmanPlane v_plane; 7858ac482aSKONRAD Frederic struct PixmanPlane bout_plane; 7958ac482aSKONRAD Frederic 8058ac482aSKONRAD Frederic QEMUSoundCard aud_card; 8158ac482aSKONRAD Frederic SWVoiceOut *amixer_output_stream; 8258ac482aSKONRAD Frederic int16_t audio_buffer_0[AUD_CHBUF_MAX_DEPTH]; 8358ac482aSKONRAD Frederic int16_t audio_buffer_1[AUD_CHBUF_MAX_DEPTH]; 8458ac482aSKONRAD Frederic size_t audio_data_available[2]; 8558ac482aSKONRAD Frederic int64_t temp_buffer[AUD_CHBUF_MAX_DEPTH]; 8658ac482aSKONRAD Frederic int16_t out_buffer[AUD_CHBUF_MAX_DEPTH]; 8758ac482aSKONRAD Frederic size_t byte_left; /* byte available in out_buffer. */ 8858ac482aSKONRAD Frederic size_t data_ptr; /* next byte to be sent to QEMU. */ 8958ac482aSKONRAD Frederic 9058ac482aSKONRAD Frederic /* Associated DPDMA controller. */ 9158ac482aSKONRAD Frederic XlnxDPDMAState *dpdma; 9258ac482aSKONRAD Frederic 9358ac482aSKONRAD Frederic qemu_irq irq; 9458ac482aSKONRAD Frederic 9558ac482aSKONRAD Frederic AUXBus *aux_bus; 9658ac482aSKONRAD Frederic Fifo8 rx_fifo; 9758ac482aSKONRAD Frederic Fifo8 tx_fifo; 9858ac482aSKONRAD Frederic 9958ac482aSKONRAD Frederic /* 10058ac482aSKONRAD Frederic * XXX: This should be in an other module. 10158ac482aSKONRAD Frederic */ 10258ac482aSKONRAD Frederic DPCDState *dpcd; 10358ac482aSKONRAD Frederic I2CDDCState *edid; 10458ac482aSKONRAD Frederic } XlnxDPState; 10558ac482aSKONRAD Frederic 10658ac482aSKONRAD Frederic #define TYPE_XLNX_DP "xlnx.v-dp" 10758ac482aSKONRAD Frederic #define XLNX_DP(obj) OBJECT_CHECK(XlnxDPState, (obj), TYPE_XLNX_DP) 10858ac482aSKONRAD Frederic 10958ac482aSKONRAD Frederic #endif /* !XLNX_DP_H */ 110