/*
 * @file exo_ahw_vdp_mt25ql512.h
 *
 * @brief This file contains the function prototype of mt25ql512 memory chip
 *
 * @copyright Copyright 2023 Antaris, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _INC_EXO_AHW_VDP_MT25QL512_H_
#define _INC_EXO_AHW_VDP_MT25QL512_H_

#include "exo_ahw_al_ext_flash_common.h"

/**
 * @brief  Wrapper API of mt25ql512 to initialize the external flash memory
 * @param[in]al_em_h : structure handle of external flash memory handle.
 * @retval hal_ret_sts - returns the success or error code
 */
hal_ret_sts	ahw_al_vdp_mt25ql512_init(ahw_al_ext_mem_hdl *al_em_h);

/**
 * @brief  Wrapper API of mt25ql512 to write data in external flash memory
 * @param[in]al_em_h : structure handle of external flash memory handle.
 * @param address : memory address where the data will be written
 * @param data    : input data buffer to be written in address
 * @param size    : Number of data to be written
 * @retval hal_ret_sts - returns the success or error code
 */
hal_ret_sts ahw_vdp_mt25ql512_write(ahw_al_ext_mem_hdl *al_em_h, uint32_t address, uint8_t *data, uint32_t size);

/**
 * @brief Wrapper API of mt25ql512 to read from external flash memory
 * @param[in]al_em_h : structure handle of external flash memory handle.
 * @param address : memory address where the data will be read
 * @param data    : output data buffer to be used to hold read data from external flash memory
 * @param size    : Number of data to be read
 * @retval hal_ret_sts - returns the success or error code
 */
hal_ret_sts ahw_vdp_mt25ql512_erase(ahw_al_ext_mem_hdl *al_em_h, uint32_t start_address, uint32_t end_address);

/**
 * @brief Wrapper API of mt25ql512 to erase external flash memory
 * @param[in]al_em_h : structure handle of external flash memory handle.
 * @param start_address  : erase start address
 * @param end_address    : erase end address
 * @retval hal_ret_sts - returns the success or error code
 */
hal_ret_sts ahw_vdp_mt25ql512_read(ahw_al_ext_mem_hdl *al_em_h, uint32_t address, uint8_t *data, uint32_t size);

/**
 * @brief Wrapper API of mt25ql512 to enable memory mapped mode
 * @param[in]al_em_h : structure handle of external flash memory handle.
 * @retval hal_ret_sts - returns the success or error code
 */
hal_ret_sts ahw_vdp_mt25ql512_memmap_enable(ahw_al_ext_mem_hdl *al_em_h);


/**
 * @brief  Wrapper API of mt25ql512 to Re-initialize the external flash memory
 * @param[in]al_em_h : structure handle of external flash memory handle.
 * @retval hal_ret_sts - returns the success or error code
 */
hal_ret_sts	ahw_al_vdp_mt25ql512_reinit(ahw_al_ext_mem_hdl *al_em_h);



#endif /* _INC_EXO_AHW_VDP_MT25QL512_H_ */
