• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 
17 #pragma once
18 
19 #include <string>
20 #include <vector>
21 
22 #include "NeuralNetworksShim.h"
23 #include "ShimDevice.h"
24 
25 namespace android::neuralnetworks::shim {
26 
27 /**
28  * Information about an NNAPI Device to register.
29  */
30 struct ShimDeviceInfo {
31     /**
32      * Name of the target device, as returned by SL ANeuralNetworksDevice_getName
33      */
34     std::string deviceName;
35 
36     /**
37      * Name of HAL AIDL service backed by this SL NNAPI Driver device.
38      */
39     std::string serviceName;
40 };
41 
42 struct RegistrationParams {
43     NnApiSLDriverImpl* nnapiSupportLibraryPackage = nullptr;
44     std::vector<ShimDeviceInfo> deviceInfos;
45     uint32_t numberOfListenerThreads = 15;
46     bool registerAsLazyService = false;
47     bool fallbackToMinimumSupportDevice = false;
48 };
49 
50 ANeuralNetworksShimResultCode registerDevices(NnApiSLDriverImpl* nnapiSLImpl,
51                                               const std::vector<ShimDeviceInfo>& devicesToRegister,
52                                               uint32_t numberOfListenerThreads,
53                                               bool registerAsLazyService,
54                                               bool fallbackToMinimumSupportDevice);
55 
56 }  // namespace android::neuralnetworks::shim
57