/* * gevntcount_reg.c * * Created on: 21-Apr-2023 * Author: pushpkant */ #include "ltcusb_regs_ops.h" static GEVNTCOUNT_data gevntcount; int gevntcount_init(uint32_t device_number, uint32_t event_count, uint32_t event_hndlr_busy) { if(device_number >= DWC_USB3_DEVICE_NUM_INT) { return -1; } uintptr_t reg_offset = GEVNTCOUNT_OFFSET + (device_number * 0x10); gevntcount.dev[device_number] = reg_setup(reg_offset); event_count &= 0xFFFF; gevntcount.dev[device_number]->EVNTCOUNT = (uint16_t)(event_count & 0xFFFF); gevntcount.dev[device_number]->EVNT_HANDLER_BUSY = (event_hndlr_busy?true:false); ltcusb_raw_write(); return 0; } int gevntcount_get(uint32_t device_number, uint32_t *event_count, uint32_t *event_hndlr_busy) { if(device_number >= DWC_USB3_DEVICE_NUM_INT) { return -1; } uintptr_t reg_offset = GEVNTCOUNT_OFFSET + (device_number * 0x10); gevntcount.dev[device_number] = reg_setup(reg_offset); *event_count = gevntcount.dev[device_number]->EVNTCOUNT; *event_hndlr_busy = gevntcount.dev[device_number]->EVNT_HANDLER_BUSY; return 0; }