blob: 40537a848b433517a64dea6bc1e23f82025e338a [file] [log] [blame]
KONRAD Fredericd3c63692016-06-14 15:59:15 +01001/*
2 * xlnx_dpdma.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#ifndef XLNX_DPDMA_H
26#define XLNX_DPDMA_H
27
28#include "hw/sysbus.h"
29#include "ui/console.h"
30#include "sysemu/dma.h"
Eduardo Habkostdb1015e2020-09-03 16:43:22 -040031#include "qom/object.h"
KONRAD Fredericd3c63692016-06-14 15:59:15 +010032
33#define XLNX_DPDMA_REG_ARRAY_SIZE (0x1000 >> 2)
34
35struct XlnxDPDMAState {
36 /*< private >*/
37 SysBusDevice parent_obj;
38 /*< public >*/
39 MemoryRegion iomem;
40 uint32_t registers[XLNX_DPDMA_REG_ARRAY_SIZE];
41 uint8_t *data[6];
42 bool operation_finished[6];
43 qemu_irq irq;
44};
45
KONRAD Fredericd3c63692016-06-14 15:59:15 +010046
47#define TYPE_XLNX_DPDMA "xlnx.dpdma"
Eduardo Habkost80633962020-09-16 14:25:19 -040048OBJECT_DECLARE_SIMPLE_TYPE(XlnxDPDMAState, XLNX_DPDMA)
KONRAD Fredericd3c63692016-06-14 15:59:15 +010049
50/*
51 * xlnx_dpdma_start_operation: Start the operation on the specified channel. The
52 * DPDMA gets the current descriptor and retrieves
53 * data to the buffer specified by
54 * dpdma_set_host_data_location().
55 *
Stefan Weil5bb85902016-11-19 20:47:15 +010056 * Returns The number of bytes transferred by the DPDMA
57 * or 0 if an error occurred.
KONRAD Fredericd3c63692016-06-14 15:59:15 +010058 *
59 * @s The DPDMA state.
60 * @channel The channel to start.
61 */
62size_t xlnx_dpdma_start_operation(XlnxDPDMAState *s, uint8_t channel,
63 bool one_desc);
64
65/*
66 * xlnx_dpdma_set_host_data_location: Set the location in the host memory where
67 * to store the data out from the dma
68 * channel.
69 *
70 * @s The DPDMA state.
71 * @channel The channel associated to the pointer.
72 * @p The buffer where to store the data.
73 */
74/* XXX: add a maximum size arg and send an interrupt in case of overflow. */
75void xlnx_dpdma_set_host_data_location(XlnxDPDMAState *s, uint8_t channel,
76 void *p);
77
78/*
79 * xlnx_dpdma_trigger_vsync_irq: Trigger a VSYNC IRQ when the display is
80 * updated.
81 *
82 * @s The DPDMA state.
83 */
84void xlnx_dpdma_trigger_vsync_irq(XlnxDPDMAState *s);
85
Markus Armbruster175de522016-06-29 15:29:06 +020086#endif /* XLNX_DPDMA_H */