Files | |
file | hdmi_cec_driver.h |
Typedefs | |
typedef void(* | HdmiCecRxCallback_t) (int handle, void *callbackData, unsigned char *buf, int len) |
Callback function triggered when a complete CEC packet is received. | |
typedef void(* | HdmiCecTxCallback_t) (int handle, void *callbackData, int result) |
Callback function triggered to report the status of the latest transmit message. | |
Functions | |
int | HdmiCecOpen (int *handle) |
Initializes the HDMI CEC HAL. | |
int | HdmiCecClose (int handle) |
Closes an instance of HDMI CEC HAL. | |
int | HdmiCecSetLogicalAddress (int handle, int *logicalAddresses, int num) |
This API is DEPRECATED due to possible race conditions competing for a logical address. | |
void | HdmiCecGetPhysicalAddress (int handle, unsigned int *physicalAddress) |
Gets the Physical Address obtained by the module. | |
int | HdmiCecAddLogicalAddress (int handle, int logicalAddresses) |
Adds one Logical Addresses to be used by host device. | |
int | HdmiCecRemoveLogicalAddress (int handle, int logicalAddresses) |
Clears the Logical Addresses claimed by the host device. | |
int | HdmiCecGetLogicalAddress (int handle, int devType, int *logicalAddress) |
Gets the Logical Address obtained by the module. | |
int | HdmiCecSetRxCallback (int handle, HdmiCecRxCallback_t cbfunc, void *data) |
Sets CEC packet receive callback. | |
int | HdmiCecSetTxCallback (int handle, HdmiCecTxCallback_t cbfunc, void *data) |
Sets CEC packet transmit callback. | |
int | HdmiCecTx (int handle, const unsigned char *buf, int len, int *result) |
Synchronous transmit call. | |
int | HdmiCecTxAsync (int handle, const unsigned char *buf, int len) |
Writes CEC packet onto bus asynchronously. | |
typedef void(* HdmiCecRxCallback_t) (int handle, void *callbackData, unsigned char *buf, int len) |
Callback function triggered when a complete CEC packet is received.
Upon each callback, only 1 complete packet should be contained in the buffer.
[in] | handle | - The handle used by application to uniquely identify the HAL instance. Non zero value |
[in] | callbackData | - Callback data for the receive callback |
[in] | buf | - Buffer passed in receive callback |
[in] | len | - Length of buffer passed in receive callback |
typedef void(* HdmiCecTxCallback_t) (int handle, void *callbackData, int result) |
Callback function triggered to report the status of the latest transmit message.
[in] | handle | - The handle used by application to uniquely identify the HAL instance. Non zero value |
[in] | callbackData | - Callback data for the transmit callback |
[in] | result | - Async transmit result from the platform implementation |
anonymous enum |
int HdmiCecAddLogicalAddress | ( | int | handle, |
int | logicalAddresses ) |
Adds one Logical Addresses to be used by host device.
This function will block until the intended logical address is secured by the module.
HAL will forward all received messages with destination being the acquired logical address.
HAL should ACK all POLL messages destined to this logical address.
This API is only applicable for sink devices. Supported logical address value must be 0x0.
Invoking this API in source device must return HDMI_CEC_IO_INVALID_ARGUMENT
In HAL implementation, this API would trigger HAL sending a POLL CEC packet to the CEC Bus:
Packet::HeaderBlock::Initiator = Requested LogicalAddress
Packet::HeaderBlock::Destination = Requested LogicalAddress
Packet::DataBlock = Empty
[in] | handle | - The handle returned from the HdmiCecOpen() function. Non zero value |
[in] | logicalAddresses | - The logical address to be acquired |
HDMI_CEC_IO_SUCCESS | - POLL message is sent successfully and not ACK'd by any device on the bus |
HDMI_CEC_IO_INVALID_ARGUMENT | - Parameter passed to this function is invalid i.e. be if any logical address other than 0x0 is given as argument |
HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE | - POLL message is sent and ACK'd by a device on the bus |
HDMI_CEC_IO_SENT_FAILED | - POLL message send failed. |
int HdmiCecClose | ( | int | handle | ) |
Closes an instance of HDMI CEC HAL.
This function will uninitialise the module.
Close will clear up registered logical addresses.
Subsequent calls to this API will return HDMI_CEC_IO_SUCCESS.
[in] | handle | - The handle returned from the HdmiCecOpen(). Non zero value |
HDMI_CEC_IO_SUCCESS | - Success |
int HdmiCecGetLogicalAddress | ( | int | handle, |
int | devType, | ||
int * | logicalAddress ) |
Gets the Logical Address obtained by the module.
This function gets the logical address for the specified device type.
For sink devices, if logical address is not added or removed, the logical address returned will be 0x0F. For source devices, logical address returned must be in between 0x00 and 0x0F, excluding both the values.
[in] | handle | - The handle returned from the HdmiCecOpen(). Non zero value |
[in] | devType | - device type (tuner, record, playback etc.). |
[out] | logicalAddress | - The logical address acquired |
HDMI_CEC_IO_SUCCESS | - Success |
HDMI_CEC_IO_INVALID_ARGUMENT | - Parameter passed to this function is invalid |
void HdmiCecGetPhysicalAddress | ( | int | handle, |
unsigned int * | physicalAddress ) |
Gets the Physical Address obtained by the module.
This function gets the Physical address for the specified device type.
[in] | handle | - The handle returned from the HdmiCecOpen(). Non zero value |
[out] | physicalAddress | - Physical address acquired Max possible physical address is 4.4.4.4 and respective integer value is (((0x04 &0xF0 ) << 20)|( (0x04 &0x0F ) << 16) |((0x04 & 0xF0) << 4) | (0x04 & 0x0F)) Min value for physicalAddress is 0 |
int HdmiCecOpen | ( | int * | handle | ) |
Initializes the HDMI CEC HAL.
This function is required to be called before the other APIs in this module.
Subsequent calls to this API will return HDMI_CEC_IO_SUCCESS.
[out] | handle | - The handle used by application to uniquely identify the HAL instance |
HDMI_CEC_IO_SUCCESS | - Success |
HDMI_CEC_IO_INVALID_ARGUMENT | - Parameter passed to this function is invalid |
HDMI_CEC_IO_LOGICALADDRESS_UNAVAILABLE | - Logical address is not available for source devices. |
int HdmiCecRemoveLogicalAddress | ( | int | handle, |
int | logicalAddresses ) |
Clears the Logical Addresses claimed by the host device.
This function releases the previously acquired logical address.
Once released, the module must not ACK any POLL message destined to the released address.
Subsequent calls to this API will return HDMI_CEC_IO_SUCCESS. This API is only applicable for sink devices. Invoking this API in source device must return HDMI_CEC_IO_INVALID_ARGUMENT
[in] | handle | - The handle returned from the HdmiCecOpen(). Non zero value |
[in] | logicalAddresses | - The logicalAddresses to be released |
HDMI_CEC_IO_SUCCESS | - Success |
HDMI_CEC_IO_INVALID_ARGUMENT | - Parameter passed to this function is invalid - i.e. if any logical address other than 0x0 is given as argument |
int HdmiCecSetLogicalAddress | ( | int | handle, |
int * | logicalAddresses, | ||
int | num ) |
This API is DEPRECATED due to possible race conditions competing for a logical address.
Set the Logical Addresses claimed by host device. This function sets multiple logical addresses used by the host. The host has claimed these logical address through the Discovery process. Once set, the host shall receive all CEC packets destined to these addresses.
Once the driver is opened, the host shall receive all broadcast messages regardless the Logical addresses.
when there is no logical address set, the host shall only receive broadcast messages.
[in] | handle | - returned from the HdmiCecOpen() function. |
[in] | logicalAddresses | - set or replace addresses claimed by host. A null value clears the current list. |
[in] | num | - number of logical addresses. If any logical address in the list cannot be set, none of them should be set upon return. Success return indicates that all addresses in the list are set. |
HDMI_CEC_IO_SUCCESS | - Success |
int HdmiCecSetRxCallback | ( | int | handle, |
HdmiCecRxCallback_t | cbfunc, | ||
void * | data ) |
Sets CEC packet receive callback.
This function sets the callback function to be invoked for each packet arrival
The packet contained in the buffer will follow this format (ref <HDMI Specification 1-4> Section <CEC 6.1>) :
complete packet = header block + data block
header block = destination logical address (4-bit) + source address (4-bit)
data block = opcode block (8-bit) + operand block (N-bytes)
When receiving, the returned buffer should not contain EOM and ACK bits. HAL internal logic.
HAL implementation should remove the EOM and ACK bits in the returned buffer
When transmitting, it is HAL's responsibility to insert EOM bit and ACK bit for each header or data block.
When HdmiCecSetRxCallback() is called, it replaces the previous set cbfunc and data values. Setting a value of (cbfunc=null) disables the callback.
This function will block if callback invocation is in progress.
[in] | handle | - The handle returned from the HdmiCecOpen(() function. Non zero value |
[in] | cbfunc | - Function pointer to be invoked when a complete packet is received. Please refer HdmiCecRxCallback_t |
[in] | data | - Callback data |
HDMI_CEC_IO_SUCCESS | - Success |
HDMI_CEC_IO_INVALID_ARGUMENT | - An invalid argument has been passed |
int HdmiCecSetTxCallback | ( | int | handle, |
HdmiCecTxCallback_t | cbfunc, | ||
void * | data ) |
Sets CEC packet transmit callback.
This function sets a callback which will be invoked once the async transmit result is available. This is only necessary if the caller chooses to transmit the packet asynchronously.
This function will block if callback invocation is in progress.
[in] | handle | - The handle returned from the HdmiCecOpen(). Non zero value. |
[in] | cbfunc | - Function pointer to be invoked when a complete packet is transmitted. Please refer HdmiCecTxCallback_t |
[in] | data | - Callback data |
HDMI_CEC_IO_SUCCESS | - Success |
HDMI_CEC_IO_INVALID_ARGUMENT | - An invalid argument has been passed |
int HdmiCecTx | ( | int | handle, |
const unsigned char * | buf, | ||
int | len, | ||
int * | result ) |
Synchronous transmit call.
This function writes a complete CEC packet onto the bus and waits for ACK.
The packet contained in the buffer will follow the format detailed in HdmiCecSetRxCallback_t(). (ref <HDMI Specification 1-4> Section <CEC 6.1>)
[in] | handle | - The handle returned from the HdmiCecOpen() function. Non zero value |
[in] | buf | - The buffer contains a complete CEC packet to send. |
[in] | len | - Number of bytes in the packet. |
[out] | result | - send status buffer. Possible results are SENT_AND_ACKD, SENT_BUT_NOT_ACKD (e.g. no follower at the destination), SENT_FAILED (e.g. collision). |
HDMI_CEC_IO_SUCCESS | - Success |
HDMI_CEC_IO_INVALID_ARGUMENT | - Parameter passed to this function is invalid |
HDMI_CEC_IO_SENT_AND_ACKD | - Cec message is send and acknowledged. |
HDMI_CEC_IO_SENT_BUT_NOT_ACKD | - Message sent but not acknowledged by the receiver. Host device is trying to send an invalid logical address |
HDMI_CEC_IO_SENT_FAILED | - Send message failed |
int HdmiCecTxAsync | ( | int | handle, |
const unsigned char * | buf, | ||
int | len ) |
Writes CEC packet onto bus asynchronously.
This function writes a complete CEC packet onto the bus but does not wait for ACK. The result will be reported via HdmiCecRxCallback_t()
[in] | handle | - The handle returned from the HdmiCecOpen() function. Non zero value |
[in] | buf | - The buffer contains a complete CEC packet to send |
[in] | len | - Number of bytes in the packet |
HDMI_CEC_IO_SUCCESS | - Success |
HDMI_CEC_IO_INVALID_ARGUMENT | - Parameter passed to this function is invalid |