/* * initialization_on_USB_reset.c * * Created on: 24-Jul-2023 * Author: vivek */ #include "initialization_on_USB_reset.h" int Initialization_on_USB_Reset() { /* * Program device speed [2:0] bits and periodic frame interval * DCFG.DEVSPD=3'b000: High-speed * DCFG.DEVSPD=3'b001: Full-speed * DCFG.DEVSPD=3'b100: Super-speed */ DCFG_data *dcfg = dcfg_setup(); dcfg ->DEVSPD = (USB_SPEED & 0x7); /**@todo why reserved bit are set, ask FPGA team.*/ dcfg ->reserved_11_10 = 0x2; /* * Refer Table number 1-78 for more information. */ dcfg ->NUMP = 0x4; if(dcfg_write()!=0) { return -1; } return 0; }