/**
*   @file    SwcRte_Cfg.h
*   @version 1.0.0
*
*   @brief   Integration Framework - Sec Rte glue-layer configuration header file
*   @details This file implements the Rte configuration header.
*
*   @addtogroup IODAL
*   @{
*/
/*===================================================================================================================
*   Platform             : PA
*
*   Autosar Version      : 4.3.1
*   Autosar Revision     : ASR_REL_4_3_REV_0001
*
*   SW Version           : 1.0.0
*   Build Version        : MPC5777CXG_MCAL_1_0_0_RTM_ASR_REL_4_3_REV_0001_20190318
*
*   (c) Copyright 2006-2016 Freescale Semiconductor, Inc. 
*       Copyright 2017-2018 NXP
*
*   All Rights Reserved.
*
*   This file contains sample code only. It is not part of the production code deliverables.
====================================================================================================================*/
/*===================================================================================================================
====================================================================================================================*/
#ifndef SWCRTE_CFG_H
#define SWCRTE_CFG_H

#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 "SwcRte_Types.h"
#include "Compiler.h"
/*===================================================================================================================
*                              SOURCE FILE VERSION INFORMATION
====================================================================================================================*/

#define SWCRTE_CFG_VENDOR_ID                      43

#define SWCRTE_CFG_SW_MAJOR_VERSION               1
#define SWCRTE_CFG_SW_MINOR_VERSION               0
#define SWCRTE_CFG_SW_PATCH_VERSION               0


/*===================================================================================================================
*                                     FILE VERSION CHECKS
====================================================================================================================*/
/* Check if SwcRte_Cfg.h header file and SwcRte_Types.h header file are of the same vendor */
#if (SWCRTE_CFG_VENDOR_ID != SWCRTE_TYPES_VENDOR_ID)
    #error "SwcRte_Cfg.h and SwcRte_Types.h have different vendor ids"
#endif


/* Check if SwcRte_Cfg.h header file and SwcRte_Types.h header file are of the same Software version */
#if ((SWCRTE_CFG_SW_MAJOR_VERSION != SWCRTE_TYPES_SW_MAJOR_VERSION) || \
     (SWCRTE_CFG_SW_MINOR_VERSION != SWCRTE_TYPES_SW_MINOR_VERSION) || \
     (SWCRTE_CFG_SW_PATCH_VERSION != SWCRTE_TYPES_SW_PATCH_VERSION) \
    )
    #error "Software Version Numbers of SwcRte_Types.h and SwcRte_Cfg.h are different"
#endif



/*==================================================================================================
                                       GLOBAL MACROS
==================================================================================================*/


#define SWCRTE_LIGTHING_APP_ENABLED      (SWCRTE_STD_ON) 

#define SWCRTE_MOTORCTRL_APP_ENABLED      (SWCRTE_STD_OFF)  

#define SWCRTE_VDR_APP_ENABLED            (SWCRTE_STD_OFF)  

#define SWCRTE_SINGLE_TASK_APPLICATION   (SWCRTE_STD_ON)  



#define SWCRTE_RTM_ENABLE                 (SWCRTE_STD_OFF)  


#define SWCRTE_MAX_LIGHTING_CHANNELS        1U
#define SWCRTE_MAX_LIGHTING_INSTANCES       3U 

#define SWCRTE_MAX_MOTORCTRL_INSTANCES      0U 
#define SWCRTE_MOTORCTRL_INSTANCE_OFFSET    3U
#define SWCRTE_MOTORCTRL_FBK_LINES          0U

#define SWCRTE_MAX_VDR_INSTANCES            0U 
#define SWCRTE_VDR_INSTANCE_OFFSET          3U

#define SWCRTE_MAX_APP_INSTANCES            (SWCRTE_MAX_LIGHTING_INSTANCES + SWCRTE_MAX_MOTORCTRL_INSTANCES + SWCRTE_MAX_VDR_INSTANCES)    

#define SWCRTE_MAX_APP_CTRL_INSTANCES       3U

#define SWCVDR_INSTANCE_ID         3U


#define  SWCRTE_MAX_TX_MESSAGE_IDS           0U
#define  SWCRTE_MAX_RX_DATA_LEN              0U


#define SWCLIGHTING_MAXIMUM_ANALOG_FDBK_VALUE   3000U 
#define SWCLIGHTING_MINIMUM_ANALOG_FDBK_VALUE   500U


#define SWCRTE_MAX_ANSENS_INSTANCES         1 
#define SWCRTE_MAX_DISENS_INSTANCES         2


#define SWCRTE_ADC_RESOLUTION               12U      

#define SWCRTE_USE_IODAL       (SWCRTE_STD_ON) 
#define SWCRTE_USE_SYSDAL  (SWCRTE_STD_ON)
#define SWCRTE_USE_MEMDAL    (SWCRTE_STD_OFF)
#define SWCRTE_USE_COMDAL    (SWCRTE_STD_OFF)

        
/*==================================================================================================
                                       GLOBAL RUN-TIME VARIABLE TYPES
==================================================================================================*/
#if SWCRTE_MAX_LIGHTING_INSTANCES > 0
typedef struct 
{
    uint32_t                   u32LightingSensorValue;   /**< @brief Value measured by input sensor */
    boolean_t                  bSensorValueUpdated;      /**< @brief Status of the Sensor*/
} SwcRte_AppLightingSensorChannelType; 

typedef struct 
{
    SwcRte_AppLightingSensorChannelType LightInputSensorData; /**< @brief Values for each FBK Channel*/
    SwcRte_AppLightingSensorChannelType aLightChannelSensorData[SWCRTE_MAX_LIGHTING_CHANNELS]; /**< @brief Values for each FBK Channel*/
} SwcRte_AppLightingSensorValueType; 

typedef struct 
{
    uint32_t aLightingOutputIntesity[SWCRTE_MAX_LIGHTING_CHANNELS]; /**< @brief Values for the output light intesity*/
    SwcRte_ChannelStateType aChannelState[SWCRTE_MAX_LIGHTING_CHANNELS];
} SwcRte_AppLightingActuatorValueType; 


#if SWCRTE_MAX_VDR_INSTANCES > 0
typedef struct
{
    SwcRte_ChannelStateType            Status;
    uint16_t                           FbkVoltage;
    uint32_t                           ActiveCommand;
    boolean_t                          RequestTx;
}SwcRte_AppLightingChanInfoType;

typedef struct 
{    
    SwcRte_AppLightingChanInfoType aLightingChanInfo[SWCRTE_MAX_LIGHTING_CHANNELS];
} SwcRte_AppLightingComInfoType; 

typedef struct
{
    boolean_t bComValueUpdated;
    uint16_t aLightChannelValue[SWCRTE_MAX_LIGHTING_CHANNELS];
} SwcRte_AppLightingComDataType; 
#endif

#endif /*SWCRTE_MAX_LIGHTING_INSTANCES*/


#if SWCRTE_MAX_MOTORCTRL_INSTANCES > 0
typedef struct 
{
    uint32_t u32MotorCtrlSensorValue;              /**< @brief Voltage Value measured by input sensor */  
    uint32_t u32MotorCtrlRotationSensorValue;      /**< @brief Voltage Value measured by RPM sensor */   
    uint32_t u32MotorCtrlCurrentSensorValue;       /**< @brief Voltage Value measured by Current sensor */   
    boolean_t bSensorValueUpdated;                 /**< @brief Signaling variable for input sensor change */   
    boolean_t bMotorCtrlRotationUpdated;           /**< @brief Signaling variable for input capture sensor change  */   
    boolean_t bMotorCtrlCurrentSensorUpdated;      /**< @brief Signaling variable for current sensor change  */   
} SwcRte_AppMotorCtrlSensorValueType;             

typedef struct 
{
    uint32_t                	   u32MotorCtrlOutputDuty;      /**< @brief Expected motor speed*/    
    SwcRte_AppMotorDirectionType   eMotorCtrlOutputDirection;   /**< @brief Values for each FBK Channel*/
} SwcRte_AppMotorCtrlActuatorValueType; 


#if SWCRTE_MAX_VDR_INSTANCES > 0

typedef struct 
{    
    uint16_t                         FbkVoltage;                /**< @brief Value for input voltage */    
    uint16_t                         FbkRotation;               /**< @brief Value for rotation speed*/
    boolean_t                        RequestTx;
} SwcRte_AppMotorCtrlComInfoType; 

typedef struct
{
    uint16_t                     MotorCtrlChannelValue;          /**< @brief Requested speed */
    boolean_t                    bComValueUpdated;               /**< @brief Message received signal */
    SwcRte_AppMotorDirectionType eMotorDirection;                /**< @brief Motor desired direction */
} SwcRte_AppMotorCtrlComDataType; 
#endif
#endif /*SWCRTE_MAX_MOTORCTRL_INSTANCES*/

/*==================================================================================================
                                       GLOBAL CONSTANTS
==================================================================================================*/
extern const SwcRte_GlobalConfigType SwcRte_AppInstanceMapPB[SWCRTE_MAX_APP_INSTANCES];


/*================================================================================================*/
/*================================================================================================*/
#ifdef __cplusplus
}
#endif
#endif /*SWCRTE_CFG_H*/
