Tharun Kumar Merugu | 66f2265 | 2019-04-01 16:56:50 +0530 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (c) 2019, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are |
| 6 | * met: |
| 7 | * * Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * * Redistributions in binary form must reproduce the above |
| 10 | * copyright notice, this list of conditions and the following |
| 11 | * disclaimer in the documentation and/or other materials provided |
| 12 | * with the distribution. |
| 13 | * * Neither the name of The Linux Foundation nor the names of its |
| 14 | * contributors may be used to endorse or promote products derived |
| 15 | * from this software without specific prior written permission. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | */ |
| 29 | |
| 30 | #ifndef REMOTE64_H |
| 31 | #define REMOTE64_H |
| 32 | |
| 33 | #include "remote.h" |
| 34 | |
| 35 | #ifdef __cplusplus |
| 36 | extern "C" { |
| 37 | #endif |
| 38 | |
| 39 | typedef struct { |
| 40 | uint64_t pv; |
| 41 | int64_t nLen; |
| 42 | } remote_buf64; |
| 43 | |
| 44 | typedef struct { |
| 45 | int32_t fd; |
| 46 | uint32_t offset; |
| 47 | uint32_t len; |
| 48 | } remote_dma_handle64; |
| 49 | |
| 50 | typedef union { |
| 51 | remote_buf64 buf; |
| 52 | remote_handle h; |
| 53 | remote_handle64 h64; //! used by multi domain modules |
| 54 | remote_dma_handle64 dma; |
| 55 | } remote_arg64; |
| 56 | |
| 57 | #ifndef __QAIC_REMOTE |
| 58 | #define __QAIC_REMOTE(ff) ff |
| 59 | #endif //__QAIC_REMOTE |
| 60 | |
| 61 | #ifndef __QAIC_REMOTE_EXPORT |
| 62 | #ifdef _WIN32 |
| 63 | #define __QAIC_REMOTE_EXPORT __declspec(dllexport) |
| 64 | #else //_WIN32 |
| 65 | #define __QAIC_REMOTE_EXPORT |
| 66 | #endif //_WIN32 |
| 67 | #endif //__QAIC_REMOTE_EXPORT |
| 68 | |
| 69 | #ifndef __QAIC_REMOTE_ATTRIBUTE |
| 70 | #define __QAIC_REMOTE_ATTRIBUTE |
| 71 | #endif |
| 72 | |
| 73 | /* map memory to the remote domain |
| 74 | * |
| 75 | * @param fd, fd associated with this memory |
| 76 | * @param flags, flags to be used for the mapping |
| 77 | * @param vaddrin, input address |
| 78 | * @param size, size of buffer |
| 79 | * @param vaddrout, output address |
| 80 | * @retval, 0 on success |
| 81 | */ |
| 82 | __QAIC_REMOTE_EXPORT int __QAIC_REMOTE(remote_mmap64)(int fd, uint32_t flags, uint64_t vaddrin, int64_t size, uint64_t *vaddrout) __QAIC_REMOTE_ATTRIBUTE; |
| 83 | |
| 84 | /* unmap memory from the remote domain |
| 85 | * |
| 86 | * @param vaddrout, remote address mapped |
| 87 | * @param size, size to unmap. Unmapping a range partially may not be supported. |
| 88 | * @retval, 0 on success, may fail if memory is still mapped |
| 89 | */ |
| 90 | __QAIC_REMOTE_EXPORT int __QAIC_REMOTE(remote_munmap64)(uint64_t vaddrout, int64_t size) __QAIC_REMOTE_ATTRIBUTE; |
| 91 | |
| 92 | #ifdef __cplusplus |
| 93 | } |
| 94 | #endif |
| 95 | |
| 96 | #endif // REMOTE64_H |