FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.

DE2-115 Nios device led demo

Altera_Forum
Honored Contributor II
814 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
103 Views

read this code carefully···

Reply