/**
 * @file ft_sender.h
 *
 * @brief This file contains function prototypes of flash drive APIs
 *
 * @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 FLASH_DRIVE_H_
#define FLASH_DRIVE_H_


//#include "stm32f7xx_hal.h"
#include "flash_sector.h"
#include "stdint.h"


/******************************************************************************/
/*               Declaration of global function prototypes                    */
/******************************************************************************/


/**
 * @brief This function used to write data to internal flash address for required size
 *
 * @param[in]  StartSectorAddress : Internal flash address
 * @param[in]  Data : pointer to data buffer to write in flash
 * @param[in]  numberofwords : length of data to write in word
 *
 * @return status of write operation
 * @retval success if returns 1
 */
uint32_t Flash_Write_Data (uint32_t StartSectorAddress, uint32_t *Data, uint32_t numberofwords);

/**
 * @brief This function used to erase data from internal flash address for required size
 *
 * @param[in]  StartSectorAddress : Internal flash address
 * @param[in]  numberofwords : length of data to write in word
 *
 * @return status of erase operation
 * @retval success if returns 1
 */
uint32_t Flash_Erase_Data (uint32_t StartSectorAddress, uint32_t numberofwords);

/**
 * @brief This function used to erase sectors in internal flash
 *
 * @param[in]  sector_name : Internal flash sector ID
 *
 * @return status of sector erase operation
 * @retval success if returns 1
 */
uint32_t Flash_Erase_Sector (uint8_t sector_name);

void 	 Flash_api_registeration(void);



typedef struct flash_api_def
{
	uint32_t (*Flash_Write_Data_fp) (uint32_t, uint32_t *, uint16_t );
	uint32_t (*Flash_Erase_Data_fp) (uint32_t , uint16_t );
	uint32_t (*Flash_Erase_Sector_fp) (uint8_t );
}s_flash_api_def;

#endif /* FLASH_DRIVE_H_ */
