/*
Copyright (c) 2012, Broadcom Europe Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* CEC service host API,
* See vc_cec.h and vc_cecservice_defs.h for related constants
*/
#ifndef _VC_CECSERVICE_H_
#define _VC_CECSERVICE_H_
#include "vcinclude/common.h"
#include "interface/vcos/vcos.h"
#include "interface/vchi/vchi.h"
#include "interface/vmcs_host/vc_cecservice_defs.h"
#include "interface/vmcs_host/vc_cec.h"
/**
* \file
* This API defines the controls for CEC. HDMI must be powered on before
* CEC is available (subject to CEC support in TV).
*
* In general, a zero return value indicates success; a negative return
* value indicates error in VCHI layer; a positive return value indicates
* alternative return value from the server
*/
/**
* Callback function for host side notification
* This is the SAME as the callback function type defined in vc_cec.h
* Host applications register a single callback for all CEC related notifications.
* See vc_cec.h for meanings of all parameters
*
* @param callback_data is the context passed in by user in vc_cec_register_callback
*
* @param reason bits 15-0 is VC_CEC_NOTIFY_T in vc_cec.h;
* bits 23-16 is the valid length of message in param1 to param4 (LSB of param1 is the byte0, MSB of param4 is byte15), little endian
* bits 31-24 is the return code (if any)
*
* @param param1 is the first parameter
*
* @param param2 is the second parameter
*
* @param param3 is the third parameter
*
* @param param4 is the fourth parameter
*
* @return void
*/
typedef void (*CECSERVICE_CALLBACK_T)(void *callback_data, uint32_t reason, uint32_t param1, uint32_t param2, uint32_t param3, uint32_t param4);
//API at application start time
/**
* Call vc_vchi_cec_init to initialise the CEC service for use.
*
* @param initialise_instance is the VCHI instance
* @param connections are array of pointers to VCHI connections
* @param num_connections is the number of connections in array
* @return void
**********************************************************/
VCHPRE_ void vc_vchi_cec_init(VCHI_INSTANCE_T initialise_instance, VCHI_CONNECTION_T **connections, uint32_t num_connections );
/**
* Call vc_vchi_cec_stop to stop host side CEC service.
*
* @param none
* @return void
**********************************************************/
VCHPRE_ void vc_vchi_cec_stop( void );
/**
* Host applications use vc_cec_register_callaback to register
* callback to handle all CEC notifications. If more than one applications
* need to use CEC, there should be ONE central application which acts on
* behalf of all clients and handles all communications with CEC services.
*
* @param callback function
* @param context to be passed when function is called
* @return void
***********************************************************/
VCHPRE_ void vc_cec_register_callback(CECSERVICE_CALLBACK_T callback, void *callback_data);
//Service API
/**
* Use vc_cec_register_command to register an opcode to
* to forwarded to the host application. By default
* is always forwarded. Once an opcode is registered, it is left to
* the host application to reply to a CEC message (where appropriate).
* It is recommended NOT to register the following commands as they
* are replied to automatically by CEC middleware:
* , , ,
* , ,