FLEX-FORD-OBC-BM/Source/bsw/Fbl/fbl_hw.h

192 lines
9.4 KiB
C
Raw Permalink Normal View History

2026-03-19 11:49:16 +01:00
/***********************************************************************************************************************
* FILE DESCRIPTION
* ------------------------------------------------------------------------------------------------------------------*/
/** \file
* \brief Provides hardware abstraction functions for ARM 32 systems
*
* --------------------------------------------------------------------------------------------------------------------
* COPYRIGHT
* --------------------------------------------------------------------------------------------------------------------
* \par Copyright
* \verbatim
* Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved.
*
* This software is copyright protected and proprietary to Vector Informatik GmbH.
* Vector Informatik GmbH grants to you only those rights as set out in the license conditions.
* All other rights remain with Vector Informatik GmbH.
* \endverbatim
*/
/**********************************************************************************************************************/
/***********************************************************************************************************************
* REVISION HISTORY
* --------------------------------------------------------------------------------------------------------------------
* Version Date Author Change Id Description
* --------------------------------------------------------------------------------------------------------------------
* 01.00.00 2018-11-07 vistbe Initial version
* 01.00.01 2019-12-09 vistbe ESCAN00105142 Compile Error in inline assembly
* 01.01.00 2020-02-07 vistmo FBL-1452 No changes
* 01.02.00 2020-11-03 vistmo FBL-2090 No changes
* 01.03.00 2020-12-09 visjdn FBL-2490 No changes
* 01.04.00 2020-12-21 visrie FBL-2517 Added support for AWR1
* 01.05.00 2021-01-28 visjdn FBL-2824 Added support for TPR12
* 01.06.00 2021-05-19 visjdn FBL-3038 Added/adapted MemMap sections
* 01.07.00 2021-05-31 visjdn FBL-3545 Added support for AWR2
* 01.08.00 2021-07-08 visjdn FBL-3694 Added support for Jacinto6
* 01.09.00 2021-11-22 vistmo FBL-4275 No changes
* 01.10.00 2022-01-12 visjdn FBL-3720 No changes
* 01.11.00 2022-03-09 visrie FBL-4770 Added support for ARM6 compiler
* 01.12.00 2022-07-18 visjdn FBL-5115 No changes
* 01.13.00 2023-02-09 fmenke FBL-6162 No changes
* ESCAN00113692 No changes
* 01.14.00 2023-04-20 jschmitding FBL-5733 Added support for TCC70xx
* 01.15.00 2023-07-12 fmenke FBL-6966 Add support for NCJ29D6
* 01.16.00 2024-01-01 fmenke FBL-7559 No changes
* ESCAN00116504 No changes
* 01.17.00 2024-09-27 jschmitding FBL-9330 No changes
* 01.17.01 2024-10-22 visrie ESCAN00118141 Compiler error: missing brackets for JSR function parameter
* 01.18.00 2024-12-02 fmenke FBL-9747 Support StellarSr6
* 01.19.00 2025-11-19 jostravsky FBL-11077 No changes
**********************************************************************************************************************/
#ifndef FBL_HW_H
#define FBL_HW_H
/***********************************************************************************************************************
* INCLUDES
**********************************************************************************************************************/
#if defined( FBL_USE_OWN_MEMCPY )
#else
# include <string.h>
#endif /* FBL_USE_OWN_MEMCPY */
#if defined( V_COMP_ARM6 )
# include <arm_compat.h>
#endif
#include "fbl_sfr.h" /* Special function register definition */
/***********************************************************************************************************************
* VERSION
**********************************************************************************************************************/
/* ##V_CFG_MANAGEMENT ##CQProject : FblHal_Arm32 CQComponent : Implementation */
#define FBLHAL_ARM32_VERSION 0x0119u
#define FBLHAL_ARM32_RELEASE_VERSION 0x00u
/***********************************************************************************************************************
* DEFINES
**********************************************************************************************************************/
/*!
* Internal comment removed.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
/** Memcpy function */
#if defined( FBL_USE_OWN_MEMCPY )
# define MEMCPY(dst, src, len) FblOwnMemcpy((void *)(dst), (const void *)(src), (vuint32)(len)) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */
#else
# define MEMCPY(dst, src, len) memcpy((void *)(dst), (const void *)(src), (size_t)(len)) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */
#endif /* FBL_USE_OWN_MEMCPY */
/***********************************************************************************************************************
* MACROS FOR JUMPS
**********************************************************************************************************************/
#if !defined( APPLSTART )
# define APPLSTART (*((vuint32 *)&ApplIntJmpTable[1u])) /**< Startup code of application */
#endif
#define JSR(x) (*((void(*)(void))(x)))() /**< Jump to subroutine */ /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */
#define JSR_APPL() JSR(APPLSTART) /**< Application start */
#define FblCheckBootVectTableIsValid() (ApplIntJmpTable[0u] == APPLVECT_FROM_BOOT)
/* Timer handling ----------------------------------------------------------*/
# define FblTimerGet() ((FBL_RTI_INTFLAG & 1uL) == 1uL)
# define FblTimerReset() FBL_RTI_INTFLAG = 1uL
/* PRQA S 3453 1 */ /* MD_MSR_FctLikeMacro */
#define FblFlashAddressGet3Bytes(array) (tFblAddress)( (tFblAddress)(((vuint8 *)array)[0u] << 16u) | \
(tFblAddress)(((vuint8 *)array)[1u] << 8u) | \
(tFblAddress)(((vuint8 *)array)[2u]) )
/* PRQA S 3453 1 */ /* MD_MSR_FctLikeMacro */
#define FblDownloadLengthGet3Bytes(array) (tFblLength)( (tFblLength)(((vuint8 *)array)[0u] << 16u) | \
(tFblLength)(((vuint8 *)array)[1u] << 8u) | \
(tFblLength)(((vuint8 *)array)[2u]) )
/* Read 4 bytes from diag buffer */
/* PRQA S 3453 1 */ /* MD_MSR_FctLikeMacro */
#define FblFlashAddressGet4Bytes(array) (tFblAddress)( (tFblAddress)(((vuint8 *)array)[0u] << 24u) | \
(tFblAddress)(((vuint8 *)array)[1u] << 16u) | \
(tFblAddress)(((vuint8 *)array)[2u] << 8u) | \
(tFblAddress)(((vuint8 *)array)[3u]) )
/* PRQA S 3453 1 */ /* MD_MSR_FctLikeMacro */
#define FblDownloadLengthGet4Bytes(array) (tFblLength)( (tFblLength)(((vuint8 *)array)[0u] << 24u) | \
(tFblLength)(((vuint8 *)array)[1u] << 16u) | \
(tFblLength)(((vuint8 *)array)[2u] << 8u) | \
(tFblLength)(((vuint8 *)array)[3u]) )
/* Interrupt handling ----------------------------------------------------------*/
#if defined( V_COMP_TI )
# define FblInterruptDisable() __asm(" CPSID I")
# define FblInterruptEnable() __asm(" CPSIE I")
#elif defined( V_COMP_ARM6 )
# define FblInterruptDisable() __disable_irq()
# define FblInterruptEnable() __enable_irq()
#else
# define FblInterruptDisable() __asm("CPSID I")
# define FblInterruptEnable() __asm("CPSIE I")
#endif
/* FblHwRestoreFblContext() definition -----------------------------------------*/
#define FblHwRestoreFblContext()
/***********************************************************************************************************************
* GLOBAL FUNCTION PROTOTYPES
**********************************************************************************************************************/
#define FBLHW_START_SEC_CODE
#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */
void FblTimerInit( void );
vuint16 FblGetTimerValue( void );
void FblTimerStopp( void );
/* Memory access functions */
tFblLength FblReadBlock( tFblAddress address, vuint8 *buffer, tFblLength length );
vuint8 FblReadByte( tFblAddress address );
#define FBLHW_STOP_SEC_CODE
#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */
#if defined( FBL_USE_OWN_MEMCPY )
# define FBLHW_MEMCPY_START_SEC_CODE
# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */
void * FblOwnMemcpy (void * dest, const void * source, vuint32 count);
# define FBLHW_MEMCPY_STOP_SEC_CODE
# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */
#endif /* FBL_USE_OWN_MEMCPY */
#endif /* FBL_HW_H */
/***********************************************************************************************************************
* END OF FILE: FBL_HW.H
**********************************************************************************************************************/