1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 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. 14 */ 15 16 #ifndef AIE_IPC_H 17 #define AIE_IPC_H 18 19 #include "liteipc.h" 20 #include "protocol/struct_definition/aie_info_define.h" 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 /** 27 * Use ipc to transfer memory. 28 * 29 * Memory larger than IPC_MAX_TRANS_CAPACITY(200) would be transferred by shared memory, otherwise by ipc. 30 * 31 * @param [in] request Ipc handle. 32 * @param [in] dataInfo Data to transfer. 33 * @param [in] receiverUid receiver's uid. 34 */ 35 void ParcelDataInfo(IpcIo *request, const DataInfo *dataInfo, const uid_t receiverUid); 36 37 /** 38 * Use ipc to receive memory. 39 * Note: the returned dataInfo must release by {@link FreeDataInfo}. 40 * 41 * @param [in] request Ipc handle. 42 * @param [out] dataInfo Data received. 43 * @return Returns 0 if the operation is successful, returns a non-zero value otherwise. 44 */ 45 int UnParcelDataInfo(IpcIo *request, DataInfo *dataInfo); 46 47 /** 48 * Free dataInfo. 49 * 50 * @param [in] dataInfo data to be freed. 51 */ 52 void FreeDataInfo(DataInfo *dataInfo); 53 54 #ifdef __cplusplus 55 } 56 #endif 57 58 #endif // AIE_IPC_H 59