/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/

/*----------------------------------------------------------------------------*/
/*! @file c_psi_eng.h 
 *  $RCSfile: $
 *  $Revision: #1 $
 *  $Date: 2015/05/29 $
 *  $Author: brianpc.huang $
 *  
 *  @par Description:
 *         This header file contains PSI engine specific definitions, which
 *         are exported.
 */
/*----------------------------------------------------------------------------*/

#ifndef _C_PSI_H_
#define _C_PSI_H_    /**<        */

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

#include "u_tm.h"
#include "u_psi_eng.h"

/*----------------------------------------------------------------------------*/
/*! @addtogroup groupMW_TBL_MNGR_PSI_ENG
 *  @{ 
 */
/*----------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------
                    functions declarations
 ----------------------------------------------------------------------------*/

/*------------------------------------------------------------------*/
/*! @brief This API returns a copy of a raw section for a PSI table.
 *
 *  @param [in] h_tbl              - References the PSI table object.
 *  @param [in] ui1_sec_num  - Specifies the section to get by index.
 *  @param [in] pui1_buffer    - Pointer to buffer to hold copy
 *  @param [in] pz_len           - Holds length of buffer
 *
 *  @param [out]  pz_len        - Holds length of section
 *  @param [out]  pe_cond     - Contains the condition of the table object.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                           -  Routine successful.
 *  @retval TMR_NOT_INIT                 - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                  - One or more of the arguments contain invalid
 *                                                        data.
 *  @retval TMR_INV_HANDLE             - Invalid handle.
 *  @retval TMR_NO_SUPPORT            - No support.
 *  @retval TMR_INV_HANDLE_STATE  - Invalid handle state.
 *  @retval TMR_INV_GET_INFO          - Invalid get operation data.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_get_raw_section (HANDLE_T   h_tbl,
                                    UINT8      ui1_sec_num,
                                    UINT8*     pui1_buffer,
                                    UINT32*    pz_len,
                                    TM_COND_T* pe_cond);

/*------------------------------------------------------------------*/
/*! @brief This API returns a service entry from a PAT table.
 *
 *  @param [in] h_pat                   - References the PAT table object.
 *  @param [in] ui2_idx                 -  Specifies the program entry number by index.
 *
 *  @param [out]  pt_pid_svc_info  - Contains the service entry info.
 *  @param [out]  pe_cond            - Contains the condition of the table object.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval  TMR_OK                           - Routine successful.
 *  @retval  TMR_NOT_INIT                 - The Table Manager is not initialized.
 *  @retval  TMR_INV_ARG                  - One or more of the arguments contain invalid
 *                                                         data.
 *  @retval  TMR_INV_HANDLE             - Invalid handle.
 *  @retval  TMR_NO_SUPPORT            - No support.
 *  @retval  TMR_INV_HANDLE_STATE  - Invalid handle state.
 *  @retval  TMR_INV_GET_INFO          - Invalid get operation data.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_get_svc_entry (HANDLE_T                h_pat,
                                  UINT16                  ui2_idx,
                                  PSI_PID_SVC_ID_INFO_T*  pt_pid_svc_info,
                                  TM_COND_T*              pe_cond);
/*------------------------------------------------------------------*/
/*! @brief  This API returns the transport stream id of a PAT table.
 *
 *  @param [in]  h_pat          - References the PAT table object.
 *
 *  @param [out] pui2_ts_id  - Contains the transport stream id.
 *  @param [out] pe_cond     - Contains the condition of the table object.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                            - Routine successful.
 *  @retval TMR_NOT_INIT                  - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                   - One or more of the arguments contain invalid
 *                                                         data.
 *  @retval TMR_INV_HANDLE             - Invalid handle.
 *  @retval TMR_NO_SUPPORT            - No support.
 *  @retval TMR_INV_HANDLE_STATE  - Invalid handle state.
 *  @retval TMR_INV_GET_INFO          - Invalid get operation data.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_get_ts_id (HANDLE_T    h_pat,
                              UINT16*     pui2_ts_id,
                              TM_COND_T*  pe_cond);
/*------------------------------------------------------------------*/
/*! @brief  This API returns the PCR PID value of a PMT table.
 *
 *  @param [in] h_pmt          - References the PMT table object.
 *
 *  @param [out] pt_pcr_pid  - Contains the PCR PID.
 *  @param [out] pe_cond    - Contains the condition of the table object.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                           - Routine successful.
 *  @retval TMR_NOT_INIT                 - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                  - One or more of the arguments contain invalid
 *                                                        data.
 *  @retval TMR_INV_HANDLE             - Invalid handle.
 *  @retval TMR_NO_SUPPORT            - No support.
 *  @retval TMR_INV_HANDLE_STATE  - Invalid handle state.
 *  @retval TMR_INV_GET_INFO          - Invalid get operation data.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_get_pcr_pid (HANDLE_T       h_pmt,
                                MPEG_2_PID_T*  pt_pcr_pid,
                                TM_COND_T*     pe_cond);
/*------------------------------------------------------------------*/
/*! @brief This API returns the stream enty information in a PMT.
 *
 *  @param [in] h_pmt                   - References the PMT table object.
 *  @param [in] ui2_idx                  - Specifies the stream entry number by index.
 *
 *  @param [out] pt_stream_entry  - Contains the stream entry information.
 *  @param [out] pe_cond              - Contains the condition of the table object.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                           - Routine successful.
 *  @retval TMR_NOT_INIT                 - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                  - One or more of the arguments contain invalid
 *                                                        data.
 *  @retval TMR_INV_HANDLE             - Invalid handle.
 *  @retval TMR_NO_SUPPORT            - No support.
 *  @retval TMR_INV_HANDLE_STATE  - Invalid handle state.
 *  @retval TMR_INV_GET_INFO          - Invalid get operation data.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_get_stream_entry (HANDLE_T            h_pmt,
                                     UINT16              ui2_idx,
                                     PSI_STREAM_INFO_T*  pt_stream_entry,
                                     TM_COND_T*          pe_cond);
/*------------------------------------------------------------------*/
/*! @brief This API returns the program or service id of a PMT table.
 *
 *  @param [in] h_pmt            - References the PMT table object.
 *
 *  @param [out] pui2_svc_id  - Contains the program or service id.
 *  @param [out] pe_cond       - Contains the condition of the table object.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval    TMR_OK                         - Routine successful.
 *  @retval TMR_NOT_INIT                  - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                   - One or more of the arguments contain invalid
 *                                                        data.
 *  @retval  TMR_INV_HANDLE             - Invalid handle.
 *  @retval   TMR_NO_SUPPORT           - No support.
 *  @retval  TMR_INV_HANDLE_STATE  - Invalid handle state.
 *  @retval    TMR_INV_GET_INFO        - Invalid get operation data.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_get_svc_id (HANDLE_T    h_pmt,
                               UINT16*     pui2_svc_id,
                               TM_COND_T*  pe_cond);
/*------------------------------------------------------------------*/
/*! @brief This API returns the number of ts ids of a monitor PAT table object.
 *
 *  @param [in] h_mon_pat          - References the monitor PAT table object.
 *
 *  @param [out] pui2_num_ts_id  -Contains the number of ts ids.
 *  @param [out] pe_cond            - Contains the condition of the table object.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                           - Routine successful.
 *  @retval TMR_NOT_INIT                 - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                  - One or more of the arguments contain invalid
 *                                                        data.
 *  @retval TMR_INV_HANDLE             - Invalid handle.
 *  @retval TMR_NO_SUPPORT            - No support.
 *  @retval TMR_INV_HANDLE_STATE  - Invalid handle state.
 *  @retval TMR_INV_GET_INFO          - Invalid get operation data.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_mon_get_num_ts_id (HANDLE_T    h_mon_pat,
                                      UINT16*     pui2_num_ts_id,
                                      TM_COND_T*  pe_cond);
/*------------------------------------------------------------------*/
/*! @brief This API returns the an entry, referenced by an index, of the
 *              monitor PAT table object.
 *
 *  @param [in] h_mon_pat  - References the monitor PAT table object.
 *  @param [in] ui2_idx        - Contains the index value.
 *
 *  @param [out] pui2_ts_id  - Contains the number of ts ids.
 *  @param [out] pe_cond    - Contains the condition of the table object.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                           - Routine successful.
 *  @retval TMR_NOT_INIT                 - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                  - One or more of the arguments contain invalid
 *                                                        data.
 *  @retval TMR_INV_HANDLE             - Invalid handle.
 *  @retval TMR_NO_SUPPORT            - No support.
 *  @retval TMR_INV_HANDLE_STATE  - Invalid handle state.
 *  @retval TMR_INV_GET_INFO          - Invalid get operation data.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_mon_get_ts_id (HANDLE_T    h_mon_pat,
                                  UINT16      ui2_idx,
                                  UINT16*     pui2_ts_id,
                                  TM_COND_T*  pe_cond);

/*------------------------------------------------------------------*/
/*! @brief This API loads a TSDT table.
 *
 *  @param [in] h_root           - References the root table object.
 *  @param [in] e_src_type    - Specifies the source type for loading the requested
 *                                            table.
 *  @param [in] pv_src_info    - Contains additional information describing the source.
 *  @param [in] pv_nfy_tag     - Contains a notify tag value.
 *  @param [in]  pf_nfy           - References the notify function.
 *
 *  @param [out]  ph_tsdt        - Contains a handle which references the TSDT table.
 *  @param [out]   pe_cond      -Contains the condition of the TSDT table.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                            -  Routine successful.
 *  @retval TMR_NOT_INIT                  - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                   - One or more of the arguments contain invalid
 *  @retval                                           data.
 *  @retval TMR_INV_HANDLE              - Invalid handle.
 *  @retval TMR_OUT_OF_HANDLES      - No handles available.
 *  @retval TMR_OUT_OF_RESOURCES  - Out of resources.
 *  @retval TMR_NO_SUPPORT              - No support.
 *  @retval TMR_INV_HANDLE_STATE    - Invalid handle state.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_load_tsdt(HANDLE_T       h_root,
                             TM_SRC_TYPE_T  e_src_type,
                             VOID*          pv_src_info,
                             VOID*          pv_nfy_tag,
                             x_tm_nfy_fct   pf_nfy,
                             HANDLE_T*      ph_tsdt,
                             TM_COND_T*     pe_cond);

/*------------------------------------------------------------------*/
/*! @brief This API loads a CAT table.
 *
 *  @param [in] h_root          - References the root table object.
 *  @param [in] e_src_type    - Specifies the source type for loading the requested
 *                                            table.
 *  @param [in]  pv_src_info  -Contains additional information describing the source.
 *  @param [in]  pv_nfy_tag  - Contains a notify tag value.
 *  @param [in]  pf_nfy         - References the notify function.
 *
 *  @param [out] ph_cat       - Contains a handle which references the CAT table.
 *  @param [out] pe_cond     - Contains the condition of the CAT table.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                             -  Routine successful.
 *  @retval TMR_NOT_INIT                   - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                    - One or more of the arguments contain invalid
 *                                                          data.
 *  @retval TMR_INV_HANDLE               - Invalid handle.
 *  @retval TMR_OUT_OF_HANDLES       - No handles available.
 *  @retval TMR_OUT_OF_RESOURCES  - Out of resources.
 *  @retval TMR_NO_SUPPORT              - No support.
 *  @retval TMR_INV_HANDLE_STATE    -  Invalid handle state.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_load_cat (HANDLE_T       h_root,
                             TM_SRC_TYPE_T  e_src_type,
                             VOID*          pv_src_info,
                             VOID*          pv_nfy_tag,
                             x_tm_nfy_fct   pf_nfy,
                             HANDLE_T*      ph_cat,
                             TM_COND_T*     pe_cond);

/*------------------------------------------------------------------*/
/*! @brief This API loads a PAT table
 *
 *  @param [in] h_root         -  References the root table object.
 *  @param [in] e_src_type   - Specifies the source type for loading the requested
 *                                          table.
 *  @param [in] pv_src_info  - Contains additional information describing the source.
 *  @param [in] pv_nfy_tag  - Contains a notify tag value.
 *  @param [in] pf_nfy         - References the notify function.
 *
 *  @param [out] ph_pat      - Contains a handle which references the PAT table.
 *  @param [out] pe_cond    - Contains the condition of the PAT table.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                              - Routine successful.
 *  @retval TMR_NOT_INIT                    -  The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                     - One or more of the arguments contain invalid
 *                                                           data.
 *  @retval TMR_INV_HANDLE               -  Invalid handle.
 *  @retval TMR_OUT_OF_HANDLES       - No handles available.
 *  @retval TMR_OUT_OF_RESOURCES   - Out of resources.
 *  @retval TMR_NO_SUPPORT               - No support.
 *  @retval TMR_INV_HANDLE_STATE     -  Invalid handle state.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_load_pat(HANDLE_T       h_root,
                            TM_SRC_TYPE_T  e_src_type,
                            VOID*          pv_src_info,
                            VOID*          pv_nfy_tag,
                            x_tm_nfy_fct   pf_nfy,
                            HANDLE_T*      ph_pat,
                            TM_COND_T*     pe_cond);

/*------------------------------------------------------------------*/
/*! @brief This API loads a PAT table given a transport stream id.
 *
 *  @param [in] h_root           - References the root table object.
 *  @param [in] ui2_ts_id       - Contains the PAT's transport stream id.
 *  @param [in] e_src_type    - Specifies the source type for loading the requested
 *                                            table.
 *  @param [in] pv_src_info    - Contains additional information describing the source.
 *  @param [in] pv_nfy_tag    - Contains a notify tag value.
 *  @param [in] pf_nfy           - References the notify function.
 *
 *  @param [out]  ph_pat        - Contains a handle which references the PAT table.
 *  @param [out]  pe_cond      - Contains the condition of the PAT table.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                            - Routine successful.
 *  @retval TMR_NOT_INIT                  - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                   - One or more of the arguments contain invalid
 *                                                         data.
 *  @retval TMR_INV_HANDLE               - Invalid handle.
 *  @retval TMR_OUT_OF_HANDLES       - No handles available.
 *  @retval TMR_OUT_OF_RESOURCES  - Out of resources.
 *  @retval TMR_NO_SUPPORT              - No support.
 *  @retval TMR_INV_HANDLE_STATE    - Invalid handle state.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_load_pat_by_ts_id (HANDLE_T       h_root,
                                      UINT16         ui2_ts_id,
                                      TM_SRC_TYPE_T  e_src_type,
                                      VOID*          pv_src_info,
                                      VOID*          pv_nfy_tag,
                                      x_tm_nfy_fct   pf_nfy,
                                      HANDLE_T*      ph_pat,
                                      TM_COND_T*     pe_cond);
/*------------------------------------------------------------------*/
/*! @brief This API loads a PAT table given a transport stream descriptor.
 *
 *  @param [in] h_root          - References the root table object.
 *  @param [in] ui2_ts_id      - Contains the PAT's transport stream id.
 *  @param [in] e_src_type   - Specifies the source type for loading the requested
 *                                           table.
 *  @param [in] pv_src_info  - Contains additional information describing the source.
 *  @param [in] pv_nfy_tag  - Contains a notify tag value.
 *  @param [in] pf_nfy         - References the notify function.
 *
 *  @param [out]  ph_pat     - Contains a handle which references the PAT table.
 *  @param [out]  pe_cond   - Contains the condition of the PAT table.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                              - Routine successful.
 *  @retval TMR_NOT_INIT                    - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                     - One or more of the arguments contain invalid
 *                                                           data.
 *  @retval TMR_INV_HANDLE               - Invalid handle.
 *  @retval TMR_OUT_OF_HANDLES       - No handles available.
 *  @retval TMR_OUT_OF_RESOURCES  - Out of resources.
 *  @retval TMR_NO_SUPPORT              - No support.
 *  @retval TMR_INV_HANDLE_STATE    - Invalid handle state.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_load_pat_by_ts_descr (HANDLE_T       h_root,
                                         TS_DESCR_T*    pt_ts_descr,
                                         TM_SRC_TYPE_T  e_src_type,
                                         VOID*          pv_src_info,
                                         VOID*          pv_nfy_tag,
                                         x_tm_nfy_fct   pf_nfy,
                                         HANDLE_T*      ph_pat,
                                         TM_COND_T*     pe_cond);
/*------------------------------------------------------------------*/
/*! @brief This API loads a PMT table given a service id and PAT table
 *              handle.
 *
 *  @param [in] h_pat           - References the PAT table object.
 *  @param [in] ui2_svc_id    - Contains the PMT's service id.
 *  @param [in] e_src_type   - Specifies the source type for loading the requested
 *                                           table.
 *  @param [in] pv_src_info  - Contains additional information describing the source.
 *  @param [in] pv_nfy_tag  - Contains a notify tag value.
 *  @param [in] pf_nfy         - References the notify function.
 *
 *  @param [out] ph_pmt     - Contains a handle which references the PMT table.
 *  @param [out] pe_cond    - Contains the condition of the PMT table.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                              - Routine successful.
 *  @retval TMR_NOT_INIT                    - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                     - One or more of the arguments contain invalid
 *                                                           data.
 *  @retval TMR_INV_HANDLE               - Invalid handle.
 *  @retval TMR_OUT_OF_HANDLES       - No handles available.
 *  @retval TMR_OUT_OF_RESOURCES  - Out of resources.
 *  @retval TMR_NO_SUPPORT              - No support.
 *  @retval TMR_INV_HANDLE_STATE    - Invalid handle state.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_load_pmt_by_svc_id (HANDLE_T       h_pat,
                                       UINT16         ui2_svc_id,
                                       TM_SRC_TYPE_T  e_src_type,
                                       VOID*          pv_src_info,
                                       VOID*          pv_nfy_tag,
                                       x_tm_nfy_fct   pf_nfy,
                                       HANDLE_T*      ph_pmt,
                                       TM_COND_T*     pe_cond);
/*------------------------------------------------------------------*/
/*! @brief  This API loads a PMT table given an index and PAT table handle.
 *
 *  @param [in] h_pat          - References the PAT table object.
 *  @param [in] ui2_idx        - Contains the index value.
 *  @param [in] e_src_type   - Specifies the source type for loading the requested
 *                                            table.
 *  @param [in] pv_src_info  - Contains additional information describing the source.
 *  @param [in] pv_nfy_tag  - Contains a notify tag value.
 *  @param [in] pf_nfy         -  References the notify function.
 *
 *
 *  @param [out] ph_pmt     - Contains a handle which references the PMT table.
 *  @param [out] pe_cond    -Contains the condition of the PMT table.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                              - Routine successful.
 *  @retval TMR_NOT_INIT                    - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                     - One or more of the arguments contain invalid
 *                                                           data.
 *  @retval TMR_INV_HANDLE               - Invalid handle.
 *  @retval TMR_OUT_OF_HANDLES       - No handles available.
 *  @retval TMR_OUT_OF_RESOURCES  - Out of resources.
 *  @retval TMR_NO_SUPPORT              - No support.
 *  @retval TMR_INV_HANDLE_STATE    - Invalid handle state.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_load_pmt_by_idx (HANDLE_T       h_pat,
                                    UINT16         ui2_idx,
                                    TM_SRC_TYPE_T  e_src_type,
                                    VOID*          pv_src_info,
                                    VOID*          pv_nfy_tag,
                                    x_tm_nfy_fct   pf_nfy,
                                    HANDLE_T*      ph_pmt,
                                    TM_COND_T*     pe_cond);

/*------------------------------------------------------------------*/
/*! @brief This API monitors PAT tables.
 *
 *  @param [in] h_root              - References the root object.
 *  @param [in] e_src_type       - Specifies the source type for loading the requested
 *                                               table.
 *  @param [in] pv_src_info      - Contains additional information describing the source.
 *  @param [in] pv_nfy_tag      -  Contains a notify tag value.
 *  @param [in] pf_nfy             - References the notify function.
 *
 *  @param [out] ph_mon_pat  - Contains a handle which references the PAT monitor
 *                                             object.
 *  @param [out] pe_cond       - Contains the condition of the PMT table.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                              - Routine successful.
 *  @retval TMR_NOT_INIT                    - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                     - One or more of the arguments contain invalid
 *                                                           data.
 *  @retval TMR_INV_HANDLE               - Invalid handle.
 *  @retval TMR_OUT_OF_HANDLES       - No handles available.
 *  @retval TMR_OUT_OF_RESOURCES  - Out of resources.
 *  @retval TMR_NO_SUPPORT              - No support.
 *  @retval TMR_INV_HANDLE_STATE    - Invalid handle state.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_mon_pat (HANDLE_T       h_root,
                            TM_SRC_TYPE_T  e_src_type,
                            VOID*          pv_src_info,
                            VOID*          pv_nfy_tag,
                            x_tm_nfy_fct   pf_nfy,
                            HANDLE_T*      ph_mon_pat,
                            TM_COND_T*     pe_cond);

/*------------------------------------------------------------------*/
/*! @brief This API creates a PMT entry in the specified PAT
 *
 *  @param [in] h_pat                - References the PAT object
 *  @param [in] pt_pid_svc_info  -Contains the PMT's service id and PID.
 *
 *  @param [out] pe_cond          - Contains the condition of the PMT table.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                              - Routine successful.
 *  @retval TMR_NOT_INIT                    - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                     - One or more of the arguments contain invalid
 *                                                           data.
 *  @retval TMR_INV_HANDLE               - Invalid handle.
 *  @retval TMR_OUT_OF_HANDLES       - No handles available.
 *  @retval TMR_OUT_OF_RESOURCES  - Out of resources.
 *  @retval TMR_NO_SUPPORT              - No support.
 *  @retval TMR_INV_HANDLE_STATE    - Invalid handle state.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_set_pat_pmt_info (HANDLE_T               h_pat,
                                     PSI_PID_SVC_ID_INFO_T* pt_pid_svc_info,
                                     TM_COND_T*             pe_cond);

/*------------------------------------------------------------------*/
/*! @brief This API sets whether a table is available
 *
 *  @param [in] h_tbl           - References the PSI object
 *  @param [in] b_available  - Specifies the state
 *
 *  @param [out] pe_cond    - Contains the condition of the PMT table.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                              - Routine successful.
 *  @retval TMR_NOT_INIT                    - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                     - One or more of the arguments contain invalid
 *                                                           data.
 *  @retval TMR_INV_HANDLE               - Invalid handle.
 *  @retval TMR_OUT_OF_HANDLES       - No handles available.
 *  @retval TMR_OUT_OF_RESOURCES  - Out of resources.
 *  @retval TMR_NO_SUPPORT              - No support.
 *  @retval TMR_INV_HANDLE_STATE    - Invalid handle state.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_set_available (HANDLE_T   h_tbl,
                                  BOOL       b_available,
                                  TM_COND_T* pe_cond);

/*------------------------------------------------------------------*/
/*! @brief This API sets a table's version number
 *
 *  @param [in] h_tbl            - References the PSI object
 *  @param [in] ui1_version   - Contains the version number
 *
 *  @param [out] pe_cond     -  Contains the condition of the table.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                              - Routine successful.
 *  @retval TMR_NOT_INIT                    - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                     - One or more of the arguments contain invalid
 *                                                           data.
 *  @retval TMR_INV_HANDLE               - Invalid handle.
 *  @retval TMR_OUT_OF_HANDLES       - No handles available.
 *  @retval TMR_OUT_OF_RESOURCES  - Out of resources.
 *  @retval TMR_NO_SUPPORT              - No support.
 *  @retval TMR_INV_HANDLE_STATE    - Invalid handle state.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_set_version_num (HANDLE_T   h_tbl,
                                    UINT8      ui1_version,
                                    TM_COND_T* pe_cond);

/*------------------------------------------------------------------*/
/*! @brief This API sets a PMT's PCR PID
 *
 *  @param [in] h_pmt       -  References the PMT object
 *  @param [in] t_pid         - Contains the PCR PID
 *
 *  @param [out] pe_cond  - Contains the condition of the PMT table.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                              - Routine successful.
 *  @retval TMR_NOT_INIT                    - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                     - One or more of the arguments contain invalid
 *                                                           data.
 *  @retval TMR_INV_HANDLE               - Invalid handle.
 *  @retval TMR_OUT_OF_HANDLES       - No handles available.
 *  @retval TMR_OUT_OF_RESOURCES  - Out of resources.
 *  @retval TMR_NO_SUPPORT              - No support.
 *  @retval TMR_INV_HANDLE_STATE    - Invalid handle state.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_set_pmt_pcr_pid (HANDLE_T     h_pmt,
                                    MPEG_2_PID_T t_pid,
                                    TM_COND_T*   pe_cond);

/*------------------------------------------------------------------*/
/*! @brief This API inserts a stream entry in the specified PMT
 *
 *  @param [in] h_pmt                -References the PMT object
 *  @param [in] pt_stream_info   - Points to the stream's info
 *
 *  @param [out] pe_cond           - Contains the condition of the PMT table.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                              - Routine successful.
 *  @retval TMR_NOT_INIT                    - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                     - One or more of the arguments contain invalid
 *                                                           data.
 *  @retval TMR_INV_HANDLE               - Invalid handle.
 *  @retval TMR_OUT_OF_HANDLES       - No handles available.
 *  @retval TMR_OUT_OF_RESOURCES  - Out of resources.
 *  @retval TMR_NO_SUPPORT              - No support.
 *  @retval TMR_INV_HANDLE_STATE    - Invalid handle state.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_set_pmt_stream_entry (HANDLE_T           h_pmt,
                                         PSI_STREAM_INFO_T* pt_stream_info,
                                         TM_COND_T*         pe_cond);

/*------------------------------------------------------------------*/
/*! @brief  This API inserts a stream descriptor  in the specified PMT
 *
 *  @param [in] h_pmt          - References the PMT object
 *  @param [in] pui1_descr    - Points to the descriptor
 *  @param [in] z_descr_len  - Length of descriptor
 *
 *  @param [out]  pe_cond    -  Contains the condition of the PMT table.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                              - Routine successful.
 *  @retval TMR_NOT_INIT                    - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                     - One or more of the arguments contain invalid
 *                                                           data.
 *  @retval TMR_INV_HANDLE               - Invalid handle.
 *  @retval TMR_OUT_OF_HANDLES       - No handles available.
 *  @retval TMR_OUT_OF_RESOURCES  - Out of resources.
 *  @retval TMR_NO_SUPPORT              - No support.
 *  @retval TMR_INV_HANDLE_STATE    - Invalid handle state.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_set_pmt_stream_descr (HANDLE_T           h_pmt,
                                         UINT8*             pui1_descr,
                                         UINT32             z_descr_len,
                                         TM_COND_T*         pe_cond);

/*------------------------------------------------------------------*/
/*! @brief This API sets the main descriptors in the specified PMT
 *
 *  @param [in] h_pmt             - References the PMT object
 *  @param [in] pui1_descr       - Points to the stream's descriptors
 *  @param [in] z_descr_len     - Length of the descriptors
 *
 *  @param [out] pe_cond        -  Contains the condition of the PMT table.
 *
 *  @note
 *  @see
 *
 *  @return Return the error code.
 *  @retval TMR_OK                              - Routine successful.
 *  @retval TMR_NOT_INIT                    - The Table Manager is not initialized.
 *  @retval TMR_INV_ARG                     - One or more of the arguments contain invalid
 *                                                           data.
 *  @retval TMR_INV_HANDLE               - Invalid handle.
 *  @retval TMR_OUT_OF_HANDLES       - No handles available.
 *  @retval TMR_OUT_OF_RESOURCES  - Out of resources.
 *  @retval TMR_NO_SUPPORT              - No support.
 *  @retval TMR_INV_HANDLE_STATE    - Invalid handle state.
 */
/*------------------------------------------------------------------*/
extern INT32 c_psi_set_pmt_main_descr (HANDLE_T           h_pmt,
                                       UINT8*             pui1_descr,
                                       UINT32             z_descr_len,
                                       TM_COND_T*         pe_cond);

#endif /* _C_PSI_H_ */

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

