/*
* @file    Fls_Mld.h
*==================================================================================================
*   Project              : YTMicro AUTOSAR 4.4.0 MCAL
*   Platform             : ARM
*   Peripheral           : Fls_Mld
*   Dependencies         : none
*
*   Autosar Version      : V4.4.0
*   Autosar Revision     : ASR_REL_4_4_REV_0000
*   SW Version           : V0.8.0
*
*   (c) Copyright 2020-2026 Yuntu Microelectronics co.,ltd.
*   All Rights Reserved.
==================================================================================================*/

#ifndef FLS_MLD_H
#define FLS_MLD_H

#ifdef __cplusplus
extern "C" {
#endif

/*==================================================================================================
                                              INCLUDE FILES
==================================================================================================*/
#include "Fls_Types.h"
/*==================================================================================================
                                      HEADER FILE VERSION INFORMATION
==================================================================================================*/
#define FLS_MLD_VENDOR_ID                     (180)
#define FLS_MLD_AR_REL_MAJOR_VER              (4)
#define FLS_MLD_AR_REL_MINOR_VER              (4)
#define FLS_MLD_AR_REL_REVISION_VER           (0)
#define FLS_MLD_SW_MAJOR_VER                  (0)
#define FLS_MLD_SW_MINOR_VER                  (8)
#define FLS_MLD_SW_PATCH_VER                  (0)
/*==================================================================================================
                                                DEFINES AND MACROS
==================================================================================================*/
/*==================================================================================================
                                                EXTERNAL CONSTANTS
==================================================================================================*/
/*==================================================================================================
                                                ENUMS
==================================================================================================*/
/*==================================================================================================
                                                FUNCTION PROTOTYPES
==================================================================================================*/
/**
 * @brief   Initializes the Flash module and device. This function initializes the internal/extern 
 *          flash device and the QSPI controller.
 * @autosar          N/A
 *
 * @details          Service ID: --
 *                   Sync/Async: Synchronous
 *                   Reentrancy: Non Reentrant
 *                   Available via: Fls_Mld.c
 *
 * @return            void
*/
void Fls_Mld_Init(void);

/**
 * @brief   Aborts the flash module and device.This function aborts the internal/extern flash 
 *          device operation.
 * @autosar          N/A
 *
 * @details          Service ID: --
 *                   Sync/Async: Synchronous
 *                   Reentrancy: Non Reentrant
 *                   Available via: Fls_Mld.c
 *
 * @return            void
 */
void Fls_Mld_AbortSuspended(void);

/**
 * @brief   Cancels the flash module operation. This function cancels the internal/extern flash
 *          device operation.
 * @details          Service ID: --
 *                   Sync/Async: Synchronous
 *                   Reentrancy: Non Reentrant
 *                   Available via: Fls_Mld.c
 *
 * @return           void
 */
void Fls_Mld_Cancel(void);
/**
 * @brief Process ongoing erase or write hardware job.
 *              In case Async Operation is ongoing this function will complete the following job:
 *                 - Erase
 *                 - Erase on Interleaved sectors
 *                 - Write
 *                 - Erase blank Check
 * @autosar          N/A
 *
 * @details          Service ID: --
 *                   Sync/Async: Synchronous
 *                   Reentrancy: Non Reentrant
 *                   Available via: Fls_Mld.c
 *
 * @return           void
 */
void Fls_Mld_MainFunction(void);

/**
 * @brief            Route Fls read, blank check, compare job to appropriate lld function.
 * @autosar          N/A
 *
 * @details          Service ID: --
 *                   Sync/Async: Synchronous
 *                   Reentrancy: Non Reentrant
 *                   Available via: Fls_Mld.c
 *
 * @param[in]        SectorOffset: Offset within target flash sector for read/compare/blank check
 * @param[in]        Length: Length of data to read/compare/blank check
 * @param[out]       JobDataDestPtr: Buffer ptr for read data (NULL for compare/blank check)
 * @param[in]        JobDataSrcPtr: Data ptr for compare (NULL for read/blank check)
 * @return           Fls_Lld_ReturnType
 *                       Return ok/failed/inconsistent status of read/compare/blank check.
 */
Fls_Lld_ReturnType Fls_Mld_SectorRead(const Fls_AddressType SectorOffset,
                                      const Fls_AddressType Length,
                                      uint8 *JobDataDestPtr,
                                      const uint8 *JobDataSrcPtr
                                     );

/**
 * @brief            Route the erase job to appropriate Lld function.
 * @autosar          N/A
 *
 * @details          Service ID: --
 *                   Sync/Async: Synchronous
 *                   Reentrancy: Non Reentrant
 *                   Available via: Fls_Mld.c
 *
 * @param[in]        SectorOffset: Offset within target flash sector for erase;
 * @param[in]        PhysicalSectorSize: Size of target flash sector for erase;
 * @param[in]        Asynch: TRUE for async erase, FALSE for sync erase.
 * @return           Fls_Lld_ReturnType
 *                       Return ok/failed/pending status of sector erase
 */
Fls_Lld_ReturnType Fls_Mld_SectorErase(const Fls_AddressType SectorOffset,
                                       const Fls_LengthType PhysicalSectorSize,
                                       const boolean Asynch
                                      );

/**
 * @brief            Route the write job to appropriate Lld function.
 * @autosar          N/A
 *
 * @details          Service ID: --
 *                   Sync/Async: Synchronous
 *                   Reentrancy: Non Reentrant
 *                   Available via: Fls_Mld.c
 *
 * @param[in]        SectorOffset: Offset within target flash sector for write;
 * @param[in]        Length: Length of data to write;
 * @param[in]        JobDataSrcPtr: Source data pointer for sector write;
 * @param[in]        Asynch: TRUE for async write, FALSE for sync write.
 * @return           Fls_Lld_ReturnType
 *                       Return ok/failed/pending status of sector write.
 */
Fls_Lld_ReturnType Fls_Mld_SectorWrite(const Fls_AddressType SectorOffset,
                                       const Fls_AddressType Length,
                                       const uint8 *JobDataSrcPtr,
                                       const boolean Asynch
                                      );
#ifdef __cplusplus
}
#endif

#endif /* End of file Fls_Mld.h */

