Altera_Forum
Honored Contributor
16 years agoaccessing hardware - a smart start?
Hello everyone.
I am using the DE2 2C35 Board with uClinux NOMMU an DE2_NET.sof and ptf. I would like to ask for a smart way to start developing own software. I would like to begin to control the LEDs. I am trying to port the example "Board Diagnostics" Project from Nios2 EDS into Linux. But how to start? I see: led = 0xff; IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, led); printf( "\nAll LEDs should now be on.\n" ); I searched for the defines and found: // altera_avalon_pio_regs.h# define IORD_ALTERA_AVALON_PIO_DATA(base) IORD(base, 0)# define IOWR_ALTERA_AVALON_PIO_DATA(base, data) IOWR(base, 0, data) // io.h# define IORD(BASE, REGNUM) __builtin_ldwio (__IO_CALC_ADDRESS_NATIVE ((BASE), (REGNUM)))# define IOWR(BASE, REGNUM, DATA) __builtin_stwio (__IO_CALC_ADDRESS_NATIVE ((BASE), (REGNUM)), (DATA)) But i am not quiet sure i this is the correct way. Any ideas? Are there examples somewhere how to access the hardware from uclinux?