/*!
* @file     Fee_InternalTypes.h
*
* @version  1.0.0
*
* @brief    AUTOSAR Module Fee Driver - Fee driver internal types declaration head file
*
* @attention
*
* Project Name      : AUTOSAR MCAL
*
* Platform          : Arm
*
* Autosar Standard  : Classic Platform 4.4.0
*
* Compiled Version  : G32A10xx_MCAL_1_0_0_01-Otc-25
*
* Copyright (C) 2026 Geehy Semiconductor
*
* You may not use this file except in compliance with the
* GEEHY COPYRIGHT NOTICE (Geehy Semiconductor Software License Agreement).
*
* The program is only for reference, which is distributed in the hope
* that it will be usefull and instructional for customers to develop
* their software. Unless required by applicable law or agreed to in
* writing, the program is distributed on an "AS IS" BASIS, WITHOUT
* ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
* See the Geehy Semiconductor Software License Agreement for the governing permissions
* and limitations under the License.
*/

#ifndef FEE_INTERNALTYPES_H
#define FEE_INTERNALTYPES_H

#ifdef __cplusplus
extern "C" {
#endif

/** @addtogroup G32A10xx_StdPeriphDriver
  @{
*/

/** @defgroup FEE_Driver
  * @brief FEE driver modules
  @{
*/

/** @defgroup FEE_Macros
  @{
*/
/**********************************************************************************************************************
                    VENDOR ID & AUTOSAR VERSION INFO
**********************************************************************************************************************/
/** Vendor ID (vendorId) of the dedicated implementation of this module according to the AUTOSAR vendor list. */
#define FEE_INTERNALTYPES_H_VENDOR_ID                   0x00C1U
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define FEE_INTERNALTYPES_H_AR_RELEASE_MAJOR_VERSION    0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define FEE_INTERNALTYPES_H_AR_RELEASE_MINOR_VERSION    0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define FEE_INTERNALTYPES_H_AR_RELEASE_REVISION_VERSION 0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define FEE_INTERNALTYPES_H_SW_MAJOR_VERSION            0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define FEE_INTERNALTYPES_H_SW_MINOR_VERSION            0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define FEE_INTERNALTYPES_H_SW_PATCH_VERSION            0x00U

/**@} end of group FEE_Macros */

/**********************************************************************************************************************
                    ENUMERATION DEFINITION
**********************************************************************************************************************/
/** @defgroup FEE_Enumerations
  @{
*/

/**
 * @brief    ths status of Fee cluster header
 */
typedef enum
{
    FEE_CLRST_VALID          = 0x0, //!< Fee cluster is valid
    FEE_CLRST_INVALID        = 0x1, //!< Fee cluster is invalid
    FEE_CLRST_INCONSISTENT   = 0x2, //!< Fee cluster is inconsistent
    FEE_CLRST_HEADER_INVALID = 0x3  //!< Fee cluster header is invalid(garbled)
} Fee_ClusterStatusType;

/**
 * @brief    ths status of Fee block header
 */
typedef enum
{
    FEE_BLKST_VALID = 0,      //!< Fee block is valid
    FEE_BLKST_INVALID,        //!< Fee block is invalid (has been invalidated)
    FEE_BLKST_INCONSISTENT,   //!< Fee block is inconsistent (contains bogus data)
    FEE_BLKST_HEADER_INVALID, //!< Fee block header is invalid (garbled)
    FEE_BLKST_INVALIDATED,    //!< Fee block header is invalidated by API Fee_InvalidateBlock (only used when STD_ON == FEE_BLOCK_ALWAYS_AVAILABLE_SUPPORT )
    FEE_BLKST_HEADER_BLANK,  //!< Fee block header is blank
#if(STD_OFF == FEE_MARK_EMPTY_BLOCKS_INVALID_SUPPORT)
    FEE_BLKST_INCONSISTENT_COPY, //!< FEE data read error during swap (ie data area was allocated)
    FEE_BLKST_NEVER_WRITTEN      //!< FEE block was never written in data flash
#else
    FEE_BLKST_INCONSISTENT_COPY //!< FEE data read error during swap (ie data area was allocated)
#endif
} Fee_BlockStatusType;

/**
 * @brief    ths job Type executed by Fee_MainFunction
 */
typedef enum
{
    FEE_READ_JOB = 0, //!< the job to Read Fee block

    FEE_WRITE_JOB,                //!< the job to Write Fee block to flash
    FEE_WRITE_DATA_JOB,           //!< the job to Write Fee block data to flash
    FEE_WRITE_UNALIGNED_DATA_JOB, //!< the job to Write unaligned rest of Fee block data to flash
    FEE_WRITE_VALIDATE_JOB,       //!< the job to Validate Fee block by writing validation flag to flash
    FEE_WRITE_DONE_JOB,           //!< the job to Finalize validation of Fee block

    FEE_INVAL_BLOCK_JOB,      //!< the job to Invalidate Fee block by writing the invalidation flag to flash
    FEE_INVAL_BLOCK_DONE_JOB, //!< the job to Finalize invalidation of Fee block

    FEE_ERASE_IMMEDIATE_JOB,      //!< the job to Erase (pre-allocate) immediate Fee block
    FEE_ERASE_IMMEDIATE_DONE_JOB, //!< the job to Finalize erase (pre-allocation) of Fee block

    FEE_INT_SCAN_JOB,                 //!< the job to Initialize the cluster scan job
    FEE_INT_SCAN_CLR_HDR_PARSE_JOB,   //!< the job to Parse Fee cluster header
    FEE_INT_SCAN_CLR_JOB,             //!< the job to Scan active cluster of current cluster group
    FEE_INT_SCAN_CLR_FMT_JOB,         //!< the job to Format first Fee cluster
    FEE_INT_SCAN_CLR_FMT_DONE_JOB,    //!< the job to Finalize format of first Fee cluster
    FEE_INT_SCAN_BLOCK_HDR_PARSE_JOB, //!< the job to Parse Fee block header

    FEE_INT_SWAP_BLOCK_JOB,        //!< the job to Copy next block from source to target cluster
    FEE_INT_SWAP_CLR_FMT_JOB,      //!< the job to Format current Fee cluster in current Fee cluster group
    FEE_INT_SWAP_DATA_READ_JOB,    //!< the job to Read data from source cluster to internal Fee buffer
    FEE_INT_SWAP_DATA_WRITE_JOB,   //!< the job to Write data from internal Fee buffer to target cluster
    FEE_INT_SWAP_CLR_VLD_DONE_JOB, //!< the job to Finalize cluster validation

    FEE_COMPLETE_JOB //!< the job to indicate job has complete,No more subsequent jobs to schedule
} Fee_JobType;

/**@} end of group FEE_Enumerations */

/**********************************************************************************************************************
                    STRUCT DEFINITION
**********************************************************************************************************************/
/** @defgroup FEE_Structure
  @{
*/

/**
 * @brief    ths Information of Fee block
 */
typedef struct
{
    Fls_AddressType     dataAddr;    //!< Address of Fee block data in flash
    Fls_AddressType     invalidAddr; //!< Address of Fee block invalidation field in flash
    Fee_BlockStatusType blockStatus; //!< Current status of Fee block
} Fee_BlkInfoType;

/**
 * @brief    ths Information of Fee cluster group
 */
typedef struct
{
    Fls_AddressType dataAddrCur; //!< current Address of Fee data block in flash
    Fls_AddressType hdrAddrCur;  //!< current Address of Fee block header in flash
    uint32          actClrID;    //!< the active cluster ID
    uint8           actClr;      //!< the active cluster index
} Fee_ClrGrpInfoType;

/**@} end of group FEE_Structure */

#ifdef __cplusplus
}
#endif

#endif

/**@} end of group FEE_Driver */
/**@} end of group G32A10xx_StdPeriphDriver */
