/* 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.
 *
 *****************************************************************************/

/*----------------------------------------------------------------------------*/
/*! @file c_pcl.h 
 *  $RCSfile: $
 *  $Revision: #1 $
 *  $Date: 2015/11/10 $
 *  $Author: dtvbm11 $
 *  
 *  @par Description:
 *         This header file contains Power Control Library related 
 *         definitions, which are exported to applications.
 */
/*----------------------------------------------------------------------------*/

#ifndef _C_PCL_H_
#define _C_PCL_H_

/*-----------------------------------------------------------------------------
                    include files
 ----------------------------------------------------------------------------*/
#include "u_handle.h"
#include "u_pcl.h"

/*----------------------------------------------------------------------------*/
/*! @addtogroup groupMW_PCL
 *  @{ 
 */
/*----------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------
                    functions declarations
 ----------------------------------------------------------------------------*/
/*------------------------------------------------------------------*/
/*! @brief  This API returns the wake-up capability info that the system  can support
 *               and clients can control.
 *
 *  @param [in] None.
 *
 *  @param [out] pui4_wakeup_cap       - References the bit-mask of all wake-up
 *                                       capabilities that the system can support.
 *  @param [out] pui4_wakeup_ctrl_cap  - References the bit-mask of the wake-up
 *                                       capabilities that clients can control.
 *  @return Return the error code.
 *  @retval  PCLR_OK                   - The routine was successful.
 *  @retval PCLR_NOT_INIT              - The Power Control Library is not initialized.
 *  @retval PCLR_DEV_GET_FAILED        - Device get operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_wakeup_capability(UINT32* pui4_wakeup_cap,
                                         UINT32* pui4_wakeup_ctrl_cap);
 
/*------------------------------------------------------------------*/
/*! @brief  This API gets the current wake-up setup.
 *
 *  @param [in] None.
 *
 *  @param [out]  pui4_wakeup_setup -  References the wake-up setup in bit-mask
 *                                                           fashion.
 *
 *  @return Return the error code.
 *  @retval  PCLR_OK                - The routine was successful.
 *  @retval  PCLR_NOT_INIT          - The Power Control Library is not  initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT    - The hardware is not supported.
 *  @retval  PCLR_DEV_GET_FAILED    - Device get operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_wakeup_setup(UINT32* pui4_wakeup_setup);

/*------------------------------------------------------------------*/
/*! @brief  This API sets the wake-up setup.  Note that PCL_WAKE_UP_REASON_IRRC
 *               and PCL_WAKE_UP_REASON_FP  are always set and cannot be disabled 
 *               by clients.
 *
 *  @param [in] ui4_wakeup_setup    - Contains the wake-up setup in bit-mask
 *                                                      fashion.
 *
 *  @param [out] None.
 *
 *  @return Return the error code.
 *  @retval    PCLR_OK                         - The routine was successful.
 *  @retval    PCLR_NOT_INIT               - The Power Control Library is not  initialized.
 *  @retval   PCLR_HW_NOT_SUPPORT   - The hardware is not supported.
 *  @retval   PCLR_DEV_GET_FAILED     - Device get operation is failed.
 *  @retval   PCLR_DEV_SET_FAILED     - Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_wakeup_setup(UINT32 ui4_wakeup_setup);

/*------------------------------------------------------------------*/
/*! @brief  This API gets the wake-up time configured by  x_pcl_set_wakeup_time()
 *
 *  @param [in] None.
 *
 *  @param [out]  pt_time   -  References the wake-up time (UTC time count as
 *                                         number of seconds since 00:00:00Z January 1, 1970).
 *                                         If the wake-up time was never set, NULL_TIME will
 *                                         be returned.
 *
 *  @return Return the error code.
 *  @retval   PCLR_OK                           - The routine was successful.
 *  @retval   PCLR_NOT_INIT                 - The Power Control Library is not  initialized.
 *  @retval   PCLR_INV_ARG                  - One or more of the arguments contain
 *                                                            invalid data.
 *  @retval   PCLR_ERROR                     -  A Power Control Library error occurred.
 *  @retval   PCLR_HANDLE_LIB_ERROR -  A handle library error occurred.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_wakeup_time(TIME_T* pt_time);

/*------------------------------------------------------------------*/
/*! @brief  This API sets a wake-up time.
 *
 *  @param [in]  t_time   - Contains the wake-up time (UTC time count as
 *                                     number of seconds since 00:00:00Z January 1, 1970).
 *                                     If a client would like to cancel the wake-up time,
 *                                     it simply calls this API with ui4_time set to NULL_TIME.
 *
 *  @param [out] None.
 *
 *  @return  Return the error code.
 *  @retval   PCLR_OK                          - The routine was successful.
 *  @retval   PCLR_NOT_INIT                - The Power Control Library is not
 *                                                           initialized.
 *  @retval   PCLR_INV_ARG                 - One or more of the arguments contain
 *                                                           invalid data.
 *  @retval   PCLR_MEM_ALLOC_FAILED - Memory allocation is failed.
 *  @retval   PCLR_HANDLE_LIB_ERROR - A handle library error occurred.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_wakeup_time(TIME_T t_time);

/*------------------------------------------------------------------*/
/*! @brief  This API gets the status of miscellaneous controls.
 *
 *  @param [in] None.
 *
 *  @param [out]  pui4_ctrl  - References the bit-mask of miscellaneous controls.
 *
 *  @return Return the error code.
 *  @retval   PCLR_OK                       - The routine was successful.
 *  @retval   PCLR_NOT_INIT             - The Power Control Library is not initialized.
 *  @retval   PCLR_INV_ARG              - One or more of the arguments contain
 *                                                        invalid data.
 *  @retval   PCLR_DEV_GET_FAILED  - Device get operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_misc_ctrl(UINT32* pui4_ctrl);

/*------------------------------------------------------------------*/
/*! @brief  This API sets the miscellaneous controls.
 *
 *  @param [in] ui4_ctrl           - Contains the bit-mask of miscellaneous controls.
 *
 *  @param [out] None.
 *
 *  @return Return the error code.
 *  @retval    PCLR_OK            -  The routine was successful.
 *  @retval    PCLR_NOT_INIT   - The Power Control Library is not initialized.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_misc_ctrl(UINT32 ui4_ctrl);

/*------------------------------------------------------------------*/
/*! @brief This API gets the current power-down time.
 *
 *  @param [in] None.
 *
 *  @param [out]  pt_time    -  References the power-down time (UTC time count as
 *                                          number of seconds since 00:00:00Z January 1, 1970).
 *                                          If the wake-up time was never set, NULL_TIME will  be 
 *                                          returned.
 *
 *
 *  @return Return the error code.
 *  @retval    PCLR_OK            - The routine was successful.
 *  @retval    PCLR_NOT_INIT  - The Power Control Library is not  initialized.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_power_down_time(TIME_T* pt_time);

/*------------------------------------------------------------------*/
/*! @brief This API sets the power-down time. If the time is already passed, this API
 *              will reject with PCLR_INV_ARG.
 *
 *  @param [in]    t_time      -  Contains the power-down time (UTC time count as
 *                                           number of seconds since 00:00:00Z January 1, 1970).
 *                                           If a client would like to cancel the power-down
 *                                           time, it simply calls this API with ui4_time set
 *                                           to NULL_TIME.
 *
 *  @param [out] None.
 *
 *  @return Return the error code.
 *  @retval  PCLR_OK                  - The routine was successful.
 *  @retval  PCLR_NOT_INIT        - The Power Control Library is not  initialized.
 *  @retval  PCLR_INV_ARG         - One or more of the arguments contain
 *                                                  invalid data.
 *  @retval  PCLR_TIMER_ERROR  - A timer error occurred.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_power_down_time(TIME_T t_time);  

/*------------------------------------------------------------------*/
/*! @brief This API gets the reason of current wake-up.
 *
 *  @param [in] None.
 *
 *  @param [out] pe_wakeup_reason    - References the wake-up reason.
 *                       pv_data                    - References the additional information of
 *                                                         wakeup reason.
 *
 *  @return Return the error code.
 *  @retval  PCLR_OK                        - The routine was successful.
 *  @retval  PCLR_NOT_INIT              - The Power Control Library is not initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT - The hardware is not supported.
 *  @retval  PCLR_DEV_GET_FAILED   - Device get operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_wakeup_reason(PCL_WAKE_UP_REASON_T* pe_wakeup_reason,
                                     VOID*                 pv_data);

/*------------------------------------------------------------------*/
/*! @brief  This API sets the reason of current wake-up.
 *
 *  @param [in]  e_wakeup_reason  - Contains the wake-up reason.
 *                      pv_data                -  References the additional information of
 *                                                      wakeup reason.
 *
 *  @param [out] None.
 *
 *  @return Return the error code.
 *  @retval  PCLR_OK                         - The routine was successful.
 *  @retval  PCLR_NOT_INIT               - The Power Control Library is not  initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT - The hardware is not supported.
 *  @retval  PCLR_SET_DEV_FAILED    - Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_wakeup_reason(PCL_WAKE_UP_REASON_T e_wakeup_reason,
                                     VOID*                pv_data);

/*------------------------------------------------------------------*/
/*! @brief  This API gets the Power Control driver miscellaneous status.
 *
 *  @param [in] None.
 *
 *  @param [out]  pui4_status   - References the bit-mask of miscellaneous status.
 *
 *  @return Return the error code.
 *  @retval   PCLR_OK                         - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_GET_FAILED    - Device get operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_misc_status(UINT32* pui4_status);

/*------------------------------------------------------------------*/
/*! @brief This API gets the power-down reason.
 *
 *  @param [in] None.
 *
 *  @param [out]  pe_power_down_reason  - References the power-down reason.
 *  @param [out]  pv_data                         - References the additional information of
 *                                                               power-down reason.
 *
 *
 *  @return Return the error code.
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not  initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED     - Device set operation is failed.-
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_power_down_reason(PCL_POWER_DOWN_REASON_T* pe_power_down_reason,
                                         VOID*                    pv_data);
                                         
/*------------------------------------------------------------------*/
/*! @brief This API sets the power-down reason.
 *
 *  @param [in]  e_power_down_reason   - Contains the power-down reason.
 *  @param [in]  pv_data               - References the additional information of
 *                                       wakeup reason. 
 *
 *  @param [out] None.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not  initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED    -  Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_power_down_reason(PCL_POWER_DOWN_REASON_T e_power_down_reason,
                                         VOID*                   pv_data);

/*------------------------------------------------------------------*/
/*! @brief  This API sets a wake-up time into driver if available and then  turns
 *               the system into power-down mode.
 *
 *  @param [in] VOID.
 *
 *  @param [out] None.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED     - Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_power_down(VOID);
extern INT32 c_pcl_set_request_suspend(VOID);
extern INT32 c_pcl_set_request_resume(VOID);

/*------------------------------------------------------------------*/
/*! @brief  This API gets the system power state.
 *
 *  @param [in]  None.
 *
 *  @param [out] pe_pwr_state_ctrl     - Contains power state setting.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not  initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED     - Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_power_state(PCL_PWR_STATE_CTRL_T* pe_pwr_state_ctrl);

/*------------------------------------------------------------------*/
/*! @brief  This API changes the system power state.
 *
 *  @param [in]  e_pwr_state_ctrl      - Contains power state setting.
 *
 *  @param [out] None.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not  initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED     - Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_power_state(PCL_PWR_STATE_CTRL_T e_pwr_state_ctrl);

/*------------------------------------------------------------------*/
/*! @brief  This API reboots the system.
 *
 *  @param [in] None.
 *
 *  @param [out] None.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED     - Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_reboot(VOID);  

/*------------------------------------------------------------------*/
/*! @brief  This API gets the status of specific GPIO pin (for either input or output mode).
 *
 *  @param [in]  ui4_gpio_id         - Contains the GPIO ID.
 *  @param [in]  e_gpio_mode      - Contains the GPIO mode.
 *
 *  @param [out] pe_gpio_status   - References the GPIO status.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_GET_FAILED    - Device get operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_gpio(UINT32             ui4_gpio_id,
                            PCL_GPIO_MODE_T    e_gpio_mode,
                            PCL_GPIO_STATUS_T* pe_gpio_status);

/*------------------------------------------------------------------*/
/*! @brief This API changes the status of specific GPIO pin output (output mode only).
 *
 *  @param [in] ui4_gpio_id     - Contains the GPIO ID.
 *  @param [in] e_gpio_status  -Contains the GPIO status.
 *
 *  @param [out] None.
 *
 *  @return
 *  @retval  PCLR_OK                         - The routine was successful.
 *  @retval  PCLR_NOT_INIT               - The Power Control Library is not initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT - The hardware is not supported.
 *  @retval  PCLR_DEV_GET_FAILED   -  Device get operation is failed.
 *  @retval  PCLR_DEV_SET_FAILED   -  Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_gpio(UINT32            ui4_gpio_id,
                            PCL_GPIO_STATUS_T e_gpio_status);

/*------------------------------------------------------------------*/
/*! @brief  This API gets GPIO/OPCTRL monitoring control.
 *
 *  @param [in]
 *
 *  @param [out]pt_gpio_monitor_ctrl  - References GPIO monitoring control info.
 *                                                    [55:0] => GPIO 0~55 monitoring control.
 *                                                    [63:56] => OPCTRL 0~7 monitoring control.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED     - Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_gpio_monitor_ctrl(PCL_GPIO_MONITOR_CTRL_T* pt_gpio_monitor_ctrl);

/*------------------------------------------------------------------*/
/*! @brief  This API sets GPIO/OPCTRL monitoring control.
 *
 *  @param [in]  pt_gpio_monitor_ctrl  - References GPIO monitoring control info.
 *                                                        [55:0] => GPIO 0~55 monitoring control.
 *                                                        [63:56] => OPCTRL 0~7 monitoring control.
 *
 *  @param [out] None.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not  initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  -The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED    - Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_gpio_monitor_ctrl(PCL_GPIO_MONITOR_CTRL_T* pt_gpio_monitor_ctrl);

/*------------------------------------------------------------------*/
/*! @brief  This API gets GPIO/OPCTRL monitoring control.
 *
 *  @param [in]
 *
 *  @param [out]pt_gpio_monitor_ctrl_ex  - References GPIO monitoring control info.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED     - Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_gpio_monitor_ctrl_ex(PCL_GPIO_MONITOR_CTRL_EX_T* pt_gpio_monitor_ctrl_ex);

/*------------------------------------------------------------------*/
/*! @brief  This API sets GPIO/OPCTRL monitoring control.
 *
 *  @param [in]  pt_gpio_monitor_ctrl_ex  - References GPIO monitoring control info.
 *
 *  @param [out] None.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not  initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  -The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED    - Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_gpio_monitor_ctrl_ex(PCL_GPIO_MONITOR_CTRL_EX_T* pt_gpio_monitor_ctrl_ex);

/*------------------------------------------------------------------*/
/*! @brief  This API gets the data from a SIF address.
 *
 *  @param [in] ui4_sif_addr     - Contains the SIF address.
 *  @param [in]  ui4_sif_offset   - Contains the SIF offset.
 *
 *  @param [out]pui1_sif_data   - References the SIF data.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_GET_FAILED    -  Device get operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_sif(UINT32 ui4_sif_addr,
                           UINT32 ui4_sif_offset,
                           UINT8* pui1_sif_data);

/*------------------------------------------------------------------*/
/*! @brief  This API sets the data to a SIF address.
 *
 *  @param [in] ui4_sif_addr    - Contains the SIF address.
 *  @param [in] ui4_sif_offset  - Contains the SIF offset.
 *  @param [in] ui1_sif_data    - Contains the SIF data.
 *
 *  @param [out] None.
 *  @return
 *  @retval  PCLR_OK                          -The routine was successful.
 *  @retval PCLR_NOT_INIT                 - The Power Control Library is not  initialized.
 *  @retval PCLR_HW_NOT_SUPPORT   - The hardware is not supported.
 *  @retval PCLR_DEV_SET_FAILED      -  Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_sif(UINT32 ui4_sif_addr,
                           UINT32 ui4_sif_offset,
                           UINT8  ui1_sif_data);

/*------------------------------------------------------------------*/
/*! @brief This API gets the data from a SIF address (advanced operation).
 *
 *  @param [in] None.
 *
 *  @param [out]  pt_sif_info    -  References the SIF info.
 *
 *  @return
 *  @retval    PCLR_OK                       - The routine was successful.
 *  @retval PCLR_NOT_INIT                - The Power Control Library is not  initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT - The hardware is not supported.
 *  @retval  PCLR_DEV_GET_FAILED   - Device get operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_sif_advanced(PCL_SIF_INFO_T* pt_sif_info);                   

/*------------------------------------------------------------------*/
/*! @brief This API sets the data to a SIF address (advanced operation).
 *
 *  @param [in]  pt_sif_info   - References the SIF info.
 *
 *  @param [out] None.
 *
 *  @return
 *  @retval   PCLR_OK                          - The routine was successful.
 *  @retval   PCLR_NOT_INIT                -  The Power Control Library is not initialized.
 *  @retval   PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
  *  @retval  PCLR_DEV_SET_FAILED    -  Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_sif_advanced(PCL_SIF_INFO_T* pt_sif_info);                              
                             
/*------------------------------------------------------------------*/
/*! @brief This API gets the data of specific SIF address via GPIO pins.
 *
 *  @param [in] pt_sif_info_by_gpio    -  References the SIF info.
 *
 *  @param [out] pt_sif_info_by_gpio  - References the SIF info.
 *
 *  @return
 *  @retval   PCLR_OK                         - The routine was successful.
 *  @retval   PCLR_NOT_INIT               - The Power Control Library is not initialized.
 *  @retval   PCLR_HW_NOT_SUPPORT - The hardware is not supported.
 *  @retval   PCLR_DEV_GET_FAILED    - Device get operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_sif_by_gpio(PCL_SIF_INFO_BY_GPIO_T* pt_sif_info_by_gpio);

/*------------------------------------------------------------------*/
/*! @brief This API sets the data to specific SIF address via GPIO pins.
 *
 *  @param [in]  pt_sif_info_by_gpio   - References the SIF info.
 *
 *  @param [out] None.
 *
 *  @return
 *  @retval PCLR_OK                        -  The routine was successful.
 *  @retval PCLR_NOT_INIT               - The Power Control Library is not initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT - The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED   -  Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_sif_by_gpio(PCL_SIF_INFO_BY_GPIO_T* pt_sif_info_by_gpio);
  
/*------------------------------------------------------------------*/
/*! @brief This API gets the status of upgrade controls.
 *
 *  @param [in] None.
 *
 *  @param [out] pui4_ctrl  -References the bit-mask of upgrade controls.
 *
 *  @return
 *  @retval  PCLR_OK                         - The routine was successful.
 *  @retval  PCLR_NOT_INIT               - The Power Control Library is not initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT - The hardware is not supported.
 *  @retval  PCLR_DEV_GET_FAILED   -  Device get operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_upgrade_ctrl(UINT32* pui4_ctrl);

/*------------------------------------------------------------------*/
/*! @brief This API sets the upgrade controls.
 *
 *  @param [in] ui4_ctrl   - Contains the bit-mask of upgrade controls.
 *
 *  @param [out] None.
 *
 *  @return
 *  @retval PCLR_OK                        - The routine was successful.
 *  @retval PCLR_NOT_INIT               -The Power Control Library is not initialized.
 *  @retval PCLR_HW_NOT_SUPPORT - The hardware is not supported.
 *  @retval PCLR_DEV_SET_FAILED   -  Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_upgrade_ctrl(UINT32 ui4_ctrl);

/*------------------------------------------------------------------*/
/*! @brief This API gets the status of upgrade from partition controls.
 *
 *  @param [in] None.
 *
 *  @param [out] pui4_ctrl  -References the bit-mask of upgrade controls.
 *
 *  @return
 *  @retval  PCLR_OK                         - The routine was successful.
 *  @retval  PCLR_NOT_INIT               - The Power Control Library is not initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT - The hardware is not supported.
 *  @retval  PCLR_DEV_GET_FAILED   -  Device get operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_upgrade_from_partition_ctrl(UINT32* pui4_ctrl);

/*------------------------------------------------------------------*/
/*! @brief This API sets the upgrade from partition controls.
 *
 *  @param [in] ui4_ctrl   - Contains the bit-mask of upgrade controls.
 *
 *  @param [out] None.
 *
 *  @return
 *  @retval PCLR_OK                        - The routine was successful.
 *  @retval PCLR_NOT_INIT               -The Power Control Library is not initialized.
 *  @retval PCLR_HW_NOT_SUPPORT - The hardware is not supported.
 *  @retval PCLR_DEV_SET_FAILED   -  Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_upgrade_from_partition_ctrl(UINT32 ui4_ctrl);

/*------------------------------------------------------------------*/
/*! @brief  This API gets the status of specific servo AD.
 *
 *  @param [in] None.
 *
 *  @param [out] pt_servo_ad_info - References the servo AD info.
 *
 *  @return
 *  @retval  PCLR_OK                         - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_GET_FAILED    -  Device get operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_servo_ad(PCL_SERVO_AD_INFO_T* pt_servo_ad_info);

/*------------------------------------------------------------------*/
/*! @brief This API registers a callback function with the Power Control
 *              Library in order to receive condition changes.
 *
 *  @param [in] pv_tag   - Private tag value which must be returned in the notify
 *                                     function. It can be set to NULL.
 *  @param [in] pf_nfy    - References the caller's notify function.
 *
 *  @param [out]ph_nfy  - A handle referencing a notification record.
 *
 *  @return Return the error code.
 *  @retval  PCLR_OK                           -The routine was successful.
 *  @retval  PCLR_NOT_INIT                 - The Power Control Library is not initialized.
 *  @retval  PCLR_MEM_ALLOC_FAILED  - Memory allocation is failed.
 *  @retval  PCLR_HANDLE_LIB_ERROR  - A handle library error occurred.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_reg_nfy_fct(VOID*        pv_tag,
                              x_pcl_nfy_fct pf_nfy,
                              HANDLE_T*     ph_nfy);

/*------------------------------------------------------------------*/
/*! @brief  This API de-registers a callback function from the Power
 *               Control Library.
 *
 *  @param [in]  h_nfy - A handle referencing a notification record.
 *
 *  @param [out] None.
 *
 *  @return Return the error code.
 *  @retval  PCLR_OK                           - The routine was successful.
 *  @retval  PCLR_NOT_INIT                 - The Power Control Library is not initialized.
 *  @retval  PCLR_HANDLE_LIB_ERROR - A handle library error occurred.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_dereg_nfy_fct(HANDLE_T h_nfy); 

/*------------------------------------------------------------------*/
/*! @brief  This API adds a wake-up event into wake-up list. Note that the
 *              list is sorted by wake-up time.
 *
 *  @param [in] pt_wakeup_ctrl      - References wake-up control info.
 *
 *  @param [out] ph_wakeup_evt   - A handle referencing the newly added wake-up
 *                                                   event.
 *
 *  @return Return the error code.
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not initialized.
 *  @retval  PCLR_INV_ARG                 - One or more of the arguments contain invalid data.
 *  @retval  PCLR_MEM_ALLOC_FAILED - Memory allocation is failed.
 *  @retval PCLR_HANDLE_LIB_ERROR  - A handle library error occurred.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_add_wakeup_event(PCL_WAKE_UP_CTRL_T* pt_wakeup_ctrl,
                                    HANDLE_T*           ph_wakeup_evt);

/*------------------------------------------------------------------*/
/*! @brief This API removes a wake-up event from wake-up list.
 *
 *  @param [in] h_wakeup_evt  - A handle referencing a wake-up event.
 *
 *  @param [out] None.
 *
 *  @return Return the error code.
 *  @retval   PCLR_OK                          -The routine was successful.
 *  @retval  PCLR_NOT_INIT                 -The Power Control Library is not  initialized.
 *  @retval  PCLR_HANDLE_LIB_ERROR - A handle library error occurred.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_remove_wakeup_event(HANDLE_T h_wakeup_evt);

/*------------------------------------------------------------------*/
/*! @brief This API obtains the wake-up control info of a wake-up event.
 *
 *  @param [in]  h_wakeup_evt     - A handle referencing a wake-up event.
 *
 *  @param [out]  pt_wakeup_ctrl  - References wake-up control info.
 *
 *  @return Return the error code.
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not initialized.
 *  @retval PCLR_INV_ARG                  - One or more of the arguments contain
 *                                                          invalid data.
 *  @retval PCLR_DEV_GET_FAILED     -  Device get operation is failed.
 *  @retval PCLR_HANDLE_LIB_ERROR - A handle library error occurred.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_wakeup_event(HANDLE_T            h_wakeup_evt,
                                    PCL_WAKE_UP_CTRL_T* pt_wakeup_ctrl);

/*------------------------------------------------------------------*/
/*! @brief This API changes the control info of a existing wake-up event
 *              in wake-up list.
 *
 *  @param [in] h_wakeup_evt    - A handle referencing a wake-up event.
 *  @param [in] pt_wakeup_ctrl   - References wake-up control info.
 *
 *  @param [out] None.
 *
 *  @return Return the error code.
 *  @retval PCLR_OK                          - The routine was successful.
 *  @retval PCLR_NOT_INIT                - The Power Control Library is not  initialized.
 *  @retval PCLR_INV_ARG                 - One or more of the arguments contain
 *                                                        invalid data.
 *  @retval PCLR_ERROR                    - Operation error.
 *  @retval PCLR_DEV_SET_FAILED     - Device set operation is failed.
 *  @retval PCLR_HANDLE_LIB_ERROR - A handle library error occurred.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_wakeup_event(HANDLE_T            h_wakeup_evt,
                                    PCL_WAKE_UP_CTRL_T* pt_wakeup_ctrl);
                                    
/*------------------------------------------------------------------*/
/*! @brief  This API obtains the count of a specific resource.
 *
 *  @param [in]  e_res_type   - Contains the resource type.
 *
 *  @param [out] pui2_count  -  References a count of the resource.
 *
 *  @return Return the error code.
 *  @retval  PCLR_OK           - The routine was successful.
 *  @retval  PCLR_NOT_INIT - The Power Control Library is not  initialized.
 *  @retval  PCLR_INV_ARG  - One or more of the arguments contain invalid data.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_res_count(PCL_RES_TYPE_T e_res_type,
                                 UINT16*        pui2_count);     
                                 
/*------------------------------------------------------------------*/
/*! @brief This API increase the count of a specific resource.
 *
 *  @param [in] e_res_type   -  Contains the resource type.
 *  @param [in] b_increase    - Indicates the counter should be increased or
 *                                           decreased by one.
 *
 *  @param [out] None.
 *
 *  @return
 *  @retval PCLR_OK            - The routine was successful.
 *  @retval PCLR_NOT_INIT  - The Power Control Library is not initialized.
 *  @retval PCLR_INV_ARG   - One or more of the arguments contain  invalid data.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_res_count(PCL_RES_TYPE_T e_res_type,
                                 BOOL           b_increase);                                       


/*------------------------------------------------------------------*/
/*! @brief This API gets the dual bank index for the specified dual bank type.
 *
 *  @param [in] e_dual_bank  -  Type of the dual bank index.
 *  @param [out] pui1_index  -  References the dual bank index (0/1).
 *
 *  @return
 *  @retval PCLR_OK        - The routine was successful.
 *  @retval PCLR_NOT_INIT  - The Power Control Library is not initialized.
 *  @retval PCLR_INV_ARG   - One or more of the arguments contain invalid data.
 *  @retval PCLR_DEV_GET_FAILED - Device get operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_dual_bank_index(PCL_DUAL_BANK_TYPE_T    e_dual_bank,
                                       UINT8 *                 pui1_index);


/*------------------------------------------------------------------*/
/*! @brief This API sets the dual bank index for the specified dual bank type.
 *
 *  @param [in] e_dual_bank  -  Type of the dual bank index.
 *  @param [in] ui1_index    -  Dual bank index value (0/1).
 *
 *  @return
 *  @retval PCLR_OK        - The routine was successful.
 *  @retval PCLR_NOT_INIT  - The Power Control Library is not initialized.
 *  @retval PCLR_INV_ARG   - One or more of the arguments contain invalid data.
 *  @retval PCLR_DEV_SET_FAILED - Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_dual_bank_index(PCL_DUAL_BANK_TYPE_T    e_dual_bank,
                                       UINT8                   ui1_index);


/*------------------------------------------------------------------*/
/*! @brief This API toggles the dual bank index for the specified dual bank
 *         type, changing from 0 to 1 or 1 to 0.
 *
 *  @param [in] e_dual_bank  -  Type of the dual bank index.
 *
 *  @return
 *  @retval PCLR_OK        - The routine was successful.
 *  @retval PCLR_NOT_INIT  - The Power Control Library is not initialized.
 *  @retval PCLR_INV_ARG   - One or more of the arguments contain invalid data.
 *  @retval PCLR_DEV_SET_FAILED - Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_toggle_dual_bank_index(PCL_DUAL_BANK_TYPE_T    e_dual_bank);

extern INT32 c_pcl_get_ethernet_wol_ctrl(PCL_Ethernet_WOL_CTRL_T* pe_ethernet_wol_ctrl);
extern INT32 c_pcl_set_ethernet_wol_ctrl(PCL_Ethernet_WOL_CTRL_T e_ethernet_wol_ctrl);

extern INT32 c_pcl_get_wifi_wol_ctrl(PCL_WIFI_WOL_CTRL_T* pe_wifi_wol_ctrl);
extern INT32 c_pcl_set_wifi_wol_ctrl(PCL_WIFI_WOL_CTRL_T e_wifi_wol_ctrl);

/*------------------------------------------------------------------*/
/*! @brief This API gets the system boot type.
 *
 *  @param [out] pe_boot_type  -  References the boot type which must be one of 
 *                                  (PCL_MISC_CTRL_FAST_BOOT, PCL_MISC_CTRL_NORMAL_BOOT_WITH_SUSPEND,
 *                                  PCL_MISC_CTRL_NORMAL_BOOT_WITHOUT_SUSPEND).
 *
 *  @return
 *  @retval PCLR_OK        - The routine was successful.
 *  @retval PCLR_NOT_INIT  - The Power Control Library is not initialized.
 *  @retval PCLR_INV_ARG   - One or more of the arguments contain invalid data.
 *  @retval PCLR_DEV_SET_FAILED - Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_boot_type(PCL_BOOT_TYPE_T    *pe_boot_type);

/*------------------------------------------------------------------*/
/*! @brief This API sets the system boot type.
 *
 *  @param [in] pe_boot_type  -  References the boot type. Only one of 
 *                                  (PCL_MISC_CTRL_FAST_BOOT, PCL_MISC_CTRL_NORMAL_BOOT_WITH_SUSPEND,
 *                                  PCL_MISC_CTRL_NORMAL_BOOT_WITHOUT_SUSPEND) can be set.
 *
 *  @return
 *  @retval PCLR_OK        - The routine was successful.
 *  @retval PCLR_NOT_INIT  - The Power Control Library is not initialized.
 *  @retval PCLR_INV_ARG   - One or more of the arguments contain invalid data.
 *  @retval PCLR_DEV_SET_FAILED - Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_boot_type(PCL_BOOT_TYPE_T    e_boot_type);

/*------------------------------------------------------------------*/
/*! @brief This API sets the power suspend.
 *
 *  @param [in]  None.
 *
 *  @param [out] None.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not  initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED    -  Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_set_power_suspend(VOID);

#ifdef SYS_QUIET_HOT_BOOT_SUPPORT
extern INT32 c_pcl_get_quiet_hot_boot_status(PCL_QUIET_HOT_BOOT_STATUS_T* prQuietHotBootStatus);
#endif

extern VOID c_pcl_lock(VOID);
extern VOID c_pcl_unlock(VOID);

extern INT32 c_pcl_suspend_reg_nfy_fct(VOID*     pv_tag,
                             x_pcl_suspend_nfy_fct    pf_nfy,
                             HANDLE_T*                ph_nfy);
extern INT32 c_pcl_suspend_dereg_nfy_fct(HANDLE_T h_nfy);
extern INT32 c_pcl_suspend_reset(VOID);

/*------------------------------------------------------------------*/
/*! @brief This API gets the key code of hotkey which wakeup system.
 *
 *  @param [in]  None.
 *
 *  @param [out] pt_wakeup_irkey         - Reference the hotkey.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not  initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED    -  Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_wakeup_irkey(PCL_WAKEUP_KEY_T *pt_wakeup_irkey);
/*------------------------------------------------------------------*/
/*! @brief This API gets the number of hotkeys.
 *
 *  @param [in]  None.
 *
 *  @param [out] pui1_key_num     - Reference the number of hotkey.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not  initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED    -  Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_hotkey_num(UINT8 *pui1_key_num);
/*------------------------------------------------------------------*/
/*! @brief This API gets all hotkeys.
 *
 *  @param [in]  u1_key_num   -  The number of hotkeys.
 *
 *  @param [out] pui4_hotkey   -  Reference the buffer to fill hotkey.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not  initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED    -  Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern INT32 c_pcl_get_all_hotkey(UINT32 *pui4_hotkey, UINT8 u1_key_num);
/*------------------------------------------------------------------*/
/*! @brief This API check the key is hotkey or not.
 *
 *  @param [in]  ui4_key_code  -  Key code.
 *
 *  @param [out] None.
 *
 *  @return
 *  @retval  PCLR_OK                          - The routine was successful.
 *  @retval  PCLR_NOT_INIT                - The Power Control Library is not  initialized.
 *  @retval  PCLR_HW_NOT_SUPPORT  - The hardware is not supported.
 *  @retval  PCLR_DEV_SET_FAILED    -  Device set operation is failed.
 */
/*------------------------------------------------------------------*/
extern BOOL c_pcl_is_hotkey(UINT32 ui4_key_code);

#endif /* _C_PCL_H_ */

/*----------------------------------------------------------------------------*/
/*! @} */                                               /* end of groupMW_PCL */
/*----------------------------------------------------------------------------*/

