/* ================================================================== >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<< ------------------------------------------------------------------ Copyright (c) 2019-2023 by Lattice Semiconductor Corporation ALL RIGHTS RESERVED ------------------------------------------------------------------ IMPORTANT: THIS FILE IS USED BY OR GENERATED BY the LATTICE PROPELâ„¢ DEVELOPMENT SUITE, WHICH INCLUDES PROPEL BUILDER AND PROPEL SDK. Lattice grants permission to use this code pursuant to the terms of the Lattice Propel License Agreement. DISCLAIMER: LATTICE MAKES NO WARRANTIES ON THIS FILE OR ITS CONTENTS, WHETHER EXPRESSED, IMPLIED, STATUTORY, OR IN ANY PROVISION OF THE LATTICE PROPEL LICENSE AGREEMENT OR COMMUNICATION WITH LICENSEE, AND LATTICE SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. LATTICE DOES NOT WARRANT THAT THE FUNCTIONS CONTAINED HEREIN WILL MEET LICENSEE 'S REQUIREMENTS, OR THAT LICENSEE' S OPERATION OF ANY DEVICE, SOFTWARE OR SYSTEM USING THIS FILE OR ITS CONTENTS WILL BE UNINTERRUPTED OR ERROR FREE, OR THAT DEFECTS HEREIN WILL BE CORRECTED. LICENSEE ASSUMES RESPONSIBILITY FOR SELECTION OF MATERIALS TO ACHIEVE ITS INTENDED RESULTS, AND FOR THE PROPER INSTALLATION, USE, AND RESULTS OBTAINED THEREFROM. LICENSEE ASSUMES THE ENTIRE RISK OF THE FILE AND ITS CONTENTS PROVING DEFECTIVE OR FAILING TO PERFORM PROPERLY AND IN SUCH EVENT, LICENSEE SHALL ASSUME THE ENTIRE COST AND RISK OF ANY REPAIR, SERVICE, CORRECTION, OR ANY OTHER LIABILITIES OR DAMAGES CAUSED BY OR ASSOCIATED WITH THE SOFTWARE.IN NO EVENT SHALL LATTICE BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS FILE OR ITS CONTENTS, EVEN IF LATTICE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. LATTICE 'S SOLE LIABILITY, AND LICENSEE' S SOLE REMEDY, IS SET FORTH ABOVE. LATTICE DOES NOT WARRANT OR REPRESENT THAT THIS FILE, ITS CONTENTS OR USE THEREOF DOES NOT INFRINGE ON THIRD PARTIES' INTELLECTUAL PROPERTY RIGHTS, INCLUDING ANY PATENT. IT IS THE USER' S RESPONSIBILITY TO VERIFY THE USER SOFTWARE DESIGN FOR CONSISTENCY AND FUNCTIONALITY THROUGH THE USE OF FORMAL SOFTWARE VALIDATION METHODS. ------------------------------------------------------------------ ================================================================== */ #ifndef IFC_H #define IFC_H #include #include #include #define Internal_Flash_Controller_Driver_Version "v1.0.0.0" #define MAX_CFG_NUM 3 #define MAX_UFM_NUM 3 #define MAX_USERDATA_NUM 9 #define PAGE_SIZE 256 #define BLOCK_SIZE 0x10000 #define MIN_WORDS_NUM 4 #define MIN_AEMPTY_FLAG 1 #define MIN_USERDATA_NUM 0x06 #define MAX_USERDATA_NUM 0x0e #define CFG_SIZE_1 0 #define CFG_SIZE_2 11 #define CFG_SIZE_3 1 #define UFM_SIZE_1 0 #define UFM_SIZE_2 4 #define MAX_CFG_UFM_SIZE 15 #define MAX_USERDATA_SIZE 18 struct ifc_instance { uint32_t base_addr; uint32_t trans_addr; uint32_t trans_partition; uint32_t cfg_size[MAX_CFG_NUM];//block size(0/11/15) uint32_t ufm_size[MAX_UFM_NUM];//block size(0/4) if cfg0 is set to 15 ,ufm0 is automaticallyset to 0 uint32_t userdata_size[MAX_USERDATA_NUM];//if a partition is set to 0 the succeeding partitions cannot be used uint8_t wr_fifo_depth; uint8_t wr_fifo_aempty_flag; uint8_t status; }; //err code typedef enum { /* basic errors */ SUCCESS = 0, /**< No error condition. */ PTR_ERROR = 1, /**< PTR is NULL. */ /* Boundary Check Errors */ CFG_ERROR = 2, /**< CFG initialization boundary error. */ UFM_ERROR = 3, /**< UFM initialization boundary error. */ USERDATA_ERROR = 4, /**< USERDATA initialization boundary error. */ CFG_UFM_ERROR = 5, /**< UFM+CFG initialization boundary error. */ CFG_ACCESS_FAILED = 6, /**< CFG access out of bounds. */ UFM_ACCESS_FAILED = 7, /**< UFM access out of bounds. */ USERDATA_ACCESS_FAILED = 8, /**< USERDATA access out of bounds. */ STATUS_ERROR = 9, /**