/* ================================================================== >>>>>>>>>>>>>>>>>>>>>>> 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 BSP_DRIVER_RISCV_CPU_H_ #define BSP_DRIVER_RISCV_CPU_H_ #define PLIC_BASE 0xFC000000L #define PLIC_PRIORITY(id) *(uint32_t*)(PLIC_BASE + (id) * 4) #define PLIC_PENDING(id) (PLIC_BASE + 0x1000 + ((id) / 32) * 4) #define PLIC_ENABLE_M(hart) *(uint32_t*)(PLIC_BASE + 0x2000) #define PLIC_ENABLE_S(hart) *(uint32_t*)(PLIC_BASE + 0x2000 + 0x80) #define PLIC_MTHRESHOLD(hart) (PLIC_BASE + 0x200000 + (hart) * 0x1000) #define PLIC_MCLAIM(hart) (PLIC_BASE + 0x200004 + (hart) * 0x1000) #define PLIC_MCOMPLETE(hart) (PLIC_BASE + 0x200004 + (hart) * 0x1000) #define PLIC_STHRESHOLD(hart) (PLIC_BASE + 0x201000 + (hart) * 0x1000) #define PLIC_SCLAIM(hart) (PLIC_BASE + 0x201004 + (hart) * 0x1000) #define PLIC_SCOMPLETE(hart) (PLIC_BASE + 0x201004 + (hart) * 0x1000) #define CLINT_BASE 0xF2000000L #define CLINT_MSIP(hartid) *(uint32_t*)(CLINT_BASE + 4 * (hartid)) #define CLINT_MTIMECMP_L(hartid) *(uint32_t*)(CLINT_BASE + 0x4000 + 8 * (hartid)) #define CLINT_MTIMECMP_H(hartid) *(uint32_t*)(CLINT_BASE + 0x4004 + 8 * (hartid)) #define CLINT_MTIME_L *(uint32_t*)(CLINT_BASE + 0xBFF8) // cycles since boot. #define CLINT_MTIME_H *(uint32_t*)(CLINT_BASE + 0xBFFC) #define CLINT_WDCSR *(uint32_t*)(CLINT_BASE + 0xD000) #define CLINT_TIMEBASE_FREQ 32000 #endif /* BSP_DRIVER_RISCV_CPU_H_ */