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