/*==================================================================================================
* Project : RTD AUTOSAR 4.4
* Platform : CORTEXM
* Peripheral : Stm_Pit_Rtc_Emios
* Dependencies : none
*
* Autosar Version : 4.4.0
* Autosar Revision : ASR_REL_4_4_REV_0000
* Autosar Conf.Variant :
* SW Version : 0.9.0
* Build Version : S32K3_RTD_0_9_0__ASR_REL_4_4_REV_0000_20210326
*
* (c) Copyright 2020 - 2021 NXP Semiconductors
* All Rights Reserved.
*
* NXP Confidential. This software is owned or controlled by NXP and may only be
* used strictly in accordance with the applicable license terms. By expressly
* accepting such terms or by downloading, installing, activating and/or otherwise
* using the software, you are agreeing that you have read, and that you agree to
* comply with and are bound by, such license terms. If you do not agree to be
* bound by the applicable license terms, then you may not retain, install,
* activate or otherwise use the software.
==================================================================================================*/

#ifndef GPT_PIT_TYPES_H
#define GPT_PIT_TYPES_H
/**
*   @file    Pit_Ip_Types.h
*
*   @addtogroup pit_ip Pit IPL
*
*   @{
*/
#ifdef __cplusplus
extern "C"{
#endif

/*==================================================================================================
*                                        INCLUDE FILES
* 1) system and project includes
* 2) needed interfaces from external units
* 3) internal and external interfaces from this unit
==================================================================================================*/
#include "Pit_Ip_Cfg_Defines.h"

/*==================================================================================================
*                              SOURCE FILE VERSION INFORMATION
==================================================================================================*/

#define PIT_IP_TYPES_VENDOR_ID                       43
#define PIT_IP_TYPES_AR_RELEASE_MAJOR_VERSION        4
#define PIT_IP_TYPES_AR_RELEASE_MINOR_VERSION        4
#define PIT_IP_TYPES_AR_RELEASE_REVISION_VERSION     0
#define PIT_IP_TYPES_SW_MAJOR_VERSION                0
#define PIT_IP_TYPES_SW_MINOR_VERSION                9
#define PIT_IP_TYPES_SW_PATCH_VERSION                0


/*==================================================================================================
*                                     FILE VERSION CHECKS
==================================================================================================*/
#if (PIT_IP_DEFINES_VENDOR_ID_CFG != PIT_IP_TYPES_VENDOR_ID)
    #error "Pit_Ip_Cfg_Defines.h and Pit_Ip_Types.h have different vendor ids"
#endif
/* Check if header file and Gpt header file are of the same Autosar version */
#if ((PIT_IP_DEFINES_AR_RELEASE_MAJOR_VERSION_CFG != PIT_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
     (PIT_IP_DEFINES_AR_RELEASE_MINOR_VERSION_CFG != PIT_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
     (PIT_IP_DEFINES_AR_RELEASE_REVISION_VERSION_CFG != PIT_IP_TYPES_AR_RELEASE_REVISION_VERSION) \
    )
    #error "AutoSar Version Numbers of Pit_Ip_Cfg_Defines.h and Pit_Ip_Types.h are different"
#endif
/* Check if source file and GPT header file are of the same Software version */
#if ((PIT_IP_DEFINES_SW_MAJOR_VERSION_CFG != PIT_IP_TYPES_SW_MAJOR_VERSION) || \
     (PIT_IP_DEFINES_SW_MINOR_VERSION_CFG != PIT_IP_TYPES_SW_MINOR_VERSION) || \
     (PIT_IP_DEFINES_SW_PATCH_VERSION_CFG != PIT_IP_TYPES_SW_PATCH_VERSION) \
    )
    #error "Software Version Numbers of Pit_Ip_Cfg_Defines.h and Pit_Ip_Types.h are different"
#endif
/*==================================================================================================
*                                          CONSTANT-LIKE DEFINES
==================================================================================================*/

/*==================================================================================================
*                                      FUNCTION-LIKE DEFINES(MACROS)
==================================================================================================*/

#if (PIT_IP_USED == STD_ON)
/**
* @brief PIT Channels defines
*/
#ifdef PIT_RTI_CHANNEL_EXISTS
#define RTI         ((uint8)4)
#endif

#endif /*PIT_IP_USED == STD_ON*/

/*==================================================================================================
*                                            ENUMS
==================================================================================================*/
/**
 * @brief     Pit Status error
 * @details   Status error
 */
typedef enum
{ 
PIT_IP_SUCCESS = E_OK,      /**< @brief Status value is SUCCESS */
PIT_IP_ERROR = E_NOT_OK     /**< @brief Status value is ERROR */
} Pit_Ip_StatusType;

/*==================================================================================================
*                                STRUCTURES AND OTHER TYPEDEFS
==================================================================================================*/
/**
* @brief    Callback type for each channel 
* @details  Pit_Ip_CallbackType
* 
*/
typedef void (*Pit_Ip_CallbackType)(uint8 callbackParam);

#if (defined (PIT_IP_RTI_USED) && (PIT_IP_RTI_USED == STD_ON))
/**
* @brief    Callback type for each channel 
* @details  errorReportCallBackType
* 
*/
typedef void (*errorReportCallBackType)(void);
#endif 
/**
 * @brief       Structure to configure the PIT
 *
 * @details     This structure holds the configuration settings for the PIT
 * Implements : 
 */
typedef struct
{
    boolean enableStandardTimers;  /**< @brief Enable standard timer */
#if (defined (PIT_IP_RTI_USED) && (PIT_IP_RTI_USED == STD_ON))
    boolean enableRTITimer;        /**< @brief Enable real time interrupt timer */
#endif
    boolean stopRunInDebug;        /**< @brief Stop timer running in debug mode */
} Pit_Ip_InstanceConfigType;

/**
 * @brief       Structure to configure the PIT timer channel
 *
 * @details     This structure holds the configuration settings for the PIT timer channel
 * Implements : 
 */
typedef struct
{
    uint8                      hwChannel;           /**< @brief Timer channel number */
#if (defined (PIT_IP_RTI_USED) && (PIT_IP_RTI_USED == STD_ON))    
    errorReportCallBackType    errorReportCallBack;   /**< @brief errorReportCallBack */
#endif    
    boolean                    enableInterrupt;     /**< @brief Enable interrupt generation */
    Pit_Ip_CallbackType        callback;            /**< @brief callback                */
    uint8                      callbackParam;       /**< @brief callbackParam           */
} Pit_Ip_ChannelConfigType;

/**
 * @brief       internal context structure
 *
 * @details     This structure is used by the IPL driver for internal logic. 
 *              The content is populated on Init
 */
typedef struct
{
    boolean                    chInit;                  /**< @brief chInit */
#if (defined (PIT_IP_RTI_USED) && (PIT_IP_RTI_USED == STD_ON))    
    errorReportCallBackType    errorReportCallBack;     /**< @brief errorReportCallBack */
#endif
    Pit_Ip_CallbackType        callback;                /**< @brief callback */
    uint8                      callbackParam;           /**< @brief callbackParam */
} Pit_Ip_State;

/*==================================================================================================
*                                GLOBAL VARIABLE DECLARATIONS
==================================================================================================*/

/*==================================================================================================
*                                    FUNCTION PROTOTYPES
==================================================================================================*/

#ifdef __cplusplus
}
#endif

/** @} */
#endif /*PIT_IP_TYPES_H*/

