qemu/include/hw/display/xlnx_dp.h
<<
>>
Prefs
   1/*
   2 * xlnx_dp.h
   3 *
   4 *  Copyright (C) 2015 : GreenSocs Ltd
   5 *      http://www.greensocs.com/ , email: info@greensocs.com
   6 *
   7 *  Developed by :
   8 *  Frederic Konrad   <fred.konrad@greensocs.com>
   9 *
  10 * This program is free software; you can redistribute it and/or modify
  11 * it under the terms of the GNU General Public License as published by
  12 * the Free Software Foundation, either version 2 of the License, or
  13 * (at your option) any later version.
  14 *
  15 * This program is distributed in the hope that it will be useful,
  16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18 * GNU General Public License for more details.
  19 *
  20 * You should have received a copy of the GNU General Public License along
  21 * with this program; if not, see <http://www.gnu.org/licenses/>.
  22 *
  23 */
  24
  25#include "hw/sysbus.h"
  26#include "ui/console.h"
  27#include "hw/misc/aux.h"
  28#include "hw/i2c/i2c.h"
  29#include "hw/display/dpcd.h"
  30#include "hw/i2c/i2c-ddc.h"
  31#include "qemu/fifo8.h"
  32#include "hw/dma/xlnx_dpdma.h"
  33#include "audio/audio.h"
  34
  35#ifndef XLNX_DP_H
  36#define XLNX_DP_H
  37
  38#define AUD_CHBUF_MAX_DEPTH                 32768
  39#define MAX_QEMU_BUFFER_SIZE                4096
  40
  41#define DP_CORE_REG_ARRAY_SIZE              (0x3AF >> 2)
  42#define DP_AVBUF_REG_ARRAY_SIZE             (0x238 >> 2)
  43#define DP_VBLEND_REG_ARRAY_SIZE            (0x1DF >> 2)
  44#define DP_AUDIO_REG_ARRAY_SIZE             (0x50 >> 2)
  45
  46struct PixmanPlane {
  47    pixman_format_code_t format;
  48    DisplaySurface *surface;
  49};
  50
  51struct XlnxDPState {
  52    /*< private >*/
  53    SysBusDevice parent_obj;
  54    /* < public >*/
  55    MemoryRegion container;
  56
  57    uint32_t core_registers[DP_CORE_REG_ARRAY_SIZE];
  58    MemoryRegion core_iomem;
  59
  60    uint32_t avbufm_registers[DP_AVBUF_REG_ARRAY_SIZE];
  61    MemoryRegion avbufm_iomem;
  62
  63    uint32_t vblend_registers[DP_VBLEND_REG_ARRAY_SIZE];
  64    MemoryRegion vblend_iomem;
  65
  66    uint32_t audio_registers[DP_AUDIO_REG_ARRAY_SIZE];
  67    MemoryRegion audio_iomem;
  68
  69    QemuConsole *console;
  70
  71    /*
  72     * This is the planes used to display in console. When the blending is
  73     * enabled bout_plane is displayed in console else it's g_plane.
  74     */
  75    struct PixmanPlane g_plane;
  76    struct PixmanPlane v_plane;
  77    struct PixmanPlane bout_plane;
  78
  79    QEMUSoundCard aud_card;
  80    SWVoiceOut *amixer_output_stream;
  81    int16_t audio_buffer_0[AUD_CHBUF_MAX_DEPTH];
  82    int16_t audio_buffer_1[AUD_CHBUF_MAX_DEPTH];
  83    size_t audio_data_available[2];
  84    int64_t temp_buffer[AUD_CHBUF_MAX_DEPTH];
  85    int16_t out_buffer[AUD_CHBUF_MAX_DEPTH];
  86    size_t byte_left; /* byte available in out_buffer. */
  87    size_t data_ptr;  /* next byte to be sent to QEMU. */
  88
  89    /* Associated DPDMA controller. */
  90    XlnxDPDMAState *dpdma;
  91
  92    qemu_irq irq;
  93
  94    AUXBus *aux_bus;
  95    Fifo8 rx_fifo;
  96    Fifo8 tx_fifo;
  97
  98    /*
  99     * XXX: This should be in an other module.
 100     */
 101    DPCDState *dpcd;
 102    I2CDDCState *edid;
 103};
 104
 105typedef struct XlnxDPState XlnxDPState;
 106
 107#define TYPE_XLNX_DP "xlnx.v-dp"
 108#define XLNX_DP(obj) OBJECT_CHECK(XlnxDPState, (obj), TYPE_XLNX_DP)
 109
 110#endif /* !XLNX_DP_H */
 111