FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
5925 Discussions

DE2-115 Nios device led demo

Altera_Forum
Honored Contributor II
1,023 Views

Hello ,  

 

I am running a demo which uses the usb device controller in the kit .  

The PC is acting as a host and the kit as a usb device . 

 

 

This is the main file : 

 

LCD_Test(); disable(); disconnect_USB(); usleep(1000000); Hal4D13_ResetDevice(); bUSBCheck_Device_State.State_bits.DEVICE_DEFAULT_STATE = 1; bUSBCheck_Device_State.State_bits.DEVICE_ADDRESS_STATE = 0; bUSBCheck_Device_State.State_bits.DEVICE_CONFIGURATION_STATE = 0; bUSBCheck_Device_State.State_bits.RESET_BITS = 0; usleep(1000000); reconnect_USB(); CHECK_CHIP_ID(); Hal4D13_AcquireD13(USB_DC_IRQ,(void*)usb_isr); enable(); bD13flags.bits.verbose=1; while (1) { if (bUSBCheck_Device_State.State_bits.RESET_BITS == 1) { disable(); break; } if (bD13flags.bits.suspend) { disable(); bD13flags.bits.suspend= 0; enable(); suspend_change(); } // Suspend Change Handler if (bD13flags.bits.DCP_state == USBFSM4DCP_SETUPPROC) { disable(); SetupToken_Handler(); enable(); } // Setup Token Handler if ((bD13flags.bits.DCP_state == USBFSM4DCP_REQUESTPROC) && !ControlData.Abort) { disable(); bD13flags.bits.DCP_state = 0x00; DeviceRequest_Handler(); enable(); } // Device Request Handler usleep(1); } return 0; }  

 

 

I know what functions generally do but I hope that somebody explains why it's written in that sequence and I don't understand how the driver generally works .
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
312 Views

read this code carefully···

0 Kudos
Reply