// >>>>>>>>>>>>>>>>>>>>>>> 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. // ------------------------------------------------------------------ #include "uart.h" #include "pic.h" #include "utils.h" #include #include #include "ltcusb.h" void fault_test(int result); void fault_handler(); struct uart_instance uart_core_uart; uint32_t ctx_handle = 0x00; static int lscc_uart_putc(char c, FILE *file) { #ifdef LSCC_STDIO_UART_APB int ret = EOF; ret = uart_putc(&uart_core_uart, c); if (c == '\n' && ret == 0) ret = uart_putc(&uart_core_uart, '\r'); return ret; #else return EOF; #endif } static int lscc_uart_getc(FILE *file) { (void) file; return EOF; } static int lscc_uart_flush(FILE *file) { (void) file; return 0; } // Request Interrupt Service Routine void Request_Buffer_isr_handler(void *ctx) { g_request_interrupt_flag = 1; pic_int_clear(S_INT_PIC2); ctx_handle = *(uint32_t*)ctx; } // Event Interrupt Service Routine void Event_Buffer_isr_handler(void *ctx) { g_event_interrupt_flag = 1; pic_int_clear(S_INT_PIC1); ctx_handle = *(uint32_t*)ctx; } void fault_handler() { volatile int a = 1; while(a != 0) { a++; if(a == 0) { a = 1; } } return; } void fault_test(int result) { if(!result) { return; } printf("\r\nFT:%d",result); fault_handler(); } void print_buf(void* addr, uint16_t size) { if(!g_uart_enable) { return; } uint8_t* t = (uint8_t*)addr; for(int i=0;i