|
#ifndef __FBL_DEF_H__
|
#define __FBL_DEF_H__
|
|
/***********************************************************************************************************************
|
* INCLUDES
|
**********************************************************************************************************************/
|
|
/* Basic type definitions */
|
#include "typedef.h"
|
|
/***********************************************************************************************************************
|
* VERSION
|
**********************************************************************************************************************/
|
|
/* ##V_CFG_MANAGEMENT ##CQProject : FblDef CQComponent : Implementation */
|
#define FBLDEF_VERSION 0x0245u
|
#define FBLDEF_RELEASE_VERSION 0x00u
|
|
#ifndef NULL
|
#define NULL ((void *)0)
|
#endif
|
|
#ifndef SWM_DATA_ALIGN
|
#define SWM_DATA_ALIGN 0
|
#endif
|
|
#define OP_STATUS_OK ((int8_t)0) /**< the operation was successful */
|
#define OP_STATUS_BUSY ((int8_t)1) /**< the operation is ongoing, call back later. */
|
#define OP_STATUS_FAIL ((int8_t)(-1)) /**< the operation failed :( */
|
|
/* CanTransmit return values */
|
#ifndef kCanTxOk
|
#define kCanTxOk 0 /* Msg transmitted */
|
#endif
|
#ifndef kCanTxFailed
|
#define kCanTxFailed 1 /* Tx path switched off */
|
#endif
|
#define kCanTxInProcess 2
|
|
/* Define return code of several functions */
|
#define kFblOk 0
|
#define kFblFailed 1
|
|
/* Parameters for ApplFblStartup() */
|
#define kStartupPreInit 0
|
#define kStartupPostInit 1
|
#define kStartupStayInBoot 2
|
|
/* Programming request flag */
|
#define kProgRequest (tFblProgStatus)0x01u
|
#define kNoProgRequest FblInvertBits(kProgRequest, tFblProgStatus)
|
|
#define kProgRequestWithResponse 0x02 /* External programming request with response required */
|
#define kProgRequestNoResponse 0x03 /* No response required to programming request */
|
/* Application validation */
|
#define kApplValid 1 /* Application is fully programmed */
|
#define kApplInvalid 0 /* Operational software is missing */
|
|
/* Memory status (flash erased detection) */
|
#define kFlashErased 1
|
#define kFlashNotErased 0
|
|
/* Define return code of security access functions */
|
/* Starts at three for future merge with GM values */
|
#define kFblSecNewSeedIssued 3 /* seed */
|
#define kFblSecGranted 4 /* seed - key - status */
|
#define kFblSecDeniedLocked 5 /* status */
|
#define kFblSecDeniedIncorrectLevel 6 /* seed */
|
#define kFblSecDeniedInvalidKey 7
|
|
/* Position of boot block: */
|
/* FBL_TOP_BOOT_BLOCK: The boot block is mapped to the high addresses */
|
/* FBL_BOTTOM_BOOT_BLOCK: The boot block is mapped to the low addresses */
|
|
#if !defined(FBL_REPEAT_CALL_CYCLE)
|
/* Set default to 1ms for repeat time of main loop */
|
#define FBL_REPEAT_CALL_CYCLE 1
|
#endif
|
|
#ifdef FBL_ENABLE_BANKING
|
#else
|
#define FBL_CALL_TYPE
|
#endif /* FBL_ENABLE_BANKING */
|
|
/* Defines to convert BigEndian bytes into short or long values ********************/
|
#ifndef C_CPUTYPE_LITTLEENDIAN
|
#define C_CPUTYPE_LITTLEENDIAN
|
#endif
|
#ifdef C_CPUTYPE_BIGENDIAN
|
#ifdef C_CPUTYPE_32BIT
|
#define FblBytesToLong(hiWrd_hiByt, hiWrd_loByt, loWrd_hiByt, loWrd_loByt) \
|
(((uint32_t)(hiWrd_hiByt) << 24) | \
|
((uint32_t)(hiWrd_loByt) << 16) | \
|
((uint32_t)(loWrd_hiByt) << 8) | \
|
((uint32_t)(loWrd_loByt)))
|
#else
|
#define FblBytesToLong(hiWrd_hiByt, hiWrd_loByt, loWrd_hiByt, loWrd_loByt) \
|
(uint32_t) * (V_MEMRAM0 V_MEMRAM1_FAR uint32_t V_MEMRAM2_FAR *)(&(hiWrd_hiByt))
|
#endif
|
#endif
|
#ifdef C_CPUTYPE_LITTLEENDIAN
|
#define FblBytesToLong(hiWrd_hiByt, hiWrd_loByt, loWrd_hiByt, loWrd_loByt) \
|
(((uint32_t)(hiWrd_hiByt) << 24) | \
|
((uint32_t)(hiWrd_loByt) << 16) | \
|
((uint32_t)(loWrd_hiByt) << 8) | \
|
((uint32_t)(loWrd_loByt)))
|
#endif
|
|
#define FBL_BIT0 0x01u
|
#define FBL_BIT1 0x02u
|
#define FBL_BIT2 0x04u
|
#define FBL_BIT3 0x08u
|
#define FBL_BIT4 0x10u
|
#define FBL_BIT5 0x20u
|
#define FBL_BIT6 0x40u
|
#define FBL_BIT7 0x80u
|
|
/* Macros and values for fblMode */
|
#define START_FROM_APPL FBL_BIT0
|
#define START_FROM_RESET FBL_BIT1
|
#define APPL_CORRUPT FBL_BIT2
|
#define STAY_IN_FBL FBL_BIT3
|
#define FBL_RESET_REQUEST FBL_BIT4
|
#define WAIT_FOR_PING FBL_BIT5
|
#define FBL_START_WITH_RESP FBL_BIT6
|
#define FBL_START_WITH_PING FBL_BIT7
|
#define SetFblMode(state) (fblMode = (uint8_t)((fblMode) | (state)))
|
#define GetFblMode() ((uint8_t)(fblMode & 0x0Fu))
|
#if defined(FBL_ENABLE_STAY_IN_BOOT)
|
#define GetFblWaitForPing() (fblMode & WAIT_FOR_PING)
|
#endif
|
#define FblSetShutdownRequest() SetFblMode(FBL_RESET_REQUEST)
|
extern uint8_t fblMode;
|
|
/* Defines for response after reset */
|
#define RESET_RESPONSE_NOT_REQUIRED ((uint8_t)0x00)
|
#define RESET_RESPONSE_SDS_REQUIRED ((uint8_t)0x01)
|
#define RESET_RESPONSE_ECURESET_REQUIRED ((uint8_t)0x02)
|
#define RESET_RESPONSE_KEYOFFON_REQUIRED ((uint8_t)0x03)
|
|
/* Access macros for FblHeader elements for application */
|
#define GetFblMainVersion() (FblHeaderTable->kFblMainVersion)
|
#define GetFblSubVersion() (FblHeaderTable->kFblSubVersion)
|
#define GetFblReleaseVersion() (FblHeaderTable->kFblBugFixVersion)
|
#define GetFblBuildVersion() (FblHeaderTable->kFblBuildVersion)
|
#if defined(FBL_ENABLE_COMMON_DATA)
|
#define GetFblCommonDataPtr() (FblHeaderTable->pFblCommonData)
|
#endif
|
|
#define FBL_START_PARAM ((void *)0)
|
#define CallFblStart(pParam) (FblHeaderTable->FblStartFct)((pParam))
|
|
/* macros to harmonize type casts for inverting bits */
|
#define FblInvertBits(x, type) ((type) ~((type)(x)))
|
#define FblInvert8Bit(x) (FblInvertBits((x), uint8_t))
|
#define FblInvert16Bit(x) (FblInvertBits((x), vuint16))
|
#define FblInvert32Bit(x) (FblInvertBits((x), vuint32))
|
|
/* Always use table for physical flash pages */
|
#define FBL_FLASHBLOCK_TABLE
|
|
/***********************************************************************************************************************
|
* TYPEDEFS
|
**********************************************************************************************************************/
|
|
typedef uint8_t tFblResult; /**< FBL result codes */
|
typedef uint8_t tFblProgStatus; /**< Status of reprogramming flag */
|
typedef uint8_t tApplStatus; /**< Application valid status */
|
typedef uint8_t tMagicFlag; /**< Application valid flag */
|
typedef uint8_t tFlashStatus; /**< Flash erased status flag */
|
|
#if defined(C_CPUTYPE_8BIT) && !defined(FBL_PROCESSOR_BANKED)
|
typedef vuint16 FBL_ADDR_TYPE;
|
typedef vuint16 FBL_MEMSIZE_TYPE;
|
#define MEMSIZE_OK
|
#else
|
typedef uint32_t FBL_ADDR_TYPE;
|
typedef uint32_t FBL_MEMSIZE_TYPE;
|
#define MEMSIZE_OK
|
#endif
|
|
#define tFblAddress FBL_ADDR_TYPE
|
#define tFblLength FBL_MEMSIZE_TYPE
|
|
typedef uint8_t FBL_MEMID_TYPE;
|
|
#ifdef MEMSIZE_OK
|
#else
|
#error "Error in FBL_DEF.H: C_CPUTYPE_ not defined."
|
#endif
|
|
/***********************************************************************************************************************
|
* DEFINES
|
**********************************************************************************************************************/
|
|
#define kFblDiagTimeP2 FBL_DIAG_TIME_P2MAX
|
#define kFblDiagTimeP2Star FBL_DIAG_TIME_P3MAX
|
|
/*****************************************************************************/
|
|
/***********************************************************************************************************************
|
* GLOBAL DATA
|
**********************************************************************************************************************/
|
|
#endif /* __FBL_DEF_H__ */
|
|
/***********************************************************************************************************************
|
* END OF FILE: FBL_DEF.H
|
**********************************************************************************************************************/
|