/**
 * @file  hv_drv_TypecInternalGlobals.h
 * @brief  Internal globals header files
 *        File contains globals used internally within the PSF stack
 * @details This file provides the following functions: \n
 *          (1) \n
 *          (2) \n
 *          (3) \n
 *
 * 
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2022-08-25
 * @copyright Copyright(c),2022-8, Hiview Software. All rights reserved.
 * @par History:
 * <table>
 * <tr><th>Author                         <th>Date         <th>Change Description
 * <tr><td>Hiview SoC Software Team       <td>2022-08-25   <td>init
 * </table>
*/


#ifndef _HV_DRV_TYPECINTERNALGLOBALS_H_
#define _HV_DRV_TYPECINTERNALGLOBALS_H_


// *****************************************************************************
// *****************************************************************************
// Section: Data types and constants
// *****************************************************************************
// *****************************************************************************

/*Timer module globals*/
extern PDTIMER gasPDTimers[MAX_CONCURRENT_TIMERS];

/*Type C module globals*/
extern TYPEC_CONTROL  gasTypeCcontrol[CONFIG_PD_PORT_COUNT];

/*Protocol Layer globals*/

/* PRL State variables */
extern PROTOCOL_LAYER_STRUCT gasPRL [CONFIG_PD_PORT_COUNT];

 /* PRL receiver Struct*/
extern PRL_RECVBUFF gasPRLRecvBuff [CONFIG_PD_PORT_COUNT];

#if (HV_TRUE == INCLUDE_PD_3_0)
    /* PRL extended message buffer for Tx & Rx*/
    extern PRL_EXTMSG_BUFF gasExtendedMsgBuff [CONFIG_PD_PORT_COUNT];

    /* PRL chunk state variable struct*/
    extern PRL_CHUNK_STRUCT gasChunkSM [CONFIG_PD_PORT_COUNT];

#endif 
   
/*Policy Engine globals*/
extern POLICY_ENGINE_STATUS gasPolicyEngine[CONFIG_PD_PORT_COUNT];

/*Policy manager globals*/
extern DEVICE_POLICY_MANAGER gasDPM[CONFIG_PD_PORT_COUNT];

/*Power Management Control globals*/
#if (HV_TRUE == INCLUDE_POWER_MANAGEMENT_CTRL)
    /*State of the port whether IDLE or Active*/
    extern UINT8 gau8ISRPortState [CONFIG_PD_PORT_COUNT];
    /*Timer ID of IDLE Timer*/
    extern UINT8 gau8PortIdleTimerID [CONFIG_PD_PORT_COUNT];
    /*MCU Idle flag*/
    extern UINT8 gu8SetMCUIdle;

#endif

/*PDFU globals*/
#if (HV_FALSE != INCLUDE_PDFU)    
    extern UINT8 gu8PDFUResBuffer[PRL_MAX_EXTN_MSG_LEN_IN_BYTES];
#endif
    
/********************Power Balancing globals************************************/
#if (HV_TRUE == INCLUDE_POWER_BALANCING) 
    /* Power Balancing Internal System Parameters */
    extern PB_INT_SYS_PARAM gsPBIntSysParam; 
    /* Power Balancing Internal Port Parameters */
    extern PB_INT_PORT_PARAM gasPBIntPortParam[CONFIG_PD_PORT_COUNT]; 
    /* Sequence in which ports are attached */
    extern UINT8 gu8AttachSeq; 
    /* Timer used to wait for Asynchronous request from the Sink */
    extern UINT8 gu8PBTimerID; 
#endif 
/**************************************************************************************************/ 
       
/********************Power Throttling globals************************************/
#if (HV_TRUE == INCLUDE_POWER_THROTTLING)
    /* Power Throttling Port Parameters */
    extern UINT8 gau8PTPrevBank[CONFIG_PD_PORT_COUNT];  
#endif  
/**************************************************************************************************/  

#if(HV_TRUE == INCLUDE_UPD_HPD)
typedef UINT16 HPD_CONTROL;
extern HPD_CONTROL gu16HPDStsISR[CONFIG_PD_PORT_COUNT];

extern UINT8 gu8HPDNextIndex[CONFIG_PD_PORT_COUNT];
#endif
// *****************************************************************************
// *****************************************************************************
//  Section: Interface Routines
// *****************************************************************************
// *****************************************************************************
 /****************************************************************************
    Function:
        void IntGlobals_PDInitialization(void)

    Summary:
        Internal globals initialization API

    Devices Supported:
        HiView Typec Controller

    Description:
        This API initializes internal globals of various modules per port 
        specifically 

    Conditions:
        None

    Input:
        None

    Return:
        None

    Remarks:
        None

*****************************************************************************/
void IntGlobals_PDInitialization (void);
/*****************************************************************************/
/*****************************************************************************/
#endif /*_INT_GLOBALS_H_*/
