• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.allocator@1.0;
18
19/**
20 * Interface which allocates the required memory.
21 */
22interface IAllocator {
23
24    /**
25     * Return memory must have instance name corresponding to this type of memory.
26     *
27     * @param size Size of memory to allocate in bytes.
28     * @return success Whether allocation succeeded.
29     * @return memory Unmapped memory object.
30     */
31    allocate(uint64_t size) generates (bool success, memory mem);
32
33    /**
34     * Return memory must have instance name corresponding to this type of memory.
35     *
36     * @param size Size of memory to allocate in bytes.
37     * @param count Number of memory instances to allocate.
38     * @return success Whether allocation succeeded (returns false if any allocation failed).
39     * @return batch Unmapped memory objects.
40     */
41    batchAllocate(uint64_t size, uint64_t count) generates (bool success, vec<memory> batch);
42};