/* 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_tsl.h 
 *  $File: //DTV/PROD_BR/DTV_X_IDTV1501/apollo/middleware/public/tsl/u_tsl.h $
 *  $Revision: #1 $
 *  $Date: 2015/05/29 $
 *  $Author: brianpc.huang $
 *  
 *  @par Description:
 *    This header file contains Transport Stream list (TSL) database
 *    API definitions, which are exported to other Middleware components
 *    and applications.
 *         
 */
/*----------------------------------------------------------------------------*/

#ifndef _U_TSL_H_
#define _U_TSL_H_
/*----------------------------------------------------------------------------*/
/*! @defgroup   groupMW_TSL Transport Stream List
 *  @ingroup    groupMW
 *  @brief      The TSL module is used to store and retrieve the tuning
 *              parameter information for the broadcast streams.
 *  @see        groupMW_CDB
 *  @{
 */
/*----------------------------------------------------------------------------*/

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

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

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

/* Return code status from API */
#define     TSLR_OK                    ((INT32)  0)    /**< Operation succeeded. */
#define	    TSLR_FAIL                  ((INT32) -1)    /**< Operation failed. */
#define     TSLR_OUT_OF_HANDLE         ((INT32) -2)    /**< Handle allocation failed. */
#define	    TSLR_OUT_OF_MEM            ((INT32) -3)    /**< Memory exhausted. */
#define	    TSLR_INV_HANDLE            ((INT32) -4)    /**< Bad handle. */
#define     TSLR_INV_ARG               ((INT32) -5)    /**< Invalid argument. */
#define	    TSLR_REC_NOT_FOUND         ((INT32) -6)    /**< Record not found. */
#define	    TSLR_NO_WRITE_LOCK         ((INT32) -7)    /**< Failed initializing RW Lock. */
#define     TSLR_NOT_FOUND             ((INT32) -8)    /**< Specified TSL object not found. */
#define     TSLR_END_OF_ITERATION      ((INT32) -9)    /**< Iteration reached end. */
#define     TSLR_MODIFIED              ((INT32) -10)    /**< Database modified since last iteration. */
#define     TSLR_DUPLICATE_REC         ((INT32) -11)    /**< Existing record with the same key value is found. */
#define     TSLR_INV_FILE_PATH         ((INT32) -12)    /**< Invalid file path. */
#define     TSLR_OUT_OF_SPACE          ((INT32) -13)    /**< Failed to allocate space on file system. */
#define     TSLR_AEE_OUT_OF_RESOURCES  ((INT32) -14)    /**< Can not allocate AEE resources. */
#define     TSLR_AEE_NO_RIGHTS         ((INT32) -15)    /**< No right for the AEE resources. */
#define     TSLR_FILE_READ_FAIL        ((INT32) -16)    /**< Failed to read from file. */
#define     TSLR_FILE_WRITE_FAIL       ((INT32) -17)    /**< Failed to write to file. */
#define     TSLR_INV_FILE_VER          ((INT32) -18)    /**< Incompatible file version. */


/* Handle type for the TSL handle. */
#define TSLT_TRANSPORT_STREAM_LIST (HT_GROUP_TSL + ((HANDLE_TYPE_T) 0))    /**< Handle type for the Transport Stream List. */

#define MAX_NW_NAME_LEN   32    /**< Maximum length for network name. */

/* Enumeration for TSL database condition */
/*------------------------------------------------------------------*/
/*!  @brief  Enumeration for TSL Database conditions
 *  @code
 *  typedef  enum
 *  {
 *      TSL_UPDATING = 1,  
 *      TSL_UPDATED,       
 *      TSL_CLOSED,        
 *      TSL_UNKNOWN
 *  } TSL_COND_T;
 *  @endcode
 *  @li@c  TSL_UPDATING                  - When tsl_lock is called.
 *  @li@c  TSL_UPDATED                   - When tsl_unlock is called.
 *  @li@c  TSL_CLOSED                    - When tsl_delete is called.
 *  @li@c  TSL_UNKNOWN                   - Unknown condition.
 */
/*------------------------------------------------------------------*/
#pragma pack(4)

typedef  enum
{
    TSL_UPDATING = 1,  /* When tsl_lock is called. */
    TSL_UPDATED,       /* When tsl_unlock is called. */
    TSL_CLOSED,        /* When tsl_delete is called. */
    TSL_UNKNOWN
} TSL_COND_T;

/* Notification reasons */
#define     TSL_REASON_UNKNOWN   ((UINT32)(0x0000))    /**< Reason unknown */
#define     TSL_RECORD_ADD       (MAKE_BIT_MASK_32(1))    /**< Reason for adding records */
#define     TSL_RECORD_DEL       (MAKE_BIT_MASK_32(2))    /**< Reason for deleting records */
#define     TSL_RECORD_MOD       (MAKE_BIT_MASK_32(3))    /**< Reason for modifying records */

/* Max length of the transport stream list name (bytes) */
#define     MAX_TSL_NAME_LEN          32    /**< Max length of the transport stream list name (bytes). */

/* Size (byte) of TSL record header and data structure. */
#define	    TSL_REC_HEADER_PADDING      16    /**< Padding size (byte) of TSL record header structure. */
#define	    TSL_REC_DATA_PADDING        268  /**60**/   /* was 52 */    /**< Padding size (byte) of TSL record data structure. */

/* Pre-set size of the TSL record structure. */
#define     TSL_REC_SIZE   (TSL_REC_HEADER_PADDING+TSL_REC_DATA_PADDING+4+MAX_NW_NAME_LEN+TSL_REC_ALTERNATE_TUNE_INFO_PADDING+TSL_REC_REFERENCE_PADDING)    /**< Pre-set size of the TSL record structure. */


/* Typedef and constants for TSL record id query flag. */
typedef     UINT8                 TSL_REC_ID_QRY_T;    /**< Typedef for TSL record id query flag. */

#define     TSL_FIRST_REC_ID      ((TSL_REC_ID_QRY_T) 1)    /**< First record ID. */
#define     TSL_LAST_REC_ID       ((TSL_REC_ID_QRY_T) 2)    /**< Last record ID. */
#define     TSL_NEXT_REC_ID       ((TSL_REC_ID_QRY_T) 3)    /**< Next record ID. */

/* Typedef and constants for TSL memory mangement policy. */
typedef	    UINT8	              TSL_MEM_POLICY_T;    /**< Typedef for TSL memory mangement policy. */

#define	    TSL_MEM_STATIC        ((TSL_MEM_POLICY_T) 0)    /**< Static memory policy. */
#define	    TSL_MEM_DYNAMIC       ((TSL_MEM_POLICY_T) 1)    /**< Dynamic memory policy. */

/* Null TSL database version id. */
#define     TSL_NULL_VER_ID       ((UINT32)0)    /**< Null TSL database version id. */

/* NULL TSL record ID value */
#define     TSL_NULL_REC_ID       ((UINT16)0)    /**< NULL TSL record ID value */

/* NULL TSL ID value. */
#define     TSL_NULL_ID           ((UINT16)0)    /**< NULL TSL ID value. */

#define     ISDB_TSL_NAME_LEN     ((UINT16) 40)    /**< Maximum length of TS name in TS Information Descriptor used in ISDB */

/* Typedef and constants for TSL record iteration flag. */
typedef	    UINT8                 TSL_ITERATE_T;    /**< Typedef for TSL record iteration flag. */

#define     TSL_NEXT_REC          ((TSL_ITERATE_T) 1)    /**< Next record */
#define     TSL_PREV_REC          ((TSL_ITERATE_T) 2)    /**< Previous record */
#define     TSL_FIRST_REC         ((TSL_ITERATE_T) 3)    /**< First record */
#define     TSL_LAST_REC          ((TSL_ITERATE_T) 4)    /**< Last record */

/*---------------------------------------------------------------------------
 Structures
----------------------------------------------------------------------------*/

#define MAX_NB_ALTERNATE_FREQ   5    /**< Maximum number of alternative frequencies. */

/*------------------------------------------------------------------*/
/*! @brief  Structure for frequency information retrieved from NIT frequency
 *          list descriptor.
 *  @code
 *  typedef struct _FREQ_INFO_T_
 *  {
 *      UINT32                      ui4_freq;
 *      TUNER_BANDWIDTH_T           e_bandwidth;
 *  }  FREQ_INFO_T;
 *  @endcode
 *  @li@c  ui4_freq                      - Central frequency.
 *  @li@c  e_bandwidth                   - Bandwidth.
 */
/*------------------------------------------------------------------*/
typedef struct _FREQ_INFO_T_
{
    UINT32                      ui4_freq;
    TUNER_BANDWIDTH_T           e_bandwidth;
}  FREQ_INFO_T;

/*------------------------------------------------------------------*/
/*! @brief  Structure for alternative tuning information used in RiksTV.
 *  @code
 *  typedef struct _ALTERNATE_TUNE_INFO_T_
 *  {
 *      FREQ_INFO_T    t_all_freq[MAX_NB_ALTERNATE_FREQ];
 *      FREQ_INFO_T    t_orig_freq;
 *      TIME_T         t_loss_event_time;
 *      UINT8          ui1_first_tune;
 *      BOOL           b_freq_updated;
 *  }  ALTERNATE_TUNE_INFO_T;
 *  @endcode
 *  @li@c  t_all_freq                    - Alternative frequencies in
 *                                         frequency list descriptor.
 *  @li@c  t_orig_freq                   - Original frequency information
 *                                         used for comparison with current
 *                                         frequency at first tune.
 *  @li@c  t_loss_event_time             - UTC time of reception signal
 *                                         loss event. After 30 days, we no
 *                                         longer need to check original &
 *                                         current frequency.
 *  @li@c  ui1_first_tune                - If 0, the TS has not been tuned to
 *                                         yet since boot up. After the first
 *                                         tune, this field is set to 1.
 *  @li@c  b_freq_updated                - Indicate whether frequency list
 *                                         descriptor has changed.
 */
/*------------------------------------------------------------------*/
typedef struct _ALTERNATE_TUNE_INFO_T_
{
    FREQ_INFO_T    t_all_freq[MAX_NB_ALTERNATE_FREQ];
    FREQ_INFO_T    t_orig_freq;
    TIME_T         t_loss_event_time;
    UINT8          ui1_first_tune;
    BOOL           b_freq_updated;
}  ALTERNATE_TUNE_INFO_T;

/* sizeof(FREQ_INFO_T) * (MAX_NB_ALTERNATE_FREQ+1) + sizeof(TIME_T) + 1 + 1
   = 8 * (5+1) + 8 + 1 + 1
   = 48 + 8 + 1 + 1
   = 58

   round off to 4 bytes boundary:  60

   Caution: in Linux solution, although offsetof(ALTERNATE_TUNE_INFO_T,
   b_freq_updated) + sizeof(BOOL) == 58, sizeof(ALTERNATE_TUNE_INFO_T) == 64.
*/
#define TSL_REC_ALTERNATE_TUNE_INFO_PADDING   64    /**< Padding size (byte) of TSL record alternative tuning information structure. */

/*------------------------------------------------------------------*/
/*! @brief  Structure for TSL record reference information for DVB-S.
 *  @code
 *  typedef struct _TSL_REC_REFERENCE_T_
 *  {
 *      UINT32          ui4_mask;
 *      UINT16          ui2_nwl_id;
 *      UINT16          ui2_nwl_rec_id;
 *      UINT16          ui2_satl_id;
 *      UINT16          ui1_satl_rec_id;
 *  }  TSL_REC_REFERENCE_T;
 *  @endcode
 *  @li@c  ui4_mask                      - User defined bit mask.
 *  @li@c  ui2_nwl_id                    - NWL ID.
 *  @li@c  ui2_nwl_rec_id                - NWL record ID.
 *  @li@c  ui2_satl_id                   - SATL ID.
 *  @li@c  ui1_satl_rec_id               - SATL record ID.
 */
/*------------------------------------------------------------------*/
typedef struct _TSL_REC_REFERENCE_T_
{
    UINT32          ui4_mask;           /* bit mask */
    UINT16          ui2_nwl_id;         /* NWL id. */
    UINT16          ui2_nwl_rec_id;     /* NWL record id. */
    UINT16          ui2_satl_id;        /* SATL id */
    UINT16          ui2_satl_rec_id;    /* SATL record id*/
}  TSL_REC_REFERENCE_T;

#define TSL_REC_REFERENCE_PADDING   12    /**< Padding size (byte) of TSL record reference structure. */

/********** Structure for common data *********/

/*------------------------------------------------------------------*/
/*!  @brief  Structure for ISDB-T digital TS infomation
 *  @code
 *  typedef struct _ISDB_TER_DIG_INFO_T
 *  {
 *      TUNER_TER_DIG_TUNE_INFO_T           t_ter_dig;
 *  	UINT8								ui1_rc_key_id;
 *  	UINT8                               ui1_num_layers;
 *  	UINT16                              ui2_prim_svc;
 *  	INT32								ai4_pr_svc_id[8];
 *  	CHAR                                ac_ts_name[ISDB_TSL_NAME_LEN+1];
 *  } ISDB_TER_DIG_INFO_T;
 *  @endcode
 *  @li@c  t_ter_dig                     - For actural tuner related information
 *  @li@c  ui1_rc_key_id                 - Remote control key ID
 *  @li@c  ui1_num_layers                - Number of layers
 *  @li@c  ui2_prim_svc                  - Service correspondent to rc_key
 *  @li@c  ai4_pr_svc_id                 - Partial reception service ID's
 *  @li@c  ac_ts_name                    - Name of the TS
 */
/*------------------------------------------------------------------*/
typedef struct _ISDB_TER_DIG_INFO_T
{
    /*for actural tuner related information */
    TUNER_TER_DIG_TUNE_INFO_T           t_ter_dig;

    UINT32                              ui4_mask;
	UINT8								ui1_rc_key_id;
	UINT8                               ui1_num_layers;
	UINT16                              ui2_prim_svc;/*only Low protection layer */

	INT32								ai4_pr_svc_id[8];/* partial reception layer service id*/
	CHAR                                ac_ts_name[ISDB_TSL_NAME_LEN+1];
} ISDB_TER_DIG_INFO_T;

/* Structure for the TSL data record */
/*------------------------------------------------------------------*/
/*!  @brief  Structure for the TSL record
 *  @code
 *  typedef struct _TSL_REC_T
 *  {
 *      UINT16      ui2_tsl_rec_id; 
 *      union 
 *      {
 *          TS_DESCR_T   t_desc ;  
 *  	    UINT8  _rec_header_padding[TSL_REC_HEADER_PADDING];
 *      } uheader;
 *      union
 *      {
 *          TUNER_CAB_DIG_TUNE_INFO_T   t_cab_dig;
 *          TUNER_SAT_DIG_TUNE_INFO_T   t_sat_dig;
 *          TUNER_TER_DIG_TUNE_INFO_T   t_ter_dig; 
 *          TUNER_CAB_ANA_TUNE_INFO_T   t_cab_ana;
 *          TUNER_SAT_ANA_TUNE_INFO_T   t_sat_ana;
 *          TUNER_TER_ANA_TUNE_INFO_T   t_ter_ana;
 *          ISDB_TER_DIG_INFO_T         t_isdbt_dig;
 *          UINT8  _rec_data_padding[TSL_REC_DATA_PADDING];
 *      } udata;
 *      CHAR s_nw_name[MAX_NW_NAME_LEN];
 *      union
 *      {
 *          ALTERNATE_TUNE_INFO_T       t_alt_ter_dig;
 *          UINT8  _alt_tune_data_padding[TSL_REC_ALTERNATE_TUNE_INFO_PADDING];
 *      } utune;
 *      union
 *      {
 *          TSL_REC_REFERENCE_T         t_ref;
 *          UINT8  _ref_data_padding[TSL_REC_REFERENCE_PADDING];
 *      } uref;
 *  } TSL_REC_T;
 *  @endcode
 *  @li@c  ui2_tsl_rec_id                - Specify the TSL record id.
 *  @li@c  t_desc                        - Specify the common description for
 *                                         this TS record.
 *  @li@c  _rec_header_padding           - Padding for the record header union
 *                                         structure.
 *  @li@c  t_cab_dig                     - Cable digital tuning parameters.
 *  @li@c  t_sat_dig                     - Satellite digital tuning parameters.
 *  @li@c  t_ter_dig                     - Terrestrial digital tuning
 *                                         parameters.
 *  @li@c  t_cab_ana                     - Cable analog tuning parameters.
 *  @li@c  t_sat_ana                     - Satellite analog tuning parameters.
 *  @li@c  t_ter_ana                     - Terrestrial analog tuning parameters.
 *  @li@c  t_isdbt_dig                   - ISDB-T didgital tuning parameters and
 *                                         related information.
 *  @li@c  _rec_data_padding             - Padding for the record data union
 *                                         structure.
 *  @li@c  s_nw_name[MAX_NW_NAME_LEN]    - Name of the network the TS belongs
 *                                         to.
 *  @li@c  t_alt_ter_dig                 - Alternate tuning freq information for
 *                                         RIKSTV support
 *  @li@c  _alt_tune_data_padding        - Padding for the alternate tuning info
 *                                         structure.
 *  @li@c  t_ref                         - TSL record reference information for
 *                                         DVB-S.
 *  @li@c  _ref_data_padding             - Padding for the TSL record reference
 *                                         structure.
 */
/*------------------------------------------------------------------*/
typedef struct _TSL_REC_T
{
    /* Transport Stream record id */
    UINT16      ui2_tsl_rec_id; 

    union 
    {
        /* See 'u_common.h' for definition of TS_DESCR_T structure. */
        TS_DESCR_T   t_desc ;  

        /* Padding to make "uheader" union 16 bytes. */
	    UINT8  _rec_header_padding[TSL_REC_HEADER_PADDING];
    } uheader;
      
    union
    {
        /* Following structures for tuning parameters are defined in 
           'u_tuner.h'. */
        TUNER_CAB_DIG_TUNE_INFO_T   t_cab_dig;
        TUNER_SAT_DIG_TUNE_INFO_T   t_sat_dig;
        TUNER_TER_DIG_TUNE_INFO_T   t_ter_dig; 

        /* Analog tuning info structure. */
        TUNER_CAB_ANA_TUNE_INFO_T   t_cab_ana;
        TUNER_SAT_ANA_TUNE_INFO_T   t_sat_ana;
        TUNER_TER_ANA_TUNE_INFO_T   t_ter_ana;
        
        /* ISDB terrestrial tuning info structure*/
        ISDB_TER_DIG_INFO_T         t_isdbt_dig;

        /* Padding to make 'udata' union 140 bytes.  */
        UINT8  _rec_data_padding[TSL_REC_DATA_PADDING];
    } udata;

    CHAR s_nw_name[MAX_NW_NAME_LEN];

    /* Alternate tuning freq information; RIKSTV support */
    union
    {
        ALTERNATE_TUNE_INFO_T       t_alt_ter_dig;
        UINT8  _alt_tune_data_padding[TSL_REC_ALTERNATE_TUNE_INFO_PADDING];
    } utune;
        
    /* TSL record reference information; DVB-S support */
    union
    {
        TSL_REC_REFERENCE_T         t_ref;
        UINT8  _ref_data_padding[TSL_REC_REFERENCE_PADDING];
    } uref;

} TSL_REC_T;

/*
 * Structure for memory dump.
 */
/*------------------------------------------------------------------*/
/*!  @brief  Structure for memory dump
 *  @code
 *  typedef struct _TSL_MEM_DUMP_T_
 *  {
 *      UINT16      ui2_tsl_id;
 *      CHAR        ps_tsl_name[MAX_TSL_NAME_LEN+1];
 *      VOID*       pv_data;
 *      UINT32      ui4_data_len;
 *  }  TSL_MEM_DUMP_T ;
 *  @endcode
 *  @li@c  ui2_tsl_id                    - ID of the Transport Stream List
 *  @li@c  ps_tsl_name                   - Name of the Transport Stream List
 *  @li@c  pv_data                       - Memory dump of TSL database
 *  @li@c  ui4_data_len                  - Size of memory allocated for pv_data
 */
/*------------------------------------------------------------------*/
typedef struct _TSL_MEM_DUMP_T_
{
    UINT16      ui2_tsl_id;
    CHAR        ps_tsl_name[MAX_TSL_NAME_LEN+1];
    VOID*       pv_data;
    UINT32      ui4_data_len;
}  TSL_MEM_DUMP_T ;

/*typedef union _UNION_POINTER_T
{
	void* value;
	uint64_t compat_value;
	uint32_t sizer;
}UNION_POINTER_T;*/

typedef struct _TSL_MEM_DUMP_EX_T_
{
    UINT16      ui2_tsl_id;
    CHAR        ps_tsl_name[MAX_TSL_NAME_LEN+1];
    UNION_POINTER_T pv_data;  // void*
    UINT32      ui4_data_len;
}  TSL_MEM_DUMP_EX_T ;

/*---------------------------------------------------------------------------
 Type definition
----------------------------------------------------------------------------*/

/*
  typedef for the TSL handle callback function.  This fucntion
  is implemented by the client of TSL.  
*/
/*------------------------------------------------------------------*/
/*! @brief  Typedef for the TSL handle callback function.  This fucntion
 *          is implemented by the client of TSL.
 *  @param  [in]  h_tsl             - Handle to the TSL object.
 *  @param  [in]  e_cond            - The status flag for the TSL object.
 *  @param  [in]  ui4_reason        - The reason for the notification.
 *  @param  [in]  pv_tag            - Private tag for the client.
 *  @param  [in]  ui4_data          - Data pass back to the application.
 *  @note   It is very important that the client MUST NOT try to read the TSL in
 *          the context of notification function.  Otherwise, a `Dead lock'
 *          situation would arise.  The client should only send a message to
 *          itself from the notification function or set a condition flag, and
 *          execute the read operation outside the context of the notification
 *          function.
 *          @par
 *          Client should also avoid doing CPU intensive task in the
 *          notification function.  If CPU intensive task needs to be performed,
 *          then the notification function should send a message to the client
 *          thread, and have the CPU intensive task executed in the client
 *          thread context.
 *  @see    c_tsl_create, c_tsl_open, c_tsl_open_by_name, c_tsl_fs_load

 */
/*------------------------------------------------------------------*/
typedef VOID (*x_tsl_nfy_fct)
(
    HANDLE_T            h_tsl,
    TSL_COND_T          e_cond,
    UINT32              ui4_reason,
    VOID*               pv_tag,
    UINT32              ui4_data
);
#pragma pack()

/*----------------------------------------------------------------------------*/
/*! @} */
/*----------------------------------------------------------------------------*/
#endif /* _U_TSL_H_ */
