/* 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 u_dvb_si_eng.h 
 *  $RCSfile: $
 *  $Revision: #1 $
 *  $Date: 2015/11/10 $
 *  $Author: dtvbm11 $
 *  
 *  @par Description:
 *         This header file contains DVB-SI engine specific definitions,
 *         which are exported.
 */
/*----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------*/
/*! @defgroup groupMW_TBL_MNGR_DVB_SI_ENGINE DVB SI Engine
 *  @ingroup groupMW_TBL_MNGR
 *  @brief Provides DVB Service Information operation.
 *  %This module is Table Manager DVB-SI instance.
 *  @see groupMW_TBL_MNGR
 *  @{ 
 */
/*----------------------------------------------------------------------------*/

#ifndef _U_DVB_SI_H_
#define _U_DVB_SI_H_


/*-----------------------------------------------------------------------------
                    include files
-----------------------------------------------------------------------------*/

#include "u_common.h"
#include "u_handle_grp.h"
#include "u_tm.h"


/*-----------------------------------------------------------------------------
                    macros, defines, typedefs, enums
 ----------------------------------------------------------------------------*/

#define DVB_SI_DEFAULT_NAME     "dvb_si_engine"    /**<        */


/* Character coding definitions */
typedef enum {
    DVB_TEXT_CHAR_CODE_DEFAULT,
    DVB_TEXT_CHAR_CODE_ISO_8859_1,
    DVB_TEXT_CHAR_CODE_ISO_8859_2,
    DVB_TEXT_CHAR_CODE_ISO_8859_3,
    DVB_TEXT_CHAR_CODE_ISO_8859_4,
    DVB_TEXT_CHAR_CODE_ISO_8859_5,
    DVB_TEXT_CHAR_CODE_ISO_8859_6,
    DVB_TEXT_CHAR_CODE_ISO_8859_7,
    DVB_TEXT_CHAR_CODE_ISO_8859_8,
    DVB_TEXT_CHAR_CODE_ISO_8859_9,
    DVB_TEXT_CHAR_CODE_ISO_8859_10,
    DVB_TEXT_CHAR_CODE_ISO_8859_11,
    DVB_TEXT_CHAR_CODE_ISO_8859_12,
    DVB_TEXT_CHAR_CODE_ISO_8859_13,
    DVB_TEXT_CHAR_CODE_ISO_8859_14,
    DVB_TEXT_CHAR_CODE_ISO_8859_15,
    DVB_TEXT_CHAR_CODE_ISO_8859_16,
    DVB_TEXT_CHAR_CODE_ISO_8859_9_HUN,
    DVB_TEXT_CHAR_CODE_ISO_10646_1,
    DVB_TEXT_CHAR_CODE_KSC_5601,
    DVB_TEXT_CHAR_CODE_GB_2312,
    DVB_TEXT_CHAR_CODE_ISO_10646_1_ZH_TW,
    DVB_TEXT_CHAR_CODE_ISO_10646_1_UTF_8,
    DVB_TEXT_CHAR_CODE_INVALID,
}   E_DVB_TEXT_CHAR_TBL;



/* DVB-SI engine handle types. */
#define TMT_DVB_BAT             (TMT_DVB + ((HANDLE_TYPE_T)  0))    /**< handle type for BAT    */
#define TMT_DVB_NIT             (TMT_DVB + ((HANDLE_TYPE_T)  1))    /**< handle type for NIT    */
#define TMT_DVB_SDT             (TMT_DVB + ((HANDLE_TYPE_T)  2))    /**< handle type for SDT    */
#define TMT_DVB_EIT_PF          (TMT_DVB + ((HANDLE_TYPE_T)  3))    /**< handle type for EIT-PF       */
#define TMT_DVB_EIT_S           (TMT_DVB + ((HANDLE_TYPE_T)  4))    /**< handle type for EIT-S       */
#define TMT_DVB_TDT             (TMT_DVB + ((HANDLE_TYPE_T)  5))    /**< handle type for TDT       */
#define TMT_DVB_TOT             (TMT_DVB + ((HANDLE_TYPE_T)  6))    /**< handle type for TOT       */
#define TMT_DVB_RST             (TMT_DVB + ((HANDLE_TYPE_T)  7))    /**< handle type for RST       */
#define TMT_DVB_UNT             (TMT_DVB + ((HANDLE_TYPE_T)  8))    /**< handle type for UNT       */

#define TMT_DVB_BAT_MON         (TMT_DVB + ((HANDLE_TYPE_T)  9))    /**< handle type for monitor BAT       */
#define TMT_DVB_NIT_ACTUAL_MON  (TMT_DVB + ((HANDLE_TYPE_T) 10))    /**< handle type for monitor actual NIT       */
#define TMT_DVB_NIT_OTHER_MON   (TMT_DVB + ((HANDLE_TYPE_T) 11))    /**< handle type for monitor other NIT       */
#define TMT_DVB_SDT_ACTUAL_MON  (TMT_DVB + ((HANDLE_TYPE_T) 12))    /**< handle type for monitor actual SDT       */
#define TMT_DVB_SDT_OTHER_MON   (TMT_DVB + ((HANDLE_TYPE_T) 13))    /**< handle type for monitor other SDT       */
#define TMT_DVB_UNT_MON         (TMT_DVB + ((HANDLE_TYPE_T) 14))    /**< handle type for monitor UNT        */

#define TMT_DVB_TXT             (TMT_DVB + ((HANDLE_TYPE_T) 15))    /**< handle type for DVB text*/

#define TMT_DVB_EIT_PF_SECTIONS  (TMT_DVB + ((HANDLE_TYPE_T)  16))    /**< handle type for EIT-PF sections      */
#define TMT_DVB_EIT_S_SECTIONS   (TMT_DVB + ((HANDLE_TYPE_T)  17))    /**< handle type for EIT-S sections      */

#define TMT_DVB_AIT             (TMT_DVB + ((HANDLE_TYPE_T)  18))    /**< handle type for AIT    */
#define TMT_DVB_AIT_MON         (TMT_DVB + ((HANDLE_TYPE_T)  19))    /**< handle type for monitor AIT    */

#define TMT_DVB_SGT             (TMT_DVB + ((HANDLE_TYPE_T)  20))    /**< handle type for SGT    */
#define TMT_DVB_SGT_MON         (TMT_DVB + ((HANDLE_TYPE_T)  21))    /**< handle type for monitor SGT    */


#define TMT_DVB_FNT             (TMT_DVB + ((HANDLE_TYPE_T)  22))    /**< handle type for FNT    */
#define TMT_DVB_FNT_MON         (TMT_DVB + ((HANDLE_TYPE_T)  23))    /**< handle type for monitor FNT    */

#define TMT_DVB_FST             (TMT_DVB + ((HANDLE_TYPE_T)  24))    /**< handle type for FST    */
#define TMT_DVB_FST_MON         (TMT_DVB + ((HANDLE_TYPE_T)  25))    /**< handle type for monitor FST    */
#define TMT_DVB_CMT             (TMT_DVB + ((HANDLE_TYPE_T)  26))    /**< handle type for CMT       */
#define TMT_DVB_CLT             (TMT_DVB + ((HANDLE_TYPE_T)  27))    /**< handle type for CLT       */
#define TMT_DVB_TRDW            (TMT_DVB + ((HANDLE_TYPE_T)  28))    /**< handle type for TRDW       */
#define TMT_DVB_TCDW            (TMT_DVB + ((HANDLE_TYPE_T)  29))    /**< handle type for TCDW       */
#define TMT_DVB_TMDW            (TMT_DVB + ((HANDLE_TYPE_T)  30))    /**< handle type for TMDW       */
#define TMT_DVB_LAST_ENTRY      (TMT_DVB + ((HANDLE_TYPE_T)  31))    /**< Last Entry       */


/* DVB-SI engine get operations. */
#define DVB_SI_GET_TYPE_TS_IDS                  \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 0))    /**< get information, reference to DVB_SI_ON_TS_ID_INFO_T*       */

#define DVB_SI_GET_TYPE_TS_ENTRY                \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 1))    /**< get information, reference to DVB_SI_ON_TS_ID_INFO_T*      */

#define DVB_SI_GET_TYPE_SVC_IDS                 \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 2))    /**< get information, reference to DVB_SI_ON_TS_SVC_ID_INFO_T*      */

#define DVB_SI_GET_TYPE_SVC_ENTRY               \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 3))    /**< get information, reference to DVB_SI_ON_TS_SVC_ID_INFO_T*      */

#define DVB_SI_GET_TYPE_EVT_ENTRY               \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 4))    /**< get information, reference to DVB_SI_EVT_ENTRY_INFO_T*      */

#define DVB_SI_GET_TYPE_ERS_ENTRY               \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 5))    /**< get information, reference to DVB_SI_EVT_RUNNING_STATUS_INFO_T*      */

#define DVB_SI_GET_TYPE_SCHED_END_TIME          \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 6))    /**< get information, reference to DVB_SI_SCHED_END_TIME_INFO_T*      */

#define DVB_SI_GET_TYPE_TXT_DESCR               \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 7))    /**< get information, reference to TXT handle      */

#define DVB_SI_GET_TYPE_TXT                     \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 8))    /**< get TXT information       */

#define DVB_SI_GET_TYPE_TXT_LEN                 \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 9))    /**< get TXT length      */

#define DVB_SI_GET_TYPE_SHORT_TXT               \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 10))    /**< get TXT short text*/

#define DVB_SI_GET_TYPE_SHORT_TXT_LEN           \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 11))    /**< get TXT short text length       */

#define DVB_SI_GET_TYPE_TXT_STYLE               \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 12))    /**< get TXT style       */

#define DVB_SI_GET_TYPE_TXT_STYLE_SIZE          \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 13))    /**< get TXT style length       */

#define DVB_SI_GET_TYPE_OUI                     \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 14))    /**< get UNT's table OUI.     */

#define DVB_SI_GET_TYPE_PROCESSING_ORDER        \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 15))    /**< get an individual UNT service entry       */

#define DVB_SI_GET_TYPE_EVT_EXT_COND           \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 16))    /**< get EIT extend condition      */

#define DVB_SI_GET_TYPE_APP_ENTRY           \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 17))    /**< get EIT extend condition      */

#define DVB_SI_GET_TYPE_DISASTER_ENTRY           \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 18))    /**< get TCDW DISASTER entry      */

#define DVB_SI_GET_TYPE_TRDW_HEAD           \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 19))    /**< get TRDW HEAD     */
    
#define DVB_SI_GET_TYPE_LOCATION_ENTRY           \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 20))    /**< get TMDW Location entry      */

#define DVB_SI_GET_TYPE_INFO_MSG           \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 21))    /**< get TMDW info msg      */

#define DVB_SI_GET_TYPE_LOCATION_NUM_BY_PKID           \
        (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 22))    /**< get TRDW location number by package id     */

#define DVB_SI_GET_TYPE_LOCATION_ENTRY_BY_PKID_IDX           \
        (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 23))    /**< get TRDW location entry by package id and index      */

#define DVB_SI_GET_TYPE_DISASTER_ENTRY_BY_PKID_DISAC           \
            (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 24))    /**< get TCDW disaster entry by pkid and disaster code     */

#define DVB_SI_GET_TYPE_INFO_MSG_LENGTH                  \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 25))    /**< get info msg length *       */  

#define DVB_SI_GET_TYPE_DISASTER_ENTRY_BY_PKID           \
            (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 26))    /**< get TCDW disaster entry by pkid and disaster code     */

#define DVB_SI_GET_TYPE_INFO_MSG_BY_PKID           \
    (TM_GET_TYPE_LAST_ENTRY + ((TM_GET_TYPE_T) 27))    /**< get TMDW info msg      */

/* DVB-SI engine monitor types. */
#define DVB_SI_MON_TYPE_PID                     \
    (TM_MON_TYPE_LAST_ENTRY + (((TM_MON_TYPE_T)  0) | TM_MON_TYPE_SINGLE_SRC))    /**< Load type for PID       */


/* DVB-SI engine load types. */
#define DVB_SI_LOAD_TYPE_BQ_ID                  \
    (TM_LOAD_TYPE_LAST_ENTRY + (((TM_LOAD_TYPE_T)  0) | TM_LOAD_TYPE_SINGLE_SRC))    /**< Load type for BQ id       */

#define DVB_SI_LOAD_TYPE_NW_ID                  \
    (TM_LOAD_TYPE_LAST_ENTRY + (((TM_LOAD_TYPE_T)  1) | TM_LOAD_TYPE_SINGLE_SRC))    /**< Load type for network id     */

#define DVB_SI_LOAD_TYPE_ON_TS_ID               \
    (TM_LOAD_TYPE_LAST_ENTRY + ((TM_LOAD_TYPE_T)  2))    /**<  Load type for ON TS id      */

#define DVB_SI_LOAD_TYPE_ON_TS_SVC_ID           \
    (TM_LOAD_TYPE_LAST_ENTRY + ((TM_LOAD_TYPE_T)  3))    /**<  Load type for ON TS SERVICE id      */

#define DVB_SI_LOAD_TYPE_ON_TS_SVC_ID_TIME      \
    (TM_LOAD_TYPE_LAST_ENTRY + ((TM_LOAD_TYPE_T)  4))    /**<   Load type for ON TS SERVICE id and Time information      */

#define DVB_SI_LOAD_TYPE_TS_DESCR_SVC_ID        \
    (TM_LOAD_TYPE_LAST_ENTRY + (((TM_LOAD_TYPE_T)  5) | TM_LOAD_TYPE_SINGLE_SRC))    /**<  Load type for TS description      */

#define DVB_SI_LOAD_TYPE_TS_DESCR_SVC_ID_TIME   \
    (TM_LOAD_TYPE_LAST_ENTRY + (((TM_LOAD_TYPE_T)  6) | TM_LOAD_TYPE_SINGLE_SRC))    /**<   Load type for TS description and time information   */

#define DVB_SI_LOAD_TYPE_IDX_SVC_ID             \
    (TM_LOAD_TYPE_LAST_ENTRY + ((TM_LOAD_TYPE_T)  7))    /**<  Load type for index of service      */

#define DVB_SI_LOAD_TYPE_IDX_SVC_ID_TIME        \
    (TM_LOAD_TYPE_LAST_ENTRY + ((TM_LOAD_TYPE_T)  8))    /**<  Load type for index if service and time information       */

#define DVB_SI_LOAD_TYPE_IDX_TIME               \
    (TM_LOAD_TYPE_LAST_ENTRY + ((TM_LOAD_TYPE_T)  9))    /**<  Load type for index of time      */

#define DVB_SI_LOAD_TYPE_SVC_ID                 \
    (TM_LOAD_TYPE_LAST_ENTRY + ((TM_LOAD_TYPE_T) 10))    /**<   Load type for service id      */

#define DVB_SI_LOAD_TYPE_SVC_ID_TIME            \
    (TM_LOAD_TYPE_LAST_ENTRY + ((TM_LOAD_TYPE_T) 11))    /**<   Load type for service id and time information     */

#define DVB_SI_LOAD_TYPE_NIT_ACTUAL             \
    (TM_LOAD_TYPE_LAST_ENTRY + (((TM_LOAD_TYPE_T) 12) | TM_LOAD_TYPE_SINGLE_SRC))    /**< Load type for NIT actual       */

#define DVB_SI_LOAD_TYPE_SDT_ACTUAL             \
    (TM_LOAD_TYPE_LAST_ENTRY + ((TM_LOAD_TYPE_T) 13))    /**< Load type for SDT actual        */

#define DVB_SI_LOAD_TYPE_PID_OUI                \
    (TM_LOAD_TYPE_LAST_ENTRY + (((TM_LOAD_TYPE_T) 14) | TM_LOAD_TYPE_SINGLE_SRC))    /**< Load type for  PID and OUI information      */

#define DVB_SI_LOAD_TYPE_PID_APP_TYPE                \
    (TM_LOAD_TYPE_LAST_ENTRY + (((TM_LOAD_TYPE_T) 15)))    /**< Load type for  PID and app type information      */

#define DVB_SI_LOAD_TYPE_PID_SERVICE_LIST_ID             \
    (TM_LOAD_TYPE_LAST_ENTRY + (((TM_LOAD_TYPE_T) 16) | TM_LOAD_TYPE_SINGLE_SRC))    /**< Load type for pid and service list id  information      */

#define DVB_SI_LOAD_TYPE_PID_OPERATOR_NETWORK_ID             \
    (TM_LOAD_TYPE_LAST_ENTRY + (((TM_LOAD_TYPE_T) 17) | TM_LOAD_TYPE_SINGLE_SRC))    /**< Load type for pid and network  id  information      */


/*DVB SI global configuration*/
typedef UINT32 DVB_SI_CONFIG_MASK_T;

#define DVB_SI_CONFIG_MASK_CUST_1           (MAKE_BIT_MASK_32(0))
#define DVB_SI_CONFIG_MASK_TRIM_SPACE       (MAKE_BIT_MASK_32(1))



/* DVB-SI engine configuration structure. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_CONFIG_T
 *  @brief DVB service information configure
 *  @code
 *  typedef struct _DVB_SI_CONFIG_T
 *  {
 *      UINT8   ui1_num_bat_filters;
 *      UINT8   ui1_num_nit_filters;
 *      UINT8   ui1_num_sdt_filters;
 *      UINT8   ui1_num_eit_filters;
 *      UINT8   ui1_num_tdt_filters;
 *      UINT8   ui1_num_tot_filters;
 *      UINT8   ui1_num_rst_filters;
 *      UINT8   ui1_num_unt_filters;
 *      SIZE_T  z_bat_buff_size;
 *      SIZE_T  z_nit_buff_size;
 *      SIZE_T  z_sdt_buff_size;
 *      SIZE_T  z_eit_buff_size;
 *      SIZE_T  z_tdt_buff_size;
 *      SIZE_T  z_tot_buff_size;
 *      SIZE_T  z_rst_buff_size;
 *      SIZE_T  z_unt_buff_size;
 *      UINT16  ui2_num_bat_tbl_objs;
 *      UINT16  ui2_num_nit_tbl_objs;
 *      UINT16  ui2_num_sdt_tbl_objs;
 *      UINT16  ui2_num_eit_tbl_objs;
 *      UINT16  ui2_num_tdt_tbl_objs;
 *      UINT16  ui2_num_tot_tbl_objs;
 *      UINT16  ui2_num_rst_tbl_objs;
 *      UINT16  ui2_num_txt_tbl_objs;
 *      UINT16  ui2_num_unt_tbl_objs;
 *      UINT16  ui2_num_mon_bat_tbl_objs;
 *      UINT16  ui2_num_mon_nit_tbl_objs;
 *      UINT16  ui2_num_mon_sdt_tbl_objs;
 *      UINT16  ui2_num_mon_unt_tbl_objs;
 *      UINT8   ui1_num_eit_tbl_objs_per_filter;
 *      UINT32  ui4_eit_tbl_filter_timeout;
 *  }   DVB_SI_CONFIG_T;
 *  @endcode
 *  @li@c  ui1_num_bat_filters                               -filter number of BAT
 *  @li@c  ui1_num_nit_filters                               -filter number of NIT
 *  @li@c  ui1_num_sdt_filters                               -filter number of SDT
 *  @li@c  ui1_num_eit_filters                               -filter number of EIT
 *  @li@c  ui1_num_tdt_filters                               -filter number of TDT
 *  @li@c  ui1_num_tot_filters                               -filter number of TOT
 *  @li@c  ui1_num_rst_filters                               -filter number of RST
 *  @li@c  ui1_num_unt_filters                               -filter number of UNT
 *  @li@c  z_bat_buff_size                                   -section buffer size of BAT
 *  @li@c  z_nit_buff_size                                   -section buffer size of NIT
 *  @li@c  z_sdt_buff_size                                   -section buffer size of SDT
 *  @li@c  z_eit_buff_size                                   -section buffer size of EIT
 *  @li@c  z_tdt_buff_size                                   -section buffer size of TDT
 *  @li@c  z_tot_buff_size                                   -section buffer size of TOT
 *  @li@c  z_rst_buff_size                                   -section buffer size of RST
 *  @li@c  z_unt_buff_size                                   -section buffer size of UNT
 *  @li@c  ui2_num_bat_tbl_objs                              -table object's number of BAT
 *  @li@c  ui2_num_nit_tbl_objs                              -table object's number of NIT
 *  @li@c  ui2_num_sdt_tbl_objs                              -table object's number of SDT
 *  @li@c  ui2_num_eit_tbl_objs                              -table object's number of EIT
 *  @li@c  ui2_num_tdt_tbl_objs                              -table object's number of TDT
 *  @li@c  ui2_num_tot_tbl_objs                              -table object's number of TOT
 *  @li@c  ui2_num_rst_tbl_objs                              -table object's number of RST
 *  @li@c  ui2_num_txt_tbl_objs                              -table object's number of TXT
 *  @li@c  ui2_num_unt_tbl_objs                              -table object's number of UNT
 *  @li@c  ui2_num_mon_bat_tbl_objs                          -monitor table object's number of BAT
 *  @li@c  ui2_num_mon_nit_tbl_objs                          -monitor table object's number of NIT
 *  @li@c  ui2_num_mon_sdt_tbl_objs                          -monitor table object's number of SDT
 *  @li@c  ui2_num_mon_unt_tbl_objs                          -monitor table object's number of UNT
 *  @li@c  ui1_num_eit_tbl_objs_per_filter                   -
 *  @li@c  ui4_eit_tbl_filter_timeout                        -time out of eit filter
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_CONFIG_T
{
    UINT8   ui1_num_bat_filters;
    UINT8   ui1_num_nit_filters;
    UINT8   ui1_num_sdt_filters;
    UINT8   ui1_num_eit_filters;
    UINT8   ui1_num_tdt_filters;
    UINT8   ui1_num_tot_filters;
    UINT8   ui1_num_rst_filters;
    UINT8   ui1_num_unt_filters;
    UINT8   ui1_num_eit_sec_filters;
    UINT8   ui1_num_ait_filters;
    UINT8   ui1_num_sgt_filters;
    UINT8   ui1_num_fnt_filters;
    UINT8   ui1_num_fst_filters;
    UINT8   ui1_num_cmt_filters;
    UINT8   ui1_num_clt_filters;
    UINT8   ui1_num_trdw_filters;
    UINT8   ui1_num_tcdw_filters;
    UINT8   ui1_num_tmdw_filters;

    SIZE_T  z_bat_buff_size;
    SIZE_T  z_nit_buff_size;
    SIZE_T  z_sdt_buff_size;
    SIZE_T  z_eit_buff_size;
    SIZE_T  z_tdt_buff_size;
    SIZE_T  z_tot_buff_size;
    SIZE_T  z_rst_buff_size;
    SIZE_T  z_unt_buff_size;
    SIZE_T  z_eit_sec_buff_size;
    SIZE_T  z_ait_buff_size;
    SIZE_T  z_sgt_buff_size;
    SIZE_T  z_fnt_buff_size;
    SIZE_T  z_fst_buff_size;
    SIZE_T  z_cmt_buff_size;
    SIZE_T  z_clt_buff_size;
    SIZE_T  z_trdw_buff_size;
    SIZE_T  z_tcdw_buff_size;
    SIZE_T  z_tmdw_buff_size;

    UINT16  ui2_num_bat_tbl_objs;
    UINT16  ui2_num_nit_tbl_objs;
    UINT16  ui2_num_sdt_tbl_objs;
    UINT16  ui2_num_eit_tbl_objs; /*share with EIT section feed*/
    UINT16  ui2_num_tdt_tbl_objs;
    UINT16  ui2_num_tot_tbl_objs;
    UINT16  ui2_num_rst_tbl_objs;
    UINT16  ui2_num_txt_tbl_objs;
    UINT16  ui2_num_unt_tbl_objs;
    UINT16  ui2_num_ait_tbl_objs;
    UINT16  ui2_num_sgt_tbl_objs;
    UINT16  ui2_num_fnt_tbl_objs;
    UINT16  ui2_num_fst_tbl_objs;
    UINT16  ui2_num_cmt_tbl_objs;
    UINT16  ui2_num_clt_tbl_objs;
    UINT16  ui2_num_trdw_tbl_objs;
    UINT16  ui2_num_tcdw_tbl_objs;
    UINT16  ui2_num_tmdw_tbl_objs;

    UINT16  ui2_num_mon_bat_tbl_objs;
    UINT16  ui2_num_mon_nit_tbl_objs;
    UINT16  ui2_num_mon_sdt_tbl_objs;
    UINT16  ui2_num_mon_unt_tbl_objs;
    UINT16  ui2_num_mon_ait_tbl_objs;
    UINT16  ui2_num_mon_sgt_tbl_objs;
    UINT16  ui2_num_mon_fnt_tbl_objs;
    UINT16  ui2_num_mon_fst_tbl_objs;
    UINT16  ui2_num_mon_cmt_tbl_objs;
    UINT16  ui2_num_mon_clt_tbl_objs;

    UINT8   ui1_num_eit_tbl_objs_per_filter;
    UINT32  ui4_eit_tbl_filter_timeout;
    DVB_SI_CONFIG_MASK_T  ui4_config_mask;
    BOOL    b_use_custom_text_decode_rule;
}   DVB_SI_CONFIG_T;


/* Possible values of ui1_flags of DVB_SI_EVT_ENTRY_INFO_T */
#define EVT_FLAG_STATUS_UNDEFINED       ((UINT8) 0x00)    /**< flag undefined       */
#define EVT_FLAG_NOT_RUNNING            ((UINT8) 0x01)    /**< not running       */
#define EVT_FLAG_SECONDS_LATER          ((UINT8) 0x02)    /**< seconds later       */
#define EVT_FLAG_PAUSING                ((UINT8) 0x03)    /**< pause       */
#define EVT_FLAG_RUNNING                ((UINT8) 0x04)    /**< runnine       */
#define EVT_FLAG_CA_SCRAMBLED           ((UINT8) 0x08)    /**< ca scrambled       */

#define EVT_MASK_RUNNING_STATUS         ((UINT8) 0x07)    /**< running status       */

/* This structure contains all information of an EIT present / following or 
   schedule table objects event loop. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_EVT_ENTRY_INFO_T
 *  @brief  This structure contains all information of an EIT present / following or 
 *          schedule table objects event loop.
 *  @code
 *  typedef struct _DVB_SI_EVT_ENTRY_INFO_T
 *  {
 *      UINT16  ui2_evt_id;
 *      TIME_T  t_start_time;
 *      TIME_T  t_duration;
 *      UINT8   ui1_flags;
 *      UINT8   ui1_sect_num;
 *  }   DVB_SI_EVT_ENTRY_INFO_T;
 *  @endcode
 *  @li@c  ui2_evt_id                                        - event id
 *  @li@c  t_start_time                                      - start time
 *  @li@c  t_duration                                        - duration
 *  @li@c  ui1_flags                                         - flag
 *  @li@c  ui1_sect_num                                      - section number
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_EVT_ENTRY_INFO_T
{
    UINT16  ui2_evt_id;

    TIME_T  t_start_time;
    TIME_T  t_duration;

    UINT8   ui1_flags;
    UINT8   ui1_sect_num;
}   DVB_SI_EVT_ENTRY_INFO_T;


/* This structure contains an index and a time, which is used to acquire the 
   schedule data of a specific period. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_IDX_TIME_INFO_T
 *  @brief  This structure contains an index and a time, which is used to acquire the 
 *          schedule data of a specific period.
 *  @code
 *  typedef struct _DVB_SI_IDX_TIME_INFO_T
 *  {
 *      UINT16  ui2_idx;
 *      TIME_T  t_time;
 *  }   DVB_SI_IDX_TIME_INFO_T;
 *  @endcode
 *  @li@c  ui2_idx                                           -index of EIT
 *  @li@c  t_time                                            -schedule time
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_IDX_TIME_INFO_T
{
    UINT16  ui2_idx;
    TIME_T  t_time;
}   DVB_SI_IDX_TIME_INFO_T;


/* This structure contains an index and a tables service id value. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_IDX_SVC_ID_INFO_T
 *  @brief  This structure contains an index and a tables service id value.
 *  @code
 *  typedef struct _DVB_SI_IDX_SVC_ID_INFO_T
 *  {
 *      UINT16  ui2_idx;
 *      UINT16  ui2_svc_id;
 *  }   DVB_SI_IDX_SVC_ID_INFO_T;
 *  @endcode
 *  @li@c  ui2_idx                                           -index
 *  @li@c  ui2_svc_id                                        -service id
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_IDX_SVC_ID_INFO_T
{
    UINT16  ui2_idx;
    UINT16  ui2_svc_id;
}   DVB_SI_IDX_SVC_ID_INFO_T;


/* This structure contains an index and a tables service id value. In 
   addition, this structure holds a time, which is used to acquire the
   schedule data of a specific period. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_IDX_SVC_ID_TIME_INFO_T
 *  @brief  This structure contains an index and a tables service id value. In 
 *          addition, this structure holds a time, which is used to acquire the
 *          schedule data of a specific period.
 *  @code
 *  typedef struct _DVB_SI_IDX_SVC_ID_TIME_INFO_T
 *  {
 *      UINT16  ui2_idx;
 *      UINT16  ui2_svc_id;
 *      TIME_T  t_time;
 *  }   DVB_SI_IDX_SVC_ID_TIME_INFO_T;
 *  @endcode
 *  @li@c  ui2_idx                                           - 
 *  @li@c  ui2_svc_id                                        -
 *  @li@c  t_time                                            -
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_IDX_SVC_ID_TIME_INFO_T
{
    UINT16  ui2_idx;
    UINT16  ui2_svc_id;
    TIME_T  t_time;
}   DVB_SI_IDX_SVC_ID_TIME_INFO_T;


/* This structure contains a tables original network and transport stream id 
   values. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_ON_TS_ID_INFO_T
 *  @brief  This structure contains a tables original network and transport stream id values.
 *  @code
 *  typedef struct _DVB_SI_ON_TS_ID_INFO_T
 *  {
 *      UINT16  ui2_on_id;
 *      UINT16  ui2_ts_id;
 *  }   DVB_SI_ON_TS_ID_INFO_T;
 *  @endcode
 *  @li@c  ui2_on_id                                         -on_id
 *  @li@c  ui2_ts_id                                         -ts_id
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_ON_TS_ID_INFO_T
{
    UINT16  ui2_on_id;
    UINT16  ui2_ts_id;
}   DVB_SI_ON_TS_ID_INFO_T;


/* This structure contains a tables original network,  transport stream and 
   service id values. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_ON_TS_SVC_ID_INFO_T
 *  @brief  This structure contains a tables original network,  transport stream and 
 *          service id values.
 *  @code
 *  typedef struct _DVB_SI_ON_TS_SVC_ID_INFO_T
 *  {
 *      UINT16  ui2_on_id;
 *      UINT16  ui2_ts_id;
 *      UINT16  ui2_svc_id;
 *  }   DVB_SI_ON_TS_SVC_ID_INFO_T;
 *  @endcode
 *  @li@c  ui2_on_id                                         -on_id
 *  @li@c  ui2_ts_id                                         -ts_is
 *  @li@c  ui2_svc_id                                        -service id
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_ON_TS_SVC_ID_INFO_T
{
    UINT16  ui2_on_id;
    UINT16  ui2_ts_id;
    UINT16  ui2_svc_id;
}   DVB_SI_ON_TS_SVC_ID_INFO_T;


/* This structure contains a tables original network, transport stream and 
   service id values. In addition, this structure holds a time, which is 
   used to acquire the schedule data of a specific period. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_ON_TS_SVC_ID_TIME_INFO_T
 *  @brief  This structure contains a tables original network, transport stream and 
 *          service id values. In addition, this structure holds a time, which is 
 *          used to acquire the schedule data of a specific period. 
 *  @code
 *  typedef struct _DVB_SI_ON_TS_SVC_ID_TIME_INFO_T
 *  {
 *      UINT16  ui2_on_id;
 *      UINT16  ui2_ts_id;
 *      UINT16  ui2_svc_id;
 *      TIME_T  t_time;
 *  }   DVB_SI_ON_TS_SVC_ID_TIME_INFO_T;
 *  @endcode
 *  @li@c  ui2_on_id                                         -on_id
 *  @li@c  ui2_ts_id                                         -ts_id
 *  @li@c  ui2_svc_id                                        -service id
 *  @li@c  t_time                                            -schedule time
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_ON_TS_SVC_ID_TIME_INFO_T
{
    UINT16  ui2_on_id;
    UINT16  ui2_ts_id;
    UINT16  ui2_svc_id;
    TIME_T  t_time;
}   DVB_SI_ON_TS_SVC_ID_TIME_INFO_T;


/* This structure contains a tables original network, transport stream and 
   service id values. In addition, this structure holds a time, which is 
   used to acquire the schedule data of a specific period. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_ON_TS_SVC_ID_SEC_INFO_T
 *  @brief  This structure contains a tables original network, transport stream and 
 *          service id values. In addition, this structure holds a time, which is 
 *          used to acquire the schedule data of a specific period. 
 *  @code
 *  typedef struct _DVB_SI_ON_TS_SVC_ID_SEC_INFO_T
 *  {
 *     UINT16  ui2_on_id;
 *     UINT16  ui2_ts_id;
 *     UINT16  ui2_svc_id;
 *     UINT8   ui1_tbl_id;
 *     UINT8   ui1_sec_num;
 *  }   DVB_SI_ON_TS_SVC_ID_SEC_INFO_T;
 *
 *  @endcode
 *  @li@c  ui2_on_id                                         -on_id
 *  @li@c  ui2_ts_id                                         -ts_id
 *  @li@c  ui2_svc_id                                        -service id
 *  @li@c  
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_ON_TS_SVC_ID_SEC_INFO_T
{
    UINT16  ui2_version;
    UINT16  ui2_on_id;
    UINT16  ui2_ts_id;
    UINT16  ui2_svc_id;
    UINT8   ui1_tbl_id;
    UINT8   ui1_sec_num;
    BOOL    b_all_sections;
}   DVB_SI_ON_TS_SVC_ID_SEC_INFO_T;



/* Possible values of ui1_flags of DVB_SI_SVC_ENTRY_INFO_T */
#define SVC_FLAG_STATUS_UNDEFINED       ((UINT8) 0x00)    /**< flag:undefined       */
#define SVC_FLAG_NOT_RUNNING            ((UINT8) 0x01)    /**< flag:not running       */
#define SVC_FLAG_SECONDS_LATER          ((UINT8) 0x02)    /**< flag:second later       */
#define SVC_FLAG_PAUSING                ((UINT8) 0x03)    /**< flag:pause       */
#define SVC_FLAG_RUNNING                ((UINT8) 0x04)    /**< flag:running       */
#define SVC_FLAG_CA_SCRAMBLED           ((UINT8) 0x08)    /**< flag:CA scrambled       */
#define SVC_FLAG_EIT_S_FLAG             ((UINT8) 0x10)    /**< flag:EIT schedule       */
#define SVC_FLAG_EIT_PF_FLAG            ((UINT8) 0x20)    /**< flag:EIT PF      */

#define SVC_MASK_RUNNING_STATUS         ((UINT8) 0x07)    /**< flag:running status       */

/* This structure contains all information of a SDT table objects service 
   loop. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_SVC_ENTRY_INFO_T
 *  @brief  This structure contains all information of a SDT table objects service 
 *          loop.
 *  @code
 *  typedef struct _DVB_SI_SVC_ENTRY_INFO_T
 *  {
 *      UINT16  ui2_svc_id;
 *      UINT8   ui1_flags;
 *      UINT8   ui1_user_def_flags;
 *  }   DVB_SI_SVC_ENTRY_INFO_T;
 *  @endcode
 *  @li@c  ui2_svc_id                                        -service id
 *  @li@c  ui1_flags                                         -flag
 *  @li@c  ui1_user_def_flags                                -use defined flags for ISDB used
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_SVC_ENTRY_INFO_T
{
    UINT16  ui2_svc_id;
    UINT8   ui1_flags;

   /* For ISDB: Each broadcaster can define this 3 bits field individually as 
    * the extension to indicate whether it transmits EIT or not.*/ /* dyin: 081030 */
    UINT8   ui1_user_def_flags;/*low three bits are used*/

}   DVB_SI_SVC_ENTRY_INFO_T;


/* This structure contains a tables generic TS description and a service 
   id value. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_TS_DESCR_SVC_ID_INFO_T
 *  @brief  This structure contains a tables generic TS description and a service 
 *  id value.
 *  @code
 *  typedef struct _DVB_SI_TS_DESCR_SVC_ID_INFO_T
 *  {
 *      TS_DESCR_T  t_ts_descr;
 *      UINT16  ui2_svc_id;
 *  }   DVB_SI_TS_DESCR_SVC_ID_INFO_T;
 *  @endcode
 *  @li@c  t_ts_descr                                        -ts descript,reference TS_DESCR_T
 *  @li@c  ui2_svc_id                                        -service id
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_TS_DESCR_SVC_ID_INFO_T
{
    TS_DESCR_T  t_ts_descr;

    UINT16  ui2_svc_id;
}   DVB_SI_TS_DESCR_SVC_ID_INFO_T;


/* This structure contains a tables generic TS description and a service 
   id values. In addition, this structure holds a time, which is used to 
   acquire the schedule data of a specific period. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_TS_DESCR_SVC_ID_TIME_INFO_T
 *  @brief  This structure contains a tables generic TS description and a service 
 *          id values. In addition, this structure holds a time, which is used to 
 *          acquire the schedule data of a specific period.
 *  @code
 *  typedef struct _DVB_SI_TS_DESCR_SVC_ID_TIME_INFO_T
 *  {
 *      TS_DESCR_T  t_ts_descr;
 *      UINT16  ui2_svc_id;
 *      TIME_T  t_time;
 *  }   DVB_SI_TS_DESCR_SVC_ID_TIME_INFO_T;
 *  @endcode
 *  @li@c  t_ts_descr                                        -ts descript,reference TS_DESCR_T
 *  @li@c  ui2_svc_id                                        -service id
 *  @li@c  t_time                                            -schedule time
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_TS_DESCR_SVC_ID_TIME_INFO_T
{
    TS_DESCR_T  t_ts_descr;

    UINT16  ui2_svc_id;
    TIME_T  t_time;
}   DVB_SI_TS_DESCR_SVC_ID_TIME_INFO_T;


/* This structure contains a tables service id value and a time, which 
   is used to acquire the schedule data of a specific period. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_SVC_ID_TIME_INFO_T
 *  @brief  This structure contains a tables service id value and a time, which 
 *          is used to acquire the schedule data of a specific period. 
 *  @code
 *  typedef struct _DVB_SI_SVC_ID_TIME_INFO_T
 *  {
 *      UINT16  ui2_svc_id;
 *      TIME_T  t_time;
 *  }   DVB_SI_SVC_ID_TIME_INFO_T;
 *  @endcode
 *  @li@c  ui2_svc_id                                        -service id
 *  @li@c  t_time                                            -schedule time
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_SVC_ID_TIME_INFO_T
{
    UINT16  ui2_svc_id;
    TIME_T  t_time;
}   DVB_SI_SVC_ID_TIME_INFO_T;


/* This structure contains the end time of EIT-S information, which is 
   just an estimated value if the b_true_end_time value is FALSE and 
   clients should load this period of schedule information in order to get 
   the true end time. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_SCHED_END_TIME_INFO_T
 *  @brief  This structure contains the end time of EIT-S information, which is 
 *          just an estimated value if the b_true_end_time value is FALSE and 
 *          clients should load this period of schedule information in order to get 
 *          the true end time.
 *  @code
 *  typedef struct _DVB_SI_SCHED_END_TIME_INFO_T 
 *  { 
 *      TIME_T  t_time;
 *      BOOL    b_true_end_time; 
 *  }   DVB_SI_SCHED_END_TIME_INFO_T; 
 *  @endcode
 *  @li@c  t_time                                            -EIT-S end time
 *  @li@c  b_true_end_time                                   -
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_SCHED_END_TIME_INFO_T 
{ 
    TIME_T  t_time;
    BOOL    b_true_end_time; 
}   DVB_SI_SCHED_END_TIME_INFO_T; 


/* This structure contains all information of a RST table. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_EVT_RUNNING_STATUS_INFO_T
 *  @brief  This structure contains all information of a RST table.
 *  @code
 *  typedef struct _DVB_SI_EVT_RUNNING_STATUS_INFO_T
 *  {
 *      UINT16  ui2_ts_id;
 *      UINT16  ui2_on_id;
 *      UINT16  ui2_svc_id;
 *      UINT16  ui2_evt_id;
 *      UINT8   ui1_running_status;
 *  }   DVB_SI_EVT_RUNNING_STATUS_INFO_T;
 *  @endcode
 *  @li@c  ui2_ts_id                                         -ts id
 *  @li@c  ui2_on_id                                         -on id
 *  @li@c  ui2_svc_id                                        -service id
 *  @li@c  ui2_evt_id                                        -event id
 *  @li@c  ui1_running_status                                -running status
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_EVT_RUNNING_STATUS_INFO_T
{
    UINT16  ui2_ts_id;
    UINT16  ui2_on_id;
    UINT16  ui2_svc_id;
    UINT16  ui2_evt_id;
    UINT8   ui1_running_status;
}   DVB_SI_EVT_RUNNING_STATUS_INFO_T;


/* Possible values of requested text mode. */
/*------------------------------------------------------------------*/
/*! @enum DVB_SI_GET_TXT_MODE_T
 *  @brief
 *  @code
 *  typedef enum
 *  {
 *      DVB_SI_GET_TXT_NORMAL,
 *      DVB_SI_GET_TXT_SHORT
 *  }   DVB_SI_GET_TXT_MODE_T;
 *  @endcode
 *  @li@c  DVB_SI_GET_TXT_NORMAL                             -normal text
 *  @li@c  DVB_SI_GET_TXT_SHORT                              -short text
 */
/*------------------------------------------------------------------*/
typedef enum
{
    DVB_SI_GET_TXT_NORMAL,
    DVB_SI_GET_TXT_SHORT
}   DVB_SI_GET_TXT_MODE_T;

/* This structure contains the UTF-8 string as well as the length of 
   the string. */
/*------------------------------------------------------------------*/
/*! @struct DVB_SI_TXT_INFO_T
 *  @brief  This structure contains the UTF-8 string as well as the length of 
 *          the string.
 *  @code
 *  typedef struct _DVB_SI_TXT_INFO_T
 *  {
 *      CHAR*               ps_txt;
 *      SIZE_T*             pz_txt_len;
 *      ISO_3166_COUNT_T    t_count_code;
 *  }   DVB_SI_TXT_INFO_T;
 *  @endcode
 *  @li@c  ps_txt                                            -UTF8 text buffer
 *  @li@c  pz_txt_len                                        -length
 *  @li@c  t_count_code                                      -country code
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_TXT_INFO_T
{
    CHAR*               ps_txt;
    SIZE_T*             pz_txt_len;
    ISO_3166_COUNT_T    t_count_code;
    E_DVB_TEXT_CHAR_TBL e_char_table;
}   DVB_SI_TXT_INFO_T;

/*------------------------------------------------------------------*/
/*! @struct DVB_SI_PID_OUI_INFO_T
 *  @brief This structure contains PID and OUI information
 *  @code
 *  typedef struct _DVB_SI_PID_OUI_INFO_T
 *  {
 *      MPEG_2_PID_T        t_pid;
 *      UINT32              ui4_oui;
 *  }   DVB_SI_PID_OUI_INFO_T;
 *  @endcode
 *  @li@c  t_pid                                             -pid
 *  @li@c  ui4_oui                                           -oui number
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_PID_OUI_INFO_T
{
    MPEG_2_PID_T        t_pid;
    UINT32              ui4_oui;
}   DVB_SI_PID_OUI_INFO_T;

/*------------------------------------------------------------------*/
/*! @struct DVB_SI_EIT_QUERY_INFO_T
 *  @brief 
 *  @code
 *  typedef struct _DVB_SI_EIT_QUERY_INFO_T
 *  {
 *      BOOL        b_actual_only;
 *      UINT8       ui1_tbl_id;
 *  }   DVB_SI_EIT_QUERY_INFO_T;
 *  @endcode
 *  @li@c 
 *  @li@c  
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_EIT_QUERY_INFO_T
{
    BOOL        b_actual_only;
    UINT8       ui1_tbl_id;
}   DVB_SI_EIT_QUERY_INFO_T;

/*------------------------------------------------------------------*/
/*! @struct DVB_SI_AIT_APP_ID_T
 *  @brief 
 *  @code
 *  typedef struct _DVB_SI_AIT_APP_ID_T
 *  {
 *      UINT32     ui4_org_id;
 *      UINT16     ui2_app_id;
 *  }   DVB_SI_AIT_APP_ID_T;
 *  @endcode
 *  @li@c 
 *  @li@c  
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_AIT_APP_ID_T
{
    UINT32     ui4_org_id;
    UINT16     ui2_app_id;
}   DVB_SI_AIT_APP_ID_T;

/*------------------------------------------------------------------*/
/*! @struct DVB_SI_AIT_APP_ID_CTRL_CODE_T
 *  @brief 
 *  @code
 *  typedef struct _DVB_SI_AIT_APP_ID_CTRL_CODE_T
 *  {
 *      DVB_SI_AIT_APP_ID_T    t_app_id;
 *      UINT8                          ui1_ctrl_code;
 *  }   DVB_SI_AIT_APP_ID_CTRL_CODE_T;
 *  @endcode
 *  @li@c 
 *  @li@c  
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_AIT_APP_ID_CTRL_CODE_T
{
    UINT32                 ui4_org_id;
    UINT16                 ui2_app_id;
    UINT8                  ui1_ctrl_code;
} DVB_SI_AIT_APP_ID_CTRL_CODE_T;



/*------------------------------------------------------------------*/
/*! @struct DVB_SI_PID_APP_TYPE_T
 *  @brief 
 *  @code
 *  typedef struct _DVB_SI_PID_APP_TYPE_T
 *  {
 *      UINT32     ui4_org_id;
 *      UINT16     ui2_app_id;
 *  }   DVB_SI_PID_APP_TYPE_T;
 *  @endcode
 *  @li@c 
 *  @li@c  
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_PID_APP_TYPE_T
{
    MPEG_2_PID_T  t_pid;
    UINT16        ui2_app_type;
}   DVB_SI_PID_APP_TYPE_T;


/*------------------------------------------------------------------*/
/*! @struct DVB_SI_PID_SERVICE_LIST_ID_TYPE_T
 *  @brief 
 *  @code
 *  typedef struct _DVB_SI_PID_SERVICE_LIST_ID_TYPE_T
 *  {
 *      MPEG_2_PID_T  t_pid;
 *      UINT16        ui2_service_list_id;
 *  }   DVB_SI_PID_SERVICE_LIST_ID_TYPE_T;
 *  @endcode
 *  @li@c 
 *  @li@c  
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_PID_SERVICE_LIST_ID_TYPE_T
{
    MPEG_2_PID_T  t_pid;
    UINT16        ui2_service_list_id;
}   DVB_SI_PID_SERVICE_LIST_ID_TYPE_T;



/*------------------------------------------------------------------*/
/*! @struct DVB_SI_PID_OPERATOR_NETWORK_ID_T
 *  @brief 
 *  @code
 *  typedef struct _DVB_SI_PID_SERVICE_LIST_ID_TYPE_T
 *  {
 *      MPEG_2_PID_T  t_pid;
 *      UINT16        ui2_operator_network_id;
 *  }   DVB_SI_PID_OPERATOR_NETWORK_ID_T;
 *  @endcode
 *  @li@c 
 *  @li@c  
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_PID_OPERATOR_NETWORK_ID_T
{
    MPEG_2_PID_T  t_pid;
    UINT16        ui2_operator_network_id;
}   DVB_SI_PID_OPERATOR_NETWORK_ID_T;




/*------------------------------------------------------------------*/
/*! @struct DVB_SI_SGT_SVC_ENTRY_INFO_T
 *  @brief  This structure contains a tables original network,  transport stream and 
 *          service id values.
 *  @code
 *  typedef struct _DVB_SI_SGT_SVC_ENTRY_INFO_T
 *  {
 *      DVB_SI_ON_TS_SVC_ID_INFO_T      t_on_ts_svc_id;
 *      UINT16                          ui2_logic_channel_number;
 *      BOOL                            b_visible_service_flag;
 *      BOOL                            b_new_service_flag;
 *      UINT16                          ui2_genre_code;
 *  }   DVB_SI_SGT_SVC_ENTRY_INFO_T;
 *  @endcode
 *  @li@c  ui2_logic_channel_number                              -ui2_on_id
 *  @li@c  b_visible_service_flag                                -b_visible_service_flag
 *  @li@c  b_new_service_flag                                    -b_new_service_flag id
 *  @li@c  ui2_genre_code                                        -ui2_genre_code id
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_SGT_SVC_ENTRY_INFO_T
{
    DVB_SI_ON_TS_SVC_ID_INFO_T      t_on_ts_svc_id;
    UINT16                          ui2_logic_channel_number;
    BOOL                            b_visible_service_flag;
    BOOL                            b_new_service_flag;
    UINT16                          ui2_genre_code;
}   DVB_SI_SGT_SVC_ENTRY_INFO_T;


/*------------------------------------------------------------------*/
/*! @struct DVB_SI_FST_SVC_ENTRY_INFO_T
 *  @brief  This structure contains a tables original network,  transport stream and 
 *          service id values.
 *  @code
 *
 *  typedef struct _DVB_SI_FST_SVC_ENTRY_INFO_T
 *  {
 *      DVB_SI_ON_TS_SVC_ID_INFO_T      t_on_ts_svc_id;
 *      UINT16                          ui2_default_video_pid;
 *      UINT16                          ui2_default_audio_pid;
 *      UINT16                          ui2_default_video_ecm_pid;
 *      UINT16                          ui2_default_audio_ecm_pid;
 *      UINT16                          ui2_default_pcr_pid;
 *  }   DVB_SI_FST_SVC_ENTRY_INFO_T;
 *  @endcode
 *  @li@c  ui2_logic_channel_number                              -ui2_on_id
 *  @li@c  b_visible_service_flag                                -b_visible_service_flag
 *  @li@c  b_new_service_flag                                    -b_new_service_flag id
 *  @li@c  ui2_genre_code                                        -ui2_genre_code id
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_FST_SVC_ENTRY_INFO_T
{
    DVB_SI_ON_TS_SVC_ID_INFO_T      t_on_ts_svc_id;
    UINT16                          ui2_default_video_pid;
    UINT16                          ui2_default_audio_pid;
    UINT16                          ui2_default_video_ecm_pid;
    UINT16                          ui2_default_audio_ecm_pid;
    UINT16                          ui2_default_pcr_pid;
}   DVB_SI_FST_SVC_ENTRY_INFO_T;

typedef struct _DVB_SI_TCDW_DISASTER_ATTRI_T
{
    UINT8    ui1_package_id;
    UINT8    ui1_authority;
    UINT16   ui2_disaster_code;
    UINT8    ui1_disaster_code_len;
    CHAR*    char_disaster_code;
    UINT8    ui1_disaster_position_len;
    CHAR*    char_disaster_position;
    UINT8    ui1_disaster_date_len;
    CHAR*    char_disaster_date;
    UINT8    ui1_disaster_characterstic_len;
    CHAR*    char_disaster_characterstic;
}  DVB_SI_TCDW_DISASTER_ATTRI_T;

typedef struct _DVB_SI_TCDW_DISASTER_LEN_T
{
    UINT8    ui1_disaster_code_len;
    UINT8    ui1_disaster_position_len;
    UINT8    ui1_disaster_date_len;
    UINT8    ui1_disaster_characterstic_len;
}  DVB_SI_TCDW_DISASTER_LEN_T;

typedef struct _DVB_SI_TRDW_HEAD_T
{
    UINT16      ui2_disaster_code;
    UINT8       ui1_location_type_code;
    UINT8       ui1_package_id;
}   DVB_SI_TRDW_HEAD_T;

typedef struct _DVB_SI_PK_IDX_T
{
    UINT8       ui1_package_id;
    UINT16      ui2_parameter;
}   DVB_SI_PK_IDX_T;

typedef struct _DVB_SI_TRDW_LOCATION_ATTRI_T
{
    UINT8       location_code[3];
    UINT8       ui1_location_code_len;
    CHAR*       location_string;
}   DVB_SI_TRDW_LOCATION_ATTRI_T;

typedef struct _DVB_SI_TMDW_HEAD_T
{
    UINT8       ui1_location_type_code;
    UINT8       ui1_package_id;
    UINT8       ui1_index;
}   DVB_SI_TMDW_HEAD_T;

typedef struct _DVB_SI_TMDW_MSG_INFO_T
{
    UINT16      ui2_msg_info_len;
    CHAR*       char_msg_info;
}   DVB_SI_TMDW_MSG_INFO_T;



/*------------------------------------------------------------------*/
/*! @struct DVB_SI_CMT_QUERY_INFO_T
 *  @brief 
 *  @code
 *  typedef struct _DVB_SI_CMT_QUERY_INFO_T
 *  {
 *      MPEG_2_PID_T  t_pid;
 *      UINT8       ui1_tbl_id;
 *  }   DVB_SI_CMT_QUERY_INFO_T;
 *  @endcode
 *  @li@c 
 *  @li@c  
 */
/*------------------------------------------------------------------*/
typedef struct _DVB_SI_CMT_QUERY_INFO_T
{
    MPEG_2_PID_T  t_pid;
    UINT8       ui1_tbl_id;
}   DVB_SI_CMT_QUERY_INFO_T;

typedef struct _DVB_SI_TRDW_QUERY_INFO_T
{
    MPEG_2_PID_T    t_pid;
    UINT8           ui1_tbl_id;
}   DVB_SI_PID_TBLID_QUERY_INFO_T;

typedef struct _DVB_SI_CLT_QUERY_INFO_T
{
    MPEG_2_PID_T  t_pid;
    UINT8       ui1_tbl_id;
}   DVB_SI_CLT_QUERY_INFO_T;

typedef enum _TXT_TUNER_TYPE
{
    TUNER_TYPE_UNKNOW,
    TUNER_TYPE_T,
    TUNER_TYPE_C,
    TUNER_TYPE_S,
} TXT_TUNER_TYPE;


/*Character Table Exception*/
typedef enum _CHAR_TABLE_EXCEPTION
{
    CHAR2_NA, /*Not Applicable*/
    CHAR2_HUN, /*Replace ISO-8859-9 with ISO-8859-2*/
    CHAR2_POL, /*Replace ISO-6937 with ISO-8859-5*/
} CHAR_TABLE_EXCEPTION;

/*Character Table Estimation Algorithm*/
typedef enum _CHAR_TABLE_ESTMATION_ALGORITHM
{
    CHAR3_NA, /*Not Applicable*/
    CHAR3_V2, /*Apply V2 algorithm*/
    CHAR3_V2_ALPHA, /*Apply V2 alpha algorithm*/
} CHAR_TABLE_ESTMATION_ALGORITHM;

typedef struct _TXT_DECODE_CONFIG
{
    ISO_3166_COUNT_T* pt_country;
    TXT_TUNER_TYPE e_type;
    UINT32 ui4_operator;
    E_DVB_TEXT_CHAR_TBL e_char_table;
    CHAR_TABLE_EXCEPTION e_table_exception;
    CHAR_TABLE_ESTMATION_ALGORITHM e_algorithm;
    BOOL        b_delete_extra_space;
} TXT_DECODE_CONFIG;
typedef INT32 (*x_dvb_si_custom_coding_func) (ISO_3166_COUNT_T              t_country_code,
                                              E_DVB_TEXT_CHAR_TBL*          pe_coding_flag);

extern INT32 get_special_coding(
                         CHAR*  pt_buffer,
                         UINT32 ui4_buffer_len,
                         ISO_3166_COUNT_T pt_country,
                         TXT_TUNER_TYPE e_tuner_type,
                         ISO_639_LANG_T* pt_lang,
                         UINT32 ui4_operator,
                         BOOL   b_has_coding_flag,
                         E_DVB_TEXT_CHAR_TBL e_char_table_with_code,
                         E_DVB_TEXT_CHAR_TBL* pe_char_table,
                         CHAR_TABLE_EXCEPTION* pe_table_exception,
                         CHAR_TABLE_ESTMATION_ALGORITHM* pe_algorithm,
                         BOOL*  pb_delete_extra_space,
	                     BOOL b_for_ci_mmi_coding
                         );


#endif /* _U_DVB_SI_H_ */

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

