/***********************************************************************************************************************
 *  FILE DESCRIPTION
 *  ------------------------------------------------------------------------------------------------------------------*/
/** \file
 *  \brief         Diagnostic services supported in boot mode
 *                 Definition of services and subfunctions for state machine
 *
 *  --------------------------------------------------------------------------------------------------------------------
 *  COPYRIGHT
 *  --------------------------------------------------------------------------------------------------------------------
 *  \par Copyright
 *  \verbatim
 *  Copyright (c) 2026 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
 *  --------------------------------------------------------------------------------------------------------------------
 *  05.00.00   2022-08-15  vistmo       FBL-5514         Support Additional OTA functionality
 *                                      ESCAN00112435    No changes
 *                                      ESCAN00112575    No changes
 *  05.01.00   2022-10-04  jschmitding  FBL-5917         Make FBL SWDL 008 Compliant
 *                                      ESCAN00113919    RoutineControl Routines are protected by security access even
 *                                                        though it's not required
 *  05.01.01   2022-10-17  fmenke       ESCAN00112879    No changes
 *  05.01.02   2023-01-13  fmenke       ESCAN00112890    No changes
 *                                      ESCAN00113612    No changes
 *  05.02.00   2023-02-09  vistmo       ESCAN00112972    No changes
 *                                      ESCAN00113292    No changes
 *                                      ESCAN00113835    No changes
 *                                      ESCAN00113843    No changes
 *                                      ESCAN00113764    RID 7013 (token download) is always supported
 *                                      FBL-6438         No changes
 *  05.02.01   2023-05-11  fmenke       ESCAN00113831    No changes
 *  05.03.00   2023-07-24  fmenke       FBL-7335         No changes
 *  05.03.01   2023-08-31  lhopfhauer   ESCAN00115494    No changes
 *  05.03.02   2024-07-16  erizk        ESCAN00117344    No changes
 *  05.03.03   2025-02-06  virchl       ESCAN00118587    No changes
 *  05.04.00   2025-02-28  jjohnson     FBL-10065        No changes
 *  05.04.01   2025-06-10  jostravsky   ESCAN00120315    No changes
 *  05.04.02   2025-07-08  visarcmijo   ESCAN00119833    No changes
 *  05.05.00   2025-09-01  fmenke       FBL-11218        No changes
 *                                      ESCAN00120917    No changes
 *  05.06.00   2025-10-28  mpatil       FBL-11690        No changes
 *  05.07.00   2026-01-13  dganesh      FBL-12162        No changes
 **********************************************************************************************************************/

/***********************************************************************************************************************
 *  VERSION
 **********************************************************************************************************************/
#if ( FBLDIAG_14229_FORD_VERSION != 0x0507u ) || \
    ( FBLDIAG_14229_FORD_RELEASE_VERSION != 0x00u )
# error "Error in fbl_diag.def: State machine definition and source are inconsistent!"
#endif

#ifndef FBL_DIAG_DEF
#define FBL_DIAG_DEF

/* PRQA S 0883 EOF */ /* MD_FblDiag_0883 */

/* Some preprocessors don't like undefined (but unused) macro parameters */
#if !defined( FBL_DIAG_DISABLE_DUMMY_MACRO_PARAMETERS )
# define Root                       0u
# define DiagnosticSessionControl   0u
# define EcuReset                   0u
# define SecurityAccess             0u
# define TesterPresent              0u
# define ReadDataByIdentifier       0u
# define ReadDataById               0u
# define WriteDataByIdentifier      0u
# define WriteDataById              0u
# define RoutineControl             0u
# define RequestDownload            0u
# define RequestUpload              0u
# define TransferData               0u
# define RequestTransferExit        0u
# define DefaultSession             0u
# define ProgrammingSession         0u
# define HardReset                  0u
# define RequestSeed                0u
# define SendKey                    0u
# define SecAccessSeed              0u
# define SecAccessKey               0u
# define ZeroSubFunction            0u
# define StartRoutine               0u
# define EraseMemory                0u
# define RcEraseMemory              0u
# define CheckProgDep               0u
# define RcCheckProgDep             0u
# define ActivateSbl                0u
# define RcActivateSbl              0u
# define CheckValidApp              0u
#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC )
# define TokenDownload              0u
#endif
# define RcCheckValidApp            0u
# if defined( FBL_DIAG_ENABLE_UPDATE_SEC_BYTES )
#  define UpdateSecBytes            0u
#  define RcUpdateSecBytes          0u
# endif
# if defined( FBL_DIAG_ENABLE_UPLOAD )
# define TransferDataDownload       0u
# define TransferDataUpload         0u
# endif
# define ServiceCheck               0u
# define SubFctCheck                0u
# define TransferDataCheck          0u
# define SubRoutineCheck            0u
# define NonSubFctCheck             0u
# define RcTypeCheck                0u
#endif
#endif /* FBL_DIAG_DEF */

/* Increase compatibility with certain preprocessors */
#if defined( None )
#else
# define None                       0xFFu
#endif

/*  LEVEL 0                                         Name                       Parent                    First Child                Last Child                 Buffer Position           ID                                        Main Handler Index    Checks             Set                                                                                          Unset                              Add                                                             Clear                                                                                             Clear Fail                                                                                        Minimum Request Length                                                     Maximum Request Length                                                                           */
/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( Root                     , None                    , DiagnosticSessionControl , RequestTransferExit      , kDiagFmtServiceId       , 0x00                                    , None                , ServiceCheck     , (kDiagStateNone)                                                                           , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , 0u                                                                       , kDiagRqlUnlimited                                                                                    )
#include "fbl_diag.imp"

/*  LEVEL 1                                         Name                       Parent                    First Child                Last Child                 Buffer Position           ID                                        Main Handler Index    Checks             Set                                                                                          Unset                              Add                                                             Clear                                                                                             Clear Fail                                                                                        Minimum Request Length                                                     Maximum Request Length                                                                           */
/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( DiagnosticSessionControl , Root                    , DefaultSession           , ProgrammingSession       , kDiagFmtSubparam        , kDiagSidDiagnosticSessionControl        , None                , SubFctCheck      , (kDiagStateNone)                                                                           , (kDiagStateNone)                 , (kDiagStateFirstDownloadReq)                                  , (kDiagStateSecurityKeyAll | kDiagStateSecurityAccessAll)                                        , (kDiagStateNone)                                                                                , kDiagRqlSubfunctionService                                               , kDiagRqlUnlimited                                                                                    )
#include "fbl_diag.imp"

#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( EcuReset                 , Root                    , HardReset                , HardReset                , kDiagFmtSubparam        , kDiagSidEcuReset                        , None                , SubFctCheck      , (kDiagStateNone)                                                                           , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlSubfunctionService                                               , kDiagRqlUnlimited                                                                                    )
#include "fbl_diag.imp"

#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( SecurityAccess           , Root                    , RequestSeed              , SendKey                  , kDiagFmtSubparam        , kDiagSidSecurityAccess                  , None                , SubFctSecCheck   , (kDiagStateNone)                                                                           , (kDiagStateSessionDefault)       , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateSecurityKeyAll)                                                                      , kDiagRqlSubfunctionService                                               , kDiagRqlUnlimited                                                                                    )
#include "fbl_diag.imp"

#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( TesterPresent            , Root                    , ZeroSubFunction          , ZeroSubFunction          , kDiagFmtSubparam        , kDiagSidTesterPresent                   , None                , SubFctCheck      , (kDiagStateNone)                                                                           , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlSubfunctionService                                               , kDiagRqlUnlimited                                                                                    )
#include "fbl_diag.imp"

#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( ReadDataByIdentifier     , Root                    , None                     , None                     , kDiagFmtDataIdHigh      , kDiagSidReadDataByIdentifier            , ReadDataById        , NonSubFctCheck   , (kDiagStateNone)                                                                           , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlMinReadDataByIdentifier                                          , kDiagRqlMaxReadDataByIdentifier                                                                      )
#include "fbl_diag.imp"

#if defined( FBL_DIAG_ENABLE_WRITE_DATA_BY_IDENTIFIER )
# define FBL_DIAG_STATE_RESULT  FBL_DIAG_STATE_DEF( WriteDataByIdentifier    , Root                    , None                     , None                     , kDiagFmtDataIdHigh      , kDiagSidWriteDataByIdentifier           , WriteDataById       , NonSubFctCheck   , (kDiagStateSessionProgramming | kDiagStateSecurityAccess01)                                , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlWriteDataByIdentifier                                            , kDiagRqlUnlimited                                                                                    )
# include "fbl_diag.imp"
#endif /* FBL_DIAG_ENABLE_WRITE_DATA_BY_IDENTIFIER */

#if defined( FBL_ENABLE_USERROUTINE )
# define FBL_DIAG_STATE_RESULT  FBL_DIAG_STATE_DEF( RoutineControl           , Root                    , ActivateSbl              , CheckProgDep             , kDiagFmtSubRoutineIdHigh, kDiagSidRoutineControl                  , RoutineControl      , SubRoutineCheck  , (kDiagStateSessionProgramming)                                                             , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlRoutineControl                                                   , kDiagRqlUnlimited                                                                                    )
#else
# define FBL_DIAG_STATE_RESULT  FBL_DIAG_STATE_DEF( RoutineControl           , Root                    , ActivateSbl              , CheckProgDep             , kDiagFmtSubRoutineIdHigh, kDiagSidRoutineControl                  , None                , SubRoutineCheck  , (kDiagStateSessionProgramming)                                                             , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlRoutineControl                                                   , kDiagRqlUnlimited                                                                                    )
#endif /* FBL_ENABLE_USERROUTINE */
#include "fbl_diag.imp"

#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( RequestDownload          , Root                    , None                     , None                     , kDiagFmtSubparam        , kDiagSidRequestDownload                 , RequestDownload     , NonSubFctCheck   , (kDiagStateSessionProgramming | kDiagStateSecurityAccess01)                                , (kDiagStateNone)                 , (kDiagStateTransferDataAllowed)                               , (kDiagStateFirstDownloadReq | kDiagStateTransferDataSucceeded)                                  , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded)                               , kDiagRqlRequestDownload + kDiagSubMinLengthFormat + kDiagSubMinAddrFormat, kDiagRqlRequestDownload + kDiagSubMaxLengthFormat + kDiagSubMaxAddrFormat                            )
#include "fbl_diag.imp"

#if defined( FBL_DIAG_ENABLE_UPLOAD )
# define FBL_DIAG_STATE_RESULT  FBL_DIAG_STATE_DEF( RequestUpload            , Root                    , None                     , None                     , kDiagFmtSubparam        , kDiagSidRequestUpload                   , RequestUpload       , NonSubFctCheck   , (kDiagStateSessionProgramming | kDiagStateSecurityAccess01)                                , (kDiagStateTransferDataAllowed)  , (kDiagStateTransferDataAllowed | kDiagStateTransferDataUpload), (kDiagStateTransferDataSucceeded)                                                               , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded | kDiagStateTransferDataUpload), kDiagRqlRequestUpload + kDiagSubMinLengthFormat + kDiagSubMinAddrFormat  , kDiagRqlRequestUpload + kDiagSubMaxLengthFormat + kDiagSubMaxAddrFormat                              )
# include "fbl_diag.imp"

# define FBL_DIAG_STATE_RESULT  FBL_DIAG_STATE_DEF( TransferData             , Root                    , TransferDataDownload     , TransferDataUpload       , kDiagFmtSequenceCnt     , kDiagSidTransferData                    , None                , TransferDataCheck, (kDiagStateSessionProgramming | kDiagStateTransferDataAllowed)                             , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateTransferDataSucceeded)                                                               , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded | kDiagStateTransferDataUpload), kDiagRqlTransferDataUpload                                               , kDiagRqlUnlimited                                                                                    )
# include "fbl_diag.imp"

# define FBL_DIAG_STATE_RESULT  FBL_DIAG_STATE_DEF( RequestTransferExit      , Root                    , None                     , None                     , kDiagFmtSubparam        , kDiagSidRequestTransferExit             , RequestTransferExit , NonSubFctCheck   , (kDiagStateSessionProgramming | kDiagStateTransferDataAllowed)                             , (kDiagStateNone)                 , (kDiagStateTransferDataSucceeded)                             , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded | kDiagStateTransferDataUpload), (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded | kDiagStateTransferDataUpload), kDiagRqlRequestTransferExit                                              , kDiagRqlRequestTransferExit                                                                          )
# include "fbl_diag.imp"
#else
# if defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER )
#  define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( TransferData             , Root                    , None                     , None                     , kDiagFmtSubparam        , kDiagSidTransferData                    , TransferDataDownload, NonSubFctCheck   , (kDiagStateSessionProgramming | kDiagStateTransferDataAllowed)                             , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateTransferDataSucceeded)                                                               , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded)                               , kDiagRqlTransferDataDownload                                             , (FBL_DIAG_BUFFER_LENGTH - 1u)                                                                         )
# else
#  define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( TransferData             , Root                    , None                     , None                     , kDiagFmtSubparam        , kDiagSidTransferData                    , TransferDataDownload, NonSubFctCheck   , (kDiagStateSessionProgramming | kDiagStateTransferDataAllowed)                             , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateTransferDataSucceeded)                                                               , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded)                               , kDiagRqlTransferDataDownload                                             , ((kDiagRqlTransferDataDownload - 1u) + ((FBL_DIAG_BUFFER_LENGTH - 2u) & (~(FBL_MAX_SEGMENT_SIZE - 1u)))))
# endif /* FBL_ENABLE_UNALIGNED_DATA_TRANSFER */
# include "fbl_diag.imp"

# define FBL_DIAG_STATE_RESULT  FBL_DIAG_STATE_DEF( RequestTransferExit      , Root                    , None                     , None                     , None                    , kDiagSidRequestTransferExit             , RequestTransferExit , NonSubFctCheck   , (kDiagStateSessionProgramming | kDiagStateTransferDataAllowed)                             , (kDiagStateNone)                 , (kDiagStateTransferDataSucceeded)                             , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded)                               , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded)                               , kDiagRqlRequestTransferExit                                              , kDiagRqlRequestTransferExit                                                                          )
# include "fbl_diag.imp"
#endif /* FBL_DIAG_ENABLE_UPLOAD */

/*  LEVEL 2                                         Name                       Parent                    First Child                Last Child                 Buffer Position           ID                                        Main Handler Index    Checks             Set                                                                                          Unset                              Add                                                             Clear                                                                                             Clear Fail                                                                                        Minimum Request Length                                                     Maximum Request Length                                                                           */
/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( DefaultSession           , DiagnosticSessionControl, None                     , None                     , None                    , kDiagSubDefaultSession                  , DefaultSession      , None             , (kDiagStateNone)                                                                           , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlDiagnosticSessionControl                                         , kDiagRqlDiagnosticSessionControl                                                                     )
#include "fbl_diag.imp"

#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( ProgrammingSession       , DiagnosticSessionControl, None                     , None                     , None                    , kDiagSubProgrammingSession              , ProgrammingSession  , None             , (kDiagStateNone)                                                                           , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlDiagnosticSessionControl                                         , kDiagRqlDiagnosticSessionControl                                                                     )
#include "fbl_diag.imp"

#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( HardReset                , EcuReset                , None                     , None                     , None                    , kDiagSubHardReset                       , EcuReset            , None             , (kDiagStateNone)                                                                           , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlEcuReset                                                         , kDiagRqlEcuReset                                                                                     )
#include "fbl_diag.imp"

#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( RequestSeed              , SecurityAccess          , None                     , None                     , None                    , kDiagSubRequestSeed                     , SecAccessSeed       , None             , (kDiagStateNone)                                                                           , (kDiagStateSecurityAccessDelay01), (kDiagStateSecurityKey01)                                     , (kDiagStateSecurityKeyAll)                                                                      , (kDiagStateNone)                                                                                , kDiagRqlSecurityAccessSeed                                               , kDiagRqlSecurityAccessSeed                                                                           )
#include "fbl_diag.imp"

#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( SendKey                  , SecurityAccess          , None                     , None                     , None                    , kDiagSubSendKey                         , SecAccessKey        , None             , (kDiagStateSecurityKey01)                                                                  , (kDiagStateSecurityAccessDelay01), (kDiagStateSecurityAccess01)                                  , (kDiagStateSecurityKeyAll | kDiagStateSecurityAccessAll)                                        , (kDiagStateNone)                                                                                , kDiagRqlSecurityAccessKey                                                , kDiagRqlSecurityAccessKey                                                                            )
#include "fbl_diag.imp"

#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( ZeroSubFunction          , TesterPresent           , None                     , None                     , None                    , kDiagSubZeroSubFunction                 , TesterPresent       , None             , (kDiagStateNone)                                                                           , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlTesterPresent                                                    , kDiagRqlTesterPresent                                                                                )
#include "fbl_diag.imp"

# define FBL_DIAG_STATE_RESULT  FBL_DIAG_STATE_DEF( ActivateSbl              , RoutineControl          , StartRoutine             , StartRoutine             , kDiagFmtSubparam        , SPLIT_SHORT(kDiagRoutineIdActivateSbl)  , RcActivateSbl       , RcTypeCheck      , (kDiagStateSecurityAccess01)                                                               , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlRcActivateSbl                                                    , kDiagRqlRcActivateSbl                                                                                )
#include "fbl_diag.imp"


# define FBL_DIAG_STATE_RESULT  FBL_DIAG_STATE_DEF( CheckValidApp            , RoutineControl          , StartRoutine             , StartRoutine             , kDiagFmtSubparam        , SPLIT_SHORT(kDiagRoutineIdCheckValidApp), RcCheckValidApp     , RcTypeCheck      , (kDiagStateNone)                                                                           , (kDiagStateNone)                 , (kDiagStateFirstDownloadReq)                                  , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlRcCheckValidApp                                                  , kDiagRqlRcCheckValidApp                                                                              )
#include "fbl_diag.imp"

#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC )
# if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING )
#  define FBL_DIAG_STATE_RESULT  FBL_DIAG_STATE_DEF( TokenDownload            , RoutineControl          , StartRoutine             , StartRoutine             , kDiagFmtSubparam        , SPLIT_SHORT(kDiagRoutineIdTokenDownload), RcTokenDownload     , RcTypeCheck      , (kDiagStateNone)                                                                           , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlRcTokenDownloadMin                                               , kDiagRqlRcTokenDownloadMax                                                                           )
#  include "fbl_diag.imp"
# endif
#endif


#if defined( FBL_DIAG_ENABLE_UPDATE_SEC_BYTES )
# define FBL_DIAG_STATE_RESULT  FBL_DIAG_STATE_DEF( UpdateSecBytes           , RoutineControl          , StartRoutine             , StartRoutine             , kDiagFmtSubparam        , SPLIT_SHORT(kDiagRoutineIdUpdateSecBytes), RcUpdateSecBytes   , RcTypeCheck      , (kDiagStateSecurityAccess01)                                                               , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlRcUpdateSecBytes                                                 , kDiagRqlRcUpdateSecBytes                                                                             )
# include "fbl_diag.imp"
#endif /* FBL_DIAG_ENABLE_UPDATE_SEC_BYTES */

#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( EraseMemory              , RoutineControl          , StartRoutine             , StartRoutine             , kDiagFmtSubparam        , SPLIT_SHORT(kDiagRoutineIdEraseMemory)  , RcEraseMemory       , RcTypeCheck      , (kDiagStateSecurityAccess01)                                                               , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateFirstDownloadReq)                                                                    , (kDiagStateNone)                                                                                , kDiagRqlRcEraseMemory                                                    , kDiagRqlRcEraseMemory                                                                                )
#include "fbl_diag.imp"
#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( CheckProgDep             , RoutineControl          , StartRoutine             , StartRoutine             , kDiagFmtSubparam        , SPLIT_SHORT(kDiagRoutineIdCheckProgDep) , RcCheckProgDep      , RcTypeCheck      , (kDiagStateNone)                                                                           , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlRcCheckProgDep                                                   , kDiagRqlRcCheckProgDep                                                                               )
#include "fbl_diag.imp"

/*  LEVEL 3                                         Name                       Parent                    First Child                Last Child                 Buffer Position           ID                                        Main Handler Index    Checks             Set                                                                                          Unset                              Add                                                             Clear                                                                                             Clear Fail                                                                                        Minimum Request Length                                                     Maximum Request Length                                                                           */
/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
#define FBL_DIAG_STATE_RESULT   FBL_DIAG_STATE_DEF( StartRoutine             , None                    , None                     , None                     , None                    , kDiagSubStartRoutine                    , None                , None             , (kDiagStateNone)                                                                           , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlRoutineControl                                                   , kDiagRqlUnlimited                                                                                    )
#include "fbl_diag.imp"


#if defined( FBL_DIAG_ENABLE_UPLOAD )
# if defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER )
#  define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( TransferDataDownload     , TransferData            , None                     , None                     , None                    , kDiagSidTransferData                    , TransferDataDownload, None             , (kDiagStateNone)                                                                           , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlTransferDataDownload                                             , (FBL_DIAG_BUFFER_LENGTH - 1u)                                                                         )
# else
#  define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( TransferDataDownload     , TransferData            , None                     , None                     , None                    , kDiagSidTransferData                    , TransferDataDownload, None             , (kDiagStateNone)                                                                           , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlTransferDataDownload                                             , ((kDiagRqlTransferDataDownload - 1u) + ((FBL_DIAG_BUFFER_LENGTH - 2u) & (~(FBL_MAX_SEGMENT_SIZE - 1u)))))
# endif /* FBL_ENABLE_UNALIGNED_DATA_TRANSFER */
# include "fbl_diag.imp"

# define FBL_DIAG_STATE_RESULT  FBL_DIAG_STATE_DEF( TransferDataUpload       , TransferData            , None                     , None                     , None                    , kDiagSidTransferData                    , TransferDataUpload  , None             , (kDiagStateTransferDataUpload)                                                             , (kDiagStateNone)                 , (kDiagStateNone)                                              , (kDiagStateNone)                                                                                , (kDiagStateNone)                                                                                , kDiagRqlTransferDataUpload                                               , kDiagRqlTransferDataUpload                                                                           )
# include "fbl_diag.imp"
#endif /* FBL_DIAG_ENABLE_UPLOAD */

/***********************************************************************************************************************
 *  END OF FILE: FBL_DIAG.DEF
 **********************************************************************************************************************/
