Ftfc_Fls_Ip_Cfg.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral : FTFC_FLS_IP IPV_QSPI
  5. * Dependencies : none
  6. *
  7. * Autosar Version : 4.4.0
  8. * Autosar Revision : ASR_REL_4_4_REV_0000
  9. * Autosar Conf.Variant :
  10. * SW Version : 1.0.0
  11. * Build Version : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
  12. *
  13. * (c) Copyright 2020-2021 NXP Semiconductors
  14. * All Rights Reserved.
  15. *
  16. * NXP Confidential. This software is owned or controlled by NXP and may only be
  17. * used strictly in accordance with the applicable license terms. By expressly
  18. * accepting such terms or by downloading, installing, activating and/or otherwise
  19. * using the software, you are agreeing that you have read, and that you agree to
  20. * comply with and are bound by, such license terms. If you do not agree to be
  21. * bound by the applicable license terms, then you may not retain, install,
  22. * activate or otherwise use the software.
  23. ==================================================================================================*/
  24. #ifndef FTFC_FLS_IP_CFG_H
  25. #define FTFC_FLS_IP_CFG_H
  26. /**
  27. * @file Ftfc_Fls_Ip_Cfg.h
  28. *
  29. * @addtogroup FLS
  30. * @{
  31. */
  32. /* implements Ftfc_Fls_Ip_Cfg.h_Artifact */
  33. #ifdef __cplusplus
  34. extern "C"{
  35. #endif
  36. /*==================================================================================================
  37. * INCLUDE FILES
  38. * 1) system and project includes
  39. * 2) needed interfaces from external units
  40. * 3) internal and external interfaces from this unit
  41. ==================================================================================================*/
  42. #include "OsIf.h"
  43. #include "S32K146_FTFC.h"
  44. #include "S32K146_MSCM.h"
  45. #include "S32K146_SIM.h"
  46. /*==================================================================================================
  47. * SOURCE FILE VERSION INFORMATION
  48. ==================================================================================================*/
  49. #define FTFC_FLS_IP_VENDOR_ID_CFG 43
  50. #define FTFC_FLS_IP_AR_RELEASE_MAJOR_VERSION_CFG 4
  51. #define FTFC_FLS_IP_AR_RELEASE_MINOR_VERSION_CFG 4
  52. #define FTFC_FLS_IP_AR_RELEASE_REVISION_VERSION_CFG 0
  53. #define FTFC_FLS_IP_SW_MAJOR_VERSION_CFG 1
  54. #define FTFC_FLS_IP_SW_MINOR_VERSION_CFG 0
  55. #define FTFC_FLS_IP_SW_PATCH_VERSION_CFG 0
  56. /*==================================================================================================
  57. * FILE VERSION CHECKS
  58. ==================================================================================================*/
  59. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  60. /* Check if current file and OsIf.h header file are of the same Autosar version */
  61. #if ((FTFC_FLS_IP_AR_RELEASE_MAJOR_VERSION_CFG != OSIF_AR_RELEASE_MAJOR_VERSION) || \
  62. (FTFC_FLS_IP_AR_RELEASE_MINOR_VERSION_CFG != OSIF_AR_RELEASE_MINOR_VERSION) \
  63. )
  64. #error "AutoSar Version Numbers of Ftfc_Fls_Ip_Cfg.h and OsIf.h are different"
  65. #endif
  66. #endif
  67. /*==================================================================================================
  68. DEFINES AND MACROS
  69. ==================================================================================================*/
  70. #define FTFx_HARDWARE_TYPE FTFC_Type
  71. #define FTFx_HARDWARE_UNIT IP_FTFC
  72. #define FTFx_FPROT_COUNT FTFC_FPROT_COUNT
  73. #define FTFx_FSTAT_CCIF_MASK FTFC_FSTAT_CCIF_MASK
  74. #define FTFx_FSTAT_ACCERR_MASK FTFC_FSTAT_ACCERR_MASK
  75. #define FTFx_FSTAT_FPVIOL_MASK FTFC_FSTAT_FPVIOL_MASK
  76. #define FTFx_FSTAT_MGSTAT0_MASK FTFC_FSTAT_MGSTAT0_MASK
  77. #define FTFx_FSTAT_RDCOLERR_MASK FTFC_FSTAT_RDCOLERR_MASK
  78. #define FTFx_FERSTAT_DFDIF_MASK FTFC_FERSTAT_DFDIF_MASK
  79. #define FTFx_FCNFG_ERSSUSP_MASK FTFC_FCNFG_ERSSUSP_MASK
  80. #define FTFx_FSTAT_MGSTAT3_MASK (0x00U)
  81. #define FTFx_FSTAT_MGSTAT2_MASK (0x00U)
  82. #define FTFx_FSTAT_MGSTAT1_MASK (0x00U)
  83. /* Mask of FTFx IP-related error flags */
  84. #define FTFx_ERR_FLAGS_MASK (FTFx_FSTAT_RDCOLERR_MASK | \
  85. FTFx_FSTAT_ACCERR_MASK | \
  86. FTFx_FSTAT_FPVIOL_MASK | \
  87. FTFx_FSTAT_MGSTAT3_MASK | \
  88. FTFx_FSTAT_MGSTAT2_MASK | \
  89. FTFx_FSTAT_MGSTAT1_MASK | \
  90. FTFx_FSTAT_MGSTAT0_MASK)
  91. #define FTFC_FLS_IP_INVALID_PREBUF_FROM_RAM (STD_ON)
  92. #define FTFC_FLS_IP_SYNCRONIZE_CACHE (STD_ON)
  93. #if (STD_ON == FTFC_FLS_IP_SYNCRONIZE_CACHE)
  94. #define FTFC_FLS_D_FLASH_CACHEABLE (STD_ON)
  95. #endif
  96. #define FTFC_ENABLE_USER_MODE_SUPPORT (STD_OFF)
  97. #define FTFC_TIMEOUT_SUPERVISION_ENABLED (STD_OFF)
  98. #define FTFC_ERASE_VERIFICATION_ENABLED (STD_OFF)
  99. #define FTFC_PROGRAM_VERIFICATION_ENABLED (STD_OFF)
  100. #define FTFC_ERASED_VALUE (0xFFFFFFFFU)
  101. #define FTFC_ECC_CHECK (STD_OFF)
  102. #define FTFC_ECC_CHECK_BY_AUTOSAR_OS (STD_OFF)
  103. #if ( (FTFC_ECC_CHECK == STD_ON) || (FTFC_ECC_CHECK_BY_AUTOSAR_OS == STD_ON) )
  104. /* Support for all the derivatives excepting the M0++ core missing some registers related to read syndrome(CFSR) and data address(BFAR) */
  105. #define FTFC_ECC_SYNDROME_AND_DATA_ADDRESS_CHECK (STD_ON)
  106. #if (FTFC_ECC_SYNDROME_AND_DATA_ADDRESS_CHECK == STD_ON)
  107. #define FTFC_DSI_EXC_SYNDROME (0x00008200U)
  108. #endif
  109. /*Return value for Fls_DsiHandler and Fls_MciHandler*/
  110. /**
  111. * Return value for Fls_DsiHandler and Fls_MciHandler.
  112. * module does not feel responsible (e.g. address does not belong to its current job,
  113. * there is no current pending read/compare job, the syndrome is different).
  114. *
  115. */
  116. #define FLS_UNHANDLED (0U)
  117. /**
  118. * Return value for Fls_DsiHandler and Fls_MciHandler.
  119. * module feels responsible, but wants to repeat the causing instruction.
  120. * Maybe: it still uses information in MCM or ECSM module, but they are outdated
  121. * (e.g. due to an erroneous DMA transfer in the meantime)
  122. *
  123. */
  124. #define FLS_HANDLED_RETRY (1U)
  125. /**
  126. * Return value for Fls_DsiHandler and Fls_MciHandler.
  127. * module feels responsible, the current job is marked as failed,
  128. * processing may continue, skipping the causing instruction.
  129. *
  130. */
  131. #define FLS_HANDLED_SKIP (2U)
  132. /**
  133. * Return value for Fls_DsiHandler and Fls_MciHandler.
  134. * module feels responsible, but the only reaction is to stop the system
  135. * (e.g.: try to shut-down in a quite safe way)
  136. *
  137. */
  138. #define FLS_HANDLED_STOP (3U)
  139. #endif /* #if ( (FTFC_ECC_CHECK == STD_ON) || (FTFC_ECC_CHECK_BY_AUTOSAR_OS == STD_ON) ) */
  140. /*! Enable development error check */
  141. #define DEV_ASSERT_FTFC(x)
  142. #define FTFC_TIMEOUT_TYPE (OSIF_COUNTER_DUMMY)
  143. #if (STD_ON == FTFC_TIMEOUT_SUPERVISION_ENABLED)
  144. #define FTFC_ASYNC_WRITE_TIMEOUT (2147483647U)
  145. #define FTFC_ASYNC_ERASE_TIMEOUT (2147483647U)
  146. #define FTFC_SYNC_WRITE_TIMEOUT (2147483647U)
  147. #define FTFC_SYNC_ERASE_TIMEOUT (2147483647U)
  148. #define FTFC_ABORT_TIMEOUT (32767U)
  149. #endif /*(STD_ON == FTFC_TIMEOUT_SUPERVISION_ENABLED)*/
  150. /* Flash memory characteristics */
  151. #define FTFC_P_FLASH_BASE_ADDR (0x00000000UL)
  152. #define FTFC_P_FLASH_SIZE (0x100000UL)
  153. #define FTFC_P_FLASH_SECTOR_SIZE (0x1000UL)
  154. #define FTFC_D_FLASH_BASE_ADDR (0x10000000UL)
  155. #define FTFC_D_FLASH_SIZE (0x10000UL)
  156. #define FTFC_D_FLASH_SECTOR_SIZE (0x800UL)
  157. /* Valid P_FLASH address */
  158. #define FTFC_ADDRESS_VALID_P_FLASH(addr) ( (addr) < (FTFC_P_FLASH_BASE_ADDR + FTFC_P_FLASH_SIZE) )
  159. /* Valid D_FLASH address */
  160. #define FTFC_ADDRESS_VALID_D_FLASH(addr) ( (FTFC_D_FLASH_BASE_ADDR <= (addr)) && ((addr) < (FTFC_D_FLASH_BASE_ADDR + FTFC_D_FLASH_SIZE)) )
  161. /* Valid P_FLASH or D_FLASH address */
  162. #define FTFC_ADDRESS_VALID(addr) ( FTFC_ADDRESS_VALID_P_FLASH(addr) || FTFC_ADDRESS_VALID_D_FLASH(addr) )
  163. /* Check if the address is sector alignment or not */
  164. #define FTFC_SECTOR_ALIGNED(addr) ( ( ((addr) & (FTFC_P_FLASH_SECTOR_SIZE - 1UL)) == 0UL ) || ( ((addr) & (FTFC_D_FLASH_SECTOR_SIZE - 1UL)) == 0UL ) )
  165. /* FlexNVM Partition Code Ratios (DFLASH_EEPROM sizes in KB) - used for Program Partition Command */
  166. #define FLASH_FLEXNVM_DFLASH_EEPROM_DEFAULT (0x0FU) /* Bit value:1111 Data flash (KByte):default*/
  167. #if (0x8000UL == FTFC_D_FLASH_SIZE)
  168. #define FLASH_FLEXNVM_DFLASH_EEPROM_32_0_V1 (0x00U) /* Bit value:0000 Data flash (KByte):32 EEPROM backup (KByte):0 */
  169. #define FLASH_FLEXNVM_DFLASH_EEPROM_0_32_V1 (0x03U) /* Bit value:0011 Data flash (KByte):0 EEPROM backup (KByte):32 */
  170. #define FLASH_FLEXNVM_DFLASH_EEPROM_0_32_V2 (0x08U) /* Bit value:1000 Data flash (KByte):0 EEPROM backup (KByte):32 */
  171. #define FLASH_FLEXNVM_DFLASH_EEPROM_8_24_V1 (0x09U) /* Bit value:1001 Data flash (KByte):8 EEPROM backup (KByte):24 */
  172. #define FLASH_FLEXNVM_DFLASH_EEPROM_32_0_V2 (0x0BU) /* Bit value:1011 Data flash (KByte):32 EEPROM backup (KByte):0 */
  173. #elif (0x10000UL == FTFC_D_FLASH_SIZE)
  174. #define FLASH_FLEXNVM_DFLASH_EEPROM_64_0_V1 (0x00U) /* Bit value:0000 Data flash (KByte):64 EEPROM backup (KByte):0 */
  175. #define FLASH_FLEXNVM_DFLASH_EEPROM_32_32_V1 (0x03U) /* Bit value:0011 Data flash (KByte):64 EEPROM backup (KByte):0 */
  176. #define FLASH_FLEXNVM_DFLASH_EEPROM_0_64_V1 (0x04U) /* Bit value:0100 Data flash (KByte):64 EEPROM backup (KByte):0 */
  177. #define FLASH_FLEXNVM_DFLASH_EEPROM_0_64_V2 (0x08U) /* Bit value:1000 Data flash (KByte):64 EEPROM backup (KByte):0 */
  178. #define FLASH_FLEXNVM_DFLASH_EEPROM_16_48_V1 (0x0AU) /* Bit value:1010 Data flash (KByte):64 EEPROM backup (KByte):0 */
  179. #define FLASH_FLEXNVM_DFLASH_EEPROM_32_32_V2 (0x0BU) /* Bit value:1011 Data flash (KByte):64 EEPROM backup (KByte):0 */
  180. #define FLASH_FLEXNVM_DFLASH_EEPROM_64_0_V2 (0x0CU) /* Bit value:1100 Data flash (KByte):64 EEPROM backup (KByte):0 */
  181. #elif (0x80000UL == FTFC_D_FLASH_SIZE)
  182. #define FLASH_FLEXNVM_DFLASH_EEPROM_512_0_V1 (0x00U) /* Bit value:0000 Data flash (KByte):64 EEPROM backup (KByte):0 */
  183. #define FLASH_FLEXNVM_DFLASH_EEPROM_448_64_V1 (0x04U) /* Bit value:0100 Data flash (KByte):64 EEPROM backup (KByte):0 */
  184. #define FLASH_FLEXNVM_DFLASH_EEPROM_512_0_V2 (0x0FU) /* Bit value:1111 Data flash (KByte):64 EEPROM backup (KByte):0 */
  185. #endif
  186. /* Code block size (flash read partition size) */
  187. #define FLS_P_BLOCK_SIZE (0x80000U)
  188. /*==================================================================================================
  189. GLOBAL CONSTANT DECLARATIONS
  190. ==================================================================================================*/
  191. #define FLS_START_SEC_CONFIG_DATA_UNSPECIFIED
  192. #include "Fls_MemMap.h"
  193. extern const Ftfc_ConfigType FlsConfigSet_VS_0_InitCfg;
  194. #define FLS_STOP_SEC_CONFIG_DATA_UNSPECIFIED
  195. #include "Fls_MemMap.h"
  196. #ifdef __cplusplus
  197. }
  198. #endif
  199. /** @} */
  200. #endif /* FTFC_FLS_IP_CFG_H */