From fb0cc2241a4ab444f0e0ccc7171feaf8a150b69f Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 10 Nov 2022 17:25:27 -0800 Subject: [PATCH] Define ApPowerControl library. Define a library for the communication channel between TCU and application processor. This library will be implemented with device-specific logic. Test: local compile Bug: 254547153 Change-Id: I241ba141f9a5a4a3852017e291fbbc08cadf2bfe --- .../remoteaccess/test_grpc_server/README.md | 4 +++ .../test_grpc_server/impl/Android.bp | 1 + .../impl/src/TestWakeupClientServiceImpl.cpp | 5 +-- .../test_grpc_server/lib/Android.bp | 32 +++++++++++++++++++ .../test_grpc_server/lib/ApPowerControl.cpp | 23 +++++++++++++ .../test_grpc_server/lib/ApPowerControl.h | 28 ++++++++++++++++ 6 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 automotive/remoteaccess/test_grpc_server/lib/Android.bp create mode 100644 automotive/remoteaccess/test_grpc_server/lib/ApPowerControl.cpp create mode 100644 automotive/remoteaccess/test_grpc_server/lib/ApPowerControl.h diff --git a/automotive/remoteaccess/test_grpc_server/README.md b/automotive/remoteaccess/test_grpc_server/README.md index 28035de1d6..6bc1829388 100644 --- a/automotive/remoteaccess/test_grpc_server/README.md +++ b/automotive/remoteaccess/test_grpc_server/README.md @@ -79,6 +79,8 @@ following behavior: * `make -j TestWakeupClientServer` +* `make -j ApPowerControlLib` + ## How to push the test wakeup client to a TCU which runs Android. * Make the target device writable: @@ -97,6 +99,8 @@ following behavior: * `adb push vendor/bin/TestWakeupClientServer /vendor/bin` +* `adb push vendor/lib/ApPowerControlLib.so /vendor/lib` + * `adb shell` * `su` diff --git a/automotive/remoteaccess/test_grpc_server/impl/Android.bp b/automotive/remoteaccess/test_grpc_server/impl/Android.bp index e978c8caa4..152b528490 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/Android.bp +++ b/automotive/remoteaccess/test_grpc_server/impl/Android.bp @@ -31,6 +31,7 @@ cc_binary { "libutils", "libgrpc++", "libprotobuf-cpp-full", + "//hardware/interfaces/automotive/remoteaccess/test_grpc_server/lib:ApPowerControlLib", ], whole_static_libs: [ "wakeup_client_protos", diff --git a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp index 795265fb64..7dcd31e3b4 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp +++ b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp @@ -16,6 +16,8 @@ #include "TestWakeupClientServiceImpl.h" +#include "ApPowerControl.h" + #include #include #include @@ -245,8 +247,7 @@ Status TestWakeupClientServiceImpl::NotifyWakeupRequired(ServerContext* context, } void TestWakeupClientServiceImpl::wakeupApplicationProcessor() { - printf("Waking up application processor...\n"); - // TODO(b/254547153): Send can bus message using socket CAN once we know what the message is. + wakeupAp(); } } // namespace remoteaccess diff --git a/automotive/remoteaccess/test_grpc_server/lib/Android.bp b/automotive/remoteaccess/test_grpc_server/lib/Android.bp new file mode 100644 index 0000000000..7e95f53dfe --- /dev/null +++ b/automotive/remoteaccess/test_grpc_server/lib/Android.bp @@ -0,0 +1,32 @@ +// Copyright (C) 2022 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +soong_namespace {} + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_library_shared { + name: "ApPowerControlLib", + vendor: true, + srcs: ["*.cpp"], + local_include_dirs: ["."], + export_include_dirs: ["."], +} diff --git a/automotive/remoteaccess/test_grpc_server/lib/ApPowerControl.cpp b/automotive/remoteaccess/test_grpc_server/lib/ApPowerControl.cpp new file mode 100644 index 0000000000..862fed1a5a --- /dev/null +++ b/automotive/remoteaccess/test_grpc_server/lib/ApPowerControl.cpp @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ApPowerControl.h" + +#include + +void wakeupAp() { + printf("Waking up application processor...\n"); +} diff --git a/automotive/remoteaccess/test_grpc_server/lib/ApPowerControl.h b/automotive/remoteaccess/test_grpc_server/lib/ApPowerControl.h new file mode 100644 index 0000000000..95605764ed --- /dev/null +++ b/automotive/remoteaccess/test_grpc_server/lib/ApPowerControl.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +// Wakeup application processor if not already waken up. +void wakeupAp(); + +#ifdef __cplusplus +} +#endif