[#ftl]
/**
  ******************************************************************************
  * @file    nvms_low_level.h
  * @author  MCD Application Team
  * @brief   This file contains definitions for Key Management Services (KMS)
  *          module NVM Low Level access to physical storage (Flash...)
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
  * All rights reserved.</center></h2>
  *
  * This software component is licensed by ST under Ultimate Liberty license
  * SLA0044, the "License"; You may not use this file except in compliance with
  * the License. You may obtain a copy of the License at:
  *                             www.st.com/SLA0044
  *
  ******************************************************************************
  */

#ifndef NVMS_LOW_LEVEL_H
#define NVMS_LOW_LEVEL_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
/* USER CODE BEGIN NVMS_LOW_LEVEL_Includes */
/* USER CODE END NVMS_LOW_LEVEL_Includes */

/** @addtogroup Key_Management_Services Key Management Services (KMS)
  * @{
  */

/** @addtogroup KMS_NVMLL NVM Low Level access
  * @{
  */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN NVMS_LOW_LEVEL_Exported_Types */
/* USER CODE END NVMS_LOW_LEVEL_Exported_Types */

/** @addtogroup KMS_NVMLL_Exported_Types Exported Types
  * @{
  */

/**
  * @brief   Block identifiers.
  */
typedef enum
{
  NVMS_BLOCK0 = 0,    /*!< Block ID 0 */
  NVMS_BLOCK1 = 1,    /*!< Block ID 1 */
} nvms_block_t;

/**
  * @}
  */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN NVMS_LOW_LEVEL_Exported_Constants */
/* USER CODE END NVMS_LOW_LEVEL_Exported_Constants */

/** @addtogroup KMS_NVMLL_Exported_Constants Exported Constants
  * @{
  */

#define NVMS_LL_ERASED           0xFFFFFFFFU    /*!< Value used to notifies data has been erased */

/**
  * @brief NVM writing granularity size
  * @note  Not physical flash page size, but writing granularity size -> 8 bytes
  */
#define NVMS_LL_PAGE_SIZE    8


/**
  * @}
  */


/* Exported functions prototypes ---------------------------------------------*/
/* USER CODE BEGIN NVMS_LOW_LEVEL_Exported_Function_Prototypes */
/* USER CODE END NVMS_LOW_LEVEL_Exported_Function_Prototypes */

/** @addtogroup KMS_NVMLL_Exported_Functions Exported Functions
  * @{
  */
void NVMS_LL_Init(void);
bool NVMS_LL_IsBlockErased(nvms_block_t block);
bool NVMS_LL_BlockErase(nvms_block_t block);
bool NVMS_LL_Write(const uint8_t *source, uint8_t *destination, size_t size);

/* Exported in line functions ------------------------------------------------*/
/* USER CODE BEGIN NVMS_LOW_LEVEL_Exported_In_Line_Function */
/* USER CODE END NVMS_LOW_LEVEL_Exported_In_Line_Function */

/**
  * @brief   Returns the base address of the specified flash block
  * @param   block block identifier
  * @retval  pointer to the block base
  */
/* Template version */
static inline uint32_t NVMS_LL_GetBlockAddress(nvms_block_t block)
{
  /* USER CODE BEGIN NVMS_LL_GetBlockAddress */
  return 0UL;
  /* USER CODE END NVMS_LL_GetBlockAddress */
}

/**
  * @brief   Returns the size of the flash blocks
  * @note    Blocks are required to be of equal size
  * @retval  Block size
  */
/* Template version */
static inline size_t NVMS_LL_GetBlockSize(void)
{
  /* USER CODE BEGIN NVMS_LL_GetBlockSize */
  return 0;
  /* USER CODE END NVMS_LL_GetBlockSize */
}

/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

#ifdef __cplusplus
}
#endif

#endif /* NVMS_LOW_LEVEL_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
