2016-06-14 16:59:15 +02:00
|
|
|
/*
|
|
|
|
* xlnx_dp.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 : GreenSocs Ltd
|
|
|
|
* http://www.greensocs.com/ , email: info@greensocs.com
|
|
|
|
*
|
|
|
|
* Developed by :
|
|
|
|
* Frederic Konrad <fred.konrad@greensocs.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-06-04 20:16:15 +02:00
|
|
|
#ifndef XLNX_DP_H
|
|
|
|
#define XLNX_DP_H
|
|
|
|
|
2016-06-14 16:59:15 +02:00
|
|
|
#include "hw/sysbus.h"
|
|
|
|
#include "ui/console.h"
|
2016-07-07 14:47:01 +02:00
|
|
|
#include "hw/misc/auxbus.h"
|
2016-06-14 16:59:15 +02:00
|
|
|
#include "hw/i2c/i2c.h"
|
|
|
|
#include "hw/display/dpcd.h"
|
2019-03-25 16:59:23 +01:00
|
|
|
#include "hw/display/i2c-ddc.h"
|
2016-06-14 16:59:15 +02:00
|
|
|
#include "qemu/fifo8.h"
|
2018-06-25 14:42:06 +02:00
|
|
|
#include "qemu/units.h"
|
2016-06-14 16:59:15 +02:00
|
|
|
#include "hw/dma/xlnx_dpdma.h"
|
|
|
|
#include "audio/audio.h"
|
2020-09-03 22:43:22 +02:00
|
|
|
#include "qom/object.h"
|
2022-06-08 20:38:47 +02:00
|
|
|
#include "hw/ptimer.h"
|
2016-06-14 16:59:15 +02:00
|
|
|
|
2018-06-25 14:42:06 +02:00
|
|
|
#define AUD_CHBUF_MAX_DEPTH (32 * KiB)
|
|
|
|
#define MAX_QEMU_BUFFER_SIZE (4 * KiB)
|
2016-06-14 16:59:15 +02:00
|
|
|
|
2022-06-08 20:38:47 +02:00
|
|
|
#define DP_CORE_REG_OFFSET (0x0000)
|
|
|
|
#define DP_CORE_REG_ARRAY_SIZE (0x3B0 >> 2)
|
|
|
|
#define DP_AVBUF_REG_OFFSET (0xB000)
|
2016-06-14 16:59:15 +02:00
|
|
|
#define DP_AVBUF_REG_ARRAY_SIZE (0x238 >> 2)
|
2022-06-08 20:38:47 +02:00
|
|
|
#define DP_VBLEND_REG_OFFSET (0xA000)
|
|
|
|
#define DP_VBLEND_REG_ARRAY_SIZE (0x1E0 >> 2)
|
|
|
|
#define DP_AUDIO_REG_OFFSET (0xC000)
|
2016-06-14 16:59:15 +02:00
|
|
|
#define DP_AUDIO_REG_ARRAY_SIZE (0x50 >> 2)
|
2022-06-08 20:38:47 +02:00
|
|
|
#define DP_CONTAINER_SIZE (0xC050)
|
2016-06-14 16:59:15 +02:00
|
|
|
|
|
|
|
struct PixmanPlane {
|
|
|
|
pixman_format_code_t format;
|
|
|
|
DisplaySurface *surface;
|
|
|
|
};
|
|
|
|
|
2020-09-03 22:43:22 +02:00
|
|
|
struct XlnxDPState {
|
2016-06-14 16:59:15 +02:00
|
|
|
/*< private >*/
|
|
|
|
SysBusDevice parent_obj;
|
|
|
|
|
|
|
|
/* < public >*/
|
|
|
|
MemoryRegion container;
|
|
|
|
|
|
|
|
uint32_t core_registers[DP_CORE_REG_ARRAY_SIZE];
|
|
|
|
MemoryRegion core_iomem;
|
|
|
|
|
|
|
|
uint32_t avbufm_registers[DP_AVBUF_REG_ARRAY_SIZE];
|
|
|
|
MemoryRegion avbufm_iomem;
|
|
|
|
|
|
|
|
uint32_t vblend_registers[DP_VBLEND_REG_ARRAY_SIZE];
|
|
|
|
MemoryRegion vblend_iomem;
|
|
|
|
|
|
|
|
uint32_t audio_registers[DP_AUDIO_REG_ARRAY_SIZE];
|
|
|
|
MemoryRegion audio_iomem;
|
|
|
|
|
|
|
|
QemuConsole *console;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the planes used to display in console. When the blending is
|
|
|
|
* enabled bout_plane is displayed in console else it's g_plane.
|
|
|
|
*/
|
|
|
|
struct PixmanPlane g_plane;
|
|
|
|
struct PixmanPlane v_plane;
|
|
|
|
struct PixmanPlane bout_plane;
|
|
|
|
|
|
|
|
QEMUSoundCard aud_card;
|
|
|
|
SWVoiceOut *amixer_output_stream;
|
|
|
|
int16_t audio_buffer_0[AUD_CHBUF_MAX_DEPTH];
|
|
|
|
int16_t audio_buffer_1[AUD_CHBUF_MAX_DEPTH];
|
|
|
|
size_t audio_data_available[2];
|
|
|
|
int64_t temp_buffer[AUD_CHBUF_MAX_DEPTH];
|
|
|
|
int16_t out_buffer[AUD_CHBUF_MAX_DEPTH];
|
|
|
|
size_t byte_left; /* byte available in out_buffer. */
|
|
|
|
size_t data_ptr; /* next byte to be sent to QEMU. */
|
|
|
|
|
|
|
|
/* Associated DPDMA controller. */
|
|
|
|
XlnxDPDMAState *dpdma;
|
|
|
|
|
|
|
|
qemu_irq irq;
|
|
|
|
|
|
|
|
AUXBus *aux_bus;
|
|
|
|
Fifo8 rx_fifo;
|
|
|
|
Fifo8 tx_fifo;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX: This should be in an other module.
|
|
|
|
*/
|
|
|
|
DPCDState *dpcd;
|
|
|
|
I2CDDCState *edid;
|
2022-06-08 20:38:47 +02:00
|
|
|
|
|
|
|
ptimer_state *vblank;
|
2020-09-03 22:43:22 +02:00
|
|
|
};
|
2016-06-14 16:59:15 +02:00
|
|
|
|
|
|
|
#define TYPE_XLNX_DP "xlnx.v-dp"
|
2020-09-16 20:25:19 +02:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(XlnxDPState, XLNX_DP)
|
2016-06-14 16:59:15 +02:00
|
|
|
|
2019-06-04 20:16:15 +02:00
|
|
|
#endif
|