From 49763267754798093a43e88acc8b822da5b40697 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 9 May 2024 13:55:20 -0400 Subject: [PATCH 01/48] RDK-40543 - L2 HDMICEC SOURCE TESTS --- docs/pages/hdmi_cec_source_tests.md | 162 ++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 docs/pages/hdmi_cec_source_tests.md diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_tests.md new file mode 100644 index 0000000..f4288fc --- /dev/null +++ b/docs/pages/hdmi_cec_source_tests.md @@ -0,0 +1,162 @@ +# HDMI CEC Test Document + +## Version History + +| Date(DD/MM/YY) | Comment | Version | +| -------------- | ------- | ------- | +| 13/02/24 | First Release | 1.0.0 | + +## Table of Contents + +- [Acronyms, Terms and Abbreviations](#acronyms-terms-and-abbreviations) +- [Overview](#overview) +- [HDMI-CEC RDK HAL Functionality](#hdmi-cec-rdk-hal-functionality) + +## Acronyms, Terms and Abbreviations + +- `CEC` - Consumer Electronics Control +- `HAL` - Hardware Abstraction layer +- `HDMI` - High Definition Multimedia Interface +- `L2` - Level 2 Testing () +- `L3` - Level 3 Testing () + +## Scope + +This document defines the requirements for testing the HDMI CEC device from a level 2/3 based on being a source device. + +## Overview + +Consumer Electronics Control (CEC) is a single-wire bidirectional bus within an HDMI system, facilitating communication among interconnected products. HDMI-CEC establishes a protocol enabling high-level control functions between audiovisual devices linked via an HDMI network, facilitating communication and control among them. Communication can occur in either Direct messaging mode or Broadcast mode. Below is a diagram illustrating a basic network setup: + +## HDMI-CEC RDK HAL Functionality + +The HAL layers within RDK serve as a bridge between the underlying low-level SoC drivers and the higher-level RDK layers that utilize the functionality offered by these HAL functions. Specifically concerning the CEC Module, the HAL layers facilitate the following functionalities: + +## Test scenarios + +The HAL CEC layer facilitates the transmission and reception of CEC information on the CEC bus. It does not handle any specific opcode commands, nor does it validate supported HAL CEC opcodes for sending or receiving. + +It is the responsibility of the caller to manage the opcodes. The current test cases will verify responses from connected devices for a subset of opcodes as part of the testing process. + +|S.No.|Test Functionality|Description| +|-----|------------------|-----------| +| 1| [Physical Address](#physical-address)| Retrieving the physical address | +| 2| [CEC Transmission](#cec-transmission)| Transmitting CEC frames and acknowledging them | +| 3| [CEC Async Transmission](#cec-async-transmission) | Asynchronously transmitting CEC frames without requiring acknowledgment | +| 4| [CEC Receive functionality](#cec-receive-functionality)| Receiving CEC information from other devices and communicating it to the above layers through registered callback functions | +| 5| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Managing CEC during Hotplug and HotUnplug events | + +----------- + +## Physical Address + +|S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| +|-----|------------------|-----------|--------|--|--|--------------------------| +| 1| [Physical Address](#physical-address)| Verify the valid physical address allocated through the HAL function.|HdmiCecGetPhysicalAddress| Y |NA|| +| | | Verify the physical addresses allocated by connecting a source and sink device through an HDMI switch.|NA | NA | Y | Enable the television connected to my Tele first so that it can declare its physical address first. | + +### Emulator Requirements - Physical Address + +- Boot control configuration to setup the cec network nodes + - A source and sink devices are connected to the network + +### Control Plane Requirements - Physical Address + +- Control plane will allow removing or adding a node to the network. + - allowing add node sink node + - allowing add node source node + +## CEC Transmission + +|S.No.|Test Functionality|Description|L2|L3|Control plane requirements| +|-----|------------------|-----------|--|--|--------------------------| +| 2| [CEC Transmission](#cec-transmission)| Verify the correct transmission of all the supported CEC commands (as per 1.4b HDMI CEC spec) to the connected device and ensure it is acknowledged properly. | NA | Y || +| | | Broadcast all the supported CEC Commands ((as per 1.4b HDMI CEC spec)) to all the devices connected on the network and receive the response.| NA | Y || +| | | Transmit all the CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitor the behavior of the connected device accordingly. | NA | Y | Control panel to monitor the behaviour of the connected devices. | + +### Emulator Requirements - CEC Transmission + +- Boot configuration + - Min case scenario multiple network nodes + - Max case scenario multiple cec nodes + +### Control Plane Requirements - CEC Transmission + +- Control plane will allow putting nodes into standby mode, this will cause a CEC message on the network + +## CEC Async Transmission + +|S.No.|Test Functionality|Description|L2|L3|Control plane requirements| +|-----|------------------|-----------|--|--|--------------------------| + 3| [CEC Async Transmission](#cec-async-transmission) | Verify the correct transmission of all the CEC commands (as per 1.4b HDMI CEC spec) using the Async Transmission support of the CEC HAL interface. || NA | Y || +| | | Verify the correct behavior of the connected device when the CEC standby command is sent to it.|| NA | Y | Control panel to monitor the behaviour of the connected devices. | +||| Broadcast all the CEC Commands ((as per 1.4b HDMI CEC spec)) to all the devices connected in the network and check the behaviour and response. || NA | Y | Control panel to monitor the behaviour of the connected devices. | + +### Emulator Requirements - CEC Async Transmission + + +### Control Plane Requirements - CEC Async Transmission + + +## CEC Receive functionality + +|S.No.|Test Functionality|Description|L2|L3|Control plane requirements| +|-----|------------------|-----------|--|--|--------------------------| +| 4| [CEC Receive functionality](#cec-receive-functionality)| Transmit a CEC Command that expects a response (Eg. GetCECVersion) to a connected device and see the response is received correctly. | NA |Y| | +| | | Transmit all the CEC Broadcast Command (as per 1.4b HDMI CEC spec) which expects a response from all the connected devices like `` | NA | Y || +| | | Transmit Different CEC commands from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (my TV here)| NA | Y | Control panel to control the third-party devices to Transmit the required commands to my Device (Device under test) | + +### Emulator Requirements - CEC Receive functionality + +### Control Plane Requirements - CEC Receive functionality + +## CEC HotPlug Functionality + +|S.No.|Test Functionality|Description|L2|L3|Control plane requirements| +|-----|------------------|-----------|--|--|--------------------------| +| 5| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Generate an Hotplug event by disconnecting the device connected to the HDMI port of the source Platform. Check whether the CEC Transmission works when HDMI port is disconnected. | NA | Y | Control Panel to control the Hotplug activities | +| | | Verify the behaviour when a device has been removed from the network which is not directly connected to the TV device. Send a CEC Async Tx command using HAL Interface and check the behaviour. The Tx Command should not fail. | NA | Y | Control Panel to control the devices connected on the CEC Network.| +| | | Check the behaviour when a device has been remove from the network which is not directly connected to the TV device. Send a CEC Tx command with acknowledgement using HAL Interface and check the behaviour. The Tx command should fail in this state. | NA | Y | Control Panel to control the external devices connected.| + +### Emulator Requirements - CEC HotPlug Functionality + +### Control Plane Requirements - CEC HotPlug Functionality + +----------- +----------- + +## Hardware Verification Testing Requirements + +|S.No.|Test Functionality|Description|L2|L3|Control plane requirements| +|-----|------------------|-----------|--|--|--------------------------| +| 6| Introduce fault in the CEC Bus | Absorve the behaviour when the CEC line is pulled high during the CEC Transmission.| NA | Y |Fault Introduction| +| 7| Overloading the CEC bus. | Overload the CEC bus with too many messages (by connecting more devices in the network) and observe the behaviour| NA | Y |Fault Introduction| + +### Emulator Requirements + +### Control Plane Requirements + +----------- +----------- + +## Boot configuration + +### Module Configuration Requirements + +The module must be configured during the boot sequence in the case of emulation, as if it was a real hardware device with or without multiple connected HDMI nodes. + +### Test Configuration for source Devices + +The following information shall be helpful for further running the Automation Rack Test for this specific module and further the configuration will help for the Design and Development of Virtual Device. + +Configurations: + +```yaml + Device: + Type: Source / Sink + Platform_Manufacturer: sony/samsung etc. + Platform_Model: xyz + Port: 3, 4 + HDMI Node: 1-3 etc. + CEC_Ports: 1, x, y +``` \ No newline at end of file From 66409389ab616c00a32cc589e1c722f646316e06 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Wed, 15 May 2024 09:40:54 -0400 Subject: [PATCH 02/48] Remove Async --- docs/pages/hdmi_cec_source_tests.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_tests.md index f4288fc..7d9462f 100644 --- a/docs/pages/hdmi_cec_source_tests.md +++ b/docs/pages/hdmi_cec_source_tests.md @@ -84,20 +84,6 @@ It is the responsibility of the caller to manage the opcodes. The current test c - Control plane will allow putting nodes into standby mode, this will cause a CEC message on the network -## CEC Async Transmission - -|S.No.|Test Functionality|Description|L2|L3|Control plane requirements| -|-----|------------------|-----------|--|--|--------------------------| - 3| [CEC Async Transmission](#cec-async-transmission) | Verify the correct transmission of all the CEC commands (as per 1.4b HDMI CEC spec) using the Async Transmission support of the CEC HAL interface. || NA | Y || -| | | Verify the correct behavior of the connected device when the CEC standby command is sent to it.|| NA | Y | Control panel to monitor the behaviour of the connected devices. | -||| Broadcast all the CEC Commands ((as per 1.4b HDMI CEC spec)) to all the devices connected in the network and check the behaviour and response. || NA | Y | Control panel to monitor the behaviour of the connected devices. | - -### Emulator Requirements - CEC Async Transmission - - -### Control Plane Requirements - CEC Async Transmission - - ## CEC Receive functionality |S.No.|Test Functionality|Description|L2|L3|Control plane requirements| From 64941ee396ff8ba4e5b64031b99e92d72fd0dedb Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Wed, 15 May 2024 09:50:47 -0400 Subject: [PATCH 03/48] Remove async update --- docs/pages/hdmi_cec_source_tests.md | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_tests.md index 7d9462f..28a20e4 100644 --- a/docs/pages/hdmi_cec_source_tests.md +++ b/docs/pages/hdmi_cec_source_tests.md @@ -41,10 +41,9 @@ It is the responsibility of the caller to manage the opcodes. The current test c |S.No.|Test Functionality|Description| |-----|------------------|-----------| | 1| [Physical Address](#physical-address)| Retrieving the physical address | -| 2| [CEC Transmission](#cec-transmission)| Transmitting CEC frames and acknowledging them | -| 3| [CEC Async Transmission](#cec-async-transmission) | Asynchronously transmitting CEC frames without requiring acknowledgment | -| 4| [CEC Receive functionality](#cec-receive-functionality)| Receiving CEC information from other devices and communicating it to the above layers through registered callback functions | -| 5| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Managing CEC during Hotplug and HotUnplug events | +| 2| [CEC Synchronous Transmission](#cec-synchronous-transmission)| Transmitting CEC frames and acknowledging them | +| 3| [CEC Receive functionality](#cec-receive-functionality)| Receiving CEC information from other devices and communicating it to the above layers through registered callback functions | +| 4| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Managing CEC during Hotplug and HotUnplug events | ----------- @@ -66,23 +65,22 @@ It is the responsibility of the caller to manage the opcodes. The current test c - allowing add node sink node - allowing add node source node -## CEC Transmission +## CEC Synchronous Transmission -|S.No.|Test Functionality|Description|L2|L3|Control plane requirements| -|-----|------------------|-----------|--|--|--------------------------| -| 2| [CEC Transmission](#cec-transmission)| Verify the correct transmission of all the supported CEC commands (as per 1.4b HDMI CEC spec) to the connected device and ensure it is acknowledged properly. | NA | Y || -| | | Broadcast all the supported CEC Commands ((as per 1.4b HDMI CEC spec)) to all the devices connected on the network and receive the response.| NA | Y || -| | | Transmit all the CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitor the behavior of the connected device accordingly. | NA | Y | Control panel to monitor the behaviour of the connected devices. | +|S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| +|-----|------------------|-----------|--------|--|--|--------------------------| +| 3| [CEC Transmission](#cec-transmission)| Verify the correct transmission of the supported CEC commands (as per 1.4b HDMI CEC spec) to the connected device and ensure it is acknowledged properly.| HdmiCecTx | NA | Y || +| | | Broadcast a supported CEC Command to all the devices connected to the network without any error |HdmiCecTx| NA | Y || +| | | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitor the behaviour of the connected device accordingly.| HdmiCecTx | NA | Y | Control panel to monitor the behavior of the connected devices. | +| | | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for a logical address that doesn't exist.| HdmiCecTx | Y | NA | | ### Emulator Requirements - CEC Transmission - - Boot configuration - Min case scenario multiple network nodes - Max case scenario multiple cec nodes ### Control Plane Requirements - CEC Transmission - -- Control plane will allow putting nodes into standby mode, this will cause a CEC message on the network +- The control plane will allow putting nodes into standby mode, this will cause a CEC message on the network ## CEC Receive functionality @@ -101,7 +99,7 @@ It is the responsibility of the caller to manage the opcodes. The current test c |S.No.|Test Functionality|Description|L2|L3|Control plane requirements| |-----|------------------|-----------|--|--|--------------------------| | 5| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Generate an Hotplug event by disconnecting the device connected to the HDMI port of the source Platform. Check whether the CEC Transmission works when HDMI port is disconnected. | NA | Y | Control Panel to control the Hotplug activities | -| | | Verify the behaviour when a device has been removed from the network which is not directly connected to the TV device. Send a CEC Async Tx command using HAL Interface and check the behaviour. The Tx Command should not fail. | NA | Y | Control Panel to control the devices connected on the CEC Network.| +| | | Check the behaviour when a device has been remove from the network which is not directly connected to the TV device. Send a CEC Tx command with acknowledgement using HAL Interface and check the behaviour. The Tx command should fail in this state.| HdmiCecTx | NA | Y | Control Panel to control the external devices connected.| | | | Check the behaviour when a device has been remove from the network which is not directly connected to the TV device. Send a CEC Tx command with acknowledgement using HAL Interface and check the behaviour. The Tx command should fail in this state. | NA | Y | Control Panel to control the external devices connected.| ### Emulator Requirements - CEC HotPlug Functionality From 8b352e1cc67b876c4f28e3e74af3c0cca18978c2 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Wed, 15 May 2024 09:52:46 -0400 Subject: [PATCH 04/48] Overview -update --- docs/pages/hdmi_cec_source_tests.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_tests.md index 28a20e4..2bd365b 100644 --- a/docs/pages/hdmi_cec_source_tests.md +++ b/docs/pages/hdmi_cec_source_tests.md @@ -26,7 +26,7 @@ This document defines the requirements for testing the HDMI CEC device from a le ## Overview -Consumer Electronics Control (CEC) is a single-wire bidirectional bus within an HDMI system, facilitating communication among interconnected products. HDMI-CEC establishes a protocol enabling high-level control functions between audiovisual devices linked via an HDMI network, facilitating communication and control among them. Communication can occur in either Direct messaging mode or Broadcast mode. Below is a diagram illustrating a basic network setup: +Consumer Electronics Control (CEC) is a single-wire bidirectional bus within an HDMI system, facilitating communication among interconnected products. HDMI-CEC establishes a protocol enabling high-level control functions between audiovisual devices linked via an HDMI network, facilitating communication and control among them. Communication can occur in either Direct messaging mode or Broadcast mode. ## HDMI-CEC RDK HAL Functionality From 6bc904c5001b98191a4c14e7a350e647a2a10720 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Wed, 15 May 2024 12:30:26 -0400 Subject: [PATCH 05/48] Addressing review comments --- docs/pages/hdmi_cec_source_tests.md | 44 ++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_tests.md index 2bd365b..ef2e4fe 100644 --- a/docs/pages/hdmi_cec_source_tests.md +++ b/docs/pages/hdmi_cec_source_tests.md @@ -19,6 +19,8 @@ - `HDMI` - High Definition Multimedia Interface - `L2` - Level 2 Testing () - `L3` - Level 3 Testing () +- `Sink device` - Any piece of equipment or technology that provides an input signal or data to another device or system. +- `Source Device` - Any piece of equipment or technology that receives an input signal or data from another device or system. ## Scope @@ -32,6 +34,10 @@ Consumer Electronics Control (CEC) is a single-wire bidirectional bus within an The HAL layers within RDK serve as a bridge between the underlying low-level SoC drivers and the higher-level RDK layers that utilize the functionality offered by these HAL functions. Specifically concerning the CEC Module, the HAL layers facilitate the following functionalities: +- Get Logical address +- Get Physical address +- Syncronous transmission, and communicating via hotplug connectivity + ## Test scenarios The HAL CEC layer facilitates the transmission and reception of CEC information on the CEC bus. It does not handle any specific opcode commands, nor does it validate supported HAL CEC opcodes for sending or receiving. @@ -40,13 +46,33 @@ It is the responsibility of the caller to manage the opcodes. The current test c |S.No.|Test Functionality|Description| |-----|------------------|-----------| -| 1| [Physical Address](#physical-address)| Retrieving the physical address | -| 2| [CEC Synchronous Transmission](#cec-synchronous-transmission)| Transmitting CEC frames and acknowledging them | -| 3| [CEC Receive functionality](#cec-receive-functionality)| Receiving CEC information from other devices and communicating it to the above layers through registered callback functions | -| 4| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Managing CEC during Hotplug and HotUnplug events | +| 1 |[Logical address](#logical-address-discovery)|Facilitating the Discovery of logical addresses getting, and removing the logical address of the device (for sink devices) | +| 2| [Physical Address](#physical-address)| Retrieving the physical address | +| 3| [CEC Synchronous Transmission](#cec-synchronous-transmission)| Transmitting CEC frames and acknowledging them | +| 4| [CEC Receive functionality](#cec-receive-functionality)| Receiving CEC information from other devices and communicating it to the above layers through registered callback functions | +| 5| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Managing CEC during Hotplug and HotUnplug events | ----------- +## Logical Address Discovery + +|S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| +|-----|------------------|-----------|--------|--|--|--------------------------| +| 1 |[Logical address](#logical-address-discovery)|Get the logical address of the `DUT`. This will add the logical address, as per source functionality. |HdmiCecGetLogicalAddress|Y|NA + +### Emulator Requirements + +- Boot with control configuration with various configurations having a predefined set of nodes: + - configuration to support the discovery of logical addresses. The caller provides the logical address, and HAL checks the availability of this address and feedback the same to the caller. + - Verify for the valid logical address and return the appropriate error code based on the logical address availability. + +### Control Plane Requirements + +- The control plane will allow removing or adding a node to the network. + - allowing adding/removing node sink node logical address 0 + - allowing adding/removing source node + - Support the CEC commands from the external devices on L3 Test Cases. + ## Physical Address |S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| @@ -62,8 +88,8 @@ It is the responsibility of the caller to manage the opcodes. The current test c ### Control Plane Requirements - Physical Address - Control plane will allow removing or adding a node to the network. - - allowing add node sink node - - allowing add node source node + - allowing adding/removing node sink node + - allowing adding/removing node source node ## CEC Synchronous Transmission @@ -77,7 +103,7 @@ It is the responsibility of the caller to manage the opcodes. The current test c ### Emulator Requirements - CEC Transmission - Boot configuration - Min case scenario multiple network nodes - - Max case scenario multiple cec nodes + - Max case scenario multiple network nodes ### Control Plane Requirements - CEC Transmission - The control plane will allow putting nodes into standby mode, this will cause a CEC message on the network @@ -94,6 +120,8 @@ It is the responsibility of the caller to manage the opcodes. The current test c ### Control Plane Requirements - CEC Receive functionality +- The control panel to handle and facilitate communicate with third party devices to receive and send commands. + ## CEC HotPlug Functionality |S.No.|Test Functionality|Description|L2|L3|Control plane requirements| @@ -106,6 +134,8 @@ It is the responsibility of the caller to manage the opcodes. The current test c ### Control Plane Requirements - CEC HotPlug Functionality +- The control panel to handle and facilitate communicate with third party devices to receive and send commands. + ----------- ----------- From de10d63496782da3e6047887f2351092ec5771a8 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Wed, 15 May 2024 12:33:50 -0400 Subject: [PATCH 06/48] Minor Asthetics --- docs/pages/hdmi_cec_source_tests.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_tests.md index ef2e4fe..d2c2b23 100644 --- a/docs/pages/hdmi_cec_source_tests.md +++ b/docs/pages/hdmi_cec_source_tests.md @@ -73,25 +73,25 @@ It is the responsibility of the caller to manage the opcodes. The current test c - allowing adding/removing source node - Support the CEC commands from the external devices on L3 Test Cases. -## Physical Address +### Physical Address |S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| |-----|------------------|-----------|--------|--|--|--------------------------| | 1| [Physical Address](#physical-address)| Verify the valid physical address allocated through the HAL function.|HdmiCecGetPhysicalAddress| Y |NA|| | | | Verify the physical addresses allocated by connecting a source and sink device through an HDMI switch.|NA | NA | Y | Enable the television connected to my Tele first so that it can declare its physical address first. | -### Emulator Requirements - Physical Address +#### Emulator Requirements - Physical Address - Boot control configuration to setup the cec network nodes - A source and sink devices are connected to the network -### Control Plane Requirements - Physical Address +#### Control Plane Requirements - Physical Address - Control plane will allow removing or adding a node to the network. - allowing adding/removing node sink node - allowing adding/removing node source node -## CEC Synchronous Transmission +### CEC Synchronous Transmission |S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| |-----|------------------|-----------|--------|--|--|--------------------------| @@ -100,15 +100,15 @@ It is the responsibility of the caller to manage the opcodes. The current test c | | | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitor the behaviour of the connected device accordingly.| HdmiCecTx | NA | Y | Control panel to monitor the behavior of the connected devices. | | | | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for a logical address that doesn't exist.| HdmiCecTx | Y | NA | | -### Emulator Requirements - CEC Transmission +#### Emulator Requirements - CEC Transmission - Boot configuration - Min case scenario multiple network nodes - Max case scenario multiple network nodes -### Control Plane Requirements - CEC Transmission +#### Control Plane Requirements - CEC Transmission - The control plane will allow putting nodes into standby mode, this will cause a CEC message on the network -## CEC Receive functionality +### CEC Receive functionality |S.No.|Test Functionality|Description|L2|L3|Control plane requirements| |-----|------------------|-----------|--|--|--------------------------| @@ -116,13 +116,13 @@ It is the responsibility of the caller to manage the opcodes. The current test c | | | Transmit all the CEC Broadcast Command (as per 1.4b HDMI CEC spec) which expects a response from all the connected devices like `` | NA | Y || | | | Transmit Different CEC commands from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (my TV here)| NA | Y | Control panel to control the third-party devices to Transmit the required commands to my Device (Device under test) | -### Emulator Requirements - CEC Receive functionality +#### Emulator Requirements - CEC Receive functionality -### Control Plane Requirements - CEC Receive functionality +#### Control Plane Requirements - CEC Receive functionality - The control panel to handle and facilitate communicate with third party devices to receive and send commands. -## CEC HotPlug Functionality +### CEC HotPlug Functionality |S.No.|Test Functionality|Description|L2|L3|Control plane requirements| |-----|------------------|-----------|--|--|--------------------------| @@ -130,9 +130,9 @@ It is the responsibility of the caller to manage the opcodes. The current test c | | | Check the behaviour when a device has been remove from the network which is not directly connected to the TV device. Send a CEC Tx command with acknowledgement using HAL Interface and check the behaviour. The Tx command should fail in this state.| HdmiCecTx | NA | Y | Control Panel to control the external devices connected.| | | | Check the behaviour when a device has been remove from the network which is not directly connected to the TV device. Send a CEC Tx command with acknowledgement using HAL Interface and check the behaviour. The Tx command should fail in this state. | NA | Y | Control Panel to control the external devices connected.| -### Emulator Requirements - CEC HotPlug Functionality +#### Emulator Requirements - CEC HotPlug Functionality -### Control Plane Requirements - CEC HotPlug Functionality +#### Control Plane Requirements - CEC HotPlug Functionality - The control panel to handle and facilitate communicate with third party devices to receive and send commands. From 8b8c6ce98181a75c9fef1f452d9868edb984f870 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Mon, 20 May 2024 13:20:12 -0400 Subject: [PATCH 07/48] Source L2 update --- docs/pages/hdmi_cec_source_tests.md | 102 ++++++++++++++-------------- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_tests.md index d2c2b23..1e54099 100644 --- a/docs/pages/hdmi_cec_source_tests.md +++ b/docs/pages/hdmi_cec_source_tests.md @@ -73,102 +73,104 @@ It is the responsibility of the caller to manage the opcodes. The current test c - allowing adding/removing source node - Support the CEC commands from the external devices on L3 Test Cases. -### Physical Address +## Physical Address |S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| |-----|------------------|-----------|--------|--|--|--------------------------| -| 1| [Physical Address](#physical-address)| Verify the valid physical address allocated through the HAL function.|HdmiCecGetPhysicalAddress| Y |NA|| -| | | Verify the physical addresses allocated by connecting a source and sink device through an HDMI switch.|NA | NA | Y | Enable the television connected to my Tele first so that it can declare its physical address first. | +| 2| [Physical Address](#physical-address)| Verify the valid physical address allocated through the HAL function.|HdmiCecGetPhysicalAddress| Y |NA|| +| | | Verify the physical addresses allocated by connecting two sink devices through an HDMI switch.| HdmiCecGetPhysicalAddress| NA | Y | Enable the television connected to `DUT` to declare its physical address first before `DUT`.| -#### Emulator Requirements - Physical Address +### Emulator Requirements - Physical Address -- Boot control configuration to setup the cec network nodes - - A source and sink devices are connected to the network +- Boot control configuration to setup the CEC network nodes +- Scenario to have two sink devices on the network -#### Control Plane Requirements - Physical Address +### Control Plane Requirements - Physical Address -- Control plane will allow removing or adding a node to the network. - - allowing adding/removing node sink node - - allowing adding/removing node source node +- The control plane will allow removing or adding a node to the network. + - allowing add sink node before the `DUT` switched ON. -### CEC Synchronous Transmission +## CEC Synchronous Transmission |S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| |-----|------------------|-----------|--------|--|--|--------------------------| -| 3| [CEC Transmission](#cec-transmission)| Verify the correct transmission of the supported CEC commands (as per 1.4b HDMI CEC spec) to the connected device and ensure it is acknowledged properly.| HdmiCecTx | NA | Y || -| | | Broadcast a supported CEC Command to all the devices connected to the network without any error |HdmiCecTx| NA | Y || -| | | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitor the behaviour of the connected device accordingly.| HdmiCecTx | NA | Y | Control panel to monitor the behavior of the connected devices. | -| | | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for a logical address that doesn't exist.| HdmiCecTx | Y | NA | | +| 3| [CEC Transmission](#cec-transmission)| Verify the correct transmission of the supported CEC commands (as per 1.4b HDMI CEC spec) to the connected device and ensure it is acknowledged properly.| HdmiCecTx | NA | Y |Control plane to switch ON a CEC-supported device on the HDMI network so that it shall respond to the basic commands| +| | | Broadcast a supported CEC Command to all the devices connected to the network without any error |HdmiCecTx| NA | Y |Control plane to switch ON a CEC-supported device on the HDMI network to act on the broadcasted command| +| | | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitoring the behaviour of the connected device accordingly.| HdmiCecTx | NA | Y | Control plane to monitor the behaviour of the connected devices. | +| | | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for a logical address that doesn't exist.| HdmiCecTx | Y | NA | Control plane can unplug or switch off a previously existing CEC device | -#### Emulator Requirements - CEC Transmission +### Emulator Requirements - CEC Transmission - Boot configuration - Min case scenario multiple network nodes - - Max case scenario multiple network nodes - -#### Control Plane Requirements - CEC Transmission -- The control plane will allow putting nodes into standby mode, this will cause a CEC message on the network - -### CEC Receive functionality + - Max case scenario multiple cec nodes -|S.No.|Test Functionality|Description|L2|L3|Control plane requirements| -|-----|------------------|-----------|--|--|--------------------------| -| 4| [CEC Receive functionality](#cec-receive-functionality)| Transmit a CEC Command that expects a response (Eg. GetCECVersion) to a connected device and see the response is received correctly. | NA |Y| | -| | | Transmit all the CEC Broadcast Command (as per 1.4b HDMI CEC spec) which expects a response from all the connected devices like `` | NA | Y || -| | | Transmit Different CEC commands from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (my TV here)| NA | Y | Control panel to control the third-party devices to Transmit the required commands to my Device (Device under test) | +### Control Plane Requirements - CEC Transmission +- The control plane will allow adding a device that can respond to the CEC Frames sent by `DUT` -#### Emulator Requirements - CEC Receive functionality +## CEC Receive functionality -#### Control Plane Requirements - CEC Receive functionality +|S.No.|Test Functionality|Description| HAL APIs|L2|L3|Control plane requirements| +|-----|------------------|-----------|---------|--|--|--------------------------| +| 5| [CEC Receive functionality](#cec-receive-functionality)| Transmit a CEC Command that expects a response (Eg. GetCECVersion) to a connected device and see the response is received correctly. Set the Rx Callback before sending the data. Validate the received CEC Version.|HdmiCecSetRxCallback HdmiCecTx | NA |Y| Control plane to switch ON a CEC device that can respond to the Transmitted CEC Command| +| | | Transmit a CEC command from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (`DUT` TV here)| HdmiCecSetRxCallback | NA | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`| +| | | Transmit an OSD CEC command from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (`DUT` TV here). Make the OSD String to max length| HdmiCecSetRxCallback | NA | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`| +| | | Transmit an OSD CEC command from the connected devices continuously for 30 seconds changing the patterns in the payload and considering the Acknowledgement and responses are received correctly from the host device (`DUT` TV here). Make the OSD String to max length| HdmiCecSetRxCallback | NA | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`. Also, Control plane to detect the OSD Display on the Sink device to validate| +| | | Set the Logical address to 0 on `DUT` and make sure that it doesn't receive the messages sent to devices with different logical address.| HdmiCecSetRxCallback | NA | Y | Control Plane to initiate a command to send CEC frames from CEC adaptor with a different logical address other than zero| -- The control panel to handle and facilitate communicate with third party devices to receive and send commands. +### Emulator Requirements - CEC Receive functionality +1. Emulate the Tx and Rx HAL functionalities with the required responses. -### CEC HotPlug Functionality +### Control Plane Requirements - CEC Transmission +- The control plane will allow adding a device that can respond to the CEC Frames sent by `DUT` +- The control plane to initiate CEC Transmissions from the connected devices as expected by the `DUT` -|S.No.|Test Functionality|Description|L2|L3|Control plane requirements| -|-----|------------------|-----------|--|--|--------------------------| -| 5| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Generate an Hotplug event by disconnecting the device connected to the HDMI port of the source Platform. Check whether the CEC Transmission works when HDMI port is disconnected. | NA | Y | Control Panel to control the Hotplug activities | -| | | Check the behaviour when a device has been remove from the network which is not directly connected to the TV device. Send a CEC Tx command with acknowledgement using HAL Interface and check the behaviour. The Tx command should fail in this state.| HdmiCecTx | NA | Y | Control Panel to control the external devices connected.| -| | | Check the behaviour when a device has been remove from the network which is not directly connected to the TV device. Send a CEC Tx command with acknowledgement using HAL Interface and check the behaviour. The Tx command should fail in this state. | NA | Y | Control Panel to control the external devices connected.| +## CEC HotPlug Functionality -#### Emulator Requirements - CEC HotPlug Functionality +|S.No.|Test Functionality|Description| HAL APIs |L2|L3|Control plane requirements| +|-----|------------------|-----------|----------|--|--|--------------------------| +| 6| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Generate a Hotplug event by disconnecting the device connected to the HDMI port of the Sink Platform. Validating whether the CEC Transmission (use Polling command) works when the HDMI port is disconnected should result in ACK not being received while the TX still works as expected. | HdmiCecTx | NA | Y | Control Panel to control the Hotplug activities | +| | | Check the behaviour when a device has been remove from the network which is not directly connected to the TV device. Send a CEC Tx command with acknowledgement using HAL Interface and check the behaviour. The Tx command should succeed, but the message should not be Acknowledged.| HdmiCecTx | NA | Y | Control Panel to control the external devices connected.| -#### Control Plane Requirements - CEC HotPlug Functionality +### Emulator Requirements - CEC HotPlug Functionality -- The control panel to handle and facilitate communicate with third party devices to receive and send commands. +### Control Plane Requirements - CEC HotPlug Functionality +1. Control plane to initiate the HotPlug activity by commanding an IP power switch to the OFF State to which the Node device is connected. ----------- ----------- ## Hardware Verification Testing Requirements -|S.No.|Test Functionality|Description|L2|L3|Control plane requirements| -|-----|------------------|-----------|--|--|--------------------------| -| 6| Introduce fault in the CEC Bus | Absorve the behaviour when the CEC line is pulled high during the CEC Transmission.| NA | Y |Fault Introduction| -| 7| Overloading the CEC bus. | Overload the CEC bus with too many messages (by connecting more devices in the network) and observe the behaviour| NA | Y |Fault Introduction| +|S.No.|Test Functionality|Description| HAL APIs |L2|L3|Control plane requirements| +|-----|------------------|-----------|----------|--|--|--------------------------| +| 7| Introduce fault in the CEC Bus | Observe the behaviour when the CEC line is pulled high during the CEC Transmission using a CEC Adaptor that provision to keep the CEC line pulled high| HdmiCecTx | NA | Y |CEC Adaptor used shall have a provision to introduce the fault. The control plane should be able to command to pull the CEC line high, else it should follow a manual process| +| 8| Overloading the CEC bus. | Overload the CEC bus with too many messages (by connecting more devices in the network) and observe the behaviour| HdmiCecTx | NA | Y |Control plane to initiate the CEC Transmission through all the connected devices continuously with a command that expects the response as well to overload the CEC Network. | ### Emulator Requirements - +1. Emulator to support the HDMI_CEC_IO_SENT_FAILED during the above scenarios + ### Control Plane Requirements - +1. Control Plane to control the external devices to pull the CEC line high. +2. Control Plan to initiate multiple CEC commands from the different devices connected to the network. ----------- ----------- -## Boot configuration +## Boot configuartion ### Module Configuration Requirements -The module must be configured during the boot sequence in the case of emulation, as if it was a real hardware device with or without multiple connected HDMI nodes. +The module must be configured during the boot sequence in the case of emulation as if it were a real hardware device with or without multiple connected HDMI nodes. -### Test Configuration for source Devices +### Test Configuration for Sink Devices -The following information shall be helpful for further running the Automation Rack Test for this specific module and further the configuration will help for the Design and Development of Virtual Device. +The following information shall be helpful for further running the Automation Rack Test for this specific module and further configuration will help for the Design and Development of Virtual Device. Configurations: ```yaml Device: Type: Source / Sink - Platform_Manufacturer: sony/samsung etc. + Platform_Manufacturer: sony/Samsung etc. Platform_Model: xyz Port: 3, 4 HDMI Node: 1-3 etc. From 12077bf66f3a8e181228e1e84e1428b52d8bc303 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Mon, 20 May 2024 13:39:25 -0400 Subject: [PATCH 08/48] Update L2 source .md document --- docs/pages/hdmi_cec_source_tests.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_tests.md index 1e54099..19da507 100644 --- a/docs/pages/hdmi_cec_source_tests.md +++ b/docs/pages/hdmi_cec_source_tests.md @@ -34,6 +34,7 @@ Consumer Electronics Control (CEC) is a single-wire bidirectional bus within an The HAL layers within RDK serve as a bridge between the underlying low-level SoC drivers and the higher-level RDK layers that utilize the functionality offered by these HAL functions. Specifically concerning the CEC Module, the HAL layers facilitate the following functionalities: +- Logical Address discovery - Get Logical address - Get Physical address - Syncronous transmission, and communicating via hotplug connectivity @@ -46,10 +47,10 @@ It is the responsibility of the caller to manage the opcodes. The current test c |S.No.|Test Functionality|Description| |-----|------------------|-----------| -| 1 |[Logical address](#logical-address-discovery)|Facilitating the Discovery of logical addresses getting, and removing the logical address of the device (for sink devices) | +| 1 |[Logical address](#logical-address-discovery)|Facilitating the Discovery of logical addresses getting logical address of the device (for source devices) | | 2| [Physical Address](#physical-address)| Retrieving the physical address | -| 3| [CEC Synchronous Transmission](#cec-synchronous-transmission)| Transmitting CEC frames and acknowledging them | -| 4| [CEC Receive functionality](#cec-receive-functionality)| Receiving CEC information from other devices and communicating it to the above layers through registered callback functions | +| 3| [CEC Synchronous Transmission](#cec-synchronous-transmission)| Transmitting CEC frames and reporting on their acknowledgement | +| 4| [CEC Receive functionality](#cec-receive-functionality)| Receiving CEC information from other devices and passing it to the layer above through a registered callback function | | 5| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Managing CEC during Hotplug and HotUnplug events | ----------- @@ -58,18 +59,17 @@ It is the responsibility of the caller to manage the opcodes. The current test c |S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| |-----|------------------|-----------|--------|--|--|--------------------------| -| 1 |[Logical address](#logical-address-discovery)|Get the logical address of the `DUT`. This will add the logical address, as per source functionality. |HdmiCecGetLogicalAddress|Y|NA +| 1 |[Logical address](#logical-address-discovery)|Get the logical address discovered during cec open and validate the address for a proper playback/tuner device. This will add the logical address, as per source functionality. |HdmiCecGetLogicalAddress|Y|NA ### Emulator Requirements - Boot with control configuration with various configurations having a predefined set of nodes: - - configuration to support the discovery of logical addresses. The caller provides the logical address, and HAL checks the availability of this address and feedback the same to the caller. + - configuration to support the discovery of logical addresses. The caller to provide a create a proper logical address during Open and that should be provided when HDMICECGetLogicaladdress is used. - Verify for the valid logical address and return the appropriate error code based on the logical address availability. ### Control Plane Requirements - The control plane will allow removing or adding a node to the network. - - allowing adding/removing node sink node logical address 0 - allowing adding/removing source node - Support the CEC commands from the external devices on L3 Test Cases. From 971e87907386c51eca57825d71a676c358c227e0 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Mon, 20 May 2024 13:49:29 -0400 Subject: [PATCH 09/48] Update HDMICEC source L2 --- docs/pages/hdmi_cec_source_tests.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_tests.md index 19da507..0a4ca8a 100644 --- a/docs/pages/hdmi_cec_source_tests.md +++ b/docs/pages/hdmi_cec_source_tests.md @@ -77,13 +77,13 @@ It is the responsibility of the caller to manage the opcodes. The current test c |S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| |-----|------------------|-----------|--------|--|--|--------------------------| -| 2| [Physical Address](#physical-address)| Verify the valid physical address allocated through the HAL function.|HdmiCecGetPhysicalAddress| Y |NA|| +| 2| [Physical Address](#physical-address)| Enable the television connected to the DUT first to get the valid physical address allocated through the HAL function.|HdmiCecGetPhysicalAddress| Y |NA|| | | | Verify the physical addresses allocated by connecting two sink devices through an HDMI switch.| HdmiCecGetPhysicalAddress| NA | Y | Enable the television connected to `DUT` to declare its physical address first before `DUT`.| ### Emulator Requirements - Physical Address - Boot control configuration to setup the CEC network nodes -- Scenario to have two sink devices on the network + - Emulator to provide a valid physical address when requested. ### Control Plane Requirements - Physical Address From 974b1d79eb634e5237551814fec3f1602fcb9f8a Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 6 Jun 2024 12:06:22 -0400 Subject: [PATCH 10/48] Upload source L2 document --- docs/pages/hdmi_cec_source_tests.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_tests.md index 0a4ca8a..21db17c 100644 --- a/docs/pages/hdmi_cec_source_tests.md +++ b/docs/pages/hdmi_cec_source_tests.md @@ -78,7 +78,7 @@ It is the responsibility of the caller to manage the opcodes. The current test c |S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| |-----|------------------|-----------|--------|--|--|--------------------------| | 2| [Physical Address](#physical-address)| Enable the television connected to the DUT first to get the valid physical address allocated through the HAL function.|HdmiCecGetPhysicalAddress| Y |NA|| -| | | Verify the physical addresses allocated by connecting two sink devices through an HDMI switch.| HdmiCecGetPhysicalAddress| NA | Y | Enable the television connected to `DUT` to declare its physical address first before `DUT`.| +| | | Verify the physical addresses allocated by connecting a source and sink device through an HDMI switch.| HdmiCecGetPhysicalAddress| NA | Y | Enable the television connected to `DUT` to declare its physical address first before `DUT`.| ### Emulator Requirements - Physical Address @@ -88,6 +88,7 @@ It is the responsibility of the caller to manage the opcodes. The current test c ### Control Plane Requirements - Physical Address - The control plane will allow removing or adding a node to the network. + - allowing add source node before the `DUT` switched ON. - allowing add sink node before the `DUT` switched ON. ## CEC Synchronous Transmission @@ -128,7 +129,7 @@ It is the responsibility of the caller to manage the opcodes. The current test c |S.No.|Test Functionality|Description| HAL APIs |L2|L3|Control plane requirements| |-----|------------------|-----------|----------|--|--|--------------------------| -| 6| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Generate a Hotplug event by disconnecting the device connected to the HDMI port of the Sink Platform. Validating whether the CEC Transmission (use Polling command) works when the HDMI port is disconnected should result in ACK not being received while the TX still works as expected. | HdmiCecTx | NA | Y | Control Panel to control the Hotplug activities | +| 6| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Generate a Hotplug event by disconnecting the device connected to the HDMI port of the Source Platform. Validating whether the CEC Transmission (use Polling command) works when the HDMI port is disconnected should result in ACK not being received while the TX still works as expected. | HdmiCecTx | NA | Y | Control Panel to control the Hotplug activities | | | | Check the behaviour when a device has been remove from the network which is not directly connected to the TV device. Send a CEC Tx command with acknowledgement using HAL Interface and check the behaviour. The Tx command should succeed, but the message should not be Acknowledged.| HdmiCecTx | NA | Y | Control Panel to control the external devices connected.| ### Emulator Requirements - CEC HotPlug Functionality @@ -161,7 +162,7 @@ It is the responsibility of the caller to manage the opcodes. The current test c The module must be configured during the boot sequence in the case of emulation as if it were a real hardware device with or without multiple connected HDMI nodes. -### Test Configuration for Sink Devices +### Test Configuration for Source Devices The following information shall be helpful for further running the Automation Rack Test for this specific module and further configuration will help for the Design and Development of Virtual Device. From 0ad5046fccc4494b53d86ab0bf551cfea9239e26 Mon Sep 17 00:00:00 2001 From: sramani-metro <71630728+sramani-metro@users.noreply.github.com> Date: Thu, 6 Jun 2024 22:33:02 +0530 Subject: [PATCH 11/48] Feature/issues15 emulator startup (#21) * gh #15 Initial commit Work in progress * gh #15 Create test drivers and successful build * gh #15 Make a few l1 tests pass * gh #15 All L1 test cases for sink profile passing * gh #15 Update design document * gh #15 Address review comments, Add device map impl based on n-ary tree * gh #15 Address Review comments. * gh #15 Revert the changes in test_l1_hdmi_cec_driver.c. Will be moved to a new ticket --- Makefile | 17 +- docs/pages/hdmi_cec_emulator_design.md | 135 +-- src/main.c | 51 + src/test_vcomponent.c | 156 +++ vcomponent/include/vcomponent_hdmi_cec.h | 71 ++ vcomponent/profiles/profile_template.yaml | 124 ++ vcomponent/profiles/test_sink.yaml | 62 + vcomponent/profiles/test_source_skyxione.yaml | 46 + vcomponent/src/vcomponent_hdmi_cec.c | 1038 +++++++++++++++++ 9 files changed, 1611 insertions(+), 89 deletions(-) create mode 100644 src/test_vcomponent.c create mode 100644 vcomponent/include/vcomponent_hdmi_cec.h create mode 100644 vcomponent/profiles/profile_template.yaml create mode 100644 vcomponent/profiles/test_sink.yaml create mode 100644 vcomponent/profiles/test_source_skyxione.yaml create mode 100644 vcomponent/src/vcomponent_hdmi_cec.c diff --git a/Makefile b/Makefile index 265fae1..a736743 100644 --- a/Makefile +++ b/Makefile @@ -34,13 +34,14 @@ TOP_DIR := $(ROOT_DIR) SRC_DIRS = $(ROOT_DIR)/src INC_DIRS := $(ROOT_DIR)/../include HAL_LIB := RCECHal -SKELTON_SRCS := $(ROOT_DIR)/skeletons/src/hdmi_cec_driver.c +VCOMPONENT_SRCS := $(ROOT_DIR)/vcomponent/src/vcomponent_hdmi_cec.c ifeq ($(TARGET),) $(info TARGET NOT SET ) $(info TARGET FORCED TO Linux) TARGET=linux -SRC_DIRS += $(ROOT_DIR)/skeletons/src +SRC_DIRS += $(ROOT_DIR)/vcomponent/src +INC_DIRS += $(ROOT_DIR)/vcomponent/include YLDFLAGS += -lpthread -lrt endif @@ -50,7 +51,7 @@ ifeq ($(TARGET),arm) HAL_LIB_DIR := $(ROOT_DIR)/libs YLDFLAGS = -Wl,-rpath,$(HAL_LIB_DIR) -L$(HAL_LIB_DIR) -l$(HAL_LIB) -lpthread -lrt ifeq ("$(wildcard $(HAL_LIB_DIR)/lib$(HAL_LIB).so)","") -SETUP_SKELETON_LIBS := skeleton +SETUP_VCOMPONENT_LIBS := vcomponent endif endif @@ -64,18 +65,18 @@ export TARGET export TOP_DIR export HAL_LIB_DIR -.PHONY: clean list build skeleton +.PHONY: clean list build vcomponent -build: $(SETUP_SKELETON_LIBS) - echo "SETUP_SKELETON_LIBS $(SETUP_SKELETON_LIBS)" +build: $(SETUP_VCOMPONENT_LIBS) + echo "SETUP_VCOMPONENT_LIBS $(SETUP_VCOMPONENT_LIBS)" @echo UT [$@] make -C ./ut-core #Build against the real library leads to the SOC library dependency also.SOC lib dependency cannot be specified in the ut Makefile, since it is supposed to be common across may platforms. So in order to over come this situation, creating a template skelton library with empty templates so that the template library wont have any other Soc dependency. And in the real platform mount copy bind with the actual library will work fine. -skeleton: +vcomponent: echo $(CC) - $(CC) -fPIC -shared -I$(ROOT_DIR)/../include $(SKELTON_SRCS) -o lib$(HAL_LIB).so + $(CC) -fPIC -shared -I$(ROOT_DIR)/../include $(VCOMPONENT_SRCS) -o lib$(HAL_LIB).so mkdir -p $(HAL_LIB_DIR) cp $(ROOT_DIR)/lib$(HAL_LIB).so $(HAL_LIB_DIR) diff --git a/docs/pages/hdmi_cec_emulator_design.md b/docs/pages/hdmi_cec_emulator_design.md index 2d72efd..d6022b6 100644 --- a/docs/pages/hdmi_cec_emulator_design.md +++ b/docs/pages/hdmi_cec_emulator_design.md @@ -20,25 +20,13 @@ hdmicec: #Device logical types - Hints for emulator to auto allocate logical address device_type: &device_type - TV - - STB_1 - - STB_2 - - DVR_1 - - DVR_2 - - Chromecast - - HomeTheatre - - GamingConsole_1 - - GamingConsole_2 - - DVDPlayer_1 - - DVDPlayer_2 - - AVR_1 - - AVR_2 - - Switcher_1 - - Switcher_2 - - Camera_1 - - Camera_2 - - SpecialPurpose - - Unregistered - + - PlaybackDevice + - AudioSystem + - RecordingDevice + - Tuner + - Reserved + - Unregistered + #Port ID - Integer [1 to 15] port_id: &port_id !!int @@ -51,36 +39,37 @@ hdmicec: - in - out - #Vendor Info - Name and IEEE RAC vendor code + #Vendor Info - Name. vendor: &vendor - - [TOSHIBA, 0x000039] - - [SAMSUNG, 0x0000F0] - - [DENON, 0x0005CD] - - [MARANTZ, 0x000678] - - [LOEWE, 0x000982] - - [ONKYO, 0x0009B0] - - [MEDION, 0x000CB8] - - [TOSHIBA2, 0x000CE7] - - [APPLE, 0x0010FA] - - [HARMAN_KARDON2, 0x001950] - - [GOOGLE, 0x001A11] - - [AKAI, 0x0020C7] - - [AOC, 0x002467] - - [PANASONIC, 0x008045] - - [PHILIPS, 0x00903E] - - [DAEWOO, 0x009053] - - [YAMAHA, 0x00A0DE] - - [GRUNDIG, 0x00D0D5] - - [PIONEER, 0x00E036] - - [LG, 0x00E091] - - [SHARP, 0x08001F] - - [SONY, 0x080046] - - [BROADCOM, 0x18C086] - - [SHARP2, 0x534850] - - [VIZIO, 0x6B746D] - - [BENQ, 0x8065E9] - - [HARMAN_KARDON, 0x9C645E] - - [UNKNOWN, 0] + - TOSHIBA + - SAMSUNG + - DENON + - MARANTZ + - LOEWE + - ONKYO + - MEDION + - TOSHIBA2 + - APPLE + - HARMAN_KARDON2 + - GOOGLE + - AKAI + - AOC + - PANASONIC + - PHILIPS + - DAEWOO + - YAMAHA + - GRUNDIG + - PIONEER + - LG + - SHARP + - SONY + - BROADCOM + - SHARP2 + - VIZIO + - BENQ + - HARMAN_KARDON + - SKY + - UNKNOWN #HDMI CEC Version supported by device cec_version: &cec_version @@ -114,7 +103,7 @@ hdmicec: version: *cec_version #Value from enum &cec_version type: *device_type #Type of device from device_type list active_source: !!bool #Whether the device will start as active source - vendor_info: *vendor #Vendor info value pair from &vendor + vendor: *vendor #Vendor info value from &vendor pwr_status: *power_status #Initial Power status from enum &power_status name: !!str #Name of the device number_ports: !!int @@ -135,28 +124,28 @@ hdmicec: - type: *device_type #Type of device from device_type list version: *cec_version active_source: !!bool - vendor_info: *vendor + vendor: *vendor pwr_status: *power_status name: !!str - type: *device_type version: *cec_version active_source: !!bool - vendor_info: *vendor + vendor: *vendor pwr_status: *power_status name: !!str - type: *device_type version: *cec_version active_source: !!bool - vendor_info: *vendor + vendor: *vendor pwr_status: *power_status name: !!str - type: *device_type version: *cec_version active_source: !!bool - vendor_info: *vendor + vendor: *vendor pwr_status: *power_status name: !!str @@ -169,45 +158,29 @@ hdmicec: ``` -A sample configuration file for the control plane - -```yaml ---- -controlplane: - ws: - port: 8091 - url: /hdmicec - -``` - The Emulator will have a common interface that needs to be implemented along with the HAL driver interface functions. `emulator.h` ``` -int emulator_initialise(const char* profile, const char* config); +Emulator_t *Emulator_Initialize( char* pProfilePath, unsigned short cpPort, char* pCPUrl ); -int emulator_deinitialise(void) +void Emulator_Deinitialize( Emulator_t *pEmulator ); ``` -emulator_initialise will use the YAML decoding functionality via the Key-Value Pair (KVP) module available currently as part of the ut_core to read the profile parameters and create the initial state machine with number of HDMI Ports and the network of devices attached on the CEC bus. In addition, emulator will also intialise the control plane with the websocket parameters passed via '--config'. +emulator_initialise will use the YAML decoding functionality via the Key-Value Pair (KVP) module available currently as part of the ut_core to read the profile parameters and create the initial state machine with number of HDMI Ports and the network of devices attached on the CEC bus. In addition, emulator will also intialise the control plane with the websocket parameters passed via "-c" and "-u" parameters. The control plane inititialise function may look like this. This will setup the websocket server. ``` -ut_kvp_instance_t conf_instance = ut_kvp_createInstance(); -ut_kvp_status_t status = ut_kvp_read(&conf_instance, config); -uint16_t port = ut_kvp_getUInt32Field(&conf_instance, "controlplane.ws.port"); -char* url = ut_kvp_getStringField(&conf_instance, "controlplane.ws.url"); - -controlPlane_initialise(port, url); +ut_controlPlane_instance_t* instance = UT_ControlPlane_Init(cpPort); ``` The emulator will also register with the control plane to receive callbacks when there is a command trigger from the Test user. These are YAML messages over Websocket. The register mechanism shall look like below, ``` -controlPlane_register_callbackOnMessage("hdmicec.command", &myCallback); +UT_ControlPlane_RegisterCallbackOnMessage("hdmicec.command", &myCallback); ``` The state machine of the Hdmi CEC hal is setup by populating its data structures by retreiving from the profile config. Below is an example of information about HDMI ports populated. The info on devices connected to the CEC bus is populated in a similar way to set up the initial state machine. @@ -256,7 +229,7 @@ port_info_t *ports = (port_info_t*)malloc(size(port_info_t) * num_ports); char prefix_name[] = "hdmicec.ports."; for(int i = 0; i < ports; i++) { - + ... } --- @@ -359,10 +332,10 @@ Command to trigger a re-configuration of the initial state. The following config hdmicec: config: version: 4 - type: STB_1 + type: PlaybackDevice active_source: true - vendor: [SAMSUNG, 0x0000F0] - power_status: on + vendor: SAMSUNG + pwr_status: on name: sky_xione number_ports: 1 ports: @@ -375,14 +348,14 @@ hdmicec: - type: TV version: 4 active_source: false - vendor_info: [SONY, 0x080046] + vendor: SONY pwr_status: on name: Sony TV - type: Chromecast version: 4 active_source: false - vendor_info: [GOOGLE, 0x001A11] - power_status: on + vendor: GOOGLE + pwr_status: on name: Chromecast links: diff --git a/src/main.c b/src/main.c index bc1695b..765faa9 100644 --- a/src/main.c +++ b/src/main.c @@ -59,17 +59,68 @@ */ #include +#include +#include +#include extern int register_hdmicec_hal_l1_tests( void ); +extern int register_vcomponent_tests ( char* profile, unsigned short cpPort, char* cpPath ); int main(int argc, char** argv) { + int opt; + char* pProfilePath = NULL; + unsigned short cpPort = 8888; + char* pUrl = NULL; + + while ((opt = getopt(argc, argv, "p:c:u:")) != -1) + { + switch(opt) + { + case 'p': + UT_LOG ("Setting Profile path [%s]\n",optarg); + pProfilePath = malloc(strlen(optarg) + 1); + strcpy(pProfilePath, optarg); + pProfilePath[strlen(optarg) + 1] = '\0'; + break; + case 'c': + cpPort = atoi(optarg); + UT_LOG ("Setting control plane port [%d]\n",cpPort); + break; + + case 'u': + UT_LOG ("Setting control plane path [%s]\n",optarg); + pUrl = malloc(strlen(optarg) + 1); + strcpy(pUrl, optarg); + pUrl[strlen(optarg) + 1] = '\0'; + break; + case '?': + case ':': + UT_LOG("unknown option: %c\n", optopt); + break; + } + } + + + /* Register tests as required, then call the UT-main to support switches and triggering */ UT_init( argc, argv ); register_hdmicec_hal_l1_tests (); + register_vcomponent_tests(pProfilePath, cpPort, pUrl); + UT_run_tests(); + + if(pProfilePath != NULL) + { + free(pProfilePath); + } + + if(pUrl != NULL) + { + free(pUrl); + } } /** @} */ // End of HDMI CEC HAL Tests Main File diff --git a/src/test_vcomponent.c b/src/test_vcomponent.c new file mode 100644 index 0000000..1552fe4 --- /dev/null +++ b/src/test_vcomponent.c @@ -0,0 +1,156 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2016 RDK Management + * + * 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. +*/ + +/** + * @addtogroup HPK Hardware Porting Kit + * @{ + * + */ + +/** + * @addtogroup HDMI_CEC HDMI CEC Module + * @{ + * + */ + +/** + * @defgroup HDMI_CEC_HALTESTS HDMI CEC HAL Tests + * @{ + * + */ + +/** + * @defgroup HDMI_CEC_HAL_EMULATORTESTS HDMI CEC HAL Virtual Component Tests File + * @{ + * @parblock + * + * ### L1 Test Cases for HDMI CEC HAL Virtual Component: + * + * This module includes Level 1 functional tests (success and failure scenarios). + * This is to ensure that the API meets the operational requirements of the module across all vendors. + * + * **Pre-Conditions:** @n + * **Dependencies:** None@n + * + * Refer to API Definition specification documentation : [hdmi-cec_halSpec.md](../../docs/pages/hdmi-cec_halSpec.md) + * + * @endparblock + * + */ + +/** + * @file test_vcomponent.c + * + */ + +#include +#include +#include +#include +#include + +#include +#include +#include "ut_log.h" +#include "hdmi_cec_driver.h" +#include "vcomponent_hdmi_cec.h" + + +struct emulator_info { + char *pProfilePath; + unsigned short cpPort; + char* pCpPath; + vComponent_HdmiCec_t* handle; +}; + +struct emulator_info gVCInfo = {NULL, 8888, NULL}; + +void start_virtual_component (void) +{ + vComponent_HdmiCec_Status status; + + if(gVCInfo.pProfilePath == NULL) + { + assert(gVCInfo.pProfilePath != NULL); + return; + } + + status = vComponent_HdmiCec_Initialize(gVCInfo.pProfilePath, gVCInfo.cpPort, gVCInfo.pCpPath, &gVCInfo.handle); + if(status != VC_HDMICEC_STATUS_SUCCESS) + { + UT_LOG("Error starting Virtual Component [%d]\n", status); + } + + UT_LOG("Virtual Component started\n"); + +} + +void stop_virtual_component(void) +{ + vComponent_HdmiCec_Status status; + if(gVCInfo.handle == NULL) + { + assert(gVCInfo.handle != NULL); + return; + } + status = vComponent_HdmiCec_Deinitialize(gVCInfo.handle); + if(status != VC_HDMICEC_STATUS_SUCCESS) + { + UT_LOG("Error stopping Virtual Component [%d]\n", status); + } + gVCInfo.handle = NULL; + UT_LOG("Virtual Component stopped\n"); + +} + +static UT_test_suite_t * pSuite = NULL; + +/** + * @brief Register the main test(s) for this module + * + * @return int - 0 on success, otherwise failure + */ +int register_vcomponent_tests ( char* profile, unsigned short cpPort, char* cpPath ) +{ + if(profile == NULL) + { + return -1; + } + gVCInfo.pProfilePath = profile; + gVCInfo.cpPort = cpPort; + gVCInfo.pCpPath = cpPath; + + /* add a suite to the registry */ + pSuite = UT_add_suite( "[HDMI CEC Virtual Component Lifecycle control]", NULL, NULL ); + if ( NULL == pSuite ) + { + return -1; + } + + UT_add_test( pSuite, "start_virtual_component" , start_virtual_component ); + UT_add_test( pSuite, "stop_virtual_component" , stop_virtual_component ); + + return 0; + +} + +/** @} */ // End of HDMI CEC HAL Virtual Component Tests File +/** @} */ // End of HDMI CEC HAL Tests +/** @} */ // End of HDMI CEC Module +/** @} */ // End of HPK diff --git a/vcomponent/include/vcomponent_hdmi_cec.h b/vcomponent/include/vcomponent_hdmi_cec.h new file mode 100644 index 0000000..ec2fe22 --- /dev/null +++ b/vcomponent/include/vcomponent_hdmi_cec.h @@ -0,0 +1,71 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2023 RDK Management + * + * 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. +*/ + +#ifndef __VCOMPONENT_HDMI_CEC_H +#define __VCOMPONENT_HDMI_CEC_H + + +/**! Status codes for the HDMI CEC Virtual Component */ +typedef enum +{ + VC_HDMICEC_STATUS_SUCCESS = 0, /**!< Operation successful. */ + VC_HDMICEC_STATUS_NOT_INITIALIZED, /**!< Virtual Component not initialized. */ + VC_HDMICEC_STATUS_ALREADY_INITIALIZED, /**!< Invalid parameter passed. */ + VC_HDMICEC_STATUS_INVALID_PARAM, /**!< Invalid parameter passed. */ + VC_HDMICEC_STATUS_INVALID_HANDLE, /**!< Invalid virtual component handle. */ + VC_HDMICEC_STATUS_PROFILE_READ_ERROR, /**!< Error reading the profile path from file */ + VC_HDMICEC_STATUS_OUT_OF_MEMORY, /**!< Out f memory. */ + VC_HDMICEC_STATUS_MAX /**!< Out of range marker (not a valid status). */ +} vComponent_HdmiCec_Status; + +typedef void vComponent_HdmiCec_t; + +/** + * @brief Intitialize the HDMI CEC Virtual Component and the control plane + * This will setup the initial state machine of the Virtual Component + * @param[in] pProfilePath - File path containing the profile config YAML for the HAL driver + * @param[in] cpPort - Control plane listening port. + * @param[in] pCPUrl - Control plane Path URL e.g, "/hdmicec". Passing NULL is valid. + * @param[out] handle - Output variable that holds the pointer to VC instane. + * + * The control plane url will look like "http://:/pCPUrl" + * + * @return Status of Virtual Component Init (vComponent_HdmiCec_Status) + * @retval VC_HDMICEC_STATUS_SUCCESS - Virtual Component successfully Created and initialized. + * @retval VC_HDMICEC_STATUS_INVALID_PARAM - One or more parameters are invalid. + * @retval VC_HDMICEC_STATUS_OUT_OF_MEMORY - Memory allocation error + * @retval VC_HDMICEC_STATUS_ALREADY_INITIALIZED - Initialize called again. + * @retval VC_HDMICEC_STATUS_PROFILE_READ_ERROR - Error reading the profile path from file + */ +vComponent_HdmiCec_Status vComponent_HdmiCec_Initialize( char* pProfilePath, unsigned short cpPort, char* pCPUrl, vComponent_HdmiCec_t** handle ); + + +/** + * @brief Deintitialize the Virtual Component and the control plane. Free up all memory associated. + * + * @param[in] pvComponent - Pointer to the vComponent instance. + * + * @return Status of Virtual Component Deinit (vComponent_HdmiCec_Status) + * @retval VC_HDMICEC_STATUS_SUCCESS - Virtual Component successfully deinitialized. + * @retval VC_HDMICEC_STATUS_INVALID_HANDLE - Provided vComponent_HdmiCec_t* is not a valid handle. + */ +vComponent_HdmiCec_Status vComponent_HdmiCec_Deinitialize( vComponent_HdmiCec_t *pvComponent ); + + +#endif //__VCOMPONENT_HDMI_CEC_H \ No newline at end of file diff --git a/vcomponent/profiles/profile_template.yaml b/vcomponent/profiles/profile_template.yaml new file mode 100644 index 0000000..ed67c06 --- /dev/null +++ b/vcomponent/profiles/profile_template.yaml @@ -0,0 +1,124 @@ +--- +hdmicec: + #Device logical types - Hints for emulator to auto allocate logical address + device_type: &device_type + - TV + - PlaybackDevice + - AudioSystem + - RecordingDevice + - Tuner + - Reserved + - Unregistered + + #Port ID - Integer [1 to 15] + port_id: &port_id + !!int + + #Enum specifying port type + #All references shown in the configuration templates are intended to provide possible values for the given type. + #In practice, the below field would be defined as, + # port_type: in + port_type: &port_type + - in + - out + + #Vendor Info - Name and IEEE RAC vendor code + vendor: &vendor + - TOSHIBA + - SAMSUNG + - DENON + - MARANTZ + - LOEWE + - ONKYO + - MEDION + - TOSHIBA2 + - APPLE + - HARMAN_KARDON2 + - GOOGLE + - AKAI + - AOC + - PANASONIC + - PHILIPS + - DAEWOO + - YAMAHA + - GRUNDIG + - PIONEER + - LG + - SHARP + - SONY + - BROADCOM + - SHARP2 + - VIZIO + - BENQ + - HARMAN_KARDON + - UNKNOWN + + #HDMI CEC Version supported by device + cec_version: &cec_version + - 0 #Unknown + - 1 #1.2 + - 2 #1.2A + - 3 #1.3 + - 4 #1.3A + - 5 #1.4 + - 6 #2.0 + + #Power Status of the device + power_status: &power_status + - on + - off + - standby + + # Emulated Device's Information + emulated_device: !!str # e.g, Sky Glass + number_ports: !!int + ports: #Variable sized array of Ports belonging to Emulated device + - id: *port_id + #All references shown in the configuration templates are intended to provide possible values for the given type. + #In practice, the below field would be defined as, + # port_type: in + type: *port_type # Type of Port from &port_type + cec_supported: !!bool + arc_supported: !!bool + - id: *port_id + type: *port_type + cec_supported: !!bool + arc_supported: !!bool + + number_devices: !!int # Total number of devices in the network + device_map: # Map of devices starting from the Root Device (A TV) and multiple levels of children + - name: !!str #Unique name identifying the device. + type: *device_type #Type of device from device_type list. The top parent must be a root device (TV) + version: *cec_version + active_source: !!bool + vendor_info: *vendor + pwr_status: *power_status + port_id: !!int #Port id of the parent to which this device is connected. For root device, this will be 0. + number_children: !!int #Number of children connected to this device + children: #Array of devices that are connected to this parent + - name: !!str + type: *device_type + version: *cec_version + active_source: !!bool + vendor_info: *vendor + pwr_status: *power_status + port_id: !!int #Port id of the parent to which this device is connected + number_children: !!int # 0, If no devices are connected. This parameter must be present for all devices + + - name: !!str + type: *device_type + version: *cec_version + active_source: !!bool + vendor_info: *vendor + pwr_status: *power_status + port_id: !!int #Port id of the parent to which this device is connected + number_children: !!int # 0, If no devices are connected. + children: + - name: !!str + type: *device_type + version: *cec_version + active_source: !!bool + vendor_info: *vendor + pwr_status: *power_status + port_id: !!int #Port id of the parent to which this device is connected + number_children: !!int # 0, If no devices are connected. diff --git a/vcomponent/profiles/test_sink.yaml b/vcomponent/profiles/test_sink.yaml new file mode 100644 index 0000000..a3892d6 --- /dev/null +++ b/vcomponent/profiles/test_sink.yaml @@ -0,0 +1,62 @@ +--- +hdmicec: + emulated_device: Sky Glass + number_ports: 3 + ports: + - id: 1 + type: in + cec_supported: true + arc_supported: true + - id: 2 + type: in + cec_supported: true + arc_supported: true + - id: 3 + type: in + cec_supported: true + arc_supported: false + + number_devices: 5 + device_map: + - name: Sky Glass + type: TV + version: 4 + active_source: false + vendor: SKY_UK + pwr_status: on + port_id: 0 + number_children: 2 + children: + - name: Sony + type: AudioSystem + version: 4 + active_source: false + vendor: SONY + pwr_status: on + port_id: 1 + number_children: 2 + children: + - name: Chromecast + type: PlaybackDevice + version: 4 + active_source: false + vendor: GOOGLE + pwr_status: on + port_id: 1 + number_children: 0 + - name: SKY xione + type: PlaybackDevice + version: 4 + active_source: false + vendor: SKY + pwr_status: on + port_id: 2 + number_children: 0 + - name: SONY PS3 + type: PlaybackDevice + version: 4 + active_source: false + vendor: SONY + pwr_status: on + port_id: 2 + number_children: 0 \ No newline at end of file diff --git a/vcomponent/profiles/test_source_skyxione.yaml b/vcomponent/profiles/test_source_skyxione.yaml new file mode 100644 index 0000000..8c741dd --- /dev/null +++ b/vcomponent/profiles/test_source_skyxione.yaml @@ -0,0 +1,46 @@ +--- +hdmicec: + emulated_device: SKY XiOne + number_ports: 1 + ports: + - id: 1 + type: out + cec_supported: true + arc_supported: false + + number_devices: 4 + device_map: + - name: Sony Bravia + type: TV + version: 4 + active_source: false + vendor: SONY + pwr_status: on + port_id: 0 + number_children: 1 + children: + - name: Onkyo TX-SR393 + type: AudioSystem + version: 4 + active_source: false + vendor: ONKYO + pwr_status: on + port_id: 1 + number_children: 2 + children: + - name: Chromecast + type: PlaybackDevice + version: 4 + active_source: false + vendor: GOOGLE + pwr_status: off + port_id: 1 + number_children: 0 + - name: SKY XiOne + type: PlaybackDevice + version: 4 + active_source: true + vendor: SKY + pwr_status: on + port_id: 2 + number_children: 0 diff --git a/vcomponent/src/vcomponent_hdmi_cec.c b/vcomponent/src/vcomponent_hdmi_cec.c new file mode 100644 index 0000000..d7ea93b --- /dev/null +++ b/vcomponent/src/vcomponent_hdmi_cec.c @@ -0,0 +1,1038 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2016 RDK Management + * + * 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 +#include +#include + +#include "hdmi_cec_driver.h" +#include "vcomponent_hdmi_cec.h" +#include "ut_log.h" +#include "ut_kvp_profile.h" +#include + +#define VC_LOG(format, ...) UT_logPrefix(__FILE__, __LINE__, UT_LOG_ASCII_YELLOW"vcHdmiCec[LOG] "UT_LOG_ASCII_NC, format, ## __VA_ARGS__) +#define VC_LOG_ERROR(format, ...) UT_logPrefix(__FILE__, __LINE__, UT_LOG_ASCII_RED"vcHdmiCec[ERROR] "UT_LOG_ASCII_NC, format, ## __VA_ARGS__) + +/**HDMI CEC HAL Data structures */ + +#define MAX_OSD_NAME_LENGTH 16 + +typedef enum +{ + DEVICE_TYPE_TV = 0, + DEVICE_TYPE_PLAYBACK, + DEVICE_TYPE_AUDIO_SYSTEM, + DEVICE_TYPE_RECORDER, + DEVICE_TYPE_TUNER, + DEVICE_TYPE_RESERVED, + DEVICE_TYPE_UNKNOWN +} vCHdmiCec_device_type_t; + +typedef enum +{ + LOGICAL_ADDRESS_TV = 0, + LOGICAL_ADDRESS_RECORDINGDEVICE1 = 1, + LOGICAL_ADDRESS_RECORDINGDEVICE2 = 2, + LOGICAL_ADDRESS_TUNER1 = 3, + LOGICAL_ADDRESS_PLAYBACKDEVICE1 = 4, + LOGICAL_ADDRESS_AUDIOSYSTEM = 5, + LOGICAL_ADDRESS_TUNER2 = 6, + LOGICAL_ADDRESS_TUNER3 = 7, + LOGICAL_ADDRESS_PLAYBACKDEVICE2 = 8, + LOGICAL_ADDRESS_RECORDINGDEVICE3 = 9, + LOGICAL_ADDRESS_TUNER4 = 10, + LOGICAL_ADDRESS_PLAYBACKDEVICE3 = 11, + LOGICAL_ADDRESS_RESERVED1 = 12, + LOGICAL_ADDRESS_RESERVED2 = 13, + LOGICAL_ADDRESS_FREEUSE = 14, + LOGICAL_ADDRESS_UNREGISTERED = 15, + LOGICAL_ADDRESS_BROADCAST = 15 +} vCHdmiCec_logical_address_t; + +typedef enum +{ + CEC_VERSION_UNKNOWN = 0, + CEC_VERSION_1_2 = 1, + CEC_VERSION_1_2A = 2, + CEC_VERSION_1_3 = 3, + CEC_VERSION_1_3A = 4, + CEC_VERSION_1_4 = 5, + CEC_VERSION_2_0 = 6 +} vCHdmiCec_version_t; + +typedef enum +{ + PORT_TYPE_INPUT = 0, + PORT_TYPE_OUTPUT, + PORT_TYPE_UNKNOWN +} vCHdmiCec_port_type_t; + +typedef enum +{ + POWER_STATUS_ON = 0, + POWER_STATUS_STANDBY, + POWER_STATUS_OFF, + POWER_STATUS_UNKNOWN +} vCHdmiCec_power_status_t; + +typedef struct +{ + unsigned short id; + unsigned int physical_address; + vCHdmiCec_port_type_t type; + bool cec_supported; + bool arc_supported; +} vCHdmiCec_port_info_t; + +typedef enum +{ + HAL_STATE_CLOSED = 0, + HAL_STATE_OPEN, + HAL_STATE_READY +} vCHdmiCec_hal_state_t; + +typedef enum +{ + CEC_EVENT_HOTPLUG = 1, + CEC_EVENT_COMMAND, + CEC_EVENT_CONFIG, + CEC_EVENT_MAX +} vCHdmiCec_event_type_t; + +typedef enum +{ + CEC_ACTIVE_SOURCE = 0x82, + CEC_IMAGE_VIEW_ON = 0x04, + CEC_TEXT_VIEW_ON = 0x0D, + CEC_INACTIVE_SOURCE = 0x9D, + CEC_REQUEST_ACTIVE_SOURCE = 0x85, + CEC_STANDBY = 0x36, + CEC_COMMAND_UNKNOWN = 0 +} vCHdmiCec_command_t; + +typedef enum +{ + VENDOR_CODE_TOSHIBA = 0x000039, + VENDOR_CODE_SAMSUNG = 0x0000F0, + VENDOR_CODE_DENON = 0x0005CD, + VENDOR_CODE_MARANTZ = 0x000678, + VENDOR_CODE_LOEWE = 0x000982, + VENDOR_CODE_ONKYO = 0x0009B0, + VENDOR_CODE_MEDION = 0x000CB8, + VENDOR_CODE_TOSHIBA2 = 0x000CE7, + VENDOR_CODE_APPLE = 0x0010FA, + VENDOR_CODE_HARMAN_KARDON2 = 0x001950, + VENDOR_CODE_GOOGLE = 0x001A11, + VENDOR_CODE_AKAI = 0x0020C7, + VENDOR_CODE_AOC = 0x002467, + VENDOR_CODE_PANASONIC = 0x008045, + VENDOR_CODE_PHILIPS = 0x00903E, + VENDOR_CODE_DAEWOO = 0x009053, + VENDOR_CODE_YAMAHA = 0x00A0DE, + VENDOR_CODE_GRUNDIG = 0x00D0D5, + VENDOR_CODE_PIONEER = 0x00E036, + VENDOR_CODE_LG = 0x00E091, + VENDOR_CODE_SHARP = 0x08001F, + VENDOR_CODE_SONY = 0x080046, + VENDOR_CODE_BROADCOM = 0x18C086, + VENDOR_CODE_SHARP2 = 0x534850, + VENDOR_CODE_VIZIO = 0x6B746D, + VENDOR_CODE_BENQ = 0x8065E9, + VENDOR_CODE_HARMAN_KARDON = 0x9C645E, + VENDOR_CODE_UNKNOWN = 0 +} vCHdmiCec_vendor_code_t; + +typedef struct +{ + bool connected; + unsigned int port_id; +} vCHdmiCec_hotplug_event_t; + + +typedef struct +{ + unsigned char src_logical_addr; + unsigned char dest_logical_addr; + vCHdmiCec_command_t command; +} vCHdmiCec_command_event_t; + + +typedef struct +{ + vCHdmiCec_event_type_t type; + union + { + vCHdmiCec_command_event_t cec_cmd; + vCHdmiCec_hotplug_event_t hot_plug; + }; +} vCHdmiCec_event_t; + +struct vCHdmiCec_device_info_t +{ + /*Variables to manage a non-binary tree of devices*/ + unsigned int number_children; + struct vCHdmiCec_device_info_t* parent; + struct vCHdmiCec_device_info_t* first_child; + struct vCHdmiCec_device_info_t* next_sibling; + + /*Device Information*/ + vCHdmiCec_device_type_t type; + vCHdmiCec_version_t version; + unsigned int physical_address; + unsigned int logical_address; + bool active_source; + unsigned int vendor_id; + unsigned short parent_port_id; + vCHdmiCec_power_status_t power_status; + char osd_name[MAX_OSD_NAME_LENGTH]; +} vCHdmiCec_device_info_t; + +typedef struct +{ + HdmiCecRxCallback_t rx_cb_func; + void* rx_cb_data; + HdmiCecTxCallback_t tx_cb_func; + void* tx_cb_data; +} vCHdmiCec_callbacks_t; + +typedef struct +{ + vCHdmiCec_hal_state_t state; + struct vCHdmiCec_device_info_t* emulated_device; + int num_ports; + vCHdmiCec_port_info_t *ports; + int num_devices; + struct vCHdmiCec_device_info_t* devices_map; + + vCHdmiCec_callbacks_t callbacks; + //TODO + // Eventing Queue, Thread for callback + +} vCHdmiCec_hal_t; + + +/**Virtual Componenent Data types*/ +typedef struct +{ + unsigned short cp_port; + char* cp_path; + vCHdmiCec_hal_t * cec_hal; +} vCHdmiCec_t; + +/*Common Data types*/ + +typedef struct +{ + char* str; + int val; +} strVal_t; + + +/*Global variables*/ +static vCHdmiCec_t* gVCHdmiCec = NULL; + +const static strVal_t gDIStrVal [] = { + { "TV", (int) DEVICE_TYPE_TV }, + { "PlaybackDevice", (int) DEVICE_TYPE_PLAYBACK }, + { "AudioSystem" , (int) DEVICE_TYPE_AUDIO_SYSTEM }, + { "RecordingDevice", (int) DEVICE_TYPE_RECORDER }, + { "Tuner", (int) DEVICE_TYPE_TUNER }, + { "Reserved", (int) DEVICE_TYPE_RESERVED }, + { "Unknown", (int) DEVICE_TYPE_UNKNOWN } +}; + +const static strVal_t gVCStrVal [] = { + {"TOSHIBA", VENDOR_CODE_TOSHIBA}, + {"SAMSUNG", VENDOR_CODE_SAMSUNG}, + {"DENON", VENDOR_CODE_DENON}, + {"MARANTZ", VENDOR_CODE_MARANTZ}, + {"LOEWE", VENDOR_CODE_LOEWE}, + {"ONKYO", VENDOR_CODE_ONKYO}, + {"MEDION", VENDOR_CODE_MEDION}, + {"TOSHIBA2", VENDOR_CODE_TOSHIBA}, + {"APPLE", VENDOR_CODE_APPLE}, + {"HARMAN_KARDON2", VENDOR_CODE_HARMAN_KARDON2}, + {"GOOGLE", VENDOR_CODE_GOOGLE}, + {"AKAI", VENDOR_CODE_AKAI}, + {"AOC", VENDOR_CODE_AOC}, + {"PANASONIC", VENDOR_CODE_PANASONIC}, + {"PHILIPS", VENDOR_CODE_PHILIPS}, + {"DAEWOO", VENDOR_CODE_DAEWOO}, + {"YAMAHA", VENDOR_CODE_YAMAHA}, + {"GRUNDIG", VENDOR_CODE_GRUNDIG}, + {"PIONEER", VENDOR_CODE_PIONEER}, + {"LG", VENDOR_CODE_LG}, + {"SHARP", VENDOR_CODE_SHARP}, + {"SONY", VENDOR_CODE_SONY}, + {"BROADCOM", VENDOR_CODE_BROADCOM}, + {"SHARP2", VENDOR_CODE_SHARP2}, + {"VIZIO", VENDOR_CODE_VIZIO}, + {"BENQ", VENDOR_CODE_BENQ}, + {"HARMAN_KARDON", VENDOR_CODE_HARMAN_KARDON}, + {"UNKNOWN", VENDOR_CODE_UNKNOWN}, + }; + +const static strVal_t gPSStrVal [] = { + { "on", (int)POWER_STATUS_ON }, + { "off", (int)POWER_STATUS_OFF }, + { "standby", (int)POWER_STATUS_STANDBY }, + { "unknown", (int)POWER_STATUS_UNKNOWN } +}; + +const static strVal_t gPortStrVal [] = { + { "in", (int)PORT_TYPE_INPUT }, + { "out", (int)PORT_TYPE_OUTPUT }, + { "unknown", (int)PORT_TYPE_UNKNOWN } +}; + +int GetValByStr(const strVal_t *map, int length, char* str, int default_val) +{ + int result = default_val; + + if(map == NULL || length <= 0 || str == NULL) + { + return result; + } + + for (int i = 0; i < length; ++i) + { + if (!strcmp(str, map[i].str)) + { + result = map[i].val; + break; + } + } + return result; +} + +char* GetStrByVal(const strVal_t *map, int length, int val) +{ + char* result = NULL; + + if(map == NULL || length <= 0) + { + return NULL; + } + + for (int i = 0; i < length; ++i) + { + if (val == (int)map[i].val) + { + result = map[i].str; + break; + } + } + return result; +} + + +void LoadPortsInfo (ut_kvp_instance_t* instance, vCHdmiCec_port_info_t* ports, unsigned int nPorts) +{ + char *prefix = "hdmicec/ports/"; + char tmp[256]; + + if (instance == NULL || ports == NULL || nPorts <= 0) + { + return; + } + + for (int i = 0; i < nPorts; ++i) + { + char type[8]; + strcpy(tmp, prefix); + int length = snprintf( NULL, 0, "%d", i ); + snprintf( tmp + strlen(prefix) , length + 1, "%d", i ); + + strcpy( tmp + strlen(prefix) + length , "/id"); + ports[i].id = ut_kvp_getUInt32Field(instance, tmp); + + strcpy(tmp + strlen(prefix) + length, "/type"); + ut_kvp_getStringField(instance, tmp, type, sizeof(type)); + ports[i].type = GetValByStr(gPortStrVal, sizeof(gPortStrVal)/sizeof(strVal_t), type, (int)PORT_TYPE_UNKNOWN); + + strcpy(tmp + strlen(prefix) + length, "/cec_supported"); + ports[i].cec_supported = ut_kvp_getBoolField(instance, tmp); + + strcpy(tmp + strlen(prefix) + length, "/arc_supported"); + ports[i].arc_supported = ut_kvp_getBoolField(instance, tmp); + + } +} + +void ResetDevice(struct vCHdmiCec_device_info_t* device) +{ + if(device == NULL) + { + assert(device != NULL); + return; + } + device->active_source = false; + device->logical_address = 0x0F; + device->physical_address = 0x0F; + device->parent = NULL; + device->first_child = NULL; + device->next_sibling = NULL; + device->vendor_id = 0; + device->number_children = 0; +} + +/* Load the device info into the passed in vCHdmiCec_device_info_t* +* prefix can be +* "hdmicec/device_map/0" +* "hdmicec/device_map/0/children/0" +* "hdmicec/device_map/0/children/1" +* "hdmicec/device_map/0/children/1/children/0" +*/ +void LoadDeviceInfo (ut_kvp_instance_t* instance, char* prefix, struct vCHdmiCec_device_info_t* device) +{ + char tmp[strlen(prefix) + 64]; + char type[32]; + + if (device == NULL || instance == NULL || prefix == NULL) + { + assert(device != NULL); + assert(instance != NULL); + assert(prefix != NULL); + return; + } + strcpy(tmp, prefix); + + strcpy(tmp + strlen(prefix), "/name"); + ut_kvp_getStringField(instance, tmp, device->osd_name, MAX_OSD_NAME_LENGTH); + + strcpy(tmp + strlen(prefix), "/active_source"); + device->active_source = ut_kvp_getBoolField(instance, tmp); + + strcpy(tmp + strlen(prefix), "/pwr_status"); + ut_kvp_getStringField(instance, tmp, type, sizeof(type)); + device->power_status = GetValByStr(gPSStrVal, sizeof(gPSStrVal)/sizeof(strVal_t), type, (int)POWER_STATUS_UNKNOWN); + + strcpy(tmp + strlen(prefix), "/version"); + device->version = (vCHdmiCec_version_t) ut_kvp_getUInt32Field(instance, tmp); + + strcpy(tmp + strlen(prefix), "/vendor"); + ut_kvp_getStringField(instance, tmp, type, sizeof(type)); + device->vendor_id = GetValByStr(gVCStrVal, sizeof(gVCStrVal)/sizeof(strVal_t), type, (int)VENDOR_CODE_UNKNOWN); + + strcpy(tmp + strlen(prefix), "/type"); + ut_kvp_getStringField(instance, tmp, type, sizeof(type)); + device->type = GetValByStr(gDIStrVal, sizeof(gDIStrVal)/sizeof(strVal_t), type, (int)DEVICE_TYPE_UNKNOWN); + + strcpy(tmp + strlen(prefix), "/port_id"); + device->parent_port_id = ut_kvp_getUInt32Field(instance, tmp); + + strcpy(tmp + strlen(prefix), "/number_children"); + device->number_children = (vCHdmiCec_version_t) ut_kvp_getUInt32Field(instance, tmp); +} + +void InsertChild(struct vCHdmiCec_device_info_t* parent, struct vCHdmiCec_device_info_t* child) +{ + if (parent == NULL || child == NULL) + { + assert(parent != NULL); + assert(child != NULL); + return; + } + + child->parent = parent; + if(parent->first_child == NULL) + { + parent->first_child = child; + } + else + { + child->next_sibling = parent->first_child; + parent->first_child = child; + } +} + +void RemoveChild(struct vCHdmiCec_device_info_t* map, char* name) +{ + struct vCHdmiCec_device_info_t* tmp; + struct vCHdmiCec_device_info_t* prev; + + if(map == NULL || name == NULL) + { + return; + } + if(map->first_child == NULL) + { + return; + } + + tmp = map->first_child; + prev = NULL; + + //Lets traverse to get to the device + while(tmp != NULL && strcmp(tmp->osd_name, name)!=0) + { + prev = tmp; + tmp = tmp->next_sibling; + } + + //We may have found the device + if(tmp == NULL) + { + //We didnt find a device with that name + return; + } + //We found the device. Lets adjust the map + if(prev == NULL) + { + //If this is the root device. + map->first_child = tmp->next_sibling; + } + else + { + prev->next_sibling = tmp->next_sibling; + } + free(tmp); +} + +struct vCHdmiCec_device_info_t* CreateDeviceMap (ut_kvp_instance_t* instance, char* profile_prefix) +{ + struct vCHdmiCec_device_info_t *device; + if(instance == NULL || profile_prefix == NULL ) + { + assert(instance != NULL); + assert(profile_prefix != NULL); + return NULL; + } + + device = (struct vCHdmiCec_device_info_t *)malloc(sizeof(struct vCHdmiCec_device_info_t)); + assert(device != NULL); + ResetDevice(device); + LoadDeviceInfo(instance, profile_prefix, device); + for(int j=0; j < device->number_children; j++) + { + char tmp[strlen(profile_prefix) + 128]; + strcpy(tmp, profile_prefix); + strcpy(tmp + strlen(profile_prefix), "/children/"); + int length = snprintf( NULL, 0, "%d", j ); + snprintf( tmp + strlen(tmp) , length + 1, "%d", j ); + + struct vCHdmiCec_device_info_t *child = CreateDeviceMap(instance, tmp); + assert(child != NULL); + InsertChild(device, child); + } + return device; + +} + +void AllocateAddresses(struct vCHdmiCec_device_info_t * map) +{ + if(map == NULL) + { + return; + } + //TODO + //map->physical_address = (((map->parent_port_id & 0xF0 ) << 20)|( (0x04 & 0x0F ) << 16) |((0x04 & 0xF0) << 4) | (0x04 & 0x0F)); +} + +void PrintDeviceMap(struct vCHdmiCec_device_info_t* map, int level) +{ + if(map == NULL) + { + return; + } + + VC_LOG(">>>>>>>>>>>> >>>>>>>>>> >>>>> >>>> >>> >> >"); + VC_LOG("%*cDevice : %s", level*4,' ', map->osd_name); + VC_LOG("%*cType : %s", level*4,' ', GetStrByVal(gDIStrVal, sizeof(gDIStrVal)/sizeof(strVal_t), map->type)); + VC_LOG("%*cPwr Status : %s", level*4,' ', GetStrByVal(gPSStrVal, sizeof(gPSStrVal)/sizeof(strVal_t), map->power_status)); + VC_LOG("-------------------------------------------"); + + PrintDeviceMap(map->first_child, level +1); + PrintDeviceMap(map->next_sibling, level); +} + +struct vCHdmiCec_device_info_t* GetDeviceByName(struct vCHdmiCec_device_info_t* map, char* name) +{ + struct vCHdmiCec_device_info_t* device; + if(map == NULL || name == NULL) + { + return NULL; + } + if(strcmp(map->osd_name, name) == 0) + { + return map; + } + device = GetDeviceByName(map->first_child, name); + if(device != NULL) + { + return device; + } + return GetDeviceByName(map->next_sibling, name); +} + +void DestroyDevicesMap(struct vCHdmiCec_device_info_t* map) +{ + if(map == NULL) + { + return; + } + + DestroyDevicesMap(map->first_child); + DestroyDevicesMap(map->next_sibling); + + free(map); +} + +void TeardownHal (vCHdmiCec_hal_t* hal) +{ + if(hal == NULL) + { + return; + } + + DestroyDevicesMap(hal->devices_map); + //Stop all events + //Exit Eventing + + if(hal->ports) + { + free (hal->ports); + } + hal->callbacks.rx_cb_func = NULL; + hal->callbacks.tx_cb_func = NULL; + free(hal); + +} + +vComponent_HdmiCec_Status vComponent_HdmiCec_Initialize( char* pProfilePath, unsigned short cpPort, char* pCPUrl, vComponent_HdmiCec_t** handle ) +{ + vCHdmiCec_t *result = NULL; + ut_kvp_status_t status; + + if(handle == NULL) + { + VC_LOG_ERROR("vComponent_HdmiCec_Initialize: Invalid handle param"); + return VC_HDMICEC_STATUS_INVALID_PARAM; + } + if(pProfilePath == NULL) + { + VC_LOG_ERROR("vComponent_HdmiCec_Initialize: Invalid Profile path"); + return VC_HDMICEC_STATUS_INVALID_PARAM; + } + + if(gVCHdmiCec != NULL) + { + //Already initialised + VC_LOG_ERROR("vComponent_HdmiCec_Initialize: Already Initialized"); + return VC_HDMICEC_STATUS_ALREADY_INITIALIZED; + } + + result = (vCHdmiCec_t*)malloc(sizeof(vCHdmiCec_t)); + if(result == NULL) + { + VC_LOG_ERROR("vComponent_HdmiCec_Initialize: Out of memory"); + return VC_HDMICEC_STATUS_OUT_OF_MEMORY; + } + result->cp_path = pCPUrl; + result->cp_port = cpPort; + result->cec_hal = NULL; + + status = ut_kvp_profile_open(pProfilePath); + if(status != UT_KVP_STATUS_SUCCESS) + { + VC_LOG_ERROR("ut_kvp_profile_open: status: %d", status); + assert(status == UT_KVP_STATUS_SUCCESS); + free(result); + return VC_HDMICEC_STATUS_PROFILE_READ_ERROR; + } + + //TODO Control Plane init + gVCHdmiCec = result; + *handle = (vComponent_HdmiCec_t *)result; + return VC_HDMICEC_STATUS_SUCCESS; +} + +vComponent_HdmiCec_Status vComponent_HdmiCec_Deinitialize(vComponent_HdmiCec_t *pVCHdmiCec) +{ + vCHdmiCec_t* vCHdmiCec = (vCHdmiCec_t*)pVCHdmiCec; + + if(vCHdmiCec == NULL) + { + VC_LOG_ERROR("vComponent_HdmiCec_Deinitialize: Invalid handle param"); + return VC_HDMICEC_STATUS_INVALID_PARAM; + } + + if(vCHdmiCec != gVCHdmiCec) + { + VC_LOG_ERROR("vComponent_HdmiCec_Deinitialize: Invalid handle"); + return VC_HDMICEC_STATUS_INVALID_HANDLE; + } + + if(gVCHdmiCec == NULL) + { + VC_LOG_ERROR("vComponent_HdmiCec_Deinitialize: Already Deinitialized"); + return VC_HDMICEC_STATUS_NOT_INITIALIZED; + } + + //Should we enforce HdmiCecClose to be called before? + if(vCHdmiCec->cec_hal != NULL && vCHdmiCec->cec_hal->state != HAL_STATE_CLOSED) + { + HdmiCecClose((int)vCHdmiCec->cec_hal); + } + ut_kvp_profile_close(); + free(vCHdmiCec); + gVCHdmiCec = NULL; + return VC_HDMICEC_STATUS_SUCCESS; +} + +HDMI_CEC_STATUS HdmiCecOpen(int* handle) +{ + char emulated_device[MAX_OSD_NAME_LENGTH]; + vCHdmiCec_hal_t* cec; + ut_kvp_instance_t *profile_instance; + vCHdmiCec_port_info_t* ports; + + if(handle == NULL) + { + return HDMI_CEC_IO_INVALID_HANDLE; + } + + if(gVCHdmiCec == NULL) + { + return HDMI_CEC_IO_NOT_OPENED; + } + + if(gVCHdmiCec->cec_hal != NULL) + { + return HDMI_CEC_IO_ALREADY_OPEN; + } + + cec = (vCHdmiCec_hal_t*)malloc(sizeof(vCHdmiCec_hal_t)); + if(cec == NULL) + { + VC_LOG_ERROR( "HdmiCecOpen: Out of Memory" ); + return HDMI_CEC_IO_GENERAL_ERROR; + } + + profile_instance = ut_kvp_profile_getInstance(); + assert(profile_instance != NULL); + + ut_kvp_getStringField(profile_instance, "hdmicec/emulated_device", emulated_device, MAX_OSD_NAME_LENGTH); + + cec->num_ports = ut_kvp_getUInt32Field(profile_instance, "hdmicec/number_ports"); + ports = (vCHdmiCec_port_info_t*) malloc(sizeof(vCHdmiCec_port_info_t) * cec->num_ports); + assert(ports != NULL); + + LoadPortsInfo(profile_instance, ports, cec->num_ports); + cec->ports = ports; + + //Setup Eventing and callback + + //Device Discovery and Network Topology + cec->num_devices = ut_kvp_getUInt32Field(profile_instance, "hdmicec/number_devices"); + + cec->devices_map = CreateDeviceMap(profile_instance, "hdmicec/device_map/0"); + cec->emulated_device = GetDeviceByName(cec->devices_map, emulated_device); + if(cec->emulated_device == NULL) + { + VC_LOG_ERROR("HdmiCecOpen: Couldnt load emulated device info"); + assert(cec->emulated_device != NULL); + TeardownHal(cec); + return HDMI_CEC_IO_GENERAL_ERROR; + } + if(cec->emulated_device->type == DEVICE_TYPE_TV) + { + VC_LOG("HdmiCecOpen: Emulating a TV"); + cec->emulated_device->physical_address = 0; + cec->emulated_device->logical_address = 0x0F; + } + else + { + VC_LOG("HdmiCecOpen: Emulating a Source device"); + //TODO Auto Allocate Logical addresses + } + + VC_LOG(">>>>>>> >>>>> >>>> >> >> >"); + VC_LOG("Emulated Device : %s", cec->emulated_device->osd_name); + VC_LOG("Type : %s", GetStrByVal(gDIStrVal, sizeof(gDIStrVal)/sizeof(strVal_t), cec->emulated_device->type)); + VC_LOG("Pwr Status : %s", GetStrByVal(gPSStrVal, sizeof(gPSStrVal)/sizeof(strVal_t), cec->emulated_device->power_status)); + VC_LOG("Number of Ports : %d", cec->num_ports); + VC_LOG("Number of devices in Network : %d", cec->num_devices); + VC_LOG("==========================="); + + PrintDeviceMap(cec->devices_map, 0); + VC_LOG("================================="); + + *handle = (int) cec; + gVCHdmiCec->cec_hal = cec; + cec->state = HAL_STATE_READY; + + return HDMI_CEC_IO_SUCCESS; +} + +HDMI_CEC_STATUS HdmiCecClose(int handle) +{ + + if(gVCHdmiCec == NULL || gVCHdmiCec->cec_hal == NULL) + { + VC_LOG_ERROR("HdmiCecClose: Not Opened"); + return HDMI_CEC_IO_NOT_OPENED; + } + + if(handle == 0) + { + VC_LOG_ERROR("HdmiCecClose: Invalid Handle"); + return HDMI_CEC_IO_INVALID_HANDLE; + } + + TeardownHal(gVCHdmiCec->cec_hal); + gVCHdmiCec->cec_hal = NULL; + + return HDMI_CEC_IO_SUCCESS; +} + + +HDMI_CEC_STATUS HdmiCecGetPhysicalAddress(int handle, unsigned int* physicalAddress) +{ + + if(gVCHdmiCec == NULL || gVCHdmiCec->cec_hal == NULL) + { + VC_LOG_ERROR("HdmiCecGetPhysicalAddress: Not Opened"); + return HDMI_CEC_IO_NOT_OPENED; + } + + if(handle == 0) + { + VC_LOG_ERROR("HdmiCecGetPhysicalAddress: Invalid handle"); + return HDMI_CEC_IO_INVALID_HANDLE; + } + + + if(physicalAddress == NULL) + { + VC_LOG_ERROR("HdmiCecGetPhysicalAddress: Invalid Argument"); + return HDMI_CEC_IO_INVALID_ARGUMENT; + } + + *physicalAddress = gVCHdmiCec->cec_hal->emulated_device->physical_address; + return HDMI_CEC_IO_SUCCESS; +} + +HDMI_CEC_STATUS HdmiCecAddLogicalAddress(int handle, int logicalAddresses) +{ + if(gVCHdmiCec == NULL || gVCHdmiCec->cec_hal == NULL) + { + VC_LOG_ERROR("HdmiCecAddLogicalAddress: Not Opened"); + return HDMI_CEC_IO_NOT_OPENED; + } + + if(handle == 0) + { + VC_LOG_ERROR("HdmiCecAddLogicalAddress: Invalid handle"); + return HDMI_CEC_IO_INVALID_HANDLE; + } + + + if(gVCHdmiCec->cec_hal->emulated_device->type != DEVICE_TYPE_TV || logicalAddresses != 0) + { + VC_LOG_ERROR("HdmiCecAddLogicalAddress: Invalid Argument"); + return HDMI_CEC_IO_INVALID_ARGUMENT; + } + + //ADD Logical Address only for Sink device + gVCHdmiCec->cec_hal->emulated_device->logical_address = logicalAddresses; + + return HDMI_CEC_IO_SUCCESS; +} + +HDMI_CEC_STATUS HdmiCecRemoveLogicalAddress(int handle, int logicalAddresses) +{ + + if(gVCHdmiCec == NULL || gVCHdmiCec->cec_hal == NULL) + { + VC_LOG_ERROR("HdmiCecRemoveLogicalAddress: Not Opened"); + return HDMI_CEC_IO_NOT_OPENED; + } + + if(handle == 0) + { + VC_LOG_ERROR("HdmiCecRemoveLogicalAddress: Invalid handle"); + return HDMI_CEC_IO_INVALID_HANDLE; + } + + + //Remove Logical Address only for Sink device + if(gVCHdmiCec->cec_hal->emulated_device->type != DEVICE_TYPE_TV || logicalAddresses != 0) + { + VC_LOG_ERROR("HdmiCecRemoveLogicalAddress: Invalid Argument"); + return HDMI_CEC_IO_INVALID_ARGUMENT; + } + + if(gVCHdmiCec->cec_hal->emulated_device->logical_address == 0x0F) + { + //Looks like logical address is already removed. + VC_LOG_ERROR("HdmiCecRemoveLogicalAddress: Logical Address not added"); + return HDMI_CEC_IO_NOT_ADDED; + } + //Reset back to 0x0F + gVCHdmiCec->cec_hal->emulated_device->logical_address = 0x0F; + + return HDMI_CEC_IO_SUCCESS; +} + +HDMI_CEC_STATUS HdmiCecGetLogicalAddress(int handle, int* logicalAddress) +{ + if(gVCHdmiCec == NULL || gVCHdmiCec->cec_hal == NULL) + { + VC_LOG_ERROR("HdmiCecGetLogicalAddress: Not Opened"); + return HDMI_CEC_IO_NOT_OPENED; + } + + if(handle == 0) + { + VC_LOG_ERROR("HdmiCecGetLogicalAddress: Invalid handle"); + return HDMI_CEC_IO_INVALID_HANDLE; + } + + if(logicalAddress == NULL) + { + VC_LOG_ERROR("HdmiCecGetLogicalAddress: Invalid Argument"); + return HDMI_CEC_IO_INVALID_ARGUMENT; + } + + *logicalAddress = gVCHdmiCec->cec_hal->emulated_device->logical_address; + + return HDMI_CEC_IO_SUCCESS; +} + +HDMI_CEC_STATUS HdmiCecSetRxCallback(int handle, HdmiCecRxCallback_t cbfunc, void* data) +{ + if(gVCHdmiCec == NULL || gVCHdmiCec->cec_hal == NULL) + { + VC_LOG_ERROR("HdmiCecSetRxCallback: Not Opened"); + return HDMI_CEC_IO_NOT_OPENED; + } + + if(handle == 0) + { + VC_LOG_ERROR("HdmiCecSetRxCallback: Invalid handle"); + return HDMI_CEC_IO_INVALID_HANDLE; + } + + + gVCHdmiCec->cec_hal->callbacks.rx_cb_func = cbfunc; + gVCHdmiCec->cec_hal->callbacks.rx_cb_data = data; + + return HDMI_CEC_IO_SUCCESS; +} + +HDMI_CEC_STATUS HdmiCecSetTxCallback(int handle, HdmiCecTxCallback_t cbfunc, void* data) +{ + if(gVCHdmiCec == NULL || gVCHdmiCec->cec_hal == NULL) + { + VC_LOG_ERROR("HdmiCecSetTxCallback: Not Opened"); + return HDMI_CEC_IO_NOT_OPENED; + } + + if(handle == 0) + { + VC_LOG_ERROR("HdmiCecSetTxCallback: Invalid handle"); + return HDMI_CEC_IO_INVALID_HANDLE; + } + + gVCHdmiCec->cec_hal->callbacks.tx_cb_func = cbfunc; + gVCHdmiCec->cec_hal->callbacks.tx_cb_data = data; + return HDMI_CEC_IO_SUCCESS; +} + +HDMI_CEC_STATUS HdmiCecTx(int handle, const unsigned char* buf, int len, int* result) +{ + if(gVCHdmiCec == NULL || gVCHdmiCec->cec_hal == NULL) + { + VC_LOG_ERROR("HdmiCecTx: Not Opened"); + return HDMI_CEC_IO_NOT_OPENED; + } + + if(handle == 0) + { + VC_LOG_ERROR("HdmiCecTx: Invalid handle"); + return HDMI_CEC_IO_INVALID_HANDLE; + } + + + if(buf == NULL || len <= 0 || result == NULL) + { + VC_LOG_ERROR("HdmiCecTx: Invalid Argument"); + return HDMI_CEC_IO_INVALID_ARGUMENT; + } + + if(gVCHdmiCec->cec_hal->emulated_device->type == DEVICE_TYPE_TV && gVCHdmiCec->cec_hal->emulated_device->logical_address == 0x0F) + { + //If Logical Address is not set for a sink device, we cannot transmit + VC_LOG_ERROR("HdmiCecTx: Send failed"); + return HDMI_CEC_IO_SENT_FAILED; + } + + VC_LOG(">>>>>>> >>>>> >>>> >> >> >"); + VC_LOG("HdmiCecTx: "); + for (int i = 0; i < len; i++) { + printf("%02X ", buf[i]); + } + VC_LOG("=========================="); + *result = HDMI_CEC_IO_SENT_BUT_NOT_ACKD; + + + return HDMI_CEC_IO_SUCCESS; +} + +HDMI_CEC_STATUS HdmiCecTxAsync(int handle, const unsigned char* buf, int len) +{ + if(gVCHdmiCec == NULL || gVCHdmiCec->cec_hal == NULL) + { + VC_LOG_ERROR("HdmiCecTxAsync: Not Opened"); + return HDMI_CEC_IO_NOT_OPENED; + } + + if(handle == 0) + { + VC_LOG_ERROR("HdmiCecTxAsync: Invalid handle"); + return HDMI_CEC_IO_INVALID_HANDLE; + } + + + if(buf == NULL || len <= 0) + { + VC_LOG_ERROR("HdmiCecTxAsync: Invalid Argument"); + return HDMI_CEC_IO_INVALID_ARGUMENT; + } + + if((gVCHdmiCec->cec_hal->emulated_device->type == DEVICE_TYPE_TV && gVCHdmiCec->cec_hal->emulated_device->logical_address == 0x0F) + || gVCHdmiCec->cec_hal->callbacks.tx_cb_func == NULL) + { + //If Logical Address is not set for a sink device, we cannot transmit + VC_LOG_ERROR("HdmiCecTxAsync: Send failed"); + return HDMI_CEC_IO_SENT_FAILED; + } + + VC_LOG(">>>>>>> >>>>> >>>> >> >> >"); + VC_LOG("HdmiCecTxAsync: "); + for (int i = 0; i < len; i++) { + printf("%02X ", buf[i]); + } + VC_LOG("=========================="); + + return HDMI_CEC_IO_SUCCESS; +} + From cdf575c94eec065f50b1a6372b21f88b97fede04 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Wed, 12 Jun 2024 16:03:24 -0400 Subject: [PATCH 12/48] Update based on review comments --- docs/pages/hdmi_cec_source_tests.md | 30 ++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_tests.md index 21db17c..0fb4d55 100644 --- a/docs/pages/hdmi_cec_source_tests.md +++ b/docs/pages/hdmi_cec_source_tests.md @@ -19,8 +19,8 @@ - `HDMI` - High Definition Multimedia Interface - `L2` - Level 2 Testing () - `L3` - Level 3 Testing () -- `Sink device` - Any piece of equipment or technology that provides an input signal or data to another device or system. -- `Source Device` - Any piece of equipment or technology that receives an input signal or data from another device or system. +- `Sink device` - Any piece of equipment or technology that receives an input signal or data from another device or system. +- `Source Device` - Any piece of equipment or technology that provides an input signal or data to another device or system. ## Scope @@ -39,6 +39,10 @@ The HAL layers within RDK serve as a bridge between the underlying low-level SoC - Get Physical address - Syncronous transmission, and communicating via hotplug connectivity +Interface of the test is available here: [Hdmicec HAL header](https://github.com/rdkcentral/rdk-halif-hdmi_cec/blob/main/include/hdmi_cec_driver.h) + +The Hdmicec Hal Spec document: [Hdmicec HAL Spec](https://github.com/rdkcentral/rdk-halif-hdmi_cec/blob/main/docs/pages/hdmi-cec_halSpec.md) + ## Test scenarios The HAL CEC layer facilitates the transmission and reception of CEC information on the CEC bus. It does not handle any specific opcode commands, nor does it validate supported HAL CEC opcodes for sending or receiving. @@ -66,6 +70,7 @@ It is the responsibility of the caller to manage the opcodes. The current test c - Boot with control configuration with various configurations having a predefined set of nodes: - configuration to support the discovery of logical addresses. The caller to provide a create a proper logical address during Open and that should be provided when HDMICECGetLogicaladdress is used. - Verify for the valid logical address and return the appropriate error code based on the logical address availability. + - Emulator should simulate the logical address that a source device can provide. ### Control Plane Requirements @@ -75,9 +80,10 @@ It is the responsibility of the caller to manage the opcodes. The current test c ## Physical Address -|S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| -|-----|------------------|-----------|--------|--|--|--------------------------| -| 2| [Physical Address](#physical-address)| Enable the television connected to the DUT first to get the valid physical address allocated through the HAL function.|HdmiCecGetPhysicalAddress| Y |NA|| +|Description|HAL APIs|L2|L3|Control plane requirements| +|-----------|--------|--|--|--------------------------| +| Get the valid physical address allocated through the HAL function when there is no sink device connected. |HdmiCecGetPhysicalAddress| Y |NA|| +| Enable a sink device connected to the DUT first to get the valid physical address allocated through the HAL function.|HdmiCecGetPhysicalAddress| N |Y|| | | | Verify the physical addresses allocated by connecting a source and sink device through an HDMI switch.| HdmiCecGetPhysicalAddress| NA | Y | Enable the television connected to `DUT` to declare its physical address first before `DUT`.| ### Emulator Requirements - Physical Address @@ -93,12 +99,14 @@ It is the responsibility of the caller to manage the opcodes. The current test c ## CEC Synchronous Transmission -|S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| -|-----|------------------|-----------|--------|--|--|--------------------------| -| 3| [CEC Transmission](#cec-transmission)| Verify the correct transmission of the supported CEC commands (as per 1.4b HDMI CEC spec) to the connected device and ensure it is acknowledged properly.| HdmiCecTx | NA | Y |Control plane to switch ON a CEC-supported device on the HDMI network so that it shall respond to the basic commands| -| | | Broadcast a supported CEC Command to all the devices connected to the network without any error |HdmiCecTx| NA | Y |Control plane to switch ON a CEC-supported device on the HDMI network to act on the broadcasted command| -| | | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitoring the behaviour of the connected device accordingly.| HdmiCecTx | NA | Y | Control plane to monitor the behaviour of the connected devices. | -| | | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for a logical address that doesn't exist.| HdmiCecTx | Y | NA | Control plane can unplug or switch off a previously existing CEC device | +|Description|HAL APIs|L2|L3|Control plane requirements| +|-----------|--------|--|--|--------------------------| +| Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for a logical address that doesn't exist. Result should return HDMI_CEC_IO_SENT_BUT_NOT_ACKD. | HdmiCecTx | Y | NA | Control plane can unplug or switch off a previously existing CEC device | +| Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for supported CEC commands (as per 1.4b HDMI CEC spec). Result should return HDMI_CEC_IO_SENT_BUT_NOT_ACKD. | HdmiCecTx | Y | NA | Control plane can unplug or switch off a previously existing CEC device | +| Verify the correct transmission of the supported CEC commands (as per 1.4b HDMI CEC spec) to the connected device and ensure it is acknowledged properly. Result should return HDMI_CEC_IO_SENT_AND_ACKD.| HdmiCecTx | NA | Y |Control plane to switch ON a CEC-supported device on the HDMI network so that it shall respond to the basic commands| +| Broadcast a supported CEC Command to all the devices connected to the network without any error. Result should return HDMI_CEC_IO_SENT_AND_ACKD |HdmiCecTx| NA | Y |Control plane to switch ON a CEC-supported device on the HDMI network to act on the broadcasted command| +| Transmit a CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitoring the behaviour of the connected device accordingly. Result should return HDMI_CEC_IO_SENT_AND_ACKD.| HdmiCecTx | NA | Y | Control plane to monitor the behaviour of the connected devices. | + ### Emulator Requirements - CEC Transmission - Boot configuration From aecf4f651bee65364c89f08573f6a52495a753cf Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 13 Jun 2024 10:50:28 -0400 Subject: [PATCH 13/48] Update based on review comments --- docs/pages/hdmi_cec_source_tests.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_tests.md index 0fb4d55..625b50c 100644 --- a/docs/pages/hdmi_cec_source_tests.md +++ b/docs/pages/hdmi_cec_source_tests.md @@ -61,9 +61,10 @@ It is the responsibility of the caller to manage the opcodes. The current test c ## Logical Address Discovery -|S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| +|Description|HAL APIs|L2|L3|Control plane requirements| |-----|------------------|-----------|--------|--|--|--------------------------| -| 1 |[Logical address](#logical-address-discovery)|Get the logical address discovered during cec open and validate the address for a proper playback/tuner device. This will add the logical address, as per source functionality. |HdmiCecGetLogicalAddress|Y|NA +|Get the logical address discovered during cec open and validate the address for a proper playback/tuner device. This will add the logical address, as per source functionality. As the connected device will be a playback device, the valid logical address would be 4, 8, 11, and 14. |HdmiCecGetLogicalAddress|N|Y +|Connect 5 playback devices using a switch, and attempt to discover a logical address with the fifth device, which exceeds number of logical ports for playback devices. |HdmiCecGetLogicalAddress|N|Y ### Emulator Requirements @@ -76,6 +77,7 @@ It is the responsibility of the caller to manage the opcodes. The current test c - The control plane will allow removing or adding a node to the network. - allowing adding/removing source node + - allow the use of multiple source nodes - Support the CEC commands from the external devices on L3 Test Cases. ## Physical Address From dd8a3d41ec1100206adede00e0b65d4673e01da7 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 13 Jun 2024 13:53:37 -0400 Subject: [PATCH 14/48] Update based on review discussion --- docs/pages/hdmi_cec_source_tests.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_tests.md index 625b50c..fb03344 100644 --- a/docs/pages/hdmi_cec_source_tests.md +++ b/docs/pages/hdmi_cec_source_tests.md @@ -62,14 +62,16 @@ It is the responsibility of the caller to manage the opcodes. The current test c ## Logical Address Discovery |Description|HAL APIs|L2|L3|Control plane requirements| -|-----|------------------|-----------|--------|--|--|--------------------------| -|Get the logical address discovered during cec open and validate the address for a proper playback/tuner device. This will add the logical address, as per source functionality. As the connected device will be a playback device, the valid logical address would be 4, 8, 11, and 14. |HdmiCecGetLogicalAddress|N|Y -|Connect 5 playback devices using a switch, and attempt to discover a logical address with the fifth device, which exceeds number of logical ports for playback devices. |HdmiCecGetLogicalAddress|N|Y +|-----------|--------|--|--|--------------------------| +|Get the logical address discovered during cec open and validate the address for a proper playback/tuner device when there is sink device connected to the source device. It should return HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE. |HdmiCecOpen|Y|N| +|Get the logical address discovered during cec open and validate the address for a proper playback/tuner device. This will add the logical address, as per source functionality. As the connected device will be a playback device, the valid logical address would be 4, 8, and 11. |HdmiCecOpen|N|Y| +|Connect 5 playback devices using a switch, and attempt to discover a logical address with the fifth device, which exceeds number of logical ports for playback devices. |HdmiCecOpen|N|Y| +|Rapidly connect and disconnect HDMI connection in 100ms connection and 100ms disconnection cycle.|HdmiCecOpen|N|Y| ### Emulator Requirements - Boot with control configuration with various configurations having a predefined set of nodes: - - configuration to support the discovery of logical addresses. The caller to provide a create a proper logical address during Open and that should be provided when HDMICECGetLogicaladdress is used. + - configuration to support the discovery of logical addresses. The caller to provide a create a proper logical address during Open and that should be provided when HdmiCecOpen is used. - Verify for the valid logical address and return the appropriate error code based on the logical address availability. - Emulator should simulate the logical address that a source device can provide. @@ -77,6 +79,7 @@ It is the responsibility of the caller to manage the opcodes. The current test c - The control plane will allow removing or adding a node to the network. - allowing adding/removing source node + - Allow adding/removing of sink node - allow the use of multiple source nodes - Support the CEC commands from the external devices on L3 Test Cases. @@ -84,9 +87,11 @@ It is the responsibility of the caller to manage the opcodes. The current test c |Description|HAL APIs|L2|L3|Control plane requirements| |-----------|--------|--|--|--------------------------| -| Get the valid physical address allocated through the HAL function when there is no sink device connected. |HdmiCecGetPhysicalAddress| Y |NA|| -| Enable a sink device connected to the DUT first to get the valid physical address allocated through the HAL function.|HdmiCecGetPhysicalAddress| N |Y|| -| | | Verify the physical addresses allocated by connecting a source and sink device through an HDMI switch.| HdmiCecGetPhysicalAddress| NA | Y | Enable the television connected to `DUT` to declare its physical address first before `DUT`.| +| Enable a sink device connected to the DUT first to get the valid physical address allocated through the HAL function. The physical address should be 1.0.0.0|HdmiCecGetPhysicalAddress| N |Y|| +|Verify the physical addresses allocated by connecting a source and sink device through an HDMI switch. The physical address should 1.1.0.0| HdmiCecGetPhysicalAddress| NA | Y | Enable the television connected to `DUT` to declare its physical address first before `DUT`.|| +| Connect a sink device to the source device, get the physical address. Disconnect the sink device and attempt to get the physical address again|HdmiCecGetPhysicalAddress| N |Y|| + +@note Calling HdmiCecGetPhysicalAddress when before there is no device connected is not a valid test because HdmiCecOpen has not initiated. ### Emulator Requirements - Physical Address @@ -103,8 +108,8 @@ It is the responsibility of the caller to manage the opcodes. The current test c |Description|HAL APIs|L2|L3|Control plane requirements| |-----------|--------|--|--|--------------------------| -| Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for a logical address that doesn't exist. Result should return HDMI_CEC_IO_SENT_BUT_NOT_ACKD. | HdmiCecTx | Y | NA | Control plane can unplug or switch off a previously existing CEC device | -| Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for supported CEC commands (as per 1.4b HDMI CEC spec). Result should return HDMI_CEC_IO_SENT_BUT_NOT_ACKD. | HdmiCecTx | Y | NA | Control plane can unplug or switch off a previously existing CEC device | +| Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for a logical address that doesn't exist after the connected device is disconnected. Result should return HDMI_CEC_IO_SENT_BUT_NOT_ACKD. | HdmiCecTx | N | Y | Control plane can unplug or switch off a previously existing CEC device | +| Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for supported CEC commands (as per 1.4b HDMI CEC spec) after the connected device is disconnected. Result should return HDMI_CEC_IO_SENT_BUT_NOT_ACKD. | HdmiCecTx | N | Y | Control plane can unplug or switch off a previously existing CEC device | | Verify the correct transmission of the supported CEC commands (as per 1.4b HDMI CEC spec) to the connected device and ensure it is acknowledged properly. Result should return HDMI_CEC_IO_SENT_AND_ACKD.| HdmiCecTx | NA | Y |Control plane to switch ON a CEC-supported device on the HDMI network so that it shall respond to the basic commands| | Broadcast a supported CEC Command to all the devices connected to the network without any error. Result should return HDMI_CEC_IO_SENT_AND_ACKD |HdmiCecTx| NA | Y |Control plane to switch ON a CEC-supported device on the HDMI network to act on the broadcasted command| | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitoring the behaviour of the connected device accordingly. Result should return HDMI_CEC_IO_SENT_AND_ACKD.| HdmiCecTx | NA | Y | Control plane to monitor the behaviour of the connected devices. | From d8587f51cceb8b1c30eca82401d1c21f4c682156 Mon Sep 17 00:00:00 2001 From: srinivasgtl <71806084+srinivasgtl@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:01:48 +0100 Subject: [PATCH 15/48] gh #24 Update the L2 test case description. Updated the L2 case description Update a few spell and grammar corrections. --- docs/pages/hdmi_cec_source_tests.md | 63 +++++++++++++++-------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_tests.md index fb03344..689c7e5 100644 --- a/docs/pages/hdmi_cec_source_tests.md +++ b/docs/pages/hdmi_cec_source_tests.md @@ -14,13 +14,14 @@ ## Acronyms, Terms and Abbreviations -- `CEC` - Consumer Electronics Control -- `HAL` - Hardware Abstraction layer +- `CEC` - Consumer Electronics Control +- `HAL` - Hardware Abstraction layer - `HDMI` - High Definition Multimedia Interface -- `L2` - Level 2 Testing () -- `L3` - Level 3 Testing () -- `Sink device` - Any piece of equipment or technology that receives an input signal or data from another device or system. -- `Source Device` - Any piece of equipment or technology that provides an input signal or data to another device or system. +- `L2` - Level 2 Testing () +- `L3` - Level 3 Testing () +- `DUT` - Device Under Test +- `Sink device` - An equipment or technology that receives an input signal or data from another device or system. +- `Source Device` - An equipment or technology that provides an input signal or data to another device or system. ## Scope @@ -35,11 +36,11 @@ Consumer Electronics Control (CEC) is a single-wire bidirectional bus within an The HAL layers within RDK serve as a bridge between the underlying low-level SoC drivers and the higher-level RDK layers that utilize the functionality offered by these HAL functions. Specifically concerning the CEC Module, the HAL layers facilitate the following functionalities: - Logical Address discovery -- Get Logical address -- Get Physical address -- Syncronous transmission, and communicating via hotplug connectivity +- Get a Logical address +- Get a Physical address +- Synchronous transmission, and communication via hotplug connectivity -Interface of the test is available here: [Hdmicec HAL header](https://github.com/rdkcentral/rdk-halif-hdmi_cec/blob/main/include/hdmi_cec_driver.h) +The interface of the test is available here: [Hdmicec HAL header](https://github.com/rdkcentral/rdk-halif-hdmi_cec/blob/main/include/hdmi_cec_driver.h) The Hdmicec Hal Spec document: [Hdmicec HAL Spec](https://github.com/rdkcentral/rdk-halif-hdmi_cec/blob/main/docs/pages/hdmi-cec_halSpec.md) @@ -47,11 +48,11 @@ The Hdmicec Hal Spec document: [Hdmicec HAL Spec](https://github.com/rdkcentral/ The HAL CEC layer facilitates the transmission and reception of CEC information on the CEC bus. It does not handle any specific opcode commands, nor does it validate supported HAL CEC opcodes for sending or receiving. -It is the responsibility of the caller to manage the opcodes. The current test cases will verify responses from connected devices for a subset of opcodes as part of the testing process. +The caller is responsible for managing the opcodes. The current test cases will verify responses from connected devices for a subset of opcodes as part of the testing process. |S.No.|Test Functionality|Description| |-----|------------------|-----------| -| 1 |[Logical address](#logical-address-discovery)|Facilitating the Discovery of logical addresses getting logical address of the device (for source devices) | +| 1 |[Logical address](#logical-address-discovery)|Facilitating the Discovery of logical addresses by getting the logical address of the device (for source devices) | | 2| [Physical Address](#physical-address)| Retrieving the physical address | | 3| [CEC Synchronous Transmission](#cec-synchronous-transmission)| Transmitting CEC frames and reporting on their acknowledgement | | 4| [CEC Receive functionality](#cec-receive-functionality)| Receiving CEC information from other devices and passing it to the layer above through a registered callback function | @@ -63,17 +64,17 @@ It is the responsibility of the caller to manage the opcodes. The current test c |Description|HAL APIs|L2|L3|Control plane requirements| |-----------|--------|--|--|--------------------------| -|Get the logical address discovered during cec open and validate the address for a proper playback/tuner device when there is sink device connected to the source device. It should return HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE. |HdmiCecOpen|Y|N| -|Get the logical address discovered during cec open and validate the address for a proper playback/tuner device. This will add the logical address, as per source functionality. As the connected device will be a playback device, the valid logical address would be 4, 8, and 11. |HdmiCecOpen|N|Y| -|Connect 5 playback devices using a switch, and attempt to discover a logical address with the fifth device, which exceeds number of logical ports for playback devices. |HdmiCecOpen|N|Y| -|Rapidly connect and disconnect HDMI connection in 100ms connection and 100ms disconnection cycle.|HdmiCecOpen|N|Y| +|Trying to get a logical address discovered during CEC open, and validate the return value when the `DUT` is not connected to a Sink device. It should return HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE.|HdmiCecOpen|Y|N| +|Get the logical address discovered during CEC open and validate the address for a proper playback/tuner device. This will add the logical address, as per source functionality. As the connected device will be a playback device, the valid logical address would be 4, 8, and 11. |HdmiCecOpen HdmiCecGetLogicalAddress|N|Y| +|Connect 5 playback devices using a switch, and attempt to discover a logical address with the fifth device, which exceeds the number of logical ports for playback devices. It should return HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE|HdmiCecOpen|N|Y| +|Rapidly connect and disconnect HDMI connection in 100ms connection and 100ms disconnection cycle.|HdmiCecOpen HdmiCecGetLogicalAddress|N|Y| ### Emulator Requirements - Boot with control configuration with various configurations having a predefined set of nodes: - - configuration to support the discovery of logical addresses. The caller to provide a create a proper logical address during Open and that should be provided when HdmiCecOpen is used. + - configuration to support the discovery of logical addresses. The caller creates a proper logical address during Open and that should be provided when HdmiCecOpen is used. - Verify for the valid logical address and return the appropriate error code based on the logical address availability. - - Emulator should simulate the logical address that a source device can provide. + - The emulator should simulate the logical address that a source device can provide. ### Control Plane Requirements @@ -88,10 +89,10 @@ It is the responsibility of the caller to manage the opcodes. The current test c |Description|HAL APIs|L2|L3|Control plane requirements| |-----------|--------|--|--|--------------------------| | Enable a sink device connected to the DUT first to get the valid physical address allocated through the HAL function. The physical address should be 1.0.0.0|HdmiCecGetPhysicalAddress| N |Y|| -|Verify the physical addresses allocated by connecting a source and sink device through an HDMI switch. The physical address should 1.1.0.0| HdmiCecGetPhysicalAddress| NA | Y | Enable the television connected to `DUT` to declare its physical address first before `DUT`.|| +|Verify the physical addresses allocated by connecting a source and sink device through an HDMI switch. The physical address should 1.1.0.0| HdmiCecGetPhysicalAddress| N | Y | Enable the television connected to `DUT` to declare its physical address first before `DUT`.|| | Connect a sink device to the source device, get the physical address. Disconnect the sink device and attempt to get the physical address again|HdmiCecGetPhysicalAddress| N |Y|| -@note Calling HdmiCecGetPhysicalAddress when before there is no device connected is not a valid test because HdmiCecOpen has not initiated. +@note Calling HdmiCecGetPhysicalAddress when no device is connected to `DUT` is not a valid test because HdmiCecOpen has not been initiated. ### Emulator Requirements - Physical Address @@ -110,9 +111,9 @@ It is the responsibility of the caller to manage the opcodes. The current test c |-----------|--------|--|--|--------------------------| | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for a logical address that doesn't exist after the connected device is disconnected. Result should return HDMI_CEC_IO_SENT_BUT_NOT_ACKD. | HdmiCecTx | N | Y | Control plane can unplug or switch off a previously existing CEC device | | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for supported CEC commands (as per 1.4b HDMI CEC spec) after the connected device is disconnected. Result should return HDMI_CEC_IO_SENT_BUT_NOT_ACKD. | HdmiCecTx | N | Y | Control plane can unplug or switch off a previously existing CEC device | -| Verify the correct transmission of the supported CEC commands (as per 1.4b HDMI CEC spec) to the connected device and ensure it is acknowledged properly. Result should return HDMI_CEC_IO_SENT_AND_ACKD.| HdmiCecTx | NA | Y |Control plane to switch ON a CEC-supported device on the HDMI network so that it shall respond to the basic commands| -| Broadcast a supported CEC Command to all the devices connected to the network without any error. Result should return HDMI_CEC_IO_SENT_AND_ACKD |HdmiCecTx| NA | Y |Control plane to switch ON a CEC-supported device on the HDMI network to act on the broadcasted command| -| Transmit a CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitoring the behaviour of the connected device accordingly. Result should return HDMI_CEC_IO_SENT_AND_ACKD.| HdmiCecTx | NA | Y | Control plane to monitor the behaviour of the connected devices. | +| Verify the correct transmission of the supported CEC commands (as per 1.4b HDMI CEC spec) to the connected device and ensure it is acknowledged properly. The result should return HDMI_CEC_IO_SENT_AND_ACKD.| HdmiCecTx | N | Y |Control plane to switch ON a CEC-supported device on the HDMI network so that it shall respond to the basic commands| +| Broadcast a supported CEC Command to all the devices connected to the network without any error. The result should return HDMI_CEC_IO_SENT_AND_ACKD |HdmiCecTx| N | Y |Control plane to switch ON a CEC-supported device on the HDMI network to act on the broadcasted command| +| Transmit a CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitoring the behaviour of the connected device accordingly. The result should return HDMI_CEC_IO_SENT_AND_ACKD.| HdmiCecTx | N | Y | Control plane to monitor the behaviour of the connected devices. | ### Emulator Requirements - CEC Transmission @@ -127,11 +128,11 @@ It is the responsibility of the caller to manage the opcodes. The current test c |S.No.|Test Functionality|Description| HAL APIs|L2|L3|Control plane requirements| |-----|------------------|-----------|---------|--|--|--------------------------| -| 5| [CEC Receive functionality](#cec-receive-functionality)| Transmit a CEC Command that expects a response (Eg. GetCECVersion) to a connected device and see the response is received correctly. Set the Rx Callback before sending the data. Validate the received CEC Version.|HdmiCecSetRxCallback HdmiCecTx | NA |Y| Control plane to switch ON a CEC device that can respond to the Transmitted CEC Command| +| 5| [CEC Receive functionality](#cec-receive-functionality)| Transmit a CEC Command that expects a response (Eg. GetCECVersion) to a connected device and see the response is received correctly. Set the Rx Callback before sending the data. Validate the received CEC Version.|HdmiCecSetRxCallback HdmiCecTx | N |Y| Control plane to switch ON a CEC device that can respond to the Transmitted CEC Command| | | | Transmit a CEC command from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (`DUT` TV here)| HdmiCecSetRxCallback | NA | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`| -| | | Transmit an OSD CEC command from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (`DUT` TV here). Make the OSD String to max length| HdmiCecSetRxCallback | NA | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`| -| | | Transmit an OSD CEC command from the connected devices continuously for 30 seconds changing the patterns in the payload and considering the Acknowledgement and responses are received correctly from the host device (`DUT` TV here). Make the OSD String to max length| HdmiCecSetRxCallback | NA | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`. Also, Control plane to detect the OSD Display on the Sink device to validate| -| | | Set the Logical address to 0 on `DUT` and make sure that it doesn't receive the messages sent to devices with different logical address.| HdmiCecSetRxCallback | NA | Y | Control Plane to initiate a command to send CEC frames from CEC adaptor with a different logical address other than zero| +| | | Transmit an OSD CEC command from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (`DUT` TV here). Make the OSD String to max length| HdmiCecSetRxCallback | N | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`| +| | | Transmit an OSD CEC command from the connected devices continuously for 30 seconds changing the patterns in the payload and considering the Acknowledgement and responses are received correctly from the host device (`DUT` TV here). Make the OSD String to max length| HdmiCecSetRxCallback | N | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`. Also, Control plane to detect the OSD Display on the Sink device to validate| +| | | Set the Logical address to 0 on `DUT` and make sure that it doesn't receive the messages sent to devices with different logical address.| HdmiCecSetRxCallback | N | Y | Control Plane to initiate a command to send CEC frames from CEC adaptor with a different logical address other than zero| ### Emulator Requirements - CEC Receive functionality 1. Emulate the Tx and Rx HAL functionalities with the required responses. @@ -144,7 +145,7 @@ It is the responsibility of the caller to manage the opcodes. The current test c |S.No.|Test Functionality|Description| HAL APIs |L2|L3|Control plane requirements| |-----|------------------|-----------|----------|--|--|--------------------------| -| 6| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Generate a Hotplug event by disconnecting the device connected to the HDMI port of the Source Platform. Validating whether the CEC Transmission (use Polling command) works when the HDMI port is disconnected should result in ACK not being received while the TX still works as expected. | HdmiCecTx | NA | Y | Control Panel to control the Hotplug activities | +| 6| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Generate a Hotplug event by disconnecting the device connected to the HDMI port of the Source Platform. Validating whether the CEC Transmission (use Polling command) works when the HDMI port is disconnected should result in ACK not being received while the TX still works as expected. | HdmiCecTx | N | Y | Control Panel to control the Hotplug activities | | | | Check the behaviour when a device has been remove from the network which is not directly connected to the TV device. Send a CEC Tx command with acknowledgement using HAL Interface and check the behaviour. The Tx command should succeed, but the message should not be Acknowledged.| HdmiCecTx | NA | Y | Control Panel to control the external devices connected.| ### Emulator Requirements - CEC HotPlug Functionality @@ -159,8 +160,8 @@ It is the responsibility of the caller to manage the opcodes. The current test c |S.No.|Test Functionality|Description| HAL APIs |L2|L3|Control plane requirements| |-----|------------------|-----------|----------|--|--|--------------------------| -| 7| Introduce fault in the CEC Bus | Observe the behaviour when the CEC line is pulled high during the CEC Transmission using a CEC Adaptor that provision to keep the CEC line pulled high| HdmiCecTx | NA | Y |CEC Adaptor used shall have a provision to introduce the fault. The control plane should be able to command to pull the CEC line high, else it should follow a manual process| -| 8| Overloading the CEC bus. | Overload the CEC bus with too many messages (by connecting more devices in the network) and observe the behaviour| HdmiCecTx | NA | Y |Control plane to initiate the CEC Transmission through all the connected devices continuously with a command that expects the response as well to overload the CEC Network. | +| 7| Introduce fault in the CEC Bus | Observe the behaviour when the CEC line is pulled high during the CEC Transmission using a CEC Adaptor that provision to keep the CEC line pulled high| HdmiCecTx | N | Y |CEC Adaptor used shall have a provision to introduce the fault. The control plane should be able to command to pull the CEC line high, else it should follow a manual process| +| 8| Overloading the CEC bus. | Overload the CEC bus with too many messages (by connecting more devices in the network) and observe the behaviour| HdmiCecTx | N | Y |Control plane to initiate the CEC Transmission through all the connected devices continuously with a command that expects the response as well to overload the CEC Network. | ### Emulator Requirements 1. Emulator to support the HDMI_CEC_IO_SENT_FAILED during the above scenarios @@ -191,4 +192,4 @@ Configurations: Port: 3, 4 HDMI Node: 1-3 etc. CEC_Ports: 1, x, y -``` \ No newline at end of file +``` From 4153e02a8f50fdede1fe8ee79a5bbd8b6c9f6be1 Mon Sep 17 00:00:00 2001 From: srinivasgtl <71806084+srinivasgtl@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:06:13 +0100 Subject: [PATCH 16/48] GH #24 spell checks --- docs/pages/hdmi_cec_source_tests.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_tests.md index 689c7e5..a0ce3f7 100644 --- a/docs/pages/hdmi_cec_source_tests.md +++ b/docs/pages/hdmi_cec_source_tests.md @@ -113,7 +113,7 @@ The caller is responsible for managing the opcodes. The current test cases will | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version for supported CEC commands (as per 1.4b HDMI CEC spec) after the connected device is disconnected. Result should return HDMI_CEC_IO_SENT_BUT_NOT_ACKD. | HdmiCecTx | N | Y | Control plane can unplug or switch off a previously existing CEC device | | Verify the correct transmission of the supported CEC commands (as per 1.4b HDMI CEC spec) to the connected device and ensure it is acknowledged properly. The result should return HDMI_CEC_IO_SENT_AND_ACKD.| HdmiCecTx | N | Y |Control plane to switch ON a CEC-supported device on the HDMI network so that it shall respond to the basic commands| | Broadcast a supported CEC Command to all the devices connected to the network without any error. The result should return HDMI_CEC_IO_SENT_AND_ACKD |HdmiCecTx| N | Y |Control plane to switch ON a CEC-supported device on the HDMI network to act on the broadcasted command| -| Transmit a CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitoring the behaviour of the connected device accordingly. The result should return HDMI_CEC_IO_SENT_AND_ACKD.| HdmiCecTx | N | Y | Control plane to monitor the behaviour of the connected devices. | +| Transmit a CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitoring the behavior of the connected device accordingly. The result should return HDMI_CEC_IO_SENT_AND_ACKD.| HdmiCecTx | N | Y | Control plane to monitor the behavior of the connected devices. | ### Emulator Requirements - CEC Transmission @@ -129,7 +129,7 @@ The caller is responsible for managing the opcodes. The current test cases will |S.No.|Test Functionality|Description| HAL APIs|L2|L3|Control plane requirements| |-----|------------------|-----------|---------|--|--|--------------------------| | 5| [CEC Receive functionality](#cec-receive-functionality)| Transmit a CEC Command that expects a response (Eg. GetCECVersion) to a connected device and see the response is received correctly. Set the Rx Callback before sending the data. Validate the received CEC Version.|HdmiCecSetRxCallback HdmiCecTx | N |Y| Control plane to switch ON a CEC device that can respond to the Transmitted CEC Command| -| | | Transmit a CEC command from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (`DUT` TV here)| HdmiCecSetRxCallback | NA | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`| +| | | Transmit a CEC command from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (`DUT` TV here)| HdmiCecSetRxCallback | N | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`| | | | Transmit an OSD CEC command from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (`DUT` TV here). Make the OSD String to max length| HdmiCecSetRxCallback | N | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`| | | | Transmit an OSD CEC command from the connected devices continuously for 30 seconds changing the patterns in the payload and considering the Acknowledgement and responses are received correctly from the host device (`DUT` TV here). Make the OSD String to max length| HdmiCecSetRxCallback | N | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`. Also, Control plane to detect the OSD Display on the Sink device to validate| | | | Set the Logical address to 0 on `DUT` and make sure that it doesn't receive the messages sent to devices with different logical address.| HdmiCecSetRxCallback | N | Y | Control Plane to initiate a command to send CEC frames from CEC adaptor with a different logical address other than zero| @@ -146,7 +146,7 @@ The caller is responsible for managing the opcodes. The current test cases will |S.No.|Test Functionality|Description| HAL APIs |L2|L3|Control plane requirements| |-----|------------------|-----------|----------|--|--|--------------------------| | 6| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Generate a Hotplug event by disconnecting the device connected to the HDMI port of the Source Platform. Validating whether the CEC Transmission (use Polling command) works when the HDMI port is disconnected should result in ACK not being received while the TX still works as expected. | HdmiCecTx | N | Y | Control Panel to control the Hotplug activities | -| | | Check the behaviour when a device has been remove from the network which is not directly connected to the TV device. Send a CEC Tx command with acknowledgement using HAL Interface and check the behaviour. The Tx command should succeed, but the message should not be Acknowledged.| HdmiCecTx | NA | Y | Control Panel to control the external devices connected.| +| | | Check the behaviour when a device has been remove from the network which is not directly connected to the TV device. Send a CEC Tx command with acknowledgment using HAL Interface and check the behaviour. The Tx command should succeed, but the message should not be Acknowledged.| HdmiCecTx | N | Y | Control Panel to control the external devices connected.| ### Emulator Requirements - CEC HotPlug Functionality From 769045a5b17736013d7950f6a4fa746b1e676433 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 20 Jun 2024 13:04:31 -0400 Subject: [PATCH 17/48] Update with generated L2 code and specification document --- ...e_driver_L2_Low-Level_TestSpecification.md | 73 +++++++++ src/test_l2_hdmi_cec_source_driver.c | 150 ++++++++++++++++++ 2 files changed, 223 insertions(+) create mode 100644 docs/pages/hdmi_cec_source_driver_L2_Low-Level_TestSpecification.md create mode 100644 src/test_l2_hdmi_cec_source_driver.c diff --git a/docs/pages/hdmi_cec_source_driver_L2_Low-Level_TestSpecification.md b/docs/pages/hdmi_cec_source_driver_L2_Low-Level_TestSpecification.md new file mode 100644 index 0000000..5c56b1a --- /dev/null +++ b/docs/pages/hdmi_cec_source_driver_L2_Low-Level_TestSpecification.md @@ -0,0 +1,73 @@ +# HDMI CEC DRIVER L2 Low Level Test Specification and Procedure Documentation + +## Table of Contents + +- [HDMI CEC DRIVER L2 Low Level Test Specification and Procedure Documentation](#hdmi-cec-driver-l2-low-level-test-specification-and-procedure-documentation) + + - [Table of Contents](#table-of-contents) + - [Overview](#overview) + - [Acronyms, Terms and Abbreviations](#acronyms-terms-and-abbreviations) + - [Definitions](#definitions) + - [References](#references) + - [Level 2 Test Procedure](#level-2-test-procedure) + +## Overview + +This document describes the level 2 testing suite for the HDMI CEC DRIVER module. + +### Acronyms, Terms and Abbreviations + +- `HAL` \- Hardware Abstraction Layer, may include some common components +- `UT` \- Unit Test(s) +- `OEM` \- Original Equipment Manufacture +- `SoC` \- System on a Chip + +### Definitions + + - `ut-core` \- Common Testing Framework , which wraps a open-source framework that can be expanded to the requirements for future framework. + +### References +- `High Level Test Specification` - [hdmi_cec_source_tests.md](hdmi_cec_source_tests.md) + +## Level 2 Test Procedure + +The following functions are expecting to test the module operates correctly. + +### Test 1 + +|Title|Details| +|--|--| +|Function Name|`test_l2_hdmi_cec_driver_ValidateLogicalAddressUnavailability_source`| +|Description|Trying to get a logical address discovered during CEC open and validate the return value when the `DUT` is not connected to a Sink device. It should return HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE.| +|Test Group|Module : 02| +|Test Case ID|001| +|Priority|High| + +**Pre-Conditions :** +None + +**Dependencies :** +None + +**User Interaction :** +If user chose to run the test in interactive mode, then the test case has to be selected via console. + +#### Test Procedure : + +| Variation / Steps | Description | Test Data | Expected Result | Notes| +| -- | --------- | ---------- | -------------- | ----- | +| 01 | Invoke HdmiCecOpen with a valid handle when the `DUT` is not connected to a Sink device | handle = valid handle | HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE | Should be successful | +| 02 | If the status is HDMI_CEC_IO_SUCCESS, invoke HdmiCecClose with the handle | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | + + +```mermaid +graph TB + Step1[Call HdmiCecOpen] -->|Success| Step2[Check returned status] + Step1 -->|Failure| TestFail1[Test Case Failed: HdmiCecOpen failed] + Step2 -->|Status is
HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE| Step4[TestCase Success] + Step2 -->|Status is not
HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE| TestFail2[Test Case Failed] + TestFail2 -->|Status is HDMI_CEC_IO_SUCCESS| Step3[Call HdmiCecClose] + Step3 -->|Success| Step5[HdmiCecClose success] + Step3 -->|Failure| TestFail3[Test Case Failed: HdmiCecClose failed] +``` + diff --git a/src/test_l2_hdmi_cec_source_driver.c b/src/test_l2_hdmi_cec_source_driver.c new file mode 100644 index 0000000..e640107 --- /dev/null +++ b/src/test_l2_hdmi_cec_source_driver.c @@ -0,0 +1,150 @@ +/* +* If not stated otherwise in this file or this component's LICENSE file the +* following copyright and licenses apply:* +* Copyright 2024 RDK Management +* +* 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. +*/ + + +/** + * @addtogroup HPK Hardware Porting Kit + * @{ + * @par The Hardware Porting Kit + * HPK is the next evolution of the well-defined Hardware Abstraction Layer + * (HAL), but augmented with more comprehensive documentation and test suites + * that OEM or SOC vendors can use to self-certify their ports before taking + * them to RDKM for validation or to an operator for final integration and + * deployment. The Hardware Porting Kit effectively enables an OEM and/or SOC + * vendor to self-certify their own Video Accelerator devices, with minimal RDKM + * assistance. + * + */ + +/** + * @addtogroup HDMI_CEC HDMICEC Source + * @{ + * + */ + +/** + * @addtogroup HDMI_CEC_HALTESTS HDMICEC Source HALTEST + * @{ + */ + +/** + * @defgroup HDMI_CEC_HALTESTS_L1 HDMICEC Source HALTEST L2 File + * @{ + * @parblock + * + * ### L2 Tests for HDMICEC Source HAL : + * This module includes Level 2 functional tests (success and failure scenarios). + * This is to ensure that the deepSleepMgr APIs meet the requirements across all vendors. + * + * **Pre-Conditions:** None@n + * **Dependencies:** None@n + * + * Ref to API Definition specification documentation : Refer to API Definition specification documentation : [hdmi-cec_halSpec.md](../../docs/pages/hdmi-cec_halSpec.md) + * + * @endparblock + */ + +/** +* @file test_l2_hdmi_cec_source_driver.c +* @page hdmi_cec_driver Level 2 Tests +* +* ## Module's Role +* This module includes Level 2 functional tests (success and failure scenarios). +* This is to ensure that the hdmi_cec_driver APIs meet the requirements across all vendors. +* +* **Pre-Conditions:** None@n +* **Dependencies:** None@n +* +* Ref to API Definition specification documentation : [hdmi-cec_halSpec.md](../../docs/pages/hdmi-cec_halSpec.md) +*/ + + + +#include +#include +#include "hdmi_cec_driver.h" + +static int gTestGroup = 2; +static int gTestID = 1; + +/** +* @brief This test validates the unavailability of logical address in HDMI CEC driver +* +* This test case is designed to validate the scenario when the logical address is unavailable in the HDMI CEC driver. The test invokes the HdmiCecOpen function and checks if the returned status is HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE. If the status is not HDMI_CEC_IO_SUCCESS, it invokes the HdmiCecClose function and checks if the returned status is HDMI_CEC_IO_SUCCESS. +* +* **Test Group ID:** 02@n +* **Test Case ID:** 001@n +* +* **Test Procedure:** +* Refer to UT specification documentation [hdmi_cec_driver_source_L2_Low-Level_TestSpecification.md](../../docs/pages/hdmi_cec_source_driver_L2_Low-Level_TestSpecification.md) +*/ + +void test_l2_hdmi_cec_driver_ValidateLogicalAddressUnavailability_source(void) +{ + gTestID = 1; + UT_LOG_INFO("In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); + + int handle; + HDMI_CEC_STATUS status; + + UT_LOG_DEBUG("Invoking HdmiCecOpen with valid handle"); + status = HdmiCecOpen(&handle); + UT_LOG_DEBUG("Returned status: %d and handle: %d", status, handle); + // Return value should be HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE, when the DUT is not connected to a Sink device. + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE); + + if (status == HDMI_CEC_IO_SUCCESS) + { + UT_LOG_DEBUG("Invoking HdmiCecClose with handle: %d", handle); + HDMI_CEC_STATUS close_status = HdmiCecClose(handle); + UT_LOG_DEBUG("Returned status: %d", close_status); + + UT_ASSERT_EQUAL_FATAL(close_status, HDMI_CEC_IO_SUCCESS); + } + + UT_LOG_INFO("Out %s\n", __FUNCTION__); +} + +static UT_test_suite_t * pSuite = NULL; + +/** + * @brief Register the main tests for this module + * + * @return int - 0 on success, otherwise failure + */ + +int test_hdmi_cec_driver_l2_register(void) +{ + // Create the test suite + pSuite = UT_add_suite("[L2 hdmi_cec_driver]", NULL, NULL); + if (pSuite == NULL) + { + return -1; + } + // List of test function names and strings + + UT_add_test( pSuite, "l2_hdmi_cec_driver_ValidateLogicalAddressUnavailability_source", test_l2_hdmi_cec_driver_ValidateLogicalAddressUnavailability_source); + + return 0; +} + +/** @} */ // End of HDMI CEC HAL Source Tests L2 File +/** @} */ // End of HDMI CEC HAL Source Tests +/** @} */ // End of HDMI CEC Source Module +/** @} */ // End of HPK + From 5c15db155c1ea3f3dcbb36e52f89579a85d6bb9d Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 20 Jun 2024 13:53:29 -0400 Subject: [PATCH 18/48] Removing unneeded file --- src/test_l2_hdmi_cec_driver.c | 77 ----------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 src/test_l2_hdmi_cec_driver.c diff --git a/src/test_l2_hdmi_cec_driver.c b/src/test_l2_hdmi_cec_driver.c deleted file mode 100644 index dfa7768..0000000 --- a/src/test_l2_hdmi_cec_driver.c +++ /dev/null @@ -1,77 +0,0 @@ -/** -* If not stated otherwise in this file or this component's LICENSE -* file the following copyright and licenses apply: -* -* Copyright 2023 RDK Management -* -* 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. -*/ - -/** -* @file TODO: test_l2_hdmi_cec_driver.c -* @page module_name TODO: Required field, name of the main module -* @subpage sub_page_name TODO: Add a function group if relevant -* -* ## Module's Role -* TODO: Explain the module's role in the system in general -* This is to ensure that the API meets the operational requirements of the module across all vendors. -* -* **Pre-Conditions:** TODO: Add pre-conditions if any@n -* **Dependencies:** TODO: Add dependencies if any@n -* -* Ref to API Definition specification documentation :[hdmi-cec_halSpec.md](../../docs/pages/hdmi-cec_halSpec.md) -*/ - -#include -#include - -#include -#include - -/** -* @brief TODO: Describe the object of the test -* -* TODO: Add the description of what is tested and why in this test -* -* **Test Group ID:** TODO: Add the group this test belongs to - Basic (for L1): 01 / Module (L2): 02 / Stress (L2): 03)@n -* **Test Case ID:** TODO: Add the ID of the test case so that it can be logically tracked in the logs@n -* -* **Test Procedure:** -* Refer to UT specification documentation [l2_module_test_specification.md](l2_module_test_specification.md) -*/ -void test_l2_hdmi_cec_driver (void) -{ - UT_FAIL("This function needs to be implemented!"); -} - -static UT_test_suite_t * pSuite = NULL; - -/** - * @brief Register the main test(s) for this module - * - * @return int - 0 on success, otherwise failure - */ -int test_l2_hdmi_cec_driver_register ( void ) -{ - /* add a suite to the registry */ - pSuite = UT_add_suite( "[L2 hdmi_cec_driver]", NULL, NULL ); - if ( NULL == pSuite ) - { - return -1; - } - - - UT_add_test( pSuite, "test_l2_hdmi_cec_driver" ,test_l2_hdmi_cec_driver ); - - return 0; -} From 6647ba4a59c08f8e4f4143cdbe29fbd7b38e17d9 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 20 Jun 2024 14:56:51 -0400 Subject: [PATCH 19/48] Commenting vcomponent --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a736743..d87707b 100644 --- a/Makefile +++ b/Makefile @@ -34,14 +34,14 @@ TOP_DIR := $(ROOT_DIR) SRC_DIRS = $(ROOT_DIR)/src INC_DIRS := $(ROOT_DIR)/../include HAL_LIB := RCECHal -VCOMPONENT_SRCS := $(ROOT_DIR)/vcomponent/src/vcomponent_hdmi_cec.c +#VCOMPONENT_SRCS := $(ROOT_DIR)/vcomponent/src/vcomponent_hdmi_cec.c ifeq ($(TARGET),) $(info TARGET NOT SET ) $(info TARGET FORCED TO Linux) TARGET=linux -SRC_DIRS += $(ROOT_DIR)/vcomponent/src -INC_DIRS += $(ROOT_DIR)/vcomponent/include +#SRC_DIRS += $(ROOT_DIR)/vcomponent/src +#INC_DIRS += $(ROOT_DIR)/vcomponent/include YLDFLAGS += -lpthread -lrt endif @@ -51,7 +51,7 @@ ifeq ($(TARGET),arm) HAL_LIB_DIR := $(ROOT_DIR)/libs YLDFLAGS = -Wl,-rpath,$(HAL_LIB_DIR) -L$(HAL_LIB_DIR) -l$(HAL_LIB) -lpthread -lrt ifeq ("$(wildcard $(HAL_LIB_DIR)/lib$(HAL_LIB).so)","") -SETUP_VCOMPONENT_LIBS := vcomponent +#SETUP_VCOMPONENT_LIBS := vcomponent endif endif From d2098b79f8df63646dffba48a3beb869f248da4f Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 20 Jun 2024 15:01:56 -0400 Subject: [PATCH 20/48] Update --- Makefile | 8 ++++---- src/test_vcomponent.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d87707b..a736743 100644 --- a/Makefile +++ b/Makefile @@ -34,14 +34,14 @@ TOP_DIR := $(ROOT_DIR) SRC_DIRS = $(ROOT_DIR)/src INC_DIRS := $(ROOT_DIR)/../include HAL_LIB := RCECHal -#VCOMPONENT_SRCS := $(ROOT_DIR)/vcomponent/src/vcomponent_hdmi_cec.c +VCOMPONENT_SRCS := $(ROOT_DIR)/vcomponent/src/vcomponent_hdmi_cec.c ifeq ($(TARGET),) $(info TARGET NOT SET ) $(info TARGET FORCED TO Linux) TARGET=linux -#SRC_DIRS += $(ROOT_DIR)/vcomponent/src -#INC_DIRS += $(ROOT_DIR)/vcomponent/include +SRC_DIRS += $(ROOT_DIR)/vcomponent/src +INC_DIRS += $(ROOT_DIR)/vcomponent/include YLDFLAGS += -lpthread -lrt endif @@ -51,7 +51,7 @@ ifeq ($(TARGET),arm) HAL_LIB_DIR := $(ROOT_DIR)/libs YLDFLAGS = -Wl,-rpath,$(HAL_LIB_DIR) -L$(HAL_LIB_DIR) -l$(HAL_LIB) -lpthread -lrt ifeq ("$(wildcard $(HAL_LIB_DIR)/lib$(HAL_LIB).so)","") -#SETUP_VCOMPONENT_LIBS := vcomponent +SETUP_VCOMPONENT_LIBS := vcomponent endif endif diff --git a/src/test_vcomponent.c b/src/test_vcomponent.c index 1552fe4..963ca92 100644 --- a/src/test_vcomponent.c +++ b/src/test_vcomponent.c @@ -69,7 +69,7 @@ #include #include "ut_log.h" #include "hdmi_cec_driver.h" -#include "vcomponent_hdmi_cec.h" +#include "../vcomponent/include/vcomponent_hdmi_cec.h" struct emulator_info { From 6f11a9baa46f347bb0b38266e1119f159918523d Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 20 Jun 2024 15:06:33 -0400 Subject: [PATCH 21/48] Update make --- Makefile | 38 ++++---------------------------------- src/test_vcomponent.c | 2 +- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index a736743..61865ed 100644 --- a/Makefile +++ b/Makefile @@ -30,33 +30,26 @@ ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) BIN_DIR := $(ROOT_DIR)/bin TOP_DIR := $(ROOT_DIR) - SRC_DIRS = $(ROOT_DIR)/src INC_DIRS := $(ROOT_DIR)/../include HAL_LIB := RCECHal -VCOMPONENT_SRCS := $(ROOT_DIR)/vcomponent/src/vcomponent_hdmi_cec.c - +SKELTON_SRCS := $(ROOT_DIR)/skeletons/src/hdmi_cec_driver.c ifeq ($(TARGET),) $(info TARGET NOT SET ) $(info TARGET FORCED TO Linux) TARGET=linux -SRC_DIRS += $(ROOT_DIR)/vcomponent/src -INC_DIRS += $(ROOT_DIR)/vcomponent/include +SRC_DIRS += $(ROOT_DIR)/skeletons/src YLDFLAGS += -lpthread -lrt endif - $(info TARGET [$(TARGET)]) - ifeq ($(TARGET),arm) HAL_LIB_DIR := $(ROOT_DIR)/libs YLDFLAGS = -Wl,-rpath,$(HAL_LIB_DIR) -L$(HAL_LIB_DIR) -l$(HAL_LIB) -lpthread -lrt ifeq ("$(wildcard $(HAL_LIB_DIR)/lib$(HAL_LIB).so)","") -SETUP_VCOMPONENT_LIBS := vcomponent +SETUP_SKELETON_LIBS := skeleton endif endif - .PHONY: clean list all - export YLDFLAGS export BIN_DIR export SRC_DIRS @@ -64,27 +57,4 @@ export INC_DIRS export TARGET export TOP_DIR export HAL_LIB_DIR - -.PHONY: clean list build vcomponent - - -build: $(SETUP_VCOMPONENT_LIBS) - echo "SETUP_VCOMPONENT_LIBS $(SETUP_VCOMPONENT_LIBS)" - @echo UT [$@] - make -C ./ut-core - -#Build against the real library leads to the SOC library dependency also.SOC lib dependency cannot be specified in the ut Makefile, since it is supposed to be common across may platforms. So in order to over come this situation, creating a template skelton library with empty templates so that the template library wont have any other Soc dependency. And in the real platform mount copy bind with the actual library will work fine. -vcomponent: - echo $(CC) - $(CC) -fPIC -shared -I$(ROOT_DIR)/../include $(VCOMPONENT_SRCS) -o lib$(HAL_LIB).so - mkdir -p $(HAL_LIB_DIR) - cp $(ROOT_DIR)/lib$(HAL_LIB).so $(HAL_LIB_DIR) - - -list: - @echo UT [$@] - make -C ./ut-core list - -clean: - @echo UT [$@] - make -C ./ut-core clean +.PHONY: clean list build skeleton \ No newline at end of file diff --git a/src/test_vcomponent.c b/src/test_vcomponent.c index 963ca92..1552fe4 100644 --- a/src/test_vcomponent.c +++ b/src/test_vcomponent.c @@ -69,7 +69,7 @@ #include #include "ut_log.h" #include "hdmi_cec_driver.h" -#include "../vcomponent/include/vcomponent_hdmi_cec.h" +#include "vcomponent_hdmi_cec.h" struct emulator_info { From 3aa7ac06b00575b7c29ac5258342d2221be597af Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 20 Jun 2024 15:13:27 -0400 Subject: [PATCH 22/48] Revert "Update make" This reverts commit 6f11a9baa46f347bb0b38266e1119f159918523d. --- Makefile | 38 ++++++++++++++++++++++++++++++++++---- src/test_vcomponent.c | 2 +- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 61865ed..a736743 100644 --- a/Makefile +++ b/Makefile @@ -30,26 +30,33 @@ ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) BIN_DIR := $(ROOT_DIR)/bin TOP_DIR := $(ROOT_DIR) + SRC_DIRS = $(ROOT_DIR)/src INC_DIRS := $(ROOT_DIR)/../include HAL_LIB := RCECHal -SKELTON_SRCS := $(ROOT_DIR)/skeletons/src/hdmi_cec_driver.c +VCOMPONENT_SRCS := $(ROOT_DIR)/vcomponent/src/vcomponent_hdmi_cec.c + ifeq ($(TARGET),) $(info TARGET NOT SET ) $(info TARGET FORCED TO Linux) TARGET=linux -SRC_DIRS += $(ROOT_DIR)/skeletons/src +SRC_DIRS += $(ROOT_DIR)/vcomponent/src +INC_DIRS += $(ROOT_DIR)/vcomponent/include YLDFLAGS += -lpthread -lrt endif + $(info TARGET [$(TARGET)]) + ifeq ($(TARGET),arm) HAL_LIB_DIR := $(ROOT_DIR)/libs YLDFLAGS = -Wl,-rpath,$(HAL_LIB_DIR) -L$(HAL_LIB_DIR) -l$(HAL_LIB) -lpthread -lrt ifeq ("$(wildcard $(HAL_LIB_DIR)/lib$(HAL_LIB).so)","") -SETUP_SKELETON_LIBS := skeleton +SETUP_VCOMPONENT_LIBS := vcomponent endif endif + .PHONY: clean list all + export YLDFLAGS export BIN_DIR export SRC_DIRS @@ -57,4 +64,27 @@ export INC_DIRS export TARGET export TOP_DIR export HAL_LIB_DIR -.PHONY: clean list build skeleton \ No newline at end of file + +.PHONY: clean list build vcomponent + + +build: $(SETUP_VCOMPONENT_LIBS) + echo "SETUP_VCOMPONENT_LIBS $(SETUP_VCOMPONENT_LIBS)" + @echo UT [$@] + make -C ./ut-core + +#Build against the real library leads to the SOC library dependency also.SOC lib dependency cannot be specified in the ut Makefile, since it is supposed to be common across may platforms. So in order to over come this situation, creating a template skelton library with empty templates so that the template library wont have any other Soc dependency. And in the real platform mount copy bind with the actual library will work fine. +vcomponent: + echo $(CC) + $(CC) -fPIC -shared -I$(ROOT_DIR)/../include $(VCOMPONENT_SRCS) -o lib$(HAL_LIB).so + mkdir -p $(HAL_LIB_DIR) + cp $(ROOT_DIR)/lib$(HAL_LIB).so $(HAL_LIB_DIR) + + +list: + @echo UT [$@] + make -C ./ut-core list + +clean: + @echo UT [$@] + make -C ./ut-core clean diff --git a/src/test_vcomponent.c b/src/test_vcomponent.c index 1552fe4..963ca92 100644 --- a/src/test_vcomponent.c +++ b/src/test_vcomponent.c @@ -69,7 +69,7 @@ #include #include "ut_log.h" #include "hdmi_cec_driver.h" -#include "vcomponent_hdmi_cec.h" +#include "../vcomponent/include/vcomponent_hdmi_cec.h" struct emulator_info { From 3518659540acea6c175d9aa3ed8dac1737aa8770 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 20 Jun 2024 15:13:36 -0400 Subject: [PATCH 23/48] Revert "Update" This reverts commit d2098b79f8df63646dffba48a3beb869f248da4f. --- Makefile | 8 ++++---- src/test_vcomponent.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a736743..d87707b 100644 --- a/Makefile +++ b/Makefile @@ -34,14 +34,14 @@ TOP_DIR := $(ROOT_DIR) SRC_DIRS = $(ROOT_DIR)/src INC_DIRS := $(ROOT_DIR)/../include HAL_LIB := RCECHal -VCOMPONENT_SRCS := $(ROOT_DIR)/vcomponent/src/vcomponent_hdmi_cec.c +#VCOMPONENT_SRCS := $(ROOT_DIR)/vcomponent/src/vcomponent_hdmi_cec.c ifeq ($(TARGET),) $(info TARGET NOT SET ) $(info TARGET FORCED TO Linux) TARGET=linux -SRC_DIRS += $(ROOT_DIR)/vcomponent/src -INC_DIRS += $(ROOT_DIR)/vcomponent/include +#SRC_DIRS += $(ROOT_DIR)/vcomponent/src +#INC_DIRS += $(ROOT_DIR)/vcomponent/include YLDFLAGS += -lpthread -lrt endif @@ -51,7 +51,7 @@ ifeq ($(TARGET),arm) HAL_LIB_DIR := $(ROOT_DIR)/libs YLDFLAGS = -Wl,-rpath,$(HAL_LIB_DIR) -L$(HAL_LIB_DIR) -l$(HAL_LIB) -lpthread -lrt ifeq ("$(wildcard $(HAL_LIB_DIR)/lib$(HAL_LIB).so)","") -SETUP_VCOMPONENT_LIBS := vcomponent +#SETUP_VCOMPONENT_LIBS := vcomponent endif endif diff --git a/src/test_vcomponent.c b/src/test_vcomponent.c index 963ca92..1552fe4 100644 --- a/src/test_vcomponent.c +++ b/src/test_vcomponent.c @@ -69,7 +69,7 @@ #include #include "ut_log.h" #include "hdmi_cec_driver.h" -#include "../vcomponent/include/vcomponent_hdmi_cec.h" +#include "vcomponent_hdmi_cec.h" struct emulator_info { From 88c646b1c0367ddff619e44d2ae9d7d23b607b8c Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 20 Jun 2024 15:13:44 -0400 Subject: [PATCH 24/48] Revert "Commenting vcomponent" This reverts commit 6647ba4a59c08f8e4f4143cdbe29fbd7b38e17d9. --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index d87707b..a736743 100644 --- a/Makefile +++ b/Makefile @@ -34,14 +34,14 @@ TOP_DIR := $(ROOT_DIR) SRC_DIRS = $(ROOT_DIR)/src INC_DIRS := $(ROOT_DIR)/../include HAL_LIB := RCECHal -#VCOMPONENT_SRCS := $(ROOT_DIR)/vcomponent/src/vcomponent_hdmi_cec.c +VCOMPONENT_SRCS := $(ROOT_DIR)/vcomponent/src/vcomponent_hdmi_cec.c ifeq ($(TARGET),) $(info TARGET NOT SET ) $(info TARGET FORCED TO Linux) TARGET=linux -#SRC_DIRS += $(ROOT_DIR)/vcomponent/src -#INC_DIRS += $(ROOT_DIR)/vcomponent/include +SRC_DIRS += $(ROOT_DIR)/vcomponent/src +INC_DIRS += $(ROOT_DIR)/vcomponent/include YLDFLAGS += -lpthread -lrt endif @@ -51,7 +51,7 @@ ifeq ($(TARGET),arm) HAL_LIB_DIR := $(ROOT_DIR)/libs YLDFLAGS = -Wl,-rpath,$(HAL_LIB_DIR) -L$(HAL_LIB_DIR) -l$(HAL_LIB) -lpthread -lrt ifeq ("$(wildcard $(HAL_LIB_DIR)/lib$(HAL_LIB).so)","") -#SETUP_VCOMPONENT_LIBS := vcomponent +SETUP_VCOMPONENT_LIBS := vcomponent endif endif From 69dec65ac6168b062251e5ea1addebd8e097fda8 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Fri, 21 Jun 2024 10:55:03 -0400 Subject: [PATCH 25/48] Update main/register files to L2 tests --- src/main.c | 3 ++- src/test_register.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 765faa9..0bbb85e 100644 --- a/src/main.c +++ b/src/main.c @@ -64,6 +64,7 @@ #include extern int register_hdmicec_hal_l1_tests( void ); +extern int register_hdmicec_hal_l2_tests( void ); extern int register_vcomponent_tests ( char* profile, unsigned short cpPort, char* cpPath ); int main(int argc, char** argv) @@ -107,7 +108,7 @@ int main(int argc, char** argv) UT_init( argc, argv ); register_hdmicec_hal_l1_tests (); - + register_hdmicec_hal_l2_tests (); register_vcomponent_tests(pProfilePath, cpPort, pUrl); UT_run_tests(); diff --git a/src/test_register.c b/src/test_register.c index 734cabb..81991db 100644 --- a/src/test_register.c +++ b/src/test_register.c @@ -62,13 +62,23 @@ /* L1 Testing Functions */ extern int test_hdmicec_hal_l1_register( void ); +extern int test_hdmicec_hal_l2_register( void ); int register_hdmicec_hal_l1_tests( void ) { int registerFailed=0; - registerFailed |= test_hdmicec_hal_l1_register(); + registerFailed |= test_hdmicec_hal_l_register(); + + return registerFailed; +} + +int register_hdmicec_hal_l2_tests( void ) +{ + int registerFailed=0; + + registerFailed |= test_hdmicec_hal_l2_register(); return registerFailed; } From 9655adfc5e492fdeff797b7f0dad0bdd1ad28d91 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Fri, 21 Jun 2024 11:18:13 -0400 Subject: [PATCH 26/48] Update with Sink tests --- .../hdmi-cec-sink_L2_Low-Level_TestSpec.md | 326 ++++++++++++ docs/pages/hdmi_cec_sink_tests.md | 168 ++++++ ... hdmi_cec_source_L2_Low-Level_TestSpec.md} | 0 src/main.c | 6 +- src/test_l2_hdmi_cec_sink_driver.c | 482 ++++++++++++++++++ src/test_l2_hdmi_cec_source_driver.c | 2 +- src/test_register.c | 17 +- 7 files changed, 994 insertions(+), 7 deletions(-) create mode 100644 docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md create mode 100644 docs/pages/hdmi_cec_sink_tests.md rename docs/pages/{hdmi_cec_source_driver_L2_Low-Level_TestSpecification.md => hdmi_cec_source_L2_Low-Level_TestSpec.md} (100%) create mode 100644 src/test_l2_hdmi_cec_sink_driver.c diff --git a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md new file mode 100644 index 0000000..1d03de3 --- /dev/null +++ b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md @@ -0,0 +1,326 @@ +# HDMI CEC DRIVER L2 Low Level Test Specification and Procedure Documentation + +## Table of Contents + +- [HDMI CEC DRIVER L2 Low Level Test Specification and Procedure Documentation](#hdmi-cec-driver-l2-low-level-test-specification-and-procedure-documentation) + + - [Table of Contents](#table-of-contents) + - [Overview](#overview) + - [Acronyms, Terms and Abbreviations](#acronyms-terms-and-abbreviations) + - [Definitions](#definitions) + - [References](#references) + - [Level 2 Test Procedure](#level-2-test-procedure) + +## Overview + +This document describes the level 2 testing suite for the HDMI CEC DRIVER module. + +### Acronyms, Terms and Abbreviations + +- `HAL` \- Hardware Abstraction Layer, may include some common components +- `UT` \- Unit Test(s) +- `HDMI` \- High-Definition Multimedia Interface +- `CEC` \- Consumer Electronics Contro +- `DUT` \- Device Under Test +- `API` \- Application Program Interface +### Definitions + +- `ut-core` \- Common Testing Framework , which wraps a open-source framework that can be expanded to the requirements for future framework. + +### References +- `High Level Test Specification` - [hdmi_cec_sink_tests.md](hdmi_cec_sink_tests.md) + +## Level 2 Test Procedure + +The following functions are intended to test the HDMI CEC HAL module's operation on sink devices according to the L2 Test specification. + +### Test 1 + +|Title|Details| +|--|--| +|Function Name|`test_l2_hdmi_cec_driver_GetDefaultLogicalAddress`| +|Description|Get the logical address of the `DUT` without actually adding the Logical Address and the API should return 0x0F as the default logical address.| +|Test Group|Module : 02| +|Test Case ID|001| +|Priority|High| + +**Pre-Conditions :** +None + +**Dependencies :** +None + +**User Interaction :** +If user chose to run the test in interactive mode, then the test case has to be selected via console. + +#### Test Procedure : + +| Variation / Steps | Description | Test Data | Expected Result | Notes| +| -- | --------- | ---------- | -------------- | ----- | +| 01 | Call the pre-requisite API HdmiCecOpen() | handle = 0 | HDMI_CEC_IO_SUCCESS | Should be successful | +| 02 | Call the API HdmiCecGetLogicalAddress() | handle = valid handle, logicalAddress = 0 | HDMI_CEC_IO_SUCCESS | Should be successful | +| 03 | Check the logical address | | logicalAddress = 0x0F| Should be successful | +| 04 | Call the post-requisite API HdmiCecClose() | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | + + +```mermaid +graph TD + style A fill:#bff,stroke:#333,stroke-width:2px + style B fill:#bbf,stroke:#333,stroke-width:2px + style C fill:#bbf,stroke:#333,stroke-width:2px + style D fill:#bff,stroke:#333,stroke-width:2px + style E fill:#f00,stroke:#333,stroke-width:2px + + A[Open HDMI CEC] --> B{Get Logical Address \n without adding one} + B -->|HDMI_CEC_IO_SUCCESS| C[Check Logical Address == 0xf] + C -->|Test successful| D[Close HDMI CEC] + B -->|Not HDMI_CEC_IO_SUCCESS| E[Test Fail] + C -->|NO| E + E --> D +``` + + +### Test 2 + +|Title|Details| +|--|--| +|Function Name|`test_l2_hdmi_cec_driver_AddAndGetLogicalAddress`| +|Description|Setup all valid logical addresses b/w 0x00 to 0x0F for the `DUT` and retrieve each to ensure proper functionality, using HAL APIs.| +|Test Group|Module : 02| +|Test Case ID|002| +|Priority|High| + +**Pre-Conditions :** +None + +**Dependencies :** +None + +**User Interaction :** +If user chose to run the test in interactive mode, then the test case has to be selected via console. + +#### Test Procedure : + +| Variation / Steps | Description | Test Data | Expected Result | Notes| +| -- | --------- | ---------- | -------------- | ----- | +| 01 | Open HDMI CEC driver using HdmiCecOpen API | handle = valid pointer | HDMI_CEC_IO_SUCCESS | Should be successful | +| 02 | Loop over the range of valid logical addresses (0x00 to 0x0F) | i = 0 to 0x0F | N/A | N/A | +| 03 | Add logical address using HdmiCecAddLogicalAddress API | handle = valid handle, logicalAddress = i | HDMI_CEC_IO_SUCCESS | Should be successful | +| 04 | Retrieve logical address using HdmiCecGetLogicalAddress API | handle = valid handle, logicalAddress = valid pointer | HDMI_CEC_IO_SUCCESS, logicalAddress = i | Should be successful | +| 05 | Remove logical address using HdmiCecRemoveLogicalAddress API | handle = valid handle, logicalAddress = i | HDMI_CEC_IO_SUCCESS | Should be successful | +| 06 | Close HDMI CEC driver using HdmiCecClose API | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | + + +```mermaid +graph TD + style A fill:#bff,stroke:#333,stroke-width:2px + style B fill:#bbf,stroke:#333,stroke-width:2px + style C fill:#f9f,stroke:#333,stroke-width:2px + style D fill:#bbf,stroke:#333,stroke-width:2px + style E fill:#bbf,stroke:#333,stroke-width:2px + style F fill:#bbf,stroke:#333,stroke-width:2px + style G fill:#f9f,stroke:#333,stroke-width:2px + style H fill:#bff,stroke:#333,stroke-width:2px + + A[Open HDMI CEC Driver] --> B{HdmiCecOpen: \n handle = valid pointer} + B -->|HDMI_CEC_IO_SUCCESS| C[Manage Logical Addresses] + C -->|Each step successful| D[Add Logical Address] + D -->|HDMI_CEC_IO_SUCCESS| E[Validate Added Logical Address] + E -->|Matched| F[Remove Logical Address] + F -->|HDMI_CEC_IO_SUCCESS| G[All Addresses processed?] + G -->|No| C + G -->|Yes| H[Close HDMI CEC Driver] +``` + + +### Test 3 + +|Title|Details| +|--|--| +|Function Name|`test_l2_hdmi_cec_driver_RemoveLogicalAddress`| +|Description|Invoke the HAL API to delete the `DUT` logical address and verify that it is removed successfully.| +|Test Group|Module : 02| +|Test Case ID|003| +|Priority|High| + +**Pre-Conditions :** +None + +**Dependencies :** +None + +**User Interaction :** +If user chose to run the test in interactive mode, then the test case has to be selected via console. + +#### Test Procedure : + +| Variation / Steps | Description | Test Data | Expected Result | Notes| +| -- | --------- | ---------- | -------------- | ----- | +| 01 | Open the HDMI CEC driver using HdmiCecOpen API | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | +| 02 | Add a logical address using HdmiCecAddLogicalAddress API | handle = valid handle, logicalAddress = 0x00 | HDMI_CEC_IO_SUCCESS | Should be successful | +| 03 | Get the logical address using HdmiCecGetLogicalAddress API | handle = valid handle, logicalAddress = valid buffer | HDMI_CEC_IO_SUCCESS , logicalAddress = 0x00 | Should be successful | +| 04 | Remove the logical address using HdmiCecRemoveLogicalAddress API | handle = valid handle, logicalAddress = 0x00 | HDMI_CEC_IO_SUCCESS | Should be successful | +| 05 | Get the logical address using HdmiCecGetLogicalAddress API | handle = valid handle, logicalAddress = valid buffer | HDMI_CEC_IO_SUCCESS , logicalAddress = 0x0F | Should be successful | +| 06 | Close the HDMI CEC driver using HdmiCecClose API | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | + + +```mermaid +graph TD + style A fill:#bff,stroke:#333,stroke-width:2px + style B fill:#bbf,stroke:#333,stroke-width:2px + style C fill:#bbf,stroke:#333,stroke-width:2px + style D fill:#bbf,stroke:#333,stroke-width:2px + style E fill:#bbf,stroke:#333,stroke-width:2px + style F fill:#bbf,stroke:#333,stroke-width:2px + style G fill:#bff,stroke:#333,stroke-width:2px + style H fill:#bbf,stroke:#333,stroke-width:2px + + A[Open HDMI CEC Driver] --> B{HdmiCecOpen:\n handle = valid handle} + B -->|HDMI_CEC_IO_SUCCESS| C[Add Logical Address] + C -->|HDMI_CEC_IO_SUCCESS| D[Get Logical Address] + D -->|HDMI_CEC_IO_SUCCESS| E[Remove Logical Address] + E -->|HDMI_CEC_IO_SUCCESS| F[Get Logical Address] + F -->|HDMI_CEC_IO_SUCCESS| H[Compare Logical Address 0x0F] + H -->|HDMI_CEC_IO_SUCCESS| G[Close HDMI CEC Driver] +``` + + + +### Test 4 + +|Title|Details| +|--|--| +|Function Name|`test_l2_hdmi_cec_driver_BroadcastHdmiCecCommand`| +|Description|After deleting the `DUT` logical address, try to send a broadcast CEC Command (as per 1.4b HDMI CEC spec) and confirm transmission is successful.| +|Test Group|Module : 02| +|Test Case ID|004| +|Priority|High| + +**Pre-Conditions :** +None + +**Dependencies :** +None + +**User Interaction :** +If user chose to run the test in interactive mode, then the test case has to be selected via console. + +#### Test Procedure : + +| Variation / Steps | Description | Test Data | Expected Result | Notes| +| -- | --------- | ---------- | -------------- | ----- | +| 01 | Open HDMI CEC using HdmiCecOpen | handle = valid buffer | HDMI_CEC_IO_SUCCESS | Should be successful | +| 02 | Add logical address using HdmiCecAddLogicalAddress | handle = valid handle, logicalAddresses = 0x0 | HDMI_CEC_IO_SUCCESS | Should be successful | +| 03 | Remove logical address using HdmiCecRemoveLogicalAddress | handle = valid handle, logicalAddresses = 0x0 | HDMI_CEC_IO_SUCCESS | Should be successful | +| 04 | Broadast CEC message using HdmiCecTx | handle = valid handle, buf = {0x0F, 0x84, 0x00, 0x00}, len = sizeof(buf), result = valid buffer | HDMI_CEC_IO_SUCCESS | Should be successful | +| 05 | Check the result of transmission | result = valid buffer | HDMI_CEC_IO_SENT_BUT_NOT_ACKD| Should be successful | +| 06 | Close HDMI CEC using HdmiCecClose | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | + + +```mermaid +graph TD + style A fill:#bff,stroke:#333,stroke-width:2px + style B fill:#bbf,stroke:#333,stroke-width:2px + style C fill:#bbf,stroke:#333,stroke-width:2px + style D fill:#bbf,stroke:#333,stroke-width:2px + style E fill:#bbf,stroke:#333,stroke-width:2px + style F fill:#bbf,stroke:#333,stroke-width:2px + style G fill:#bff,stroke:#333,stroke-width:2px + + A[Open HDMI CEC Driver] --> B{HdmiCecOpen:\n handle = valid buffer} + B -->|HDMI_CEC_IO_SUCCESS| C[Add Logical Address] + C -->|HDMI_CEC_IO_SUCCESS| D[Remove Logical Address] + D -->|HDMI_CEC_IO_SUCCESS| E[Broadcast CEC Message] + E -->|HDMI_CEC_IO_SUCCESS| F[Check Transmission Result] + F -->|HDMI_CEC_IO_SENT_BUT_NOT_ACKD| G[Close HDMI CEC Driver] +``` + + + +### Test 5 + +|Title|Details| +|--|--| +|Function Name|`test_l2_hdmi_cec_driver_VerifyPhysicalAddress`| +|Description|Verify the valid physical address allocated through the HAL function.| +|Test Group|Module : 02| +|Test Case ID|005| +|Priority|High| + +**Pre-Conditions :** +None + +**Dependencies :** +None + +**User Interaction :** +If user chose to run the test in interactive mode, then the test case has to be selected via console. + +#### Test Procedure : + +| Variation / Steps | Description | Test Data | Expected Result | Notes| +| -- | --------- | ---------- | -------------- | ----- | +| 01 | Call the pre-requisite API HdmiCecOpen() | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | +| 02 | Call the API HdmiCecGetPhysicalAddress() | handle = valid handle, physicalAddress = valid address | HDMI_CEC_IO_SUCCESS | Should be successful | +| 03 | Check the return status of HdmiCecGetPhysicalAddress() | status = return status of HdmiCecGetPhysicalAddress() | HDMI_CEC_IO_SUCCESS | Should be successful | +| 04 | Verify that the physical address obtained is less than F.F.F.F | physicalAddress = obtained physical address | physicalAddress < 0xFFFF | Should be successful | +| 05 | Call the post-requisite API HdmiCecClose() | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | + + +```mermaid +graph TD + style A fill:#bff,stroke:#333,stroke-width:2px + style B fill:#bbf,stroke:#333,stroke-width:2px + style C fill:#bbf,stroke:#333,stroke-width:2px + style D fill:#bff,stroke:#333,stroke-width:2px + + A[Open HDMI CEC Driver] --> B{HdmiCecGetPhysicalAddress} + B -->|Not HDMI_CEC_IO_SUCCESS | D + B -->|HDMI_CEC_IO_SUCCESS| C[Verify physical address < 0xFFFF] + C -->D[Close HDMI CEC Driver] +``` + + +### Test 6 + +|Title|Details| +|--|--| +|Function Name|`test_l2_hdmi_cec_driver_TransmitCECCommand`| +|Description|DUT transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC version of device that doesn't exist.| +|Test Group|Module : 02| +|Test Case ID|006| +|Priority|High| + +**Pre-Conditions :** +None + +**Dependencies :** +None + +**User Interaction :** +If user chose to run the test in interactive mode, then the test case has to be selected via console. + +#### Test Procedure : + +| Variation / Steps | Description | Test Data | Expected Result | Notes| +| -- | --------- | ---------- | -------------- | ----- | +| 01 | Open HDMI CEC driver using HdmiCecOpen | handle = valid buffer | HDMI_CEC_IO_SUCCESS | Should be successful | +| 02 | Add logical address using HdmiCecAddLogicalAddress | handle = valid handle, logicalAddresses = 0x4 | HDMI_CEC_IO_SUCCESS | Should be successful | +| 03 | Transmit CEC command using HdmiCecTx for a non existing device | handle = valid handle, buf = {0x47, 0x9F}, len = sizeof(buf), result = valid buffer | HDMI_CEC_IO_SUCCESS, result = HDMI_CEC_IO_SENT_BUT_NOT_ACKD | Should be successful | +| 04 | Remove logical address using HdmiCecRemoveLogicalAddress | handle = valid handle, logicalAddresses = 0x4 | HDMI_CEC_IO_SUCCESS | Should be successful | +| 05 | Close HDMI CEC driver using HdmiCecClose | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | + + +```mermaid +graph TD + style A fill:#bff,stroke:#333,stroke-width:2px + style B fill:#bbf,stroke:#333,stroke-width:2px + style C fill:#bbf,stroke:#333,stroke-width:2px + style D fill:#bbf,stroke:#333,stroke-width:2px + style E fill:#bff,stroke:#333,stroke-width:2px + + A[Open HDMI CEC Driver] --> B{HdmiCecAddLogicalAddress} + B -->|HDMI_CEC_IO_SUCCESS| C[Transmit CEC Command for \n a device not in the network] + C -->|HDMI_CEC_IO_SUCCESS| D[Check Result] + D -->|HDMI_CEC_IO_SENT_BUT_NOT_ACKD| E[Close HDMI CEC Driver] +``` \ No newline at end of file diff --git a/docs/pages/hdmi_cec_sink_tests.md b/docs/pages/hdmi_cec_sink_tests.md new file mode 100644 index 0000000..ca99c07 --- /dev/null +++ b/docs/pages/hdmi_cec_sink_tests.md @@ -0,0 +1,168 @@ + +# HDMI CEC High-Level Test Specification Document + +## Table of Contents + +- [Acronyms, Terms and Abbreviations](#acronyms-terms-and-abbreviations) +- [Overview](#overview) +- [HDMI-CEC RDK HAL Functionality](#hdmi-cec-rdk-hal-functionality) + +## Acronyms, Terms and Abbreviations + +- `CEC` - Consumer Electronics Control +- `HAL` - Hardware Abstraction layer +- `HDMI` - High Definition Multimedia Interface +- `DUT` - Device Under Test +- `L2` - Level 2 Testing () +- `L3` - Level 3 Testing () + +## Scope + +This document defines the requirements for testing the HDMI CEC device from a level 2/3 based on being a sink device. + +## Overview + +Consumer Electronics Control (CEC) is a single-wire bidirectional bus within an HDMI system, facilitating communication among interconnected products. HDMI-CEC establishes a protocol enabling high-level control functions between audiovisual devices linked via an HDMI network, facilitating communication and control among them. Communication can occur in either Direct messaging mode or Broadcast mode. + +## HDMI-CEC RDK HAL Functionality + +The HAL layers within RDK serve as a bridge between the underlying low-level SoC drivers and the higher-level RDK layers that utilize the functionality offered by these HAL functions. Caller will manage the discovery of logical addresses in sink devices, while HAL needs to facilitate sending and receiving the CEC commands on the network. Specifically concerning the CEC Module, the HAL layers facilitate the following functionalities on sink devices: + +1. Provision to set, get, and remove the logical address +2. Provision to get the Physical address +3. Provision to Tx and Rx the CEC data + +## Test scenarios + +The HAL CEC layer enables the transmission and reception of CEC frames on the CEC bus. However, it does not manage or validate any particular CEC opcode commands to confirm the supported HAL CEC opcodes for transmission or reception. + +Managing the opcodes is the responsibility of the caller. The existing test cases will validate responses from connected devices for a subset of opcodes as part of the testing procedure. + +|S.No.|Test Functionality|Description| +|-----|------------------|-----------| +| 1 |[Logical address](#logical-address-discovery)|Facilitating the Discovery of logical addresses, Setting, getting, and removing the logical address of the device (for sink devices) | +| 2| [Physical Address](#physical-address)| Retrieving the physical address | +| 3| [CEC Synchronous Transmission](#cec-synchronous-transmission)| Transmitting CEC frames and reporting on their acknowledgement| +| 4| [CEC Receive functionality](#cec-receive-functionality)| Receiving CEC Information from other devices and passing it to the layer above through registered callback function | +| 5| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Managing CEC during Hotplug and HotUnplug events | + +----------- + +## Logical Address Discovery + +|S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| +|-----|------------------|-----------|--------|--|--|--------------------------| +| 1 |[Logical address](#logical-address-discovery)|Get the logical address of the `DUT` without actually adding the Logical Address and the API should return 0x0F as the default logical address.|HdmiCecGetLogicalAddress|Y|NA +|a| |Setup all valid logical addresses b/w 0x00 to 0x0F for the `DUT` and retrieve each to ensure proper functionality, using HAL APIs.|HdmiCecAddLogicalAddress, HdmiCecGetLogicalAddress, HdmiCecRemoveLogicalAddress| Y | NA | +|b| | Invoke the HAL API to delete the `DUT` logical address and verify that it is removed successfully. |HdmiCecAddLogicalAddress, HdmiCecRemoveLogicalAddress, HdmiCecGetLogicalAddress| Y | NA| +|c| | After deleting the `DUT` logical address, try to send a broadcast CEC Command (as per 1.4b HDMI CEC spec) and confirm transmission is successful.|HdmiCecAddLogicalAddress, HdmiCecRemoveLogicalAddress, HdmiCecTx | Y|NA|| + +### Emulator Requirements + +- Boot with control configuration with various configurations having a predefined set of nodes: + - configuration to support the discovery of logical addresses. The caller provides the logical address, and HAL checks the availability of this address and feedback the same to the caller. + - Verify for the valid logical address and return the appropriate error code based on the logical address availability. + +## Physical Address + +|S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| +|-----|------------------|-----------|--------|--|--|--------------------------| +| 2| [Physical Address](#physical-address)| Verify the valid physical address allocated through the HAL function.|HdmiCecGetPhysicalAddress| Y |NA|| +| | | Verify the physical addresses allocated by connecting two sink devices through an HDMI switch.| HdmiCecGetPhysicalAddress| NA | Y | Enable the television connected to `DUT` to declare its physical address first before `DUT`.| + +### Emulator Requirements - Physical Address + +- Boot control configuration to setup the CEC network nodes +- Scenario to have two sink devices on the network + +### Control Plane Requirements - Physical Address + +- The control plane will allow removing or adding a node to the network. + - allowing add sink node before the `DUT` switched ON. + +## CEC Synchronous Transmission + +|S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| +|-----|------------------|-----------|--------|--|--|--------------------------| +| 3| [CEC Transmission](#cec-transmission)| Verify the correct transmission of the supported CEC commands (as per 1.4b HDMI CEC spec) to the connected device and ensure it is acknowledged properly.| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y |Control plane to switch ON a CEC-supported device on the HDMI network so that it shall respond to the basic commands| +| | | Broadcast a supported CEC Command to all the devices connected to the network without any error |HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress| NA | Y |Control plane to switch ON a CEC-supported device on the HDMI network to act on the broadcasted command| +| | | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitoring the behaviour of the connected device accordingly.| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y | Control plane to monitor the behaviour of the connected devices. | +| | | Transmit a HDMI CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version of a device that doesn't exist.| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | Y | NA | Control plane can unplug or switch off a previously existing CEC device | + +### Emulator Requirements - CEC Transmission +- Boot configuration + - Min case scenario multiple network nodes + - Max case scenario multiple cec nodes + +### Control Plane Requirements - CEC Transmission +- The control plane will allow adding a device that can respond to the CEC Frames sent by `DUT` + +## CEC Receive functionality + +|S.No.|Test Functionality|Description| HAL APIs|L2|L3|Control plane requirements| +|-----|------------------|-----------|---------|--|--|--------------------------| +| 5| [CEC Receive functionality](#cec-receive-functionality)| Transmit a CEC Command that expects a response (Eg. GetCECVersion) to a connected device and see the response is received correctly. Set the Rx Callback before sending the data. Validate the received CEC Version.|HdmiCecAddLogicalAddress, HdmiCecSetRxCallback, HdmiCecTx, HdmiCecRemoveLogicalAddress| NA |Y| Control plane to switch ON a CEC device that can respond to the Transmitted CEC Command| +| | | Transmit a CEC command from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (`DUT` TV here)| HdmiCecAddLogicalAddress, HdmiCecSetRxCallback, HdmiCecRemoveLogicalAddress | NA | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`| +| | | Transmit an OSD CEC command from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (`DUT` TV here). Make the OSD String to max length| HdmiCecAddLogicalAddress, HdmiCecSetRxCallback, HdmiCecRemoveLogicalAddress | NA | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`| +| | | Transmit an OSD CEC command from the connected devices continuously for 30 seconds changing the patterns in the payload and considering the Acknowledgement and responses are received correctly from the host device (`DUT` TV here). Make the OSD String to max length| HdmiCecAddLogicalAddress, HdmiCecSetRxCallback, HdmiCecRemoveLogicalAddress | NA | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`. Also, Control plane to detect the OSD Display on the Sink device to validate| +| | | Set the Logical address to 0 on `DUT` and make sure that it doesn't receive the messages sent to devices with different logical address.| HdmiCecAddLogicalAddress, HdmiCecSetRxCallback, HdmiCecRemoveLogicalAddress | NA | Y | Control Plane to initiate a command to send CEC frames from CEC adaptor with a different logical address other than zero| + +### Emulator Requirements - CEC Receive functionality +1. Emulate the Tx and Rx HAL functionalities with the required responses. + +### Control Plane Requirements - CEC Transmission +- The control plane will allow adding a device that can respond to the CEC Frames sent by `DUT` +- The control plane to initiate CEC Transmissions from the connected devices as expected by the `DUT` + +## CEC HotPlug Functionality + +|S.No.|Test Functionality|Description| HAL APIs |L2|L3|Control plane requirements| +|-----|------------------|-----------|----------|--|--|--------------------------| +| 6| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Generate a Hotplug event by disconnecting the device connected to the HDMI port of the Sink Platform. Validating whether the CEC Transmission (use Polling command) works when the HDMI port is disconnected should result in ACK not being received while the TX still works as expected. | HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y | Control Panel to control the Hotplug activities | +| | | Check the behaviour when a device has been remove from the network which is not directly connected to the TV device. Send a CEC Tx command with acknowledgement using HAL Interface and check the behaviour. The Tx command should succeed, but the message should not be Acknowledged.| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y | Control Panel to control the external devices connected.| + +### Emulator Requirements - CEC HotPlug Functionality + +### Control Plane Requirements - CEC HotPlug Functionality +1. Control plane to initiate the HotPlug activity by commanding an IP power switch to the OFF State to which the Node device is connected. + +----------- +----------- + +## Hardware Verification Testing Requirements + +|S.No.|Test Functionality|Description| HAL APIs |L2|L3|Control plane requirements| +|-----|------------------|-----------|----------|--|--|--------------------------| +| 7| Introduce fault in the CEC Bus | Absorve the behaviour when the CEC line is pulled high during the CEC Transmission using a CEC Adaptor that provision to keep the CEC line pulled high| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y |CEC Adaptor used shall have a provision to introduce the fault. The control plane should be able to command to pull the CEC line high, else it should follow a manual process| +| 8| Overloading the CEC bus. | Overload the CEC bus with too many messages (by connecting more devices in the network) and observe the behaviour| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y |Control plane to initiate the CEC Transmission through all the connected devices continuously with a command that expects the response as well to overload the CEC Network. | + +### Emulator Requirements +1. Emulator to support the HDMI_CEC_IO_SENT_FAILED during the above scenarios + +### Control Plane Requirements +1. Control Plane to control the external devices to pull the CEC line high. +2. Control Plan to initiate multiple CEC commands from the different devices connected to the network. +----------- +----------- + +## Boot configuartion + +### Module Configuration Requirements + +The module must be configured during the boot sequence in the case of emulation as if it were a real hardware device with or without multiple connected HDMI nodes. + +### Test Configuration for Sink Devices + +The following information shall be helpful for further running the Automation Rack Test for this specific module and further configuration will help for the Design and Development of Virtual Device. + +Configurations: + +```yaml + Device: + Type: Source / Sink + Platform_Manufacturer: sony/Samsung etc. + Platform_Model: xyz + Port: 3, 4 + HDMI Node: 1-3 etc. + CEC_Ports: 1, x, y +``` \ No newline at end of file diff --git a/docs/pages/hdmi_cec_source_driver_L2_Low-Level_TestSpecification.md b/docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md similarity index 100% rename from docs/pages/hdmi_cec_source_driver_L2_Low-Level_TestSpecification.md rename to docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md diff --git a/src/main.c b/src/main.c index 0bbb85e..fc817c8 100644 --- a/src/main.c +++ b/src/main.c @@ -64,7 +64,8 @@ #include extern int register_hdmicec_hal_l1_tests( void ); -extern int register_hdmicec_hal_l2_tests( void ); +extern int register_hdmicec_hal_source_l2_tests( void ); +extern int register_hdmicec_hal_sink_l2_tests( void ); extern int register_vcomponent_tests ( char* profile, unsigned short cpPort, char* cpPath ); int main(int argc, char** argv) @@ -108,7 +109,8 @@ int main(int argc, char** argv) UT_init( argc, argv ); register_hdmicec_hal_l1_tests (); - register_hdmicec_hal_l2_tests (); + register_hdmicec_hal_source_l2_tests (); + register_hdmicec_hal_sink_l2_tests (); register_vcomponent_tests(pProfilePath, cpPort, pUrl); UT_run_tests(); diff --git a/src/test_l2_hdmi_cec_sink_driver.c b/src/test_l2_hdmi_cec_sink_driver.c new file mode 100644 index 0000000..dad67c9 --- /dev/null +++ b/src/test_l2_hdmi_cec_sink_driver.c @@ -0,0 +1,482 @@ +/* +* If not stated otherwise in this file or this component's LICENSE file the +* following copyright and licenses apply:* +* Copyright 2024 RDK Management +* +* 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. +*/ + +/** + * @addtogroup HPK Hardware Porting Kit + * @{ + * + */ + +/** + * @addtogroup HDMI_CEC HDMI CEC Module + * @{ + * + */ + +/** + * @defgroup HDMI_CEC_HALTESTS HDMI CEC HAL Tests + * @{ + * + */ + + +/** + * @defgroup HDMI_CEC_HALTESTS_L2 HDMI CEC HAL Tests L2 File + * @{ + * @parblock + * + * ### L2 Test Cases for HDMI CEC HAL : + * + * @file test_l2_hdmi_cec_driver.c + * @page hdmi_cec_driver Level 2 Tests + * + * ## Module's Role + * This module includes Level 2 functional tests (success and failure scenarios). + * This is to ensure that the hdmi_cec_driver APIs meet the requirements across all vendors. + * + * **Pre-Conditions:** None@n + * **Dependencies:** None@n + * + * Refer to API Definition specification documentation : [hdmi-cec_halSpec.md](../../docs/pages/hdmi-cec_halSpec.md) + * + * @endparblock + */ + +#include +#include +#include "hdmi_cec_driver.h" + +static int gTestGroup = 2; +static int gTestID = 1; + +/** +* @brief Test for getting the default logical address of the HDMI CEC driver +* +* This test case validates the functionality of getting the default logical address of the HDMI CEC driver. It first opens a connection to the HDMI CEC driver, then retrieves the logical address, checks if the address is correct, and finally closes the connection. This test is important to ensure that the HDMI CEC driver is correctly assigning the default logical address. +* +* **Test Group ID:** 02@n +* **Test Case ID:** 001@n +* +* **Test Procedure:** +* Refer to UT specification documentation [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +*/ + +void test_l2_hdmi_cec_driver_GetDefaultLogicalAddress(void) +{ + gTestID = 1; + int handle = 0; + int logicalAddress = 0; + HDMI_CEC_STATUS status; + + UT_LOG_INFO("In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); + + // Step 1: Call the pre-requisite API HdmiCecOpen() + UT_LOG_DEBUG("Invoking HdmiCecOpen with valid handle"); + status = HdmiCecOpen(&handle); + UT_ASSERT_EQUAL_FATAL(status, HDMI_CEC_IO_SUCCESS); + UT_ASSERT_NOT_EQUAL_FATAL(handle, 0); + + // Step 2: Call the API HdmiCecGetLogicalAddress() + UT_LOG_DEBUG("Invoking HdmiCecGetLogicalAddress with handle: %d", handle); + status = HdmiCecGetLogicalAddress(handle, &logicalAddress); + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_SUCCESS); + if (status != HDMI_CEC_IO_SUCCESS) + { + UT_LOG_ERROR("HdmiCecGetLogicalAddress failed with status: %d", status); + HdmiCecClose(handle); // Cleanup if test fails + return; + } + + // Step 3: Check the logical address + UT_LOG_DEBUG("Checking logical address: %d", logicalAddress); + UT_ASSERT_EQUAL(logicalAddress, 0x0F); + + // Step 4: Call the post-requisite API HdmiCecClose() + UT_LOG_DEBUG("Invoking HdmiCecClose with handle: %d", handle); + status = HdmiCecClose(handle); + UT_ASSERT_EQUAL_FATAL(status, HDMI_CEC_IO_SUCCESS); + + UT_LOG_INFO("Out %s\n", __FUNCTION__); +} + +/** +* @brief This test checks the functionality of adding and getting logical addresses in HDMI CEC driver +* +* This test case is designed to validate the correct operation of the HdmiCecAddLogicalAddress and HdmiCecGetLogicalAddress APIs. +* It does this by first opening a handle to the HDMI CEC driver, then adding logical addresses to it, and finally retrieving those addresses to verify they were correctly added. +* The test ensures that the APIs return the expected status codes and that the retrieved addresses match the ones that were added. +* +* **Test Group ID:** 02@n +* **Test Case ID:** 002@n +* +* **Test Procedure:** +* Refer to UT specification documentation [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +*/ +void test_l2_hdmi_cec_driver_AddAndGetLogicalAddress(void) +{ + gTestID = 2; + UT_LOG_INFO("In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); + + int handle; + HDMI_CEC_STATUS status; + int logicalAddress; + + // Step 1: Call the pre-requisite API HdmiCecOpen + status = HdmiCecOpen(&handle); + UT_LOG_DEBUG("Invoking HdmiCecOpen with valid handle"); + UT_ASSERT_EQUAL_FATAL(status, HDMI_CEC_IO_SUCCESS); + + // Step 2: Call the API HdmiCecAddLogicalAddress and HdmiCecGetLogicalAddress for each logical address + for (int i = 0x00; i <= 0x0F; i++) + { + status = HdmiCecAddLogicalAddress(handle, i); + UT_LOG_DEBUG("Invoking HdmiCecAddLogicalAddress with handle: %d and logicalAddress: %d", handle, i); + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_SUCCESS); + if (status != HDMI_CEC_IO_SUCCESS) + { + UT_LOG_ERROR("HdmiCecAddLogicalAddress failed with status: %d\n", status); + continue; + } + + status = HdmiCecGetLogicalAddress(handle, &logicalAddress); + UT_LOG_DEBUG("Invoking HdmiCecGetLogicalAddress with handle: %d and logicalAddress: %d", handle, logicalAddress); + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_SUCCESS); + UT_ASSERT_EQUAL(logicalAddress, i); + if ((status != HDMI_CEC_IO_SUCCESS) || (logicalAddress != i)) + { + UT_LOG_ERROR("HdmiCecGetLogicalAddress failed with status: %d logical address : %d\n", status, logicalAddress ); + } + + status = HdmiCecRemoveLogicalAddress(handle, i); + UT_LOG_DEBUG("Invoking HdmiCecRemoveLogicalAddress with handle: %d and logicalAddress: %d", handle, i); + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_SUCCESS); + if (status != HDMI_CEC_IO_SUCCESS) + { + UT_LOG_ERROR("HdmiCecRemoveLogicalAddress failed with status: %d\n", status); + } + } + + // Step 4: Call the post-requisite API HdmiCecClose + status = HdmiCecClose(handle); + UT_LOG_DEBUG("Invoking HdmiCecClose with handle: %d", handle); + UT_ASSERT_EQUAL_FATAL(status, HDMI_CEC_IO_SUCCESS); + + UT_LOG_INFO("Out %s\n", __FUNCTION__); +} + +/** +* @brief Test the removal of a logical address in the HDMI CEC driver +* +* This function tests the removal of a logical address in the HDMI CEC driver. +* It first opens the driver, adds a logical address, removes the logical address, checks that the logical address has been removed, +* and finally closes the driver. +* +* **Test Group ID:** 02@n +* **Test Case ID:** 003@n +* +* **Test Procedure:** +* Refer to UT specification documentation [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +*/ + +void test_l2_hdmi_cec_driver_RemoveLogicalAddress(void) +{ + gTestID = 3; + UT_LOG_INFO("In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); + + int handle; + int logicalAddress = 0x00; // valid logical address + HDMI_CEC_STATUS status; + int getLogicaladdress; + + // Call the pre-requisite API HdmiCecOpen + status = HdmiCecOpen(&handle); + UT_LOG_DEBUG("Invoking HdmiCecOpen with handle: %d", handle); + UT_ASSERT_EQUAL_FATAL(status, HDMI_CEC_IO_SUCCESS); + + // Invoke the API HdmiCecAddLogicalAddress + status = HdmiCecAddLogicalAddress(handle, logicalAddress); + UT_LOG_DEBUG("Invoking HdmiCecAddLogicalAddress with handle: %d and logicalAddress: %d", handle, logicalAddress); + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_SUCCESS); + if (status != HDMI_CEC_IO_SUCCESS) + { + UT_LOG_ERROR("HdmiCecAddLogicalAddress failed with status: %d\n", status); + HdmiCecClose(handle); + return; + } + + // Invoke the API HdmiCecGetLogicalAddress + status = HdmiCecGetLogicalAddress(handle, &getLogicaladdress); + UT_LOG_DEBUG("Invoking HdmiCecGetLogicalAddress with handle: %d", handle); + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_SUCCESS); + UT_ASSERT_EQUAL(logicalAddress, getLogicaladdress); + if ((status != HDMI_CEC_IO_SUCCESS) || (getLogicaladdress != logicalAddress)) + { + UT_LOG_ERROR("HdmiCecGetLogicalAddress failed with status: %d logical address : %d\n", status, getLogicaladdress ); + } + + // Invoke the API HdmiCecRemoveLogicalAddress + status = HdmiCecRemoveLogicalAddress(handle, logicalAddress); + UT_LOG_DEBUG("Invoking HdmiCecRemoveLogicalAddress with handle: %d and logicalAddress: %d", handle, logicalAddress); + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_SUCCESS); + if (status != HDMI_CEC_IO_SUCCESS) + { + UT_LOG_ERROR("HdmiCecRemoveLogicalAddress failed with status: %d\n", status); + HdmiCecClose(handle); + return; + } + + // Invoke the API HdmiCecGetLogicalAddress + status = HdmiCecGetLogicalAddress(handle, &getLogicaladdress); + UT_LOG_DEBUG("Invoking HdmiCecGetLogicalAddress with handle: %d", handle); + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_SUCCESS); + UT_ASSERT_EQUAL(getLogicaladdress, 0x0F); + if ((status != HDMI_CEC_IO_SUCCESS) || (getLogicaladdress != 0x0F)) + { + UT_LOG_ERROR("HdmiCecGetLogicalAddress failed with status: %d logical address : %d\n", status, getLogicaladdress ); + HdmiCecClose(handle); + return; + } + + // Call the post-requisite API HdmiCecClose + status = HdmiCecClose(handle); + UT_LOG_DEBUG("Invoking HdmiCecClose with handle: %d", handle); + UT_ASSERT_EQUAL_FATAL(status, HDMI_CEC_IO_SUCCESS); + + UT_LOG_INFO("Out %s\n", __FUNCTION__); +} + +/** +* @brief Test for broadcasting HDMI CEC command +* +* This function tests the HDMI CEC driver's ability to broadcast a HDMI CEC command when logical address is removed. +* It first opens the HDMI CEC HAL, adds a logical address, removes the logical address, sends a broadcast HDMI CEC command, +* and finally closes the HDMI CEC HAL. +* +* **Test Group ID:** 02@n +* **Test Case ID:** 004@n +* +* **Test Procedure:** +* Refer to UT specification documentation [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +*/ + +void test_l2_hdmi_cec_driver_BroadcastHdmiCecCommand(void) +{ + gTestID = 4; + UT_LOG_INFO("In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); + + int handle; + int logicalAddresses = 0x0; // valid logical address + unsigned char buf[] = {0x0F, 0x84, 0x00, 0x00}; // valid CEC message + int len = sizeof(buf); + int result; + + HDMI_CEC_STATUS status = HdmiCecOpen(&handle); + UT_LOG_DEBUG("Invoking HdmiCecOpen with handle: %d", handle); + UT_ASSERT_EQUAL_FATAL(status, HDMI_CEC_IO_SUCCESS); + + status = HdmiCecAddLogicalAddress(handle, logicalAddresses); + UT_LOG_DEBUG("Invoking HdmiCecAddLogicalAddress with handle: %d and logicalAddress: %d", handle, logicalAddresses); + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_SUCCESS); + if (status != HDMI_CEC_IO_SUCCESS) + { + UT_LOG_ERROR("HdmiCecAddLogicalAddress failed with status: %d\n", status); + HdmiCecClose(handle); + return; + } + + status = HdmiCecRemoveLogicalAddress(handle, logicalAddresses); + UT_LOG_DEBUG("Invoking HdmiCecRemoveLogicalAddress with handle: %d and logicalAddress: %d", handle, logicalAddresses); + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_SUCCESS); + if (status != HDMI_CEC_IO_SUCCESS) + { + UT_LOG_ERROR("HdmiCecRemoveLogicalAddress failed with status: %d\n", status); + HdmiCecClose(handle); + return; + } + + status = HdmiCecTx(handle, buf, len, &result); + UT_LOG_DEBUG("Invoking HdmiCecTx with handle: %d status:%d result:%d\n", handle, status, result); + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_SUCCESS); + if (status != HDMI_CEC_IO_SUCCESS) + { + UT_LOG_ERROR("HdmiCecTx failed with status: %d\n", status); + HdmiCecClose(handle); + return; + } + + UT_ASSERT_EQUAL(result, HDMI_CEC_IO_SENT_BUT_NOT_ACKD); + if (result != HDMI_CEC_IO_SENT_BUT_NOT_ACKD) + { + UT_LOG_ERROR("HdmiCecTx result: %d\n", result); + } + + status = HdmiCecClose(handle); + UT_LOG_DEBUG("Invoking HdmiCecClose with handle: %d", handle); + UT_ASSERT_EQUAL_FATAL(status, HDMI_CEC_IO_SUCCESS); + + UT_LOG_INFO("Out %s\n", __FUNCTION__); +} + +/** +* @brief Test to verify the physical address of the HDMI CEC driver +* +* This test case verifies the physical address of the HDMI CEC driver by calling the HdmiCecGetPhysicalAddress() API. +* The test ensures that the physical address obtained is less than F.F.F.F. +* The test also includes error handling and assertions to check the return values of the APIs. +* The test ensures that the post-requisite API HdmiCecClose() is called in case of any test failure after the successful execution of the pre-requisite API HdmiCecOpen(). +* +* **Test Group ID:** 02@n +* **Test Case ID:** 005@n +* +* **Test Procedure:** +* Refer to UT specification documentation [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +*/ + +void test_l2_hdmi_cec_driver_VerifyPhysicalAddress(void) +{ + gTestID = 5; + int handle; + unsigned int physicalAddress; + HDMI_CEC_STATUS status; + + UT_LOG_INFO("In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); + + // Step 1: Call the pre-requisite API HdmiCecOpen() + UT_LOG_DEBUG("Invoking HdmiCecOpen with valid handle"); + status = HdmiCecOpen(&handle); + UT_ASSERT_EQUAL_FATAL(status, HDMI_CEC_IO_SUCCESS); + + // Step 2: Call the API HdmiCecGetPhysicalAddress() + UT_LOG_DEBUG("Invoking HdmiCecGetPhysicalAddress with handle: %d", handle); + status = HdmiCecGetPhysicalAddress(handle, &physicalAddress); + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_SUCCESS); + // Step 3: Check the return status of HdmiCecGetPhysicalAddress() + if (status != HDMI_CEC_IO_SUCCESS) + { + UT_LOG_ERROR("HdmiCecGetPhysicalAddress failed with status: %d", status); + HdmiCecClose(handle); // Closing the handle as the test failed + return; + } + + // Step 4: Verify that the physical address obtained is less than F.F.F.F + UT_LOG_DEBUG("Checking if physical address: %u is less than F.F.F.F", physicalAddress); + UT_ASSERT_TRUE(physicalAddress < 0xFFFF); + + // Step 5: Call the post-requisite API HdmiCecClose() + UT_LOG_DEBUG("Invoking HdmiCecClose with handle: %d", handle); + status = HdmiCecClose(handle); + UT_ASSERT_EQUAL_FATAL(status, HDMI_CEC_IO_SUCCESS); + + UT_LOG_INFO("Out %s\n", __FUNCTION__); +} + +/** +* @brief This test function is designed to test the transmission of CEC commands in the HDMI CEC driver. +* +* This test function tests the transmission of CEC commands in the HDMI CEC driver. +* It opens a connection, adds a logical address, sends a CEC command, removes the logical address, and then closes the connection. +* The test asserts that each operation returns the expected status. +* +* **Test Group ID:** 02@n +* **Test Case ID:** 006@n +* +* **Test Procedure:** +* Refer to UT specification documentation [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +*/ + +void test_l2_hdmi_cec_driver_TransmitCECCommand(void) +{ + gTestID = 6; + UT_LOG_INFO("In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); + + int handle; + int logicalAddresses = 0x4; // Example logical address + unsigned char buf[] = {0x47, 0x9F}; // Example CEC message + int len = sizeof(buf); + int result; + + HDMI_CEC_STATUS status = HdmiCecOpen(&handle); + UT_LOG_DEBUG("Invoking HdmiCecOpen with valid handle"); + UT_ASSERT_EQUAL_FATAL(status, HDMI_CEC_IO_SUCCESS); + + status = HdmiCecAddLogicalAddress(handle, logicalAddresses); + UT_LOG_DEBUG("Invoking HdmiCecAddLogicalAddress with handle: %d and logicalAddress: %d", handle, logicalAddresses); + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_SUCCESS); + if (status != HDMI_CEC_IO_SUCCESS) + { + UT_LOG_ERROR("HdmiCecAddLogicalAddress failed with status: %d\n", status); + HdmiCecClose(handle); + return; + } + + status = HdmiCecTx(handle, buf, len, &result); + UT_LOG_DEBUG("Invoking HdmiCecTx with handle: %d status:%d result:%d \n", handle, status,result); + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_SUCCESS); + UT_ASSERT_EQUAL(result, HDMI_CEC_IO_SENT_BUT_NOT_ACKD); + if ((result != HDMI_CEC_IO_SENT_BUT_NOT_ACKD) && (status != HDMI_CEC_IO_SUCCESS)) + { + UT_LOG_ERROR("HdmiCecTx failed with status: %d result:%d\n", status, result); + HdmiCecRemoveLogicalAddress(handle, logicalAddresses); + HdmiCecClose(handle); + return; + } + + status = HdmiCecRemoveLogicalAddress(handle, logicalAddresses); + UT_LOG_DEBUG("Invoking HdmiCecRemoveLogicalAddress with handle: %d and logicalAddress: %d", handle, logicalAddresses); + UT_ASSERT_EQUAL(status, HDMI_CEC_IO_SUCCESS); + if (status != HDMI_CEC_IO_SUCCESS) + { + UT_LOG_ERROR("HdmiCecRemoveLogicalAddress failed with status: %d\n", status); + HdmiCecClose(handle); + return; + } + + status = HdmiCecClose(handle); + UT_LOG_DEBUG("Invoking HdmiCecClose with handle: %d", handle); + UT_ASSERT_EQUAL_FATAL(status, HDMI_CEC_IO_SUCCESS); + + UT_LOG_INFO("Out %s\n", __FUNCTION__); +} + +static UT_test_suite_t * pSuite = NULL; + +/** + * @brief Register the main tests for this module + * + * @return int - 0 on success, otherwise failure + */ + +int test_hdmicec_hal_l2_register(void) +{ + // Create the test suite + pSuite = UT_add_suite("[L2 HDMICEC PANEL TestCase] ", NULL, NULL); + if (pSuite == NULL) + { + return -1; + } + // List of test function names and strings + + UT_add_test( pSuite, "l2_hdmi_cec_driver_GetDefaultLogicalAddress", test_l2_hdmi_cec_driver_GetDefaultLogicalAddress); + UT_add_test( pSuite, "l2_hdmi_cec_driver_AddAndGetLogicalAddress", test_l2_hdmi_cec_driver_AddAndGetLogicalAddress); + UT_add_test( pSuite, "l2_hdmi_cec_driver_RemoveLogicalAddress", test_l2_hdmi_cec_driver_RemoveLogicalAddress); + UT_add_test( pSuite, "l2_hdmi_cec_driver_BroadcastHdmiCecCommand", test_l2_hdmi_cec_driver_BroadcastHdmiCecCommand); + UT_add_test( pSuite, "l2_hdmi_cec_driver_VerifyPhysicalAddress", test_l2_hdmi_cec_driver_VerifyPhysicalAddress); + UT_add_test( pSuite, "l2_hdmi_cec_driver_TransmitCECCommand", test_l2_hdmi_cec_driver_TransmitCECCommand); + + return 0; +} \ No newline at end of file diff --git a/src/test_l2_hdmi_cec_source_driver.c b/src/test_l2_hdmi_cec_source_driver.c index e640107..6801dcb 100644 --- a/src/test_l2_hdmi_cec_source_driver.c +++ b/src/test_l2_hdmi_cec_source_driver.c @@ -128,7 +128,7 @@ static UT_test_suite_t * pSuite = NULL; * @return int - 0 on success, otherwise failure */ -int test_hdmi_cec_driver_l2_register(void) +int test_hdmi_cec_driver_source_l2_register(void) { // Create the test suite pSuite = UT_add_suite("[L2 hdmi_cec_driver]", NULL, NULL); diff --git a/src/test_register.c b/src/test_register.c index 81991db..b0e36c2 100644 --- a/src/test_register.c +++ b/src/test_register.c @@ -62,23 +62,32 @@ /* L1 Testing Functions */ extern int test_hdmicec_hal_l1_register( void ); -extern int test_hdmicec_hal_l2_register( void ); +extern int test_hdmi_cec_driver_source_l2_register( void ); +extern int test_hdmi_cec_driver_sink_l2_register( void ); int register_hdmicec_hal_l1_tests( void ) { int registerFailed=0; - registerFailed |= test_hdmicec_hal_l_register(); + registerFailed |= test_hdmicec_hal_l1_register(); return registerFailed; } -int register_hdmicec_hal_l2_tests( void ) +int register_hdmicec_hal_source_l2_tests( void ) { int registerFailed=0; - registerFailed |= test_hdmicec_hal_l2_register(); + registerFailed |= test_hdmi_cec_driver_source_l2_register(); + + return registerFailed; +} +int register_hdmicec_hal_sink_l2_tests( void ) +{ + int registerFailed=0; + + registerFailed |= test_hdmi_cec_driver_sink_l2_register(); return registerFailed; } From 872ee979962aae437f73ba214dc6251e7af034a3 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Fri, 21 Jun 2024 11:22:15 -0400 Subject: [PATCH 27/48] Corrected Mistype --- src/test_l2_hdmi_cec_sink_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test_l2_hdmi_cec_sink_driver.c b/src/test_l2_hdmi_cec_sink_driver.c index dad67c9..de7c993 100644 --- a/src/test_l2_hdmi_cec_sink_driver.c +++ b/src/test_l2_hdmi_cec_sink_driver.c @@ -461,7 +461,7 @@ static UT_test_suite_t * pSuite = NULL; * @return int - 0 on success, otherwise failure */ -int test_hdmicec_hal_l2_register(void) +int test_hdmi_cec_driver_sink_l2_register(void) { // Create the test suite pSuite = UT_add_suite("[L2 HDMICEC PANEL TestCase] ", NULL, NULL); From c098239dbd2ad2ebde76aa5ef895077c347fc057 Mon Sep 17 00:00:00 2001 From: Santhosh Ramani Date: Fri, 21 Jun 2024 20:53:28 +0530 Subject: [PATCH 28/48] gh#34 fix compilation issue for arm platforms --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a736743..42099b6 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ build: $(SETUP_VCOMPONENT_LIBS) #Build against the real library leads to the SOC library dependency also.SOC lib dependency cannot be specified in the ut Makefile, since it is supposed to be common across may platforms. So in order to over come this situation, creating a template skelton library with empty templates so that the template library wont have any other Soc dependency. And in the real platform mount copy bind with the actual library will work fine. vcomponent: echo $(CC) - $(CC) -fPIC -shared -I$(ROOT_DIR)/../include $(VCOMPONENT_SRCS) -o lib$(HAL_LIB).so + $(CC) -fPIC -shared -I$(ROOT_DIR)/../include -I$(ROOT_DIR)/vcomponent/include -I$(ROOT_DIR)/ut-core/include $(VCOMPONENT_SRCS) -o lib$(HAL_LIB).so mkdir -p $(HAL_LIB_DIR) cp $(ROOT_DIR)/lib$(HAL_LIB).so $(HAL_LIB_DIR) From 5b64386155264adea5f5004ee3f742eb572feea0 Mon Sep 17 00:00:00 2001 From: Santhosh Ramani Date: Fri, 21 Jun 2024 23:56:42 +0530 Subject: [PATCH 29/48] gh #34 Fix Compilation issue after ut-control integration --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 42099b6..91aeec1 100644 --- a/Makefile +++ b/Makefile @@ -52,6 +52,8 @@ HAL_LIB_DIR := $(ROOT_DIR)/libs YLDFLAGS = -Wl,-rpath,$(HAL_LIB_DIR) -L$(HAL_LIB_DIR) -l$(HAL_LIB) -lpthread -lrt ifeq ("$(wildcard $(HAL_LIB_DIR)/lib$(HAL_LIB).so)","") SETUP_VCOMPONENT_LIBS := vcomponent +SRC_DIRS += $(ROOT_DIR)/vcomponent/src +INC_DIRS += $(ROOT_DIR)/vcomponent/include endif endif @@ -76,7 +78,7 @@ build: $(SETUP_VCOMPONENT_LIBS) #Build against the real library leads to the SOC library dependency also.SOC lib dependency cannot be specified in the ut Makefile, since it is supposed to be common across may platforms. So in order to over come this situation, creating a template skelton library with empty templates so that the template library wont have any other Soc dependency. And in the real platform mount copy bind with the actual library will work fine. vcomponent: echo $(CC) - $(CC) -fPIC -shared -I$(ROOT_DIR)/../include -I$(ROOT_DIR)/vcomponent/include -I$(ROOT_DIR)/ut-core/include $(VCOMPONENT_SRCS) -o lib$(HAL_LIB).so + $(CC) -fPIC -shared -I$(ROOT_DIR)/../include -I$(ROOT_DIR)/vcomponent/include -I$(ROOT_DIR)/ut-core/include -I$(ROOT_DIR)/ut-core/framework/ut-control/include $(VCOMPONENT_SRCS) -o lib$(HAL_LIB).so mkdir -p $(HAL_LIB_DIR) cp $(ROOT_DIR)/lib$(HAL_LIB).so $(HAL_LIB_DIR) From 961e954975bc581a965c68bcca143e044cd4d86d Mon Sep 17 00:00:00 2001 From: Santhosh Ramani Date: Wed, 26 Jun 2024 15:38:51 +0530 Subject: [PATCH 30/48] Make vcomponent build based on a switch TARGET=vcomponent By default, running make without TARGET will only build linux skeleton. --- Makefile | 30 ++++++++++++++++++++++-------- src/main.c | 10 +++++++++- src/test_vcomponent.c | 5 ++++- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 91aeec1..960f54b 100644 --- a/Makefile +++ b/Makefile @@ -35,13 +35,13 @@ SRC_DIRS = $(ROOT_DIR)/src INC_DIRS := $(ROOT_DIR)/../include HAL_LIB := RCECHal VCOMPONENT_SRCS := $(ROOT_DIR)/vcomponent/src/vcomponent_hdmi_cec.c +SKELTON_SRCS := $(ROOT_DIR)/skeletons/src/hdmi_cec_driver.c ifeq ($(TARGET),) $(info TARGET NOT SET ) $(info TARGET FORCED TO Linux) TARGET=linux -SRC_DIRS += $(ROOT_DIR)/vcomponent/src -INC_DIRS += $(ROOT_DIR)/vcomponent/include +SRC_DIRS += $(ROOT_DIR)/skeletons/src YLDFLAGS += -lpthread -lrt endif @@ -51,12 +51,21 @@ ifeq ($(TARGET),arm) HAL_LIB_DIR := $(ROOT_DIR)/libs YLDFLAGS = -Wl,-rpath,$(HAL_LIB_DIR) -L$(HAL_LIB_DIR) -l$(HAL_LIB) -lpthread -lrt ifeq ("$(wildcard $(HAL_LIB_DIR)/lib$(HAL_LIB).so)","") -SETUP_VCOMPONENT_LIBS := vcomponent -SRC_DIRS += $(ROOT_DIR)/vcomponent/src -INC_DIRS += $(ROOT_DIR)/vcomponent/include +SETUP_SKELETON_LIBS := skeleton endif endif +ifeq ($(TARGET),vcomponent) +HAL_LIB_DIR := $(ROOT_DIR)/libs +YLDFLAGS = -Wl,-rpath,$(HAL_LIB_DIR) -L$(HAL_LIB_DIR) -l$(HAL_LIB) -lpthread -lrt +INC_DIRS += $(ROOT_DIR)/vcomponent/include +SETUP_SKELETON_LIBS := vcomponent +XCFLAGS = -DVCOMPONENT +export XCFLAGS +endif + + + .PHONY: clean list all export YLDFLAGS @@ -69,13 +78,18 @@ export HAL_LIB_DIR .PHONY: clean list build vcomponent - -build: $(SETUP_VCOMPONENT_LIBS) - echo "SETUP_VCOMPONENT_LIBS $(SETUP_VCOMPONENT_LIBS)" +build: $(SETUP_SKELETON_LIBS) + echo "SETUP_SKELETON_LIBS $(SETUP_SKELETON_LIBS)" @echo UT [$@] make -C ./ut-core #Build against the real library leads to the SOC library dependency also.SOC lib dependency cannot be specified in the ut Makefile, since it is supposed to be common across may platforms. So in order to over come this situation, creating a template skelton library with empty templates so that the template library wont have any other Soc dependency. And in the real platform mount copy bind with the actual library will work fine. +skeleton: + echo $(CC) + $(CC) -fPIC -shared -I$(ROOT_DIR)/../include $(SKELTON_SRCS) -o lib$(HAL_LIB).so + mkdir -p $(HAL_LIB_DIR) + cp $(ROOT_DIR)/lib$(HAL_LIB).so $(HAL_LIB_DIR) + vcomponent: echo $(CC) $(CC) -fPIC -shared -I$(ROOT_DIR)/../include -I$(ROOT_DIR)/vcomponent/include -I$(ROOT_DIR)/ut-core/include -I$(ROOT_DIR)/ut-core/framework/ut-control/include $(VCOMPONENT_SRCS) -o lib$(HAL_LIB).so diff --git a/src/main.c b/src/main.c index fc817c8..61cc825 100644 --- a/src/main.c +++ b/src/main.c @@ -66,10 +66,14 @@ extern int register_hdmicec_hal_l1_tests( void ); extern int register_hdmicec_hal_source_l2_tests( void ); extern int register_hdmicec_hal_sink_l2_tests( void ); + +#ifdef VCOMPONENT extern int register_vcomponent_tests ( char* profile, unsigned short cpPort, char* cpPath ); +#endif int main(int argc, char** argv) { +#ifdef VCOMPONENT int opt; char* pProfilePath = NULL; unsigned short cpPort = 8888; @@ -102,7 +106,7 @@ int main(int argc, char** argv) break; } } - +#endif /* Register tests as required, then call the UT-main to support switches and triggering */ @@ -111,10 +115,13 @@ int main(int argc, char** argv) register_hdmicec_hal_l1_tests (); register_hdmicec_hal_source_l2_tests (); register_hdmicec_hal_sink_l2_tests (); +#ifdef VCOMPONENT register_vcomponent_tests(pProfilePath, cpPort, pUrl); +#endif UT_run_tests(); +#ifdef VCOMPONENT if(pProfilePath != NULL) { free(pProfilePath); @@ -124,6 +131,7 @@ int main(int argc, char** argv) { free(pUrl); } +#endif } /** @} */ // End of HDMI CEC HAL Tests Main File diff --git a/src/test_vcomponent.c b/src/test_vcomponent.c index 1552fe4..e172c35 100644 --- a/src/test_vcomponent.c +++ b/src/test_vcomponent.c @@ -59,6 +59,9 @@ * */ + +#ifdef VCOMPONENT + #include #include #include @@ -149,7 +152,7 @@ int register_vcomponent_tests ( char* profile, unsigned short cpPort, char* cpPa return 0; } - +#endif /** @} */ // End of HDMI CEC HAL Virtual Component Tests File /** @} */ // End of HDMI CEC HAL Tests /** @} */ // End of HDMI CEC Module From cc4ad575ce9458e0517c554c7e55321426a25a49 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Wed, 26 Jun 2024 11:02:38 -0400 Subject: [PATCH 31/48] Make and build v3 update --- Makefile | 5 +++-- build.sh | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 960f54b..f14f0a6 100644 --- a/Makefile +++ b/Makefile @@ -81,7 +81,8 @@ export HAL_LIB_DIR build: $(SETUP_SKELETON_LIBS) echo "SETUP_SKELETON_LIBS $(SETUP_SKELETON_LIBS)" @echo UT [$@] - make -C ./ut-core + make -C ./ut-core framework + make -C ./ut-core test #Build against the real library leads to the SOC library dependency also.SOC lib dependency cannot be specified in the ut Makefile, since it is supposed to be common across may platforms. So in order to over come this situation, creating a template skelton library with empty templates so that the template library wont have any other Soc dependency. And in the real platform mount copy bind with the actual library will work fine. skeleton: @@ -103,4 +104,4 @@ list: clean: @echo UT [$@] - make -C ./ut-core clean + make -C ./ut-core cleanall diff --git a/build.sh b/build.sh index d6ac8e4..6b77cee 100755 --- a/build.sh +++ b/build.sh @@ -28,7 +28,7 @@ NC="\e[39m" # When the major version changes in the ut-core, what that signals is that the testings will have to be upgraded to support that version # Therefore in that case it warns you but doesnt' chnage to that version, which could cause your tests to break. # Change this to upgrade your UT-Core Major versions. Non ABI Changes 1.x.x are supported, between major revisions -UT_PROJECT_MAJOR_VERSION="2." +UT_PROJECT_MAJOR_VERSION="3." # Clone the Unit Test Requirements TEST_REPO=git@github.com:rdkcentral/ut-core.git @@ -60,7 +60,7 @@ else check_next_revision cd ./ut-core git checkout ${UT_CORE_PROJECT_VERSION} - ./build.sh + ./build.sh $@ cd .. ./${0} $@ fi From 2d77ec7aa3d7353d3e729844abb8b9067f6fdb14 Mon Sep 17 00:00:00 2001 From: srinivasgtl <71806084+srinivasgtl@users.noreply.github.com> Date: Thu, 27 Jun 2024 10:10:10 +0100 Subject: [PATCH 32/48] gh #24 Update hdmi-cec-sink_L2_Low-Level_TestSpec.md Updated the design of flow chart to be in sync with other modules --- .../hdmi-cec-sink_L2_Low-Level_TestSpec.md | 210 ++++++++---------- 1 file changed, 96 insertions(+), 114 deletions(-) diff --git a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md index 1d03de3..ada1f31 100644 --- a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md +++ b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md @@ -1,4 +1,4 @@ -# HDMI CEC DRIVER L2 Low Level Test Specification and Procedure Documentation +# HDMI CEC DRIVER L2 Low-Level Test Specification and Procedure Documentation ## Table of Contents @@ -25,10 +25,10 @@ This document describes the level 2 testing suite for the HDMI CEC DRIVER module - `API` \- Application Program Interface ### Definitions -- `ut-core` \- Common Testing Framework , which wraps a open-source framework that can be expanded to the requirements for future framework. +- `ut-core` \- Common Testing Framework , which wraps an open-source framework that can be expanded to the requirements for future frameworks. ### References -- `High Level Test Specification` - [hdmi_cec_sink_tests.md](hdmi_cec_sink_tests.md) +- `High-Level Test Specification` - [hdmi_cec_sink_tests.md](hdmi_cec_sink_tests.md) ## Level 2 Test Procedure @@ -40,18 +40,18 @@ The following functions are intended to test the HDMI CEC HAL module's operation |--|--| |Function Name|`test_l2_hdmi_cec_driver_GetDefaultLogicalAddress`| |Description|Get the logical address of the `DUT` without actually adding the Logical Address and the API should return 0x0F as the default logical address.| -|Test Group|Module : 02| +|Test Group|02| |Test Case ID|001| |Priority|High| -**Pre-Conditions :** +**Pre-Conditions:** None -**Dependencies :** +**Dependencies:** None -**User Interaction :** -If user chose to run the test in interactive mode, then the test case has to be selected via console. +**User Interaction:** +If the user chooses to run the test in interactive mode, then the test case has to be selected via the console. #### Test Procedure : @@ -64,19 +64,15 @@ If user chose to run the test in interactive mode, then the test case has to be ```mermaid -graph TD - style A fill:#bff,stroke:#333,stroke-width:2px - style B fill:#bbf,stroke:#333,stroke-width:2px - style C fill:#bbf,stroke:#333,stroke-width:2px - style D fill:#bff,stroke:#333,stroke-width:2px - style E fill:#f00,stroke:#333,stroke-width:2px - - A[Open HDMI CEC] --> B{Get Logical Address \n without adding one} - B -->|HDMI_CEC_IO_SUCCESS| C[Check Logical Address == 0xf] - C -->|Test successful| D[Close HDMI CEC] - B -->|Not HDMI_CEC_IO_SUCCESS| E[Test Fail] - C -->|NO| E - E --> D +graph TB +A[Call HdmiCecOpen] -->|HDMI_CEC_IO_SUCCESS| B[Call HdmiCecGetLogicalAddress] +A -->|Failure| A1[Test case fail] +B -->|HDMI_CEC_IO_SUCCESS| C[Check logical address] +B -->|Failure| B1[Test case fail] +C -->|Logical address is 0x0F| D[Call HdmiCecClose] +C -->|Logical address is not 0x0F| C1[Test case fail] +D -->|HDMI_CEC_IO_SUCCESS| E[Test case pass] +D -->|Failure| D1[Test case fail] ``` @@ -90,14 +86,14 @@ graph TD |Test Case ID|002| |Priority|High| -**Pre-Conditions :** +**Pre-Conditions:** None -**Dependencies :** +**Dependencies:** None -**User Interaction :** -If user chose to run the test in interactive mode, then the test case has to be selected via console. +**User Interaction:** +If the user chooses to run the test in interactive mode, then the test case has to be selected via the console. #### Test Procedure : @@ -112,24 +108,16 @@ If user chose to run the test in interactive mode, then the test case has to be ```mermaid -graph TD - style A fill:#bff,stroke:#333,stroke-width:2px - style B fill:#bbf,stroke:#333,stroke-width:2px - style C fill:#f9f,stroke:#333,stroke-width:2px - style D fill:#bbf,stroke:#333,stroke-width:2px - style E fill:#bbf,stroke:#333,stroke-width:2px - style F fill:#bbf,stroke:#333,stroke-width:2px - style G fill:#f9f,stroke:#333,stroke-width:2px - style H fill:#bff,stroke:#333,stroke-width:2px - - A[Open HDMI CEC Driver] --> B{HdmiCecOpen: \n handle = valid pointer} - B -->|HDMI_CEC_IO_SUCCESS| C[Manage Logical Addresses] - C -->|Each step successful| D[Add Logical Address] - D -->|HDMI_CEC_IO_SUCCESS| E[Validate Added Logical Address] - E -->|Matched| F[Remove Logical Address] - F -->|HDMI_CEC_IO_SUCCESS| G[All Addresses processed?] - G -->|No| C - G -->|Yes| H[Close HDMI CEC Driver] +graph TB +A[HdmiCecOpen] -->|HDMI_CEC_IO_SUCCESS| B{Loop 0x00 to 0x0F} +B --> |HDMI_CEC_IO_SUCCESS| C[HdmiCecAddLogicalAddress] +C --> |HDMI_CEC_IO_SUCCESS| D[HdmiCecGetLogicalAddress] +D --> |HDMI_CEC_IO_SUCCESS & Address Match| E[HdmiCecRemoveLogicalAddress] +E --> |HDMI_CEC_IO_SUCCESS| B +B --> |End of Loop| F[HdmiCecClose] +A -->|Failure| G[Test case fail] +F -->|Failure| K[Test case fail] +F -->|HDMI_CEC_IO_SUCCESS| L[Test case success] ``` @@ -143,14 +131,14 @@ graph TD |Test Case ID|003| |Priority|High| -**Pre-Conditions :** +**Pre-Conditions:** None -**Dependencies :** +**Dependencies:** None -**User Interaction :** -If user chose to run the test in interactive mode, then the test case has to be selected via console. +**User Interaction:** +If the user chooses to run the test in interactive mode, then the test case has to be selected via the console. #### Test Procedure : @@ -165,23 +153,19 @@ If user chose to run the test in interactive mode, then the test case has to be ```mermaid -graph TD - style A fill:#bff,stroke:#333,stroke-width:2px - style B fill:#bbf,stroke:#333,stroke-width:2px - style C fill:#bbf,stroke:#333,stroke-width:2px - style D fill:#bbf,stroke:#333,stroke-width:2px - style E fill:#bbf,stroke:#333,stroke-width:2px - style F fill:#bbf,stroke:#333,stroke-width:2px - style G fill:#bff,stroke:#333,stroke-width:2px - style H fill:#bbf,stroke:#333,stroke-width:2px - - A[Open HDMI CEC Driver] --> B{HdmiCecOpen:\n handle = valid handle} - B -->|HDMI_CEC_IO_SUCCESS| C[Add Logical Address] - C -->|HDMI_CEC_IO_SUCCESS| D[Get Logical Address] - D -->|HDMI_CEC_IO_SUCCESS| E[Remove Logical Address] - E -->|HDMI_CEC_IO_SUCCESS| F[Get Logical Address] - F -->|HDMI_CEC_IO_SUCCESS| H[Compare Logical Address 0x0F] - H -->|HDMI_CEC_IO_SUCCESS| G[Close HDMI CEC Driver] +graph TB +A[HdmiCecOpen] -- "HDMI_CEC_IO_SUCCESS" --> B[HdmiCecAddLogicalAddress] +A -- "Failure" --> A1[Test case fail] +B -- "HDMI_CEC_IO_SUCCESS" --> C[HdmiCecGetLogicalAddress] +B -- "Failure" --> B1[Test case fail] +C -- "HDMI_CEC_IO_SUCCESS & Logical Address = current logical address" --> D[HdmiCecRemoveLogicalAddress] +C -- "Failure" --> C1[Test case fail] +D --"HDMI_CEC_IO_SUCCESS" -->E[HdmiCecGetLogicalAddress] +D -- "Failure" --> D1[Test case fail] +E -- "HDMI_CEC_IO_SUCCESS & Logical Address = 0x0F" --> F[HdmiCecClose] +E -- "Failure" --> E1[Test case fail] +F -- "HDMI_CEC_IO_SUCCESS" --> G[Test case pass] +F -- "Failure" --> F1[Test case fail] ``` @@ -196,14 +180,14 @@ graph TD |Test Case ID|004| |Priority|High| -**Pre-Conditions :** +**Pre-Conditions:** None -**Dependencies :** +**Dependencies:** None -**User Interaction :** -If user chose to run the test in interactive mode, then the test case has to be selected via console. +**User Interaction:** +If the user chooses to run the test in interactive mode, then the test case has to be selected via the console. #### Test Procedure : @@ -218,21 +202,19 @@ If user chose to run the test in interactive mode, then the test case has to be ```mermaid -graph TD - style A fill:#bff,stroke:#333,stroke-width:2px - style B fill:#bbf,stroke:#333,stroke-width:2px - style C fill:#bbf,stroke:#333,stroke-width:2px - style D fill:#bbf,stroke:#333,stroke-width:2px - style E fill:#bbf,stroke:#333,stroke-width:2px - style F fill:#bbf,stroke:#333,stroke-width:2px - style G fill:#bff,stroke:#333,stroke-width:2px - - A[Open HDMI CEC Driver] --> B{HdmiCecOpen:\n handle = valid buffer} - B -->|HDMI_CEC_IO_SUCCESS| C[Add Logical Address] - C -->|HDMI_CEC_IO_SUCCESS| D[Remove Logical Address] - D -->|HDMI_CEC_IO_SUCCESS| E[Broadcast CEC Message] - E -->|HDMI_CEC_IO_SUCCESS| F[Check Transmission Result] - F -->|HDMI_CEC_IO_SENT_BUT_NOT_ACKD| G[Close HDMI CEC Driver] +graph TB +A[HdmiCecOpen] -- "HDMI_CEC_IO_SUCCESS" --> B[HdmiCecAddLogicalAddress] +A -- "Failure" --> A1[Test case fail] +B -- "HDMI_CEC_IO_SUCCESS" --> C[HdmiCecRemoveLogicalAddress] +B -- "Failure" --> B1[Test case fail] +C -- "HDMI_CEC_IO_SUCCESS" --> D[HdmiCecTx] +C -- "Failure" --> C1[Test case fail] +D -- "HDMI_CEC_IO_SUCCESS" --> E[Check HdmiCecTx result] +D -- "Failure" --> D1[Test case fail] +E -- "HDMI_CEC_IO_SENT_AND_ACKD" --> F[HdmiCecClose] +E -- "Failure" --> E1[Test case fail] +F -- "HDMI_CEC_IO_SUCCESS" --> G[Test case success] +F -- "Failure" --> F1[Test case fail] ``` @@ -247,14 +229,14 @@ graph TD |Test Case ID|005| |Priority|High| -**Pre-Conditions :** +**Pre-Conditions:** None -**Dependencies :** +**Dependencies:** None -**User Interaction :** -If user chose to run the test in interactive mode, then the test case has to be selected via console. +**User Interaction:** +If the user chooses to run the test in interactive mode, then the test case has to be selected via the console. #### Test Procedure : @@ -268,16 +250,15 @@ If user chose to run the test in interactive mode, then the test case has to be ```mermaid -graph TD - style A fill:#bff,stroke:#333,stroke-width:2px - style B fill:#bbf,stroke:#333,stroke-width:2px - style C fill:#bbf,stroke:#333,stroke-width:2px - style D fill:#bff,stroke:#333,stroke-width:2px - - A[Open HDMI CEC Driver] --> B{HdmiCecGetPhysicalAddress} - B -->|Not HDMI_CEC_IO_SUCCESS | D - B -->|HDMI_CEC_IO_SUCCESS| C[Verify physical address < 0xFFFF] - C -->D[Close HDMI CEC Driver] +graph TB +A[HdmiCecOpen] -->|HDMI_CEC_IO_SUCCESS| B[HdmiCecGetPhysicalAddress] +B -->|HDMI_CEC_IO_SUCCESS| C{Verify Physical Address < F.F.F.F} +B -->|Failure| B1[Test case fail] +C -->|Success| D[HdmiCecClose] +C -->|Failure| C1[Test case fail] +D -->|HDMI_CEC_IO_SUCCESS| E[Test case success] +D -->|Failure| D1[Test case fail] +A -->|Failure| A1[Test case fail] ``` @@ -286,19 +267,19 @@ graph TD |Title|Details| |--|--| |Function Name|`test_l2_hdmi_cec_driver_TransmitCECCommand`| -|Description|DUT transmit a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC version of device that doesn't exist.| +|Description|DUT transmits a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC version of the device that doesn't exist.| |Test Group|Module : 02| |Test Case ID|006| |Priority|High| -**Pre-Conditions :** +**Pre-Conditions:** None -**Dependencies :** +**Dependencies:** None -**User Interaction :** -If user chose to run the test in interactive mode, then the test case has to be selected via console. +**User Interaction:** +If the user chooses to run the test in interactive mode, then the test case has to be selected via the console. #### Test Procedure : @@ -312,15 +293,16 @@ If user chose to run the test in interactive mode, then the test case has to be ```mermaid -graph TD - style A fill:#bff,stroke:#333,stroke-width:2px - style B fill:#bbf,stroke:#333,stroke-width:2px - style C fill:#bbf,stroke:#333,stroke-width:2px - style D fill:#bbf,stroke:#333,stroke-width:2px - style E fill:#bff,stroke:#333,stroke-width:2px - - A[Open HDMI CEC Driver] --> B{HdmiCecAddLogicalAddress} - B -->|HDMI_CEC_IO_SUCCESS| C[Transmit CEC Command for \n a device not in the network] - C -->|HDMI_CEC_IO_SUCCESS| D[Check Result] - D -->|HDMI_CEC_IO_SENT_BUT_NOT_ACKD| E[Close HDMI CEC Driver] -``` \ No newline at end of file +graph TB +A[HdmiCecOpen] -- "HDMI_CEC_IO_SUCCESS" --> B[HdmiCecAddLogicalAddress] +A -- "Not HDMI_CEC_IO_SUCCESS" --> A1[Test case fail] +B -- "HDMI_CEC_IO_SUCCESS" --> C[Prepare CEC message] +B -- "Not HDMI_CEC_IO_SUCCESS" --> B1[Test case fail] +C --> D[HdmiCecTx] +D -- "HDMI_CEC_IO_SENT_BUT_NOT_ACKD" --> E[HdmiCecRemoveLogicalAddress] +D -- "Not HDMI_CEC_IO_SENT_BUT_NOT_ACKD" --> D1[Test case fail] +E -- "HDMI_CEC_IO_SUCCESS" --> F[HdmiCecClose] +E -- "Not HDMI_CEC_IO_SUCCESS" --> E1[Test case fail] +F -- "HDMI_CEC_IO_SUCCESS" --> G[Test case success] +F -- "Not HDMI_CEC_IO_SUCCESS" --> F1[Test case fail] +``` From 71bc99fd2e0628b771bdb2f5667e4e9792b29507 Mon Sep 17 00:00:00 2001 From: srinivasgtl <71806084+srinivasgtl@users.noreply.github.com> Date: Thu, 27 Jun 2024 10:48:01 +0000 Subject: [PATCH 33/48] gh #24 fixing doxygen issues --- src/test_l2_hdmi_cec_source_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test_l2_hdmi_cec_source_driver.c b/src/test_l2_hdmi_cec_source_driver.c index 6801dcb..b620220 100644 --- a/src/test_l2_hdmi_cec_source_driver.c +++ b/src/test_l2_hdmi_cec_source_driver.c @@ -91,7 +91,7 @@ static int gTestID = 1; * **Test Case ID:** 001@n * * **Test Procedure:** -* Refer to UT specification documentation [hdmi_cec_driver_source_L2_Low-Level_TestSpecification.md](../../docs/pages/hdmi_cec_source_driver_L2_Low-Level_TestSpecification.md) +* Refer to UT specification documentation [hdmi_cec_driver_source_L2_Low-Level_TestSpecification.md](../docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md) */ void test_l2_hdmi_cec_driver_ValidateLogicalAddressUnavailability_source(void) From 18e619c082e6f29e3d9828cedded040852630bf3 Mon Sep 17 00:00:00 2001 From: srinivasgtl <71806084+srinivasgtl@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:13:28 +0100 Subject: [PATCH 34/48] gh #24 Updated with some documentation reviews --- docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md | 10 +++++----- docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md index ada1f31..4c21bb1 100644 --- a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md +++ b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md @@ -82,7 +82,7 @@ D -->|Failure| D1[Test case fail] |--|--| |Function Name|`test_l2_hdmi_cec_driver_AddAndGetLogicalAddress`| |Description|Setup all valid logical addresses b/w 0x00 to 0x0F for the `DUT` and retrieve each to ensure proper functionality, using HAL APIs.| -|Test Group|Module : 02| +|Test Group|02| |Test Case ID|002| |Priority|High| @@ -127,7 +127,7 @@ F -->|HDMI_CEC_IO_SUCCESS| L[Test case success] |--|--| |Function Name|`test_l2_hdmi_cec_driver_RemoveLogicalAddress`| |Description|Invoke the HAL API to delete the `DUT` logical address and verify that it is removed successfully.| -|Test Group|Module : 02| +|Test Group|02| |Test Case ID|003| |Priority|High| @@ -176,7 +176,7 @@ F -- "Failure" --> F1[Test case fail] |--|--| |Function Name|`test_l2_hdmi_cec_driver_BroadcastHdmiCecCommand`| |Description|After deleting the `DUT` logical address, try to send a broadcast CEC Command (as per 1.4b HDMI CEC spec) and confirm transmission is successful.| -|Test Group|Module : 02| +|Test Group|02| |Test Case ID|004| |Priority|High| @@ -225,7 +225,7 @@ F -- "Failure" --> F1[Test case fail] |--|--| |Function Name|`test_l2_hdmi_cec_driver_VerifyPhysicalAddress`| |Description|Verify the valid physical address allocated through the HAL function.| -|Test Group|Module : 02| +|Test Group|02| |Test Case ID|005| |Priority|High| @@ -268,7 +268,7 @@ A -->|Failure| A1[Test case fail] |--|--| |Function Name|`test_l2_hdmi_cec_driver_TransmitCECCommand`| |Description|DUT transmits a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC version of the device that doesn't exist.| -|Test Group|Module : 02| +|Test Group|02| |Test Case ID|006| |Priority|High| diff --git a/docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md b/docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md index 5c56b1a..af38cd7 100644 --- a/docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md +++ b/docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md @@ -39,7 +39,7 @@ The following functions are expecting to test the module operates correctly. |--|--| |Function Name|`test_l2_hdmi_cec_driver_ValidateLogicalAddressUnavailability_source`| |Description|Trying to get a logical address discovered during CEC open and validate the return value when the `DUT` is not connected to a Sink device. It should return HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE.| -|Test Group|Module : 02| +|Test Group|02| |Test Case ID|001| |Priority|High| From ab6f66870bbb3c5fea99a8c429ca74b37ace6b95 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:04:27 -0400 Subject: [PATCH 35/48] Update based on review discussion --- .../hdmi-cec-sink_L2_Low-Level_TestSpec.md | 101 +++++++-------- ...> hdmi_cec_sink_L2_High-Level_TestSpec.md} | 4 +- ...hdmi_cec_source_L2_High-Level_TestSpec.md} | 0 .../hdmi_cec_source_L2_Low-Level_TestSpec.md | 24 ++-- profiles/sink/sink_hdmiCEC.yml | 6 + profiles/source/source_hdmiCEC.yml | 6 + src/main.c | 17 ++- src/test_l2_hdmi_cec_sink_driver.c | 122 +++++++++--------- src/test_l2_hdmi_cec_source_driver.c | 19 ++- src/test_register.c | 8 +- 10 files changed, 161 insertions(+), 146 deletions(-) rename docs/pages/{hdmi_cec_sink_tests.md => hdmi_cec_sink_L2_High-Level_TestSpec.md} (98%) rename docs/pages/{hdmi_cec_source_tests.md => hdmi_cec_source_L2_High-Level_TestSpec.md} (100%) create mode 100644 profiles/sink/sink_hdmiCEC.yml create mode 100644 profiles/source/source_hdmiCEC.yml diff --git a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md index 4c21bb1..aa43d82 100644 --- a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md +++ b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md @@ -1,20 +1,17 @@ -# HDMI CEC DRIVER L2 Low-Level Test Specification and Procedure Documentation - +# HDMI CEC HAL L2 Low-Level Test Specification and Procedure Documentation + ## Table of Contents - -- [HDMI CEC DRIVER L2 Low Level Test Specification and Procedure Documentation](#hdmi-cec-driver-l2-low-level-test-specification-and-procedure-documentation) - - - [Table of Contents](#table-of-contents) - - [Overview](#overview) - - [Acronyms, Terms and Abbreviations](#acronyms-terms-and-abbreviations) - - [Definitions](#definitions) - - [References](#references) - - [Level 2 Test Procedure](#level-2-test-procedure) - + +- [Overview](#overview) + - [Acronyms, Terms and Abbreviations](#acronyms-terms-and-abbreviations) + - [Definitions](#definitions) + - [References](#references) +- [Level 2 Test Procedure](#level-2-test-procedure) + ## Overview -This document describes the level 2 testing suite for the HDMI CEC DRIVER module. - +This document describes the level 2 testing suite for the HDMI CEC HAL module. + ### Acronyms, Terms and Abbreviations - `HAL` \- Hardware Abstraction Layer, may include some common components @@ -23,22 +20,24 @@ This document describes the level 2 testing suite for the HDMI CEC DRIVER module - `CEC` \- Consumer Electronics Contro - `DUT` \- Device Under Test - `API` \- Application Program Interface + ### Definitions - `ut-core` \- Common Testing Framework , which wraps an open-source framework that can be expanded to the requirements for future frameworks. - + ### References + - `High-Level Test Specification` - [hdmi_cec_sink_tests.md](hdmi_cec_sink_tests.md) - + ## Level 2 Test Procedure The following functions are intended to test the HDMI CEC HAL module's operation on sink devices according to the L2 Test specification. - + ### Test 1 |Title|Details| |--|--| -|Function Name|`test_l2_hdmi_cec_driver_GetDefaultLogicalAddress`| +|Function Name|`test_l2_hdmi_cec_sink_hal_GetDefaultLogicalAddress`| |Description|Get the logical address of the `DUT` without actually adding the Logical Address and the API should return 0x0F as the default logical address.| |Test Group|02| |Test Case ID|001| @@ -47,13 +46,13 @@ The following functions are intended to test the HDMI CEC HAL module's operation **Pre-Conditions:** None -**Dependencies:** +**Dependencies:** None -**User Interaction:** +**User Interaction:** If the user chooses to run the test in interactive mode, then the test case has to be selected via the console. -#### Test Procedure : +#### Test Procedure Test 1 | Variation / Steps | Description | Test Data | Expected Result | Notes| | -- | --------- | ---------- | -------------- | ----- | @@ -75,12 +74,11 @@ D -->|HDMI_CEC_IO_SUCCESS| E[Test case pass] D -->|Failure| D1[Test case fail] ``` - ### Test 2 |Title|Details| |--|--| -|Function Name|`test_l2_hdmi_cec_driver_AddAndGetLogicalAddress`| +|Function Name|`test_l2_hdmi_cec_sink_hal_AddAndGetLogicalAddress`| |Description|Setup all valid logical addresses b/w 0x00 to 0x0F for the `DUT` and retrieve each to ensure proper functionality, using HAL APIs.| |Test Group|02| |Test Case ID|002| @@ -89,22 +87,22 @@ D -->|Failure| D1[Test case fail] **Pre-Conditions:** None -**Dependencies:** +**Dependencies:** None -**User Interaction:** +**User Interaction:** If the user chooses to run the test in interactive mode, then the test case has to be selected via the console. -#### Test Procedure : +#### Test Procedure Test 2 | Variation / Steps | Description | Test Data | Expected Result | Notes| | -- | --------- | ---------- | -------------- | ----- | -| 01 | Open HDMI CEC driver using HdmiCecOpen API | handle = valid pointer | HDMI_CEC_IO_SUCCESS | Should be successful | +| 01 | Open HDMI CEC HAL using HdmiCecOpen API | handle = valid pointer | HDMI_CEC_IO_SUCCESS | Should be successful | | 02 | Loop over the range of valid logical addresses (0x00 to 0x0F) | i = 0 to 0x0F | N/A | N/A | | 03 | Add logical address using HdmiCecAddLogicalAddress API | handle = valid handle, logicalAddress = i | HDMI_CEC_IO_SUCCESS | Should be successful | | 04 | Retrieve logical address using HdmiCecGetLogicalAddress API | handle = valid handle, logicalAddress = valid pointer | HDMI_CEC_IO_SUCCESS, logicalAddress = i | Should be successful | | 05 | Remove logical address using HdmiCecRemoveLogicalAddress API | handle = valid handle, logicalAddress = i | HDMI_CEC_IO_SUCCESS | Should be successful | -| 06 | Close HDMI CEC driver using HdmiCecClose API | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | +| 06 | Close HDMI CEC HAL using HdmiCecClose API | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | ```mermaid @@ -120,12 +118,11 @@ F -->|Failure| K[Test case fail] F -->|HDMI_CEC_IO_SUCCESS| L[Test case success] ``` - ### Test 3 |Title|Details| |--|--| -|Function Name|`test_l2_hdmi_cec_driver_RemoveLogicalAddress`| +|Function Name|`test_l2_hdmi_cec_sink_hal_RemoveLogicalAddress`| |Description|Invoke the HAL API to delete the `DUT` logical address and verify that it is removed successfully.| |Test Group|02| |Test Case ID|003| @@ -134,22 +131,22 @@ F -->|HDMI_CEC_IO_SUCCESS| L[Test case success] **Pre-Conditions:** None -**Dependencies:** +**Dependencies:** None -**User Interaction:** +**User Interaction:** If the user chooses to run the test in interactive mode, then the test case has to be selected via the console. -#### Test Procedure : +#### Test Procedure Test 3 | Variation / Steps | Description | Test Data | Expected Result | Notes| | -- | --------- | ---------- | -------------- | ----- | -| 01 | Open the HDMI CEC driver using HdmiCecOpen API | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | +| 01 | Open the HDMI CEC HAL using HdmiCecOpen API | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | | 02 | Add a logical address using HdmiCecAddLogicalAddress API | handle = valid handle, logicalAddress = 0x00 | HDMI_CEC_IO_SUCCESS | Should be successful | | 03 | Get the logical address using HdmiCecGetLogicalAddress API | handle = valid handle, logicalAddress = valid buffer | HDMI_CEC_IO_SUCCESS , logicalAddress = 0x00 | Should be successful | | 04 | Remove the logical address using HdmiCecRemoveLogicalAddress API | handle = valid handle, logicalAddress = 0x00 | HDMI_CEC_IO_SUCCESS | Should be successful | | 05 | Get the logical address using HdmiCecGetLogicalAddress API | handle = valid handle, logicalAddress = valid buffer | HDMI_CEC_IO_SUCCESS , logicalAddress = 0x0F | Should be successful | -| 06 | Close the HDMI CEC driver using HdmiCecClose API | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | +| 06 | Close the HDMI CEC HAL using HdmiCecClose API | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | ```mermaid @@ -168,13 +165,11 @@ F -- "HDMI_CEC_IO_SUCCESS" --> G[Test case pass] F -- "Failure" --> F1[Test case fail] ``` - - ### Test 4 |Title|Details| |--|--| -|Function Name|`test_l2_hdmi_cec_driver_BroadcastHdmiCecCommand`| +|Function Name|`test_l2_hdmi_cec_sink_hal_BroadcastHdmiCecCommand`| |Description|After deleting the `DUT` logical address, try to send a broadcast CEC Command (as per 1.4b HDMI CEC spec) and confirm transmission is successful.| |Test Group|02| |Test Case ID|004| @@ -183,13 +178,13 @@ F -- "Failure" --> F1[Test case fail] **Pre-Conditions:** None -**Dependencies:** +**Dependencies:** None -**User Interaction:** +**User Interaction:** If the user chooses to run the test in interactive mode, then the test case has to be selected via the console. -#### Test Procedure : +#### Test Procedure Test 4 | Variation / Steps | Description | Test Data | Expected Result | Notes| | -- | --------- | ---------- | -------------- | ----- | @@ -200,7 +195,6 @@ If the user chooses to run the test in interactive mode, then the test case has | 05 | Check the result of transmission | result = valid buffer | HDMI_CEC_IO_SENT_BUT_NOT_ACKD| Should be successful | | 06 | Close HDMI CEC using HdmiCecClose | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | - ```mermaid graph TB A[HdmiCecOpen] -- "HDMI_CEC_IO_SUCCESS" --> B[HdmiCecAddLogicalAddress] @@ -217,13 +211,11 @@ F -- "HDMI_CEC_IO_SUCCESS" --> G[Test case success] F -- "Failure" --> F1[Test case fail] ``` - - ### Test 5 |Title|Details| |--|--| -|Function Name|`test_l2_hdmi_cec_driver_VerifyPhysicalAddress`| +|Function Name|`test_l2_hdmi_cec_sink_hal_VerifyPhysicalAddress`| |Description|Verify the valid physical address allocated through the HAL function.| |Test Group|02| |Test Case ID|005| @@ -238,17 +230,16 @@ None **User Interaction:** If the user chooses to run the test in interactive mode, then the test case has to be selected via the console. -#### Test Procedure : +#### Test Procedure Test 5 | Variation / Steps | Description | Test Data | Expected Result | Notes| | -- | --------- | ---------- | -------------- | ----- | | 01 | Call the pre-requisite API HdmiCecOpen() | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | | 02 | Call the API HdmiCecGetPhysicalAddress() | handle = valid handle, physicalAddress = valid address | HDMI_CEC_IO_SUCCESS | Should be successful | | 03 | Check the return status of HdmiCecGetPhysicalAddress() | status = return status of HdmiCecGetPhysicalAddress() | HDMI_CEC_IO_SUCCESS | Should be successful | -| 04 | Verify that the physical address obtained is less than F.F.F.F | physicalAddress = obtained physical address | physicalAddress < 0xFFFF | Should be successful | +| 04 | Verify that the physical address obtained is greater than or equal to F.F.F.F | physicalAddress = obtained physical address | physicalAddress >= 0xFFFF | Should be successful | | 05 | Call the post-requisite API HdmiCecClose() | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | - ```mermaid graph TB A[HdmiCecOpen] -->|HDMI_CEC_IO_SUCCESS| B[HdmiCecGetPhysicalAddress] @@ -261,12 +252,11 @@ D -->|Failure| D1[Test case fail] A -->|Failure| A1[Test case fail] ``` - ### Test 6 |Title|Details| |--|--| -|Function Name|`test_l2_hdmi_cec_driver_TransmitCECCommand`| +|Function Name|`test_l2_hdmi_cec_sink_hal_TransmitCECCommand`| |Description|DUT transmits a CEC Command (as per 1.4b HDMI CEC spec) to get the CEC version of the device that doesn't exist.| |Test Group|02| |Test Case ID|006| @@ -275,22 +265,21 @@ A -->|Failure| A1[Test case fail] **Pre-Conditions:** None -**Dependencies:** +**Dependencies:** None -**User Interaction:** +**User Interaction:** If the user chooses to run the test in interactive mode, then the test case has to be selected via the console. -#### Test Procedure : +#### Test Procedure Test 6 | Variation / Steps | Description | Test Data | Expected Result | Notes| | -- | --------- | ---------- | -------------- | ----- | -| 01 | Open HDMI CEC driver using HdmiCecOpen | handle = valid buffer | HDMI_CEC_IO_SUCCESS | Should be successful | +| 01 | Open HDMI CEC HAL using HdmiCecOpen | handle = valid buffer | HDMI_CEC_IO_SUCCESS | Should be successful | | 02 | Add logical address using HdmiCecAddLogicalAddress | handle = valid handle, logicalAddresses = 0x4 | HDMI_CEC_IO_SUCCESS | Should be successful | | 03 | Transmit CEC command using HdmiCecTx for a non existing device | handle = valid handle, buf = {0x47, 0x9F}, len = sizeof(buf), result = valid buffer | HDMI_CEC_IO_SUCCESS, result = HDMI_CEC_IO_SENT_BUT_NOT_ACKD | Should be successful | | 04 | Remove logical address using HdmiCecRemoveLogicalAddress | handle = valid handle, logicalAddresses = 0x4 | HDMI_CEC_IO_SUCCESS | Should be successful | -| 05 | Close HDMI CEC driver using HdmiCecClose | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | - +| 05 | Close HDMI CEC HAL using HdmiCecClose | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | ```mermaid graph TB diff --git a/docs/pages/hdmi_cec_sink_tests.md b/docs/pages/hdmi_cec_sink_L2_High-Level_TestSpec.md similarity index 98% rename from docs/pages/hdmi_cec_sink_tests.md rename to docs/pages/hdmi_cec_sink_L2_High-Level_TestSpec.md index ca99c07..ba100d9 100644 --- a/docs/pages/hdmi_cec_sink_tests.md +++ b/docs/pages/hdmi_cec_sink_L2_High-Level_TestSpec.md @@ -67,7 +67,7 @@ Managing the opcodes is the responsibility of the caller. The existing test case |S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| |-----|------------------|-----------|--------|--|--|--------------------------| -| 2| [Physical Address](#physical-address)| Verify the valid physical address allocated through the HAL function.|HdmiCecGetPhysicalAddress| Y |NA|| +| 2| [Physical Address](#physical-address)| Verify the physical address allocated through the HAL function.|HdmiCecGetPhysicalAddress| Y |NA|| | | | Verify the physical addresses allocated by connecting two sink devices through an HDMI switch.| HdmiCecGetPhysicalAddress| NA | Y | Enable the television connected to `DUT` to declare its physical address first before `DUT`.| ### Emulator Requirements - Physical Address @@ -133,7 +133,7 @@ Managing the opcodes is the responsibility of the caller. The existing test case |S.No.|Test Functionality|Description| HAL APIs |L2|L3|Control plane requirements| |-----|------------------|-----------|----------|--|--|--------------------------| -| 7| Introduce fault in the CEC Bus | Absorve the behaviour when the CEC line is pulled high during the CEC Transmission using a CEC Adaptor that provision to keep the CEC line pulled high| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y |CEC Adaptor used shall have a provision to introduce the fault. The control plane should be able to command to pull the CEC line high, else it should follow a manual process| +| 7| Introduce fault in the CEC Bus | Observe the behaviour when the CEC line is pulled high during the CEC Transmission using a CEC Adaptor that provision to keep the CEC line pulled high| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y |CEC Adaptor used shall have a provision to introduce the fault. The control plane should be able to command to pull the CEC line high, else it should follow a manual process| | 8| Overloading the CEC bus. | Overload the CEC bus with too many messages (by connecting more devices in the network) and observe the behaviour| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y |Control plane to initiate the CEC Transmission through all the connected devices continuously with a command that expects the response as well to overload the CEC Network. | ### Emulator Requirements diff --git a/docs/pages/hdmi_cec_source_tests.md b/docs/pages/hdmi_cec_source_L2_High-Level_TestSpec.md similarity index 100% rename from docs/pages/hdmi_cec_source_tests.md rename to docs/pages/hdmi_cec_source_L2_High-Level_TestSpec.md diff --git a/docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md b/docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md index af38cd7..0a93a96 100644 --- a/docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md +++ b/docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md @@ -1,19 +1,16 @@ -# HDMI CEC DRIVER L2 Low Level Test Specification and Procedure Documentation +# HDMI CEC HAL L2 Low Level Test Specification and Procedure Documentation ## Table of Contents -- [HDMI CEC DRIVER L2 Low Level Test Specification and Procedure Documentation](#hdmi-cec-driver-l2-low-level-test-specification-and-procedure-documentation) - - - [Table of Contents](#table-of-contents) - - [Overview](#overview) - - [Acronyms, Terms and Abbreviations](#acronyms-terms-and-abbreviations) - - [Definitions](#definitions) - - [References](#references) - - [Level 2 Test Procedure](#level-2-test-procedure) +- [Overview](#overview) + - [Acronyms, Terms and Abbreviations](#acronyms-terms-and-abbreviations) + - [Definitions](#definitions) + - [References](#references) +- [Level 2 Test Procedure](#level-2-test-procedure) ## Overview -This document describes the level 2 testing suite for the HDMI CEC DRIVER module. +This document describes the level 2 testing suite for the HDMI CEC HAL module. ### Acronyms, Terms and Abbreviations @@ -24,9 +21,10 @@ This document describes the level 2 testing suite for the HDMI CEC DRIVER module ### Definitions - - `ut-core` \- Common Testing Framework , which wraps a open-source framework that can be expanded to the requirements for future framework. +- `ut-core` \- Common Testing Framework , which wraps a open-source framework that can be expanded to the requirements for future framework. ### References + - `High Level Test Specification` - [hdmi_cec_source_tests.md](hdmi_cec_source_tests.md) ## Level 2 Test Procedure @@ -37,7 +35,7 @@ The following functions are expecting to test the module operates correctly. |Title|Details| |--|--| -|Function Name|`test_l2_hdmi_cec_driver_ValidateLogicalAddressUnavailability_source`| +|Function Name|`test_l2_hdmi_cec_source_hal_ValidateLogicalAddressUnavailability_source`| |Description|Trying to get a logical address discovered during CEC open and validate the return value when the `DUT` is not connected to a Sink device. It should return HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE.| |Test Group|02| |Test Case ID|001| @@ -52,7 +50,7 @@ None **User Interaction :** If user chose to run the test in interactive mode, then the test case has to be selected via console. -#### Test Procedure : +#### Test Procedure | Variation / Steps | Description | Test Data | Expected Result | Notes| | -- | --------- | ---------- | -------------- | ----- | diff --git a/profiles/sink/sink_hdmiCEC.yml b/profiles/sink/sink_hdmiCEC.yml new file mode 100644 index 0000000..323bf59 --- /dev/null +++ b/profiles/sink/sink_hdmiCEC.yml @@ -0,0 +1,6 @@ +hdmicec: + type: sink + name: panel + + features: + extendedEnumsSupported: false diff --git a/profiles/source/source_hdmiCEC.yml b/profiles/source/source_hdmiCEC.yml new file mode 100644 index 0000000..7b8fff6 --- /dev/null +++ b/profiles/source/source_hdmiCEC.yml @@ -0,0 +1,6 @@ +hdmicec: + type: source + name: stb + + features: + extendedEnumsSupported: false diff --git a/src/main.c b/src/main.c index 61cc825..11d73fe 100644 --- a/src/main.c +++ b/src/main.c @@ -62,6 +62,8 @@ #include #include #include +#include +#include extern int register_hdmicec_hal_l1_tests( void ); extern int register_hdmicec_hal_source_l2_tests( void ); @@ -73,6 +75,9 @@ extern int register_vcomponent_tests ( char* profile, unsigned short cpPort, cha int main(int argc, char** argv) { + ut_kvp_status_t status; + char szReturnedString[UT_KVP_MAX_ELEMENT_SIZE]; + #ifdef VCOMPONENT int opt; char* pProfilePath = NULL; @@ -112,9 +117,17 @@ int main(int argc, char** argv) /* Register tests as required, then call the UT-main to support switches and triggering */ UT_init( argc, argv ); + status = ut_kvp_getStringField(ut_kvp_profile_getInstance(), "dsAudio/Type", szReturnedString, UT_KVP_MAX_ELEMENT_SIZE); + register_hdmicec_hal_l1_tests (); - register_hdmicec_hal_source_l2_tests (); - register_hdmicec_hal_sink_l2_tests (); + + if(strncmp(szReturnedString,"source",UT_KVP_MAX_ELEMENT_SIZE) == 0) { + register_hdmicec_hal_source_l2_tests (); + } + + if(strncmp(szReturnedString,"sink",UT_KVP_MAX_ELEMENT_SIZE) == 0) { + register_hdmicec_hal_sink_l2_tests (); + } #ifdef VCOMPONENT register_vcomponent_tests(pProfilePath, cpPort, pUrl); #endif diff --git a/src/test_l2_hdmi_cec_sink_driver.c b/src/test_l2_hdmi_cec_sink_driver.c index de7c993..6c44f73 100644 --- a/src/test_l2_hdmi_cec_sink_driver.c +++ b/src/test_l2_hdmi_cec_sink_driver.c @@ -65,18 +65,23 @@ static int gTestGroup = 2; static int gTestID = 1; /** -* @brief Test for getting the default logical address of the HDMI CEC driver +* @brief Test for getting the default logical address of the HDMI CEC HAL * -* This test case validates the functionality of getting the default logical address of the HDMI CEC driver. It first opens a connection to the HDMI CEC driver, then retrieves the logical address, checks if the address is correct, and finally closes the connection. This test is important to ensure that the HDMI CEC driver is correctly assigning the default logical address. +* This test case validates the functionality of getting the default logical +* address of the HDMI CEC HAL. It first opens a connection to the HDMI CEC HAL, +* then retrieves the logical address, checks if the address is correct, +* and finally closes the connection. This test is important to ensure +* that the HDMI CEC HAL is correctly assigning the default logical address. * * **Test Group ID:** 02@n * **Test Case ID:** 001@n * * **Test Procedure:** -* Refer to UT specification documentation [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +* Refer to UT specification documentation +* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ -void test_l2_hdmi_cec_driver_GetDefaultLogicalAddress(void) +void test_l2_hdmi_cec_sink_hal_GetDefaultLogicalAddress(void) { gTestID = 1; int handle = 0; @@ -98,8 +103,6 @@ void test_l2_hdmi_cec_driver_GetDefaultLogicalAddress(void) if (status != HDMI_CEC_IO_SUCCESS) { UT_LOG_ERROR("HdmiCecGetLogicalAddress failed with status: %d", status); - HdmiCecClose(handle); // Cleanup if test fails - return; } // Step 3: Check the logical address @@ -115,19 +118,25 @@ void test_l2_hdmi_cec_driver_GetDefaultLogicalAddress(void) } /** -* @brief This test checks the functionality of adding and getting logical addresses in HDMI CEC driver +* @brief This test checks the functionality of adding and +* getting logical addresses in HDMI CEC HAL * -* This test case is designed to validate the correct operation of the HdmiCecAddLogicalAddress and HdmiCecGetLogicalAddress APIs. -* It does this by first opening a handle to the HDMI CEC driver, then adding logical addresses to it, and finally retrieving those addresses to verify they were correctly added. -* The test ensures that the APIs return the expected status codes and that the retrieved addresses match the ones that were added. +* This test case is designed to validate the correct operation of the +* HdmiCecAddLogicalAddress and HdmiCecGetLogicalAddress APIs. +* It does this by first opening a handle to the HDMI CEC HAL, +* then adding logical addresses to it, and finally retrieving +* those addresses to verify they were correctly added. +* The test ensures that the APIs return the expected status codes +* and that the retrieved addresses match the ones that were added. * * **Test Group ID:** 02@n * **Test Case ID:** 002@n * * **Test Procedure:** -* Refer to UT specification documentation [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +* Refer to UT specification documentation +* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ -void test_l2_hdmi_cec_driver_AddAndGetLogicalAddress(void) +void test_l2_hdmi_cec_sink_hal_AddAndGetLogicalAddress(void) { gTestID = 2; UT_LOG_INFO("In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); @@ -180,20 +189,22 @@ void test_l2_hdmi_cec_driver_AddAndGetLogicalAddress(void) } /** -* @brief Test the removal of a logical address in the HDMI CEC driver +* @brief Test the removal of a logical address in the HDMI CEC HAL * -* This function tests the removal of a logical address in the HDMI CEC driver. -* It first opens the driver, adds a logical address, removes the logical address, checks that the logical address has been removed, -* and finally closes the driver. +* This function tests the removal of a logical address in the HDMI CEC HAL. +* It first opens the HAL, adds a logical address, removes the logical address, +* checks that the logical address has been removed, +* and finally closes the HAL. * * **Test Group ID:** 02@n * **Test Case ID:** 003@n * * **Test Procedure:** -* Refer to UT specification documentation [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +* Refer to UT specification documentation +* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ -void test_l2_hdmi_cec_driver_RemoveLogicalAddress(void) +void test_l2_hdmi_cec_sink_hal_RemoveLogicalAddress(void) { gTestID = 3; UT_LOG_INFO("In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); @@ -215,8 +226,6 @@ void test_l2_hdmi_cec_driver_RemoveLogicalAddress(void) if (status != HDMI_CEC_IO_SUCCESS) { UT_LOG_ERROR("HdmiCecAddLogicalAddress failed with status: %d\n", status); - HdmiCecClose(handle); - return; } // Invoke the API HdmiCecGetLogicalAddress @@ -236,8 +245,6 @@ void test_l2_hdmi_cec_driver_RemoveLogicalAddress(void) if (status != HDMI_CEC_IO_SUCCESS) { UT_LOG_ERROR("HdmiCecRemoveLogicalAddress failed with status: %d\n", status); - HdmiCecClose(handle); - return; } // Invoke the API HdmiCecGetLogicalAddress @@ -248,8 +255,6 @@ void test_l2_hdmi_cec_driver_RemoveLogicalAddress(void) if ((status != HDMI_CEC_IO_SUCCESS) || (getLogicaladdress != 0x0F)) { UT_LOG_ERROR("HdmiCecGetLogicalAddress failed with status: %d logical address : %d\n", status, getLogicaladdress ); - HdmiCecClose(handle); - return; } // Call the post-requisite API HdmiCecClose @@ -263,18 +268,21 @@ void test_l2_hdmi_cec_driver_RemoveLogicalAddress(void) /** * @brief Test for broadcasting HDMI CEC command * -* This function tests the HDMI CEC driver's ability to broadcast a HDMI CEC command when logical address is removed. -* It first opens the HDMI CEC HAL, adds a logical address, removes the logical address, sends a broadcast HDMI CEC command, +* This function tests the HDMI CEC HAL's ability to broadcast a +* HDMI CEC command when logical address is removed. +* It first opens the HDMI CEC HAL, adds a logical address, removes +* the logical address, sends a broadcast HDMI CEC command, * and finally closes the HDMI CEC HAL. * * **Test Group ID:** 02@n * **Test Case ID:** 004@n * * **Test Procedure:** -* Refer to UT specification documentation [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +* Refer to UT specification documentation +* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ -void test_l2_hdmi_cec_driver_BroadcastHdmiCecCommand(void) +void test_l2_hdmi_cec_sink_hal_BroadcastHdmiCecCommand(void) { gTestID = 4; UT_LOG_INFO("In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); @@ -295,8 +303,6 @@ void test_l2_hdmi_cec_driver_BroadcastHdmiCecCommand(void) if (status != HDMI_CEC_IO_SUCCESS) { UT_LOG_ERROR("HdmiCecAddLogicalAddress failed with status: %d\n", status); - HdmiCecClose(handle); - return; } status = HdmiCecRemoveLogicalAddress(handle, logicalAddresses); @@ -305,8 +311,6 @@ void test_l2_hdmi_cec_driver_BroadcastHdmiCecCommand(void) if (status != HDMI_CEC_IO_SUCCESS) { UT_LOG_ERROR("HdmiCecRemoveLogicalAddress failed with status: %d\n", status); - HdmiCecClose(handle); - return; } status = HdmiCecTx(handle, buf, len, &result); @@ -315,8 +319,6 @@ void test_l2_hdmi_cec_driver_BroadcastHdmiCecCommand(void) if (status != HDMI_CEC_IO_SUCCESS) { UT_LOG_ERROR("HdmiCecTx failed with status: %d\n", status); - HdmiCecClose(handle); - return; } UT_ASSERT_EQUAL(result, HDMI_CEC_IO_SENT_BUT_NOT_ACKD); @@ -333,21 +335,24 @@ void test_l2_hdmi_cec_driver_BroadcastHdmiCecCommand(void) } /** -* @brief Test to verify the physical address of the HDMI CEC driver +* @brief Test to verify the physical address of the HDMI CEC HAL * -* This test case verifies the physical address of the HDMI CEC driver by calling the HdmiCecGetPhysicalAddress() API. +* This test case verifies the physical address of the HDMI CEC HAL +* by calling the HdmiCecGetPhysicalAddress() API. * The test ensures that the physical address obtained is less than F.F.F.F. * The test also includes error handling and assertions to check the return values of the APIs. -* The test ensures that the post-requisite API HdmiCecClose() is called in case of any test failure after the successful execution of the pre-requisite API HdmiCecOpen(). +* The test ensures that the post-requisite API HdmiCecClose() +* is called in case of any test failure after the successful execution of the pre-requisite API HdmiCecOpen(). * * **Test Group ID:** 02@n * **Test Case ID:** 005@n * * **Test Procedure:** -* Refer to UT specification documentation [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +* Refer to UT specification documentation +* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ -void test_l2_hdmi_cec_driver_VerifyPhysicalAddress(void) +void test_l2_hdmi_cec_sink_hal_VerifyPhysicalAddress(void) { gTestID = 5; int handle; @@ -369,13 +374,11 @@ void test_l2_hdmi_cec_driver_VerifyPhysicalAddress(void) if (status != HDMI_CEC_IO_SUCCESS) { UT_LOG_ERROR("HdmiCecGetPhysicalAddress failed with status: %d", status); - HdmiCecClose(handle); // Closing the handle as the test failed - return; } // Step 4: Verify that the physical address obtained is less than F.F.F.F UT_LOG_DEBUG("Checking if physical address: %u is less than F.F.F.F", physicalAddress); - UT_ASSERT_TRUE(physicalAddress < 0xFFFF); + UT_ASSERT_TRUE(physicalAddress >= 0xFFFF) // Step 5: Call the post-requisite API HdmiCecClose() UT_LOG_DEBUG("Invoking HdmiCecClose with handle: %d", handle); @@ -386,20 +389,22 @@ void test_l2_hdmi_cec_driver_VerifyPhysicalAddress(void) } /** -* @brief This test function is designed to test the transmission of CEC commands in the HDMI CEC driver. +* @brief This test function is designed to test the transmission of CEC commands in the HDMI CEC HAL. * -* This test function tests the transmission of CEC commands in the HDMI CEC driver. -* It opens a connection, adds a logical address, sends a CEC command, removes the logical address, and then closes the connection. +* This test function tests the transmission of CEC commands in the HDMI CEC HAL. +* It opens a connection, adds a logical address, sends a CEC command, +* removes the logical address, and then closes the connection. * The test asserts that each operation returns the expected status. * * **Test Group ID:** 02@n * **Test Case ID:** 006@n * * **Test Procedure:** -* Refer to UT specification documentation [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +* Refer to UT specification documentation +* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ -void test_l2_hdmi_cec_driver_TransmitCECCommand(void) +void test_l2_hdmi_cec_sink_hal_TransmitCECCommand(void) { gTestID = 6; UT_LOG_INFO("In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); @@ -420,8 +425,6 @@ void test_l2_hdmi_cec_driver_TransmitCECCommand(void) if (status != HDMI_CEC_IO_SUCCESS) { UT_LOG_ERROR("HdmiCecAddLogicalAddress failed with status: %d\n", status); - HdmiCecClose(handle); - return; } status = HdmiCecTx(handle, buf, len, &result); @@ -431,9 +434,6 @@ void test_l2_hdmi_cec_driver_TransmitCECCommand(void) if ((result != HDMI_CEC_IO_SENT_BUT_NOT_ACKD) && (status != HDMI_CEC_IO_SUCCESS)) { UT_LOG_ERROR("HdmiCecTx failed with status: %d result:%d\n", status, result); - HdmiCecRemoveLogicalAddress(handle, logicalAddresses); - HdmiCecClose(handle); - return; } status = HdmiCecRemoveLogicalAddress(handle, logicalAddresses); @@ -442,8 +442,6 @@ void test_l2_hdmi_cec_driver_TransmitCECCommand(void) if (status != HDMI_CEC_IO_SUCCESS) { UT_LOG_ERROR("HdmiCecRemoveLogicalAddress failed with status: %d\n", status); - HdmiCecClose(handle); - return; } status = HdmiCecClose(handle); @@ -461,22 +459,22 @@ static UT_test_suite_t * pSuite = NULL; * @return int - 0 on success, otherwise failure */ -int test_hdmi_cec_driver_sink_l2_register(void) +int register_hdmicec_hal_sink_l2_tests(void) { // Create the test suite - pSuite = UT_add_suite("[L2 HDMICEC PANEL TestCase] ", NULL, NULL); + pSuite = UT_add_suite("[L2 HDMICEC Sink Test Case] ", NULL, NULL); if (pSuite == NULL) { return -1; } // List of test function names and strings - UT_add_test( pSuite, "l2_hdmi_cec_driver_GetDefaultLogicalAddress", test_l2_hdmi_cec_driver_GetDefaultLogicalAddress); - UT_add_test( pSuite, "l2_hdmi_cec_driver_AddAndGetLogicalAddress", test_l2_hdmi_cec_driver_AddAndGetLogicalAddress); - UT_add_test( pSuite, "l2_hdmi_cec_driver_RemoveLogicalAddress", test_l2_hdmi_cec_driver_RemoveLogicalAddress); - UT_add_test( pSuite, "l2_hdmi_cec_driver_BroadcastHdmiCecCommand", test_l2_hdmi_cec_driver_BroadcastHdmiCecCommand); - UT_add_test( pSuite, "l2_hdmi_cec_driver_VerifyPhysicalAddress", test_l2_hdmi_cec_driver_VerifyPhysicalAddress); - UT_add_test( pSuite, "l2_hdmi_cec_driver_TransmitCECCommand", test_l2_hdmi_cec_driver_TransmitCECCommand); + UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_GetDefaultLogicalAddress", test_l2_hdmi_cec_sink_hal_GetDefaultLogicalAddress); + UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_AddAndGetLogicalAddress", test_l2_hdmi_cec_sink_hal_AddAndGetLogicalAddress); + UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_RemoveLogicalAddress", test_l2_hdmi_cec_sink_hal_RemoveLogicalAddress); + UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_BroadcastHdmiCecCommand", test_l2_hdmi_cec_sink_hal_BroadcastHdmiCecCommand); + UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_VerifyPhysicalAddress", test_l2_hdmi_cec_sink_hal_VerifyPhysicalAddress); + UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_TransmitCECCommand", test_l2_hdmi_cec_driver_TransmitCECCommand); return 0; } \ No newline at end of file diff --git a/src/test_l2_hdmi_cec_source_driver.c b/src/test_l2_hdmi_cec_source_driver.c index b620220..194278e 100644 --- a/src/test_l2_hdmi_cec_source_driver.c +++ b/src/test_l2_hdmi_cec_source_driver.c @@ -83,18 +83,23 @@ static int gTestGroup = 2; static int gTestID = 1; /** -* @brief This test validates the unavailability of logical address in HDMI CEC driver +* @brief This test validates the unavailability of logical address in HDMI CEC HAL * -* This test case is designed to validate the scenario when the logical address is unavailable in the HDMI CEC driver. The test invokes the HdmiCecOpen function and checks if the returned status is HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE. If the status is not HDMI_CEC_IO_SUCCESS, it invokes the HdmiCecClose function and checks if the returned status is HDMI_CEC_IO_SUCCESS. +* This test case is designed to validate the scenario when the logical address +* is unavailable in the HDMI CEC HAL. The test invokes the HdmiCecOpen function +* and checks if the returned status is HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE. +* If the status is not HDMI_CEC_IO_SUCCESS, it invokes the HdmiCecClose function +* and checks if the returned status is HDMI_CEC_IO_SUCCESS. * * **Test Group ID:** 02@n * **Test Case ID:** 001@n * * **Test Procedure:** -* Refer to UT specification documentation [hdmi_cec_driver_source_L2_Low-Level_TestSpecification.md](../docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md) +* Refer to UT specification documentation +* [hdmi_cec_source_hal_source_L2_Low-Level_TestSpecification.md](../docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md) */ -void test_l2_hdmi_cec_driver_ValidateLogicalAddressUnavailability_source(void) +void test_l2_hdmi_cec_source_hal_ValidateLogicalAddressUnavailability(void) { gTestID = 1; UT_LOG_INFO("In %s [%02d%03d]\n", __FUNCTION__, gTestGroup, gTestID); @@ -128,17 +133,17 @@ static UT_test_suite_t * pSuite = NULL; * @return int - 0 on success, otherwise failure */ -int test_hdmi_cec_driver_source_l2_register(void) +int register_hdmicec_hal_source_l2_tests(void) { // Create the test suite - pSuite = UT_add_suite("[L2 hdmi_cec_driver]", NULL, NULL); + pSuite = UT_add_suite("[L2 HDMICEC Source Test Case]", NULL, NULL); if (pSuite == NULL) { return -1; } // List of test function names and strings - UT_add_test( pSuite, "l2_hdmi_cec_driver_ValidateLogicalAddressUnavailability_source", test_l2_hdmi_cec_driver_ValidateLogicalAddressUnavailability_source); + UT_add_test( pSuite, "l2_hdmi_cec_source_hal_ValidateLogicalAddressUnavailability_source", test_l2_hdmi_cec_source_hal_ValidateLogicalAddressUnavailability); return 0; } diff --git a/src/test_register.c b/src/test_register.c index b0e36c2..3784f92 100644 --- a/src/test_register.c +++ b/src/test_register.c @@ -62,8 +62,8 @@ /* L1 Testing Functions */ extern int test_hdmicec_hal_l1_register( void ); -extern int test_hdmi_cec_driver_source_l2_register( void ); -extern int test_hdmi_cec_driver_sink_l2_register( void ); +extern int register_hdmicec_hal_source_l2_tests( void ); +extern int register_hdmicec_hal_sink_l2_tests( void ); int register_hdmicec_hal_l1_tests( void ) @@ -79,7 +79,7 @@ int register_hdmicec_hal_source_l2_tests( void ) { int registerFailed=0; - registerFailed |= test_hdmi_cec_driver_source_l2_register(); + registerFailed |= register_hdmicec_hal_source_l2_tests(); return registerFailed; } @@ -87,7 +87,7 @@ int register_hdmicec_hal_sink_l2_tests( void ) { int registerFailed=0; - registerFailed |= test_hdmi_cec_driver_sink_l2_register(); + registerFailed |= register_hdmicec_hal_sink_l2_tests(); return registerFailed; } From 66088da4c62f96309aef86647298083f7943dc75 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:13:04 -0400 Subject: [PATCH 36/48] Update links --- src/test_l2_hdmi_cec_sink_driver.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test_l2_hdmi_cec_sink_driver.c b/src/test_l2_hdmi_cec_sink_driver.c index 6c44f73..8d47c34 100644 --- a/src/test_l2_hdmi_cec_sink_driver.c +++ b/src/test_l2_hdmi_cec_sink_driver.c @@ -134,7 +134,7 @@ void test_l2_hdmi_cec_sink_hal_GetDefaultLogicalAddress(void) * * **Test Procedure:** * Refer to UT specification documentation -* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ void test_l2_hdmi_cec_sink_hal_AddAndGetLogicalAddress(void) { @@ -201,7 +201,7 @@ void test_l2_hdmi_cec_sink_hal_AddAndGetLogicalAddress(void) * * **Test Procedure:** * Refer to UT specification documentation -* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ void test_l2_hdmi_cec_sink_hal_RemoveLogicalAddress(void) @@ -279,7 +279,7 @@ void test_l2_hdmi_cec_sink_hal_RemoveLogicalAddress(void) * * **Test Procedure:** * Refer to UT specification documentation -* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ void test_l2_hdmi_cec_sink_hal_BroadcastHdmiCecCommand(void) @@ -349,7 +349,7 @@ void test_l2_hdmi_cec_sink_hal_BroadcastHdmiCecCommand(void) * * **Test Procedure:** * Refer to UT specification documentation -* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ void test_l2_hdmi_cec_sink_hal_VerifyPhysicalAddress(void) @@ -401,7 +401,7 @@ void test_l2_hdmi_cec_sink_hal_VerifyPhysicalAddress(void) * * **Test Procedure:** * Refer to UT specification documentation -* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) +* [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ void test_l2_hdmi_cec_sink_hal_TransmitCECCommand(void) From 62266ceb0440bd88444e5f043b41da8095167955 Mon Sep 17 00:00:00 2001 From: srinivasgtl <71806084+srinivasgtl@users.noreply.github.com> Date: Thu, 27 Jun 2024 17:35:57 +0000 Subject: [PATCH 37/48] gh #24 resolving compilation issue --- src/test_l2_hdmi_cec_sink_driver.c | 6 +++--- src/test_l2_hdmi_cec_source_driver.c | 2 +- src/test_register.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test_l2_hdmi_cec_sink_driver.c b/src/test_l2_hdmi_cec_sink_driver.c index 8d47c34..edf54af 100644 --- a/src/test_l2_hdmi_cec_sink_driver.c +++ b/src/test_l2_hdmi_cec_sink_driver.c @@ -459,7 +459,7 @@ static UT_test_suite_t * pSuite = NULL; * @return int - 0 on success, otherwise failure */ -int register_hdmicec_hal_sink_l2_tests(void) +int test_register_hdmicec_hal_sink_l2_tests(void) { // Create the test suite pSuite = UT_add_suite("[L2 HDMICEC Sink Test Case] ", NULL, NULL); @@ -474,7 +474,7 @@ int register_hdmicec_hal_sink_l2_tests(void) UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_RemoveLogicalAddress", test_l2_hdmi_cec_sink_hal_RemoveLogicalAddress); UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_BroadcastHdmiCecCommand", test_l2_hdmi_cec_sink_hal_BroadcastHdmiCecCommand); UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_VerifyPhysicalAddress", test_l2_hdmi_cec_sink_hal_VerifyPhysicalAddress); - UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_TransmitCECCommand", test_l2_hdmi_cec_driver_TransmitCECCommand); + UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_TransmitCECCommand", test_l2_hdmi_cec_sink_hal_TransmitCECCommand); return 0; -} \ No newline at end of file +} diff --git a/src/test_l2_hdmi_cec_source_driver.c b/src/test_l2_hdmi_cec_source_driver.c index 194278e..41dd700 100644 --- a/src/test_l2_hdmi_cec_source_driver.c +++ b/src/test_l2_hdmi_cec_source_driver.c @@ -133,7 +133,7 @@ static UT_test_suite_t * pSuite = NULL; * @return int - 0 on success, otherwise failure */ -int register_hdmicec_hal_source_l2_tests(void) +int test_register_hdmicec_hal_source_l2_tests(void) { // Create the test suite pSuite = UT_add_suite("[L2 HDMICEC Source Test Case]", NULL, NULL); diff --git a/src/test_register.c b/src/test_register.c index 3784f92..8c0d800 100644 --- a/src/test_register.c +++ b/src/test_register.c @@ -62,8 +62,8 @@ /* L1 Testing Functions */ extern int test_hdmicec_hal_l1_register( void ); -extern int register_hdmicec_hal_source_l2_tests( void ); -extern int register_hdmicec_hal_sink_l2_tests( void ); +extern int test_register_hdmicec_hal_source_l2_tests( void ); +extern int test_register_hdmicec_hal_sink_l2_tests( void ); int register_hdmicec_hal_l1_tests( void ) @@ -79,7 +79,7 @@ int register_hdmicec_hal_source_l2_tests( void ) { int registerFailed=0; - registerFailed |= register_hdmicec_hal_source_l2_tests(); + registerFailed |= test_register_hdmicec_hal_source_l2_tests(); return registerFailed; } @@ -87,7 +87,7 @@ int register_hdmicec_hal_sink_l2_tests( void ) { int registerFailed=0; - registerFailed |= register_hdmicec_hal_sink_l2_tests(); + registerFailed |= test_register_hdmicec_hal_sink_l2_tests(); return registerFailed; } From 8661c01ee95405af4c74cd5e3c7f4c077d6a6091 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:57:01 -0400 Subject: [PATCH 38/48] Update driver to proper names --- ...evel_TestSpec.md => hdmi-cec-sink_L2_High-Level_TestSpec.md} | 0 docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md | 2 +- ...el_TestSpec.md => hdmi-cec-source_L2_High-Level_TestSpec.md} | 0 ...vel_TestSpec.md => hdmi-cec-source_L2_Low-Level_TestSpec.md} | 0 src/test_l2_hdmi_cec_source_driver.c | 2 +- 5 files changed, 2 insertions(+), 2 deletions(-) rename docs/pages/{hdmi_cec_sink_L2_High-Level_TestSpec.md => hdmi-cec-sink_L2_High-Level_TestSpec.md} (100%) rename docs/pages/{hdmi_cec_source_L2_High-Level_TestSpec.md => hdmi-cec-source_L2_High-Level_TestSpec.md} (100%) rename docs/pages/{hdmi_cec_source_L2_Low-Level_TestSpec.md => hdmi-cec-source_L2_Low-Level_TestSpec.md} (100%) diff --git a/docs/pages/hdmi_cec_sink_L2_High-Level_TestSpec.md b/docs/pages/hdmi-cec-sink_L2_High-Level_TestSpec.md similarity index 100% rename from docs/pages/hdmi_cec_sink_L2_High-Level_TestSpec.md rename to docs/pages/hdmi-cec-sink_L2_High-Level_TestSpec.md diff --git a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md index aa43d82..b83cf28 100644 --- a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md +++ b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md @@ -243,7 +243,7 @@ If the user chooses to run the test in interactive mode, then the test case has ```mermaid graph TB A[HdmiCecOpen] -->|HDMI_CEC_IO_SUCCESS| B[HdmiCecGetPhysicalAddress] -B -->|HDMI_CEC_IO_SUCCESS| C{Verify Physical Address < F.F.F.F} +B -->|HDMI_CEC_IO_SUCCESS| C{Verify Physical Address >= F.F.F.F} B -->|Failure| B1[Test case fail] C -->|Success| D[HdmiCecClose] C -->|Failure| C1[Test case fail] diff --git a/docs/pages/hdmi_cec_source_L2_High-Level_TestSpec.md b/docs/pages/hdmi-cec-source_L2_High-Level_TestSpec.md similarity index 100% rename from docs/pages/hdmi_cec_source_L2_High-Level_TestSpec.md rename to docs/pages/hdmi-cec-source_L2_High-Level_TestSpec.md diff --git a/docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md b/docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md similarity index 100% rename from docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md rename to docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md diff --git a/src/test_l2_hdmi_cec_source_driver.c b/src/test_l2_hdmi_cec_source_driver.c index 41dd700..319f1f4 100644 --- a/src/test_l2_hdmi_cec_source_driver.c +++ b/src/test_l2_hdmi_cec_source_driver.c @@ -96,7 +96,7 @@ static int gTestID = 1; * * **Test Procedure:** * Refer to UT specification documentation -* [hdmi_cec_source_hal_source_L2_Low-Level_TestSpecification.md](../docs/pages/hdmi_cec_source_L2_Low-Level_TestSpec.md) +* [hdmi_cec_source_hal_source_L2_Low-Level_TestSpecification.md](../docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md) */ void test_l2_hdmi_cec_source_hal_ValidateLogicalAddressUnavailability(void) From 3f2ad713298ad5a0b279448b5da7394cc28e9883 Mon Sep 17 00:00:00 2001 From: srinivasgtl <71806084+srinivasgtl@users.noreply.github.com> Date: Thu, 27 Jun 2024 18:04:14 +0000 Subject: [PATCH 39/48] gh #24 correcting the proper kvp key reading --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 11d73fe..bbf4d3e 100644 --- a/src/main.c +++ b/src/main.c @@ -117,7 +117,7 @@ int main(int argc, char** argv) /* Register tests as required, then call the UT-main to support switches and triggering */ UT_init( argc, argv ); - status = ut_kvp_getStringField(ut_kvp_profile_getInstance(), "dsAudio/Type", szReturnedString, UT_KVP_MAX_ELEMENT_SIZE); + status = ut_kvp_getStringField(ut_kvp_profile_getInstance(), "hdmicec/type", szReturnedString, UT_KVP_MAX_ELEMENT_SIZE); register_hdmicec_hal_l1_tests (); From 99fa71c3de35f07baa2b6cf2458cdc55abeee2ce Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:34:43 -0400 Subject: [PATCH 40/48] Correct physical address --- docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md | 4 ++-- src/test_l2_hdmi_cec_sink_driver.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md index b83cf28..3dc3337 100644 --- a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md +++ b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md @@ -237,13 +237,13 @@ If the user chooses to run the test in interactive mode, then the test case has | 01 | Call the pre-requisite API HdmiCecOpen() | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | | 02 | Call the API HdmiCecGetPhysicalAddress() | handle = valid handle, physicalAddress = valid address | HDMI_CEC_IO_SUCCESS | Should be successful | | 03 | Check the return status of HdmiCecGetPhysicalAddress() | status = return status of HdmiCecGetPhysicalAddress() | HDMI_CEC_IO_SUCCESS | Should be successful | -| 04 | Verify that the physical address obtained is greater than or equal to F.F.F.F | physicalAddress = obtained physical address | physicalAddress >= 0xFFFF | Should be successful | +| 04 | Verify that the physical address obtained is equal to 0.0.0.0 | physicalAddress = obtained physical address | physicalAddress == 0x0000 | Should be successful | | 05 | Call the post-requisite API HdmiCecClose() | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | ```mermaid graph TB A[HdmiCecOpen] -->|HDMI_CEC_IO_SUCCESS| B[HdmiCecGetPhysicalAddress] -B -->|HDMI_CEC_IO_SUCCESS| C{Verify Physical Address >= F.F.F.F} +B -->|HDMI_CEC_IO_SUCCESS| C{Verify Physical Address == 0.0.0.0} B -->|Failure| B1[Test case fail] C -->|Success| D[HdmiCecClose] C -->|Failure| C1[Test case fail] diff --git a/src/test_l2_hdmi_cec_sink_driver.c b/src/test_l2_hdmi_cec_sink_driver.c index edf54af..6bef956 100644 --- a/src/test_l2_hdmi_cec_sink_driver.c +++ b/src/test_l2_hdmi_cec_sink_driver.c @@ -339,7 +339,7 @@ void test_l2_hdmi_cec_sink_hal_BroadcastHdmiCecCommand(void) * * This test case verifies the physical address of the HDMI CEC HAL * by calling the HdmiCecGetPhysicalAddress() API. -* The test ensures that the physical address obtained is less than F.F.F.F. +* The test ensures that the physical address obtained is equal to 0.0.0.0. * The test also includes error handling and assertions to check the return values of the APIs. * The test ensures that the post-requisite API HdmiCecClose() * is called in case of any test failure after the successful execution of the pre-requisite API HdmiCecOpen(). @@ -376,9 +376,9 @@ void test_l2_hdmi_cec_sink_hal_VerifyPhysicalAddress(void) UT_LOG_ERROR("HdmiCecGetPhysicalAddress failed with status: %d", status); } - // Step 4: Verify that the physical address obtained is less than F.F.F.F - UT_LOG_DEBUG("Checking if physical address: %u is less than F.F.F.F", physicalAddress); - UT_ASSERT_TRUE(physicalAddress >= 0xFFFF) + // Step 4: Verify that the physical address obtained is equal to 0.0.0.0 + UT_LOG_DEBUG("Checking if physical address: %u is less than 0.0.0.0", physicalAddress); + UT_ASSERT_TRUE(physicalAddress >= 0x0000) // Step 5: Call the post-requisite API HdmiCecClose() UT_LOG_DEBUG("Invoking HdmiCecClose with handle: %d", handle); From 1b5819381d50471e098fe0a86e93213c308f181a Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:39:13 -0400 Subject: [PATCH 41/48] Update with specification information --- .../hdmi-cec-sink_L2_High-Level_TestSpec.md | 17 +++++++++++++---- .../hdmi-cec-sink_L2_Low-Level_TestSpec.md | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/pages/hdmi-cec-sink_L2_High-Level_TestSpec.md b/docs/pages/hdmi-cec-sink_L2_High-Level_TestSpec.md index ba100d9..aa9f7ba 100644 --- a/docs/pages/hdmi-cec-sink_L2_High-Level_TestSpec.md +++ b/docs/pages/hdmi-cec-sink_L2_High-Level_TestSpec.md @@ -78,7 +78,7 @@ Managing the opcodes is the responsibility of the caller. The existing test case ### Control Plane Requirements - Physical Address - The control plane will allow removing or adding a node to the network. - - allowing add sink node before the `DUT` switched ON. + - allowing add sink node before the `DUT` switched ON. ## CEC Synchronous Transmission @@ -90,11 +90,13 @@ Managing the opcodes is the responsibility of the caller. The existing test case | | | Transmit a HDMI CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version of a device that doesn't exist.| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | Y | NA | Control plane can unplug or switch off a previously existing CEC device | ### Emulator Requirements - CEC Transmission + - Boot configuration - Min case scenario multiple network nodes - Max case scenario multiple cec nodes ### Control Plane Requirements - CEC Transmission + - The control plane will allow adding a device that can respond to the CEC Frames sent by `DUT` ## CEC Receive functionality @@ -108,9 +110,11 @@ Managing the opcodes is the responsibility of the caller. The existing test case | | | Set the Logical address to 0 on `DUT` and make sure that it doesn't receive the messages sent to devices with different logical address.| HdmiCecAddLogicalAddress, HdmiCecSetRxCallback, HdmiCecRemoveLogicalAddress | NA | Y | Control Plane to initiate a command to send CEC frames from CEC adaptor with a different logical address other than zero| ### Emulator Requirements - CEC Receive functionality + 1. Emulate the Tx and Rx HAL functionalities with the required responses. ### Control Plane Requirements - CEC Transmission + - The control plane will allow adding a device that can respond to the CEC Frames sent by `DUT` - The control plane to initiate CEC Transmissions from the connected devices as expected by the `DUT` @@ -124,6 +128,7 @@ Managing the opcodes is the responsibility of the caller. The existing test case ### Emulator Requirements - CEC HotPlug Functionality ### Control Plane Requirements - CEC HotPlug Functionality + 1. Control plane to initiate the HotPlug activity by commanding an IP power switch to the OFF State to which the Node device is connected. ----------- @@ -136,12 +141,16 @@ Managing the opcodes is the responsibility of the caller. The existing test case | 7| Introduce fault in the CEC Bus | Observe the behaviour when the CEC line is pulled high during the CEC Transmission using a CEC Adaptor that provision to keep the CEC line pulled high| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y |CEC Adaptor used shall have a provision to introduce the fault. The control plane should be able to command to pull the CEC line high, else it should follow a manual process| | 8| Overloading the CEC bus. | Overload the CEC bus with too many messages (by connecting more devices in the network) and observe the behaviour| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y |Control plane to initiate the CEC Transmission through all the connected devices continuously with a command that expects the response as well to overload the CEC Network. | -### Emulator Requirements +### Emulator Requirements - Hardware verification + 1. Emulator to support the HDMI_CEC_IO_SENT_FAILED during the above scenarios - + ### Control Plane Requirements + 1. Control Plane to control the external devices to pull the CEC line high. + 2. Control Plan to initiate multiple CEC commands from the different devices connected to the network. + ----------- ----------- @@ -165,4 +174,4 @@ Configurations: Port: 3, 4 HDMI Node: 1-3 etc. CEC_Ports: 1, x, y -``` \ No newline at end of file +``` diff --git a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md index 3dc3337..7ff45e2 100644 --- a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md +++ b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md @@ -237,7 +237,7 @@ If the user chooses to run the test in interactive mode, then the test case has | 01 | Call the pre-requisite API HdmiCecOpen() | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | | 02 | Call the API HdmiCecGetPhysicalAddress() | handle = valid handle, physicalAddress = valid address | HDMI_CEC_IO_SUCCESS | Should be successful | | 03 | Check the return status of HdmiCecGetPhysicalAddress() | status = return status of HdmiCecGetPhysicalAddress() | HDMI_CEC_IO_SUCCESS | Should be successful | -| 04 | Verify that the physical address obtained is equal to 0.0.0.0 | physicalAddress = obtained physical address | physicalAddress == 0x0000 | Should be successful | +| 04 | Verify that the physical address obtained is equal to 0.0.0.0 | physicalAddress = obtained physical address | physicalAddress == 0x0000 (as per HDMI Spec 1.4b and section 8.7.2) | Should be successful | | 05 | Call the post-requisite API HdmiCecClose() | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | ```mermaid From 5da5457444979b4bfe85d977e107ae795bc24086 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:02:29 -0400 Subject: [PATCH 42/48] Update based on review meeting --- .../hdmi-cec-source_L2_Low-Level_TestSpec.md | 2 +- .../l2_module_test_specification_template.md | 109 ------------------ src/test_l2_hdmi_cec_source_driver.c | 2 +- 3 files changed, 2 insertions(+), 111 deletions(-) delete mode 100644 docs/pages/l2_module_test_specification_template.md diff --git a/docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md b/docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md index 0a93a96..6f8da43 100644 --- a/docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md +++ b/docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md @@ -63,7 +63,7 @@ graph TB Step1[Call HdmiCecOpen] -->|Success| Step2[Check returned status] Step1 -->|Failure| TestFail1[Test Case Failed: HdmiCecOpen failed] Step2 -->|Status is
HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE| Step4[TestCase Success] - Step2 -->|Status is not
HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE| TestFail2[Test Case Failed] + Step2 -->|Status is
HDMI_CEC_IO_SUCCESS or HDMI_CEC_IO_ALREADY_OPEN| TestFail2[Test Case Failed] TestFail2 -->|Status is HDMI_CEC_IO_SUCCESS| Step3[Call HdmiCecClose] Step3 -->|Success| Step5[HdmiCecClose success] Step3 -->|Failure| TestFail3[Test Case Failed: HdmiCecClose failed] diff --git a/docs/pages/l2_module_test_specification_template.md b/docs/pages/l2_module_test_specification_template.md deleted file mode 100644 index 75cc834..0000000 --- a/docs/pages/l2_module_test_specification_template.md +++ /dev/null @@ -1,109 +0,0 @@ -# L2 Test Specification template -## History - -| Version | Date(YY-MM-DD) | Comments | -| --------| -------------- | ----- | -| 1.0.0 | 22/02/23 | Inital Document | - -## Table of Contents - -- [L2 Test Specification template](#l2-test-specification-template) - - [History](#history) - - [Table of Contents](#table-of-contents) - - [Overview](#overview) - - [Acronyms, Terms and Abbreviations](#acronyms-terms-and-abbreviations) - - [Definitions](#definitions) - - [References](#references) - - [Level 2 Test Suite](#level-2-test-suite) - - [Test 1](#test-1) - - [Test Procedure :](#test-procedure-) - - [Test 2](#test-2) - - [Test Procedure :](#test-procedure--1) - -## Overview - -This document describes the level 2 testing suite for the module. - -### Acronyms, Terms and Abbreviations - -- `HAL` \- Hardware Abstraction Layer, may include some common components -- `HAL.h` \- Abstracted defined API to control the hardware -- `HAL.c` \- Implementation wrapper layer created by the `OEM` or `SoC` Vendor. -- `RDK` \- Reference Design Kit for All Devices -- `RDK-B` \- Reference Design Kit for Broadband Devices -- `RDK-V` \- Reference Design Kit for Video Devices -- `UT` \- Unit Test(s) -- `OEM` \- Original Equipment Manufacture -- `SoC` \- System on a Chip - -### Definitions - -- `Broadcom` \- `SoC` manufacturer -- `Amlogic` \- `SoC` manufacturer -- `Soc Vendor` \- Definition to encompass multiple vendors -- `Unit Tests` \- C Function tests that run on the target hardware -- `Common Testing Framework` \- Off the shelf 3rd Party Testing Framework, or framework that does not require infrastructure to control it. That's not to say it cannot be controlled via infrastructure if required. Examples of which are. - - `GTest` \- Google Test Suit - - `CUnit` \- C Testing Suit - - `Unity` \- C Embedded Testing Suit - - `ut-core` \- Common Testing Framework , which wraps a open-source framework that can be expanded to the requirements for future framework. - -### References - -- `Feedback Loops` \- -- `Doxygen` \- SourceCode documentation tool - -- `Black Box Testing` \- - -## Level 2 Test Suite - -The following functions are expecting to test the module operates correctly. - -### Test 1 - -|Title|Details| -|--|--| -|Function Name|`test_l2__`| -|Description|TODO: Add the description of what is tested and why in this test| -|Test Group|TODO: Basic (for L1): 01 / Module (L2): 02 / Stress (L2): 03)| -|Test Case ID|TODO: Add the ID of the test case so that it can be logically tracked in the logs| -|Priority|TODO: (Low/Med/High) Add the priority for the level of test, how important is the test to overall functionality| - -**Pre-Conditions :** -TODO: Add pre-conditions, if any - -**Dependencies :** TODO: Add dependencies for this test, if any - -**User Interaction :** TODO: Add any user interactions required during this test, if any - -#### Test Procedure : - -TODO: Add the steps to run this test and add a line in the below table for each input variation tried in this function. - -| Variation / Steps | Description | Test Data | Expected Result | Notes| -| -- | --------- | ---------- | -------------- | ----- | -| 01 | First set of conditions | What is input data to be tested | How to gauge success, is it a success variable? | Should be successful | - -### Test 2 - -|Title|Details| -|--|--| -|Function Name|`test_l2__`| -|Description|TODO: Add the description of what is tested and why in this test| -|Test Group|TODO: Basic (for L1): 01 / Module (L2): 02 / Stress (L2): 03)| -|Test Case ID|TODO: Add the ID of the test case so that it can be logically tracked in the logs| -|Priority|TODO: (Low/Med/High) Add the priority for the level of test, how important is the test to overall functionality| - -**Pre-Conditions :** -TODO: Add pre-conditions, if any - -**Dependencies :** TODO: Add dependencies for this test, if any - -**User Interaction :** TODO: Add any user interactions required during this test, if any - -#### Test Procedure : - -TODO: Add the steps to run this test and add a line in the below table for each input variation tried in this function. - -| Variation / Steps | Description | Test Data | Expected Result | Notes| -| -- | --------- | ---------- | -------------- | ----- | -| 01 | First set of conditions | What is input data to be tested | How to gauge success, is it a success variable? | Should be successful | diff --git a/src/test_l2_hdmi_cec_source_driver.c b/src/test_l2_hdmi_cec_source_driver.c index 319f1f4..925fe2b 100644 --- a/src/test_l2_hdmi_cec_source_driver.c +++ b/src/test_l2_hdmi_cec_source_driver.c @@ -113,7 +113,7 @@ void test_l2_hdmi_cec_source_hal_ValidateLogicalAddressUnavailability(void) // Return value should be HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE, when the DUT is not connected to a Sink device. UT_ASSERT_EQUAL(status, HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE); - if (status == HDMI_CEC_IO_SUCCESS) + if (status == HDMI_CEC_IO_SUCCESS || status == HDMI_CEC_IO_ALREADY_OPEN) { UT_LOG_DEBUG("Invoking HdmiCecClose with handle: %d", handle); HDMI_CEC_STATUS close_status = HdmiCecClose(handle); From 8b996f9d16f8a80a2be8d7b412fe47abf515da33 Mon Sep 17 00:00:00 2001 From: srinivasgtl <71806084+srinivasgtl@users.noreply.github.com> Date: Thu, 27 Jun 2024 19:16:49 +0000 Subject: [PATCH 43/48] gh #24 documentation and hyper link updates --- ...Level_TestSpec.md => hdmi-cec-sink_High-Level_TestSpec.md} | 0 docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md | 4 +++- ...vel_TestSpec.md => hdmi-cec-source_High-Level_TestSpec.md} | 0 docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md | 3 ++- 4 files changed, 5 insertions(+), 2 deletions(-) rename docs/pages/{hdmi-cec-sink_L2_High-Level_TestSpec.md => hdmi-cec-sink_High-Level_TestSpec.md} (100%) rename docs/pages/{hdmi-cec-source_L2_High-Level_TestSpec.md => hdmi-cec-source_High-Level_TestSpec.md} (100%) diff --git a/docs/pages/hdmi-cec-sink_L2_High-Level_TestSpec.md b/docs/pages/hdmi-cec-sink_High-Level_TestSpec.md similarity index 100% rename from docs/pages/hdmi-cec-sink_L2_High-Level_TestSpec.md rename to docs/pages/hdmi-cec-sink_High-Level_TestSpec.md diff --git a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md index 7ff45e2..bad499a 100644 --- a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md +++ b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md @@ -27,7 +27,9 @@ This document describes the level 2 testing suite for the HDMI CEC HAL module. ### References -- `High-Level Test Specification` - [hdmi_cec_sink_tests.md](hdmi_cec_sink_tests.md) +- `High Level Test Specification` - [hdmi-cec-sink_High-Level_TestSpec.md](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/blob/main/docs/pages/hdmi-cec-sink_High-Level_TestSpec.md) +- `HDMI CEC HAL Interface file` - [hdmi_cec_driver.h](https://github.com/rdkcentral/rdk-halif-hdmi_cec/blob/main/include/hdmi_cec_driver.h) + ## Level 2 Test Procedure diff --git a/docs/pages/hdmi-cec-source_L2_High-Level_TestSpec.md b/docs/pages/hdmi-cec-source_High-Level_TestSpec.md similarity index 100% rename from docs/pages/hdmi-cec-source_L2_High-Level_TestSpec.md rename to docs/pages/hdmi-cec-source_High-Level_TestSpec.md diff --git a/docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md b/docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md index 6f8da43..36c69ae 100644 --- a/docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md +++ b/docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md @@ -25,7 +25,8 @@ This document describes the level 2 testing suite for the HDMI CEC HAL module. ### References -- `High Level Test Specification` - [hdmi_cec_source_tests.md](hdmi_cec_source_tests.md) +- `High Level Test Specification` - [hdmi-cec-source_High-Level_TestSpec.md](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/blob/main/docs/pages/hdmi-cec-source_High-Level_TestSpec.md) +- `HDMI CEC HAL Interface file` - [hdmi_cec_driver.h](https://github.com/rdkcentral/rdk-halif-hdmi_cec/blob/main/include/hdmi_cec_driver.h) ## Level 2 Test Procedure From 47ffacfe611536403f7dc538500732dece3af832 Mon Sep 17 00:00:00 2001 From: srinivasgtl <71806084+srinivasgtl@users.noreply.github.com> Date: Thu, 27 Jun 2024 19:22:51 +0000 Subject: [PATCH 44/48] gh #24 removed the version history --- docs/pages/hdmi-cec-source_High-Level_TestSpec.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/pages/hdmi-cec-source_High-Level_TestSpec.md b/docs/pages/hdmi-cec-source_High-Level_TestSpec.md index a0ce3f7..2e36cd4 100644 --- a/docs/pages/hdmi-cec-source_High-Level_TestSpec.md +++ b/docs/pages/hdmi-cec-source_High-Level_TestSpec.md @@ -1,11 +1,5 @@ # HDMI CEC Test Document -## Version History - -| Date(DD/MM/YY) | Comment | Version | -| -------------- | ------- | ------- | -| 13/02/24 | First Release | 1.0.0 | - ## Table of Contents - [Acronyms, Terms and Abbreviations](#acronyms-terms-and-abbreviations) From 5e99e8088b5633ca20ed91dc42c373dcbd66f919 Mon Sep 17 00:00:00 2001 From: hari22yuva <56021398+hari22yuva@users.noreply.github.com> Date: Fri, 28 Jun 2024 11:21:54 +0100 Subject: [PATCH 45/48] gh #24 fixed compilation warnings,doxygen,name in test spec --- .../hdmi-cec-sink_High-Level_TestSpec.md | 32 ++++---- .../hdmi-cec-sink_L2_Low-Level_TestSpec.md | 16 ++-- .../hdmi-cec-source_L2_Low-Level_TestSpec.md | 4 +- src/main.c | 9 +- src/test_l2_hdmi_cec_sink_driver.c | 82 ++++++++++--------- src/test_l2_hdmi_cec_source_driver.c | 32 ++++---- 6 files changed, 94 insertions(+), 81 deletions(-) diff --git a/docs/pages/hdmi-cec-sink_High-Level_TestSpec.md b/docs/pages/hdmi-cec-sink_High-Level_TestSpec.md index aa9f7ba..faeeb83 100644 --- a/docs/pages/hdmi-cec-sink_High-Level_TestSpec.md +++ b/docs/pages/hdmi-cec-sink_High-Level_TestSpec.md @@ -1,18 +1,18 @@ - -# HDMI CEC High-Level Test Specification Document +# HDMI CEC Sink High-Level Test Specification Document ## Table of Contents - [Acronyms, Terms and Abbreviations](#acronyms-terms-and-abbreviations) - [Overview](#overview) - [HDMI-CEC RDK HAL Functionality](#hdmi-cec-rdk-hal-functionality) +- [Test scenarios](#test-scenarios) ## Acronyms, Terms and Abbreviations - `CEC` - Consumer Electronics Control - `HAL` - Hardware Abstraction layer - `HDMI` - High Definition Multimedia Interface -- `DUT` - Device Under Test +- `DUT` - Device Under Test - `L2` - Level 2 Testing () - `L3` - Level 3 Testing () @@ -22,7 +22,7 @@ This document defines the requirements for testing the HDMI CEC device from a le ## Overview -Consumer Electronics Control (CEC) is a single-wire bidirectional bus within an HDMI system, facilitating communication among interconnected products. HDMI-CEC establishes a protocol enabling high-level control functions between audiovisual devices linked via an HDMI network, facilitating communication and control among them. Communication can occur in either Direct messaging mode or Broadcast mode. +Consumer Electronics Control (CEC) is a single-wire bidirectional bus within an HDMI system, facilitating communication among interconnected products. HDMI-CEC establishes a protocol enabling high-level control functions between audiovisual devices linked via an HDMI network, facilitating communication and control among them. Communication can occur in either Direct messaging mode or Broadcast mode. ## HDMI-CEC RDK HAL Functionality @@ -30,7 +30,7 @@ The HAL layers within RDK serve as a bridge between the underlying low-level SoC 1. Provision to set, get, and remove the logical address 2. Provision to get the Physical address -3. Provision to Tx and Rx the CEC data +3. Provision to Tx and Rx the CEC data ## Test scenarios @@ -52,22 +52,22 @@ Managing the opcodes is the responsibility of the caller. The existing test case |S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| |-----|------------------|-----------|--------|--|--|--------------------------| -| 1 |[Logical address](#logical-address-discovery)|Get the logical address of the `DUT` without actually adding the Logical Address and the API should return 0x0F as the default logical address.|HdmiCecGetLogicalAddress|Y|NA -|a| |Setup all valid logical addresses b/w 0x00 to 0x0F for the `DUT` and retrieve each to ensure proper functionality, using HAL APIs.|HdmiCecAddLogicalAddress, HdmiCecGetLogicalAddress, HdmiCecRemoveLogicalAddress| Y | NA | -|b| | Invoke the HAL API to delete the `DUT` logical address and verify that it is removed successfully. |HdmiCecAddLogicalAddress, HdmiCecRemoveLogicalAddress, HdmiCecGetLogicalAddress| Y | NA| -|c| | After deleting the `DUT` logical address, try to send a broadcast CEC Command (as per 1.4b HDMI CEC spec) and confirm transmission is successful.|HdmiCecAddLogicalAddress, HdmiCecRemoveLogicalAddress, HdmiCecTx | Y|NA|| +| 1 |Logical address|Get the logical address of the `DUT` without actually adding the Logical Address and the API should return 0x0F as the default logical address.|HdmiCecGetLogicalAddress|`Y`|`NA`|`NA`| +|a| |Setup all valid logical addresses b/w 0x00 to 0x0F for the `DUT` and retrieve each to ensure proper functionality, using HAL APIs.|HdmiCecAddLogicalAddress, HdmiCecGetLogicalAddress, HdmiCecRemoveLogicalAddress| `Y`| `NA` |`NA`| +|b| | Invoke the HAL API to delete the `DUT` logical address and verify that it is removed successfully. |HdmiCecAddLogicalAddress, HdmiCecRemoveLogicalAddress, HdmiCecGetLogicalAddress| `Y` | `NA`|`NA`| +|c| | After deleting the `DUT` logical address, try to send a broadcast CEC Command (as per 1.4b HDMI CEC spec) and confirm transmission is successful.|HdmiCecAddLogicalAddress, HdmiCecRemoveLogicalAddress, HdmiCecTx |`Y`|`NA`|`NA`| ### Emulator Requirements - Boot with control configuration with various configurations having a predefined set of nodes: - - configuration to support the discovery of logical addresses. The caller provides the logical address, and HAL checks the availability of this address and feedback the same to the caller. - - Verify for the valid logical address and return the appropriate error code based on the logical address availability. + - configuration to support the discovery of logical addresses. The caller provides the logical address, and HAL checks the availability of this address and feedback the same to the caller. + - Verify for the valid logical address and return the appropriate error code based on the logical address availability. ## Physical Address |S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| |-----|------------------|-----------|--------|--|--|--------------------------| -| 2| [Physical Address](#physical-address)| Verify the physical address allocated through the HAL function.|HdmiCecGetPhysicalAddress| Y |NA|| +| 2| Physical Address| Verify the physical address allocated through the HAL function.|HdmiCecGetPhysicalAddress| Y |NA|| | | | Verify the physical addresses allocated by connecting two sink devices through an HDMI switch.| HdmiCecGetPhysicalAddress| NA | Y | Enable the television connected to `DUT` to declare its physical address first before `DUT`.| ### Emulator Requirements - Physical Address @@ -84,7 +84,7 @@ Managing the opcodes is the responsibility of the caller. The existing test case |S.No.|Test Functionality|Description|HAL APIs|L2|L3|Control plane requirements| |-----|------------------|-----------|--------|--|--|--------------------------| -| 3| [CEC Transmission](#cec-transmission)| Verify the correct transmission of the supported CEC commands (as per 1.4b HDMI CEC spec) to the connected device and ensure it is acknowledged properly.| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y |Control plane to switch ON a CEC-supported device on the HDMI network so that it shall respond to the basic commands| +| 3| CEC Transmission| Verify the correct transmission of the supported CEC commands (as per 1.4b HDMI CEC spec) to the connected device and ensure it is acknowledged properly.| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y |Control plane to switch ON a CEC-supported device on the HDMI network so that it shall respond to the basic commands| | | | Broadcast a supported CEC Command to all the devices connected to the network without any error |HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress| NA | Y |Control plane to switch ON a CEC-supported device on the HDMI network to act on the broadcasted command| | | | Transmit a CEC Command (as per 1.4b HDMI CEC spec) to put the connected device into standby mode and await the device's response. Monitoring the behaviour of the connected device accordingly.| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y | Control plane to monitor the behaviour of the connected devices. | | | | Transmit a HDMI CEC Command (as per 1.4b HDMI CEC spec) to get the CEC Version of a device that doesn't exist.| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | Y | NA | Control plane can unplug or switch off a previously existing CEC device | @@ -103,7 +103,7 @@ Managing the opcodes is the responsibility of the caller. The existing test case |S.No.|Test Functionality|Description| HAL APIs|L2|L3|Control plane requirements| |-----|------------------|-----------|---------|--|--|--------------------------| -| 5| [CEC Receive functionality](#cec-receive-functionality)| Transmit a CEC Command that expects a response (Eg. GetCECVersion) to a connected device and see the response is received correctly. Set the Rx Callback before sending the data. Validate the received CEC Version.|HdmiCecAddLogicalAddress, HdmiCecSetRxCallback, HdmiCecTx, HdmiCecRemoveLogicalAddress| NA |Y| Control plane to switch ON a CEC device that can respond to the Transmitted CEC Command| +| 5| CEC Receive functionality| Transmit a CEC Command that expects a response (Eg. GetCECVersion) to a connected device and see the response is received correctly. Set the Rx Callback before sending the data. Validate the received CEC Version.|HdmiCecAddLogicalAddress, HdmiCecSetRxCallback, HdmiCecTx, HdmiCecRemoveLogicalAddress| NA |Y| Control plane to switch ON a CEC device that can respond to the Transmitted CEC Command| | | | Transmit a CEC command from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (`DUT` TV here)| HdmiCecAddLogicalAddress, HdmiCecSetRxCallback, HdmiCecRemoveLogicalAddress | NA | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`| | | | Transmit an OSD CEC command from the connected devices and consider the Acknowledgement and responses are received correctly from the host device (`DUT` TV here). Make the OSD String to max length| HdmiCecAddLogicalAddress, HdmiCecSetRxCallback, HdmiCecRemoveLogicalAddress | NA | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`| | | | Transmit an OSD CEC command from the connected devices continuously for 30 seconds changing the patterns in the payload and considering the Acknowledgement and responses are received correctly from the host device (`DUT` TV here). Make the OSD String to max length| HdmiCecAddLogicalAddress, HdmiCecSetRxCallback, HdmiCecRemoveLogicalAddress | NA | Y | Control panel to control the third-party devices to Transmit the required commands to `DUT`. Also, Control plane to detect the OSD Display on the Sink device to validate| @@ -113,7 +113,7 @@ Managing the opcodes is the responsibility of the caller. The existing test case 1. Emulate the Tx and Rx HAL functionalities with the required responses. -### Control Plane Requirements - CEC Transmission +### Control Plane Requirements - CEC Receive Transmission - The control plane will allow adding a device that can respond to the CEC Frames sent by `DUT` - The control plane to initiate CEC Transmissions from the connected devices as expected by the `DUT` @@ -149,7 +149,7 @@ Managing the opcodes is the responsibility of the caller. The existing test case 1. Control Plane to control the external devices to pull the CEC line high. -2. Control Plan to initiate multiple CEC commands from the different devices connected to the network. +2. Control Plan to initiate multiple CEC commands from the different devices connected to the network. ----------- ----------- diff --git a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md index bad499a..4b15aad 100644 --- a/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md +++ b/docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md @@ -1,23 +1,23 @@ -# HDMI CEC HAL L2 Low-Level Test Specification and Procedure Documentation +# HDMI CEC Sink L2 Low-Level Test Specification and Procedure Documentation ## Table of Contents - [Overview](#overview) - - [Acronyms, Terms and Abbreviations](#acronyms-terms-and-abbreviations) - - [Definitions](#definitions) - - [References](#references) +- [Acronyms, Terms and Abbreviations](#acronyms-terms-and-abbreviations) +- [Definitions](#definitions) +- [References](#references) - [Level 2 Test Procedure](#level-2-test-procedure) ## Overview -This document describes the level 2 testing suite for the HDMI CEC HAL module. +This document describes the level 2 Low-Level Test Specification and Procedure Documentation for the HDMI CEC Sink module. ### Acronyms, Terms and Abbreviations - `HAL` \- Hardware Abstraction Layer, may include some common components - `UT` \- Unit Test(s) - `HDMI` \- High-Definition Multimedia Interface -- `CEC` \- Consumer Electronics Contro +- `CEC` \- Consumer Electronics Control - `DUT` \- Device Under Test - `API` \- Application Program Interface @@ -30,7 +30,6 @@ This document describes the level 2 testing suite for the HDMI CEC HAL module. - `High Level Test Specification` - [hdmi-cec-sink_High-Level_TestSpec.md](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/blob/main/docs/pages/hdmi-cec-sink_High-Level_TestSpec.md) - `HDMI CEC HAL Interface file` - [hdmi_cec_driver.h](https://github.com/rdkcentral/rdk-halif-hdmi_cec/blob/main/include/hdmi_cec_driver.h) - ## Level 2 Test Procedure The following functions are intended to test the HDMI CEC HAL module's operation on sink devices according to the L2 Test specification. @@ -63,7 +62,6 @@ If the user chooses to run the test in interactive mode, then the test case has | 03 | Check the logical address | | logicalAddress = 0x0F| Should be successful | | 04 | Call the post-requisite API HdmiCecClose() | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | - ```mermaid graph TB A[Call HdmiCecOpen] -->|HDMI_CEC_IO_SUCCESS| B[Call HdmiCecGetLogicalAddress] @@ -106,7 +104,6 @@ If the user chooses to run the test in interactive mode, then the test case has | 05 | Remove logical address using HdmiCecRemoveLogicalAddress API | handle = valid handle, logicalAddress = i | HDMI_CEC_IO_SUCCESS | Should be successful | | 06 | Close HDMI CEC HAL using HdmiCecClose API | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | - ```mermaid graph TB A[HdmiCecOpen] -->|HDMI_CEC_IO_SUCCESS| B{Loop 0x00 to 0x0F} @@ -150,7 +147,6 @@ If the user chooses to run the test in interactive mode, then the test case has | 05 | Get the logical address using HdmiCecGetLogicalAddress API | handle = valid handle, logicalAddress = valid buffer | HDMI_CEC_IO_SUCCESS , logicalAddress = 0x0F | Should be successful | | 06 | Close the HDMI CEC HAL using HdmiCecClose API | handle = valid handle | HDMI_CEC_IO_SUCCESS | Should be successful | - ```mermaid graph TB A[HdmiCecOpen] -- "HDMI_CEC_IO_SUCCESS" --> B[HdmiCecAddLogicalAddress] diff --git a/docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md b/docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md index 36c69ae..349e51e 100644 --- a/docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md +++ b/docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md @@ -1,4 +1,4 @@ -# HDMI CEC HAL L2 Low Level Test Specification and Procedure Documentation +# HDMI CEC Source L2 Low Level Test Specification and Procedure Documentation ## Table of Contents @@ -10,7 +10,7 @@ ## Overview -This document describes the level 2 testing suite for the HDMI CEC HAL module. +This document describes the Source level 2 Low Level Test Specification and Procedure Documentation for the HDMI CEC HAL module Source. ### Acronyms, Terms and Abbreviations diff --git a/src/main.c b/src/main.c index bbf4d3e..3badd61 100644 --- a/src/main.c +++ b/src/main.c @@ -73,7 +73,7 @@ extern int register_hdmicec_hal_sink_l2_tests( void ); extern int register_vcomponent_tests ( char* profile, unsigned short cpPort, char* cpPath ); #endif -int main(int argc, char** argv) +int main(int argc, char** argv) { ut_kvp_status_t status; char szReturnedString[UT_KVP_MAX_ELEMENT_SIZE]; @@ -118,6 +118,13 @@ int main(int argc, char** argv) UT_init( argc, argv ); status = ut_kvp_getStringField(ut_kvp_profile_getInstance(), "hdmicec/type", szReturnedString, UT_KVP_MAX_ELEMENT_SIZE); + if (status == UT_KVP_STATUS_SUCCESS ) { + UT_LOG_DEBUG("Device Type: %s", szReturnedString); + } + else { + UT_LOG_ERROR("Failed to get the platform Device Type"); + return -1; + } register_hdmicec_hal_l1_tests (); diff --git a/src/test_l2_hdmi_cec_sink_driver.c b/src/test_l2_hdmi_cec_sink_driver.c index 6bef956..0d84ca3 100644 --- a/src/test_l2_hdmi_cec_sink_driver.c +++ b/src/test_l2_hdmi_cec_sink_driver.c @@ -42,8 +42,6 @@ * * ### L2 Test Cases for HDMI CEC HAL : * - * @file test_l2_hdmi_cec_driver.c - * @page hdmi_cec_driver Level 2 Tests * * ## Module's Role * This module includes Level 2 functional tests (success and failure scenarios). @@ -57,6 +55,11 @@ * @endparblock */ +/** + * @file test_l2_hdmi_cec_sink_driver.c + * + */ + #include #include #include "hdmi_cec_driver.h" @@ -67,17 +70,17 @@ static int gTestID = 1; /** * @brief Test for getting the default logical address of the HDMI CEC HAL * -* This test case validates the functionality of getting the default logical +* This test case validates the functionality of getting the default logical * address of the HDMI CEC HAL. It first opens a connection to the HDMI CEC HAL, -* then retrieves the logical address, checks if the address is correct, -* and finally closes the connection. This test is important to ensure +* then retrieves the logical address, checks if the address is correct, +* and finally closes the connection. This test is important to ensure * that the HDMI CEC HAL is correctly assigning the default logical address. * * **Test Group ID:** 02@n * **Test Case ID:** 001@n * * **Test Procedure:** -* Refer to UT specification documentation +* Refer to UT specification documentation * [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ @@ -122,18 +125,18 @@ void test_l2_hdmi_cec_sink_hal_GetDefaultLogicalAddress(void) * getting logical addresses in HDMI CEC HAL * * This test case is designed to validate the correct operation of the -* HdmiCecAddLogicalAddress and HdmiCecGetLogicalAddress APIs. -* It does this by first opening a handle to the HDMI CEC HAL, -* then adding logical addresses to it, and finally retrieving -* those addresses to verify they were correctly added. -* The test ensures that the APIs return the expected status codes +* HdmiCecAddLogicalAddress and HdmiCecGetLogicalAddress APIs. +* It does this by first opening a handle to the HDMI CEC HAL, +* then adding logical addresses to it, and finally retrieving +* those addresses to verify they were correctly added. +* The test ensures that the APIs return the expected status codes * and that the retrieved addresses match the ones that were added. * * **Test Group ID:** 02@n * **Test Case ID:** 002@n * * **Test Procedure:** -* Refer to UT specification documentation +* Refer to UT specification documentation * [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ void test_l2_hdmi_cec_sink_hal_AddAndGetLogicalAddress(void) @@ -191,16 +194,16 @@ void test_l2_hdmi_cec_sink_hal_AddAndGetLogicalAddress(void) /** * @brief Test the removal of a logical address in the HDMI CEC HAL * -* This function tests the removal of a logical address in the HDMI CEC HAL. +* This function tests the removal of a logical address in the HDMI CEC HAL. * It first opens the HAL, adds a logical address, removes the logical address, -* checks that the logical address has been removed, +* checks that the logical address has been removed, * and finally closes the HAL. * * **Test Group ID:** 02@n * **Test Case ID:** 003@n * * **Test Procedure:** -* Refer to UT specification documentation +* Refer to UT specification documentation * [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ @@ -268,17 +271,17 @@ void test_l2_hdmi_cec_sink_hal_RemoveLogicalAddress(void) /** * @brief Test for broadcasting HDMI CEC command * -* This function tests the HDMI CEC HAL's ability to broadcast a -* HDMI CEC command when logical address is removed. -* It first opens the HDMI CEC HAL, adds a logical address, removes -* the logical address, sends a broadcast HDMI CEC command, +* This function tests the HDMI CEC HAL's ability to broadcast a +* HDMI CEC command when logical address is removed. +* It first opens the HDMI CEC HAL, adds a logical address, removes +* the logical address, sends a broadcast HDMI CEC command, * and finally closes the HDMI CEC HAL. * * **Test Group ID:** 02@n * **Test Case ID:** 004@n * * **Test Procedure:** -* Refer to UT specification documentation +* Refer to UT specification documentation * [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ @@ -337,18 +340,18 @@ void test_l2_hdmi_cec_sink_hal_BroadcastHdmiCecCommand(void) /** * @brief Test to verify the physical address of the HDMI CEC HAL * -* This test case verifies the physical address of the HDMI CEC HAL -* by calling the HdmiCecGetPhysicalAddress() API. -* The test ensures that the physical address obtained is equal to 0.0.0.0. -* The test also includes error handling and assertions to check the return values of the APIs. -* The test ensures that the post-requisite API HdmiCecClose() +* This test case verifies the physical address of the HDMI CEC HAL +* by calling the HdmiCecGetPhysicalAddress() API. +* The test ensures that the physical address obtained is equal to 0.0.0.0. +* The test also includes error handling and assertions to check the return values of the APIs. +* The test ensures that the post-requisite API HdmiCecClose() * is called in case of any test failure after the successful execution of the pre-requisite API HdmiCecOpen(). * * **Test Group ID:** 02@n * **Test Case ID:** 005@n * * **Test Procedure:** -* Refer to UT specification documentation +* Refer to UT specification documentation * [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ @@ -391,16 +394,16 @@ void test_l2_hdmi_cec_sink_hal_VerifyPhysicalAddress(void) /** * @brief This test function is designed to test the transmission of CEC commands in the HDMI CEC HAL. * -* This test function tests the transmission of CEC commands in the HDMI CEC HAL. -* It opens a connection, adds a logical address, sends a CEC command, -* removes the logical address, and then closes the connection. +* This test function tests the transmission of CEC commands in the HDMI CEC HAL. +* It opens a connection, adds a logical address, sends a CEC command, +* removes the logical address, and then closes the connection. * The test asserts that each operation returns the expected status. * * **Test Group ID:** 02@n * **Test Case ID:** 006@n * * **Test Procedure:** -* Refer to UT specification documentation +* Refer to UT specification documentation * [hdmi-cec-sink_L2_Low-Level_TestSpec.md](../docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md) */ @@ -458,7 +461,7 @@ static UT_test_suite_t * pSuite = NULL; * * @return int - 0 on success, otherwise failure */ - + int test_register_hdmicec_hal_sink_l2_tests(void) { // Create the test suite @@ -469,12 +472,17 @@ int test_register_hdmicec_hal_sink_l2_tests(void) } // List of test function names and strings - UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_GetDefaultLogicalAddress", test_l2_hdmi_cec_sink_hal_GetDefaultLogicalAddress); - UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_AddAndGetLogicalAddress", test_l2_hdmi_cec_sink_hal_AddAndGetLogicalAddress); - UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_RemoveLogicalAddress", test_l2_hdmi_cec_sink_hal_RemoveLogicalAddress); - UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_BroadcastHdmiCecCommand", test_l2_hdmi_cec_sink_hal_BroadcastHdmiCecCommand); - UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_VerifyPhysicalAddress", test_l2_hdmi_cec_sink_hal_VerifyPhysicalAddress); - UT_add_test( pSuite, "l2_hdmi_cec_sink_hal_TransmitCECCommand", test_l2_hdmi_cec_sink_hal_TransmitCECCommand); + UT_add_test( pSuite, "L2_GetDefaultLogicalAddress_Sink", test_l2_hdmi_cec_sink_hal_GetDefaultLogicalAddress); + UT_add_test( pSuite, "L2_AddAndGetLogicalAddress_Sink", test_l2_hdmi_cec_sink_hal_AddAndGetLogicalAddress); + UT_add_test( pSuite, "L2_RemoveLogicalAddress_Sink", test_l2_hdmi_cec_sink_hal_RemoveLogicalAddress); + UT_add_test( pSuite, "L2_BroadcastHdmiCecCommand_Sink", test_l2_hdmi_cec_sink_hal_BroadcastHdmiCecCommand); + UT_add_test( pSuite, "L2_VerifyPhysicalAddress_Sink", test_l2_hdmi_cec_sink_hal_VerifyPhysicalAddress); + UT_add_test( pSuite, "L2_TransmitCECCommand_Sink", test_l2_hdmi_cec_sink_hal_TransmitCECCommand); return 0; } + +/** @} */ // End of HDMI CEC HAL Tests L1 File +/** @} */ // End of HDMI CEC HAL Tests +/** @} */ // End of HDMI CEC Module +/** @} */ // End of HPK \ No newline at end of file diff --git a/src/test_l2_hdmi_cec_source_driver.c b/src/test_l2_hdmi_cec_source_driver.c index 925fe2b..6ec6e2a 100644 --- a/src/test_l2_hdmi_cec_source_driver.c +++ b/src/test_l2_hdmi_cec_source_driver.c @@ -32,18 +32,19 @@ */ /** - * @addtogroup HDMI_CEC HDMICEC Source + * @addtogroup HDMI_CEC HDMI CEC Module * @{ * */ /** - * @addtogroup HDMI_CEC_HALTESTS HDMICEC Source HALTEST + * @defgroup HDMI_CEC_HALTESTS HDMI CEC HAL Tests * @{ + * */ /** - * @defgroup HDMI_CEC_HALTESTS_L1 HDMICEC Source HALTEST L2 File + * @defgroup HDMI_CEC_HALTESTS_L2_SOURCE HDMI CEC Source HALTEST L2 File for Source * @{ * @parblock * @@ -58,10 +59,11 @@ * * @endparblock */ - /** -* @file test_l2_hdmi_cec_source_driver.c -* @page hdmi_cec_driver Level 2 Tests + * @file test_l2_hdmi_cec_source_driver.c + * + */ +/** * * ## Module's Role * This module includes Level 2 functional tests (success and failure scenarios). @@ -85,17 +87,17 @@ static int gTestID = 1; /** * @brief This test validates the unavailability of logical address in HDMI CEC HAL * -* This test case is designed to validate the scenario when the logical address -* is unavailable in the HDMI CEC HAL. The test invokes the HdmiCecOpen function -* and checks if the returned status is HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE. -* If the status is not HDMI_CEC_IO_SUCCESS, it invokes the HdmiCecClose function +* This test case is designed to validate the scenario when the logical address +* is unavailable in the HDMI CEC HAL. The test invokes the HdmiCecOpen function +* and checks if the returned status is HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE. +* If the status is not HDMI_CEC_IO_SUCCESS, it invokes the HdmiCecClose function * and checks if the returned status is HDMI_CEC_IO_SUCCESS. * * **Test Group ID:** 02@n * **Test Case ID:** 001@n * * **Test Procedure:** -* Refer to UT specification documentation +* Refer to UT specification documentation * [hdmi_cec_source_hal_source_L2_Low-Level_TestSpecification.md](../docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md) */ @@ -143,13 +145,13 @@ int test_register_hdmicec_hal_source_l2_tests(void) } // List of test function names and strings - UT_add_test( pSuite, "l2_hdmi_cec_source_hal_ValidateLogicalAddressUnavailability_source", test_l2_hdmi_cec_source_hal_ValidateLogicalAddressUnavailability); + UT_add_test( pSuite, "L2_ValidateLogicalAddressUnavailability_source", test_l2_hdmi_cec_source_hal_ValidateLogicalAddressUnavailability); return 0; } -/** @} */ // End of HDMI CEC HAL Source Tests L2 File -/** @} */ // End of HDMI CEC HAL Source Tests -/** @} */ // End of HDMI CEC Source Module +/** @} */ // End of HDMI_CEC_HALTESTS_L2_SOURCE +/** @} */ // End of HDMI_CEC_HALTESTS +/** @} */ // End of HDMI_CEC Module /** @} */ // End of HPK From bb1160663c93fa8899442d13f4ab0f8386e7ebfd Mon Sep 17 00:00:00 2001 From: srinivasgtl <71806084+srinivasgtl@users.noreply.github.com> Date: Fri, 28 Jun 2024 11:44:34 +0100 Subject: [PATCH 46/48] gh #24 Update hdmi-cec-sink_High-Level_TestSpec.md documentation correction. --- docs/pages/hdmi-cec-sink_High-Level_TestSpec.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/hdmi-cec-sink_High-Level_TestSpec.md b/docs/pages/hdmi-cec-sink_High-Level_TestSpec.md index faeeb83..b3091e4 100644 --- a/docs/pages/hdmi-cec-sink_High-Level_TestSpec.md +++ b/docs/pages/hdmi-cec-sink_High-Level_TestSpec.md @@ -122,7 +122,7 @@ Managing the opcodes is the responsibility of the caller. The existing test case |S.No.|Test Functionality|Description| HAL APIs |L2|L3|Control plane requirements| |-----|------------------|-----------|----------|--|--|--------------------------| -| 6| [CEC HotPlug Functionality](#cec-hotplug-functionality)| Generate a Hotplug event by disconnecting the device connected to the HDMI port of the Sink Platform. Validating whether the CEC Transmission (use Polling command) works when the HDMI port is disconnected should result in ACK not being received while the TX still works as expected. | HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y | Control Panel to control the Hotplug activities | +| 6| CEC HotPlug Functionality| Generate a Hotplug event by disconnecting the device connected to the HDMI port of the Sink Platform. Validating whether the CEC Transmission (use Polling command) works when the HDMI port is disconnected should result in ACK not being received while the TX still works as expected. | HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y | Control Panel to control the Hotplug activities | | | | Check the behaviour when a device has been remove from the network which is not directly connected to the TV device. Send a CEC Tx command with acknowledgement using HAL Interface and check the behaviour. The Tx command should succeed, but the message should not be Acknowledged.| HdmiCecAddLogicalAddress, HdmiCecTx, HdmiCecRemoveLogicalAddress | NA | Y | Control Panel to control the external devices connected.| ### Emulator Requirements - CEC HotPlug Functionality From 3dd6e4363d6a2fdc2073ca018ee8f1336c5b15ca Mon Sep 17 00:00:00 2001 From: hari22yuva <56021398+hari22yuva@users.noreply.github.com> Date: Fri, 28 Jun 2024 12:15:19 +0100 Subject: [PATCH 47/48] Updated README.md --- README.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f1177d1..b7bed6a 100644 --- a/README.md +++ b/README.md @@ -9,24 +9,29 @@ ## Acronyms, Terms and Abbreviations -- `L1` - Functional Tests - `HAL`- Hardware Abstraction Layer +- `HDMI` - High Definition Multimedia Interface +- `CEC` - Consumer Electronics Control +- `L1` - Functional Tests +- `L2` - Functional Tests ## Description -This repository contains the Unit Test Suites (L1) for HDMI CEC `HAL`. +This repository contains the Unit Test Suites for HDMI CEC `HAL`. ## Reference Documents - |SNo|Document Name|Document Description|Document Link| |---|-------------|--------------------|-------------| -|1|`HAL` Specification Document|This document provides specific information on the APIs for which tests are written in this module|[hdmi-cec_halSpec.md](https://github.com/rdkcentral/rdk-halif-hdmi_cec/blob/main/docs/pages/hdmi-cec_halSpec.md "hdmi-cec_halSpec.md")| -|2|`L1` Tests |`L1` Test Case File for this module |[test_l1_hdmi_cec_driver.c](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/blob/main/src/test_l1_hdmi_cec_driver.c "test_l1_hdmi_cec_driver.c")| +|1|`HAL` Specification Document|This document provides specific information on the APIs for which tests are written in this module|[hdmi-cec_halSpec.md](https://github.com/rdkcentral/rdk-halif-hdmi_cec/blob/main/docs/pages/hdmi-cec_halSpec.md)| +|2|High Level Test Spec for sink device|High Level Test Specification Documentation for the `HDMI` `CEC` Sink device|[hdmi-cec-sink_High-Level_TestSpec.md](docs/pages/hdmi-cec-sink_High-Level_TestSpec.md )| +|3|`L2` Low Level Test Spec for sink device|`L2` Low Level Test Specification and Procedure Documentation for the `HDMI` `CEC` Sink device|[hdmi-cec-sink_L2_Low-Level_TestSpec.md](docs/pages/hdmi-cec-sink_L2_Low-Level_TestSpec.md)| +|4|High Level Test Spec for Source device|High Level Test Specification Documentation for the `HDMI` `CEC` Source device|[hdmi-cec-source_High-Level_TestSpec.md](docs/pages/hdmi-cec-source_High-Level_TestSpec.md)| +|5|`L2` Low Level Test Spec for Source device|`L2` Low Level Test Specification and Procedure Documentation for the `HDMI` `CEC` Source device|[hdmi-cec-source_L2_Low-Level_TestSpec.md](docs/pages/hdmi-cec-source_L2_Low-Level_TestSpec.md)| ## Notes - All APIs need to be implemented in this current version. If any API is not supported, please add stub implementation with return type HDMI_CEC_IO_OPERATION_NOT_SUPPORTED for the same. - Building against the actual library may introduce SOC dependencies. Hence, a template SKELETON library is created without SOC dependencies. On the real platform (target), it can be mounted, copied and bound with the actual library. -- When running the binary, remember to include a profile file as an argument for designated test cases. The following example illustrates this: `./hal_test -p hdmiCECExtendedEnumsNotSupported.yaml` -- Profiles file available in [profile yaml file](./profiles/hdmiCECExtendedEnumsNotSupported.yaml) \ No newline at end of file +- When running the binary, remember to include a profile file as an argument for designated test cases. The following example illustrates this: `./hal_test -p sink_hdmiCEC.yml` +- Profiles file available in [profile yaml file](./profiles/) From 2e558248b9d89939deb29883d518a3176d48b9bd Mon Sep 17 00:00:00 2001 From: hari22yuva <56021398+hari22yuva@users.noreply.github.com> Date: Fri, 28 Jun 2024 12:17:43 +0100 Subject: [PATCH 48/48] Bumped CHANGELOG.md - 1.2.0 --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 019d4ac..4415d2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,19 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [1.2.0](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/compare/1.1.0...1.2.0) + +- gh #24 hdmicec source & sink l2 tests [`#28`](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/pull/28) +- Feature/issues15 emulator startup [`#21`](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/pull/21) +- Update [`#19`](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/pull/19) +- Update with Sink tests [`9655adf`](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/commit/9655adfc5e492fdeff797b7f0dad0bdd1ad28d91) +- Update based on review discussion [`ab6f668`](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/commit/ab6f66870bbb3c5fea99a8c429ca74b37ace6b95) +- Update with generated L2 code and specification document [`769045a`](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/commit/769045a5b17736013d7950f6a4fa746b1e676433) + #### [1.1.0](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/compare/1.0.4...1.1.0) +> 5 June 2024 + - gh #11 hdmi_cec: Test Profile: Adding MACRO ENABLE_ENHANCED_ERROR_CODE to enalbe/disable the enhanced error code tests [`#12`](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/pull/12) - Capture the YAML Template and design for CEC Emulator [`#8`](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/pull/8) - Create hdmi_cec_emulator_design.md [`84741c3`](https://github.com/rdkcentral/rdk-halif-test-hdmi_cec/commit/84741c312dfc3b9ff96ec79ad1a93e2fd1e2565a)