Exemplo n.º 1
0
FUNC(void, SPI_CODE) Spi_SetDriverState(Spi_HWUnitType HWUnit, Spi_StatusType State)
{
    Spi_DriverState[HWUnit] = State;
}

FUNC(void, SPI_CODE) Spi_SetAllDriversState(Spi_StatusType State)
{
    Spi_HWUnitType hwunit;

    for (hwunit = 0; hwunit < SPI_NUM_DRIVERS; ++hwunit) {
        Spi_SetDriverState(hwunit, State);
    }
}

FUNC(void, SPI_CODE) Spi_Init(P2CONST(Spi_ConfigType, AUTOMATIC, SPI_APPL_DATA) ConfigPtr)
{
#if SPI_DEV_ERROR_DETECT == STD_ON

    if (AR_MODULE_IS_INITIALIZED(Spi)) {
        AR_RAISE_DEV_ERROR(SPI, INIT, SPI_E_ALREADY_INITIALIZED);
        return;
    }

    if (ConfigPtr == NULL) {
        AR_RAISE_DEV_ERROR(SPI, INIT, SPI_E_PARAM_CONFIG);
        return;
    }

    AR_MODULE_INITIALIZE(Spi);
#endif /* SPI_DEV_ERROR_DETECT */
Exemplo n.º 2
0
 * Brief               <Service for PWM initialization.>
 * ServiceId           <>
 * Sync/Async          <>
 * Reentrancy          <>
 * Param-Name[in]      <ConfigPtr: Pointer to configuration set>      
 * Param-Name[out]     <None>
 * Param-Name[in/out]  <None>
 * Return              <None>  
 * PreCondition        <>  
 * CallByAPI           <Pwm_Init> 
 */
/******************************************************************************/
#define PWM_START_SEC_CODE
#include "MemMap.h"

FUNC(void, PWM_CODE) Pwm_Mpc5634Init(P2CONST(Pwm_ConfigType, AUTOMATIC, PWM_APPL_CONST) ConfigPtr)
{	
    /** @req PWM095 */
    /** @req PWM062 */
    /** @req PWM116 */
    /** @req PWM121 */
    Pwm_ChannelType channelIterator;
	
	/* 
	 * Clock scaler uses system clock (~64MHz) as source, 
	 * so prescaler 64 => 1MHz. 
	 */
    EMIOS.MCR.B.GPRE = PWM_PRESCALER - 1;
    EMIOS.MCR.B.GPREN = 1;	/* Enable eMIOS clock */
    EMIOS.MCR.B.FRZ = 0;	/* PWM_FREEZE_ENABLE */
    EMIOS.MCR.B.GTBE = 1;	/* Use global time base */
Exemplo n.º 3
0
    return Dio_Functions[map->FunctionIndex].ReadPort(map->HwPort);
}

FUNC(void, DIO_CODE) Dio_WritePort(Dio_PortType PortId, Dio_PortLevelType Level)
{
    Dio_PortMappingType const * map;

    if (PortId >= DIO_NUM_PORTS) {
        AR_RAISE_DEV_ERROR(DIO, WRITE_PORT, DIO_E_PARAM_INVALID_PORT_ID);
    }

    map = &Dio_Ports_to_Functions[PortId];
    Dio_Functions[map->FunctionIndex].WritePort(map->HwPort, Level);
}

FUNC(Dio_PortLevelType, DIO_CODE) Dio_ReadChannelGroup(P2CONST(Dio_ChannelGroupType, AUTOMATIC, DIO_APLL_DATA) ChannelGroupIdPtr)
{
    Dio_PortMappingType const * map;

    /* DIO_E_PARAM_INVALID_GROUP_ID */

    map = &Dio_Ports_to_Functions[ChannelGroupIdPtr->port];
    return Dio_Functions[map->FunctionIndex].ReadPort(map->HwPort);
}

FUNC(void, DIO_CODE) Dio_WriteChannelGroup(P2CONST(Dio_ChannelGroupType, AUTOMATIC, DIO_APPL_DATA) ChannelGroupIdPtr,
                                           Dio_PortLevelType Level)
{
    Dio_PortMappingType const * map;

    /* DIO_E_PARAM_INVALID_GROUP_ID */
tpl_app_table[APP_COUNT];
#endif

/**
 * service for sending an IOC queued message
 *
 * @param ioc_id identifier of the ioc
 * @param ioc_data pointer to the data struct to send
 *
 * @retval IOC_E_OK no error
 * @retval IOC_E_LIMIT queue is full
 *
 */
FUNC(tpl_status, OS_CODE) tpl_ioc_send_queued_service(
  VAR(tpl_ioc_id, AUTOMATIC) ioc_id,
  P2CONST(tpl_ioc_message, AUTOMATIC, OS_VAR) ioc_data
)
{
  P2CONST(tpl_ioc_queued_mo, AUTOMATIC, OS_CONST) ioc_stat;
  P2CONST(tpl_ioc_queue, AUTOMATIC, OS_CONST)     queue_stat;
  VAR(tpl_ioc_buffer, AUTOMATIC)                  data_ptr;
  P2VAR(uint8, AUTOMATIC, AUTOMATIC)			  ioc_data_ptr;
  VAR(tpl_status, AUTOMATIC)                      result = E_OK;
  VAR(tpl_status, AUTOMATIC)                  ioc_result=IOC_E_OK;
  VAR(tpl_ioc_size, AUTOMATIC)                    message;
  GET_CURRENT_CORE_ID(core_id)

  /*  lock the task system  */
  LOCK_KERNEL()

  /*  store information for error hook routine    */
Exemplo n.º 5
0
void WsFodMgr_MainFunction (void)
{
  WdgM_CheckpointIdType CheckpointId;
  Dem_FaultDetectionCounterType EventIdFaultDetectionCounter;
  Dem_DTCType DTCofEvent;
  Dem_DTCKindType DTCKind;
  boolean EventTested;
  boolean EventFailed;
  Dem_EventStatusExtendedType EventStatusExtended;
  Dem_EventStatusType EventStatus;
  NvM_DstPtrType DstPtr_0;
  NvM_SrcPtrType SrcPtr;
  NvM_DstPtrType DstPtr;
  boolean BlockChanged;
  uint8 DataIndexPtr;
  uint8 DataIndex;
  NvM_RequestResultType RequestResultPtr;
  GenericByte DiagCtrlFreeze;
  uint8 DiagCtrlFod;
  P2CONST(ResData, AUTOMATIC, AUTOMATIC) ResDataVal;
  P2CONST(FodDataV40, AUTOMATIC, AUTOMATIC) SCI_FODMGR_FodDataValue;
  P2VAR(FodDetectTh, AUTOMATIC, AUTOMATIC) Value_6;
  FodDetectTh Value_5;
  P2VAR(FodDetectTh, AUTOMATIC, AUTOMATIC) Value_4;
  FodDetectTh Value_3;
  P2VAR(FodDetectTh, AUTOMATIC, AUTOMATIC) Value_2;
  FodDetectTh Value_1;
  P2VAR(FodDetectTh, AUTOMATIC, AUTOMATIC) Value_0;
  FodDetectTh Value;
  P2VAR(SftyBoolTF, AUTOMATIC, AUTOMATIC) SftyBoolValue_8;
  SftyBoolTF SftyBoolValue_7;
  P2VAR(SftyBoolTF, AUTOMATIC, AUTOMATIC) SftyBoolValue_6;
  SftyBoolTF SftyBoolValue_5;
  P2VAR(SftyBoolTF, AUTOMATIC, AUTOMATIC) SftyBoolValue_4;
  SftyBoolTF SftyBoolValue_3;
  P2VAR(SftyBoolTF, AUTOMATIC, AUTOMATIC) SftyBoolValue_2;
  SftyBoolTF SftyBoolValue_1;
  P2VAR(SftyBoolTF, AUTOMATIC, AUTOMATIC) SftyBoolValue_0;
  SftyBoolTF SftyBoolValue;
  P2VAR(SftyBoolOO, AUTOMATIC, AUTOMATIC) SCI_FODMGR_SftyOnOffValue_0;
  SftyBoolOO SCI_FODMGR_SftyOnOffValue;
  GenericByte NvFlag_0;
  GenericByte NvFlag;
  Std_ReturnType status;

  NvFlag = Rte_IrvRead_WsFodMgr_MainFunction_NvFlag();

  Rte_IrvWrite_WsFodMgr_MainFunction_NvFlag(NvFlag_0);

  Rte_IWrite_WsFodMgr_MainFunction_PP_ForeignObjectDetected_SCI_FODMGR_SftyOnOffValue(&SCI_FODMGR_SftyOnOffValue);

  SCI_FODMGR_SftyOnOffValue_0 = Rte_IWriteRef_WsFodMgr_MainFunction_PP_ForeignObjectDetected_SCI_FODMGR_SftyOnOffValue();

  Rte_IWrite_WsFodMgr_MainFunction_PP_FodCheckDuringChrg_SftyBoolValue(&SftyBoolValue);

  SftyBoolValue_0 = Rte_IWriteRef_WsFodMgr_MainFunction_PP_FodCheckDuringChrg_SftyBoolValue();

  Rte_IWrite_WsFodMgr_MainFunction_PP_FodCheckStartUpChrg_SftyBoolValue(&SftyBoolValue_1);

  SftyBoolValue_2 = Rte_IWriteRef_WsFodMgr_MainFunction_PP_FodCheckStartUpChrg_SftyBoolValue();

  Rte_IWrite_WsFodMgr_MainFunction_PP_FodCheckZMDown_SftyBoolValue(&SftyBoolValue_3);

  SftyBoolValue_4 = Rte_IWriteRef_WsFodMgr_MainFunction_PP_FodCheckZMDown_SftyBoolValue();

  Rte_IWrite_WsFodMgr_MainFunction_PP_FodCheckZMUp_SftyBoolValue(&SftyBoolValue_5);

  SftyBoolValue_6 = Rte_IWriteRef_WsFodMgr_MainFunction_PP_FodCheckZMUp_SftyBoolValue();

  Rte_IWrite_WsFodMgr_MainFunction_PP_FodPreCheck_SftyBoolValue(&SftyBoolValue_7);

  SftyBoolValue_8 = Rte_IWriteRef_WsFodMgr_MainFunction_PP_FodPreCheck_SftyBoolValue();

  Rte_IWrite_WsFodMgr_MainFunction_PP_FodCheckDuringChrgTh_Value(Value);

  Value_0 = Rte_IWriteRef_WsFodMgr_MainFunction_PP_FodCheckDuringChrgTh_Value();

  Rte_IWrite_WsFodMgr_MainFunction_PP_FodCheckZMDownTh_Value(Value_1);

  Value_2 = Rte_IWriteRef_WsFodMgr_MainFunction_PP_FodCheckZMDownTh_Value();

  Rte_IWrite_WsFodMgr_MainFunction_PP_FodCheckZMUpTh_Value(Value_3);

  Value_4 = Rte_IWriteRef_WsFodMgr_MainFunction_PP_FodCheckZMUpTh_Value();

  Rte_IWrite_WsFodMgr_MainFunction_PP_FodPreCheckTh_Value(Value_5);

  Value_6 = Rte_IWriteRef_WsFodMgr_MainFunction_PP_FodPreCheckTh_Value();

  SCI_FODMGR_FodDataValue = Rte_IRead_WsFodMgr_MainFunction_RP_FodData_SCI_FODMGR_FodDataValue();

  ResDataVal = Rte_IRead_WsFodMgr_MainFunction_RP_ResData_ResDataVal();

  DiagCtrlFod = Rte_IRead_WsFodMgr_MainFunction_WspDiagCtrl_cmdFodActivate_DiagCtrlFod();

  DiagCtrlFreeze = Rte_IRead_WsFodMgr_MainFunction_WspDiagCtrl_cmdFodFreeze_DiagCtrlFreeze();

  status = Rte_Call_RP_NvMService_GetErrorStatus(&RequestResultPtr);

  status = Rte_Call_RP_NvMService_SetDataIndex(DataIndex);

  status = Rte_Call_RP_NvMService_GetDataIndex(&DataIndexPtr);

  status = Rte_Call_RP_NvMService_SetRamBlockStatus(BlockChanged);

  status = Rte_Call_RP_NvMService_ReadBlock(DstPtr);

  status = Rte_Call_RP_NvMService_WriteBlock(SrcPtr);

  status = Rte_Call_RP_NvMService_RestoreBlockDefaults(DstPtr_0);

  status = Rte_Call_RP_NvMService_InvalidateNvBlock();

  status = Rte_Call_Event_METAL_ON_PAD_SetEventStatus(EventStatus);

  status = Rte_Call_Event_METAL_ON_PAD_ResetEventStatus();

  status = Rte_Call_Event_METAL_ON_PAD_GetEventStatus(&EventStatusExtended);

  status = Rte_Call_Event_METAL_ON_PAD_GetEventFailed(&EventFailed);

  status = Rte_Call_Event_METAL_ON_PAD_GetEventTested(&EventTested);

  status = Rte_Call_Event_METAL_ON_PAD_GetDTCOfEvent(DTCKind, &DTCofEvent);

  status = Rte_Call_Event_METAL_ON_PAD_PrestoreFreezeFrame();

  status = Rte_Call_Event_METAL_ON_PAD_ClearPrestoredFreezeFrame();

  status = Rte_Call_Event_METAL_ON_PAD_GetFaultDetectionCounter(&EventIdFaultDetectionCounter);

  status = Rte_Call_alive_WdgMSvEnt_FodMgr_CheckpointReached(CheckpointId);

  status = Rte_Call_alive_WdgMSvEnt_FodMgr_UpdateAliveCounter();

}
Exemplo n.º 6
0
    0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
    0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
    0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
    0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
    0x2d02ef8dUL
};
#endif

/*
**  Global Functions.
*/
#define CRC_START_SEC_CODE
#include "MemMap.h"

FUNC(uint8, CRC_CODE) Crc_CalculateCRC8(
    P2CONST(uint8, AUTOMATIC, CRC_APPL_DATA) Crc_DataPtr,
    uint32 Crc_Length,
    uint8 Crc_StartValue8)
{
#if CRC_8_MODE == CRC_8_RUNTIME
    uint16  idx;
    boolean bit;
    uint8   c;
    uint8   crc;

    crc = Crc_StartValue8;

    while (Crc_Length--) {
        c = *Crc_DataPtr++;

        for (idx = ((uint8)0x80); idx > ((uint8)0x00); idx >>= 1) {
Exemplo n.º 7
0
#define PORT_START_SEC_VAR_UNSPECIFIED
#include "MemMap.h"

P2CONST(Port_ConfigType, STATIC, PORT_VAR)  Port_Config;

#define PORT_STOP_SEC_VAR_UNSPECIFIED
#include "MemMap.h"

/*
**  Global Functions.
*/
#define PORT_START_SEC_CODE
#include "MemMap.h"

FUNC(void, PORT_CODE) Port_Init(P2CONST(Port_ConfigType, AUTOMATIC, PORT_APPL_DATA) ConfigPtr)
{
#if AR_DEV_ERROR_DETECT(PORT) == STD_ON
    AR_MODULE_INITIALIZE(PORT);
#endif
    /* Port_ConfigurationPtr = ConfigPtr; */
    AR_SAVE_CONFIG_PTR(Port);

    KAR_IMPLEMENT_PORT_INIT();
}

/* todo: Variante, die 'E_NOT_OK' zurückliefert!!! */
/* todo: 'INITIALIZED' (Rechtschreibung!?) */
#define AR_ASSERT_MODULE_INITIALZATION(mod, service)                      \
    _BEGIN_BLOCK                                                          \
    if (!AR_MODULE_IS_INITIALIZED(mod)) {                                 \
Exemplo n.º 8
0
#include "tpl_os_definitions.h"
#include "tpl_os_task_kernel.h"
#include "tpl_os_event_kernel.h"
#include "tpl_os_action.h"
#include "tpl_os_error.h"
#include "tpl_os_errorhook.h"

#define OS_START_SEC_CODE
#include "tpl_memmap.h"

/**
 *  action function for action call back
 */
FUNC(void, OS_CODE) tpl_action_callback(
  P2CONST(tpl_action, AUTOMATIC, OS_APPL_CONST) action)
{
  /*
   * A tpl_action * is cast to a tpl_callback_action *
   * This violate MISRA rule 45. However, since the
   * first member of tpl_callback_action is a tpl_action
   * This cast behaves correctly.
   */
  ((P2CONST(tpl_callback_action, AUTOMATIC, OS_APPL_CONST))action)->callback();
}

/**
 *  action function for action by task activation
 */
FUNC(void, OS_CODE) tpl_action_activate_task(
  P2CONST(tpl_action, AUTOMATIC, OS_APPL_CONST) action
Exemplo n.º 9
0
Arquivo: Gpt.c Projeto: LuYuan81/icore
/*
 * Brief               <Initializes the hardware timer module.>
 * ServiceId           <0x01>
 * Sync/Async          <Synchronous>
 * Reentrancy          <Non Reentrant>
 * Param-Name[in]      <configPtr>      
 * Param-Name[out]     <None>
 * Param-Name[in/out]  <None>
 * Return              <None>  
 * PreCondition        <None>  
 * CallByAPI           <None> 
 */
/******************************************************************************/
#define GPT_START_SEC_CODE
#include "MemMap.h"
FUNC(void,GPT_CODE) Gpt_Init(P2CONST(Gpt_ConfigType,AUTOMATIC,GPT_APPL_DATA)configPtr)
{
	/** @req GPT280 */ 
	/** @req GPT006 */
	/** @req GPT068 */
	/** @req GPT205 */
	/** @req GPT309 */
#if (GPT_DEV_ERROR_DETECT == STD_ON)	
	/** @req GPT307 */
	if(TRUE == Gpt_Global.initRun)
	{
		Det_ReportError(MODULE_ID_GPT,0,GPT_INIT_SERVICE_ID,GPT_E_ALREADY_INITIALIZED);
		return;
	}
			   
	/** @req GPT294 */		   
Exemplo n.º 10
0
        Spi_HwSeqEvent_at[SeqIdx_u16].Guard_u8 = SPI_HW_UNDEF ;
    }
    Spi_HwJobsSort() ;
    Spi_DlcInit() ;
}

FUNC(void, SPI_CODE) Spi_HwDeInit(void)
{
    Spi_DlcClose() ;
}

/* SourceId : SPI_SourceId_061 */
/* Requirements : AR_SPI_SR139, AR_SPI_SR151, AR_SPI_SR199, AR_SPI_SR270, AR_SPI_SR272 */
FUNC(Std_ReturnType, SPI_CODE) Spi_HwSetEvent
(
    P2CONST(Spi_HwEventType, AUTOMATIC, SPI_VAR) Hw_Event_pt
)
{
    uint16_least SeqId_u16;       /* id of a sequence, used as index of the sequence array */
    uint16_least JobNr_u16;       /* number of jobs in a configuration */
    uint16_least HW_Inst_Nr_u8;   /* Instance of the SPI Hw */
    Std_ReturnType Ret_loc ;

    SeqId_u16 = (uint16_least)Hw_Event_pt->TaskID_u8;
    HW_Inst_Nr_u8 =  Spi_ConfigPtr_pt->Spi_SeqCfg[SeqId_u16].Spi_JobList[0U];
    Ret_loc = E_NOT_OK;
	
    if (Hw_Event_pt->Event_u8 == SPI_HW_EV_CANCEL)
    {
        /* start critical section */
        Spi_GlobalSuspend();
Exemplo n.º 11
0
  * This file contains an Rte component template / example code
  *
  * This file has been automatically generated by
  * EB tresos AutoCore Rte Generator Version 6.1.75
  * on Mon Apr 16 09:34:11 CEST 2018. !!!IGNORE-LINE!!!
  */

 /* \addtogroup Rte Runtime Environment
  * @{ */

#include "Rte_SCI_DiagCtrl.h"

/*------------------------[runnable entity skeletons]------------------------*/

#ifdef RTE_PTR2ARRAYTYPE_PASSING
Std_ReturnType DiagCtrl_zMover_ReturnControlToECU (P2CONST(Dcm_Data0x81C2_RCTE_COR_ArrayType, AUTOMATIC, RTE_APPL_CONST) ControlOptionRecord, P2CONST(Dcm_Data0x81C2_RCTE_CEMR_ArrayType, AUTOMATIC, RTE_APPL_CONST) ControlEnableMaskRecord, P2VAR(Dcm_Data0x81C2_RCTE_CSR_ArrayType, AUTOMATIC, RTE_APPL_DATA) ControlStatusRecord, P2VAR(NegativeResponseCodeType, AUTOMATIC, RTE_APPL_DATA) ErrorCode)
#else
Std_ReturnType DiagCtrl_zMover_ReturnControlToECU (P2CONST(uint8, AUTOMATIC, RTE_APPL_CONST) ControlOptionRecord, P2CONST(uint8, AUTOMATIC, RTE_APPL_CONST) ControlEnableMaskRecord, P2VAR(uint8, AUTOMATIC, RTE_APPL_DATA) ControlStatusRecord, P2VAR(NegativeResponseCodeType, AUTOMATIC, RTE_APPL_DATA) ErrorCode)
#endif
{
  P2VAR(GenericByte, AUTOMATIC, AUTOMATIC) DiagCtrlFreeze_0;
  GenericByte DiagCtrlFreeze;
  Std_ReturnType status;

  Rte_IWrite_DiagCtrl_zMover_ReturnControlToECU_WspDiagCtrl_cmdZMovFreeze_DiagCtrlFreeze(DiagCtrlFreeze);

  DiagCtrlFreeze_0 = Rte_IWriteRef_DiagCtrl_zMover_ReturnControlToECU_WspDiagCtrl_cmdZMovFreeze_DiagCtrlFreeze();

  return status;
}