/* 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_brdcst.h 
 *  $RCSfile: $
 *  $Revision: #2 $
 *  $Date: 2015/10/12 $
 *  $Author: chenglu.xu $
 *  
 *  @par Description:
 *         This header file contains the Broadcast Connection Handler specific
 *         definitions that are exported.
 */
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/*! @defgroup groupMW_CONN_MNGR_BRDCST Broadcasting Handler
 *  @ingroup groupMW_CONN_MNGR
 *  @brief Provides a unified interface for digital TV connection
 *  %This module allows an application to create and control digital TV connection
 *   - including these sub modules:
 *  @see groupMW
 *  @{ 
 */
/*----------------------------------------------------------------------------*/

#ifndef _U_BRDCST_H_
#define _U_BRDCST_H_


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

#include "u_common.h"
#include "u_cm.h"
#include "u_handle.h"
#include "u_tuner.h"
#include "u_scdb.h"
#include "u_tm.h"


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

#define BRDCST_HANDLER_DEFAULT_NAME "brdcst"    /**< Define the default name of broadcast handler       */

/* Connection command codes */
#define BRDCST_CONN_OFFSET                  ((CM_COMMAND_CODE_T) 0x80000000)    /**< Define the command code offset of broadcast handler                        */
#define BRDCST_CONN_SVC_LST_ID              (BRDCST_CONN_OFFSET +  0)           /**< Define the command code for SVL ID                                         */
#define BRDCST_CONN_SVC_LST_NAME            (BRDCST_CONN_OFFSET +  1)           /**< Define the command code for SVL name                                       */
#define BRDCST_CONN_SVL_REC_ID              (BRDCST_CONN_OFFSET +  2)           /**< Define the command code for SVL record ID                                  */
#define BRDCST_CONN_SVC_ID                  (BRDCST_CONN_OFFSET +  3)           /**< Define the command code for service ID                                     */
#define BRDCST_CONN_TS_LST_ID               (BRDCST_CONN_OFFSET +  4)           /**< Define the command code for TSL ID                                         */
#define BRDCST_CONN_TS_LST_NAME             (BRDCST_CONN_OFFSET +  5)           /**< Define the command code for TSL name                                       */
#define BRDCST_CONN_TSL_REC_ID              (BRDCST_CONN_OFFSET +  6)           /**< Define the command code for TSL record ID                                  */
#define BRDCST_CONN_SAT_LST_ID              (BRDCST_CONN_OFFSET +  7)           /**< Define the command code for TSL record ID                                  */
#define BRDCST_CONN_SAT_LST_NAME            (BRDCST_CONN_OFFSET +  8)           /**< Define the command code for TSL record ID                                  */
#define BRDCST_CONN_SATL_REC_ID             (BRDCST_CONN_OFFSET +  9)           /**< Define the command code for TSL record ID                                  */
#define BRDCST_CONN_SIGNAL_LOST_DISCONNECT  (BRDCST_CONN_OFFSET + 10)           /**< Define the command code for disconnect condition when signal lose          */
#define BRDCST_CONN_DELIVERY_SYS            (BRDCST_CONN_OFFSET + 11)           /**< Define the command code for delivery system                                */
#define BRDCST_CONN_FREQUENCY               (BRDCST_CONN_OFFSET + 12)           /**< Define the command code for frequency                                      */
#define BRDCST_CONN_SYM_RATE                (BRDCST_CONN_OFFSET + 13)           /**< Define the command code for symbol rate                                    */
#define BRDCST_CONN_FEC_OUTER               (BRDCST_CONN_OFFSET + 14)           /**< Define the command code for FEC outer                                      */
#define BRDCST_CONN_FEC_INNER               (BRDCST_CONN_OFFSET + 15)           /**< Define the command code for FEC inner                                      */
#define BRDCST_CONN_MODULATION              (BRDCST_CONN_OFFSET + 16)           /**< Define the command code for modulation                                     */
#define BRDCST_CONN_ORBITAL_POSITION        (BRDCST_CONN_OFFSET + 17)           /**< Define the command code for orbital position                               */
#define BRDCST_CONN_POLARIZATION            (BRDCST_CONN_OFFSET + 18)           /**< Define the command code for polarization                                   */
#define BRDCST_CONN_BANDWIDTH               (BRDCST_CONN_OFFSET + 19)           /**< Define the command code for bandwidth                                      */
#define BRDCST_CONN_HIERARCHY               (BRDCST_CONN_OFFSET + 20)           /**< Define the command code for hierarchy                                      */
#define BRDCST_CONN_22K                     (BRDCST_CONN_OFFSET + 21)
#define BRDCST_CONN_TONE_BURST              (BRDCST_CONN_OFFSET + 22)
#define BRDCST_CONN_PORT                    (BRDCST_CONN_OFFSET + 23)
#define BRDCST_CONN_CODE_RATE_HP            (BRDCST_CONN_OFFSET + 24)           /**< Define the command code for code rate HP                                   */
#define BRDCST_CONN_CODE_RATE_LP            (BRDCST_CONN_OFFSET + 25)           /**< Define the command code for code rate LP                                   */
#define BRDCST_CONN_GUARD_INTERVAL          (BRDCST_CONN_OFFSET + 26)           /**< Define the command code for guard interval                                 */
#define BRDCST_CONN_TRANS_MODE              (BRDCST_CONN_OFFSET + 27)           /**< Define the command code for trans mode                                     */
#define BRDCST_CONN_OTHER_FREQ_FLAG         (BRDCST_CONN_OFFSET + 28)           /**< Define the command code for other freq flag                                */
#define BRDCST_CONN_PAT_TIME_OUT            (BRDCST_CONN_OFFSET + 29)           /**< Define the command code for the time out of PAT table                      */
#define BRDCST_CONN_PMT_TIME_OUT            (BRDCST_CONN_OFFSET + 30)           /**< Define the command code for the time out of PMT table                      */
#define BRDCST_CONN_MGT_TIME_OUT            (BRDCST_CONN_OFFSET + 31)           /**< Define the command code for the time out of MGT table                      */
#define BRDCST_CONN_CVCT_TIME_OUT           (BRDCST_CONN_OFFSET + 32)           /**< Define the command code for the time out of CVCT table                     */
#define BRDCST_CONN_TVCT_TIME_OUT           (BRDCST_CONN_OFFSET + 33)           /**< Define the command code for the time out of TVCT table                     */
#define BRDCST_CONN_EIT_TIME_OUT            (BRDCST_CONN_OFFSET + 34)           /**< Define the command code for the time out of EIT table                      */
#define BRDCST_CONN_EIT_RETRY_DELAY         (BRDCST_CONN_OFFSET + 35)           /**< Define the command code for the retry delay of EIT table                   */
#define BRDCST_CONN_DISC_IF_COMP_BUSY       (BRDCST_CONN_OFFSET + 36)           /**< Define the command code for the disconnect condition when component busy   */
#define BRDCST_CONN_DISC_SUB_CONNECTIONS    (BRDCST_CONN_OFFSET + 37)           /**< Define the command code for the disconnect condition of sub connections    */
#define BRDCST_CONN_DISC_IF_NO_SERVICE      (BRDCST_CONN_OFFSET + 38)           /**< Define the command code for the disconnect condition when no service       */
#define BRDCST_CONN_HIERARCHY_PRIORITY      (BRDCST_CONN_OFFSET + 39)           /**< Define the command code for hierarchy priority                             */
#define BRDCST_CONN_REUSE_CONNECTION        (BRDCST_CONN_OFFSET + 40)           /**< Define the command code for reuse connection                               */
#define BRDCST_CONN_TUNER_CONN_MODE         (BRDCST_CONN_OFFSET + 41)           /**< Define the command code for tuner connection mode                          */
#define BRDCST_CONN_TUNER_NO_RIGHTS_OK      (BRDCST_CONN_OFFSET + 42)           /**< Define the command code for tuner no rights ok                             */
#define BRDCST_CONN_2_LANGUAGES_1_STREAM    (BRDCST_CONN_OFFSET + 43)           /**< Define the command code for 2 audio languages in one stream                */
#define BRDCST_CONN_N_LANGUAGES_1_STREAM    (BRDCST_CONN_OFFSET + 44)           /**< Define the command code for N audio languages in one stream                */
#define BRDCST_CONN_DUAL_MONO_FAKE_STEREO   (BRDCST_CONN_OFFSET + 45)           /**< Define the command code for dual mono fake stereo                          */
#define BRDCST_CONN_DUAL_MONO_MIXED_STEREO  (BRDCST_CONN_OFFSET + 46)           /**< Define the command code for mixed A+B                                   */
/* Riks-TV requirement - Begin */
#define BRDCST_CONN_ALTER_FREQ_TUNE         (BRDCST_CONN_OFFSET + 47)           /**< Define the command code for tune alternate frequency                       */
/* Riks-TV requirement - End */
#define BRDCST_CONN_DISEQ_TYPE              (BRDCST_CONN_OFFSET + 48)
#define BRDCST_CONN_CASCADE_TYPE            (BRDCST_CONN_OFFSET + 49)
#define BRDCST_CONN_CASCADE_PORT            (BRDCST_CONN_OFFSET + 50)
#define BRDCST_CONN_DVB_T_T2_MODE           (BRDCST_CONN_OFFSET + 51)
#define BRDCST_CONN_DISC_IF_TSL_UPDATE      (BRDCST_CONN_OFFSET + 52)           /**< Define the command code tsl update                       */
#define BRDCST_CONN_DVBT2_PLP_ID            (BRDCST_CONN_OFFSET + 53)

#define BRDCST_CONN_SUBSTREAM_FAKE_STEREO   (BRDCST_CONN_OFFSET + 54)           /**< Define the command code for E-AC3 substream  fake stereo   */
#define BRDCST_CONN_AUDIO_AD_TO_INDEPENDENT_AD      (BRDCST_CONN_OFFSET + 55)           /* Define the command code ad to nomal, used in finand for pre-mixed audio*/
#define BRDCST_CONN_START_FREQ              (BRDCST_CONN_OFFSET + 56)
#define BRDCST_CONN_END_FREQ                (BRDCST_CONN_OFFSET + 57)
#define BRDCST_CONN_WITHOUT_SCDB            (BRDCST_CONN_OFFSET + 58)           /**< Define the command code tsl update                       */
#define BRDCST_CONN_BE_PRE_CONN             (BRDCST_CONN_OFFSET + 59)           /**< Define the command code tsl update                       */
#define BRDCST_CONN_ATSC_AC3_AD_TO_IND_AD   (BRDCST_CONN_OFFSET + 60)           /* Define the command code ATSC ac3 ad to nomal, used in atsc pre-mixed audio*/
#define BRDCST_CONN_UNKNOWN_IS_ATSC_SCTE    (BRDCST_CONN_OFFSET + 61)           /**< Define the command code for unknown ATSC/SCTE                             */
#define BRDCST_CONN_DEL_DUAL_LABELING_AD    (BRDCST_CONN_OFFSET + 62)           /**< Define the command code for delete dual-labeling AD audio                 */
#define BRDCST_CONN_TUNING_MODE             (BRDCST_CONN_OFFSET + 63)           /* Define the command code for tuning mode (A2D,D2D)*/
#define BRDCST_CONN_BAND_FREQUENCY          (BRDCST_CONN_OFFSET + 64)
#define BRDCST_CONN_B_HIGH_LOW_BAND         (BRDCST_CONN_OFFSET + 65)
#define BRDCST_CONN_USER_BAND               (BRDCST_CONN_OFFSET + 66)
#define BRDCST_CONN_UNICABLE_POSITION       (BRDCST_CONN_OFFSET + 67)
#define BRDCST_CONN_UNICABLE_BANK           (BRDCST_CONN_OFFSET + 68)
#define BRDCST_CONN_IF_FREQUENCY            (BRDCST_CONN_OFFSET + 69)
#define BRDCST_CONN_MDU_LO_FREQUENCY        (BRDCST_CONN_OFFSET + 70)
#define BRDCST_CONN_MDU_TYPE                (BRDCST_CONN_OFFSET + 71)
#define BRDCST_CONN_B_CANAL_DIGITAL_TS      (BRDCST_CONN_OFFSET + 72)
#define BRDCST_CONN_TUNER_NAME              (BRDCST_CONN_OFFSET + 73)
#define BRDCST_CONN_TUNER_INFO              (BRDCST_CONN_OFFSET + 74)
#define BRDCST_CONN_PREVIOUS_TS_ID          (BRDCST_CONN_OFFSET + 75)           /** the ts id of previous frequency,  for cannel digital certification*/
#define BRDCST_CONN_ACTUAL_FREQUENCY        (BRDCST_CONN_OFFSET + 76)
#define BRDCST_CONN_CAT_TIME_OUT            (BRDCST_CONN_OFFSET + 77)           /**< Define the command code for the time out of CAT table                      */
#define BRDCST_CONN_NO_DISEQC_PRESET        (BRDCST_CONN_OFFSET + 78)
#define BRDCST_CONN_LTS_ID_MODE             (BRDCST_CONN_OFFSET + 79)           /** for msctx lts id mode */

#define BRDCST_CONN_PROGRAM_NUMBER          BRDCST_CONN_SVC_ID                  /**< Define the command code for service ID (Program ID)                        */

#define BRDCST_HANDLER_GET_OFFSET ((CM_CTRL_TYPE_T) 0x01000000)
#define BRDCST_HANDLER_SET_OFFSET (BRDCST_HANDLER_GET_OFFSET + 0x200) /*512 for GET value*/
#define BRDCST_HANDLER_GET(_x)    (CM_CTRL_HANDLER_PRIVATE_OFFSET + BRDCST_HANDLER_GET_OFFSET + (_x))   /**< brdcst handler specific commands to use with x_cm_set/get */
#define BRDCST_HANDLER_SET(_x)    (CM_CTRL_HANDLER_PRIVATE_OFFSET + BRDCST_HANDLER_SET_OFFSET + (_x))   /**< brdcst handler specific commands to use with x_cm_set/get */

/* Broadcast-specific commands to use with x_cm_set/get */
#define BRDCST_CTRL_GET_LNA_SETTING         BRDCST_HANDLER_GET(0)     /**< Define the command code to get tuner LNA setting*/
#define BRDCST_CTRL_GET_SIGNAL_LEVEL        BRDCST_HANDLER_GET(1)     /**< Define the command code to get signal level           */
#define BRDCST_CTRL_GET_DBM_SIGNAL_LEVEL    BRDCST_HANDLER_GET(2)     /**< Define the command code to get DBM signal level       */
#define BRDCST_CTRL_GET_DELIVERY_SYS        BRDCST_HANDLER_GET(3)     /**< Define the command code to get delivery system        */
#define BRDCST_CTRL_GET_CAB_TUNE_INFO       BRDCST_HANDLER_GET(4)     /**< Define the command code to get cable tuner info       */
#define BRDCST_CTRL_GET_SAT_TUNE_INFO       BRDCST_HANDLER_GET(5)     /**< Define the command code to get satellite tuner info    */
#define BRDCST_CTRL_GET_TER_TUNE_INFO       BRDCST_HANDLER_GET(6)     /**< Define the command code to terrestrial tuner info     */
#define BRDCST_CTRL_GET_AGC                 BRDCST_HANDLER_GET(7)     /**< Define the command code to get AGC                    */
#define BRDCST_CTRL_GET_DBM_SNR             BRDCST_HANDLER_GET(8)     /**< Define the command code to get DBM SNR                */
#define BRDCST_CTRL_GET_PACKET_ERRORS       BRDCST_HANDLER_GET(9)     /**< Define the command code to get packet errors          */
#define BRDCST_CTRL_GET_INTERLEAVING        BRDCST_HANDLER_GET(10)    /**< Define the command code to get interleaving           */
#define BRDCST_CTRL_GET_KHZ_CFO             BRDCST_HANDLER_GET(11)    /**< Define the command code to get KHZ CFO                */
#define BRDCST_CTRL_GET_BER                 BRDCST_HANDLER_GET(12)    /**< Define the command code to get BER                    */
#define BRDCST_CTRL_GET_RAW_SIGNAL_LEVEL    BRDCST_HANDLER_GET(13)    /**< Define the command code to get raw signal level       */
#define BRDCST_CTRL_GET_PACKET_STATUS       BRDCST_HANDLER_GET(14)    /**< Define the command code to get packet status          */
#define BRDCST_CTRL_GET_BER_TOLERANCE       BRDCST_HANDLER_GET(15)    /**< Define the command code to get BER tolerance          */
#define BRDCST_CTRL_GET_CELL_ID             BRDCST_HANDLER_GET(16)    /**< Define the command code to get cell ID                */
#define BRDCST_CTRL_GET_TUNER_STATUS        BRDCST_HANDLER_GET(17)    /**< Define the command code to get tuner status           */
#define BRDCST_CTRL_GET_CONN_FREQ           BRDCST_HANDLER_GET(18)    /**< Define the command code to get connected frequency - Riks-TV requirement */
#define BRDCST_CTRL_GET_UEC                 BRDCST_HANDLER_GET(19)    /**< Define the command code to get number of uncorrected errors at the output of the TS */
#define BRDCST_CTRL_GET_SQI                 BRDCST_HANDLER_GET(20)    /**< Define the command code to get SQI */
#define BRDCST_CTRL_GET_SSI                 BRDCST_HANDLER_GET(21)    /**< Define the command code to get SSI */
#define BRDCST_CTRL_GET_CODERATE            BRDCST_HANDLER_GET(22)    /**< Define the command code to get code rate */
#define BRDCST_CTRL_GET_AFTER_BER           BRDCST_HANDLER_GET(23)    /**< Define the command code to get post-viterbi BER */
#define BRDCST_CTRL_GET_PAT_TS_ID           BRDCST_HANDLER_GET(24)    /**< Define the command code to get TS ID in PAT */
#define BRDCST_CTRL_GET_CONN_SVC_ID         BRDCST_HANDLER_GET(25)    /**< Define the command code to get connection SVC ID */
#define BRDCST_CTRL_GET_EWS_STATUS          BRDCST_HANDLER_GET(26)    /**< Define the command code to get EWS status */
#define BRDCST_CTRL_GET_PRE_VBER            BRDCST_HANDLER_GET(27)    /**< Define the command code to get tuner pre vber*/
#define BRDCST_CTRL_GET_SCAN_PROGRESS       BRDCST_HANDLER_GET(28)    /**< Define the command code to get scan progress*/
#define BRDCST_CTRL_GET_FE_STATUS           BRDCST_HANDLER_GET(29)
#define BRDCST_CTRL_GET_DIG_DEMOD_STATUS    BRDCST_HANDLER_GET(30)    /**< Define the command code to get dig demod status*/
#define BRDCST_CTRL_GET_BER_UPPER           BRDCST_HANDLER_GET(31)    /**< Define the command code to get ber upper*/
#define BRDCST_CTRL_GET_BER_LOWER           BRDCST_HANDLER_GET(32)    /**< Define the command code to get ber lower*/
#define BRDCST_CTRL_GET_PER_UPPER           BRDCST_HANDLER_GET(33)    /**< Define the command code to get per upper*/
#define BRDCST_CTRL_GET_PER_LOWER           BRDCST_HANDLER_GET(34)    /**< Define the command code to get per lower*/
#define BRDCST_CTRL_GET_LNB_STATUS          BRDCST_HANDLER_GET(35)    /**< Define the command code to get lnb status*/
#define BRDCST_CTRL_GET_TMCC_INFO           BRDCST_HANDLER_GET(36)    /**< Define the command code to get tuner tmcc info*/
#define BRDCST_CTRL_GET_PMT_SECTION         BRDCST_HANDLER_GET(37)    /**< Define the command code to get pmt section*/
#define BRDCST_CTRL_GET_SVC_INFO            BRDCST_HANDLER_GET(38)    /**< Define the command code to get service information   */
#define BRDCST_CTRL_GET_DIGITAL_COPY_CTRL   BRDCST_HANDLER_GET(39)    /**< Define the command code to get isdb digital copy control info*/
#define BRDCST_CTRL_GET_TS_LOCK_STATUS      BRDCST_HANDLER_GET(40)    /**< Define the command code to get tuner ts lock status*/
#define BRDCST_CTRL_GET_DEMOD_LOCK_STATUS   BRDCST_HANDLER_GET(41)    /**< Define the command code to get tuner demod lock status*/
#define BRDCST_CTRL_GET_TUNER_CHIP_REVISION BRDCST_HANDLER_GET(42)    /**< Define the command code to get tuner ts lock status*/
#define BRDCST_CTRL_GET_DEMOD_CHIP_REVISION BRDCST_HANDLER_GET(43)    /**< Define the command code to get tuner demod lock status*/
#define BRDCST_CTRL_GET_LAYER_NUM           BRDCST_HANDLER_GET(44)    /**< Define the command code to get tuner ts lock status*/
#define BRDCST_CTRL_GET_ACTUAL_FREQ         BRDCST_HANDLER_GET(45)    /**< Define the command code to get tuner actual frequency*/
#define BRDCST_CTRL_GET_AGC_STATUS          BRDCST_HANDLER_GET(46)    /**< Define the command code to get agc status*/
#define BRDCST_CTRL_GET_PMT_STATUS          BRDCST_HANDLER_GET(47)    /**< Define the command code to get pmt load status*/
#define BRDCST_CTRL_GET_TYPE_22K            BRDCST_HANDLER_GET(48)    /**< Define the command code to get 22k type*/
#define BRDCST_CTRL_GET_LTS_ID              BRDCST_HANDLER_GET(49)    /**< Define the command code to get lts id*/
#define BRDCST_CTRL_GET_CA_SYS_ID           BRDCST_HANDLER_GET(50)    /**< Define the command code to get CA system ID*/
#define BRDCST_CTRL_GET_AC4_APD_MSG         BRDCST_HANDLER_GET(51)    /**< Define the command code to get AC4 audio preselextion descriptor message id mapped message info*/
#define BRDCST_CTRL_GET_TUNER_IQ_SENSE      BRDCST_HANDLER_GET(52)    /**< Define the command code to get tuner IQ sense info*/
#define BRDCST_CTRL_GET_TUNER_SCIF_INV      BRDCST_HANDLER_GET(53)    /**< Define the command code to get tuner SCIF info*/

#define BRDCST_CTRL_SET_DIAGNOSTICS                     BRDCST_HANDLER_SET(0)     /**< Define the command code to set diagnostics            */
#define BRDCST_CTRL_SET_TUNE_ATTRIBUTES                 BRDCST_HANDLER_SET(1)     /**< Define the command code to set tuner attributes       */
#define BRDCST_CTRL_SET_AUDIO_STREAM_FMT                BRDCST_HANDLER_SET(2)     /**< Define the command code to set audio stream format    */
#define BRDCST_CTRL_SET_FREQ_LIST_UPDATED_CHK           BRDCST_HANDLER_SET(3)     /**< Define the command code to set frequency list updated check - Riks-TV requirement */
#define BRDCST_CTRL_SET_AUDIO_ENC                       BRDCST_HANDLER_SET(4)     /**< Define the command code to set audio stream format    */
#define BRDCST_CTRL_SET_DISEQC_COMMAND                  BRDCST_HANDLER_SET(5)
#define BRDCST_CTRL_SET_TYPE_SCAN_CONTINUE              BRDCST_HANDLER_SET(6)
#define BRDCST_CTRL_SET_TYPE_22K                        BRDCST_HANDLER_SET(7)
#define BRDCST_CTRL_SET_TYPE_SAT_POSITION               BRDCST_HANDLER_SET(8)
#define BRDCST_CTRL_SET_TYPE_TONE_BURST                 BRDCST_HANDLER_SET(9)
#define BRDCST_CTRL_SET_PRESENT_EVENT                   BRDCST_HANDLER_SET(10)    /**< Define the command code to set present event          */
/* this set command is for MHEG5 requirement */
#define BRDCST_CTRL_SET_SVL_REC_IN_SAME_TS              BRDCST_HANDLER_SET(11)    /**< Define the command code to set SVL record ID in the same TS*/
#define BRDCST_CTRL_SET_TYPE_LNB_POWER                  BRDCST_HANDLER_SET(12)
#define BRDCST_CTRL_SET_TYPE_UNICABLE_BLIND_SCAN        BRDCST_HANDLER_SET(13)
#define BRDCST_CTRL_SET_TYPE_UNICABLE_ODU_CH_CHANGE     BRDCST_HANDLER_SET(14)
#define BRDCST_CTRL_SET_TYPE_DEMOD_EARLY_BREAK_CTL      BRDCST_HANDLER_SET(15)
#define BRDCST_CTRL_SET_TYPE_DISEQC_INFO                BRDCST_HANDLER_SET(16)
#define BRDCST_CTRL_SET_TYPE_SVC_ID                     BRDCST_HANDLER_SET(17)
#define BRDCST_CTRL_SET_TYPE_DISEQC_RESET               BRDCST_HANDLER_SET(18)
#define BRDCST_CTRL_SET_TYPE_DEMOD_CLOCK                BRDCST_HANDLER_SET(19)
#define BRDCST_CTRL_SET_TYPE_TS_GAP_LENGTH              BRDCST_HANDLER_SET(20)
#define BRDCST_CTRL_SET_TYPE_DISEQC_WRITE_CH_FREQ       BRDCST_HANDLER_SET(21)
#define BRDCST_CTRL_SET_TYPE_DISEQC_STOP_MOVEMENT       BRDCST_HANDLER_SET(22)
#define BRDCST_CTRL_SET_TYPE_DISEQC_DISABLE_LIMITS      BRDCST_HANDLER_SET(23)
#define BRDCST_CTRL_SET_TYPE_DISEQC_LIMIT_EAST          BRDCST_HANDLER_SET(24)
#define BRDCST_CTRL_SET_TYPE_DISEQC_LIMIT_WEST          BRDCST_HANDLER_SET(25)
#define BRDCST_CTRL_SET_TYPE_DISEQC_MOVE_EAST           BRDCST_HANDLER_SET(26)
#define BRDCST_CTRL_SET_TYPE_DISEQC_MOVE_WEST           BRDCST_HANDLER_SET(27)
#define BRDCST_CTRL_SET_TYPE_DISEQC_STORE_POSITION      BRDCST_HANDLER_SET(28)
#define BRDCST_CTRL_SET_TYPE_DISEQC_GOTO_POSITION       BRDCST_HANDLER_SET(29)
#define BRDCST_CTRL_SET_TYPE_DISEQC_WRITE_TO_PORT_GRP_1 BRDCST_HANDLER_SET(30)
#define BRDCST_CTRL_SET_TYPE_SET_STRM_COMP_INFO         BRDCST_HANDLER_SET(31)     /**< Define the command for FVP test case **/
#define BRDCST_CTRL_SET_TS_DESCR                        BRDCST_HANDLER_GET(32)     /**< Define the command code to set TS DESCR               */


/* Connection reason */
#define BRDCST_CONNECT_OTHER_REASON                0U    /**< Connection reason of others                            */
#define BRDCST_CONNECT_NO_SERVICE                  1U    /**< Connection reason of no service                        */
#define BRDCST_CONNECT_PAT_TIMER_EXPIRED           2U    /**< Connection reason of PAT timer expired                 */
#define BRDCST_CONNECT_PMT_TIMER_EXPIRED           3U    /**< Connection reason of PMT timer expired                 */
#define BRDCST_CONNECT_MGT_TIMER_EXPIRED           4U    /**< Connection reason of MGT timer expired                 */
#define BRDCST_CONNECT_VCT_TIMER_EXPIRED           5U    /**< Connection reason of VCT timer expired                 */
#define BRDCST_CONNECT_WITHOUT_PMT_TABLE           6U    /**< Connection reason of load PAT table only               */
#define BRDCST_CONNECT_CACHED_SCDB                 7U    /**< Connection reason of load PAT table only               */

/* Disconnection reasons */
#define BRDCST_DISC_AS_REQUESTED                   0U    /**< Disconnect reason of user request                      */
#define BRDCST_DISC_OTHER_REASON                   1U    /**< Disconnect reason of other reason                      */
#define BRDCST_DISC_NEW_CONNECTION                 2U    /**< Disconnect reason of new connection                    */
#define BRDCST_DISC_PARENT_DISCONNECTED            3U    /**< Disconnect reason of parent disconnected               */
#define BRDCST_DISC_NO_COMP_FOUND                  4U    /**< Disconnect reason of unable found avaliable component  */
#define BRDCST_DISC_COMP_BUSY                      5U    /**< Disconnect reason of component busy                    */
#define BRDCST_DISC_COULD_NOT_SET_COMP_PROPERTIES  6U    /**< Disconnect reason of set component properties fail     */
#define BRDCST_DISC_COULD_NOT_CONNECT_COMP         7U    /**< Disconnect reason of could not connect component       */
#define BRDCST_DISC_COULD_NOT_LOAD_PAT             8U    /**< Disconnect reason of could load PAT table fail         */
#define BRDCST_DISC_COULD_NOT_LOAD_PMT             9U    /**< Disconnect reason of could load PMT table fail         */
#define BRDCST_DISC_COULD_NOT_LOAD_MGT            10U    /**< Disconnect reason of could load MGT table fail         */
#define BRDCST_DISC_COULD_NOT_LOAD_VCT            11U    /**< Disconnect reason of could load VCT table fail         */
#define BRDCST_DISC_PAT_TIMER_EXPIRED             12U    /**< Disconnect reason of PAT timer expired                 */
#define BRDCST_DISC_PMT_TIMER_EXPIRED             13U    /**< Disconnect reason of PMT timer expired                 */
#define BRDCST_DISC_MGT_TIMER_EXPIRED             14U    /**< Disconnect reason of MGT timer expired                 */
#define BRDCST_DISC_VCT_TIMER_EXPIRED             15U    /**< Disconnect reason of VCT timer expired                 */
#define BRDCST_DISC_NOT_FOUND_IN_VCT              16U    /**< Disconnect reason of unable found service in VCT       */
#define BRDCST_DISC_SVL_ERROR                     17U    /**< Disconnect reason of SVL error                         */
#define BRDCST_DISC_SVL_CLOSED                    18U    /**< Disconnect reason of SVL closed                        */
#define BRDCST_DISC_TSL_CLOSED                    19U    /**< Disconnect reason of TSL closed                        */
#define BRDCST_DISC_SATL_CLOSED                   20U    /**< Disconnect reason of SATL closed                       */
#define BRDCST_DISC_TUNER_SIGNAL_LOSS             21U    /**< Disconnect reason of tuner signal loss                 */
#define BRDCST_DISC_TUNER_UNKNOWN_LNB             22U    /**< Disconnect reason of tuner LNB unknown                 */
#define BRDCST_DISC_TUNER_OUT_OF_RANGE            23U    /**< Disconnect reason of tuer frequency out of range       */
#define BRDCST_DISC_COULD_NOT_LOAD_SDT            24U    /**< Disconnect reason of could load SDT table fail 		 */
#define BRDCST_DISC_SDT_TIMER_EXPIRED             25U    /**< Disconnect reason of SDT timer expired                 */

/* Diseqc set reasons */
#define BRDCST_DISEQC_SET_SUCCESS                       0U
#define BRDCST_DISEQC_SET_MICROCONTROLLER_NOT_FOUND     1U
#define BRDCST_DISEQC_SET_INV_COMMAND                   2U

/* To use with BRDCST_CTRL_SET_TUNE_ATTRIBUTES command */
#define BRDCST_TUNE_ATTRIBUTES_FREQUENCY           ((UINT32) 0x0001)    /**< Broadcast tune attribute of frequency          */
#define BRDCST_TUNE_ATTRIBUTES_SYMBOL_RATE         ((UINT32) 0x0002)    /**< Broadcast tune attribute of symbol rate        */
#define BRDCST_TUNE_ATTRIBUTES_BANDWIDTH           ((UINT32) 0x0004)    /**< Broadcast tune attribute of bandwidth          */
#define BRDCST_TUNE_ATTRIBUTES_FEC_OUTER           ((UINT32) 0x0008)    /**< Broadcast tune attribute of FEC outer          */
#define BRDCST_TUNE_ATTRIBUTES_FEC_INNER           ((UINT32) 0x0010)    /**< Broadcast tune attribute of FEC inner          */
#define BRDCST_TUNE_ATTRIBUTES_MODULATION          ((UINT32) 0x0020)    /**< Broadcast tune attribute of modulation         */
#define BRDCST_TUNE_ATTRIBUTES_HIERARCHY           ((UINT32) 0x0040)    /**< Broadcast tune attribute of hierarchy          */
#define BRDCST_TUNE_ATTRIBUTES_HIERARCHY_PRIORITY  ((UINT32) 0x0080)    /**< Broadcast tune attribute of hierarchy priority */
#define BRDCST_TUNE_ATTRIBUTES_GUARD_INTERVAL      ((UINT32) 0x0100)    /**< Broadcast tune attribute of guard interval     */
#define BRDCST_TUNE_ATTRIBUTES_TRANS_MODE          ((UINT32) 0x0200)    /**< Broadcast tune attribute of transmission mode  */
#define BRDCST_TUNE_ATTRIBUTES_POLARIZATION        ((UINT32) 0x0400)    /**< Broadcast tune attribute of polarization       */
#define BRDCST_TUNE_ATTRIBUTES_ORBITAL_POSITION    ((UINT32) 0x0800)    /**< Broadcast tune attribute of orbital position   */
#define BRDCST_TUNE_ATTRIBUTES_DIRECTION           ((UINT32) 0x1000)    /**< Broadcast tune attribute of direction          */
#define BRDCST_TUNE_ATTRIBUTES_GAIN                ((UINT32) 0x2000)    /**< Broadcast tune attribute of gain               */
#define BRDCST_TUNE_ATTRIBUTES_TUNER_CONN_MODE     ((UINT32) 0x4000)    /**< Broadcast tune attribute of tuner conn        */
#define BRDCST_TUNE_ATTRIBUTES_DISEQC_TYPE         ((UINT32) 0x8000)    /**< Broadcast tune attribute of tuner conneect mode */
#define BRDCST_TUNE_ATTRIBUTES_PORT                ((UINT32) 0x10000)    /**< Broadcast tune attribute of tuner conneect mode */
#define BRDCST_TUNE_ATTRIBUTES_CASCADE_TYPE        ((UINT32) 0x20000)    /**< Broadcast tune attribute of tuner conneect mode */
#define BRDCST_TUNE_ATTRIBUTES_CASCADE_PORT        ((UINT32) 0x40000)    /**< Broadcast tune attribute of tuner conneect mode */
#define BRDCST_TUNE_ATTRIBUTES_22K                 ((UINT32) 0x80000)    /**< Broadcast tune attribute of tuner conneect mode */
#define BRDCST_TUNE_ATTRIBUTES_TONE_BURST          ((UINT32) 0x100000)   /**< Broadcast tune attribute of tuner conneect mode */
#define BRDCST_TUNE_ATTRIBUTES_WXYZ                ((UINT32) 0x200000)    /**< Broadcast tune attribute of tuner conneect mode */

/* This structure contains the DiSEqC protocol information which will be transmitted */
/*#define BRDCST_DISEQC_22K_OFF               ((UINT8)0)
#define BRDCST_DISEQC_22K_ON                ((UINT8)1)
#define BRDCST_DISEQC_22K_UNKNOWN           ((UINT8)2)

#define BRDCST_DISEQC_SAT_POSITION_UNKNOWN  ((UINT8)0)
#define BRDCST_DISEQC_SAT_POSITION_1        ((UINT8)1)
#define BRDCST_DISEQC_SAT_POSITION_2        ((UINT8)2)
#define BRDCST_DISEQC_SAT_POSITION_3        ((UINT8)3)
#define BRDCST_DISEQC_SAT_POSITION_4        ((UINT8)4)

#define BRDCST_DISEQC_POL_KNOWN             ((UINT8)POL_UNKNOWN)             
#define BRDCST_DISEQC_POL_VERTICAL_13V      ((UINT8)POL_LIN_VERTICAL)
#define BRDCST_DISEQC_POL_HORIZONTAL_18V    ((UINT8)POL_LIN_HORIZONTAL)

#define BRDCST_DISEQC_TONE_BURST_OFF        ((UINT8)0)
#define BRDCST_DISEQC_TONE_BURST_A          ((UINT8)1)
#define BRDCST_DISEQC_TONE_BURST_B          ((UINT8)2)
*/

typedef enum
{
    BRDCST_SET_DISEQC_NONE,
    BRDCST_SET_DISEQC_10_CMD_RESET_MICROCONTROLLER, 
    BRDCST_SET_DISEQC_10_CMD_SET_WRITE_TO_PORT_GRP_0,
    BRDCST_SET_DISEQC_UNICABLE_ODU_CH_CHANGE,
    BRDCST_SET_DISEQC_UNICABLE,
    BRDCST_SET_DISEQC_JESS_UNICABLE,
    BRDCST_SET_DISEQC_CTRL_RESET,
    BRDCST_SET_DISEQC_WRITE_TO_PORT_GRP_1,
    BRDCST_SET_DISEQC_WRITE_CHANNEL_FREQ,
    BRDCST_SET_DISEQC_STOP_POSITIONER_MOVEMENT,
    BRDCST_SET_DISEQC_DISABLE_LIMITS,
    BRDCST_SET_DISEQC_EAST_LIMIT_AND_ENABLE_LIMITS,
    BRDCST_SET_DISEQC_WEST_LIMIT_AND_ENABLE_LIMITS,
    BRDCST_SET_DISEQC_DRIVE_MOTOR_EAST_AND_TIMEOUT_AND_STEPS,
    BRDCST_SET_DISEQC_DRIVE_MOTOR_WEST_AND_TIMEOUT_AND_STEPS,
    BRDCST_SET_DISEQC_STORE_SAT_POSITION_AND_ENABLE_LIMITS,
    BRDCST_SET_DISEQC_DRIVE_MOTOR_TO_SAT_POSITION_NN,
}   BRDCST_CTRL_DISEQC_COMMAND_T;

typedef struct
{
    UINT8                   ui1_22k;
    UINT8                   ui1_polarity_13v_18v;
    UINT8                   ui1_sat_position;
}   DISEQC_10_SET_T;

typedef struct
{
    UINT32                  ui4_frequency;
}   DISEQC_11_SET_T;

typedef struct
{
    UINT8                   ui1_sat_position;
    INT8                    i1_movement_data;
}   DISEQC_12_SET_T;


typedef struct
{
    BRDCST_CTRL_DISEQC_COMMAND_T    e_diseqc_cmd;
    union {
        DISEQC_10_SET_T             t_diseqc_10_set;
        DISEQC_11_SET_T             t_diseqc_11_set;
        DISEQC_12_SET_T             t_diseqc_12_set;
    } u;
    UINT8                           ui1_tone_burst;
    UINT8                           ui1_repeat_cmd;
    UINT8                           ui1_lnb_power;          /* 0->LNB_POWER_OFF, 1->LNB_POWER_13V_18V, 2->LNB_POWER_14V_19V*/
    UINT32                          ui4_transponder_freq;
    TUNER_UNICABLE_BANK_T           e_bank;
    TUNER_USER_BAND_T               e_user_band;
    UINT16                          ui2_band_freq;
    UINT16                          ui2_lnb_freq;
    BOOL                            b_unicable_sat;
    BOOL                            b_unicable_jess_sat;

}   BRDCST_CTRL_DISEQC_T;

typedef struct
{
    UINT32                  ui4_info_mask;

    TUNER_DISEQC_INFO_T     t_diseqc_info;
    
}BRDCST_DISEQC_INFO_T;


/*------------------------------------------------------------------*/
/*! @struct BRDCST_CTRL_TUNE_ATTRIBUTES_T
 *  @brief This structure contains the tuner attributes which will transmit in
 *  @code
 *  typedef struct
 *  {
 *      UINT32                      ui4_flags;
 *      UINT32                      ui4_freq;
 *      UINT32                      ui4_sym_rate;
 *      TUNER_BANDWIDTH_T           e_bandwidth;
 *      TUNER_FEC_OUTER_T           e_fec_outer;
 *      TUNER_FEC_INNER_T           e_fec_inner;
 *      TUNER_MODULATION_T          e_mod;
 *      TUNER_HIERARCHY_T           e_hierarchy;
 *      TUNER_HIERARCHY_PRIORITY_T  e_hierarchy_priority;
 *      TUNER_GUARD_INTERVAL_T      e_guard_int;
 *      TUNER_TRANSMISSION_MODE_T   e_trans_mode;
 *      TUNER_POLARIZATION_T        e_pol;
 *      TUNER_CONNECTION_MODE_T     e_conn_mode;
 *      INT16                       i2_orb_pos;
 *      UINT16                      ui2_dir;
 *      UINT16                      ui2_gain;
 *  }   BRDCST_CTRL_TUNE_ATTRIBUTES_T;
 *  @endcode
 *  @li@c  ui4_flags              -   The Mask to indicate which value is available in this structure
 *  @li@c  ui4_freq               -   Frequency value
 *  @li@c  ui4_sym_rate           -   Symbol rate value
 *  @li@c  e_bandwidth            -   Bandwidth value
 *  @li@c  e_fec_outer            -   Outer Forward Error Correction(FEC) scheme
 *  @li@c  e_fec_inner            -   Inner Forward Error Correction(FEC) scheme
 *  @li@c  e_mod                  -   Modulation scheme
 *  @li@c  e_hierarchy            -   Specified whether the transmission is hierarchical and what the alpha value is
 *  @li@c  e_hierarchy_priority   -   Hierarchy priority
 *  @li@c  e_guard_int            -   Guard interval value
 *  @li@c  e_trans_mode           -   Number of carries of in an OFDM frame
 *  @li@c  e_pol                  -   Polarization of the transmitted signal
 *  @li@c  e_conn_mode            -   Tuner connection mode
 *  @li@c  i2_orb_pos             -   Orbital position in degrees
 *  @li@c  ui2_dir                -   Direction in 0.1 degrees. Valid value range '0..3599' (inclusive)
 *  @li@c  ui2_gain               -   Gain in 0.1 steps. Valid range '0..1000' (inclusive)
 */
/*------------------------------------------------------------------*/
typedef struct
{
    UINT32                      ui4_flags;
    UINT32                      ui4_freq;
    UINT32                      ui4_sym_rate;
    TUNER_BANDWIDTH_T           e_bandwidth;
    TUNER_FEC_OUTER_T           e_fec_outer;
    TUNER_FEC_INNER_T           e_fec_inner;
    TUNER_MODULATION_T          e_mod;
    TUNER_HIERARCHY_T           e_hierarchy;
    TUNER_HIERARCHY_PRIORITY_T  e_hierarchy_priority;
    TUNER_GUARD_INTERVAL_T      e_guard_int;
    TUNER_TRANSMISSION_MODE_T   e_trans_mode;
    TUNER_POLARIZATION_T        e_pol;
    TUNER_CONNECTION_MODE_T     e_conn_mode;
    INT16                       i2_orb_pos;
    UINT16                      ui2_dir;
    UINT16                      ui2_gain;
    TUNER_DISEQC_TYPE_T         e_diseqc_type; //none, 2x1, 4x1, 8x1, 16x1, 1.2, usals
    UINT8                       ui1_port;
    UINT8                       ui1_cascade_type;//none, 1
    UINT8                       ui1_cascade_port;
    UINT8                       ui1_22k; //0: off, 1: on
    UINT8                       ui1_tone_burst; //0: off, 1: A, 2: B
    UINT16                      ui2_wxyz;
}   BRDCST_CTRL_TUNE_ATTRIBUTES_T;


/*------------------------------------------------------------------*/
/*! @struct BRDCST_CTRL_AUDIO_STREAM_FMT_T
 *  @brief This structure contains the audio stream information which will stransmit in
 *  @code
 *  typedef struct
 *  {
 *      UINT16     ui2_pid;
 *      AUD_FMT_T  e_audio_format;
 *      UINT8      ui1_index;
 *  }   BRDCST_CTRL_AUDIO_STREAM_FMT_T;
 *  @endcode
 *  @li@c  ui2_pid                            -   PID of the elementary stream which audio stream transmit in
 *  @li@c  e_audio_format                     -   Audio format
 *  @li@c  ui1_index                          -   Indicate the audio stream index
 */
/*------------------------------------------------------------------*/
typedef struct
{
    UINT16     ui2_pid;
    AUD_FMT_T  e_audio_format;
    UINT8      ui1_index;
}   BRDCST_CTRL_AUDIO_STREAM_FMT_T;

/*------------------------------------------------------------------*/
/*! @struct BRDCST_CTRL_AUDIO_ENC_T
 *  @brief This structure contains the audio stream information which will stransmit in
 *  @code
 *  typedef struct
 *  {
 *      UINT16     ui2_pid;
 *      AUD_FMT_T  e_audio_enc;
 *      UINT8      ui1_index;
 *  }   BRDCST_CTRL_AUDIO_ENC_T;
 *  @endcode
 *  @li@c  ui2_pid                            -   PID of the elementary stream which audio stream transmit in
 *  @li@c  e_audio_enc                        -   Audio encoder
 *  @li@c  ui1_index                          -   Indicate the audio stream index
 */
/*------------------------------------------------------------------*/
typedef struct
{
    UINT16     ui2_pid;
    AUD_ENC_T  e_audio_enc;
    UINT8      ui1_index;
}   BRDCST_CTRL_AUDIO_ENC_T;

/* Time-out values */
/*------------------------------------------------------------------*/
/*! @struct BRDCST_TIME_OUT_T
 *  @brief This structure contains all time out of related PSI/SI/ATSC tables.
 *  @code
 *  typedef struct
 *  {
 *      UINT32  ui4_pat_time_out;
 *      UINT32  ui4_pmt_time_out;
 *      UINT32  ui4_mgt_time_out;
 *      UINT32  ui4_cvct_time_out;
 *      UINT32  ui4_tvct_time_out;
 *      UINT32  ui4_eit_time_out;
 *      UINT32  ui4_eit_retry_delay;
 *  }   BRDCST_TIME_OUT_T;
 *  @endcode
 *  @li@c  ui4_pat_time_out                 - Time out value of PAT loading
 *  @li@c  ui4_pmt_time_out                 - Time out value of PMT loading 
 *  @li@c  ui4_mgt_time_out                 - Time out value of MGT loading
 *  @li@c  ui4_cvct_time_out                - Time out value of CVCT loading
 *  @li@c  ui4_tvct_time_out                - Time out value of TVCT loading
 *  @li@c  ui4_eit_time_out                 - Time out value of EIT loading
 *  @li@c  ui4_eit_retry_delay              - Delay time of EIT retry loading
 */
/*------------------------------------------------------------------*/
typedef struct
{
    UINT32  ui4_pat_time_out;
    UINT32  ui4_cat_time_out;
    UINT32  ui4_pmt_time_out;
    UINT32  ui4_mgt_time_out;
    UINT32  ui4_cvct_time_out;
    UINT32  ui4_tvct_time_out;
    UINT32  ui4_eit_time_out;
    UINT32  ui4_eit_retry_delay; 
	UINT32	ui4_sdt_time_out;
}   BRDCST_TIME_OUT_T;
typedef struct
{
    UINT16  ui2_on_id;
    UINT16  ui2_ts_id;
    UINT16  ui2_svc_id;
}   BRDCST_SVC_INFO_T;


/*------------------------------------------------------------------*/
/*! @struct BRDCST_CTRL_GET_PMT_SECT_T
 *  @brief This structure contains the current pmt raw section information
 *  typedef struct{    
 *      VOID*               pv_pmt_data;    
 *      SIZE_T*            pz_data_len;    
 *      TM_COND_T      e_tbl_cond;
 *  }   BRDCST_CTRL_GET_PMT_SECT_T;
 *  @endcode
 *  @li@c  pv_pmt_data                    -   point to pmt section
 *  @li@c  pz_data_len                      -   pmt section length
 *  @li@c  e_tbl_cond                        -   Indicate the current pmt table condition
 */
/*------------------------------------------------------------------*/

typedef struct{    
    VOID*               pv_pmt_data;    
    SIZE_T*             pz_data_len;    
    TM_COND_T           e_tbl_cond;
}   BRDCST_CTRL_GET_PMT_SECT_T;

/*------------------------------------------------------------------*/
/*! @struct BRDCST_CTRL_GET_AC4_APD_MSG
 *  @brief This structure contains the current SDT message descriptor information
 *  typedef struct
 *  {
 *      UINT8          ui1_message_id;
 *      ISO_639_LANG_T s_lang;
 *      UINT8          ui1_text_len;
 *      UINT8          aui1_text[BRDCST_AC4_APD_MSG_LEN];
 *  }BRDCST_MESSAGE_DESC_INFO_T;
 *  @endcode
 *  @li@c  ui1_message_id                 -   Input data,need set message ID
 *  @li@c  b_found                        -   Output data, found message id mapped descriptor or not
 *  @li@c  s_lang                         -   Output data, message descriptor language code
 *  @li@c  ui1_text_len                   -   Output data, text length, 0 mean no text data
 *  @li@c  aui1_text[]                    -   Output data, text cotent
 */
/*------------------------------------------------------------------*/
#define BRDCST_AC4_APD_MSG_LEN 250
typedef struct
{
    UINT8          ui1_message_id;
    BOOL           b_found;
    ISO_639_LANG_T s_lang;
    UINT8          ui1_text_len;
    UINT8          aui1_text[BRDCST_AC4_APD_MSG_LEN];
}BRDCST_MESSAGE_DESC_INFO_T;

/*------------------------------------------------------------------*/
/*! @enmu BRDCST_COPY_CTRL_TYPE_T
 *  @brief This enum specify the copy control type according to spec 
 *    ARIB_TR-B14-2_V2.8_E2.pdf, table 30-23
 *
 * typedef enum{
 * 
 *     BRDCST_COPY_TYPE_UNKNOWN = 0,
 *     BRDCST_COPY_TYPE_FREELY,
 *     BRDCST_COPY_TYPE_NEVER,
 *     BRDCST_COPY_TYPE_ONE_GEN,
 * 
 * }BRDCST_COPY_CTRL_TYPE_T;
 *
 *  @endcode
 */
/*------------------------------------------------------------------*/

typedef enum{

    BRDCST_COPY_CTRL_TYPE_UNKNOWN = 0,
    BRDCST_COPY_CTRL_TYPE_FREELY,
    BRDCST_COPY_CTRL_TYPE_ONE_GEN,
    BRDCST_COPY_CTRL_TYPE_NEVER,

}BRDCST_COPY_CTRL_TYPE_T;

/*------------------------------------------------------------------*/
/*! @enmu BRDCST_ENCRYPTION_MODE_T
 *  @brief This enum specify the encryption mode according to spec 
 *    ARIB_TR-B14-2_V2.8_E2.pdf, table 30-31
 *
 * typedef enum{
 * 
 *     BRDCST_ENCRYPTION_MODE_UNKNOWN = 0,
 *     BRDCST_ENCRYPTION_NOT_APPLIED,
 *     BRDCST_ENCRYPTION_APPLIED,
 * 
 * }BRDCST_ENCRYPTION_MODE_T;
 *
 *  @endcode
 */
/*------------------------------------------------------------------*/

typedef enum{

    BRDCST_ENCRYPTION_MODE_UNKNOWN = 0,
    BRDCST_ENCRYPTION_APPLIED,
    BRDCST_ENCRYPTION_NOT_APPLIED,

}BRDCST_ENCRYPTION_MODE_T;

/*------------------------------------------------------------------*/
/*! @struct BRDCST_DIGITAL_COPY_CTRL_INFO_T
 *  @brief This structure contains the digital copy control information
 *  typedef struct{    
 *   BRDCST_COPY_CTRL_TYPE_T  e_copy_ctrl_type;
 *  }   BRDCST_CTRL_GET_PMT_SECT_T;
 *  @endcode
 *  @li@c  e_copy_ctrl_type               -  copy control type
 */
/*------------------------------------------------------------------*/

typedef struct{

    BRDCST_COPY_CTRL_TYPE_T  e_copy_ctrl_mode;
    BRDCST_ENCRYPTION_MODE_T e_encrypt_mode;

}BRDCST_DIGITAL_COPY_CTRL_INFO_T;


/*add for hbbtv test case,get stream info from AP*/
typedef struct _BRDCST_SET_STREAM_INFO_AUDIO_T
{
    UINT8           ui1_component_tag;
    BOOL            b_audio_description;
    AUD_ENC_T       e_aud_enc;
    AUD_LAYER_T     e_aud_layer;
    ISO_639_LANG_T  s_lang;
    AUD_FMT_T       e_aud_fmt;
    AUD_TYPE_T      e_aud_type;
}BRDCST_SET_STREAM_INFO_AUDIO_T;

typedef struct _BRDCST_SET_STREAM_INFO_VIDEO_T
{
    UINT8  ui1_component_tag;
    VID_FMT_T  e_vid_fmt;
    VID_ENC_T  e_video_enc;
}BRDCST_SET_STREAM_INFO_VIDEO_T;

typedef struct _BRDCST_SET_STREAM_INFO_T
{
    STREAM_TYPE_T e_stream_type;
    union BRDCST_SET_STREAM_INFO_U
    {
        BRDCST_SET_STREAM_INFO_AUDIO_T t_audio_info;
        BRDCST_SET_STREAM_INFO_VIDEO_T t_video_info;
    }u_stream_info;
}BRDCST_SET_STREAM_INFO_T;

/*end of  add for hbbtv test case,get stream info from AP*/

#endif /*  _U_BRDCST_H_ */

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

