Lingfeng Yang | 92a62a9 | 2020-05-01 10:59:52 -0700 | [diff] [blame] | 1 | // Copyright 2016 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
Lingfeng Yang | 88c170c | 2016-11-30 00:52:35 +0000 | [diff] [blame] | 14 | |
| 15 | #ifndef ANDROID_INCLUDE_HARDWARE_GOLDFISH_DMA_H |
| 16 | #define ANDROID_INCLUDE_HARDWARE_GOLDFISH_DMA_H |
| 17 | |
Lingfeng Yang | e38d15c | 2018-09-24 16:24:01 -0700 | [diff] [blame] | 18 | #include <inttypes.h> |
Lingfeng Yang | 88c170c | 2016-11-30 00:52:35 +0000 | [diff] [blame] | 19 | |
| 20 | // userspace interface |
| 21 | struct goldfish_dma_context { |
Roman Kiryanov | 96a068f | 2018-06-13 17:05:05 -0700 | [diff] [blame] | 22 | uint64_t mapped_addr; |
| 23 | uint32_t size; |
| 24 | int32_t fd; |
Lingfeng Yang | 88c170c | 2016-11-30 00:52:35 +0000 | [diff] [blame] | 25 | }; |
| 26 | |
Lingfeng Yang | 88c170c | 2016-11-30 00:52:35 +0000 | [diff] [blame] | 27 | int goldfish_dma_create_region(uint32_t sz, struct goldfish_dma_context* res); |
| 28 | |
| 29 | void* goldfish_dma_map(struct goldfish_dma_context* cxt); |
| 30 | int goldfish_dma_unmap(struct goldfish_dma_context* cxt); |
| 31 | |
| 32 | void goldfish_dma_write(struct goldfish_dma_context* cxt, |
Roman Kiryanov | 96a068f | 2018-06-13 17:05:05 -0700 | [diff] [blame] | 33 | const void* to_write, |
Lingfeng Yang | 88c170c | 2016-11-30 00:52:35 +0000 | [diff] [blame] | 34 | uint32_t sz); |
| 35 | |
| 36 | void goldfish_dma_free(goldfish_dma_context* cxt); |
Roman Kiryanov | be1c0c2 | 2018-10-02 18:07:14 -0700 | [diff] [blame] | 37 | uint64_t goldfish_dma_guest_paddr(const struct goldfish_dma_context* cxt); |
Lingfeng Yang | 88c170c | 2016-11-30 00:52:35 +0000 | [diff] [blame] | 38 | |
| 39 | #endif |