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

/*-----------------------------------------------------------------------------
 * $RCSfile: u_lst_mngr.h,v $
 * $Revision: #1 $
 * $Date: 2015/11/10 $
 * $Author: dtvbm11 $
 * $CCRevision: /main/DTV_X/DTV_X_HQ_int/20 $
 * $SWAuthor: Pedro Tsai $
 * $MD5HEX: aa3109d410702d35a82d86c6386592c7 $
 *
 * Description:
 *         This header file contains Large Object list related API definitions,
 *         which are exported to other Middleware components.
 *
 *---------------------------------------------------------------------------*/

#ifndef _U_LST_MNGR_H_
#define _U_LST_MNGR_H_

#include "u_common.h"
#include "u_handle.h"
#include "u_handle_grp.h"

/*--------------------------------------------------------------------------
 Constants, enumerations, and macros
---------------------------------------------------------------------------*/

/* Return code status from API */
#define         LSTMR_OK                    ((INT32)  0)
#define         LSTMR_FAIL                  ((INT32) -1)
#define         LSTMR_OUT_OF_HANDLE         ((INT32) -2)
#define         LSTMR_OUT_OF_MEM            ((INT32) -3)
#define         LSTMR_INV_HANDLE            ((INT32) -4)
#define         LSTMR_INV_ARG               ((INT32) -5)
#define         LSTMR_REC_NOT_FOUND         ((INT32) -6)
#define         LSTMR_NO_WRITE_LOCK         ((INT32) -7)
#define         LSTMR_NOT_FOUND             ((INT32) -8)
#define         LSTMR_END_OF_ITERATION      ((INT32) -9)
#define         LSTMR_MODIFIED              ((INT32) -10)
#define         LSTMR_DUPLICATE_REC         ((INT32) -11)
#define         LSTMR_INV_FILE_PATH         ((INT32) -12)
#define         LSTMR_OUT_OF_SPACE          ((INT32) -13)
#define         LSTMR_AEE_OUT_OF_RESOURCES  ((INT32) -14)
#define         LSTMR_AEE_NO_RIGHTS         ((INT32) -15)
#define         LSTMR_FILE_READ_FAIL        ((INT32) -16)
#define         LSTMR_FILE_WRITE_FAIL       ((INT32) -17)
#define         LSTMR_INV_FILE_VER          ((INT32) -18)
#define         LSTMR_ALREADY_INITED        ((INT32) -19)

/* Empty list ID */
#define LST_NULL_ID                         0

/* Bitmasks for individual lists */
#define LST_MASK_SVL                    MAKE_BIT_MASK_32 (LST_TYPE_SVL)
#define LST_MASK_TSL                    MAKE_BIT_MASK_32 (LST_TYPE_TSL)
#define LST_MASK_NWL                    MAKE_BIT_MASK_32 (LST_TYPE_NWL)
#define LST_MASK_LOL                    MAKE_BIT_MASK_32 (LST_TYPE_LOL)
#define LST_MASK_SATL                   MAKE_BIT_MASK_32 (LST_TYPE_SATL)

#define LST_MASK_ALL                    ((UINT32) ~0)

/*------------------------------------------------------
  data structure and typedef.
------------------------------------------------------*/
typedef enum _LST_MNGR_LST_TYPE_ {
    LST_TYPE_SVL = 0,
    LST_TYPE_TSL,
    LST_TYPE_NWL,
    LST_TYPE_LOL,
    LST_TYPE_SATL,
    LST_MNGR_NUM_LIST_TYPES         /* Number of list types under management */
} LST_MNGR_LST_TYPE_T;

/* Dual bank */
typedef enum
{
    LST_MNGR_DUAL_BANK_AS_MODE_BY_NVM = 0,
    LST_MNGR_DUAL_BANK_AS_MODE_TO_MAIN_SUB,
    LST_MNGR_DUAL_BANK_AS_MODE_TO_MAIN,
    LST_MNGR_DUAL_BANK_AS_MODE_TO_SUB,
    LST_MNGR_DUAL_BANK_AS_MODE_LAST_VALID_ENTRY  /* only for counting purpose */
} LST_MNGR_DUAL_BANK_AS_MODE_T;

typedef INT32 (*x_lst_mngr_get_fct) (UINT8* pui1_svl_tsl_dual_bank);

typedef INT32 (*x_lst_mngr_set_fct) (UINT8 ui1_svl_tsl_dual_bank);

typedef INT32 (*lst_mngr_get_fct) (UINT8* pui1_svl_tsl_dual_bank, VOID* pv_tag);

typedef INT32 (*lst_mngr_set_fct) (UINT8 ui1_svl_tsl_dual_bank, VOID* pv_tag);

typedef struct _LST_MNGR_CLEAN_ {
    BRDCST_TYPE_T   e_brdcst_type;
} LST_MNGR_CLEAN_T;

#endif  /* _U_LST_MNGR_H_ */
