/* BEGIN_FILE_HDR ************************************************************************************************ * NOTICE * This software is the property of HiRain Technologies. Any information contained in this * doc should not be reproduced, or used, or disclosed without the written authorization from * HiRain Technologies. ************************************************************************************************ * File Name : Fee.h ************************************************************************************************ * Module Name : Fee_Z20K14X * Title : Fee.h ************************************************************************************************ * Platform : ARM * Peripheral : FEE * Autosar Version : 4.2.2 * Package Version : 01.00.00 ************************************************************************************************ * Description : This is Application H-file for the Fee of Z20K14X ECU * ************************************************************************************************ * Limitations : None * ************************************************************************************************ * ************************************************************************************************ * Revision History: * * Version Date Initials CR# Descriptions * --------- ---------- ------------ ---------- --------------- * 01.00.00 2022/11/4 huan.ji N/A Original * * ************************************************************************************************ * END_FILE_HDR*/ #ifndef FEE_H #define FEE_H #ifdef __cplusplus extern "C"{ #endif /******************************************************************************************************** INCLUDE FILES *********************************************************************************************************/ #include "Fee_Cfg.h" #include "Fee_Version.h" /********************************************************************************************************************** MODULE VERSION MACROS **********************************************************************************************************************/ /****DEFINES AND MACROS****/ /**All service IDs (passed to DET)*/ /** Fee_interface */ #define FEE_INIT_ID ((uint8)0x00U) /** Fee_interface */ #define FEE_SETMODE_ID ((uint8)0x01U) /** Fee_interface */ #define FEE_READ_ID ((uint8)0x02U) /** Fee_interface */ #define FEE_WRITE_ID ((uint8)0x03U) /** Fee_interface */ #define FEE_CANCEL_ID ((uint8)0x04U) /** Fee_interface */ #define FEE_GETSTATUS_ID ((uint8)0x05U) /** Fee_interface */ #define FEE_GETJOBRESULT_ID ((uint8)0x06U) /** Fee_interface */ #define FEE_INVALIDATEBLOCK_ID ((uint8)0x07U) /** Fee_interface */ #define FEE_GETVERSIONINFO_ID ((uint8)0x08U) /** Fee_interface */ #define FEE_ERASEIMMEDIATEBLOCK_ID ((uint8)0x09U) /** Fee_interface */ #define FEE_JOBENDNOTIFICATION_ID ((uint8)0x10U) /** Fee_interface */ #define FEE_JOBERRORNOTIFICATION_ID ((uint8)0x11U) /** Fee_interface */ #define FEE_MAINFUNCTION_ID ((uint8)0x12U) /* Vendor specific API */ /** Fee_interface */ #define FEE_GETRUNTIMEINFO_ID ((uint8)0x13U) /** Fee_interface */ #define FEE_FORCESWAPONNEXTWRITE_ID ((uint8)0x14U) /**Development error codes (passed to DET)*/ /** API called when module was not initialized */ #define FEE_E_UNINIT ((uint8)0x01U) /** API called with invalid block number */ #define FEE_E_INVALID_BLOCK_NO ((uint8)0x02U) /** API called with invalid block offset */ #define FEE_E_INVALID_BLOCK_OFS ((uint8)0x03U) /** API called with invalid data pointer */ #define FEE_E_PARAM_POINTER ((uint8)0x04U) /** API called with invalid length information */ #define FEE_E_INVALID_BLOCK_LEN ((uint8)0x05U) /** API called while module is busy processing a user request */ #define FEE_E_BUSY ((uint8)0x06U) /** API called while module is busy doing internal management operations */ #define FEE_E_BUSY_INTERNAL ((uint8)0x07U) /** API called while module is not busy because there is no job to cancel */ #define FEE_E_INVALID_CANCEL ((uint8)0x08U) /** API Fee_init failed */ #define FEE_E_INIT_FAILED ((uint8)0x09U) /* Vendor Specific Define */ /** API called when underlying driver has cancel API disabled */ #define FEE_E_CANCEL_API ((uint8)0x0AU) /** API called with invalid cluster group index */ #define FEE_E_CLUSTER_GROUP_IDX ((uint8)0x0BU) /** API number of foreign blocks from data flash exceeds the total number of blocks allowed which is FEE_MAX_NR_OF_BLOCKS */ #define FEE_E_FOREIGN_BLOCKS_OVF ((uint8)0x0CU) /* Fee module Addition operation */ #define FEE_OPERATIONADD(pClrHdrPtr, ClusterOperation)\ pClrHdrPtr + ClusterOperation /* Fee module Subtraction operation */ #define FEE_OPERATIONSUB(pClrHdrPtr, ClusterOperation)\ pClrHdrPtr - ClusterOperation /* Fee module Calculate the block header checksum */ #define FEE_CHECKSUM(uBlockNumber, uLength, uTargetAddress)\ uBlockNumber + uLength + uTargetAddress /* Fee module BlockConfig operation */ #define FEE_BLOCKCONFIG(Index, Param)\ Fee_BlockConfig[Index].Param /* Fee module BlockSize Calculate operation */ #define FEE_BLOCKSIZE ((uBlockSize / FEE_VIRTUAL_PAGE_SIZE) + 1U) * FEE_VIRTUAL_PAGE_SIZE /* Fee module Clear Group operation */ #define FEE_CLRGRPS(Index1, Index2, Param)\ Fee_ClrGrps[Index1].clrPtr[Index2].Param /* process only valid and inconsistent blocks from the current cluster */ #define FEE_VAILDCURRENT (Fee_uJobIntClrGrpIt == uBlockClusterGrp) &&\ ((FEE_BLOCK_VALID == Fee_aBlockInfo[Fee_uJobIntBlockIt].eBlockStatus) ||\ (FEE_BLOCK_INCONSISTENT == Fee_aBlockInfo[Fee_uJobIntBlockIt].eBlockStatus) ||\ (FEE_BLOCK_INCONSISTENT_COPY == Fee_aBlockInfo[Fee_uJobIntBlockIt].eBlockStatus)) #define FEE_PARAMDIF ((boolean)TRUE == bBufferValid) && (FEE_CLUSTER_VALID == eClrStatus) &&\ (uClrStartAddr == uCfgStartAddr) && (uClrSize == uCfgClrSize) &&\ (uClrID > FEE_CLRGRPINFO(Fee_uJobIntClrGrpIt, uActClrID)) /* Fee module clear group operation */ #define FEE_CLRGRP(Index, Param)\ Fee_ClrGrps[Index].Param /* Fee module Foreign Block Config */ #define FEE_FOREIGNBLOCKCONFIG(Index,Param)\ Fee_ForeignBlockConfig[Index].Param /* Fee module Block Information */ #define FEE_BLOCKINFO(Index, Param)\ Fee_aBlockInfo[Index].Param /* Fee module clear group information operation */ #define FEE_CLRGRPINFO(Index, Param)\ Fee_aClrGrpInfo[Index].Param /* Deserialize scalar parameter from the buffer */ #define FEE_DESERIALIZE( pDeserialPtr, ParamVal, ParamType ) \ for(unsigned char i=0; i