/* * gevntsiz_reg.c * * Created on: 21-Apr-2023 * Author: pushpkant */ #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; }