telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | 93e4898 | 2018-09-05 13:05:09 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 4 | // |
| 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> |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 14 | |
| 15 | using namespace armnn_driver; |
| 16 | using namespace std; |
| 17 | |
| 18 | int main(int argc, char** argv) |
| 19 | { |
surmeh01 | 49b9e10 | 2018-05-17 14:11:25 +0100 | [diff] [blame] | 20 | android::sp<ArmnnDriver> driver; |
Kevin May | abc95d0 | 2020-05-15 15:34:03 +0100 | [diff] [blame] | 21 | DriverOptions driverOptions(argc, argv); |
surmeh01 | 49b9e10 | 2018-05-17 14:11:25 +0100 | [diff] [blame] | 22 | 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 | } |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 31 | |
| 32 | android::hardware::configureRpcThreadpool(1, true); |
surmeh01 | 49b9e10 | 2018-05-17 14:11:25 +0100 | [diff] [blame] | 33 | android::status_t status = android::UNKNOWN_ERROR; |
| 34 | try |
| 35 | { |
Kevin May | abc95d0 | 2020-05-15 15:34:03 +0100 | [diff] [blame] | 36 | status = driver->registerAsService(driverOptions.GetServiceName()); |
surmeh01 | 49b9e10 | 2018-05-17 14:11:25 +0100 | [diff] [blame] | 37 | } |
| 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) |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 44 | { |
| 45 | ALOGE("Could not register service"); |
surmeh01 | 49b9e10 | 2018-05-17 14:11:25 +0100 | [diff] [blame] | 46 | return EXIT_FAILURE; |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 47 | } |
surmeh01 | 49b9e10 | 2018-05-17 14:11:25 +0100 | [diff] [blame] | 48 | |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 49 | android::hardware::joinRpcThreadpool(); |
| 50 | ALOGE("Service exited!"); |
surmeh01 | 49b9e10 | 2018-05-17 14:11:25 +0100 | [diff] [blame] | 51 | return EXIT_FAILURE; |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 52 | } |