diff --git a/tv/cec/1.1/Android.bp b/tv/cec/1.1/Android.bp new file mode 100644 index 0000000000..c2d4e54407 --- /dev/null +++ b/tv/cec/1.1/Android.bp @@ -0,0 +1,16 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.tv.cec@1.1", + root: "android.hardware", + srcs: [ + "types.hal", + "IHdmiCec.hal", + "IHdmiCecCallback.hal", + ], + interfaces: [ + "android.hardware.tv.cec@1.0", + "android.hidl.base@1.0", + ], + gen_java: true, +} diff --git a/tv/cec/1.1/IHdmiCec.hal b/tv/cec/1.1/IHdmiCec.hal new file mode 100644 index 0000000000..fe7bedf195 --- /dev/null +++ b/tv/cec/1.1/IHdmiCec.hal @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2021 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. + */ + +package android.hardware.tv.cec@1.1; + +import @1.0::IHdmiCec; +import @1.0::Result; +import @1.0::SendMessageResult; + +import IHdmiCecCallback; + +/** + * HDMI-CEC HAL interface definition. + */ +interface IHdmiCec extends @1.0::IHdmiCec { + /** + * Passes the logical address that must be used in this system. + * + * HAL must use it to configure the hardware so that the CEC commands + * addressed the given logical address can be filtered in. This method must + * be able to be called as many times as necessary in order to support + * multiple logical devices. + * + * @param addr Logical address that must be used in this system. It must be + * in the range of valid logical addresses for the call to succeed. + * @return result Result status of the operation. SUCCESS if successful, + * FAILURE_INVALID_ARGS if the given logical address is invalid, + * FAILURE_BUSY if device or resource is busy + */ + addLogicalAddress_1_1(CecLogicalAddress addr) generates (Result result); + + /** + * Transmits HDMI-CEC message to other HDMI device. + * + * The method must be designed to return in a certain amount of time and not + * hanging forever which may happen if CEC signal line is pulled low for + * some reason. + * + * It must try retransmission at least once as specified in the section '7.1 + * Frame Re-transmissions' of the CEC Spec 1.4b. + * + * @param message CEC message to be sent to other HDMI device. + * @return result Result status of the operation. SUCCESS if successful, + * NACK if the sent message is not acknowledged, + * BUSY if the CEC bus is busy. + */ + sendMessage_1_1(CecMessage message) generates (SendMessageResult result); + + /** + * Sets a callback that HDMI-CEC HAL must later use for incoming CEC + * messages or internal HDMI events. + * + * @param callback Callback object to pass hdmi events to the system. The + * previously registered callback must be replaced with this one. + */ + setCallback_1_1(IHdmiCecCallback callback); +}; diff --git a/tv/cec/1.1/IHdmiCecCallback.hal b/tv/cec/1.1/IHdmiCecCallback.hal new file mode 100644 index 0000000000..3928f186cc --- /dev/null +++ b/tv/cec/1.1/IHdmiCecCallback.hal @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2021 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. + */ + +package android.hardware.tv.cec@1.1; + +import @1.0::IHdmiCecCallback; + +/** + * Callbacks from the HAL implementation to notify the system of new events. + */ +interface IHdmiCecCallback extends @1.0::IHdmiCecCallback { + /** + * The callback function that must be called by HAL implementation to notify + * the system of new CEC message arrival. + */ + oneway onCecMessage_1_1(CecMessage message); +}; diff --git a/tv/cec/1.1/types.hal b/tv/cec/1.1/types.hal new file mode 100644 index 0000000000..a117519ed0 --- /dev/null +++ b/tv/cec/1.1/types.hal @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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. + */ + +package android.hardware.tv.cec@1.1; + +import @1.0::CecLogicalAddress; +import @1.0::CecMessageType; + +enum CecLogicalAddress : @1.0::CecLogicalAddress { + BACKUP_1 = 12, + BACKUP_2 = 13, +}; + +enum CecMessageType : @1.0::CecMessageType { + GIVE_FEATURES = 0xA5, + REPORT_FEATURES = 0xA6, + REQUEST_CURRENT_LATENCY = 0xA7, + REPORT_CURRENT_LATENCY = 0xA8, +}; + +struct CecMessage { + /** logical address of the initiator */ + CecLogicalAddress initiator; + + /** logical address of destination */ + CecLogicalAddress destination; + + /** + * The maximum size of body is 15 (MaxLength::MESSAGE_BODY) as specified in + * the section 6 of the CEC Spec 1.4b. Overflowed data must be ignored. */ + vec body; +};