telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // See LICENSE file in the project root for full license information. |
| 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; |
| 21 | try |
| 22 | { |
| 23 | driver = new ArmnnDriver(DriverOptions(argc, argv)); |
| 24 | } |
| 25 | catch (const std::exception& e) |
| 26 | { |
| 27 | ALOGE("Could not create driver: %s", e.what()); |
| 28 | return EXIT_FAILURE; |
| 29 | } |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 30 | |
| 31 | android::hardware::configureRpcThreadpool(1, true); |
surmeh01 | 49b9e10 | 2018-05-17 14:11:25 +0100 | [diff] [blame] | 32 | android::status_t status = android::UNKNOWN_ERROR; |
| 33 | try |
| 34 | { |
| 35 | status = driver->registerAsService("armnn"); |
| 36 | } |
| 37 | catch (const std::exception& e) |
| 38 | { |
| 39 | ALOGE("Could not register service: %s", e.what()); |
| 40 | return EXIT_FAILURE; |
| 41 | } |
| 42 | if (status != android::OK) |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 43 | { |
| 44 | ALOGE("Could not register service"); |
surmeh01 | 49b9e10 | 2018-05-17 14:11:25 +0100 | [diff] [blame] | 45 | return EXIT_FAILURE; |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 46 | } |
surmeh01 | 49b9e10 | 2018-05-17 14:11:25 +0100 | [diff] [blame] | 47 | |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 48 | android::hardware::joinRpcThreadpool(); |
| 49 | ALOGE("Service exited!"); |
surmeh01 | 49b9e10 | 2018-05-17 14:11:25 +0100 | [diff] [blame] | 50 | return EXIT_FAILURE; |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 51 | } |