/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * 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.
 *
 *****************************************************************************/

/*-----------------------------------------------------------------------------
 *
 * $Author: dtvbm11 $
 * $Date: 2015/11/10 $
 * $RCSfile: cec_weltrend_if.h,v $
 * $Revision: #1 $
 *
 *---------------------------------------------------------------------------*/

/** @file cec_weltrend_if.h
 *  Declare CEC Weltrend export function.
 */

#ifndef CEC_WELTREND_H
#define CEC_WELTREND_H

//---------------------------------------------------------------------------
// Include files
//---------------------------------------------------------------------------

#ifdef SUPPORT_WELTREND_UP

//---------------------------------------------------------------------------
// Type definitions
//---------------------------------------------------------------------------
typedef enum
{
    I2C_READ_ERROR,
    I2C_WRITE_ERROR,
    ALL_ERROR = 0xff
}WELTREND_ERR_STATUS;

typedef enum
{
    WT_LED_1,
    WT_LED_2
}WT_LED_IDX;

typedef enum
{
    WAKEUP = 41,
    LED1 = 24,
    LED2 = 25,
    POWER_DOWN = 35,
    CEC = 10,
    INT_CEC = 26,
    IR = 9,
    KEY = 19
}WT_GPIO_CONTROL_IDX;

typedef enum
{
    PA_OE = 0x40,
    PB_OE,
    PC_OE,
    PD_OE,
    PE_OE,
    PA_DAT,
    PB_DAT,
    PC_DAT,
    PD_DAT,
    PE_DAT,
    PA_PHN,
    PB_PHN,
    PC_PHN,
    PD_PHN,
    PE_PHN,
    PC_ADC
}WT_GPIO_REGISTER;

typedef enum
{
    WT_WAKEUP_COLDSTART = 0x01,
    WT_WAKEUP_IR = 0x02,
    WT_WAKEUP_LKB = 0x04,
    WT_WAKEUP_CEC = 0x08,
    WT_WAKEUP_TIMER = 0x10
} WT_WAKEUP_REASION;

typedef enum
{
    WT_STANDBY_NORMAL,
    WT_STANDBY_PROTECTION
} WT_STANDBY_REASON;

typedef enum
{
    WT_CONFIRM_OFF,
    WT_CONFIRM_ON
} WT_CONFIRMATION;

//---------------------------------------------------------------------------
// Inter-file functions
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
// Public functions
//---------------------------------------------------------------------------
EXTERN void vWTCECOnOff(UINT8 u1Onoff);
EXTERN UINT8 u1WTGetFWVersion(void);
EXTERN void vWTSetPhyAddr(void);
EXTERN void vWTSetVendorID(UINT8 *data);
EXTERN void vWTSetCECVersion(UINT8 *data);
EXTERN void vWTSetMenuLang(UINT8 *data);
EXTERN UINT8 u1WTGetWakeupReason(void);
EXTERN void vWTSetStandbyReason(UINT8 reason);
EXTERN void vWTSetLatestErrCode(UINT8 u1code);
EXTERN void vWTSetErrorBuffer(UINT8 *errcode);
EXTERN UINT8 u1WTGetClrErrBuffFlag(void);
EXTERN void vWTSetConfirmation(UINT8 flag);
EXTERN void vWTResetWatchdog(void);
EXTERN void vWTSetWakeTimer(UINT8 *time);
EXTERN void vWTWakeTimerOnOff(UINT8 onoff);
EXTERN void vWTNotifyPendingData(void);
EXTERN void vWTDebugMesg(void);

#endif // #ifdef SUPPORT_WELTREND_UP
#endif // CEC_WELTREND_H
