blob: 823f0c75bbd12fc33a5718d47300b128f3ea7477 [file] [log] [blame]
telsoa015307bc12018-03-09 13:51:08 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
David Beck93e48982018-09-05 13:05:09 +01003// SPDX-License-Identifier: MIT
telsoa015307bc12018-03-09 13:51:08 +00004//
5
6#define LOG_TAG "ArmnnDriver"
7
8#include "ArmnnDriver.hpp"
9
10#include <hidl/LegacySupport.h>
11#include <log/log.h>
12
13#include <string>
telsoa015307bc12018-03-09 13:51:08 +000014
15using namespace armnn_driver;
16using namespace std;
17
18int main(int argc, char** argv)
19{
surmeh0149b9e102018-05-17 14:11:25 +010020 android::sp<ArmnnDriver> driver;
Kevin Mayabc95d02020-05-15 15:34:03 +010021 DriverOptions driverOptions(argc, argv);
surmeh0149b9e102018-05-17 14:11:25 +010022 try
23 {
24 driver = new ArmnnDriver(DriverOptions(argc, argv));
25 }
26 catch (const std::exception& e)
27 {
28 ALOGE("Could not create driver: %s", e.what());
29 return EXIT_FAILURE;
30 }
telsoa015307bc12018-03-09 13:51:08 +000031
32 android::hardware::configureRpcThreadpool(1, true);
surmeh0149b9e102018-05-17 14:11:25 +010033 android::status_t status = android::UNKNOWN_ERROR;
34 try
35 {
Kevin Mayabc95d02020-05-15 15:34:03 +010036 status = driver->registerAsService(driverOptions.GetServiceName());
surmeh0149b9e102018-05-17 14:11:25 +010037 }
38 catch (const std::exception& e)
39 {
40 ALOGE("Could not register service: %s", e.what());
41 return EXIT_FAILURE;
42 }
43 if (status != android::OK)
telsoa015307bc12018-03-09 13:51:08 +000044 {
45 ALOGE("Could not register service");
surmeh0149b9e102018-05-17 14:11:25 +010046 return EXIT_FAILURE;
telsoa015307bc12018-03-09 13:51:08 +000047 }
surmeh0149b9e102018-05-17 14:11:25 +010048
telsoa015307bc12018-03-09 13:51:08 +000049 android::hardware::joinRpcThreadpool();
50 ALOGE("Service exited!");
surmeh0149b9e102018-05-17 14:11:25 +010051 return EXIT_FAILURE;
telsoa015307bc12018-03-09 13:51:08 +000052}