1/* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.hidl.memory@1.0; 18 19interface IMemory { 20 21 /** 22 * Notify that you are about to use all of this memory. 23 */ 24 update(); 25 26 /** 27 * Notify that you are about to use the specific range. 28 * 29 * start + length must be < size 30 * 31 * @param start Offset from start of buffer about to be updated. 32 * @param length Number of bytes to be updated. 33 */ 34 updateRange(uint64_t start, uint64_t length); 35 36 /** 37 * Notify that you are about to start reading all of this memory. 38 */ 39 read(); 40 41 /** 42 * Notify that you are about to read the specific range. 43 * 44 * @param start Offset from start of buffer about to be read. 45 * @param length Number of bytes to be read. 46 */ 47 readRange(uint64_t start, uint64_t length); 48 49 /** 50 * Notify that you are done reading and/or writing this memory. 51 * 52 * Must commit all previous update's and updateAll's. 53 */ 54 commit(); 55 56 /** 57 * Must return the same value everytime it is called. Must be callable 58 * at any point in or outside of the update/commit process. 59 * 60 * @return ptr Actual pointer to underlying memory. 61 */ 62 getPointer() generates (pointer ptr); 63 64 /** 65 * @return size Size in bytes of underlying memory. 66 */ 67 getSize() generates (uint64_t size); 68 69};