RDK Documentation (Open Sourced RDK Components)
RDK HDMI-CEC

Description

Application API Specification
In general, the RDK CEC Library offers three categories of Application APIs:
HDMI-CEC Connection
The Connection APIs allows application to transmit and receive raw data bytes (a.k.a. CEC Frame) that conforms to the HDMI-CEC specification. This is the only interface that the application can use to access CEC Bus.
HDMI-CEC Message and Frame Constructs
The Messages APIs allows application to encode high-level message constructs into CECFrame raw bytes, or decode CECFrame raw bytes into high-level message constructs.
Host Interface
The Host interface allows libCEC implementation to interact with the host environment Such interaction includes monitoring of the Power State change, the HDMI HotPlug events, or APIs to change the Host States. This allows the CEC stack to run in any devices that implements the Host Interface.
Driver Component
The Driver component access the HDMI-CEC SoC Driver via the CEC HAL API. The Vendors are responsible in delivering a SoC Driver that conforms to the HAL API (see hdmi_cec_driver.h"

Modules

 HDMI-CEC Applications
 The relation between Application, Connection and CEC-Bus is described in the figure.
 
 HDMI-CEC BUS
 
 HDMI-CEC CCEC
 
 HDMI-CEC Connection
 The connection API allows the application to access CEC Bus. A connection is a tap into the CEC bus. The application can use a connection to send raw bytes (in form of CECFrame) onto CEC bus or receive raw bytes from it.

Each connection must have one and only one logical address. When application sends a CEC frame onto the connection, the connection's logical address will be used as the source address. On such connection, the application can only receive broadcast messages or unicast messages destined to the logical address of the connection.

The application can open multiple connections, with one connection dedicated to each Role of the application. For example, a Set-top Box of three roles (Record, Playback, and Tuner) can open three connections, with each connection used to send/receive messages of the relevant role. Such Role-Connection mapping is transparent to the devices on the CEC bus. The external devices will not be able to tell if the CEC messages come from connections of a same or different physical device.

All incoming CEEFrame arrived at the Physical CEC bus will be dispatched to all opened connections, based on the filtering criteria of the connection. By default, a connection with a given logical address filters out messages destined to other logical addresses.

When a connection is opened without a given logical address, this connection will pick up all messages destined to the host device, regardless what roles the device has. This is useful if the application wants to sniff all available CEC packets from the bus.
 
 HDMI-CEC Daemon
 
 HDMI-CEC Driver APIs
 The Driver component access the HDMI-CEC SoC Driver via the CEC HAL API. Vendors are responsible in delivering a SoC Driver that conforms to the HAL API (see hdmi_cec_driver.h)
 
 HDMI-CEC Host
 
 HDMI-CEC Messages and Frames
 The CECFrame is a byte buffer that provides access to raw CEC bytes. CECFrame is guaranteed to be a complete CEC Message that has the necessary data blocks:

.
 
 Multi-App Support
 Often , the application functionality (Record, Tune and Playback) is distributed across multiple components. In order for any component to have equivalent access to the HDMI-CEC bus, the library offers Multi-App support via IARM-Bus. This support is enabled by default, and can be disabled if desired.

In essence, there is only one physical CEC bus on asystem. However, with the help of Connection, Logical CEC-Bus, and IARM-Bus, the CEC library can converge the CEC traffic from different Connections and Logical Buses before forwarding them to the single physical bus. This is illustrated by the diagram below.