liyujie
2025-08-29 87c7c0d90966d729ca3d39cbfca77a39a43960eb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * Copyright (C) 2016 Google, Inc.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * 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.
 *
 */
 
#ifndef ANDROID_INCLUDE_HARDWARE_GOLDFISH_DMA_H
#define ANDROID_INCLUDE_HARDWARE_GOLDFISH_DMA_H
 
#include <inttypes.h>
 
// userspace interface
struct goldfish_dma_context {
   uint64_t mapped_addr;
   uint32_t size;
   int32_t fd;
};
 
int goldfish_dma_create_region(uint32_t sz, struct goldfish_dma_context* res);
 
void* goldfish_dma_map(struct goldfish_dma_context* cxt);
int goldfish_dma_unmap(struct goldfish_dma_context* cxt);
 
void goldfish_dma_write(struct goldfish_dma_context* cxt,
                        const void* to_write,
                        uint32_t sz);
 
void goldfish_dma_free(goldfish_dma_context* cxt);
uint64_t goldfish_dma_guest_paddr(const struct goldfish_dma_context* cxt);
 
#endif