/* ================================================================== >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<< ------------------------------------------------------------------ Copyright (c) 2019-2020 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 SPI_MONITOR_H_ #define SPI_MONITOR_H_ struct spi_mon_ctrl { unsigned int config; //0x00 unsigned int control; //0x04 unsigned int reserved0; //0x08 unsigned int reserved1; //0x0C unsigned int irq_status; //0x10 unsigned int irq_enable; //0x14 unsigned int irq_set; //0x18 }; #define MONITOR0_EN (1 << 0) #define MONITOR1_EN (1 << 1) #define MONITOR2_EN (1 << 2) #define MONITOR3_EN (1 << 3) #define MONITOR4_EN (1 << 4) #define MONITOR0_IRQ (1 << 0) #define MONITOR1_IRQ (1 << 4) #define MONITOR2_IRQ (1 << 8) #define MONITOR3_IRQ (1 << 12) #define MONITOR4_IRQ (1 << 16) struct spi_monitor_space { unsigned int control; //0x20 unsigned int start_addr; //0x24 unsigned int end_addr; //0x28 unsigned int reserved0; //0x2C unsigned int reserved1; //0x30 unsigned int reserved2; //0x34 unsigned int reserved3; //0x38 unsigned int reserved4; //0x3C }; struct spi_monitor { unsigned int control; //0x00 unsigned int space_en; //0x04 unsigned int dummy_bytes; //0x08 unsigned int reserved0; //0x0C unsigned int reserved1; //0x10 unsigned int reserved2; //0x14 unsigned int reserved3; //0x18 unsigned int reserved4; //0x1C struct spi_monitor_space space[4]; }; #define MUXSEL_MONITOR (0) #define MUXSEL_INTMASTER (1) #define FLASHA_EN (1 << 4) #define FLASHB_EN (1 << 5) #define INIT_CMD_FILTER (1 << 8) #define ALLOW_4BYTE_ADDR (1 << 9) #define SPACE0_EN (1 << 0) #define SPACE1_EN (1 << 1) #define SPACE2_EN (1 << 2) #define SPACE3_EN (1 << 3) #define ALLOW_PROG_CMDS (1 << 0) #define ALLOW_ERASE_CMDS (1 << 1) #define BLOCK_READ_CMDS (1 << 2) struct spi_exception { unsigned int command; //0x00 unsigned int address; //0x04 }; struct spi_mon_instance { volatile struct spi_mon_ctrl *main; // qspi monitor module global control volatile struct spi_monitor *monitor[5]; // monitor configuration for each device volatile struct spi_exception *exception[5]; // exception info for each monitored device }; //initialize pointer addressing for SPI Monitor unsigned char qspi_mon_init(struct spi_mon_instance *this_spi_monitor, unsigned int base_address); //Configure the monitor IP unsigned char qspi_mon_config(struct spi_mon_instance *this_spi_monitor); // qspi monitor flash select, Update the flash needs to be monitored unsigned char qspi_mon_flash_update(struct spi_mon_instance *this_spi_monitor, unsigned int flash_id, unsigned int flash_select, unsigned int master_select); //White space, control setting from manifest unsigned char qspi_mon_ws_update(struct spi_mon_instance *this_spi_monitor, unsigned int flash_id, unsigned int mon_cntl, unsigned int dummy_num, struct spi_monitor_space *flash_mon_sp); // Get the qspi exceptions from monitor for a specified flash unsigned char qspi_mon_exception_get(struct spi_mon_instance *this_spi_monitor, unsigned int flash_id, unsigned int *command, unsigned int *address); #endif /* SPI_MONITOR_H_ */