/** * @file device_soft_rst.h * @brief Initialize the controller on Power On or Soft Reset. * @note * * ------------------------------------------------------------------ Copyright (c) 2023 by Lattice Semiconductor Corporation ALL RIGHTS RESERVED ------------------------------------------------------------------ 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 SRC_DEVICE_SOFT_RST_H_ #define SRC_DEVICE_SOFT_RST_H_ #include "ltcusb.h" #include "rv_delay.h" #include "ltcusb_command.h" #include #include #include "trb_fifo.h" /** * @brief Device Power On or Soft reset * * Implemented as per the section 4.1.1 for the document Programming DWC_usb3 * in device mode. * @return 0 when success, a negative value when failed. * @retval -1 DCTL.CSFTRST unable to low by hardware, retry count reached. * @retval -2 Geventadr init failed. * @retval -3 Geventadr get failed. * @retval -4 Get event address from hardware didn't matched with set address. * @retval -5 Set Gevent size failed. * @retval -6 Get Gevent size failed. * @retval -7 Event size mismatched. * @retval -8 Gevent count failed. * @retval -9 Gevent count get failed. * @retval -10 Gevent count mismatched. * @retval -11 GCTL register write failed. * @retval -12 DCTL register write failed. * @retval -13 DCFG write failed. * @retval -14 DEVTEN write failed. * @retval -15 DEPSTARTCFG Command failed. * @retval -16 DCTL register read failed. * @retval -17 DALEPENA register write failed. * @retval -18 DCTL register write failed after RUN STOP. * @retval -19 DEPCFG command failed for EP0. * @retval -20 DEPCFG command failed for EP1. * @retval -21 DEPXFERCFG command failed for EP0. * @retval -22 DEPXFERCFG command failed for EP1. * @retval -23 TRB_control_setup failed. * @retval -24 Register at offset (0x000100AC) write failed. * @retval -25 Register at offset (0x0001008C) write failed. */ extern int device_power_on_soft_rst(void); #endif /* SRC_DEVICE_SOFT_RST_H_ */