/*!
 * @file        user_fls_config.h
 *
 * @brief       FLASH configurations
 *
 * @version     V1.0.0
 *
 * @date        2026-03-25
 *
 * @attention
 *
 *  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 useful and instructional for customers to develop
 *  their software. Unless required by applicable law or agreed to in
 *  writing, the program is distributed in 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 USER_FLS_CONFIG_H
#define USER_FLS_CONFIG_H

#include "Board.h"

#ifdef __cplusplus
extern "C" {
#endif
    
/* Includes */
#include "g32a10xx_fls.h"
#include "g32a10xx_eint.h"

/** @addtogroup Examples
  @{
*/

/** @addtogroup FLASH_Examples
  @{
*/

/** @addtogroup FMC_Flash_WriteProtection
  @{
*/

/** @defgroup FMC_Flash_WriteProtection_Macros Macros
  @{
*/

/* Debug USART interface */
#define DEBUG_USART              USART1

/* Flash test address */
#define FLS_TEST_ADDR            (0x08040000U)
#define FLS_OPTION_BYTE_ADDR     (0x1FFFF800U)

/* Test data definition */
#define TEST_FLAG_DATA           (0xAAAAAAAAU)
#define TEST_DATA_0              (0xAAAAAAAAU)
#define TEST_DATA_1              (0x55555555U)

/* Write protection configuration value */
#define WRP_PFLASH_UNPROTECT     (0xFFU)
#define WRP_PFLASH_PROTECT       (0x00U)
#define WRP_DFLASH_UNPROTECT     (0xFFU)
#define WRP_DFLASH_PROTECT       (0x00U)

/**@} end of group FMC_Flash_WriteProtection_Macros*/

/** @defgroup FMC_Flash_WriteProtection_Variables Variables
  @{
*/

/* Option byte default configuration */
extern Fmc_User_ConfigType g_ob_default_config;

/* PFLASH write protection configuration */
extern const Fmc_Wrpp_ConfigType g_wrp_pflash_config;

/* DFLASH write protection configuration */
extern const Fmc_Wrpd_ConfigType g_wrp_dflash_config;

/* PFLASH write protection restore configuration */
extern const Fmc_Wrpp_ConfigType g_wrp_pflash_restore;

/* DFLASH write protection restore configuration */
extern const Fmc_Wrpd_ConfigType g_wrp_dflash_restore;

/**@} end of group FMC_Flash_WriteProtection_Variables*/

/** @defgroup FMC_Flash_WriteProtection_Functions Functions
  @{
*/

/* Interrupt service function declaration */
void Eint_RestoreWrpIsr(void);

/**@} end of group FMC_Flash_WriteProtection_Functions*/
/**@} end of group FMC_Flash_WriteProtection*/
/**@} end of group Examples*/

#ifdef __cplusplus
}
#endif

#endif /* __USER_FLS_CONFIG_H */
