/* * ------------------------------------------------------------------ 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. ------------------------------------------------------------------ * */ #include "ltcusb_regs_ops.h" static GEVNTSIZ_data gevntsiz; int gevntsiz_init(uint32_t device_number, uint32_t event_size, uint32_t event_intr_mask) { if(device_number >= DWC_USB3_DEVICE_NUM_INT) { return -1; } uintptr_t reg_offset = GEVNTSIZ_OFFSET + (device_number * 0x10); gevntsiz.dev[device_number] = reg_setup(reg_offset); event_size &= 0xFFFC; //event size must be 16 bit wide and divisible by 4 gevntsiz.dev[device_number]->EVENTSIZ = (uint16_t)(event_size & 0xFFFF); gevntsiz.dev[device_number]->EVNTINTRPTMASK = (event_intr_mask?true:false); ltcusb_raw_write(); return 0; } int gevntsiz_get(uint32_t device_number, uint32_t *event_size, uint32_t *event_intr_mask) { if(device_number >= DWC_USB3_DEVICE_NUM_INT) { return -1; } uintptr_t reg_offset = GEVNTSIZ_OFFSET + (device_number * 0x10); gevntsiz.dev[device_number] = reg_setup(reg_offset); *event_size = gevntsiz.dev[device_number]->EVENTSIZ; *event_intr_mask = gevntsiz.dev[device_number]->EVNTINTRPTMASK; return 0; }