/* * depcmdpar_reg.c * * Created on: 21-Apr-2023 * Author: pushpkant */ #include "ltcusb_raw_rw.h" #include "ltcusb_regs.h" #include "GenMac.h" static DEPCMDPAR_data_reg *depcmdpar_reg; int depcmdpar_set(uint32_t endpoint, uint32_t par_number, uint32_t parameter) { if(par_number > 2) { return -1; } if(endpoint >= DWC_USB3_NUM_EPS) { return -2; } uintptr_t reg_offset = (DEPCMDPAR0_OFFSET - (par_number * 0x4)) + (endpoint * 0x10); depcmdpar_reg = reg_setup(reg_offset); depcmdpar_reg->PARAMETER = parameter; ltcusb_raw_write(); return 0; } int depcmdpar_get(uint32_t endpoint, uint32_t par_number, uint32_t *parameter) { if(par_number > 2) { return -1; } if(endpoint >= DWC_USB3_NUM_EPS) { return -2; } uintptr_t reg_offset = (DEPCMDPAR0_OFFSET - (par_number * 0x4)) + (endpoint * 0x10); depcmdpar_reg = reg_setup(reg_offset); *parameter = depcmdpar_reg->PARAMETER; return 0; }