/** ********************************************************************************************************* * Copyright(c) 2016, Realtek Semiconductor Corporation. All rights reserved. ********************************************************************************************************* * @file flash_device.h * @brief This file contains structures the functions regarding flash device. * @author Brenda_li * @date 2016-11-9 * @version v1.0 ****************************************************************************** * @attention * * This module is a confidential and proprietary property of RealTek and * possession or use of this module requires written permission of RealTek. * * Copyright(c) 2016, Realtek Semiconductor Corporation. All rights reserved. ****************************************************************************** */ /***************************************************************************************** * Introduction ***************************************************************************************** * - Flash function would be splitted into two modules: flash_driver and flash_device * - flash_driver will handle flash_spic register to provide flash basic read/write function * - flash_device would provide flash layout or other functions. ******************************************************************************************/ #ifndef _FLASH_DEVICE_H #define _FLASH_DEVICE_H /*============================================================================* * Header Files *============================================================================*/ #include #include /** @defgroup FLASH_DEVICE Flash Device * @brief Flash image layout and APIs * @{ */ /*============================================================================* * Macros *============================================================================*/ /** @defgroup FLASH_DEVICE_Exported_Macros Flash Device Exported Macros * @brief * @{ */ #define FMC_PAGE_SIZE 0x1000 #define FMC_SEC_SECTION_LEN (4 * 1024) #define FMC_BLK_SECTION_LEN (64 * 1024) #define FMC_ERASE_PATTERN (0xffffffff) #if (IC_TYPE == IC_TYPE_BEE3) #define FLASH_OFFSET_TO_NO_CACHE 0x01000000 /*!< memory offset between no cache and cache flash address */ #elif (IC_TYPE == IC_TYPE_SBEE2) #define FLASH_OFFSET_TO_NO_CACHE 0x04000000 #endif //leverage config signature from bee1 #define SIGNATURE_CONFIG 0x8721bee2 /******** bit definitions of hardfault configuration ********/ #define BIT_ENABLE_SAVE_HARDFAULT 0x00000001 /* BIT0 */ #define BIT_ENABLE_DUMP_HARDFAULT 0x00000004 /* BIT2 */ #define BIT_CLEAR_HISTROY_AFTER_DUMP 0x00000008 /* BIT3 */ #define BIT_CLEAR_HISTROY_BEFORE_SAVING 0x00000010 /* BIT4 */ /** End of FLASH_DEVICE_Exported_Macros * @} */ /*============================================================================* * Types *============================================================================*/ /** @defgroup FLASH_DEVICE_Exported_Types Flash Device Exported Types * @brief * @{ */ /******************** flash erase type ******************* FLASH_ERASE_CHIP: erase whole chip FLASH_ERASE_SECTOR: erase specified sector(page, 4K always) FLASH_ERASE_BLOCK: erase specified block(16 sector always) ****************************************************************/ typedef enum { FLASH_ERASE_CHIP = 1, /*!